submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s491796245
p03828
C++
#include<bits/stdc++.h> typedef long long LL; #define mod 1E9+7 int N; int div[1001]; int main() { scanf("%d", &N); LL ans = 1; for(int i=1;i<=N;i++) { for(int j=1;j*j<=i;j++) { if(i%j==0) { div[j]++; div[i/j]++; } } } for(int i=2;i*i<=N;i++) { if(div[i]) ans*=(div[i]+1); if(ans>mod) ans%=mod; } printf("%lld\n", ans); }
a.cc:5:13: error: 'int div [1001]' redeclared as different kind of entity 5 | int div[1001]; | ^ In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42, from a.cc:1: /usr/include/stdlib.h:992:14: note: previous declaration 'div_t div(int, int)' 992 | extern div_t div (int __numer, int __denom) | ^~~ a.cc: In function 'int main()': a.cc:16:27: warning: pointer to a function used in arithmetic [-Wpointer-arith] 16 | div[j]++; | ^ a.cc:16:27: warning: ISO C++ forbids incrementing a pointer of type 'div_t (*)(int, int) noexcept' [-Wpointer-arith] 16 | div[j]++; | ~~~~~^ a.cc:16:27: error: lvalue required as increment operand 16 | div[j]++; | ^ a.cc:17:29: warning: pointer to a function used in arithmetic [-Wpointer-arith] 17 | div[i/j]++; | ^ a.cc:17:29: warning: ISO C++ forbids incrementing a pointer of type 'div_t (*)(int, int) noexcept' [-Wpointer-arith] 17 | div[i/j]++; | ~~~~~~~^ a.cc:17:29: error: lvalue required as increment operand 17 | div[i/j]++; | ^ a.cc:23:20: warning: pointer to a function used in arithmetic [-Wpointer-arith] 23 | if(div[i]) ans*=(div[i]+1); | ^ a.cc:23:34: warning: pointer to a function used in arithmetic [-Wpointer-arith] 23 | if(div[i]) ans*=(div[i]+1); | ^ a.cc:23:35: warning: pointer to a function used in arithmetic [-Wpointer-arith] 23 | if(div[i]) ans*=(div[i]+1); | ~~~~~~^~ a.cc:23:26: error: invalid operands of types 'LL' {aka 'long long int'} and 'div_t (*)(int, int) noexcept' to binary 'operator*' 23 | if(div[i]) ans*=(div[i]+1); | ~~~^~~~~~~~~~~~ a.cc:23:26: note: in evaluation of 'operator*=(LL {aka long long int}, struct div_t (*)(int, int) noexcept)' a.cc:24:27: error: invalid operands of types 'LL' {aka 'long long int'} and 'double' to binary 'operator%' 24 | if(ans>mod) ans%=mod; | ^ a.cc:24:27: note: in evaluation of 'operator%=(LL {aka long long int}, double)'
s958515306
p03828
C++
#include<bits/stdc++.h> typedef long long LL; #define mod 1E9+7 int N; int div[1001]; int main() { scanf("%d", &N); LL ans = 1; for(int i=1;i<=N;i++) { for(int j=1;j*j<=i;j++) { if(i%j==0) { div[j]++; div[i/j]++; } } } for(int i=2;i*i<=N;i++) { if(div[i]) ans*=(div[i]+1); if(ans>mod) ans%=mod; } printf("%lld\n", ans); }
a.cc:5:13: error: 'int div [1001]' redeclared as different kind of entity 5 | int div[1001]; | ^ In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42, from a.cc:1: /usr/include/stdlib.h:992:14: note: previous declaration 'div_t div(int, int)' 992 | extern div_t div (int __numer, int __denom) | ^~~ a.cc: In function 'int main()': a.cc:16:27: warning: pointer to a function used in arithmetic [-Wpointer-arith] 16 | div[j]++; | ^ a.cc:16:27: warning: ISO C++ forbids incrementing a pointer of type 'div_t (*)(int, int) noexcept' [-Wpointer-arith] 16 | div[j]++; | ~~~~~^ a.cc:16:27: error: lvalue required as increment operand 16 | div[j]++; | ^ a.cc:23:20: warning: pointer to a function used in arithmetic [-Wpointer-arith] 23 | if(div[i]) ans*=(div[i]+1); | ^ a.cc:23:34: warning: pointer to a function used in arithmetic [-Wpointer-arith] 23 | if(div[i]) ans*=(div[i]+1); | ^ a.cc:23:35: warning: pointer to a function used in arithmetic [-Wpointer-arith] 23 | if(div[i]) ans*=(div[i]+1); | ~~~~~~^~ a.cc:23:26: error: invalid operands of types 'LL' {aka 'long long int'} and 'div_t (*)(int, int) noexcept' to binary 'operator*' 23 | if(div[i]) ans*=(div[i]+1); | ~~~^~~~~~~~~~~~ a.cc:23:26: note: in evaluation of 'operator*=(LL {aka long long int}, struct div_t (*)(int, int) noexcept)' a.cc:24:27: error: invalid operands of types 'LL' {aka 'long long int'} and 'double' to binary 'operator%' 24 | if(ans>mod) ans%=mod; | ^ a.cc:24:27: note: in evaluation of 'operator%=(LL {aka long long int}, double)'
s510713298
p03828
C++
#include<bits/stdc++.h> #define mod 1E9+7 int N; int div[1001]; int main() { scanf("%d", &N); LL ans = 1; for(int i=1;i<=N;i++) { for(int j=1;j*j<=i;j++) { if(i%j==0) { div[j]++; div[i/j]++; } } } for(int i=2;i*i<=N;i++) { if(div[i]) ans*=(div[i]+1); if(ans>mod) ans%=mod; } printf("%lld\n", ans); }
a.cc:4:13: error: 'int div [1001]' redeclared as different kind of entity 4 | int div[1001]; | ^ In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42, from a.cc:1: /usr/include/stdlib.h:992:14: note: previous declaration 'div_t div(int, int)' 992 | extern div_t div (int __numer, int __denom) | ^~~ a.cc: In function 'int main()': a.cc:8:5: error: 'LL' was not declared in this scope 8 | LL ans = 1; | ^~ a.cc:15:27: warning: pointer to a function used in arithmetic [-Wpointer-arith] 15 | div[j]++; | ^ a.cc:15:27: warning: ISO C++ forbids incrementing a pointer of type 'div_t (*)(int, int) noexcept' [-Wpointer-arith] 15 | div[j]++; | ~~~~~^ a.cc:15:27: error: lvalue required as increment operand 15 | div[j]++; | ^ a.cc:22:20: warning: pointer to a function used in arithmetic [-Wpointer-arith] 22 | if(div[i]) ans*=(div[i]+1); | ^ a.cc:22:23: error: 'ans' was not declared in this scope; did you mean 'abs'? 22 | if(div[i]) ans*=(div[i]+1); | ^~~ | abs a.cc:22:34: warning: pointer to a function used in arithmetic [-Wpointer-arith] 22 | if(div[i]) ans*=(div[i]+1); | ^ a.cc:22:35: warning: pointer to a function used in arithmetic [-Wpointer-arith] 22 | if(div[i]) ans*=(div[i]+1); | ~~~~~~^~ a.cc:23:15: error: 'ans' was not declared in this scope; did you mean 'abs'? 23 | if(ans>mod) ans%=mod; | ^~~ | abs a.cc:25:23: error: 'ans' was not declared in this scope; did you mean 'abs'? 25 | printf("%lld\n", ans); | ^~~ | abs
s714370070
p03828
Java
import java.util.*; /* 階乗の素因数分解の仕方。参考: https://youtu.be/28IanD3lXGg */ public class Playground2 { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); // find prime factor int[] primeFactor = new int[n + 1]; for (int i = 2; i <= n; i++) { int x = i; while (1 < x) { for (int j = 2; j <= x; j++) { if (x % j == 0) { primeFactor[j]++; break; } } } } long count = 1; for (int i = 2; i <= n; i++) { count *= (primeFactor[i] + 1); count %= 1000000007; } System.out.println(count); } }
Main.java:5: error: class Playground2 is public, should be declared in a file named Playground2.java public class Playground2 { ^ 1 error
s928212539
p03828
C++
#include <iostream> #include<cstdio> #include<cmath> #include<cstring> #include<string> #include<stack> #include <queue> typedef long long int ll; using namespace std; #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define REP(i,n) for (int i=0;i<(n);i++) #define EREP(i,n) for (int i=1;i<=(n);i++) const ll MOD = 1000000007; ll ans=0,temp=0,count=0,N,A,B; ll X[100010]={0},num[100100]={0}; int main(){ REP(i,100010)X[i]=0; FOR(i,2,N+1){ REP(j,500){ if(X[j] == 0){ X[j] = i; } if(i % X[j]==0){ break; } } } FOR(i,2,N+1){ int n = i; do { REP(j,500){ if(n % X[j]==0){ num[j]++; n /= X[j]; break; } } } while(n != 1); } REP(i,500){ ans = (ans * (num[i]+1)) % 1000000007 } cout<<ans; }
a.cc: In function 'int main()': a.cc:42:42: error: expected ';' before '}' token 42 | ans = (ans * (num[i]+1)) % 1000000007 | ^ | ; 43 | } | ~
s905945080
p03828
Java
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] factors = new int[n+1]; for (int i = 2; i <= n; i++) { int trg = i; int prime = 2; while (trg != 1) { if (trg % prime == 0) { factors[prime]++; trg /= prime; } else { while (++prime<trg) if (factors[prime] != 0) break; } } } int mod = (int)1e9+7; long res = Arrays.stream(factors).reduce(1L, (a, b) -> (a*(b+1)) % mod); System.out.println(res); } }
Main.java:26: error: incompatible types: possible lossy conversion from long to int long res = Arrays.stream(factors).reduce(1L, (a, b) -> (a*(b+1)) % mod); ^ Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error
s831044679
p03828
Java
public class Main { void run() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n + 1]; for (int k = 2; k <= n; k++) { int t = k; while (1 < t) { for (int i = 2; i <= t; i++) { if (t % i == 0) { a[i]++; t /= i; break; } } } } long count = 1; long MOD = 1_000_000_000 + 7; for (int i = 0; i < n + 1; i++) { if (a[i] != 0) { count *= (a[i] + 1); count %= MOD; } } System.out.println(count); } public static void main(String[] args) { new Main().run(); } }
Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner sc = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s911013707
p03828
Java
import java.util.Scanner; class Main{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); long a=sc.nextInt(); long b=1; for(int i=1;i<=a;i++){ b*=i; } a=b%10000000000; System.out.println(a); } }
Main.java:10: error: integer number too large a=b%10000000000; ^ 1 error
s110579811
p03828
C++
#include<iostream> using namespace std; int main(){ int N; int sosu[11] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31 }; int yakusu[11] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int i; int loop; int ans = 1; cin >> N; for (loop = 0; loop < 11; loop++){ for (i = 1; N / i > 0; i++){ yakusu[loop] += N / (int)pow(sosu[loop], i); } ans *= yakusu[loop] + 1; } cout << ans << "\n"; return 0; }
a.cc: In function 'int main()': a.cc:16:50: error: 'pow' was not declared in this scope 16 | yakusu[loop] += N / (int)pow(sosu[loop], i); | ^~~
s340605395
p03828
C++
import java.util.*; public class Main { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); int k=1,mul=1,n; HashSet<Integer>a=new HashSet<Integer>(); n=sc.nextInt(); int i,val=1; for(i=1;i<=n;i++) { val*=i; } int p=(val/2); while(k<=p) { if(val%k==0) a.add(k); k++; } System.out.println(a.size()+1); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: expected unqualified-id before 'public' 2 | public class Main { | ^~~~~~
s968404013
p03828
Java
import java.io.*; public class Mainc{ public static void main(String[] args) throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String N_moji = br.readLine(); int N = Integer.parseInt(N_moji); long i,j,count = 1; for(i = 2; i <= N; i++){ if(sosuu(i)){ count = (count * (kazu(i, N)+1)) % ((long)Math.pow(10,9) + 7); System.out.println(count); } } System.out.println(count); } public static boolean sosuu(long i){ long j,dame = 0; if(i == 1){ return false; }else{ for(j = 2; j < i; j++){ if((i % j) == 0){ dame++; } } if(dame > 0){ return false; }else{ return true; } } } public static long kazu(long i, int N){ long j,k,count = 0; for(j = 2; j <= N; j++){ k = j; while(k % i == 0){ count++; k /= i; } } return count; } }
Main.java:3: error: class Mainc is public, should be declared in a file named Mainc.java public class Mainc{ ^ 1 error
s490940484
p03828
C++
#include <bits/stdc++.h> using namespace std; using ull = unsigned long long; using ll = long long; using lli = long long int; using ld = long double; using pa = pair<int, int>; using ppa = pair<pa, int>; #define SORT(v, n) sort(v, v + n); #define ALL(v) v.begin(), v.end() #define VSORT(v) sort(ALL(v)) #define GRESORT(v) sort(ALL(v), greater<ll>()) #define REVERSE(v) reverse(ALL(v)) #define overlap(v) v.erase(unique(ALL(v)), v.end()) #define debug(x) cout << #x << ": " << x << endl #define FOR(i, a, b) for (int i = (a); i < (b); i++) #define rep(i, n) FOR(i, 0, n) #define RFOR(i, a, b) for (int i = (b - 1); i >= a; i--) #define rrep(i, n) RFOR(i, 0, n) #define INF INT_MAX #define SUP INT_MIN #define mins(a, b) a = min(a, b) #define maxs(a, b) a = max(a, b) // 4近傍 // int dy[]={0, 1, 0, -1}; // int dx[]={1, 0, -1, 0}; // 8近傍 // int dy[]={0,0,1,-1,1,1,-1,-1}; // int dx[]={1,-1,0,0,1,-1,1,-1}; const ll MOD = 1000000007; ll pow_mod(ll a, ll b, ll mod) { ll tmp = 1; a %= mod; if (b > 0) { tmp = pow_mod(a, b / 2, mod); if (b % 2) tmp = (((tmp * tmp) % mod) * a) % mod; else tmp = (tmp * tmp) % mod; } return tmp; } ll gcd(ll x,ll y){ if(x == 0) return y; return gcd(y%x,x); } vector<int> prime(1010); void solve(){ int n; cin >> n; ll ans = 0; for(int i = 2; i <= n; i++){ int tmp = 2; for(int j = i; j > 1;){ if(j%tmp == 0){ prime[tmp]++; j /= tmp; }else{ tmp++; } } } ll ans = 1; for(int i = 2; i <= 1000; i++){ if(prime[i]) ans *= (prime[i]+1) % MOD; } cout << ans << endl; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); solve(); return 0; }
a.cc: In function 'void solve()': a.cc:72:8: error: redeclaration of 'll ans' 72 | ll ans = 1; | ^~~ a.cc:60:8: note: 'll ans' previously declared here 60 | ll ans = 0; | ^~~
s719103550
p03828
C++
#include<stdio.h> int main(){ int N, i=1, t=0; scanf("%d", &N); for(i=1;i<=N;i++){ if N%i == 0 t++; } printf("%d", t%(10^9+7)); }
a.cc: In function 'int main()': a.cc:7:20: error: expected '(' before 'N' 7 | if N%i == 0 | ^ | (
s810208406
p03828
C++
#include<stdio.h> int main(){ int N, i=1, t=0; scanf("%d", &N); for(i=1;i<=N;i++){ if N%i == 0 t++; } printf("%d", N%t); }
a.cc: In function 'int main()': a.cc:7:20: error: expected '(' before 'N' 7 | if N%i == 0 | ^ | (
s391787043
p03828
C++
#include <iostream> #include <vector> #include <cmath> using namespace std; long long main() { long long N; long long value = 1; long long ans = 1; long long num = 1000000007; vector<long long> p; p.push_back(2); for (long long i = 3; i <= 1000; i += 2) { bool k = false; for (long long j = 3; j <= sqrt(i); j += 2) { if (i % j == 0) { k = true; break; } } if (!k) p.push_back(i); } vector<long long> Pc(p.size()); for (long long i = 0; i < Pc.size(); i++) Pc[i] = 0; cin >> N; //N! for (long long i = 0; i < N; i++) { value = i + 1; for (long long j = 0; j < p.size(); j++) { long long v = 0; while (value % p[j] == 0) { value /= p[j]; v++; } Pc[j] += v; } } for (long long i = 0; i < Pc.size(); i++) { ans = (ans % num) * (Pc[i] + 1 % num); } cout << ans << endl; return 0; }
cc1plus: error: '::main' must return 'int'
s474391626
p03828
C++
#include <iostream> #include <vector> #include <map> #include <algorithm> using namespace std; const long long N 168; const long long M 1000000007; #define REP(i,n) for (int i=0;i<(n);i++) #define PII pair<int,int> #define LL long long LL prime[168]={ 2 , 3 , 5 , 7 , 11 , 13 , 17 , 19 , 23 , 29 , 31 , 37 , 41 , 43 , 47 , 53 , 59 , 61 , 67 , 71 , 73 , 79 , 83 , 89 , 97 , 101 , 103 , 107 , 109 , 113 , 127 , 131 , 137 , 139 , 149 , 151 , 157 , 163 , 167 , 173 , 179 , 181 , 191 , 193 , 197 , 199 , 211 , 223 , 227 , 229 , 233 , 239 , 241 , 251 , 257 , 263 , 269 , 271 , 277 , 281 , 283 , 293 , 307 , 311 , 313 , 317 , 331 , 337 , 347 , 349 , 353 , 359 , 367 , 373 , 379 , 383 , 389 , 397 , 401 , 409 , 419 , 421 , 431 , 433 , 439 , 443 , 449 , 457 , 461 , 463 , 467 , 479 , 487 , 491 , 499 , 503 , 509 , 521 , 523 , 541 , 547 , 557 , 563 , 569 , 571 , 577 , 587 , 593 , 599 , 601 , 607 , 613 , 617 , 619 , 631 , 641 , 643 , 647 , 653 , 659 , 661 , 673 , 677 , 683 , 691 , 701 , 709 , 719 , 727 , 733 , 739 , 743 , 751 , 757 , 761 , 769 , 773 , 787 , 797 , 809 , 811 , 821 , 823 , 827 , 829 , 839 , 853 , 857 , 859 , 863 , 877 , 881 , 883 , 887 , 907 , 911 , 919 , 929 , 937 , 941 , 947 , 953 , 967 , 971 , 977 , 983 , 991 , 997 }; void pf(LL n,LL* count){ // cout<<n<<"="; REP(i,N){ if(prime[i]/2>n) break; while(n%prime[i]==0){ // cout<<prime[i]<<"*"; n/=prime[i]; count[i]++; } } //cout<<"1\n"<<endl; } int main(){ LL n; cin>>n; LL count[168]; REP(i,168){ count[i]=0; } for(LL i=2;i<=n;i++){ pf(i,count); } LL ret=1; REP(i,N){ ret=((ret%M)*((count[i]+1)%M)); } cout<<ret<<endl; return 0; }
a.cc:7:19: error: expected initializer before numeric constant 7 | const long long N 168; | ^~~ a.cc:8:19: error: expected initializer before numeric constant 8 | const long long M 1000000007; | ^~~~~~~~~~ a.cc: In function 'void pf(long long int, long long int*)': a.cc:20:9: error: 'N' was not declared in this scope 20 | REP(i,N){ | ^ a.cc:10:34: note: in definition of macro 'REP' 10 | #define REP(i,n) for (int i=0;i<(n);i++) | ^ a.cc: In function 'int main()': a.cc:46:9: error: 'N' was not declared in this scope 46 | REP(i,N){ | ^ a.cc:10:34: note: in definition of macro 'REP' 10 | #define REP(i,n) for (int i=0;i<(n);i++) | ^ a.cc:47:15: error: 'M' was not declared in this scope 47 | ret=((ret%M)*((count[i]+1)%M)); | ^
s477302157
p03828
C++
#include<stdio.h> int fractorial(int n) { if (n > 0) return n*fractorial(n - 1); else return 1; } int search(int x) { int count = 0; for (int i = 1; x<i; i++) { if (x % i == 0) { count += 1; } } return(count); } int main() { int NUMBER,X,ANS; scanf_s("%d", &NUMBER); X = fractorial(NUMBER); ANS = search(X); printf("%d",ANS / (10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 + 7)); }
a.cc: In function 'int main()': a.cc:21:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 21 | scanf_s("%d", &NUMBER); | ^~~~~~~ | scanf
s196450336
p03828
C++
#include <cstdio> #include <iostream> #include <string> using namespace std; long primeCounter(long n) { long j ,c = 1; for (long i = 2; i * i <= n; i++, c *= j) { for (j = 1; !(n % i); j++) { n /= i; } } return (1 < n) ? c * 2 : c; } long factorial(long n) { long fact = 1; for (long i = 1; i <= n; ++i) { fact = fact * i; } return fact; } int main() { int N; cin >> N; long fact = factorial(N); long primeNum = primeCounter(fact); long ans = primeNum % ((long)pow(10, 9) + 7); printf("%d\n", ans); }
a.cc: In function 'int main()': a.cc:38:38: error: 'pow' was not declared in this scope 38 | long ans = primeNum % ((long)pow(10, 9) + 7); | ^~~
s175658920
p03828
C++
#include<iostream> #include<vector> using namespace std; typedef long long ll; int main() { int n; cin>>n; vector<ll> v(n+1,1); vector<int> vec; vec.push_back(2); for(int i=3;i<=n;i++) { bool cc=true; for(int j=2;j<=sqrt((double)i);j++) { if(i%j==0) { cc=false; break; } } if(cc) vec.push_back(i); } for(int i=1;i<=n;i++) { int p=i; for(int j=0;j<vec.size();j++) { while(p%vec[j]==0) { p/=vec[j]; v[vec[j]]++; } } } ll brojac=1; for(int i=0;i<=n;i++) { brojac=(brojac*v[i])%1000000007; } cout<<brojac%1000000007<<endl; return 0; }
a.cc: In function 'int main()': a.cc:15:32: error: 'sqrt' was not declared in this scope 15 | for(int j=2;j<=sqrt((double)i);j++) | ^~~~
s618284200
p03828
C++
#include<iostream> #include<vector> #include<algorithm> #include<queue> using namespace std; int main(){ int n; cin>>n; int tmp[1001]; memset(tmp,0,sizeof(tmp)); for(int i = n;i > 0;i--){ int t_n = i; for(int j = 2;j * j<=t_n;j++){ while(t_n % j == 0){ ++tmp[j]; t_n /= j; } } if(t_n != 1) tmp[t_n]++; //tmp[i]--; } long ans = 1; for(int i = 2;i<=n;i++){ ans *= (tmp[i]+ 1); ans %= 1000000007; } cout<<ans % 1000000007<<endl; return 0; }
a.cc: In function 'int main()': a.cc:12:3: error: 'memset' was not declared in this scope 12 | memset(tmp,0,sizeof(tmp)); | ^~~~~~ a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include<queue> +++ |+#include <cstring> 5 |
s691723716
p03828
Java
import java.util.*; public class Main{ public static void main(String[] args){ Scanner scan=new Scanner(System.in); int n=scan.nextInt(); int num=1; boolean[] facs=new int[n]; for(int i=2;i<=n;i++){ if(!facs[i-1]){ int mem_i=i; facs[i-1]=true; int mem_n=check(i); while(mem_i<=n){ mem_i*=i; facs[mem_i-1]=true; mem_n+=check(mem_i); } num*=(mem_n+1); } } System.out.println(num); } int check(int k){ if(n%k==0)return n/k; return 0; } }
Main.java:7: error: incompatible types: int[] cannot be converted to boolean[] boolean[] facs=new int[n]; ^ Main.java:12: error: non-static method check(int) cannot be referenced from a static context int mem_n=check(i); ^ Main.java:16: error: non-static method check(int) cannot be referenced from a static context mem_n+=check(mem_i); ^ Main.java:24: error: cannot find symbol if(n%k==0)return n/k; ^ symbol: variable n location: class Main Main.java:24: error: cannot find symbol if(n%k==0)return n/k; ^ symbol: variable n location: class Main 5 errors
s763064179
p03828
Java
import java.io.*; import java.util.*; public class Main { static int n; static int a; static int b; static int[] x; static int[][] dp; public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); n=Integer.parseInt(br.readLine()); x=new int[n+1]; int[] prime=new int[n+1]; Arrays.fill(prime,1); prime[0]=prime[1]=0; for(int i=2;i*i<=n;i++){ if(prime[i]>0){ for(int j=2;i*j<=n;j++){ prime[i*j]=0; } } } for(int i=2;i<n+1;i++){ if(prime[i]>0){ prime[i]=0; for(int j=i;j<=n;j*=i){ prime[i]+=n/j; } } }for(int i=0;i<n+1;i++){ prime[i]++; } long sum=1; for(int i=0;i<n+1;i++){ sum=(sum%1000000007)*(prime[i]%1000000007); }System.out.println(sum%1000000007); }
Main.java:39: error: reached end of file while parsing } ^ 1 error
s623345076
p03828
C++
//インクルード #include <cstdlib> #include <iostream> #include <string> //関数のプロトライプ宣言 long long calcFactorial(long long target); //メイン関数 int main() { //入力の取得 long long N; std::cin >> N; long long N_factorial = calcFactorial(N); long long temp = 1; for(long long i=N_factorial; i>=2; --i) { temp *= i; } long long divisor = 1000000007; //約数を求める for(long long i=N_factorial; i>=1; --i) { if(N_factorial % i == 0) { ++temp; } } //答えを求める long long answer = temp % divisor; //答えの出力 std::cout << answer << std::endl; //正常終了 return EXIT_SUCCESS; }
/usr/bin/ld: /tmp/cc4BKsor.o: in function `main': a.cc:(.text+0x26): undefined reference to `calcFactorial(long long)' collect2: error: ld returned 1 exit status
s178891729
p03828
C++
#include <bits/stdc++.h> using namespace std; int main(){ int N,K,i,t,a; cin<<N; a=1; for(i=1; i<=N; i++){ K*=i; } for(i=2; i<=N; i++){ t=0; if(K%i==0){ K/=i; t++; } a*=t+1; } cout<<a%(pow(10,9)+7); }
a.cc: In function 'int main()': a.cc:6:6: 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:6: note: candidate: 'operator<<(int, int)' (built-in) 6 | cin<<N; | ~~~^~~ a.cc:6:6: 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:8: 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/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; | ^~~ 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:8: 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:8: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 6 | cin<<N; | ^ /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:8: 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/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:8: 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/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:8: 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/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:8: 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:8: 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:8: 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:8: 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:8: 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:8: 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:8: 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:8: 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)
s978280750
p03828
C++
#include "iostream" #include <math.h> using namespace std; int main(){ int N; int amari; int sum = 0; int kaizyou = 1; cin >> N; for (int i = 1; i <= N; i++){ kaizyou = kaizyou * i; } for (int i = 1; i <= kaizyou; i++){ amari = kaizyou % i; if(amari == 0){ sum = sum + 1; } } cout << sum % (pow(10,9) + 7) << endl; return 0; }
a.cc: In function 'int main()': a.cc:23:21: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%' 23 | cout << sum % (pow(10,9) + 7) << endl; | ~~~ ^ ~~~~~~~~~~~~~~~ | | | | int __gnu_cxx::__promote<double>::__type {aka double}
s255466950
p03828
C++
#include "iostream" #include <math> using namespace std; int main(){ int N; int amari; int sum = 0; int kaizyou = 1; cin >> N; for (int i = 1; i <= N; i++){ kaizyou = kaizyou * i; } for (int i = 1; i <= kaizyou; i++){ amari = kaizyou % i; if(amari == 0){ sum = sum + 1; } } cout << sum % (pow(10,9) + 7) << endl; return 0; }
a.cc:2:10: fatal error: math: No such file or directory 2 | #include <math> | ^~~~~~ compilation terminated.
s183022255
p03828
C++
include "iostream" #include <math> using namespace std; int main(){ int N; int amari; int sum = 0; int kaizyou = 1; cin >> N; for (int i = 1; i <= N; i++){ kaizyou = kaizyou * i; } for (int i = 1; i <= kaizyou; i++){ amari = kaizyou % i; if(amari == 0){ sum = sum + 1; } } cout << sum % (pow(10,9) + 7) << endl; return 0; }
a.cc:2:10: fatal error: math: No such file or directory 2 | #include <math> | ^~~~~~ compilation terminated.
s449476451
p03828
C++
#include "iostream" using namespace std; int main(){ int N; int amari; int sum = 0; int kaizyou = 1; cin >> N; for (int i = 1; i <= N; i++){ kaizyou = kaizyou * i; } for (int i = 1; i <= kaizyou; i++){ amari = kaizyou % i; if(amari == 0){ sum = sum + 1; } } cout << sum % (pow(10,9) + 7) << endl; return 0; }
a.cc: In function 'int main()': a.cc:22:24: error: 'pow' was not declared in this scope 22 | cout << sum % (pow(10,9) + 7) << endl; | ^~~
s424624316
p03828
C++
#include "iostream" using namespace std; int main(){ int N; int amari; int sum = 0; int kaizyou = 1; cin << N; for (int i = 1; i <= N; i++){ kaizyou = kaizyou * i; } for (int i = 1; i <= kaizyou; i++){ amari = kaizyou % i; if(amari == 0){ sum = sum + 1; } } cout << sum % (pow(10,9) + 7) << endl; return 0; }
a.cc: In function 'int main()': a.cc:9:13: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int') 9 | cin << N; | ~~~ ^~ ~ | | | | | int | std::istream {aka std::basic_istream<char>} a.cc:9:13: note: candidate: 'operator<<(int, int)' (built-in) 9 | cin << N; | ~~~~^~~~ a.cc:9:13: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/bits/basic_string.h:47, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)' 763 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed: a.cc:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | 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:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | 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:9:9: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte' 9 | 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:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | 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:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | 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:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | 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:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | 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:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | 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:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | 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:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | 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:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>' 9 | 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:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | 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:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | 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:9:16: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>' 9 | 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:9:9: required from here 9 | 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:22:24: error: 'pow' was not declared in this scope 22 | cout << sum % (pow(10,9) + 7) << endl; | ^~~
s182394131
p03828
C++
}a
a.cc:1:9: error: expected declaration before '}' token 1 | }a | ^ a.cc:1:10: error: 'a' does not name a type 1 | }a | ^
s847117610
p03829
Java
import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a = sc.nextInt(); //座標1移動したときの疲労度 int b = sc.nextInt(); //TP int[] array = new int[n]; for(int i = 0; i < n; i++) { array[i] = sc.nextInt(); } int sum = 0; for(int i = 1; i < n; i++) { int dist = array[i] - array[i - 1]; if(dist * a >= b) { sum += b; } else { sum += dist * a; } } System.out.println(sum); } }
Main.java:3: error: class Test is public, should be declared in a file named Test.java public class Test { ^ 1 error
s950109143
p03829
C++
#include <bits/stdc++.h> using namespace std; #define ALL(x) (x).begin(),(x).end() #define COUT(x) cout<<(x)<<"\n" #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define REP(i, n) for(int i=0;i<n;i++) #define YES(x) cout<<(x?"YES":"NO")<<"\n" #define Yes(x) cout<<(x?"Yes":"No")<<"\n" #define dump(x) cout<<#x<<" = "<<(x)<<"\n" #define endl "\n" using G = vector<vector<int>>; using M = map<int,int>; using P = pair<int,int>; using PQ = priority_queue<int>; using PQG = priority_queue<int,vector<int>,greater<int>>; using V = vector<int>; using ll = long long; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } const int INF = 1e9; const int MOD = 1e9+7; const ll LINF = 1e18; int main() { IOS; int n,a,b; cin >> n >> a >> b; ll x[n]; REP(i,n) cin >> x[i]; ll ans = 0; for (int i = 1; i < n; i++) { ll d = x[i] - x[i-1]; ans += min(d*a, b); } COUT(ans); return 0; }
a.cc: In function 'int main()': a.cc:33:15: error: no matching function for call to 'min(ll, int&)' 33 | ans += min(d*a, b); | ~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:33:15: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 33 | ans += min(d*a, b); | ~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:33:15: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 33 | ans += min(d*a, b); | ~~~^~~~~~~~
s863979671
p03829
C++
#include <bits/stdc++.h> using namespace std; #define ALL(x) (x).begin(),(x).end() #define COUT(x) cout<<(x)<<"\n" #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define REP(i, n) for(int i=0;i<n;i++) #define YES(x) cout<<(x?"YES":"NO")<<"\n" #define Yes(x) cout<<(x?"Yes":"No")<<"\n" #define dump(x) cout<<#x<<" = "<<(x)<<"\n" #define endl "\n" using G = vector<vector<int>>; using M = map<int,int>; using P = pair<int,int>; using PQ = priority_queue<int>; using PQG = priority_queue<int,vector<int>,greater<int>>; using V = vector<int>; using ll = long long; template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } const int INF = 1e9; const int MOD = 1e9+7; const ll LINF = 1e18; int main() { IOS; int n,a,b; cin >> n >> a >> b; ll x[n]; REP(i,n) cin >> x[i]; ll ans = 0; for (int i = 1; i < n; i++) { ll d = x[i] - x[i-1]; ans += min(d*a, b); } COUT(ans); return 0; }
a.cc: In function 'int main()': a.cc:33:15: error: no matching function for call to 'min(ll, int&)' 33 | ans += min(d*a, b); | ~~~^~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:33:15: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 33 | ans += min(d*a, b); | ~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:33:15: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 33 | ans += min(d*a, b); | ~~~^~~~~~~~
s328864532
p03829
C++
#include <bits/stdc++.h> using namespace std; int main() { long long N, A, B, answer = 0; cin >> N >> A >> B; int X[N]; for (int i = 0; i < N; i++) { cin >> X[i]; } for (int i = 1; i < N; i++) { answer += min(1llA*(X[i]-X[i-1]),B); } cout << answer; }
a.cc: In function 'int main()': a.cc:11:19: error: unable to find numeric literal operator 'operator""llA' 11 | answer += min(1llA*(X[i]-X[i-1]),B); | ^~~~
s082864343
p03829
C++
#include <bits/stdc++.h> #define int long long #define rep(i, n) for (int i = 0; i < (int)(n); i++) using namespace std; constexpr int MOD = 1000000007; constexpr int INF = 1e16; typedef pair<int,int> P; using Graph = vector<vector<int>>; 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; } const double PI = acos(-1.0); // cout << fixed << setprecision(14); signed main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int N, a, b; cin >> N >> A >> B; int A[N]; rep(i,N) cin >> A[i]; int ans = 0; rep(i,N-1){ int dis = A[i+1] - A[i]; ans += min(dis*a, b); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:20:17: error: 'A' was not declared in this scope 20 | cin >> N >> A >> B; | ^ a.cc:20:22: error: 'B' was not declared in this scope 20 | cin >> N >> A >> B; | ^
s334139756
p03829
C++
#include <iostream> #include <string> #include <vector> #include <map> #include <algorithm> #include <cmath> #include <sstream> #include <iomanip> #include <set> #include <queue> #include <stack> #include <utility> #include <stdio.h> #include <unistd.h> using namespace std; typedef long long int ll; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define drep(i, n) for(int i = n - 1; i >= 0; i--) #define YES cout << "YES" << endl #define Yes cout << "Yes" << endl #define yes cout << "yes" << endl #define NO cout << "NO" << endl #define No cout << "No" << endl #define no cout << "no" << endl #define PI 3.14159265359 const int INF = 1001001001; const ll LINF = 1001002003004005006ll; const int mod = 1000000007; void P(int x) {cout << x << endl;} void P(long x) {cout << x << endl;} void P(double x) {cout << x << endl;} void P(ll x) {cout << x << endl;} void P(string x) {cout << x << endl;} void P(char x) {cout << x << endl;} ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;} ll lcm(ll a, ll b) { return a/gcd(a,b)*b;} int main() { int n, a, b; cin >> n >> a >> b; int now; cin >> now; ll ans = 0; rep (i, n - 1) { int tmp; cin >> tmp; ll diff = tmp - now; ans += min(b, diff * a); now = tmp; } P(ans); return 0; }
a.cc: In function 'int main()': a.cc:53:15: error: no matching function for call to 'min(int&, ll)' 53 | ans += min(b, diff * a); | ~~~^~~~~~~~~~~~~ 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:53:15: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 53 | ans += min(b, diff * a); | ~~~^~~~~~~~~~~~~ /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:53:15: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 53 | ans += min(b, diff * a); | ~~~^~~~~~~~~~~~~
s937890954
p03829
C++
#include<bits/stdc++.h> using namespace std; int main () { int N; cin >> N; long long ans = 0; long long x; cin >> x; for (int i = 0; i < N; i ++) { long long k = 0; cin >> k; ans += min((k - x) * A, B); x = k; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:26: error: 'A' was not declared in this scope 12 | ans += min((k - x) * A, B); | ^ a.cc:12:29: error: 'B' was not declared in this scope 12 | ans += min((k - x) * A, B); | ^
s375937168
p03829
C++
#include<iostream> using namespace std; int main(){ int n,a,b;cin>>n>>a>>b; int x[n]; for(int i=0;i<n;i++) cin>>x[i]; long long ans=0; for(int i=1;i<n;i++){ ans+=min((long long)a*(long long)(x[i]-x[i-1]),b); } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:13: error: no matching function for call to 'min(long long int, int&)' 10 | ans+=min((long long)a*(long long)(x[i]-x[i-1]),b); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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:10:13: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 10 | ans+=min((long long)a*(long long)(x[i]-x[i-1]),b); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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
s555012549
p03829
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long N,A,B,counter=0; cin>>N>>A>>B; long long a[100000]; for(int j=0; j<N;j++){ cin>>a[j];} for(int j=0; j<N;j++){ if((a[j+1]-a[j]*A<=B){ counter+=A*(a[j+1]-a[j]);} else counter+=B; } cout<<counter<<endl;}
a.cc: In function 'int main()': a.cc:10:22: error: expected ';' before '{' token 10 | if((a[j+1]-a[j]*A<=B){ | ^ | ; a.cc:12:1: error: expected primary-expression before 'else' 12 | else | ^~~~ a.cc:11:27: error: expected ')' before 'else' 11 | counter+=A*(a[j+1]-a[j]);} | ^ | ) 12 | else | ~~~~ a.cc:10:3: note: to match this '(' 10 | if((a[j+1]-a[j]*A<=B){ | ^
s635784768
p03829
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long N,A,B,counter=0; cin>>N>>A>>B; long long a[100000]; for(int j=0; j<N;j++){ cin>>a[i];} for(int j=0; j<N;j++){ if((a[i+1]-a[i]*A<=B){ counter+=A*(a[i+1]-a[i]);} else counter+=B; } cout<<counter<<endl;}
a.cc: In function 'int main()': a.cc:8:8: error: 'i' was not declared in this scope 8 | cin>>a[i];} | ^ a.cc:10:7: error: 'i' was not declared in this scope 10 | if((a[i+1]-a[i]*A<=B){ | ^ a.cc:12:1: error: expected primary-expression before 'else' 12 | else | ^~~~ a.cc:11:27: error: expected ')' before 'else' 11 | counter+=A*(a[i+1]-a[i]);} | ^ | ) 12 | else | ~~~~ a.cc:10:3: note: to match this '(' 10 | if((a[i+1]-a[i]*A<=B){ | ^
s263165817
p03829
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long N,A,B,counter=0; cin>>N>>A>>B; long long a[100000]; for(int j=0; j<N;j++;){ cin>>a[i];} for(int j=0; j<N;j++;){ if((a[i+1]-a[i]*A<=B){ counter+=A*(a[i+1]-a[i]);} else counter+=B; } cout<<counter<<endl;}
a.cc: In function 'int main()': a.cc:7:21: error: expected ')' before ';' token 7 | for(int j=0; j<N;j++;){ | ~ ^ | ) a.cc:7:22: error: expected primary-expression before ')' token 7 | for(int j=0; j<N;j++;){ | ^ a.cc:9:21: error: expected ')' before ';' token 9 | for(int j=0; j<N;j++;){ | ~ ^ | ) a.cc:9:22: error: expected primary-expression before ')' token 9 | for(int j=0; j<N;j++;){ | ^
s497077367
p03829
C++
#include <bits/stdc++.h> using namespace std; int main(){ long long N,A,B,counter=0; cin>>N>>A>>B; long long a[100000]; for(int j=0 j<N;j++;){ cin>>a[i];} for(int j=0 j<N;j++;){ if((a[i+1]-a[i]*A<=B){ counter+=A*(a[i+1]-a[i]);} else counter+=B; } cout<<counter<<endl;}
a.cc: In function 'int main()': a.cc:7:12: error: expected ';' before 'j' 7 | for(int j=0 j<N;j++;){ | ^~ | ; a.cc:7:20: error: expected ')' before ';' token 7 | for(int j=0 j<N;j++;){ | ~ ^ | ) a.cc:7:21: error: expected primary-expression before ')' token 7 | for(int j=0 j<N;j++;){ | ^ a.cc:9:12: error: expected ';' before 'j' 9 | for(int j=0 j<N;j++;){ | ^~ | ; a.cc:9:20: error: expected ')' before ';' token 9 | for(int j=0 j<N;j++;){ | ~ ^ | ) a.cc:9:21: error: expected primary-expression before ')' token 9 | for(int j=0 j<N;j++;){ | ^
s031115532
p03829
C++
#include <bits/stdc++.h> using namespace std; int main(){ int64_t N, A, B; cin >> N >> A >> B; vector<int64_t> X(N); for (int i64_t = 0; i < N; i++){ cin >> X.at(i); } int64_t exh = 0; for (int64_t i = 0; i < N - 1; i++){ int64_t d = X.at(i + 1) - X.at(i); exh += min(A * d, B); } cout << exh << endl; }
a.cc: In function 'int main()': a.cc:8:26: error: 'i' was not declared in this scope 8 | for (int i64_t = 0; i < N; i++){ | ^
s293502719
p03829
C++
import java.util.*; import java.io.*; public class Main{ static int repow(int b,int p){ long a = b; long res=1; while(p>0){ if(p%2==1){ res*=a; } a*=a; p/=2; } return (int)res; } static int repow(int b,int p,int modder){ long a = b%modder; long res=1; while(p>0){ if(p%2==1){ res=(res*a)%modder; } a=(a*a)%modder; p/=2; } return (int)res; } static long repow(long b,long p){ long a = b; long res=1; while(p>0){ if(p%2==1){ res*=a; } a*=a; p/=2; } return res; } static long repow(long b,long p,long modder){ long a = b%modder; long res=1; while(p>0){ if(p%2==1){ res=(res*a)%modder; } a=(a*a)%modder; p/=2; } return res; } static long gcd(long c,long d){ while(true){ long f=c%d; if(f==0){ return d; } c=d; d=f; } } static long lcm(long c,long d){ return c/gcd(c,d)*d; } static ArrayList<Integer> divList(int n){ ArrayList<Integer> div=new ArrayList<Integer>(); for(int i=1;i*i<=n;i++){ if(n%i==0){ div.add(i); if(i*i!=n){ div.add((int)(n/i)); } } } return div; } static ArrayList<Long> divList(long n){ ArrayList<Long> div=new ArrayList<Long>(); for(long i=1;i*i<=n;i++){ if(n%i==0){ div.add(i); if(i*i!=n){ div.add(n/i); } } } return div; } static HashSet<Integer> divSet(int n){ HashSet<Integer> div=new HashSet<Integer>(); for(int i=1;i*i<=n;i++){ if(n%i==0){ div.add(i); div.add((int)(n/i)); } } return div; } static Map<Long,Integer> pFacMap(long x){ Map<Long,Integer> mp=new HashMap<>(); long t=x; for(long i=2;i*i<=x&&i<=t;i++){ if(t%i==0){ int num=0; while(t%i==0){ t/=i; num++; } mp.put(i,num); } } if(t!=1){ mp.put(t,1); } return mp; } static boolean iP(long n){ if(n==2){ return true; } if((n&1)==0||n==1){ return false; } // if(n>3037007383L){ if(n>Integer.MAX_VALUE){ return tameshiwari(n); } long d=n-1; int s=0; while((d&1)==0){ d/=2; s++; } int[] aa = {2,3,5,7,11,13,17}; for(int i=0;i<7&&aa[i]<n;i++){ int a = aa[i]; long t = d; long y=repow(a,t,n); while(t!=n-1&&y!=1&&y!=n-1){ y = (y*y)%n; t=t<<1; } if(y!=n-1&&(t&1)==0){ return false; } } return true; } static boolean tameshiwari(long n){ for(long i=2;i*i<=n;i++){ if(n%i==0){ return false; } } return true; } static class NCK{ int max; int mod; long[] fac; long[] finv; long[] inv; NCK(){ this(510000,1000000007); } NCK(int max,int mod){ this.max=max; this.mod=mod; pre(max,mod); } void pre(int nmax,int nmod){ fac = new long[nmax]; finv = new long[nmax]; inv = new long[nmax]; fac[0]=fac[1]=1; finv[0]=finv[1]=1; inv[1]=1; for(int i=2;i<nmax;i++){ fac[i]=fac[i-1]*i%nmod; inv[i]=nmod-inv[nmod%i]*(nmod/i)%nmod; finv[i]=finv[i-1]*inv[i]%nmod; } } long nCk(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; } } static int kmp(String t,String p){ int[] f=new int[p.length()+1]; int i=0; int j=1; f[1]=0; while(j<p.length()){ if(i==0||p.charAt(i-1)==p.charAt(j-1)){ i++; j++; f[j]=i; }else{ i=f[i]; } } i=1; j=1; while(i<=p.length()&&j<=t.length()){ if(i==0||p.charAt(i-1)==t.charAt(j-1)){ i++; j++; }else{ i=f[i]; } } return i==(p.length()+1)?j-i:-1; } static String StSort(String s){ StringBuilder sb = new StringBuilder(s); int lg = sb.length(); int l; int r; int gaze; for(int i=1;i<lg;i++){ l=0; r=i-1; while(l<=r){ gaze=(l+r)/2; if(sb.charAt(gaze)<=sb.charAt(i)){ l=gaze+1; }else if(sb.charAt(gaze)>sb.charAt(i)){ r=gaze-1; } } sb.insert(l,sb.charAt(i)); sb.deleteCharAt(i+1); } return sb.toString(); } static class Xy{ int x; int y; Xy(int x,int y){ this.x=x; this.y=y; } public int manht(Xy o){ return Math.abs(x-o.x)+Math.abs(y-o.y); } public String toString(){ return "["+x+","+y+"]"; } public double henkaku(){ return Math.atan2(y,x); } public static int hencom(Xy s1,Xy s2){ return (int)Math.signum(s1.henkaku()-s2.henkaku()); } public boolean equals(Object o){ return x==((Xy)o).x&&y==((Xy)o).y; } } static class Zip1{ Map<Long,Integer> zip=new HashMap<>(); long[] unzip; Zip1(long[] a){ Arrays.sort(a); long mae=0;int zure=0; for(int i=0;i<a.length;i++){ if(i==0||mae!=a[i]){ zip.put(a[i],i-zure); mae=a[i]; }else{ zure++; } } unzip=new long[size()]; for(Map.Entry<Long,Integer> me:zip.entrySet()){ unzip[me.getValue()]=me.getKey(); } } int zip(long t){ return zip.get(t); } long unzip(int i){ return unzip[i]; } int size(){ return zip.size(); } } static class UnFd{ int[] parent; int[] size; int forest; UnFd(int n){ parent=new int[n]; size=new int[n]; forest=n; for(int i=0;i<n;i++){ parent[i]=i; size[i]=1; } } private boolean isRoot(int i){ return parent[i]==i; } private int rootOf(int i){ if(isRoot(i)){ return i; } return parent[i]=rootOf(parent[i]); } public boolean same(int i,int j){ return rootOf(i)==rootOf(j); } public void merge(int i,int j){ i=rootOf(i); j=rootOf(j); if(i==j){ return; } size[Integer.min(i,j)]+=size[Integer.max(i,j)]; parent[Integer.max(i,j)]=Integer.min(i,j); forest--; } public int sizeOf(int i){ return size[rootOf(i)]; } public int[] parents(){ return parent; } public int forest(){ return forest; } public String toString(){ return Arrays.toString(parent); } } static class SegTree<T>{ int n; int m; java.util.function.BinaryOperator<T> op; int[] l; int[] r; T[] a; T ident; SegTree(int n,java.util.function.BinaryOperator<T> op,T ident){ this.n=n; this.op=op; this.ident=ident; int ii=n-1; int p=0; while(ii>0){ ii/=2; p++; } m=repow(2,p+1)-1; @SuppressWarnings("unchecked") T[] b=(T[])(new Object[m]); a=b; Arrays.fill(a,ident); l=new int[m]; r=new int[m]; for(int i=0;i<=m/2;i++){ l[m/2+i]=i; r[m/2+i]=i+1; } for(int i=m/2-1;i>=0;i--){ l[i]=l[lch(i)]; r[i]=r[rch(i)]; } } SegTree(int n,java.util.function.BinaryOperator<T> op,T ident,T[] ary){ this.n=n; this.op=op; this.ident=ident; int ii=n-1; int p=0; while(ii>0){ ii/=2; p++; } m=repow(2,p+1)-1; @SuppressWarnings("unchecked") T[] b=(T[])(new Object[m]); a=b; for(int i=0;i<n;i++){ a[m/2+i]=ary[i]; } for(int i=m/2+n;i<m;i++){ a[i]=ident; } for(int i=m/2-1;i>=0;i--){ a[i]=op.apply(a[lch(i)],a[rch(i)]); } l=new int[m]; r=new int[m]; for(int i=0;i<=m/2;i++){ l[m/2+i]=i; r[m/2+i]=i+1; } for(int i=m/2-1;i>=0;i--){ l[i]=l[lch(i)]; r[i]=r[rch(i)]; } } public T getAll(){ return a[0]; } public T get(int from,int to){ if(from<0||n<to||from>=to){ throw new IllegalArgumentException(String.valueOf(from)+","+String.valueOf(to)); } return get(from,to,0); } private T get(int from,int to,int node){ if(from==l[node]&&to==r[node]){ return a[node]; }else{ if(to<=l[node]+(r[node]-l[node])/2){ return get(from,to,lch(node)); }else if(l[node]+(r[node]-l[node])/2<=from){ return get(from,to,rch(node)); }else{ return op.apply(get(from,l[node]+(r[node]-l[node])/2,lch(node)),get(l[node]+(r[node]-l[node])/2,to,rch(node))); } } } public void set(T ob,int i){ if(i<0||n<=i){ throw new IndexOutOfBoundsException(String.valueOf(i)+"isOutFromLength "+String.valueOf(n)); } int j=m/2+i; a[j]=ob; while(true){ if(j==0){ break; } j=prt(j); a[j]=op.apply(a[lch(j)],a[rch(j)]); } } static private int prt(int node){ return (node-1)/2; } static private int lch(int node){ return 2*node+1; } static private int rch(int node){ return 2*node+2; } public String toString(){ return Arrays.toString(a); } } static boolean next_permutation(int[] per){ if(per.length<2){ return false; } int i; for(i=per.length-1;i>0;i--){ if(per[i-1]<per[i]){ break; } } if(0<i){ i--; int tmp; int j; for(j=per.length-1;j>i;j--){ if(per[j]>per[i]){ break; } } //swap(i,j) tmp=per[i]; per[i]=per[j]; per[j]=tmp; for(int k=i+1;k<(i+1+per.length)/2;k++){ //swap(k,per.length-k+i) tmp=per[k]; per[k]=per[per.length-k+i]; per[per.length-k+i]=tmp; } return true; } int tmp; for(int k=0;k<per.length;k++){ //swap(k,per.length-k-1) tmp=per[k]; per[k]=per[per.length-k-1]; per[per.length-k-1]=tmp; } return false; } static boolean next_bits(boolean[] b){ for(int i=0;i<b.length;i++){ if(b[i]){ b[i]=false; }else{ b[i]=true; return true; } } return false; } static class Scnr{ private final InputStream ins; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; Scnr(){ this(System.in); } Scnr(InputStream in){ ins = in; } private boolean hasNextByte(){ if(ptr<buflen){ return true; }else{ ptr = 0; try{ buflen = ins.read(buffer); }catch(IOException e){ e.printStackTrace(); } if(buflen<=0){ return false; } } return true; } private int readByte(){ if(hasNextByte()){ return buffer[ptr++]; }else{ return -1; } } private static boolean isPrintableChar(int c){ return 33<=c&&c<=126; } public boolean hasNext(){ while(hasNextByte()&&!isPrintableChar(buffer[ptr])){ ptr++; } return hasNextByte(); } public String next(){ return nextBuilder().toString(); } public StringBuilder nextBuilder(){ if(!hasNext()){ throw new NoSuchElementException(); } StringBuilder sb = new StringBuilder(); int b = readByte(); while(isPrintableChar(b)){ sb.appendCodePoint(b); b = readByte(); } return sb; } public double nextDouble(){ return Double.parseDouble(next()); } public long nextLong(){ if(!hasNext()){ throw new NoSuchElementException(); } long n = 0; boolean minus = false; int b = readByte(); if(b=='-'){ minus=true; b=readByte(); } if(b<'0'||'9'<b){ throw new NumberFormatException(); } while(true){ if('0'<=b&&b<='9'){ n*=10; n+=b-'0'; }else if(b==-1||!isPrintableChar(b)){ return minus?-n:n; }else{ throw new NumberFormatException(); } b=readByte(); } } public int nextInt(){ long nl=nextLong(); if(nl<Integer.MIN_VALUE||Integer.MAX_VALUE<nl){ throw new NumberFormatException(); } return (int) nl; } public String[] nextA(int n){ String[] a = new String[n]; nextA(a,n); return a; } public void nextA(String[] a,int n){ nextA(a,0,n); } public void nextA(String[] a,int off,int len){ for(int i=off;i<off+len;i++){ a[i]=next(); } } public int[] nextAInt(int n){ int[] a = new int[n]; nextAInt(a,n); return a; } public void nextAInt(int[] a,int n){ nextAInt(a,0,n); } public void nextAInt(int[] a,int off,int len){ for(int i=off;i<off+len;i++){ a[i] = nextInt(); } } public long[] nextALong(int n){ long[] a = new long[n]; nextALong(a,n); return a; } public void nextALong(long[] a,int n){ nextALong(a,0,n); } public void nextALong(long[] a,int off,int len){ for(int i=off;i<off+len;i++){ a[i] = nextLong(); } } public double[] nextADouble(int n){ double[] a = new double[n]; nextADouble(a,n); return a; } public void nextADouble(double[] a,int n){ nextADouble(a,0,n); } public void nextADouble(double[] a,int off,int len){ for(int i=off;i<off+len;i++){ a[i] = nextDouble(); } } public List<Integer> nextLInt(int n){ List<Integer> l = new ArrayList<>(n); for(int i=0;i<n;i++){ l.add(sc.nextInt()); } return l; } public List<Long> nextLLong(int n){ List<Long> l = new ArrayList<>(n); for(int i=0;i<n;i++){ l.add(sc.nextLong()); } return l; } public List<Double> nextLDouble(int n){ List<Double> l = new ArrayList<>(n); for(int i=0;i<n;i++){ l.add(sc.nextDouble()); } return l; } } static Scnr sc = new Scnr(); static PrintWriter out = new PrintWriter(System.out); public static void main(String args[]){ //for(int i=sc.nextInt();i>0;i--) solve(); out.flush(); } static void solve(){ int n=sc.nextInt(); long a=sc.nextInt(); long b=sc.nextInt(); int[] x=sc.nextAInt(n); long ans=0; for(int i=1;i<n;i++){ ans+=Math.min((x[i]-x[i-1])*a,b); } out.println(ans); } }
a.cc:358:7: error: stray '@' in program 358 | @SuppressWarnings("unchecked") | ^ a.cc:384:7: error: stray '@' in program 384 | @SuppressWarnings("unchecked") | ^ a.cc:1:1: error: 'import' does not name a type 1 | import java.util.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.io.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: expected unqualified-id before 'public' 4 | public class Main{ | ^~~~~~
s297863106
p03829
C++
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; using ll = long long; #define rep(i, j, n) for(int i = j; i < (int)(n); i++) const ll MOD = 1000000007; const int INFI = 1000000000; const ll INFL = (1LL << 60); int main() { int N, A, B; cin >> N >> A >> B; vector<ll> X(N); rep(i, 0, N) cin >> X.at(i); ll ans = 0; rep(i, 0, N - 1) { ans += min(B, A * (X.at(i + 1) - X.at(i))); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:18:16: error: no matching function for call to 'min(int&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type)' 18 | ans += min(B, A * (X.at(i + 1) - X.at(i))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h: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:18:16: note: deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'}) 18 | ans += min(B, A * (X.at(i + 1) - X.at(i))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:18:16: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 18 | ans += min(B, A * (X.at(i + 1) - X.at(i))); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s213676010
p03829
C++
#include<bits/stdc++.h> #include <iostream> #include <string> #include <cmath> using namespace std; #define ll long long #define rep(i, n) for (ll i = 0; i < (n); i++) #define FOR(i,a,b) for(ll i=(a);i<(b);i++) #define FORR(i,a,b)for(ll i=(a);i<=(b);i++) #define repR(i,n) for(ll i=n;i>=0;i--) #define all(v)(v).begin(),(v).end() #define rall(v)(v).rbegin(),(v).rend() #define F first #define S second #define pb push_back #define pu push #define COUT(x) cout<<(x)<<endl #define PQ priority_queue<ll> #define PQR priority_queue<ll,vector<ll>,greater<ll>> #define YES(n) cout << ((n) ? "YES" : "NO" ) << endl #define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl #define mp make_pair #define maxs(x,y) (x = max(x,y)) #define mins(x,y) (x = min(x,y)) #define sz(x) (int)(x).size() typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll MOD = 1000000007LL; const ll INF = 1LL << 60; using vll = vector<ll>; using vb = vector<bool>; using vvb = vector<vb>; using vvll = vector<vll>; using vstr = vector<string>; using pll = pair<ll, ll>; int main(){ ll n,a,b; cin>>n>>a>>b; vll x(n); rep(i,n){ cin>>x[i]; x[i]-=x[0]; } ll ans=0; rep(i,n-1){ if((a[i+1]-a[i])*a>b){ ans+=b; } else{ ans+=(a[i+1]-a[i])*a; } } COUT(ans); }
a.cc: In function 'int main()': a.cc:46:10: error: invalid types 'long long int[long long int]' for array subscript 46 | if((a[i+1]-a[i])*a>b){ | ^ a.cc:46:17: error: invalid types 'long long int[long long int]' for array subscript 46 | if((a[i+1]-a[i])*a>b){ | ^ a.cc:50:14: error: invalid types 'long long int[long long int]' for array subscript 50 | ans+=(a[i+1]-a[i])*a; | ^ a.cc:50:21: error: invalid types 'long long int[long long int]' for array subscript 50 | ans+=(a[i+1]-a[i])*a; | ^
s275756497
p03829
C++
#include <iostream> #include <vector> using namespace std; int main() { ll n,a,b,i; ll ans = 0; cin >> n >> a >> b; vector<ll> x(n); for(i = 0;i < n;++i){ cin >> x.at(i); } for(i = 1;i < n;++i){ ans += min(a*(x.at(i)-x.at(i-1)),b); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:5: error: 'll' was not declared in this scope 7 | ll n,a,b,i; | ^~ a.cc:8:7: error: expected ';' before 'ans' 8 | ll ans = 0; | ^~~~ | ; a.cc:9:12: error: 'n' was not declared in this scope 9 | cin >> n >> a >> b; | ^ a.cc:9:17: error: 'a' was not declared in this scope 9 | cin >> n >> a >> b; | ^ a.cc:9:22: error: 'b' was not declared in this scope 9 | cin >> n >> a >> b; | ^ a.cc:10:14: error: template argument 2 is invalid 10 | vector<ll> x(n); | ^ a.cc:11:9: error: 'i' was not declared in this scope 11 | for(i = 0;i < n;++i){ | ^ a.cc:12:18: error: request for member 'at' in 'x', which is of non-class type 'int' 12 | cin >> x.at(i); | ^~ a.cc:14:9: error: 'i' was not declared in this scope 14 | for(i = 1;i < n;++i){ | ^ a.cc:15:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 15 | ans += min(a*(x.at(i)-x.at(i-1)),b); | ^~~ | abs a.cc:15:25: error: request for member 'at' in 'x', which is of non-class type 'int' 15 | ans += min(a*(x.at(i)-x.at(i-1)),b); | ^~ a.cc:15:33: error: request for member 'at' in 'x', which is of non-class type 'int' 15 | ans += min(a*(x.at(i)-x.at(i-1)),b); | ^~ a.cc:17:13: error: 'ans' was not declared in this scope; did you mean 'abs'? 17 | cout << ans << endl; | ^~~ | abs
s598016769
p03829
C++
#include<bits/stdc++.h> using namespace std; long long n,a,b,ans; long long x[100005],; int main(){ cin>>n>>a>>b; for(int i=1;i<=n;i++){ cin>>x[i]; } for(int i=1;i<n;i++){ ans+=min(a*(x[i+1]-x[i]),b); } cout<<ans<<endl; return 0; }
a.cc:4:21: error: expected unqualified-id before ';' token 4 | long long x[100005],; | ^
s493159931
p03829
Java
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int A = scanner.nextInt(); int B = scanner.nextInt(); int[] X = new int[N]; for (int i = 0; i < N; i++) { X[i] = scanner.nextInt(); } long ans = 0; for (int i = 0; i < N - 1; i++) { if (A * (X[i + 1] - X[i]) < B) { ans += A * (X[i + 1] - X[i]); } else { ans += B; } } System.out.println(ans); }
Main.java:23: error: reached end of file while parsing } ^ 1 error
s314993408
p03829
Java
public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); int A = scanner.nextInt(); int B = scanner.nextInt(); int[] X = new int[N]; for (int i = 0; i < N; i++) { X[i] = scanner.nextInt(); } int ans = 0; for (int i = 0; i < N - 1; i++) { if (A * (X[i + 1] - X[i]) < B) { ans += A * (X[i + 1] - X[i]); } else { ans += B; } } System.out.println(ans); }
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
s981818255
p03829
C++
N, A, B = map(int, input().split()) X = list(map(int, input().split())) print(sum([min(A*(X[i + 1] - X[i]), B) for i in range(N - 1)]))
a.cc:1:1: error: 'N' does not name a type 1 | N, A, B = map(int, input().split()) | ^
s537476367
p03829
C++
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n , a , b ; cin>>n>>a>>b; int arr[n]; for(int i = 0 ; i < n ; ++i)cin>>arr[i]; ll res = 0; for(int i = 0 ; i < n-1 ; ++i){ ll dis = abs(arr[i] - arr[i+1]); res += min(dis*a , b); } cout<<res; return 0; }
a.cc: In function 'int main()': a.cc:12:27: error: no matching function for call to 'min(ll, int&)' 12 | res += min(dis*a , b); | ~~~^~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:12:27: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 12 | res += min(dis*a , b); | ~~~^~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:12:27: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 12 | res += min(dis*a , b); | ~~~^~~~~~~~~~~
s654052043
p03829
Java
import java.util.Scanner; public class { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int []x = new int [n]; for(int i = 0; i < n ; i++) { x[i] = sc.nextInt(); } int now = x[0]; long sum = 0; for(int i = 1 ; i < n ; i++) { int temp = x[i] - now; if((long)a * temp > b) { sum += b; } else { sum += (long) a * temp; } now = x[i]; } System.out.println(sum); } }
Main.java:2: error: <identifier> expected public class { ^ 1 error
s263892826
p03829
C++
// --------------------<optimizations>-------------------- #pragma GCC optimize("O3") //(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)\ #pragma comment(linker, "/stack:200000000") //(UNCOMMENT WHEN TRYING TO BRUTEFORCE WITH A LOT OF LOOPS)\ #pragma GCC optimize("unroll-loops") #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimization ("unroll-loops") #include<bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define eb emplace_back #define pii pair<ll,ll> #define vpii vector<pair<ll,ll> > #define F first #define S second #define ld long double #define built __builtin_popcountll #define mst(a,i) memset(a,i,sizeof(a)) #define all(x) x.begin(),x.end() #define itit(it,a) for(auto it=(a).begin(); it!=(a).end(); it++) #define rep(i,a,b) for(ll i=a; i<b; i++) #define repr(i,a,b) for(ll i=a; i>b; i--) #define reprr(i,a,b) for(ll i=a; i>=b; i--) #define pi 3.14159265358979323846264338327950288419716939937510582097494459230 ll max3(ll x,ll y,ll z) {return max(max(x,y),z);} ll min3(ll x,ll y,ll z) {return min(min(x,y),z);} const ll M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e17+10; const int INF=1e9+7; void add(int& a, int b) {a+=b;if(a>=mod){a-=mod;}} #define trace1(x) cerr<<#x<<": "<<x<<endl #define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl #define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl #define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl #define trace5(a, b, c, d, e) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl int X[] = {0, 1, 0, -1}; int Y[] = {-1, 0, 1, 0}; ll power(ll x,ll n){ll result=1;while(n>0){if(n%2==1)result=(result*x)%mod; x=((x%mod)*(x%mod))%mod;n=n/2;}return result;} ll n,a,b; ll x[M]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> a >> b; for(ll i=0; i<n; i++) cin >> x[i]; ll ans=0; for(ll i=1; i<n; i++){ ans+=min((b,a*(x[i]-x[i-1])); } cout << ans; return 0; } /* The judge is never wrong! Your code is buggy Look for: * * Read the problem carefully. * * Don't forget to sort(), mod, ll!!!! * * Initial value = +/- infinity instead of zero!!! * * an easier and alternate approach * * read the problem statement carefully * * if concept is correct and still WA, try with a different implementation * * special cases (n=1?) * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/ */
a.cc: In function 'int main()': a.cc:60:37: error: expected ')' before ';' token 60 | ans+=min((b,a*(x[i]-x[i-1])); | ~ ^ | )
s419137012
p03829
C++
#include<bits/stdc++.h> using namespace std; int n,i,j,w,f,sum; long long a[100001]; int main() { cin>>n>>w>>f; for(i=1;i<=n;i++)cin>>a[i]; for(i=1;i<=n-1;i++){ sum+=min(w*(a[i+1]-a[i]),f); } cout<<sum<<endl; return 0; }
a.cc: In function 'int main()': a.cc:10:25: error: no matching function for call to 'min(long long int, int&)' 10 | sum+=min(w*(a[i+1]-a[i]),f); | ~~~^~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)' 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed: a.cc:10:25: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 10 | sum+=min(w*(a[i+1]-a[i]),f); | ~~~^~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)' 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)' 5686 | min(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)' 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed: a.cc:10:25: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 10 | sum+=min(w*(a[i+1]-a[i]),f); | ~~~^~~~~~~~~~~~~~~~~~~
s980911325
p03829
C++
#include <iostream> using namespace std; int main(){ int n, a, b; cin >> n >> a >> b; int pre; cin >> pre; long ans = 0; for(int i=0; i<n - 1; i++){ int x; cin >> x; ans += min ((long)(x - pre) * a, b); pre = x; } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:13:28: error: no matching function for call to 'min(long int, int&)' 13 | ans += min ((long)(x - pre) * a, b); | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~ 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:13:28: note: deduced conflicting types for parameter 'const _Tp' ('long int' and 'int') 13 | ans += min ((long)(x - pre) * a, b); | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~ /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
s946844212
p03829
C++
#include <iostream> using namespace std; int main() { int x , a , b , size = 100002 ; long long int sum = 0 ; cin >> x >> a >> b ; int arr[100002]; for(int i = 0 ; i < x ; i++){ cin >> arr[i]; } for(int i = 0 ; i < x-1 ; i++){ if (sum2 < sum) sum = sum2 ; if ( (arr[i+1] - arr[i]) * a < b ){ sum = sum +(arr[i+1] - arr[i]) * a ; sum2 = sum2 + b ; } else sum = sum + b ; // cout << sum << endl ; } cout << sum ; return 0 ; }
a.cc: In function 'int main()': a.cc:15:13: error: 'sum2' was not declared in this scope; did you mean 'sum'? 15 | if (sum2 < sum) | ^~~~ | sum a.cc:19:14: error: 'sum2' was not declared in this scope; did you mean 'sum'? 19 | sum2 = sum2 + b ; | ^~~~ | sum
s610250445
p03829
C++
use std::io::*; fn main(){ let n : usize = input(); let a : isize = input(); let b : isize = input(); let x : Vec<isize> = (0..n).map(|_| input()).collect(); let mut ans = 0; for i in 1..n{ ans += if (x[i] - x[i - 1]) * a < b {(x[i] - x[i - 1]) * a} else {b}; } println!("{}", ans); } fn input<T>() -> T where T: std::str::FromStr, { let stdin = std::io::stdin(); let token: String = stdin .lock() .bytes() .map(|c| c.unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespace()) .collect(); token.parse().ok().unwrap() }
a.cc:7:27: error: too many decimal points in number 7 | let x : Vec<isize> = (0..n).map(|_| input()).collect(); | ^~~~ a.cc:9:14: error: too many decimal points in number 9 | for i in 1..n{ | ^~~~ a.cc:1:1: error: 'use' does not name a type 1 | use std::io::*; | ^~~ a.cc:3:1: error: 'fn' does not name a type 3 | fn main(){ | ^~ a.cc:15:1: error: 'fn' does not name a type 15 | fn input<T>() -> T | ^~
s316397818
p03829
C++
#include <bits/stdc++.h> #define rep(i, n) for(int i=0;i<(int)(n);i++) #define reps(i, n) for(int i=1;i<=(int)(n);i++) #define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--) #define repi(i,n,m) for(int i=(int)(n);i<(int)(m);i++) #define all(x) (x).begin(),(x).end() typedef long long ll; using namespace std; int main(){ l n,a,b; cin>>n>>a>>b; vector<ll> x(n); rep(i,n) cin>>x.at(i); ll ans=0; rep(i,n-1){ ll d=x.at(i+1)-x.at(i); ans+=min(b,d*a); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:10:5: error: 'l' was not declared in this scope; did you mean 'll'? 10 | l n,a,b; | ^ | ll a.cc:11:10: error: 'n' was not declared in this scope; did you mean 'yn'? 11 | cin>>n>>a>>b; | ^ | yn a.cc:11:13: error: 'a' was not declared in this scope 11 | cin>>n>>a>>b; | ^ a.cc:11:16: error: 'b' was not declared in this scope 11 | cin>>n>>a>>b; | ^
s329300616
p03829
C++
#include <array> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <deque> #include <complex> #include <stack> #include <queue> #include <cstdio> #include <cctype> #include <cstring> #include <ctime> #include <iterator> #include <bitset> #include <numeric> #include <list> #include <iomanip> using namespace std; typedef long long LL; typedef pair<int,int> pii; typedef pair<LL,LL> pll; typedef vector<int> vint; typedef vector<vector<int> > vvint; typedef vector<long long> vll, vLL; typedef vector<vector<long long> > vvll, vvLL; #define VV(T) vector<vector< T > > template <class T> void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){ v.assign(a, vector<T>(b, t)); } template <class F, class T> void convert(const F &f, T &t){ stringstream ss; ss << f; ss >> t; } #define REP(i,n) for(int i=0;i<int(n);++i) #define ALL(v) (v).begin(),(v).end() #define RALL(v) (v).rbegin(),(v).rend() #define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i) #define PB push #define MOD 1000000007LL #define EPS 1e-10 int main() { int N, A, B; cin >> N >> A >> B; int X[N]; REP(i, N) cin >> X[i]; LL ans = 0; REP(i, N - 1) { ans += min((X[i + 1] - X[i]) * A, B); } cout << ans << endl; return 0; }#include <array> #include <cstdlib> #include <cmath> #include <climits> #include <cfloat> #include <map> #include <utility> #include <set> #include <iostream> #include <memory> #include <string> #include <vector> #include <algorithm> #include <functional> #include <sstream> #include <deque> #include <complex> #include <stack> #include <queue> #include <cstdio> #include <cctype> #include <cstring> #include <ctime> #include <iterator> #include <bitset> #include <numeric> #include <list> #include <iomanip> using namespace std; typedef long long LL; typedef pair<int,int> pii; typedef pair<LL,LL> pll; typedef vector<int> vint; typedef vector<vector<int> > vvint; typedef vector<long long> vll, vLL; typedef vector<vector<long long> > vvll, vvLL; #define VV(T) vector<vector< T > > template <class T> void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){ v.assign(a, vector<T>(b, t)); } template <class F, class T> void convert(const F &f, T &t){ stringstream ss; ss << f; ss >> t; } #define REP(i,n) for(int i=0;i<int(n);++i) #define ALL(v) (v).begin(),(v).end() #define RALL(v) (v).rbegin(),(v).rend() #define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i) #define PB push #define MOD 1000000007LL #define EPS 1e-10 int main() { int N, A, B; cin >> N >> A >> B; int X[N]; REP(i, N) cin >> X[i]; LL ans = 0; REP(i, N - 1) { ans += min((X[i + 1] - X[i]) * A, B); } cout << ans << endl; return 0; }
a.cc:79:2: error: stray '#' in program 79 | }#include <array> | ^ a.cc:79:3: error: 'include' does not name a type 79 | }#include <array> | ^~~~~~~ a.cc:122:6: error: redefinition of 'template<class T> void initvv(std::vector<std::vector<_Tp> >&, int, int, const T&)' 122 | void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){ | ^~~~~~ a.cc:44:6: note: 'template<class T> void initvv(std::vector<std::vector<_Tp> >&, int, int, const T&)' previously declared here 44 | void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){ | ^~~~~~ a.cc:127:6: error: redefinition of 'template<class F, class T> void convert(const F&, T&)' 127 | void convert(const F &f, T &t){ | ^~~~~~~ a.cc:49:6: note: 'template<class F, class T> void convert(const F&, T&)' previously declared here 49 | void convert(const F &f, T &t){ | ^~~~~~~ a.cc:144:5: error: redefinition of 'int main()' 144 | int main() | ^~~~ a.cc:66:5: note: 'int main()' previously defined here 66 | int main() | ^~~~
s461896360
p03829
C++
#include<iostream> #include<algorithm> #include<cmath> #include<cstring> #include<cstdlib> #include<ctime> #include<cstdio> #include<string> //#include<string> //#include<sstream> int main() { int dp[110000]; int a[110000]; int n,x,b; cin>>n>>x>>b; for(int i=1;i<=n;i++) { cin>>a[i]; } dp[1]=0; a[0]=0; for(int i=2;i<=n;i++) { dp[i]=min(dp[i-1]+(a[i]-a[i-1])*x,dp[i-1]+b); } cout<<dp[n]<<endl; return 0; }
a.cc: In function 'int main()': a.cc:16:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 16 | cin>>n>>x>>b; | ^~~ | std::cin In file included from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:25:15: error: 'min' was not declared in this scope; did you mean 'std::min'? 25 | dp[i]=min(dp[i-1]+(a[i]-a[i-1])*x,dp[i-1]+b); | ^~~ | std::min In file included from /usr/include/c++/14/algorithm:61, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here 5696 | min(initializer_list<_Tp> __l, _Compare __comp) | ^~~ a.cc:27:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 27 | cout<<dp[n]<<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:27:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 27 | cout<<dp[n]<<endl; | ^~~~ | std::endl In file included from /usr/include/c++/14/iostream:41: /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s725487643
p03829
C++
#include <iostream> #include <cmath> #include <string> #include <algorithm> #include <set> #include <vector> #include <map> #include <list> #include <stack> #include <cstdio> #include <cstring> #include <cstdlib> #include <queue> #define mkp make_pair #define fi first #define se second #define pt(num) cout << num << "\n" #define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD #define max(a, b) ((a)>(b) ? (a):(b)) #define min(a, b) ((a)<(b) ? (a):(b)) #define chmax(a, b) (a<b ? a=b : 0) #define chmin(a, b) (a>b ? a=b : 0) #define INF 1000000000000000000 #define MOD 1000000007LL #define MAX 101010 using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef map<ll, ll> Map; int main(void) { ll N, A, B; cin >> N >> A >> B; ll i; ll x[MAX]; for(i=0; i<N; i++) cin >> x[i]; ll p=x[0]; for(i=1; i<N; i++) { ans+=min(A*(x[i]-p), B); p=x[i]; } pt(ans); }
a.cc: In function 'int main()': a.cc:44:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 44 | ans+=min(A*(x[i]-p), B); | ^~~ | abs a.cc:48:8: error: 'ans' was not declared in this scope; did you mean 'abs'? 48 | pt(ans); | ^~~ a.cc:17:25: note: in definition of macro 'pt' 17 | #define pt(num) cout << num << "\n" | ^~~
s454560340
p03829
C++
#include <iostream> using namespace std; typedef long long ll; int n,a,b,p,t; ll sum=0; int main(void){ cin>>n>>a>>b; cin>>p; for(int i=0;i<n;i++){ cin>>t; sum+=min(b,(ll) (t-p)*a); p=t; } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:13:17: error: no matching function for call to 'min(int&, ll)' 13 | sum+=min(b,(ll) (t-p)*a); | ~~~^~~~~~~~~~~~~~~~ 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:13:17: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'}) 13 | sum+=min(b,(ll) (t-p)*a); | ~~~^~~~~~~~~~~~~~~~ /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
s746965518
p03829
C++
#include "bits/stdc++.h" #define rep(i,a,n) for(int i = a;i < n;i++) typedef unsigned long long ull; typedef long long ll; using namespace std; int main(){ int n,a,b,memo = 0; cin >> n >> a >> b; int a[n]; rep(i,0,n){ cin >> d[i]; if(i > 0){ memo += min(d[i]-d[i-1]*b,a); } } cout << memo << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:13: error: conflicting declaration 'int a [n]' 10 | int a[n]; | ^ a.cc:8:15: note: previous declaration as 'int a' 8 | int n,a,b,memo = 0; | ^ a.cc:13:16: error: 'd' was not declared in this scope 13 | cin >> d[i]; | ^
s148715596
p03829
C++
#include "bits/stdc++.h" #define rep(i,a,n) for(int i = a;i < n;i++) typedef unsigned long long ull; typedef long long ll; using namespace std; int main(){ int n,a,b,memo = 0; cin >> n >> a >> b; int a[n]; rep(i,0,n){ cin >> a[i]; if(i > 0){ memo += min(a[i]-a[i-1]*b,a); } } cout << memo << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:13: error: conflicting declaration 'int a [n]' 10 | int a[n]; | ^ a.cc:8:15: note: previous declaration as 'int a' 8 | int n,a,b,memo = 0; | ^ a.cc:13:17: error: invalid types 'int[int]' for array subscript 13 | cin >> a[i]; | ^ a.cc:15:30: error: invalid types 'int[int]' for array subscript 15 | memo += min(a[i]-a[i-1]*b,a); | ^ a.cc:15:35: error: invalid types 'int[int]' for array subscript 15 | memo += min(a[i]-a[i-1]*b,a); | ^
s189472496
p03829
C++
#include<bits/stdc++.h> using namespace std; int a[100001]; int main(){ long long N,A,B,P,X,ans=0; cin>>P; for(int i=1;i<N;i++){ cin>>x; ans+=min(A*(X-P),B); P=X; } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:8:22: error: 'x' was not declared in this scope 8 | cin>>x; | ^
s136699739
p03829
C++
#include<bits/stdc++.h> using namespace std; int a[100001],b[100001],c[100001]; int main(){ long long n,p,x,i,j,s1,s2; cin>>n; cin>>s1>>s2; for(i=1;i<=n;i++){ cin>>a[i]; b[a[i]]=a[i]; c[i]=a[i]-a[i-1]+1; } for(i=1;i<=n;i++){ if(i==b[i]){ c[i+1] } } cout<<endl; cout<<p; return 0; }
a.cc: In function 'int main()': a.cc:15:31: error: expected ';' before '}' token 15 | c[i+1] | ^ | ; 16 | } | ~
s304325152
p03829
C++
#include<bits/stdc++.h> long long a[1000001]; int main(){ long long n,A,B,ans=0; cin>>n>>A>>B; for(int i=1;i<=n;i++){ cin>>a[i]; } for(long long i=2;i<=n;i++){ long long len=a[i]-a[i-1]; long long tmp=len*A; if(tmp<B){ ans+=tmp; }else ans+=B; } cout<<ans; return 0; }
a.cc: In function 'int main()': a.cc:5:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 5 | cin>>n>>A>>B; | ^~~ | std::cin In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146, from a.cc:1: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:16:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 16 | cout<<ans; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
s706327847
p03829
C++
#include<iostream> using namespace std; using ll = long long; int main() { int n, a, b; cin >> n >> a >> b; ll x[n]; for (int i = 0;i < n;i++)cin >> x[i]; ll ans = 0; for (int i = 1;i < n;i++) { ans += min((x[i] - x[i - 1])*a, b); } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:12:27: error: no matching function for call to 'min(ll, int&)' 12 | ans += min((x[i] - x[i - 1])*a, b); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ 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:12:27: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 12 | ans += min((x[i] - x[i - 1])*a, b); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~ /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
s963348229
p03829
C++
#include<iostream> #include<math.h> using namespace std; int main(){ long long n,a,b,ans; long long x[10001]; cin>>n>>a>>b; for(int i=0;i<n;i++) cin>>x[i]; ans=0; for(int i=1;i<n;i++){ long long tmp; tmp=(x[i]-x[i-1])*a; if(tmp>b) ans+=b; else ans+=tmp; } cout<<ans<endl; return 0; }
a.cc: In function 'int main()': a.cc:16:18: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 16 | cout<<ans<endl; | ~~~~~~~~~^~~~~ 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:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 16 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 16 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 16 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 16 | cout<<ans<endl; | ^~~~ 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:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 16 | cout<<ans<endl; | ^~~~ 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:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 16 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 16 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:16:19: note: couldn't deduce template parameter '_CharT' 16 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874: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>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 16 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 16 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed: a.cc:16:19: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>' 16 | cout<<ans<endl; | ^~~~ 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:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2600 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed: a.cc:16:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 16 | cout<<ans<endl; | ^~~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:324:3: note: candidate: 'bool std::operator<(const error_code&, const error_code&)' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ^~~~~~~~ /usr/include/c++/14/system_error:324:31: note: no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'const std::error_code&' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/system_error:507:3: note: candidate: 'bool std::operator<(const error_condition&, const error_condition&)' 507 | operator<(const error_condition& __lhs, | ^~~~~~~~ /usr/include/c++/14/system_error:507:36: note: no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'const std::error_condition&' 507 | operator<(const error_condition& __lhs, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
s822457044
p03829
C++
#include<iostream> #include<climits> #include<math.h> #include<vector> #include<algorithm> using namespace std; int main(){ long long n,a,b,ans; long long x[10001]; cin>>n>>a>>b; for(int i=0;i<n;i++) cin>>x[i]; ans=0; for(int i=1;i<n;i++){ long long tmp; tmp=(x[i]-x[i-1])*a; if(tmp>b) ans+=b; else ans+=k; } cout<<ans<endl; return 0; }
a.cc: In function 'int main()': a.cc:17:27: error: 'k' was not declared in this scope 17 | else ans+=k; | ^ a.cc:19:18: error: no match for 'operator<' (operand types are 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 19 | cout<<ans<endl; | ~~~~~~~~~^~~~~ 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:448:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)' 448 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:448:5: note: template argument deduction/substitution failed: a.cc:19:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 19 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)' 493 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:493:5: note: template argument deduction/substitution failed: a.cc:19:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::reverse_iterator<_Iterator>' 19 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' 1694 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1694:5: note: template argument deduction/substitution failed: a.cc:19:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 19 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' 1760 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/14/bits/stl_iterator.h:1760:5: note: template argument deduction/substitution failed: a.cc:19:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::move_iterator<_IteratorL>' 19 | cout<<ans<endl; | ^~~~ 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:1045:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' 1045 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_pair.h:1045:5: note: template argument deduction/substitution failed: a.cc:19:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::pair<_T1, _T2>' 19 | cout<<ans<endl; | ^~~~ 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:673:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)' 673 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:673:5: note: template argument deduction/substitution failed: a.cc:19:19: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 19 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/string_view:680:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)' 680 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:680:5: note: template argument deduction/substitution failed: a.cc:19:19: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>' 19 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/string_view:688:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)' 688 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/14/string_view:688:5: note: template argument deduction/substitution failed: a.cc:19:19: note: couldn't deduce template parameter '_CharT' 19 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3874: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>&)' 3874 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3874:5: note: template argument deduction/substitution failed: a.cc:19:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 19 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)' 3888 | operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3888:5: note: template argument deduction/substitution failed: a.cc:19:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' 19 | cout<<ans<endl; | ^~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)' 3901 | operator<(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:3901:5: note: template argument deduction/substitution failed: a.cc:19:19: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>' 19 | cout<<ans<endl; | ^~~~ 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:2600:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)' 2600 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/14/tuple:2600:5: note: template argument deduction/substitution failed: a.cc:19:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::tuple<_UTypes ...>' 19 | cout<<ans<endl; | ^~~~ In file included from /usr/include/c++/14/vector:66, from a.cc:4: /usr/include/c++/14/bits/stl_vector.h:2089:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' 2089 | operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/14/bits/stl_vector.h:2089:5: note: template argument deduction/substitution failed: a.cc:19:19: note: 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} is not derived from 'const std::vector<_Tp, _Alloc>' 19 | cout<<ans<endl; | ^~~~ In file included from /usr/include/c++/14/bits/ios_base.h:46: /usr/include/c++/14/system_error:324:3: note: candidate: 'bool std::operator<(const error_code&, const error_code&)' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ^~~~~~~~ /usr/include/c++/14/system_error:324:31: note: no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'const std::error_code&' 324 | operator<(const error_code& __lhs, const error_code& __rhs) noexcept | ~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/system_error:507:3: note: candidate: 'bool std::operator<(const error_condition&, const error_condition&)' 507 | operator<(const error_condition& __lhs, | ^~~~~~~~ /usr/include/c++/14/system_error:507:36: note: no known conversion for argument 1 from 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'const std::error_condition&' 507 | operator<(const error_condition& __lhs, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~
s080805726
p03829
C++
#include<iostream> using namespace std; int main(){ int n,a,b; cin>>n>>a>>b; int x[n]={0}; for(int i=0;i<n;i++){ cin>>x[i]; } long long int ans=0; for(int i=1;i<n;i++){ long long int w=a*(x[i]-x[i-1]); ans+=min(w,b); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:14:25: error: no matching function for call to 'min(long long int&, int&)' 14 | ans+=min(w,b); | ~~~^~~~~ 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:14:25: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 14 | ans+=min(w,b); | ~~~^~~~~ /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
s166257472
p03829
C++
#include<iostream> using namespace std; int main(){ int n,a,b; cin>>n>>a>>b; int x[n]={0}; for(int i=0;i<n;i++){ cin>>x[i]; } int ans=0 for(int i=0;i<n-1;i++){ int w=a*(x[i+1]-x[i]); ans+=min(w,b); } cout<<ans<<endl; }
a.cc: In function 'int main()': a.cc:12:9: error: expected ',' or ';' before 'for' 12 | for(int i=0;i<n-1;i++){ | ^~~ a.cc:12:21: error: 'i' was not declared in this scope 12 | for(int i=0;i<n-1;i++){ | ^
s279405350
p03829
C++
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main(){ int N,A,B; scanf("%d%d%d",&N,&A,&B); int i,a[100000]; for(i=0;i<N;i++){ scanf("%d",&a[i]); } int sun=0; for(i=0;i<N-1;i++){ if(A*(a[i+1]-a[i])>=B){ sum+=B; } else{ sum+=A*(a[i+1]-a[i]); } } }
a.cc: In function 'int main()': a.cc:13:1: error: 'sum' was not declared in this scope; did you mean 'sun'? 13 | sum+=B; | ^~~ | sun a.cc:16:1: error: 'sum' was not declared in this scope; did you mean 'sun'? 16 | sum+=A*(a[i+1]-a[i]); | ^~~ | sun
s394643574
p03829
C++
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main{ int N,A,B; scanf("%d%d%d",&N,&A,&B); int i,a[100000]; for(i=0;i<N;i++){ scanf("%d",&a[i]); } int sun=0; for(i=0;i<N-1;i++){ if(A*(a[i+1]-a[i])>=B){ sum+=B; } else{ sum+=A*(a[i+1]-a[i]); } } }
a.cc:3:5: error: cannot declare '::main' to be a global variable 3 | int main{ | ^~~~ a.cc:4:1: error: expected primary-expression before 'int' 4 | int N,A,B; | ^~~ a.cc:4:1: error: expected '}' before 'int' a.cc:3:9: note: to match this '{' 3 | int main{ | ^ a.cc:5:6: error: expected constructor, destructor, or type conversion before '(' token 5 | scanf("%d%d%d",&N,&A,&B); | ^ a.cc:7:1: error: expected unqualified-id before 'for' 7 | for(i=0;i<N;i++){ | ^~~ a.cc:7:9: error: 'i' does not name a type 7 | for(i=0;i<N;i++){ | ^ a.cc:7:13: error: 'i' does not name a type 7 | for(i=0;i<N;i++){ | ^ a.cc:11:1: error: expected unqualified-id before 'for' 11 | for(i=0;i<N-1;i++){ | ^~~ a.cc:11:9: error: 'i' does not name a type 11 | for(i=0;i<N-1;i++){ | ^ a.cc:11:15: error: 'i' does not name a type 11 | for(i=0;i<N-1;i++){ | ^ a.cc:21:1: error: expected declaration before '}' token 21 | } | ^
s971795007
p03829
C++
#include <bits/stdc++.h> #define INF 1 << 29 #define REP(i,n) for(int i=0; i<(int)(n); i++) #define FOR(i,k,n) for(int i=(k);i<(int)(n);i++) using namespace std; typedef pair<int,int> pii; typedef long long int ll; void gen_sosuu(int sosuu[]){ REP(i,100010){ sosuu[i] = true; } sosuu[0] = false; sosuu[1] = false; sosuu[2] = true; FOR(i,2,sqrt(100000)+1){ if(sosuu[i] == false) continue; for(int j = 2; i*j<=100000;j++){ //printf("%d %d %d\n",i*j,i,j); sosuu[i*j] =false; } } } ll n,a,b; ll now,next; ll sum = 0; int main(){ cin >> n>>a>>b>>now; REP(i,n-1){ cin >> next; sum += min(b,(next-now)*a); //printf("%d,%d\n",b,(next-now)*a); now = next; } cout << sum<<endl; }
a.cc: In function 'int main()': a.cc:33:12: error: reference to 'next' is ambiguous 33 | cin >> next; | ^~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:66, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:28:8: note: 'll next' 28 | ll now,next; | ^~~~ a.cc:34:19: error: reference to 'next' is ambiguous 34 | sum += min(b,(next-now)*a); | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:28:8: note: 'll next' 28 | ll now,next; | ^~~~ a.cc:36:11: error: reference to 'next' is ambiguous 36 | now = next; | ^~~~ /usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)' 232 | next(_InputIterator __x, typename | ^~~~ a.cc:28:8: note: 'll next' 28 | ll now,next; | ^~~~
s007934869
p03829
C++
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define INF (1<<30) #define INFLL (1ll<<60) typedef pair<ll, int> P; #define MOD (1000000007ll) #define l_ength size ll sq(ll x){ return x*x; } void mul_mod(ll& a, ll b){ a *= b; a %= MOD; } bool isvowel(char c){ int i; string v="aeiou"; for(i = (v.size()-1); i>=0; --i){ if(c == v[i]){ return true; } } return false; } int main(void){ int n,i; ll x[123456],a,b,ans=0ll: cin >> n >> a >> b; for(i=0; i<n; ++i){ cin >> x[i]; } for(i=1; i<n; i++){ ans += min(a*(x[i]-x[i-1]),b); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:32:33: error: expected ',' or ';' before ':' token 32 | ll x[123456],a,b,ans=0ll: | ^
s743658965
p03829
C++
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define INF (1<<30) #define INFLL (1ll<<60) typedef pair<ll, int> P; #define MOD (1000000007ll) #define l_ength size ll sq(ll x){ return x*x; } void mul_mod(ll& a, ll b){ a *= b; a %= MOD; } bool isvowel(char c){ int i; string v="aeiou"; for(i = (v.size()-1); i>=0; --i){ if(c == v[i]){ return true; } } return false; } int main(void){ int n,i; ll x[123456],a,b,ans=0: cin >> n >> a >> b; for(i=0; i<n; ++i){ cin >> x[i]; } for(i=1; i<n; i++){ ans += min(a*(x[i]-x[i-1]),b); } return 0; }
a.cc: In function 'int main()': a.cc:32:31: error: expected ',' or ';' before ':' token 32 | ll x[123456],a,b,ans=0: | ^
s181108818
p03829
C++
// finish date: 2018/02/02 #include <iostream> #include <cmath> #include <vector> #include <bitset> #include <algorithm> #include <stack> #include <queue> #include <map> #include <climits> using namespace std; #define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++) #define rep(i, n) FOR(i,0,n) #define ll long long #define vi vector<int> #define vvi vector<vector<int>> #define vvvi vector<vector<vector<int>>> #define vl vector<ll> #define vvl vector<vector<ll>> #define vb vector<bool> #define vvb vector<vector<bool>> #define vs vector<string> #define vc vector<char> #define vvc vector<vector<char>> #define bigmod 1000000007 #define INF 1050000000 #include <iostream> #include <cmath> #include <vector> #include <bitset> #include <algorithm> #include <stack> #include <queue> #include <map> #include <climits> using namespace std; int main() { int N, A, B; cin >> N >> A >> B; ll total = 0; vi X(N); rep(i, N) cin >> X[i]; //sort(X.begin(),X.end()); FOR(i, 1, N) { total += min((ll)A * (X[i] - X[i - 1]), B); } cout << total << endl; return 0; }
a.cc: In function 'int main()': a.cc:51:21: error: no matching function for call to 'min(long long int, int&)' 51 | total += min((ll)A * (X[i] - X[i - 1]), B); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/string:51, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:2: /usr/include/c++/14/bits/stl_algobase.h: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:51:21: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 51 | total += min((ll)A * (X[i] - X[i - 1]), B); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:6: /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:51:21: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 51 | total += min((ll)A * (X[i] - X[i - 1]), B); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s018913947
p03829
C++
#include <iostream> #include <algorithm> using namespace std; typedef long long ll; int main(void) { int n ll a, b; cin >> n >> a >> b; ll l, r; cin >> l; ll ans = 0; for (int i = 1; i < n; i++) { cin >> r; ans += min((r - l) * a, b); l = r; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:3: error: expected initializer before 'll' 7 | ll a, b; | ^~ a.cc:8:10: error: 'n' was not declared in this scope 8 | cin >> n >> a >> b; | ^ a.cc:8:15: error: 'a' was not declared in this scope 8 | cin >> n >> a >> b; | ^ a.cc:8:20: error: 'b' was not declared in this scope 8 | cin >> n >> a >> b; | ^
s666538633
p03829
C++
#include <iostream> #include <algorithm> #include <vector> using namespace std; typedef long long ll; int main(void) { int n, a, b; cin >> n >> a >> b; vector<int> x(ll); cin >> x[0]; ll ans = 0; for (int i = 1; i < n; i++) { cin >> x[i]; ans += min((x[i] - x[i - 1]) * a, b); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:13: warning: pointer to a function used in arithmetic [-Wpointer-arith] 10 | cin >> x[0]; | ^ a.cc:10:7: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>(ll)' {aka 'std::vector<int>(long long int)'}) 10 | cin >> x[0]; | ~~~ ^~ ~~~~ | | | | | std::vector<int>(ll) {aka std::vector<int>(long long int)} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, 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>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:10:13: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::vector<int> (*)(ll)' {aka 'std::vector<int> (*)(long long int)'} 10 | cin >> x[0]; | ~~~^ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:10:13: error: invalid conversion from 'std::vector<int> (*)(ll)' {aka 'std::vector<int> (*)(long long int)'} to 'short int' [-fpermissive] 10 | cin >> x[0]; | ~~~^ | | | std::vector<int> (*)(ll) {aka std::vector<int> (*)(long long int)} a.cc:10:13: error: cannot bind rvalue '(short int)x' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:10:13: error: invalid conversion from 'std::vector<int> (*)(ll)' {aka 'std::vector<int> (*)(long long int)'} to 'short unsigned int' [-fpermissive] 10 | cin >> x[0]; | ~~~^ | | | std::vector<int> (*)(ll) {aka std::vector<int> (*)(long long int)} a.cc:10:13: error: cannot bind rvalue '(short unsigned int)x' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:10:13: error: invalid conversion from 'std::vector<int> (*)(ll)' {aka 'std::vector<int> (*)(long long int)'} to 'int' [-fpermissive] 10 | cin >> x[0]; | ~~~^ | | | std::vector<int> (*)(ll) {aka std::vector<int> (*)(long long int)} a.cc:10:13: error: cannot bind rvalue '(int)x' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:10:13: error: invalid conversion from 'std::vector<int> (*)(ll)' {aka 'std::vector<int> (*)(long long int)'} to 'unsigned int' [-fpermissive] 10 | cin >> x[0]; | ~~~^ | | | std::vector<int> (*)(ll) {aka std::vector<int> (*)(long long int)} a.cc:10:13: error: cannot bind rvalue '(unsigned int)x' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:10:13: error: invalid conversion from 'std::vector<int> (*)(ll)' {aka 'std::vector<int> (*)(long long int)'} to 'long int' [-fpermissive] 10 | cin >> x[0]; | ~~~^ | | | std::vector<int> (*)(ll) {aka std::vector<int> (*)(long long int)} a.cc:10:13: error: cannot bind rvalue '(long int)x' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:10:13: error: invalid conversion from 'std::vector<int> (*)(ll)' {aka 'std::vector<int> (*)(long long int)'} to 'long unsigned int' [-fpermissive] 10 | cin >> x[0]; | ~~~^ | | | std::vector<int> (*)(ll) {aka std::vector<int> (*)(long long int)} a.cc:10:13: error: cannot bind rvalue '(long unsigned int)x' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:10:13: error: invalid conversion from 'std::vector<int> (*)(ll)' {aka 'std::vector<int> (*)(long long int)'} to 'long long int' [-fpermissive] 10 | cin >> x[0]; | ~~~^ | | | std::vector<int> (*)(ll) {aka std::vector<int> (*)(long long int)} a.cc:10:13: error: cannot bind rvalue '(long long int)x' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:10:13: error: invalid conversion from 'std::vector<int> (*)(ll)' {aka 'std::vector<int> (*)(long long int)'} to 'long long unsigned int' [-fpermissive] 10 | cin >> x[0]; | ~~~^ | | | std::vector<int> (*)(ll) {aka std::vector<int> (*)(long long int)} a.cc:10:13: error: cannot bind rvalue '(long long unsigned int)x' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:10:13: error: invalid conversion from 'std::vector<int> (*)(ll)' {aka 'std::vector<int> (*)(long long int)'} to 'void*' [-fpermissive] 10 | cin >> x[0]; | ~~~^ | | | std::vector<int> (*)(ll) {aka std::vector<int> (*)(long long int)} a.cc:10:13: error: cannot bind rvalue '(void*)x' to 'void*&' /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 122 | operator>>(__istream_type& (*__pf)(__istream_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed: a.cc:10:13: error: invalid conversion from 'std::vector<int> (*)(ll)' {aka 'std::vector<int> (*)(long long int)'} to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive] 10 | cin >> x[0]; | ~~~^ | | | std::vector<int> (*)(ll) {aka std::vector<int> (*)(long long int)} /usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' (near match) 126 | operator>>(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/istream:126:7: note: conversion of argument 1 would be ill-formed: a.cc:10:13: error: invalid conversion from 'std::vector<int> (*)(ll)' {aka 'std::vector<int> (*)(long long int)'} to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} [-fpermissive] 10 | cin >> x[0]; | ~~~^ | | | std::vector<int> (*)(ll) {aka st
s736838654
p03829
C++
#include <iostream> #include <algorithm> #include <vector> using namespace std; typedef long long ll; int main(void) { int n, a, b; cin >> n >> a >> b; vector<int> x(n); cin >> x[0]; ll ans = 0; for (int i = 1; i < n; i++) { cin >> x[i]; ans += min(1LL * (x[i] - x[i - 1]) * a, b); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:15: error: no matching function for call to 'min(long long int, int&)' 14 | ans += min(1LL * (x[i] - x[i - 1]) * a, b); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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:14:15: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 14 | ans += min(1LL * (x[i] - x[i - 1]) * a, b); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /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:2: /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:14:15: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 14 | ans += min(1LL * (x[i] - x[i - 1]) * a, b); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
s994983980
p03829
Java
//Do what you can't. import java.io.*; import java.util.*; import java.math.BigInteger; public class Main{ public static void main(String[] args) { InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int n = in.nextInt(), a = in.nextInt(), b = in.nextInt(); int[] arr = in.nextIntArray(n); long fat = 0; for (int i = 0; i < n - 1; i++) { fat += Math.min((long)Math.abs(a[i] - a[i + 1]) * a, b); } w.println(fat); w.close(); } static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, snumChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int snext() { if (snumChars == -1) throw new InputMismatchException(); if (curChar >= snumChars) { curChar = 0; try { snumChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (snumChars <= 0) return -1; } return buf[curChar++]; } public int nextInt() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public long nextLong() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } int sgn = 1; if (c == '-') { sgn = -1; c = snext(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = snext(); } while (!isSpaceChar(c)); return res * sgn; } public int[] nextIntArray(int n) { int a[] = new int[n]; for (int i = 0; i < n; i++) { a[i] = nextInt(); } return a; } public String readString() { int c = snext(); while (isSpaceChar(c)) { c = snext(); } StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isSpaceChar(c)); return res.toString(); } public String nextLine() { int c = snext(); while (isSpaceChar(c)) c = snext(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = snext(); } while (!isEndOfLine(c)); return res.toString(); } public boolean isSpaceChar(int c) { if (filter != null) return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
Main.java:16: error: array required, but int found fat += Math.min((long)Math.abs(a[i] - a[i + 1]) * a, b); ^ Main.java:16: error: array required, but int found fat += Math.min((long)Math.abs(a[i] - a[i + 1]) * a, b); ^ 2 errors
s604730247
p03829
C++
#include <iostream> #include <algorithm> using namespace std; const int N_MAX = 1e5; // = 100000 int main(void){ int n, a, b; cin >> n >> a >> b; int x[N_MAX]; for(int i = 0; i < n; i++){ cin >> x[i]; } long long res = 0; for(int i = 1; i < n; i++){ int len = x[i] - x[i - 1]; int diff = min(B, len * A); res += diff; } cout << res << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:24: error: 'B' was not declared in this scope 20 | int diff = min(B, len * A); | ^ a.cc:20:33: error: 'A' was not declared in this scope 20 | int diff = min(B, len * A); | ^
s263789529
p03829
C++
#include <stdio.h> #include <algorithm> using namespace std; int main(){ int n,a,b,i,ans; scanf("%d %d %d",&n,&a,&b); // vector <int>x(n); ans=0; for (i=0;i<n;i++){ scanf("%d",&x[i]); if (i>0){ ans+=min(a*(x[i]-x[i-1]),b); } } printf("%d\n",ans); }
a.cc: In function 'int main()': a.cc:10:17: error: 'x' was not declared in this scope 10 | scanf("%d",&x[i]); | ^
s380672250
p03829
C++
#include <iostream> #include <cmath> using namespace std; //using ll = long long; int main() { int N, A, B; int pre, now; ll ans = 0; cin >> N >> A >> B; cin >> now; for (int i = 1; i < N; i++) { pre = now; cin >> now; ans += min((now - pre) * A, B); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 'll' was not declared in this scope 10 | ll ans = 0; | ^~ a.cc:17:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 17 | ans += min((now - pre) * A, B); | ^~~ | abs a.cc:20:17: error: 'ans' was not declared in this scope; did you mean 'abs'? 20 | cout << ans << endl; | ^~~ | abs
s754543587
p03829
C++
#include<iostream> #include<string> using namespace std; int min(int x,int y){ if(x<y)return x; else return y; } __int64 N,A,B; int a[100000]; int main(){ int sum=0; cin>>N>>A>>B; for(int i=0;i<N;i++){ cin>>a[i]; } for(int i=0;i<N-1;i++){ sum+=min(A*(a[i+1]-a[i]),B); } cout<<sum<<endl; }
a.cc:8:1: error: '__int64' does not name a type; did you mean '__int64_t'? 8 | __int64 N,A,B; | ^~~~~~~ | __int64_t a.cc: In function 'int main()': a.cc:12:10: error: 'N' was not declared in this scope 12 | cin>>N>>A>>B; | ^ a.cc:12:13: error: 'A' was not declared in this scope 12 | cin>>N>>A>>B; | ^ a.cc:12:16: error: 'B' was not declared in this scope 12 | cin>>N>>A>>B; | ^
s072195458
p03829
C++
#include<iostream> #include<vector> #include<algorithm> #include<cmath> using namespace std; int main(){ int n; cin >> n ; long long int a,b; cin >> a >> b; vector<long long int> x(n); for (int i = 0; i < n; i++){ cin >> x[i]; } long long int hiro = 0; for (int i = 0; i < n - 1; i++){ hiro += min((x[i+1] - x[i]) * a,b); } cout << hiro << endl; return 0; } #include<iostream> #include<vector> #include<algorithm> #include<cmath> using namespace std; int main(){ int n; cin >> n ; long long int a,b; cin >> a >> b; vector<long long int> x(n); for (int i = 0; i < n; i++){ cin >> x[i]; } long long int hiro = 0; for (int i = 0; i < n - 1; i++){ hiro += min((x[i+1] - x[i]) * a,b); } cout << hiro << endl; return 0; }
a.cc:30:5: error: redefinition of 'int main()' 30 | int main(){ | ^~~~ a.cc:8:5: note: 'int main()' previously defined here 8 | int main(){ | ^~~~
s907345907
p03829
C++
#include<iostream> #include<vector> #include<algorithm> #include<cmath> using namespace std; int main(){ int n,a,b; cin >> n >> a >> b; vector<long long int> x(n); for (int i = 0; i < n; i++){ cin >> x[i]; } long long int hiro = 0; for (int i = 0; i < n - 1; i++){ hiro += min((x[i+1] - x[i]) * a,b); } cout << hiro << endl; return 0; }
a.cc: In function 'int main()': a.cc:17:28: error: no matching function for call to 'min(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type, int&)' 17 | hiro += min((x[i+1] - x[i]) * a,b); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ 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:17:28: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int') 17 | hiro += min((x[i+1] - x[i]) * a,b); | ~~~^~~~~~~~~~~~~~~~~~~~~~~ /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:3: /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:17:28: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 17 | hiro += min((x[i+1] - x[i]) * a,b); | ~~~^~~~~~~~~~~~~~~~~~~~~~~
s160333485
p03829
C++
#include<cstdio> #include<cstdlib> #include<cmath> #include<iostream> #include<string> #include<stack> #include<queue> #include<vector> #include<map> #include<set> #include<algorithm> #define rep(n) for(int i=0;i<n;i++) #define repp(j, n) for(int j=0;j<n;j++) #define reppp(i, m, n) for(int i=m;i<=n;i++) #define all(c) c.begin(), c.end() #define MOD 1000000007 #define MAX 100000 #define INF 1410065408 using namespace std; typedef long long ll; typedef pair<ll, ll> P; struct edge{int from, to; ll cost;}; ll cost[MAX][MAX]; ll mincost[MAX]; priority_queue<P, vector<P>, greater<P> > que; bool used[MAX]; ll prim(ll V){ fill(mincost, mincost+V, INF); fill(used, used+V, false); que.push(make_pair(0, 0)); int res = 0; while(true){ P v; while(!que.empty()){ if(!used[que.top().second]){ v = que.top(); break; } que.pop(); } if(que.empty()) break; used[v.second] = true; res += v.first; rep(V){ mincost[i] = min(mincost[i], cost[v.second][i]); que.push(make_pair(mincost[i], i)); } } return res; } signed main(){ int n; ll a, b; scanf("%d %lld %lld", &n, &a, &b); fill(cost[0], cost[n], b); ll before, after; scanf("%lld", &after); rep(n-1){ before = after; scanf("%lld", &after); ll c = a * (after-before); cost[i][i+1] = c; cost[i+1][i] = c; } printf("%lld", prim(n)); }
/tmp/ccA5vff3.o: in function `prim(long long)': a.cc:(.text+0x2b): relocation truncated to fit: R_X86_64_PC32 against symbol `mincost' defined in .bss section in /tmp/ccA5vff3.o a.cc:(.text+0x40): relocation truncated to fit: R_X86_64_PC32 against symbol `mincost' defined in .bss section in /tmp/ccA5vff3.o a.cc:(.text+0x5a): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccA5vff3.o a.cc:(.text+0x6f): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccA5vff3.o a.cc:(.text+0xbd): relocation truncated to fit: R_X86_64_PC32 against symbol `que' defined in .bss section in /tmp/ccA5vff3.o a.cc:(.text+0xe5): relocation truncated to fit: R_X86_64_PC32 against symbol `que' defined in .bss section in /tmp/ccA5vff3.o a.cc:(.text+0xf8): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/ccA5vff3.o a.cc:(.text+0x10a): relocation truncated to fit: R_X86_64_PC32 against symbol `que' defined in .bss section in /tmp/ccA5vff3.o a.cc:(.text+0x12d): relocation truncated to fit: R_X86_64_PC32 against symbol `que' defined in .bss section in /tmp/ccA5vff3.o a.cc:(.text+0x13c): relocation truncated to fit: R_X86_64_PC32 against symbol `que' defined in .bss section in /tmp/ccA5vff3.o a.cc:(.text+0x152): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status
s405111469
p03829
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); long A = sc.nextInt(); long B = sc.nextInt(); long ans=0; int Xb=sc.nextInt();; for(int i=1; i<N; i++){ long X = sc.nextInt(); long d = X-Xb; Xb=X; long t = Math.min(d*A,B); ans+=t; } System.out.println(ans); } }
Main.java:14: error: incompatible types: possible lossy conversion from long to int Xb=X; ^ 1 error
s932217128
p03829
C++
#include <iostream> #include <string> using namespace std; int main() { int n; cin >> n >> a >> b; int x[n + 1]; for (int i = 1; i <= n; i++) cin >> x[i]; int sum = 0; for (int i = 1; i < n; i++) { int dis = x[i + 1] - x[i]; if (dis * a < b) sum += dis * a; else sum += b; } cout << sum << endl; return 0; }
a.cc: In function 'int main()': a.cc:7:15: error: 'a' was not declared in this scope 7 | cin >> n >> a >> b; | ^ a.cc:7:20: error: 'b' was not declared in this scope 7 | cin >> n >> a >> b; | ^
s568301304
p03829
C++
#include <iostream> #include <array> int main() { using namespace std; int N,A,B; std:: array <int,100000> X; std:: array <int,100000> dist; cin >> N >> A >> B; for (int i=0;i < N;++i) cin >> X[i]; for (int K=0;K<N-1;++K) { dist[K] = X[K+1] - X[K]; } std::sort(dist.begin(),dist.begin()+N-1); int curWalk = 0; int curWarp = B*(N-1); int curSum = curWarp; for (int K=0;K<N-1;++K) { curWalk += dist[K]*A; curWarp -= B; } cout << curSum << endl; return 0; }
a.cc: In function 'int main()': a.cc:20:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 20 | std::sort(dist.begin(),dist.begin()+N-1); | ^~~~ | qsort
s883964605
p03829
C++
#include<iostream> using namespace std; int main(void) { long long n, a, b; cin>>n>>a>>b; long long pre; long long next; long long ans=0; cin>>pre; for(int i=0; i<n-1; i++) { cin>>next; ans+=min(x, b); pre=next; } cout<<ans<<endl; return 0; }
a.cc: In function 'int main()': a.cc:14:16: error: 'x' was not declared in this scope 14 | ans+=min(x, b); | ^
s059217131
p03829
C++
#include <bits/stdc++.h> using namespace std; typedef long long int ll; ll a[1000100]; int main(){ ll n, a, b; cin >> n >> a >> b; for(ll i=0 ; i<n ; i++){ cin >> a[i]; } sort(a, a+n); ll ans = 0; for(ll i=0 ; i<n-1 ; i++){ ans += min((a[i+1]-a[i])*a, b); } cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:12:17: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript 12 | cin >> a[i]; | ^ a.cc:17:22: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript 17 | ans += min((a[i+1]-a[i])*a, b); | ^ a.cc:17:29: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript 17 | ans += min((a[i+1]-a[i])*a, b); | ^ In file included from /usr/include/c++/14/algorithm:61, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:2: /usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]': /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = long long int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:14:9: required from here 14 | sort(a, a+n); | ~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1780:17: error: no type named 'value_type' in 'struct std::iterator_traits<long long int>' 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~ In file included from /usr/include/c++/14/bits/stl_pair.h:61, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60: /usr/include/c++/14/bits/stl_algo.h:1780:25: error: invalid type argument of unary '*' (have 'long long int') 1780 | __val = _GLIBCXX_MOVE(*__i); | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1782:15: error: invalid type argument of unary '*' (have 'long long int') 1782 | *__first = _GLIBCXX_MOVE(__val); | ^~~~~~~~ In file included from /usr/include/c++/14/bits/stl_algobase.h:71: /usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = long long int; _Iterator2 = long long int]': /usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1777 | if (__comp(__i, __first)) | ~~~~~~^~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp); | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1908 | std::__final_insertion_sort(__first, __last, __comp); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = long long int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:14:9: required from here 14 | sort(a, a+n); | ~~~~^~~~~~~~ /usr/include/c++/14/bits/predefined_ops.h:45:16: error: invalid type argument of unary '*' (have 'long long int') 45 | { return *__it1 < *__it2; } | ^~~~~~ /usr/include/c++/14/bits/predefined_ops.h:45:25: error: invalid type argument of unary '*' (have 'long long int') 45 | { return *__it1 < *__it2; } | ^~~~~~ In file included from /usr/include/c++/14/bits/stl_algo.h:61: /usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]': /usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1593 | std::__make_heap(__first, __middle, __comp); | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1868 | std::__heap_select(__first, __middle, __last, __comp); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = long long int; _Size = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1884 | std::__partial_sort(__first, __last, __last, __comp); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1905 | std::__introsort_loop(__first, __last, | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1907 | __comp); | ~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = long long int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:14:9: required from here 14 | sort(a, a+n); | ~~~~^~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:344:11: error: no type named 'value_type' in 'struct std::iterator_traits<long long int>' 344 | _ValueType; | ^~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h:346:11: error: no type named 'difference_type' in 'struct std::iterator_traits<long long int>' 346 | _DistanceType; | ^~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]': /usr/include/c++/14/bits/stl_algo.h:1596:19: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1596 | std::__pop_heap(__first, __middle, __i, __comp); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1868 | std::__heap_select(__first, __middle, __last, __comp); | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = long long int; _Size = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1884 | std::__partial_sort(__first, __last, __last, __comp); | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = long long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]' 1905 | std::__introsort_loop(__first, __last, | ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ 1906 | std::__lg(__last - __first) * 2, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1907 | __comp); | ~~~~~~~ /usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = long long int]' 4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter()); | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ a.cc:14:9: required from here
s914607289
p03829
C++
#include <iostream> #define FOR(i,a,b) for(long long int i =(a); i <(b);i++) #define REP(i,N) FOR(i,0,N) using namespace std; int town[100000]; int main(void){ int N; int walkCost,telpCost; cin >> N >> walkCost >> telpCost; REP(i,N){ cin >> town[i]; } long long int ans = 0; REP(i,N-1){ long long int dist = town[i+1] - town[i]; long long int tiredW = dist*walkCost; int tiredT = telpCost; ans += min(tiredT,tiredW); } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:24:19: error: no matching function for call to 'min(int&, long long int&)' 24 | ans += min(tiredT,tiredW); | ~~~^~~~~~~~~~~~~~~ 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:24:19: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 24 | ans += min(tiredT,tiredW); | ~~~^~~~~~~~~~~~~~~ /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
s540081543
p03829
C++
#include <iostream> using namespace std; int main(){ int n, a, b; int way[n]; for(int i=0; i<n; i++){ cin >> way[i]; } int ans=0; for(int i=0; i<n-1; i++){ if((way[i+1]-way[i])*a < b){ ans += (way[i+1]-way[i])*a } else{ ans+=b; } } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:15:51: error: expected ';' before '}' token 15 | ans += (way[i+1]-way[i])*a | ^ | ; 16 | } | ~
s651249433
p03829
C++
#include <iostream> #include <algorithm> #include <string> #include <cstdio> #include <cmath> using namespace std; void calc(long long ans,long long x[]) int main() { unsigned long long n,a,b,x[100000]={0},ans[1000]={0}; cin>>n>>a>>b; for(int i=0;i<n;i++) cin>>x[i]; for(int i=1;i<n;i++){ int d=(x[i]-x[i-1])*a; if(d<=b){ ans+=d; }else{ ans+=b; } } cout<<ans<<endl; return 0; }
a.cc:10:1: error: expected initializer before 'int' 10 | int main() { | ^~~
s004522447
p03830
C++
#include <bits/stdc++.h> using namespace std; int main(){ int x; cin >> x; map < int , int > cnt; for(int i = 1; i <= x; i++){ //I int cur_num = i; for(int j = 2; j*j <= cur_num; j++){ while(cur_num % j == 0){ cur_num /= j; cnt[j] ++; } } if(cur_num != 1){ cnt[cur_num]++; } } long long ans = 1; map < int , int > :: iterator it = cnt.begin(); for(; it != cnt.end(); it++){ ans = (ans * ((it)->second + 1)) % mod; ans %= mod; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:25:44: error: 'mod' was not declared in this scope; did you mean 'modf'? 25 | ans = (ans * ((it)->second + 1)) % mod; | ^~~ | modf
s287094284
p03830
C++
#include <bits/stdc++.h> using namespace std; int main(){ int x; cin >> x; map < int , int > cnt; for(int i = 1; i <= x; i++){ //I int cur_num = i; for(int j = 2; j*j <= cur_num; j++){ while(cur_num % j == 0){ cur_num /= j; cnt[j] ++; } } if(cur_num != 1){ cnt[cur_num]++; } } ll ans = 1; map < int , int > :: iterator it = cnt.begin(); for(; it != cnt.end(); it++){ ans = (ans * ((it)->second + 1)) % mod; ans %= mod; } cout << ans << endl; }
a.cc: In function 'int main()': a.cc:22:5: error: 'll' was not declared in this scope 22 | ll ans = 1; | ^~ a.cc:25:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 25 | ans = (ans * ((it)->second + 1)) % mod; | ^~~ | abs a.cc:25:44: error: 'mod' was not declared in this scope; did you mean 'modf'? 25 | ans = (ans * ((it)->second + 1)) % mod; | ^~~ | modf a.cc:29:13: error: 'ans' was not declared in this scope; did you mean 'abs'? 29 | cout << ans << endl; | ^~~ | abs