submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s987443769
p04011
C++
#include <bits/stdc++.h> //--------------------------- using namespace std; //--------------------------- #define REP(i,n) for(int i = 0; i < (n); i++) #define P(x) cout << (x) << "\n" #define MOD 1000000007 // 1e9+7 #define PI acos(-1.0) #define ll long long int // 10^18 #define INF 1000000001 // 1e9+1 int dx[4]={1,-1,0,0}; int dy[4]={0,0,1,-1}; //--------------------------- int main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); // ifstream in("input.txt"); // cin.rdbuf(in.rdbuf()); int a,b,c,d;cin>>a>>b>>c>>d; int ans; if(n<=k){ ans=c*n; }else{ ans=c*k+d*(n-k); } P(ans); return 0; }
a.cc: In function 'int main()': a.cc:26:6: error: 'n' was not declared in this scope 26 | if(n<=k){ | ^ a.cc:26:9: error: 'k' was not declared in this scope 26 | if(n<=k){ | ^
s845413095
p04011
C++
#include <cstdio> int main() { int n, k, x, y; scanf("%d%d%d%d", &n, &k, &x, &y); printf("%d\n",n>k ? (n-k) * y + k * x : n * x)); }
a.cc: In function 'int main()': a.cc:5:49: error: expected ';' before ')' token 5 | printf("%d\n",n>k ? (n-k) * y + k * x : n * x)); | ^ | ;
s236039781
p04011
C++
#include<iostream> using namespace std; int main(){ int N,K,X,Y; int sum=0; for(i=1;i<=N;i++){ if(i<=K)sum+=X; else sum+=Y; } cout<<sum<<endl; }
a.cc: In function 'int main()': a.cc:6:7: error: 'i' was not declared in this scope 6 | for(i=1;i<=N;i++){ | ^
s833741537
p04011
C++
#include<iostrem> using namespace std; int main(){ int N,K,X,Y; int sum=0; for(i=1;i<=N;i++){ if(i<=K)sum+=X; else sum+=Y; } cout<<sum<<endl; }
a.cc:1:9: fatal error: iostrem: No such file or directory 1 | #include<iostrem> | ^~~~~~~~~ compilation terminated.
s909317752
p04011
C++
#include <stdio.h> int main(){ int a,b,c,d; scanf("%d%d%d%d",&a,&b,&c,&d); if(a>b){ int count=b*c+(a-b)*d; } else{ int count=b*c; } printf("%d\n",count); return 0; }
a.cc: In function 'int main()': a.cc:13:17: error: 'count' was not declared in this scope 13 | printf("%d\n",count); | ^~~~~
s639248809
p04011
C++
#include <stdio.h> int mian(){ int a,b,c,d; scanf("%d%d%d%d",&a,&b,&c,&d); if(a>b){ int count=b*c+(a-b)*d; } else{ int count=b*c; } printf("%d\n",count); return 0; }
a.cc: In function 'int mian()': a.cc:13:17: error: 'count' was not declared in this scope 13 | printf("%d\n",count); | ^~~~~
s393713170
p04011
C++
#include<iostream> int main(){ int N,K,a,b; cin>>N>>K>>a>>b; int total=0; for(int i=1;i<=N;i++){ if(i<=K)total+=a; else total+=b; } cout<<total<<endl; }
a.cc: In function 'int main()': a.cc:4:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 4 | cin>>N>>K>>a>>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:10:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 10 | cout<<total<<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:10:16: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 10 | cout<<total<<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) | ^~~~
s504036776
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e, f; cin >> a; cin >> b; cin >> c; cin >> d; if (a > b) { e = b * c; f = (a - b) * d; cout << e + f << endl; } else{ cout << a*c << endl; } return 0; }#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e, f; cin >> a; cin >> b; cin >> c; cin >> d; if (a > b) { e = b * c; f = (a - b) * d; cout << e + f << endl; } else{ cout << a*c << endl; } return 0; }
a.cc:19:2: error: stray '#' in program 19 | }#include <bits/stdc++.h> | ^ a.cc:19:3: error: 'include' does not name a type 19 | }#include <bits/stdc++.h> | ^~~~~~~ a.cc:21:5: error: redefinition of 'int main()' 21 | int main() | ^~~~ a.cc:3:5: note: 'int main()' previously defined here 3 | int main() | ^~~~
s507022954
p04011
C++
package main import "fmt" func main() { var n, k, x, y int fmt.Scanf("%d\n%d\n%d\n%d\n", &n, &k, &x, &y) if n-k > 0 { fmt.Println(k*x + (n-k)*y) } else { fmt.Println(n * x) } }
a.cc:1:1: error: 'package' does not name a type 1 | package main | ^~~~~~~
s421415570
p04011
C++
#include<iostream> #include<algorithm> #include<string> #include<cstdlib> using namespace std; int main() { int n, k, x, y; cin >> n >> k >> x >> y; if(n <= k) { ans = n * x; } else { ans = n * x + (n - k) * y; } cout << ans << endl; return 0; }
a.cc: In function 'int main()': a.cc:14:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 14 | ans = n * x; | ^~~ | abs a.cc:16:9: error: 'ans' was not declared in this scope; did you mean 'abs'? 16 | ans = n * x + (n - k) * y; | ^~~ | abs a.cc:20:13: error: 'ans' was not declared in this scope; did you mean 'abs'? 20 | cout << ans << endl; | ^~~ | abs
s740175873
p04011
C++
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int a, b, c, d, ans; cin >> a >> b >> c >> d; ans = min(a, b)*c + min(a - b, 0)*d << endl; return 0; }
a.cc: In function 'int main()': a.cc:8:45: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<' 8 | ans = min(a, b)*c + min(a - b, 0)*d << endl; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
s253933821
p04011
C
#include <stdio.h> #include <math.h> int main() { int n,k,x,y,e,f,g,; scanf("%d",&n); scanf("%d",&k); scanf("%d",&x); scanf("%d",&y); if(k>n) { printf("%d",x*n); }else{ e=k*x; f=n-k; g=f*y; printf("%d",g+e); } }
main.c: In function 'main': main.c:7:23: error: expected identifier or '(' before ';' token 7 | int n,k,x,y,e,f,g,; | ^
s479085605
p04011
C++
N = int(input()) K = int(input()) X = int(input()) Y = int(input()) print(min(K, N)*X - max(0, N-K) * Y)
a.cc:1:1: error: 'N' does not name a type 1 | N = int(input()) | ^
s778088204
p04011
C++
include <stdio.h> int main(void) { int x, y, n, k, sum; scanf("%d%d%d%d", &n, &k, &x, &y); if (n - k <= 0) sum = n * x; else sum = k * x + (n - k) * y; printf("%d\n", sum); return 0; }
a.cc:1:1: error: 'include' does not name a type 1 | include <stdio.h> | ^~~~~~~
s864765444
p04011
C++
#include <iostream> using namespace std; int main(){ int N,K,X,Y long long int ans=0; cin >> N >> K >> X >> Y; ans = K*X; if(N>K)ans+=(N-K)*Y; cout << ans; return 0; }
a.cc: In function 'int main()': a.cc:7:1: error: expected initializer before 'long' 7 | long long int ans=0; | ^~~~ a.cc:8:23: error: 'Y' was not declared in this scope 8 | cin >> N >> K >> X >> Y; | ^ a.cc:9:1: error: 'ans' was not declared in this scope; did you mean 'abs'? 9 | ans = K*X; | ^~~ | abs
s004315827
p04011
Java
import java.io.*; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { FastScanner in = new FastScanner(); int N = in.nextInt(); int K = in.nextInt(); int X = in.nextInt(); int Y = in.nextInt(); if (K > N) { System.out.println(N * X); } else { int sumX = K * X; int sumY = (N - K) * Y; System.out.println(sumX + sumY); } } } public static class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner(String s) { try { br = new BufferedReader(new FileReader(s)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public FastScanner() { br = new BufferedReader(new InputStreamReader(System.in)); } String nextToken() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return st.nextToken(); } String nextLine() { st = null; try { return br.readLine(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } int nextInt() { return Integer.parseInt(nextToken()); } long nextLong() { return Long.parseLong(nextToken()); } double nextDouble() { return Double.parseDouble(nextToken()); } } }
Main.java:79: error: class, interface, enum, or record expected } ^ 1 error
s066203826
p04011
C++
#include <iostream> #include <string> using namespace std; int main() { int N; int K;- int X; int Y; cin >> N; cin >> K; cin >> X; cin >> Y; if (N >= K) { cout << K * X + (N - K) * Y << endl; } else { cout << K * X << endl; } }
a.cc: In function 'int main()': a.cc:9:1: error: expected primary-expression before 'int' 9 | int X; | ^~~ a.cc:13:8: error: 'X' was not declared in this scope 13 | cin >> X; | ^
s210879003
p04011
C++
a = [int(input()) for i in range(4)] print(a[2]*a[0]+max(0,(a[0]-a[1])*a[3]))
a.cc:1:1: error: 'a' does not name a type 1 | a = [int(input()) for i in range(4)] | ^
s580048756
p04011
Java
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); String a = s.nextLine(); char[] ar = a.toCharArray(); loop: for (int i = 0;i < ar.length();i++) { int y = 0; for (int m = 0;m < ar.length();m++) { if(ar[n].equals(ar[m])) { y += 1; } if(m.equals(ar[ar.length()])) { if(y % 2 == 1) { System.out.println("No"); break loop; } } } } System.out.println("Yes"); } }
Main.java:7: error: cannot find symbol loop: for (int i = 0;i < ar.length();i++) { ^ symbol: method length() location: variable ar of type char[] Main.java:9: error: cannot find symbol for (int m = 0;m < ar.length();m++) { ^ symbol: method length() location: variable ar of type char[] Main.java:10: error: cannot find symbol if(ar[n].equals(ar[m])) { ^ symbol: variable n location: class Main Main.java:10: error: char cannot be dereferenced if(ar[n].equals(ar[m])) { ^ Main.java:13: error: cannot find symbol if(m.equals(ar[ar.length()])) { ^ symbol: method length() location: variable ar of type char[] Main.java:13: error: int cannot be dereferenced if(m.equals(ar[ar.length()])) { ^ 6 errors
s385729124
p04011
Java
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); int x = scanner.nextInt(); int y = scanner.nextInt(); System.out.println(x*k+Math.max(0, y*(n-k); } }
Main.java:12: error: ')' or ',' expected System.out.println(x*k+Math.max(0, y*(n-k); ^ 1 error
s703796189
p04011
Java
import java.io.IOException; import java.util.Scanner; public class Main { public static void main(String[] args) throws IOException { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int k = scanner.nextInt(); int x = scanner.nextInt(); int y = scanner.nextInt(); System.out.println(x*k+Math.max(0, y*(n-k)); } }
Main.java:12: error: ')' or ',' expected System.out.println(x*k+Math.max(0, y*(n-k)); ^ 1 error
s781959733
p04011
Java
package atcoder; import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Arrays; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import java.io.BufferedReader; import java.io.InputStream; public class Main001 { public static void main(String[] args) { InputStream inputStream = System.in; FastScanner in = new FastScanner(inputStream); char[] c = in.next().toCharArray(); int[] num = new int[26]; for (int i = 0; i < c.length; i++) { num[c[i] - 'a']++; } boolean isBeautiful = true; for (int i = 0; i < num.length; i++) { if (num[i] % 2 != 0) { isBeautiful = false; break; } } System.out.println(isBeautiful ? "Yes" : "No"); } static class FastScanner { private BufferedReader in; private StringTokenizer st; public FastScanner(InputStream stream) { in = new BufferedReader(new InputStreamReader(stream)); } public String next() { while (st == null || !st.hasMoreTokens()) { try { String rl = in.readLine(); if (rl == null) { return null; } st = new StringTokenizer(rl); } catch (IOException e) { throw new RuntimeException(e); } } return st.nextToken(); } public int nextInt() { return Integer.parseInt(next()); } } }
Main.java:16: error: class Main001 is public, should be declared in a file named Main001.java public class Main001 { ^ 1 error
s816306257
p04011
C++
#include<bits/stdc++.h> #define fi first #define se second #define FO(x, n) for (int x = 0; x < n; ++x) #define FOR(x, a, b) for (int x = a; x < b; ++x) #define RFO(x, n) for (int x = n - 1; x >= 0; --x) #define RFOR(x, a, b) for (int x = b - 1; x >= a; --x) #define FOR_ITER(x, a) for(auto x = a.begin(); x != a.end(); ++x) using namespace std; typedef unsigned char byte; typedef long long llong; typedef unsigned long long ullong; typedef pair<int, int> pii; typedef pair<double, double> pdd; typedef pair<string, string> pss; typedef pair<llong, llong> pll; inline bool feq(const double& a, const double& b) { return fabs(a - b) < 1e-10; } using namespace std; int n, k, x, y; int main(){ // int n, l; // cin >> n >> k; // vector<bool> dislike(10, false); // // FOR(i, 0, k) { // int t; // cin >> t; // dislike[t] = true; // } cin >> n >> k >> x >> y; int sum = 0; FOR(i, 1, n + 1) { if(i > k) { sum += y; } else { sum += x; } } cout << sum. << endl; return 0; }
a.cc: In function 'int main()': a.cc:47:18: error: expected unqualified-id before '<<' token 47 | cout << sum. << endl; | ^~
s617222977
p04011
C++
#include <bits/stdc++.h> using namespace std; int main( int argc, char *argv[] ) { int N; int K; int X; int Y; ios::sync_with_stdio( false ); cin.tie( 0 ); cin >> N; cin >> K; cin >> X; cin >> Y; if( N <= K ) cout << N * X << endl; else cout << K * X + ( N - K ) * Y << endl; return 0;
a.cc: In function 'int main(int, char**)': a.cc:24:18: error: expected '}' at end of input 24 | return 0; | ^ a.cc:6:1: note: to match this '{' 6 | { | ^
s271075366
p04011
C++
#include<iostream> using namespace std; int main(){ int N,K,X,Y; cin >> N >> K >> X >> Y; if(N>K){ cout << (N*X) << endl; { else{ cout << (N*X)+(N-K)*Y << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:1: error: expected '}' before 'else' 13 | else{ | ^~~~ a.cc:12:1: note: to match this '{' 12 | { | ^ a.cc:13:1: error: expected '}' before 'else' 13 | else{ | ^~~~ a.cc:10:8: note: to match this '{' 10 | if(N>K){ | ^
s303804592
p04011
C++
#include<iostream> using namespace std; int main(){ int a,b,c; cin >> a >> b >> c; int i=0; while(i<a){ cout << +b << endl; i++1; } cout << +c << endl; return 0; }
a.cc: In function 'int main()': a.cc:13:4: error: expected ';' before numeric constant 13 | i++1; | ^ | ;
s831625769
p04011
C++
#include<iostream> using namesapce std; int main(){ int a,b,c; cin >> a >> b >> c; int i=0; while(i<a){ cout << +b << endl; i++1; } cout << +c << endl; return 0; }
a.cc:3:7: error: expected nested-name-specifier before 'namesapce' 3 | using namesapce std; | ^~~~~~~~~ a.cc: In function 'int main()': a.cc:8:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 8 | cin >> a >> b >> c; | ^~~ | 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:12:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 12 | cout << +b << endl; | ^~~~ | std::cout /usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ a.cc:12:15: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 12 | cout << +b << 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) | ^~~~ a.cc:13:4: error: expected ';' before numeric constant 13 | i++1; | ^ | ; a.cc:15:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'? 15 | cout << +c << 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:15:15: error: 'endl' was not declared in this scope; did you mean 'std::endl'? 15 | cout << +c << endl; | ^~~~ | std::endl /usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here 744 | endl(basic_ostream<_CharT, _Traits>& __os) | ^~~~
s815927593
p04011
C++
package main import ( "fmt" ) func min(x, y int) int { if x > y { return y } return x } func main(){ var n,k,x,y int fmt.Scan(&n, &k, &x, &y) if min(n,k) == n { fmt.Println(n * x) } else { fmt.Println(k * x + (n-k) * y) } }
a.cc:1:1: error: 'package' does not name a type 1 | package main | ^~~~~~~ a.cc:14:1: error: 'func' does not name a type 14 | func main(){ | ^~~~
s494255808
p04011
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N =sc.nextInt(); int K =sc.nextInt(); int X =sc.nextInt(); int Y =sc.nextInt(); int S; if(N >= K){ S = K*X+(N-K)*Y; System.out.println(M); }else{ S=N*X; System.out.println(M); } } }
Main.java:12: error: cannot find symbol System.out.println(M); ^ symbol: variable M location: class Main Main.java:15: error: cannot find symbol System.out.println(M); ^ symbol: variable M location: class Main 2 errors
s375865560
p04011
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n, k, x, y, answer; int X =sc.nextInt(); int K =sc.nextInt(); int X =sc.nextInt(); int Y =sc.nextInt(); if(N<=K){ answer=K * X + (N - K) * Y; System.out.println(answer); }else { answer=N*X; System.out.println(answer); } } }
Main.java:8: error: variable X is already defined in method main(String[]) int X =sc.nextInt(); ^ Main.java:10: error: cannot find symbol if(N<=K){ ^ symbol: variable N location: class Main Main.java:11: error: cannot find symbol answer=K * X + (N - K) * Y; ^ symbol: variable N location: class Main Main.java:14: error: cannot find symbol answer=N*X; ^ symbol: variable N location: class Main 4 errors
s272603321
p04011
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int X =sc.nextInt(); int K =sc.nextInt(); int X =sc.nextInt(); int Y =sc.nextInt(); if(N<=K){ System.out.println("N*X"); }else if(N>K){ System.out.println("K*X+(N-K)*Y"); } } }
Main.java:7: error: variable X is already defined in method main(String[]) int X =sc.nextInt(); ^ Main.java:9: error: cannot find symbol if(N<=K){ ^ symbol: variable N location: class Main Main.java:11: error: cannot find symbol }else if(N>K){ ^ symbol: variable N location: class Main 3 errors
s294106793
p04011
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); String X =sc.next(); String K =sc.next(); String X =sc.next(); String Y =sc.next(); if(N<=K){ System.out.println("N*X"); }else if(N>K){ System.out.println("K*X+(N-K)*Y"); } } }
Main.java:7: error: variable X is already defined in method main(String[]) String X =sc.next(); ^ Main.java:9: error: cannot find symbol if(N<=K){ ^ symbol: variable N location: class Main Main.java:11: error: cannot find symbol }else if(N>K){ ^ symbol: variable N location: class Main 3 errors
s360907696
p04011
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int X =sc.nextInt(); int K =sc.nextInt(); int X =sc.nextInt(); int Y =sc.nextInt(); if(N<=K){ System.out.println(N*X); }else if(N>K){ System.out.println(K*X+(N-K)*Y); } } }
Main.java:7: error: variable X is already defined in method main(String[]) int X =sc.nextInt(); ^ Main.java:9: error: cannot find symbol if(N<=K){ ^ symbol: variable N location: class Main Main.java:10: error: cannot find symbol System.out.println(N*X); ^ symbol: variable N location: class Main Main.java:11: error: cannot find symbol }else if(N>K){ ^ symbol: variable N location: class Main Main.java:12: error: cannot find symbol System.out.println(K*X+(N-K)*Y); ^ symbol: variable N location: class Main 5 errors
s036624800
p04011
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N =nextInt(); int K =nextInt(); int X =nextInt(); int Y =nextInt(); if(N<=K){ System.out.println(N*X); }else if(N>K){ System.out.println(K*X+(N-K)*Y); } } }
Main.java:5: error: cannot find symbol int N =nextInt(); ^ symbol: method nextInt() location: class Main Main.java:6: error: cannot find symbol int K =nextInt(); ^ symbol: method nextInt() location: class Main Main.java:7: error: cannot find symbol int X =nextInt(); ^ symbol: method nextInt() location: class Main Main.java:8: error: cannot find symbol int Y =nextInt(); ^ symbol: method nextInt() location: class Main 4 errors
s813502860
p04011
Java
import java.util.*; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int X = sc.nextInt(); int Y = sc.nextInt(); int M; if(N > K){ M = K * X + (N - k) * Y; System.out.println(M); }else if(N < K){ M = N * X; System.out.println(M); } } }
Main.java:11: error: cannot find symbol M = K * X + (N - k) * Y; ^ symbol: variable k location: class Main 1 error
s688284701
p04011
C++
N = int(input()) K = int(input()) X = int(input()) Y = int(input()) if N < K: print(X*N) else: print(K*X+(N-K)*Y)
a.cc:1:1: error: 'N' does not name a type 1 | N = int(input()) | ^
s866560252
p04011
C++
#include<iostream> #include<cstdio> #include<vector> #include<string> #include<algorithm> #include<math.h> using namespace std; typedef long long ll; typedef pair<long long, long long> pll; int main(){ int N, K, X, Y; scanf_s("%d", &N); scanf_s("%d", &K); scanf_s("%d", &X); scanf_s("%d", &Y); if (N <= K){ printf("%d", N*X); } else{ int out = K*X + (N - K)*Y; printf("%d", out); } }
a.cc: In function 'int main()': a.cc:15:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 15 | scanf_s("%d", &N); | ^~~~~~~ | scanf
s850706686
p04011
C++
#include <iostream> using namespace std; int main(){ int n,k,a,b; cin>>n>>k>>x>>y; cout<<k+x+(n-k)*y<<endl; return 0; }
a.cc: In function 'int main()': a.cc:8:20: error: 'x' was not declared in this scope 8 | cin>>n>>k>>x>>y; | ^ a.cc:8:23: error: 'y' was not declared in this scope 8 | cin>>n>>k>>x>>y; | ^
s162113992
p04011
C++
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(i=0; i<n; i++) int sum=0; int main(){ int N,K,X,Y; cin>>N>>K>>X>>Y; if(N>=K){ sum=X*K+(N-K)*Y; cout<<sum; } else{ sum=X*N cout<<sum; } }
a.cc: In function 'int main()': a.cc:13:12: error: expected ';' before 'cout' 13 | sum=X*N | ^ | ; 14 | cout<<sum; | ~~~~
s122285549
p04011
C++
using System; class Program { static void Main() { int n, k, x, y,res = 0; n = int.Parse(Console.ReadLine()); k = int.Parse(Console.ReadLine()); x = int.Parse(Console.ReadLine()); y = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { res += x; } if (n - k > 0) { for (int i = 0; i < n - k; i++) { res += y; } } Console.WriteLine(res); } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:25:2: error: expected ';' after class definition 25 | } | ^ | ; a.cc: In static member function 'static void Program::Main()': a.cc:8:13: error: expected primary-expression before 'int' 8 | n = int.Parse(Console.ReadLine()); | ^~~ a.cc:9:13: error: expected primary-expression before 'int' 9 | k = int.Parse(Console.ReadLine()); | ^~~ a.cc:10:13: error: expected primary-expression before 'int' 10 | x = int.Parse(Console.ReadLine()); | ^~~ a.cc:11:13: error: expected primary-expression before 'int' 11 | y = int.Parse(Console.ReadLine()); | ^~~ a.cc:23:9: error: 'Console' was not declared in this scope 23 | Console.WriteLine(res); | ^~~~~~~
s854024696
p04011
C++
using System; class Program { static void Main(string[] args) { int n, k, x, y,res = 0; n = int.Parse(Console.ReadLine()); k = int.Parse(Console.ReadLine()); x = int.Parse(Console.ReadLine()); y = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { res += x; } if (n - k > 0) { for (int i = 0; i < n - k; i++) { res += y; } } Console.WriteLine(res); } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:5:22: error: 'string' has not been declared 5 | static void Main(string[] args) | ^~~~~~ a.cc:5:31: error: expected ',' or '...' before 'args' 5 | static void Main(string[] args) | ^~~~ a.cc:25:2: error: expected ';' after class definition 25 | } | ^ | ; a.cc: In static member function 'static void Program::Main(int*)': a.cc:8:13: error: expected primary-expression before 'int' 8 | n = int.Parse(Console.ReadLine()); | ^~~ a.cc:9:13: error: expected primary-expression before 'int' 9 | k = int.Parse(Console.ReadLine()); | ^~~ a.cc:10:13: error: expected primary-expression before 'int' 10 | x = int.Parse(Console.ReadLine()); | ^~~ a.cc:11:13: error: expected primary-expression before 'int' 11 | y = int.Parse(Console.ReadLine()); | ^~~ a.cc:23:9: error: 'Console' was not declared in this scope 23 | Console.WriteLine(res); | ^~~~~~~
s079051900
p04011
C++
#include <bits/stdc++.h> #include<iostream> #include<cstdio> #include<vector> #include<queue> #include<map> #include<cstring> #include<string> #include <math.h> #include<algorithm> // #include <boost/multiprecision/cpp_int.hpp> #include<functional> #define int long long #define inf 1000000007 #define pa pair<int,int> #define ll long long #define pal pair<double,int> #define ppa pair<int,pa> #define ssa pair<string,int> #define mp make_pair #define pb push_back #define EPS (1e-10) #define equals(a,b) (fabs((a)-(b))<EPS) using namespace std; //priority_queue<int, vector<int>, greater<int> > que; class Point{ public: double x,y; Point(double x=0,double y=0):x(x),y(y) {} Point operator + (Point p) {return Point(x+p.x,y+p.y);} Point operator - (Point p) {return Point(x-p.x,y-p.y);} Point operator * (double a) {return Point(x*a,y*a);} Point operator / (double a) {return Point(x/a,y/a);} double absv() {return sqrt(norm());} double norm() {return x*x+y*y;} bool operator < (const Point &p) const{ return x != p.x ? x<p.x: y<p.y; } bool operator == (const Point &p) const{ return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS; } }; typedef Point Vector; struct Segment{ Point p1,p2; }; double hen(Vector a){ if(fabs(a.x)<EPS && a.y>0) return acos(0); else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0); else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0); else if(fabs(a.y)<EPS && a.x>0) return 0.0; else if(a.y>0) return acos(a.x/a.absv()); else return 2*acos(0)+acos(-a.x/a.absv()); } int gcd(int v,int b){ if(v>b) return gcd(b,v); if(v==b) return b; if(b%v==0) return v; return gcd(v,b%v); } double dot(Vector a,Vector b){ return a.x*b.x+a.y*b.y; } double cross(Vector a,Vector b){ return a.x*b.y-a.y*b.x; } double distans(double x1,double y1,double x2,double y2){ double rr=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); return sqrt(rr); } //----------------kokomade tenpure------------ signed main(){ int n,k,x,y; cin>>n>>k>>x>>y; int ans=0; ans = n*x; ans += max(0,n-k)*(y-x); cout<<ans<<endl; // printf("%.10f\n",ans[n-1]); return 0; }
a.cc: In function 'int main()': a.cc:87:19: error: no matching function for call to 'max(int, long long int)' 87 | ans += max(0,n-k)*(y-x); | ~~~^~~~~~~ In file included from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51, from a.cc:1: /usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)' 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed: a.cc:87:19: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int') 87 | ans += max(0,n-k)*(y-x); | ~~~^~~~~~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)' 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided In file included from /usr/include/c++/14/algorithm:61: /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)' 5706 | max(initializer_list<_Tp> __l) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided /usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)' 5716 | max(initializer_list<_Tp> __l, _Compare __comp) | ^~~ /usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed: a.cc:87:19: note: mismatched types 'std::initializer_list<_Tp>' and 'int' 87 | ans += max(0,n-k)*(y-x); | ~~~^~~~~~~
s749456902
p04011
Java
class Main{ public static void main(String[] a){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int x = in.nextInt(); int y = in.nextInt(); int ans = k*x+(n-k)*y; System.out.println(ans); } }
Main.java:3: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:3: error: cannot find symbol Scanner in = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s051850051
p04011
Java
public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); String l = scan.next(); String m =scan.next(); String n = scan.next(); String o = scan.next(); int N = Integer.parseInt(l);//5 int K = Integer.parseInt(m);//3 int X = Integer.parseInt(n);//10000 int Y = Integer.parseInt(o);//9000 System.out.println(N*X-(X-Y)*(N-K)); } }
Main.java:6: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main Main.java:6: error: cannot find symbol Scanner scan = new Scanner(System.in); ^ symbol: class Scanner location: class Main 2 errors
s745020462
p04011
C++
import java.io.*; import java.util.Scanner; public class Main { public static void main(String args[]) { Scanner scan = new Scanner(System.in); String l = scan.next(); String m =scan.next(); String n = scan.next(); String o = scan.next(); int N = Integer.parseInt(l);//5 int K = Integer.parseInt(m);//3 int X = Integer.parseInt(n);//10000 int Y = Integer.parseInt(o);//9000 System.out.println(N*X-(X-Y)*(N-K)); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.*; | ^~~~~~ 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.util.Scanner; | ^~~~~~ 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 { | ^~~~~~
s053497438
p04011
C
#include<stdio.h> #include<iostream> using namespace std; int main() { int i = 0, t = 0, j = 0; char a[100], b[27] = { 0 }; scanf_s("%s", a,sizeof(a)/sizeof(a[0])); //cout << "h" << endl; for (j = 0; j < 26; j++) { for (i = 0; i < 100; i++) { //cout << i << " " << a[j] << endl; if (j == a[i] - 'a') b[j] = b[j] + 1; } } for (j = 0; j < 26; j++) { if (b[j] % 2 == 1) { t++; } } if (t == 0) { printf("Yes\n"); } else { printf("No\n"); } }
main.c:2:9: fatal error: iostream: No such file or directory 2 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s952243898
p04011
C
#include<stdio.h> int main() { int n, k, x, y, z; scanf_s("%d%d%d%d",&n,&k,&x,&y); if (n > k) { z = x*k + y*(n - k); } else { z = x*n; } printf("%d",z); }
main.c: In function 'main': main.c:5:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 5 | scanf_s("%d%d%d%d",&n,&k,&x,&y); | ^~~~~~~ | scanf
s692531148
p04011
C++
#include <cstdio> #include <cstdint> using namespace std; int main() { int32_t n, k, x, y; int32_t payment; scanf_s("%d\n%d\n%d\n%d\n", n, k, x, y); payment = n >= k ? k * x : n * x; payment += n >= k ? (n - k) * y : 0; printf("%d\n", payment); }
a.cc: In function 'int main()': a.cc:11:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'? 11 | scanf_s("%d\n%d\n%d\n%d\n", n, k, x, y); | ^~~~~~~ | scanf
s225550426
p04011
C
#include <stdio.h> int main(void) { int N,K,X,Y,; scanf("%d",&N); scanf("%d",&K); scanf("%d",&X); scanf("%d",&Y); if (K>N){ printf("%d\n", N*X); } else{ printf("%d\n", K*X+(N-K)*Y); } return 0; }
main.c: In function 'main': main.c:5:13: error: expected identifier or '(' before ';' token 5 | int N,K,X,Y,; | ^
s958343495
p04011
C
#include <stdio.h> int main(void) { int N,K,X,Y,; scanf("%d",&N); scanf("%d",&K); scanf("%d",&X); scanf("%d",&Y); if (K>N){ printf("%d\n", K*X); } else{ printf("%d\n", K*X+(N-K)*Y); } return 0; }
main.c: In function 'main': main.c:5:13: error: expected identifier or '(' before ';' token 5 | int N,K,X,Y,; | ^
s125711490
p04011
Java
import java.util.Scanner; class Test { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); String[] strStdIn = new String[4]; while (scanner.hasNextLine()) { int i = 0; strStdIn[i] = scanner.nextLine(); i++; if (s.length() == 0) { break; } } int totalLiving = Integer.parseInt(strStdIn[0]); int initialLiving = Integer.parseInt(strStdIn[1]); int initialCost = Integer.parseInt(strStdIn[2]); int latterCost = Integer.parseInt(strStdIn[3]); int initialLivingDate = totalLiving - initialLiving + 1; int latterLivingDate = totalLiving - initialLivingDate -1; int totalCost = initialCost * initialLivingDate + latterCost * latterLivingDate; String returnString = Integer.toString(totalCost); System.out.println(totalCost); } }
Main.java:12: error: cannot find symbol if (s.length() == 0) { ^ symbol: variable s location: class Test 1 error
s481049427
p04011
Java
import java.util.Scanner; class Test { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); String[] strStdIn = new String[4]; while (scanner.hasNextLine()) { int i = 0; strStdIn[i] = scanner.nextLine(); i++; if (s.length() == 0) { break; } int totalLiving = Integer.parseInt(strStdIn[0]); int initialLiving = Integer.parseInt(strStdIn[1]); int initialCost = Integer.parseInt(strStdIn[2]); int latterCost = Integer.parseInt(strStdIn[3]); int initialLivingDate = totalLiving - initialLiving + 1; int latterLivingDate = totalLiving - initialLivingDate -1; int totalCost = initialCost * initialLivingDate + latterCost * latterLivingDate; String returnString = Integer.toString(totalCost); System.out.println(totalCost); } }
Main.java:30: error: reached end of file while parsing } ^ 1 error
s322691279
p04011
Java
import java.io.*; class Test { public static void main(String args[]) { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String[] strStdIn = new String[4]; for (int i=0; i < 4; i++) { strStdIn[i] = in.readLine(); } int totalLiving = Integer.parseInt(strStdIn[0]); int initialLiving = Integer.parseInt(strStdIn[1]); int initialCost = Integer.parseInt(strStdIn[2]); int latterCost = Integer.parseInt(strStdIn[3]); int initialLivingDate = totalLiving - initialLiving + 1; int latterLivingDate = totalLiving - initialLivingDate -1; int totalCost = initialCost * initialLivingDate + latterCost * latterLivingDate; String returnString = Integer.toString(totalCost); System.out.println(totalCost); } }
Main.java:8: error: unreported exception IOException; must be caught or declared to be thrown strStdIn[i] = in.readLine(); ^ 1 error
s023439073
p04011
C++
#include<iostream> #include<string> using namespace std; int main(){ int al[26]={0}; int aa[2]={0}; char w[101]; cin>>w; int len=strlen(w); for(int i=0;i<len;i++){ int j=w[i]-'a'; al[j]++; } for(int i=0;i<26;i++){ if(al[i]!=0&&al[i]%2==0){ aa[0]++; }else if(al[i]!=0&&al[i]%2!=0){ aa[1]++; } } if(aa[1]==0){ cout<<"Yes"<<endl; }else if(aa[1]!=0){ cout<<"No"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:9:11: error: 'strlen' was not declared in this scope 9 | int len=strlen(w); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | #include<string>
s043506957
p04011
C++
#include<iostream> using namespace std; int main(){ int al[26]={0}; int aa[2]={0}; char w[101]; cin>>w; int len=strlen(w); for(int i=0;i<len;i++){ int j=w[i]-'a'; al[j]++; } for(int i=0;i<26;i++){ if(al[i]!=0&&al[i]%2==0){ aa[0]++; }else if(al[i]!=0&&al[i]%2!=0){ aa[1]++; } } if(aa[1]==0){ cout<<"Yes"<<endl; }else if(aa[1]!=0){ cout<<"No"<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:8:11: error: 'strlen' was not declared in this scope 8 | int len=strlen(w); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include<iostream> +++ |+#include <cstring> 2 | using namespace std;
s205100031
p04011
C++
#include<stdio.h> int main() { int N,K,X,Y; long long int sum; scanf("%d""%d""%d""%d",&N,&K,&X,&Y) if(N>K) printf("%lld\n",sum=K*X+(N-K)*Y); else if(N<=K) printf("%lld\n",sum=N*X); return 0; }
a.cc: In function 'int main()': a.cc:6:44: error: expected ';' before 'if' 6 | scanf("%d""%d""%d""%d",&N,&K,&X,&Y) | ^ | ; 7 | 8 | if(N>K) printf("%lld\n",sum=K*X+(N-K)*Y); | ~~ a.cc:9:9: error: 'else' without a previous 'if' 9 | else if(N<=K) printf("%lld\n",sum=N*X); | ^~~~
s373771998
p04011
C
#include<stdio.h> #define MIN(A,B) ((A) < (B) ? (A) : (B)) int main(void){ int i,j; long long n,k,x,y,ans; scanf("%lld %lld %lld %lld",&n,&k,&x,&y); ans = x * MIN(n,k); if(n > k)12. ans += y * (n - k); printf("%lld\n",ans); return 0; }
main.c: In function 'main': main.c:9:14: error: expected ';' before 'ans' 9 | if(n > k)12. ans += y * (n - k); | ^ ~~~ | ;
s231212286
p04011
C
include<stdio.h> #define MIN(A,B) ((A) < (B) ? (A) : (B)) int main(void){ int i,j; long long n,k,x,y,ans; scanf("%lld %lld %lld %lld",&n,&k,&x,&y); ans = x * MIN(n,k); if(n > k) ans += y * (n - k); printf("%lld\n",ans); return 0; }
main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include<stdio.h> | ^
s896446903
p04011
C
#include<stdio.h> #define MIN(A,B) ((A) < (B) ? (A) : (B)) int main(void){ int i,j; long long n,k,x,y,ans; scanf("%d %d %d %d",&n,&k,&x,&y); ans = x * MIN(n,k); if(n > k)12. ans += y * (n - k); printf("%lld\n",ans); return 0; }
main.c: In function 'main': main.c:9:14: error: expected ';' before 'ans' 9 | if(n > k)12. ans += y * (n - k); | ^ ~~~ | ;
s521976426
p04011
C
#include<stdio.h> #define MIN(A<B) ((A) < (B) ? (A) : (B)) int main(void){ int i,j long long n,k,x,y,ans; scanf("%d %d %d %d",&n,&k,&x,&y); ans = x * MIN(n,k); if(n > k) ans += y * (n - k); printf("%lld\n",ans); return 0; }
main.c:2:14: error: expected ',' or ')', found "<" 2 | #define MIN(A<B) ((A) < (B) ? (A) : (B)) | ^ main.c: In function 'main': main.c:7:7: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'long' 7 | long long n,k,x,y,ans; | ^~~~ main.c:9:27: error: 'n' undeclared (first use in this function) 9 | scanf("%d %d %d %d",&n,&k,&x,&y); | ^ main.c:9:27: note: each undeclared identifier is reported only once for each function it appears in main.c:9:30: error: 'k' undeclared (first use in this function) 9 | scanf("%d %d %d %d",&n,&k,&x,&y); | ^ main.c:9:33: error: 'x' undeclared (first use in this function) 9 | scanf("%d %d %d %d",&n,&k,&x,&y); | ^ main.c:9:36: error: 'y' undeclared (first use in this function) 9 | scanf("%d %d %d %d",&n,&k,&x,&y); | ^ main.c:10:5: error: 'ans' undeclared (first use in this function) 10 | ans = x * MIN(n,k); | ^~~ main.c:10:15: error: implicit declaration of function 'MIN' [-Wimplicit-function-declaration] 10 | ans = x * MIN(n,k); | ^~~
s470021108
p04011
C
#include<stdio.h> int main(void){ int n,k,x,y; int sum = 0; scanf("%d", &n); scanf("%d", &k); scanf("%d", &x); scanf("%d", &y); sum = k * x; while(k++ < n) sum += y; printf("%d\n", sum); return 0; } ~
main.c:22:1: error: expected identifier or '(' before '~' token 22 | ~ | ^
s855897931
p04011
C
main() { if (int N = 1) { if (int K = 1) { if (int X = 1) { if (int Y = 1) { if (int ans = 0) {} else { if (scanf("%d", &N)) {} if (scanf("%d", &K)) {} if (scanf("%d", &X)) {} if (scanf("%d", &Y)) {} while (N > K) { if (ans += Y) {} if (N--) {} } while (N > 0) { if (ans += X) {} if (N--) {} } if (printf("%d", ans)) {} } } } } } }
main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int] 1 | main() { | ^~~~ main.c: In function 'main': main.c:2:13: error: expected expression before 'int' 2 | if (int N = 1) { | ^~~ main.c:3:21: error: expected expression before 'int' 3 | if (int K = 1) { | ^~~ main.c:4:29: error: expected expression before 'int' 4 | if (int X = 1) { | ^~~ main.c:5:37: error: expected expression before 'int' 5 | if (int Y = 1) { | ^~~ main.c:6:45: error: expected expression before 'int' 6 | if (int ans = 0) {} | ^~~ main.c:8:53: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 8 | if (scanf("%d", &N)) {} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | main() { main.c:8:53: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 8 | if (scanf("%d", &N)) {} | ^~~~~ main.c:8:53: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:8:66: error: 'N' undeclared (first use in this function) 8 | if (scanf("%d", &N)) {} | ^ main.c:8:66: note: each undeclared identifier is reported only once for each function it appears in main.c:9:53: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 9 | if (scanf("%d", &K)) {} | ^~~~~ main.c:9:53: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:9:66: error: 'K' undeclared (first use in this function) 9 | if (scanf("%d", &K)) {} | ^ main.c:10:53: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 10 | if (scanf("%d", &X)) {} | ^~~~~ main.c:10:53: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:10:66: error: 'X' undeclared (first use in this function) 10 | if (scanf("%d", &X)) {} | ^ main.c:11:53: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 11 | if (scanf("%d", &Y)) {} | ^~~~~ main.c:11:53: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:11:66: error: 'Y' undeclared (first use in this function) 11 | if (scanf("%d", &Y)) {} | ^ main.c:13:61: error: 'ans' undeclared (first use in this function) 13 | if (ans += Y) {} | ^~~ main.c:20:53: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 20 | if (printf("%d", ans)) {} | ^~~~~~ main.c:20:53: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:20:53: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:20:53: note: include '<stdio.h>' or provide a declaration of 'printf'
s139190762
p04011
C
#include <stdio.h> int main(void){ int n, k, x, y, cost; scanf("%d\n%d\n%d\n%d", &n, &k, &x, &y); if(n > k){ cost = k*x+(n-k)y; } else{ cost = n*x; } printf("%d\n", cost); return 0; }
main.c: In function 'main': main.c:9:33: error: expected ';' before 'y' 9 | cost = k*x+(n-k)y; | ^ | ;
s512068070
p04011
C++
#include <stdio.h> int main(){ int n, k, x, y; scanf("%d %d %d %d", &n, &k, &x, &y); if(n-k) sum=k*x+(n-k)*y; else sum=k*x; printf("%d\n", sum); return 0; }
a.cc: In function 'int main()': a.cc:6:10: error: 'sum' was not declared in this scope 6 | if(n-k) sum=k*x+(n-k)*y; | ^~~ a.cc:7:7: error: 'sum' was not declared in this scope 7 | else sum=k*x; | ^~~ a.cc:8:17: error: 'sum' was not declared in this scope 8 | printf("%d\n", sum); | ^~~
s642255231
p04011
C++
n = int(input()) k = int(input()) x = int(input()) y = int(input()) if n <= k : print(x*n) else : ans = k*x+(n-k)*y print(int(ans))
a.cc:1:1: error: 'n' does not name a type 1 | n = int(input()) | ^
s501142484
p04011
C
#include <stdio.h> int main() { int n,k,x,y; scanf("%d",&n); scanf("%d",&k); scanf("%d",&x); scanf("%d",&y); int gokei=0; int i=0; if(n<k){ gokei=k*x; }else{ i=n-k; gokei=k*x+i*y; } printf("%d",golei); return 0; }
main.c: In function 'main': main.c:19:21: error: 'golei' undeclared (first use in this function); did you mean 'gokei'? 19 | printf("%d",golei); | ^~~~~ | gokei main.c:19:21: note: each undeclared identifier is reported only once for each function it appears in
s609452077
p04011
C
#include <stdio.h> int main() { int n,k,x,y; scanf("%d",&n); scanf("%d",&k); scanf("%d",&x); scanf("%d",&y); int gokei=0; int i=0; if(n<k){ i=0; }else{ i=n-k; } gokei=i*y+k*x; printf("%d",golei); return 0; }
main.c: In function 'main': main.c:18:21: error: 'golei' undeclared (first use in this function); did you mean 'gokei'? 18 | printf("%d",golei); | ^~~~~ | gokei main.c:18:21: note: each undeclared identifier is reported only once for each function it appears in
s903051846
p04011
C
#include <stdio.h> int main() { int n,k,x,y; scanf("%d",&n); scanf("%d",&k); scanf("%d",&x); scanf("%d",&y); int gokei=0; int i=n-k; gokei=i*y+k*x; printf("%d",golei); return 0; }
main.c: In function 'main': main.c:13:21: error: 'golei' undeclared (first use in this function); did you mean 'gokei'? 13 | printf("%d",golei); | ^~~~~ | gokei main.c:13:21: note: each undeclared identifier is reported only once for each function it appears in
s984190732
p04011
C++
#include <stdio.h> int N , K, X , Y ; int S; int main(void) { scanf("%s",N); scanf("%s",K); scanf("%s",X); scanf("%s",Y); int S = N*X + (N-K)*Y ; printf("%d",S) return 0; }
a.cc: In function 'int main()': a.cc:18:19: error: expected ';' before 'return' 18 | printf("%d",S) | ^ | ; ...... 21 | return 0; | ~~~~~~
s552234214
p04011
C++
#include <stdio.h> int N , K, X , Y ; int S; int main(void) { scanf("%d",N); scanf("%d",K); scanf("%d",X); scanf("%d",Y); int S = N*X + (N-K)*Y ; printf("%d",S) return 0; }
a.cc: In function 'int main()': a.cc:18:19: error: expected ';' before 'return' 18 | printf("%d",S) | ^ | ; ...... 21 | return 0; | ~~~~~~
s234632007
p04011
C++
#include <iostream> using namespace std; int Main() { int N,K,X,Y; cin>>N; cin>>K; cin>>X; cin>>Y; int res1 = K * X; int res2 = (N-K) * Y; cout<<res1+res2<<endl; return 0; }
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s933982375
p04011
C++
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = Integer.parseInt(sc.nextLine()); int k = Integer.parseInt(sc.nextLine()); int x = Integer.parseInt(sc.nextLine()); int y = Integer.parseInt(sc.nextLine()); int fee = (n-k) > 0? x * k + y * (n-k) : x * k; System.out.println(fee); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: expected unqualified-id before 'public' 3 | public class Main { | ^~~~~~
s022260450
p04011
C++
lines = $stdin.read.split(?\n).map(&:to_i) n = lines[0] k = lines[1] x = lines[2] y = lines[3] if k >= n { puts k*x } else { puts k*x + y(n-k) } puts
a.cc:1:28: error: stray '\' in program 1 | lines = $stdin.read.split(?\n).map(&:to_i) | ^ a.cc:1:1: error: 'lines' does not name a type 1 | lines = $stdin.read.split(?\n).map(&:to_i) | ^~~~~ a.cc:9:4: error: expected unqualified-id before 'else' 9 | } else { | ^~~~ a.cc:16:1: error: 'puts' does not name a type 16 | puts | ^~~~
s272804637
p04011
C
#include<stdio.h> int main() { int N, K, X, Y, Total; scanf_s("%d", &N); scanf_s("%d", &K); scanf_s("%d", &X); scanf_s("%d", &Y); if (N <= K) { Total = N*X; } else { Total = K*X + (N - K)*Y; } printf_s("%d\n", Total); return 0; }
main.c: In function 'main': main.c:7:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration] 7 | scanf_s("%d", &N); | ^~~~~~~ | scanf main.c:19:9: error: implicit declaration of function 'printf_s'; did you mean 'printf'? [-Wimplicit-function-declaration] 19 | printf_s("%d\n", Total); | ^~~~~~~~ | printf
s960737712
p04011
C++
N = input() K = input() X = input() Y = input() ix = min(K, N) iy = max(0, N-K) payment = ix * X + iy * Y print payment#, ix, iy
a.cc:10:14: error: stray '#' in program 10 | print payment#, ix, iy | ^ a.cc:1:1: error: 'N' does not name a type 1 | N = input() | ^
s157077020
p04011
C++
#include <string> #include <iostream> using namespace std; int main () { int N , K , X , Y ,a; cin >>N >> K >> X >> Y; a = K * X + (N - K) * Y; cout << a <<endl;
a.cc: In function 'int main()': a.cc:11:26: error: expected '}' at end of input 11 | cout << a <<endl; | ^ a.cc:7:1: note: to match this '{' 7 | { | ^
s766849751
p04011
C++
#include <iostream> using namespace std; int main() { cin >> N; cin >> K; cin >> X; cin >> Y; if (K-N>0) { cout << N*X + (K-N)*Y << endl; } else { cout << N*X << endl; } }
a.cc: In function 'int main()': a.cc:5:12: error: 'N' was not declared in this scope 5 | cin >> N; | ^ a.cc:6:12: error: 'K' was not declared in this scope 6 | cin >> K; | ^ a.cc:7:12: error: 'X' was not declared in this scope 7 | cin >> X; | ^ a.cc:8:12: error: 'Y' was not declared in this scope 8 | cin >> Y; | ^
s673238189
p04011
Java
import java.util.Scanner; public class Solution{ public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int k = in.nextInt(); int x = in.nextInt(); int y = in.nextInt(); int ret = 0; for(int i = 0; i<n ; i++){ if(k<n){ ret = ret+x; }else{ ret = ret+y; } } System.out.println(ret); } }
Main.java:3: error: class Solution is public, should be declared in a file named Solution.java public class Solution{ ^ 1 error
s046545252
p04011
C++
#include <bits/stdc++.h> using namespace std; int main() { int n,m,x,y; cin >> n >> m >> x >> y; cout << min(n,m)*x+max(0,n-m)*y << endl return 0; }
a.cc: In function 'int main()': a.cc:7:42: error: expected ';' before 'return' 7 | cout << min(n,m)*x+max(0,n-m)*y << endl | ^ | ; 8 | return 0; | ~~~~~~
s693849319
p04011
Java
import java.util.*; public class taskA { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int totalNights, numFirst, numSubsequent; int priceFirst, priceSubsequent; totalNights = sc.nextInt(); numFirst = sc.nextInt(); numSubsequent = totalNights - numFirst; priceFirst = sc.nextInt(); priceSubsequent = sc.nextInt(); if (totalNights < numFirst) { numFirst = totalNights; numSubsequent = 0; } System.out.println(numFirst*priceFirst + numSubsequent*priceSubsequent); }
Main.java:22: error: reached end of file while parsing } ^ 1 error
s508206542
p04011
Java
import java.util.Scanner; public Class FeeCalculator(){ public static void main (String [] args){ Scanner in = new Scanner(System.in); int N = in.nextInt(); int K = in.nextInt(); int X = in.nextInt(); int Y = in.nextInt(); int total = K*X + (N-K)*Y; System.out.println(total); } }
Main.java:3: error: unnamed classes are a preview feature and are disabled by default. public Class FeeCalculator(){ ^ (use --enable-preview to enable unnamed classes) Main.java:4: error: illegal start of expression public static void main (String [] args){ ^ Main.java:14: error: class, interface, enum, or record expected } ^ 3 errors
s092546777
p04011
C++
#include <iostream>   using namespace std;   int main() { int N,K,X,Y; cin >> N; cin >> K; cin >> X; cin >> Y; if(N < K) { cout << N*X << endl; return 0; } int result = K*X + (N-K)*Y; cout << result << endl; return 0; }
a.cc:2:1: error: extended character   is not valid in an identifier 2 |   | ^ a.cc:4:1: error: extended character   is not valid in an identifier 4 |   | ^ a.cc:2:1: error: '\U000000a0' does not name a type 2 |   | ^ a.cc:4:1: error: '\U000000a0' does not name a type 4 |   | ^
s919964941
p04011
C++
#include <iostream> using namespace std; int main(){ int N; int K; int X; int Y; int sum =0; cin >>N >> K >> X >> Y; for(int i=1; i<=N; i++){ if(i <=K){ sum +=X; } else { sum +=Y; } } return 0;
a.cc: In function 'int main()': a.cc:23:10: error: expected '}' at end of input 23 | return 0; | ^ a.cc:5:11: note: to match this '{' 5 | int main(){ | ^
s536950153
p04011
C++
#include <iostream> using namespace std; int main(){ int N; int K; int X; int Y; int sum =0; cin >>N >> K >> X >> Y; for(int i=1; i<=N; i++){ if(i < =K){ sum +=X; } else { sum +=Y; } } return 0; }
a.cc: In function 'int main()': a.cc:15:9: error: expected primary-expression before '=' token 15 | if(i < =K){ | ^
s140378376
p04011
Java
package A; import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); scan = new Scanner(System.in); int K = scan.nextInt(); scan = new Scanner(System.in); int X = scan.nextInt(); scan = new Scanner(System.in); int Y = scan.nextInt(); int Hi = N - K; int Yen; if (Hi > 0){ Yen = K * X; Yen = Yen + (Hi * Y); System.out.println(Yen); } else{ Yen = N * X; System.out.println(Yen); } } }
Main.java:5: error: class Test is public, should be declared in a file named Test.java public class Test { ^ 1 error
s823548935
p04011
Java
package sample; import java.util.Scanner; public class A { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); scan = new Scanner(System.in); int K = scan.nextInt(); scan = new Scanner(System.in); int X = scan.nextInt(); scan = new Scanner(System.in); int Y = scan.nextInt(); int Hi = N - K; int Yen; if (Hi > 0){ Yen = K * X; Yen = Yen + (Hi * Y); System.out.println(Yen); } else{ Yen = N * X; System.out.println(Yen); } } }
Main.java:5: error: class A is public, should be declared in a file named A.java public class A { ^ 1 error
s637671470
p04011
Java
package sample; import java.util.Scanner; public class ABC { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); scan = new Scanner(System.in); int K = scan.nextInt(); scan = new Scanner(System.in); int X = scan.nextInt(); scan = new Scanner(System.in); int Y = scan.nextInt(); int Hi = N - K; int Yen; if (Hi > 0){ Yen = K * X; Yen = Yen + (Hi * Y); System.out.println(Yen); } else{ Yen = N * X; System.out.println(Yen); } } }
Main.java:5: error: class ABC is public, should be declared in a file named ABC.java public class ABC { ^ 1 error
s363999749
p04011
Java
public class toi1 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int n_day = Integer.parseInt(args[0]); int k_day = Integer.parseInt(args[1]); int x_yen = Integer.parseInt(args[2]); int y_yen = Integer.parseInt(args[3]); int sum = 0; for (int i = 1; i <= n_day; i++) { if (i < k_day) { sum = sum + y_yen; } if (i >= k_day) { sum = sum + x_yen; } } System.out.println(sum); } }
Main.java:1: error: class toi1 is public, should be declared in a file named toi1.java public class toi1 { ^ 1 error
s539027103
p04011
C++
#include <string> #include <sstream> #include <iostream> #include <vector> using namespace std; int main() { vector <char> _vec; int total [26] = {0}; string s = ""; cin >> s; for (char& c : s) { for (int i=0; i<_vec.size(); i++) { if(c!=_vec(i) { _vec.push(c) } total(i) = total(i)+1; } } for (int x : total){ if(x%2!=0){ cout << "No" break; } } cout << "Yes"; return 0; }
a.cc: In function 'int main()': a.cc:20:35: error: no match for call to '(std::vector<char>) (int&)' 20 | if(c!=_vec(i) { | ~~~~^~~ a.cc:23:30: error: 'total' cannot be used as a function 23 | total(i) = total(i)+1; | ~~~~~^~~ a.cc:23:41: error: 'total' cannot be used as a function 23 | total(i) = total(i)+1; | ~~~~~^~~ a.cc:23:46: error: expected ')' before ';' token 23 | total(i) = total(i)+1; | ^ | ) a.cc:20:27: note: to match this '(' 20 | if(c!=_vec(i) { | ^ a.cc:30:37: error: expected ';' before 'break' 30 | cout << "No" | ^ | ; 31 | break; | ~~~~~
s854618997
p04011
Java
package sample; import java.util.Scanner; public class sample { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); scan = new Scanner(System.in); int K = scan.nextInt(); scan = new Scanner(System.in); int X = scan.nextInt(); scan = new Scanner(System.in); int Y = scan.nextInt(); int Hi = N - K; int Yen; if (Hi > 0){ Yen = K * X; Yen = Yen + (Hi * Y); System.out.println(Yen); } else{ Yen = N * X; System.out.println(Yen); } } }
Main.java:5: error: class sample is public, should be declared in a file named sample.java public class sample { ^ 1 error
s283484355
p04011
Java
package A; import java.util.Scanner; public class sample { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); scan = new Scanner(System.in); int K = scan.nextInt(); scan = new Scanner(System.in); int X = scan.nextInt(); scan = new Scanner(System.in); int Y = scan.nextInt(); int Hi = N - K; int Yen; if (Hi > 0){ Yen = K * X; Yen = Yen + (Hi * Y); System.out.println(Yen); } else{ Yen = N * X; System.out.println(Yen); } } }
Main.java:5: error: class sample is public, should be declared in a file named sample.java public class sample { ^ 1 error
s855212328
p04011
C++
N = input() K = input() X = input() Y = input() print( K*X + (N-K)*Y )
a.cc:1:1: error: 'N' does not name a type 1 | N = input() | ^
s520417244
p04011
Java
package A; import java.util.Scanner; public class A { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); scan = new Scanner(System.in); int K = scan.nextInt(); scan = new Scanner(System.in); int X = scan.nextInt(); scan = new Scanner(System.in); int Y = scan.nextInt(); int Hi = N - K; int Yen; if (Hi > 0){ Yen = K * X; Yen = Yen + (Hi * Y); System.out.println(Yen); } else{ Yen = N * X; System.out.println(Yen); } } }
Main.java:5: error: class A is public, should be declared in a file named A.java public class A { ^ 1 error
s004996464
p04011
C++
#include<iostream> #include<string> using namespace std; int main(){ string s; cin>>s; int char[26]={0}; for(int i=0;i<s.len;i++){ if(char[s[i]-97]==0) char[s[i]-97]=1; else char[s[i]-97]=0; } for(int i=0;i<n;i++){ if (char[i]=='1'){cout<<"No";return 0;} } cout<<"Yes"; }
a.cc: In function 'int main()': a.cc:9:10: error: expected identifier before numeric constant 9 | int char[26]={0}; | ^~ a.cc:9:10: error: expected ']' before numeric constant 9 | int char[26]={0}; | ^~ | ] a.cc:9:1: error: two or more data types in declaration of 'structured binding' 9 | int char[26]={0}; | ^~~ a.cc:9:9: error: empty structured binding declaration 9 | int char[26]={0}; | ^ a.cc:10:17: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'len' 10 | for(int i=0;i<s.len;i++){ | ^~~ a.cc:11:8: error: expected unqualified-id before '[' token 11 | if(char[s[i]-97]==0) | ^ a.cc:12:7: error: expected ']' before '[' token 12 | char[s[i]-97]=1; | ^ | ] a.cc:12:5: error: structured binding declaration cannot have type 'char' 12 | char[s[i]-97]=1; | ^ a.cc:12:5: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:12:5: error: cannot decompose non-array non-class type 'int' a.cc:13:12: error: expected ']' before '[' token 13 | else char[s[i]-97]=0; | ^ | ] a.cc:13:10: error: structured binding declaration cannot have type 'char' 13 | else char[s[i]-97]=0; | ^ a.cc:13:10: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto' a.cc:13:10: error: cannot decompose non-array non-class type 'int' a.cc:16:15: error: 'n' was not declared in this scope 16 | for(int i=0;i<n;i++){ | ^ a.cc:17:9: error: expected unqualified-id before '[' token 17 | if (char[i]=='1'){cout<<"No";return 0;} | ^
s678585203
p04011
C
#include<stdio.h> #include <string.h> #include <stdlib.h> int main() { int n; int k; int x; int y; int sum1; int i; // 個数のの入力 sum1 = 0; scanf("%d %d %d %d",&n,&k,&x,&y); for (i = 0;i < n; i++) { if (i < k ) { sum1 = sum1 + x; } else sum1 = sum1 + y; } } printf("%d\n",sum1); return 0; }
main.c:28:16: error: expected declaration specifiers or '...' before string constant 28 | printf("%d\n",sum1); | ^~~~~~ main.c:28:23: error: unknown type name 'sum1' 28 | printf("%d\n",sum1); | ^~~~ main.c:31:9: error: expected identifier or '(' before 'return' 31 | return 0; | ^~~~~~ main.c:32:1: error: expected identifier or '(' before '}' token 32 | } | ^
s342941364
p04011
C++
N = int(input()) K = int(input()) X = int(input()) Y = int(input()) if N > K: print(X * K + Y * (N-K)) else: print(X * N)
a.cc:1:1: error: 'N' does not name a type 1 | N = int(input()) | ^
s221710871
p04011
C
#include<stdio.h> #include <string.h> #include <stdlib.h> int main() { int n; int k; int x; int y; int sum1; int i; // 個数のの入力 sum = 0; scanf("%d %d %d %d",&n,&k,&x,&y); for (i = 0;i < n; i++) { if (i < k ) { sum1 = sum1 + x; } else sum1 = sum1 + y; } } printf("%d\n",sum1); return 0; }
main.c: In function 'main': main.c:16:9: error: 'sum' undeclared (first use in this function); did you mean 'sum1'? 16 | sum = 0; | ^~~ | sum1 main.c:16:9: note: each undeclared identifier is reported only once for each function it appears in main.c: At top level: main.c:28:16: error: expected declaration specifiers or '...' before string constant 28 | printf("%d\n",sum1); | ^~~~~~ main.c:28:23: error: unknown type name 'sum1' 28 | printf("%d\n",sum1); | ^~~~ main.c:31:9: error: expected identifier or '(' before 'return' 31 | return 0; | ^~~~~~ main.c:32:1: error: expected identifier or '(' before '}' token 32 | } | ^
s705103450
p04011
C
#include<stdio.h> #include <string.h> #include <stdlib.h> int main() { int n; int k; int x; int y; int sum; int i; // 個数のの入力 sum = 0; scanf("%d %d %d %d",&n,&k,&x,&y); for (i = 0;i < n; i++) { if (i < k ) { sum = sum + x; } else sum = sum + y; } } printf("%d|n",sum); return 0; }
main.c:28:16: error: expected declaration specifiers or '...' before string constant 28 | printf("%d|n",sum); | ^~~~~~ main.c:28:23: error: unknown type name 'sum' 28 | printf("%d|n",sum); | ^~~ main.c:31:9: error: expected identifier or '(' before 'return' 31 | return 0; | ^~~~~~ main.c:32:1: error: expected identifier or '(' before '}' token 32 | } | ^
s708653702
p04011
C
#include<stdio.h> #include <string.h> #include <stdlib.h> int main() { int n; int k; int x; int y; int sum; int i; // 個数のの入力 sum = 0; scanf("%d %d %d %d",&n,&k,&x,&y); for (i = 0,i < n, i++) { if (i < k ) { sum = sum + x; } else sum = sum + y; } } printf("%d|n",sum); return 0; }
main.c: In function 'main': main.c:19:30: error: expected ';' before ')' token 19 | for (i = 0,i < n, i++) { | ^ | ; main.c:19:30: error: expected expression before ')' token main.c: At top level: main.c:28:16: error: expected declaration specifiers or '...' before string constant 28 | printf("%d|n",sum); | ^~~~~~ main.c:28:23: error: unknown type name 'sum' 28 | printf("%d|n",sum); | ^~~ main.c:31:9: error: expected identifier or '(' before 'return' 31 | return 0; | ^~~~~~ main.c:32:1: error: expected identifier or '(' before '}' token 32 | } | ^
s788693027
p04011
C
#include<stdio.h> #include <string.h> #include <stdlib.h> int main() { int n; int k; int x; int y; int sum; int i; // 個数のの入力 sum = 0; scanf("%d %d %d %d",&n,&k,&x,&y); for (i = 0,i < n, i++) { if (i < k ) { sum = sum + x; } else sum = sum + y; } } printf("%d",sum); return 0; }
main.c: In function 'main': main.c:19:30: error: expected ';' before ')' token 19 | for (i = 0,i < n, i++) { | ^ | ; main.c:19:30: error: expected expression before ')' token main.c: At top level: main.c:28:16: error: expected declaration specifiers or '...' before string constant 28 | printf("%d",sum); | ^~~~ main.c:28:21: error: unknown type name 'sum' 28 | printf("%d",sum); | ^~~ main.c:31:9: error: expected identifier or '(' before 'return' 31 | return 0; | ^~~~~~ main.c:32:1: error: expected identifier or '(' before '}' token 32 | } | ^