submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s347826308 | p02258 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,a;
cin >> n;
for(int i = 0; i < n; i++){
cin >> a[i];
}
int maxv = -200000,minv = a[0];
for(int j = 1; j < n; j++){
maxv = max(maxv,a[j]- minv);
minv = min(minv,a[j]);
}
cout << maxv << endl;
... | a.cc: In function 'int main()':
a.cc:9:17: error: invalid types 'int[int]' for array subscript
9 | cin >> a[i];
| ^
a.cc:11:32: error: invalid types 'int[int]' for array subscript
11 | int maxv = -200000,minv = a[0];
| ^
a.cc:13:26: error: in... |
s171172430 | p02258 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,a;
cin >> n;
for(int i = 0; i < n; i++){
cin >> a[i];
}
int maxv = a[1]-a[0],minv = a[0];
for(int j = 1; j < n; j++){
maxv = max(maxv,a[j] - minv);
minv = min(minv,a[j]);
}
cout << maxv << endl;
... | a.cc: In function 'int main()':
a.cc:9:17: error: invalid types 'int[int]' for array subscript
9 | cin >> a[i];
| ^
a.cc:11:17: error: invalid types 'int[int]' for array subscript
11 | int maxv = a[1]-a[0],minv = a[0];
| ^
a.cc:11:22: error: invalid types '... |
s338776437 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
#define MAX 200000
int main(void) {
int R[MAX], n=0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> R[i];
}
int maxv = -2000000000;
int minv = R[0];
for (int i = 1; i < n; i++) {
maxv = max(maxv, R[i] - minv);
minv = min(minv, R[i]);
}
cout... | a.cc: In function 'int main()':
a.cc:20:30: error: expected '}' at end of input
20 | cout << maxv << endl;
| ^
a.cc:7:16: note: to match this '{'
7 | int main(void) {
| ^
|
s667725412 | p02258 | C++ | #include <iostream>
#include <list>
#include <cmath>
#include<vector>
#include <utility>
using namespace std;
#define D
#ifdef D
int main(void)
{
int n;
cin >> n;
int max = INT_MIN;
int min = INT_MAX;
int dis,in;
for (size_t i = 0; i < n; i++)
{
cin >> in;
if (min > in)
min = in;
if (max < in - min)
... | a.cc: In function 'int main()':
a.cc:16:19: error: 'INT_MIN' was not declared in this scope
16 | int max = INT_MIN;
| ^~~~~~~
a.cc:6:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
5 | #include <utility>
+++ |+#include... |
s207640619 | p02258 | C++ | using System;
class A{
static void Main(){
int n=int.Parse(Console.ReadLine());
var a=new int[n];
int max=0;
for(int i=0;i<n;i++){
a[i]=int.Parse(Console.ReadLine());
for(int j=0;j<i;j++){
max=Math.Max(a[j]-a[i],max);
}
}
Console.WriteLine(max);
///
}} | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:16:3: error: expected ';' after class definition
16 | }}
| ^
| ;
a.cc: In static member function 'static void A::Main()':
a.cc:5:7: error: expected primary-expression before 'int'
5 | i... |
s097318486 | p02258 | C++ | #include<iostream>
using namespace std;
int main() {
int num, i, j, max_profit;
cin >> num;
int arr[num];
for (i = 0; i < num; i++) {
cin>>arr[i];
}
max_profit = arr[1] - arr[0];
for (i = 0; i < num-1; i++) {
for (j = i+1; j < num; j++) {
if (max_profit < arr[j] -... | a.cc: In function 'int main()':
a.cc:13:46: error: expected primary-expression before ')' token
13 | if (max_profit < arr[j] - arr[i];) {
| ^
|
s238514834 | p02258 | C++ | #include<iostream>
#include <vector>
int main()
{
std::vector<long> Dat={};
int t=0;
std::cin >>t;
for(int i=0;i<t;i++)
{
int tmp=0;
std::cin >>tmp;
Dat.push_back(tmp);
}
long max=*Dat.begin;
for(auto cur=Dat.begin();!cur=Dat.end()-1;cur++)// may bug
{
long start = *cur;
long tmp=*(cur+1);
for(auto curr=cur+2;curr!=Da... | a.cc: In function 'int main()':
a.cc:15:15: error: invalid use of member function 'std::vector<long int>::begin' (did you forget the '()' ?)
15 | long max=*Dat.begin;
| ~~~~^~~~~
a.cc:16:26: error: no match for 'operator!' (operand type is '__gnu_cxx::__normal_iterator<long int*, std::vector<long int... |
s130468400 | p02258 | C++ | #include "stdafx.h"
#include <iostream>
#include <vector>
int main()
{
std::vector<long> Dat = {};
int t = 0;
std::cin >> t;
for (int i = 0; i<t; i++)
{
int tmp = 0;
std::cin >> tmp;
Dat.push_back(tmp);
}
long max = *(Dat.begin()+1)- *Dat.begin();
for (auto cur = Dat.begin(); cur != Dat.end() - 1; cur++)... | a.cc:1:10: fatal error: stdafx.h: No such file or directory
1 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s471970482 | p02258 | C++ | #include "stdafx.h"
#include <iostream>
#include <vector>
int main()
{
std::vector<long> Dat = {};
int t = 0;
std::cin >> t;
for (int i = 0; i<t; i++)
{
int tmp = 0;
std::cin >> tmp;
Dat.push_back(tmp);
}
long min=*Dat.begin(),max=-2E9;
for (auto cur = Dat.begin()+1; cur != Dat.end() ; cur++)
{
if (*(... | a.cc:1:10: fatal error: stdafx.h: No such file or directory
1 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s055593742 | p02258 | C++ | #include <cstdio>
#include <algorithm>
constexpr int inf = 1e30;
int main() {
int n, maxv, minv, r;
scanf("%d", &n);
maxv = -inf;
scanf("%d", &minv);
for (int i = 1; i < n; i++) {
scanf("%d", &r);
maxv = max(maxv, r - minv);
minv = min(minv, r)
}
printf("%d\n", maxv);
return 0;
} | a.cc:4:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+30' to '2147483647' [-Woverflow]
4 | constexpr int inf = 1e30;
| ^~~~
a.cc:4:21: error: overflow in constant expression [-fpermissive]
a.cc:4:21: error: overflow in constant expression [-fpermissive]... |
s533837903 | p02258 | C++ | #include <cstdio>
#include <algorithm>
constexpr int inf = 1<<20;
int main() {
int n, maxv, minv, r;
scanf("%d", &n);
maxv = -inf;
scanf("%d", &minv);
for (int i = 1; i < n; i++) {
scanf("%d", &r);
maxv = max(maxv, r - minv);
minv = min(minv, r)
}
printf("%d\n", maxv);
return 0;
} | a.cc: In function 'int main()':
a.cc:15:12: error: 'max' was not declared in this scope; did you mean 'std::max'?
15 | maxv = max(maxv, r - minv);
| ^~~
| std::max
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:2:
/usr/include/c++/14/bits/stl_... |
s369936525 | p02258 | C++ | #include <cstdio>
#include <algorithm>
using namespace std;
constexpr int inf = 1<<20;
int main() {
int n, maxv, minv, r;
scanf("%d", &n);
maxv = -inf;
scanf("%d", &minv);
for (int i = 1; i < n; i++) {
scanf("%d", &r);
maxv = max(maxv, r - minv);
minv = min(minv, r)
}
printf("%d\n", maxv)... | a.cc: In function 'int main()':
a.cc:17:24: error: expected ';' before '}' token
17 | minv = min(minv, r)
| ^
| ;
18 | }
| ~
|
s326513427 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n;
long long int num[200000],max1=-1000000000,min1=1000000000;
cin >> n;
for(int i=0;i<n;i++){
cin >> num[i];
min1 = min(min1,num[i]);
max1 = max(max1,num[i]-min1)
}
cout << max1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:12:45: error: expected ';' before '}' token
12 | max1 = max(max1,num[i]-min1)
| ^
| ;
13 | }
| ~
|
s863069095 | p02258 | C++ | #include <stdio.h>
int main(void)
{
int n,t,R[],max,min;
scanf("%d",&n");
for(t=0;t<n;t++){
scanf("%d",&R[t]);
}
min=R[0];
max=0;
for(t=1;t<n;t++){
if( max^2 < (R[t]-min)^2 ){
max = R[t]-min;
}
if( min > R[t] ){
min = R[t];
}
}
printf("%d",max);
return 0;
} | a.cc:7:15: warning: missing terminating " character
7 | scanf("%d",&n");
| ^
a.cc:7:15: error: missing terminating " character
7 | scanf("%d",&n");
| ^~~
a.cc: In function 'int main()':
a.cc:5:10: error: storage size of 'R' isn't known
5 | int n,t,R[],max,min;
... |
s984287778 | p02258 | C++ | #include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;
int main () {
int n, maxv, minv;
cin >> n;
int r [n], maxv = -1000000001;
int minv = 1000000001;
for (int i = 0; i <= n; i++) {
... | a.cc: In function 'int main()':
a.cc:11:14: error: redeclaration of 'int maxv'
11 | int r [n], maxv = -1000000001;
| ^~~~
a.cc:9:10: note: 'int maxv' previously declared here
9 | int n, maxv, minv;
| ^~~~
a.cc:12:7: error: redeclaration of 'int minv'
12 | int minv = 100... |
s156071094 | p02258 | C++ | #include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;
int main () {
cin >> n;
int r [n];
int maxv = -1000000001;
int minv = 1000000001;
for (int i = 0; i <= n; i++) {
cin >> r [i];... | a.cc: In function 'int main()':
a.cc:9:10: error: 'n' was not declared in this scope; did you mean 'yn'?
9 | cin >> n;
| ^
| yn
a.cc:14:12: error: 'r' was not declared in this scope
14 | cin >> r [i];
| ^
|
s501597577 | p02258 | C++ | #include<bits/stdc++.h>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)
using namespace std;
int main () {
int n;
cin >> n;
int r[n];
for (int i = 0; i < n; i++) {
cin >> r[i];
}
int maxv = -1000000001;
int minv =... | a.cc: In function 'int main()':
a.cc:20:25: error: 'i' was not declared in this scope
20 | minv = min (minv, r[i]);
| ^
a.cc: At global scope:
a.cc:22:3: error: 'cout' does not name a type
22 | cout << maxv << endl;
| ^~~~
a.cc:23:3: error: expected unqualified-id befor... |
s547675778 | p02258 | C++ | #include <iostream>
#include <vector>
#include <limits>
using namespace std;
int solve(const vector<int> &v) {
int res = numeric_limits<int>::min();
for (int i = 0; i < v.size(); i++) {
for (int j = i + 1; j < v.size(); j++) {
res = max(res, v[j] - v[i]);
}
}
return res;
}
... | a.cc: In function 'int solve2(const std::vector<int>&)':
a.cc:23:5: error: 'sort' was not declared in this scope; did you mean 'short'?
23 | sort(pv.begin(), pv.end(), [](auto l, auto r) { return l.value > r.value; });
| ^~~~
| short
|
s617321253 | p02258 | C++ | #include <iostream>
#include <vector>
#include <limits>
using namespace std;
int solve(const vector<int> &v) {
int res = numeric_limits<int>::min();
for (int i = 0; i < v.size(); i++) {
for (int j = i + 1; j < v.size(); j++) {
res = max(res, v[j] - v[i]);
}
}
return res;
}
... | a.cc: In function 'int solve2(const std::vector<int>&)':
a.cc:23:5: error: 'sort' was not declared in this scope; did you mean 'short'?
23 | sort(pv.begin(), pv.end(), [](auto l, auto r) { return l.value > r.value; });
| ^~~~
| short
|
s259901088 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
static const int MAX=200000;
int main(){
intR[MAX],n;
cin>>n;
for(int i=0;i<n;i++) cin>>R[i];
int maxv=-2000000000;
int minv=R[0];
for(int i=1;i<n;i++){
maxv=max(maxv,R[i]-minv);
minv=min(minv,R[i]);
}
cout<<maxv<<end;
return 0;
... | a.cc: In function 'int main()':
a.cc:7:3: error: 'intR' was not declared in this scope; did you mean 'int'?
7 | intR[MAX],n;
| ^~~~
| int
a.cc:7:13: error: 'n' was not declared in this scope
7 | intR[MAX],n;
| ^
a.cc:9:29: error: 'R' was not declared in this scope
9 | ... |
s818875030 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
static const int MAX=200000;
int main(){
int R[MAX],n;
cin>>n;
for(int i=0;i<n;i++) cin>>R[i];
int maxv=-2000000000;
int minv=R[0];
for(int i=1;i<n;i++){
maxv=max(maxv,R[i]-minv);
minv=min(minv,R[i]);
}
cout<<maxv<<end;
ret... | a.cc: In function 'int main()':
a.cc:20:13: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
20 | cout<<maxv<<end;
| ~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c... |
s164306969 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
static const int MAX=200000;
int main(){
intR[MAX],n;
cin>>n;
for(int i=0;i<n;i++) cin>>R[i];
int maxv=-2000000000;
int minv=R[0];
for(int i=1;i<n;i++){
maxv=max(maxv,R[i]-minv);
minv=min(minv,R[i]);
}
cout<<maxv<<end;
retur... | a.cc: In function 'int main()':
a.cc:7:3: error: 'intR' was not declared in this scope; did you mean 'int'?
7 | intR[MAX],n;
| ^~~~
| int
a.cc:7:13: error: 'n' was not declared in this scope
7 | intR[MAX],n;
| ^
a.cc:9:29: error: 'R' was not declared in this scope
9 | ... |
s722811574 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
static const int MAX=200000;
int main(){
int R[MAX],n;
cin>>n;
for(int i=0;i<n;i++) cin>>R[i];
int maxv=-2000000000;
int minv=R[0];
for(int i=1;i<n;i++){
maxv=max(maxv,R[i]-minv);
minv=min(minv,R[i]);
}
cout<<maxv<<end;
retu... | a.cc: In function 'int main()':
a.cc:19:13: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
19 | cout<<maxv<<end;
| ~~~~~~~~~~^~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c... |
s929547079 | p02258 | C++ | #include<stdio.h>
#include<math.h>
int main() {
int i, j,n,Rt[200000],max;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &Rt[i]);
}
max = 0;
for (i = 0; i < n; i++) {
for (j = i+1; j < n; j++) {
if (Rt[j] > Rt[i]) {
max = Rt[j] - Rt[i];
}
}
}
printf("%d\n",max)
} | a.cc: In function 'int main()':
a.cc:18:27: error: expected ';' before '}' token
18 | printf("%d\n",max)
| ^
| ;
19 |
20 | }
| ~
|
s230278305 | p02258 | C++ | #include<stdio.h>
#include<math.h>
int main() {
int i, j,n,Rt[200000],max;
scanf_s("%d", &n);
for (i = 0; i < n; i++) {
scanf_s("%d", &Rt[i]);
}
max = 0;
for (i = 0; i < n; i++) {
for (j = i+1; j < n; j++) {
if (max < Rt[j] - Rt[i]) {
max = Rt[j] - Rt[i];
}
}
}
printf("%d\n", max);
} | a.cc: In function 'int main()':
a.cc:6:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
6 | scanf_s("%d", &n);
| ^~~~~~~
| scanf
|
s133928338 | p02258 | C++ | #include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef signed long long ll;
#define MIN(a, b) (a < b) ? a : b
#define MAX(a, b) (a > b) ? a : b
int main(void)
{
int N = 0;
int R = 0;
int min = INT_MAX;
int max... | a.cc: In function 'int main()':
a.cc:18:15: error: 'INT_MAX' was not declared in this scope
18 | int min = INT_MAX;
| ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
6 | #include <vector>
+++ |+#include <climits... |
s145625991 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;
int main(){
int R[MAX], n;
cin >> n;
for(int i=0; i<n; i++){
cin >> R[i];
}
int maxValue = -2000000000;
int minValue = R[0];
for(int j=1;){
maxValue = max(maxValue, R[j]-minValue);
... | a.cc: In function 'int main()':
a.cc:13:17: error: expected primary-expression before ')' token
13 | for(int j=1;){
| ^
a.cc:13:17: error: expected ';' before ')' token
13 | for(int j=1;){
| ^
| ;
a.cc:18:13: error: expected ';' before '}' ... |
s438900950 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;
int main(){
int R[MAX], n;
cin >> n;
for(int i=0; i<n; i++){
cin >> R[i];
}
int maxValue = -2000000000;
int minValue = R[0];
for(int j=1; j<n; j++){
maxValue = max(maxValue, R[j]-minV... | a.cc: In function 'int main()':
a.cc:18:13: error: expected ';' before '}' token
18 | return 0
| ^
| ;
19 | }
| ~
|
s488452990 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
int main()
{
int n;
cin >> n;
int maxv = -2000000000;
int minv = 0;
for (int i = 0; i < n; i++) {
int r;
cin >> r;
maxv = max(maxv, r - minv);
minv = min(minv, r);
}
cout << max << endl;
return 0;... | a.cc: In function 'int main()':
a.cc:18:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>')
18 | cout << max << endl;
| ~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.... |
s809252680 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
int main()
{
int n;
cin >> n;
int maxv = -2000000000;
int minv;
cin >> minv;
for (int i = 1; i < n; i++) {
int r;
cin >> r;
maxv = max(maxv, r - minv);
minv = min(minv, r);
}
cout << max << endl;... | a.cc: In function 'int main()':
a.cc:19:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>')
19 | cout << max << endl;
| ~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.... |
s625147419 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
int maxv = -2000000000;
int minv;
cin >> minv;
for (int i = 1; i < n; i++) {
int r;
cin >> r;
maxv = max(maxv, r - minv);
minv = min(minv, r);
}
cout << max << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:18:8: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>')
18 | cout << max << endl;
| ~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.... |
s550990528 | p02258 | C++ | #include <iostream>
#include <vector>
using namespace std;
int greater(int a, int b)
{
return a >= b ? a : b;
}
int main()
{
int n;
cin >> n;
vector<int> Rt(n);
for (int i = 0; i < n; i++) {
cin >> Rt[i];
}
int posL = 0;
int maxv = Rt[1] - Rt[0];
for (int i = 1; i < n; i++) {
if (Rt[i] <= Rt[posL])
... | a.cc: In function 'int main()':
a.cc:25:32: error: reference to 'greater' is ambiguous
25 | maxv = greater(maxv, Rt[i] - Rt[posL]);
| ^~~~~~~
In file included from /usr/include/c++/14/string:49,
from /usr/include/c++/14/bits/locale_classes... |
s754456107 | p02258 | C++ | #include <algorithm>
#include <iostream>
#include <iterator>
template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
if(!v.empty()) {
std::copy(v.begin(), v.end() - 1, std::ostream_iterator<T>(out, " "));
out << v.back();
} else {
out << "";
}
return out;
}
int... | a.cc:6:56: error: 'vector' in namespace 'std' does not name a template type
6 | std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
| ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by addi... |
s846396040 | p02258 | C++ | #include <stdio.h>
#include <iostream>
#include <fstream>
using namespace std;
int main(){
int n;
cin >> n; cin.ignore();
if (n < 2) {
cout << 0 << endl;
return 0;
}
int ary[n];
for (uint32_t i = 0; i < n; i++) {
cin >> ary[i];
//cout << ary[i] << endl;
}
int maxProf = ary[1] - ary[0... | a.cc: In function 'int main()':
a.cc:16:8: error: 'uint32_t' was not declared in this scope
16 | for (uint32_t i = 0; i < n; i++) {
| ^~~~~~~~
a.cc:4:1: note: 'uint32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
3 | #include <fstream>
+++ |+#includ... |
s866519240 | p02258 | C++ | #include <iostream>
#include <array>
using namespace std;
const int MAX = 200000;
int main(int argc, char *argv[]) {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
array<int, MAX> R;
for (int i = 0; i < n; i++) {
cin >> R[i];
}
int maxv;
for (int j = 1; j < n-... | a.cc: In function 'int main(int, char**)':
a.cc:26:5: error: 'println' was not declared in this scope; did you mean 'printf'?
26 | println(maxv)
| ^~~~~~~
| printf
|
s517880468 | p02258 | C++ | #include <iostream>
#include <array>
using namespace std;
const int MAX = 200000;
int main(int argc, char *argv[]) {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
array<int, MAX> R;
for (int i = 0; i < n; i++) {
cin >> R[i];
}
int maxv;
for (int j = 1; j < n-... | a.cc: In function 'int main(int, char**)':
a.cc:26:5: error: 'println' was not declared in this scope; did you mean 'printf'?
26 | println(maxv)
| ^~~~~~~
| printf
|
s466060658 | p02258 | C++ | #include<stdio.h>
#include<stdlib.h>
#include<limits.h>
int main(void){
const int N;
scanf("%d",&N);
int i,j,temp=0,min=INT_MAX,n,a[N],input;
for(i=0;i<N;i++){
scanf("%d",&input);
a[i]=input;
}
for(i=N-1;i>=0;i--){
for(j=i-1;j>=0;j--){
temp=a[i]-a[j];
if(temp<min){
min=temp;
... | a.cc: In function 'int main()':
a.cc:6:13: error: uninitialized 'const N' [-fpermissive]
6 | const int N;
| ^
|
s266082795 | p02258 | C++ | #include<stdio.h>
#include<stdlib.h>
#include<limits.h>
int main(void){
const int N;
scanf("%d",&N);
int i,j,temp=0,min=INT_MAX,n,a[N],input;
for(i=0;i<N;i++){
scanf("%d",&input);
a[i]=input;
}
for(i=N-1;i>=0;i--){
for(j=i-1;j>=0;j--){
temp=a[i]-a[j];
if(temp<min){
min=temp;
... | a.cc: In function 'int main()':
a.cc:6:13: error: uninitialized 'const N' [-fpermissive]
6 | const int N;
| ^
|
s865407511 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
static const int MAX=200000;
int main()
{
int N[MAX],n;
cin >> n;
for(int i=0; i<n; i++)
{
cin >> R[i];
}
int maxv = -2000000000;
int minv = R[0];
for(int i=1;i<n;i++)
{
maxv = max(maxv,N[i... | a.cc: In function 'int main()':
a.cc:15:16: error: 'R' was not declared in this scope
15 | cin >> R[i];
| ^
a.cc:19:16: error: 'R' was not declared in this scope
19 | int minv = R[0];
| ^
|
s469038294 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
static const int MAX=200000;
int main()
{
int N[MAX],n;
cin >> n;
for(int i=0; i<n; i++)
{
cin >> N[i];
}
int maxv = -2000000000;
int minv = R[0];
for(int i=1;i<n;i++)
{
maxv = max(maxv,N[i... | a.cc: In function 'int main()':
a.cc:19:16: error: 'R' was not declared in this scope
19 | int minv = R[0];
| ^
|
s605685850 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
static const int MAX=200000;
int main()
{
int N[MAX],n;
cin >> n;
for(int i=0; i<n; i++)
{
cin >> N[i];
}
int maxv = -2000000000;
int minv = R[0];
for(int i=1;i<n;i++)
{
maxv = max(maxv,N[i... | a.cc: In function 'int main()':
a.cc:19:16: error: 'R' was not declared in this scope
19 | int minv = R[0];
| ^
|
s902829182 | p02258 | C++ | #include <iostream>
??
int main() {
????????int num, tmp, min, ans =?? -1;
????????std::cin >> num >> min;
????????for(int i=1; i < num; i++){
????????????????std::cin >> tmp;
????????????????if(tmp - min > ans){
????????????????????????????????ans = tmp - min;
????????????????}
if( tmp < min){
min... | a.cc:2:1: error: expected unqualified-id before '?' token
2 | ??
| ^
|
s009101624 | p02258 | C++ | #include <iostream>
int main() {
int num, tmp, min, and;
std::cin >> num >> min;
for(int i=1; i < num; i++){
std::cin >> tmp;
if(tmp - min > ans || i == 1){
ans = tmp - min;
}
if( tmp < min ){
min = tmp;
}
}
std::cout << ans << s... | a.cc: In function 'int main()':
a.cc:4:27: error: expected unqualified-id before ';' token
4 | int num, tmp, min, and;
| ^
a.cc:8:25: error: 'ans' was not declared in this scope; did you mean 'abs'?
8 | if(tmp - min > ans || i == 1){
| ... |
s619301294 | p02258 | C++ | import sys
n=int(input())
r=list(map(int,sys.stdin.read())
print(max([max(r[i+1:])-r[i]for i in range(n-1)])) | a.cc:1:1: error: 'import' does not name a type
1 | import sys
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s250393158 | p02258 | C++ | #include <iostream>
using namespace std;
static const int MAX = 200000
int main(){
int R[MAX], n;
int temp;
cin >> n;
for(int i = 0; i < n; i++) cin >> R[i];
int min = r[0];
int max = -2000000;
for(int i = 0; i < n; i++){
if(r[i] > max){
max = r[i];
} else if (r[i] < min){
min = r... | a.cc:7:1: error: expected ',' or ';' before 'int'
7 | int main(){
| ^~~
|
s492895637 | p02258 | C++ | #include <iostream>
using namespace std;
static const int MAX = 200000;
int main(){
int R[MAX], n;
int temp;
cin >> n;
for(int i = 0; i < n; i++) cin >> R[i];
int min = r[0];
int max = -2000000;
for(int i = 0; i < n; i++){
if(r[i] > max){
max = r[i];
} else if (r[i] < min){
min = ... | a.cc: In function 'int main()':
a.cc:13:13: error: 'r' was not declared in this scope
13 | int min = r[0];
| ^
|
s239096376 | p02258 | C++ | #include <iostream>
using namespace std;
static const int MAX = 200000;
int main(){
int R[MAX], n;
int temp;
cin >> n;
for(int i = 0; i < n; i++) cin >> R[i];
int min = r[0];
int max = -2000000;
for(int i = 0; i < n; i++){
if(r[i] > max){
max = R[i];
} else if (R[i] < min){
min = ... | a.cc: In function 'int main()':
a.cc:13:13: error: 'r' was not declared in this scope
13 | int min = r[0];
| ^
|
s585355827 | p02258 | C++ | #include <iostream>
using namespace std;
static const int MAX = 200000;
int main(){
int R[MAX], n;
int temp;
cin >> n;
for(int i = 0; i < n; i++) cin >> R[i];
int min = R[0];
int max = -2000000;
for(int i = 0; i < n; i++){
if(r[i] > max){
max = R[i];
} else if (R[i] < min){
min = ... | a.cc: In function 'int main()':
a.cc:16:8: error: 'r' was not declared in this scope
16 | if(r[i] > max){
| ^
|
s055029328 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
static const int MAX = 200000;
int main()
{
int R[MAX], n;
cin >> n;
for (int i = 0; i < n; ++i) cin >> R[i]
int maxv = -2000000000; // ???????°??????????????????????????¨????
int minv = R[0];
for (int i = 1; i < n; ++i)
{
maxv = max(maxv, R[i]... | a.cc: In function 'int main()':
a.cc:11:48: error: expected ';' before 'int'
11 | for (int i = 0; i < n; ++i) cin >> R[i]
| ^
| ;
12 |
13 | int maxv = -2000000000; // ???????°?????????????... |
s215150956 | p02258 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
int main() {
ios_base::sync_with_stdio(false);
int n, tmp;
ll max_profit = -1000000000;
vector<ll> R;
cin >> n;
R.resize(n);
for(int i = 0;i < n;i++) {
cin >> R[i];
}
for(int i = 0;i < n;++i) {
fo... | a.cc: In function 'int main()':
a.cc:27:41: error: no matching function for call to 'max(ll&, int&)'
27 | max_profit = max(max_profit, tmp);
| ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/includ... |
s742662879 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
int main(){
int R[MAX], n;
cin >> n;
for ( int i = 0; i < n; i++) cin >> R[i];
int maxv = -2000000000;
int minv = R[0];
for ( int i = 1; i < n; i++ ) {
maxv = max(maxv, R[i] - minv);
manv = min(minv, R[i])... | a.cc: In function 'int main()':
a.cc:17:5: error: 'manv' was not declared in this scope; did you mean 'minv'?
17 | manv = min(minv, R[i]);
| ^~~~
| minv
|
s710945426 | p02258 | C++ | #include <iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
int main(){
int R[Max], n;
cin >> n;
for(int i; i<n;i++) cin>>R[i];
int maxv = -2000000000;
int minv = R[0];
for(int i=1;i<n;i++){
maxv = max(maxv,R[i]-minv);
minv = min(minv,R[i]);
}
cout << maxv << e... | a.cc: In function 'int main()':
a.cc:7:9: error: 'Max' was not declared in this scope; did you mean 'MAX'?
7 | int R[Max], n;
| ^~~
| MAX
a.cc:9:28: error: 'R' was not declared in this scope
9 | for(int i; i<n;i++) cin>>R[i];
| ^
a.cc:12:14: error... |
s176794209 | p02258 | C++ | if __name__ == '__main__':
n = int(input())
lists = list()
for i in range(n):
a = int(input())
lists.append(a)
S = None
while lists:
mini = min(lists)
mini_ind = lists.index(mini)
maxi = max(lists[mini_ind : len(lists)])
T = maxi - mini
if S is None or S < T:
S = T
lists = lists[0 : mini_ind... | a.cc:1:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
1 | if __name__ == '__main__':
| ^~~~~~~~~~
a.cc:1:1: error: expected unqualified-id before 'if'
1 | if __name__ == '__main__':
| ^~
|
s012243777 | p02258 | C++ | #include <iostream>
#include <climits>
#include <algorithm>
using std::cin;
using std::cout;
using std::max;
using std::min;
int main()
{
int n, curr;
int maxv = INT_MAX, minv = INT_MAX;
cin >> n;
for (int i = 0; i < n; ++i)
{
cin >> curr;
minv = min(minv, curr);
maxv = max(maxv, c... | a.cc: In function 'int main()':
a.cc:22:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
22 | cout << maxv << endl;
| ^~~~
| std::endl
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/... |
s353302682 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin>>n;
int a[n];
int i=0;
for(i=0;i<n;i++)
{
cin>>a[i];
}
int maxv=-2000000000;
int minv=a[0];
for(i=0;i<n;i++)
{
maxv=max(maxv,a[i]-minv);
minv=m... | a.cc: In function 'int main()':
a.cc:22:27: error: 'r' was not declared in this scope
22 | minv=min(minv,r[i]);
| ^
|
s709369602 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std:
static const int MAX = 200000;
int main()
{
int R[MAX],n;
cin>>n;
for(int i=0;i<n;i++)
cin>>R[i];
int maxv = -2000000000;
int minv = R[0];
for (int i =1 ;i < n;i++)
{
maxv = max(maxv,R[i]-minv);
minv = min(minv,R[i]);
}
cout<<maxv<<endl;
return 0;
}
| a.cc:3:20: error: expected ';' before ':' token
3 | using namespace std:
| ^
| ;
a.cc:3:20: error: expected unqualified-id before ':' token
a.cc: In function 'int main()':
a.cc:8:7: error: 'MAX' was not declared in this scope
8 | int R[MAX],n;
| ^~~
... |
s551624889 | p02258 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
int R[1000000000]
int max=-200001;
cin>>n;
for(int i=0;i<n;i++) cin>>R[i];
for(int j=0;j<i;j++){
(R[i]-R[j]>max) max=R[i]-R[[j];
}
cout<<max<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:9: error: expected initializer before 'int'
9 | int max=-200001;
| ^~~
a.cc:11:35: error: 'R' was not declared in this scope
11 | for(int i=0;i<n;i++) cin>>R[i];
| ^
a.cc:13:23: error: 'i' was not declare... |
s918153665 | p02258 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
int R[1000000000]
int max=-200001;
cin>>n;
for(int i=0;i<n;i++) cin>>R[i];
for(int i=0;i<n;i++){
for(int j=0;j<i;j++){
(R[i]-R[j]>max) max=R[i]-R[[j];
}
}
cout<<max<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:9: error: expected initializer before 'int'
9 | int max=-200001;
| ^~~
a.cc:11:35: error: 'R' was not declared in this scope
11 | for(int i=0;i<n;i++) cin>>R[i];
| ^
a.cc:15:10: error: 'R' was not declare... |
s806919222 | p02258 | C++ | #include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
int n;
int R[200000];
int max=-1000000000;
cin>>n;
for(int i=0;i<n;i++) cin>>R[i];
for(int i=0;i<n;i++){
for(int j=0;j<i;j++){
if (R[i]-R[j]>max) max=R[i]-R[[j];
}
}
cout<<max... | a.cc: In function 'int main()':
a.cc:19:38: error: two consecutive '[' shall only introduce an attribute before '[' token
19 | if (R[i]-R[j]>max) max=R[i]-R[[j];
| ^
|
s121120048 | p02258 | C++ | #include <iostream>
using namespace std;
int main() {
int n, p;
cin >> n;
int list[n] = {};
int maxim[n] = {};
for (int i = 0; i < n; i++) {
cin >> p;
list[i] = p;
}
int lowest =INT_MAX;
for (int i = 0; i < n - 1; i++) {
int max = INT_MIN;
int maxnum = 0;... | a.cc: In function 'int main()':
a.cc:13:17: error: 'INT_MAX' was not declared in this scope
13 | int lowest =INT_MAX;
| ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include <iostream>
+++ |+#include <c... |
s154640101 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n,Rt,min,max=-200000000000;
cin>>n;
cin>>Rt;
min=Rt
for(int i=1<i<n; i++)
{
cin>>Rt;
if(Rt-min>max)
max=Rt-min;
if(Rt<min)
min=Rt;
}
cout<<max;
system("... | a.cc: In function 'int main()':
a.cc:7:22: warning: overflow in conversion from 'long int' to 'int' changes value from '-200000000000' to '1863462912' [-Woverflow]
7 | int n,Rt,min,max=-200000000000;
| ^~~~~~~~~~~~~
a.cc:10:11: error: expected ';' before 'for'
10 | min=Rt
... |
s893907850 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n,Rt,min,max=-200000000000;
cin>>n;
cin>>Rt;
min=Rt;
for(int i=1<i<n; i++)
{
cin>>Rt;
if(Rt-min>max)
max=Rt-min;
if(Rt<min)
min=Rt;
}
cout<<max;
system("pau... | a.cc: In function 'int main()':
a.cc:7:22: warning: overflow in conversion from 'long int' to 'int' changes value from '-200000000000' to '1863462912' [-Woverflow]
7 | int n,Rt,min,max=-200000000000;
| ^~~~~~~~~~~~~
a.cc:11:25: error: expected ';' before ')' token
11 | for(int ... |
s564210372 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int a, n[200000];
cin >> a;
for(int i = 0; i < n; ++i) {
cin >> n[i];
}
int maxv = -1000000000;
int minv = n[0];
for(int j - 1; j < n; ++j) {
maxv = max(maxv, n[j] - minv);
minv = min(minv, n[j]);
}
cout << maxv <<... | a.cc: In function 'int main()':
a.cc:8:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
8 | for(int i = 0; i < n; ++i) {
| ~~^~~
a.cc:13:12: error: expected ';' before '-' token
13 | for(int j - 1; j < n; ++j) {
| ^~
| ;... |
s326827418 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int a, n[200000];
cin >> a;
for(int i = 0; i < a; ++i) {
cin >> n[i];
}
int maxv = -1000000000;
int minv = n[0];
for(int j - 1; j < a; ++j) {
maxv = max(maxv, n[j] - minv);
minv = min(minv, n[j]);
}
cout << maxv <<... | a.cc: In function 'int main()':
a.cc:13:12: error: expected ';' before '-' token
13 | for(int j - 1; j < a; ++j) {
| ^~
| ;
a.cc:13:23: error: expected ')' before ';' token
13 | for(int j - 1; j < a; ++j) {
| ~ ^
| )
a.cc:... |
s771324973 | p02258 | C++ | // 基本テンプレート
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#inc... | a.cc: In function 'int main()':
a.cc:56:25: error: expected '}' at end of input
56 | int minv = R[0];
| ^
a.cc:48:15: note: to match this '{'
48 | signed main() {
| ^
|
s534192499 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
int main() {
int R[MAX], m;
cin >> n;
for ( int i = 0; i < n; i++ ) cin >> R[i];
int maxv = -2000000000; // 十分小さい値を初期値に設定
int minv = R[0];
for ( int i = 1; i < n; i++ ) { // ここで毎回 R[i] を読み込めば、配列は不要
maxv = ma... | a.cc: In function 'int main()':
a.cc:9:10: error: 'n' was not declared in this scope
9 | cin >> n;
| ^
a.cc:16:29: error: 'imnv' was not declared in this scope; did you mean 'minv'?
16 | maxv = max(maxv, R[i] - imnv); // 最大値を更新
| ^~~~
| ... |
s281347481 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
int main() {
int R[MAX], m;
cin >> n;
for ( int i = 0; i < n; i++ ) cin >> R[i];
int maxv = -2000000000; // 十分小さい値を初期値に設定
int minv = R[0];
for ( int i = 1; i < n; i++ ) { // ここで毎回 R[i] を読み込めば、配列は不要
maxv = ma... | a.cc: In function 'int main()':
a.cc:9:10: error: 'n' was not declared in this scope
9 | cin >> n;
| ^
a.cc:17:27: error: expected ';' before '}' token
17 | minv = min(minv, R[i]) // ここまでの最小値を保持しておく
| ^
| ;
18 | }
| ... |
s132788494 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
static const int MAX=200000;
int main()
{
int R[MAX],n;
cin>>n;
for(int i=0;i<n;i++)cin>>R[i];
int maxv=-20000000;
int minv=R[0];
for(int i=1;i<n;i++)
{
maxv=max(maxv,R[i]-minv);
minv=min(R[i].minv);
}
cout<<maxv<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:15:15: error: request for member 'minv' in 'R[i]', which is of non-class type 'int'
15 | minv=min(R[i].minv);
| ^~~~
|
s779104363 | p02258 | C++ | n = int(input())
r = [int(input()) for i in range(n)]
r_temp_min = r[0]
ans = r[1]-r[0]
for r_i in r[1:]:
if ans < (r_i - r_temp_min):
ans = r_i - r_temp_min
for i,r_i in enumerate(r):
if r_temp_min <= r_i:
continue
ans += t_temp_min - r_i
r_temp_min = r_i
print(ans)
| a.cc:1:1: error: 'n' does not name a type
1 | n = int(input())
| ^
|
s970113685 | p02258 | C++ | n = int(input())
r = [int(input()) for i in range(n)]
r_temp_min = r[0]
ans = r[1]-r[0]
for r_i in r[1:]:
if ans < (r_i - r_temp_min):
ans = r_i - r_temp_min
for i,r_i in enumerate(r):
if r_temp_min <= r_i:
continue
ans += r_temp_min - r_i
r_temp_min = r_i
print(ans)
| a.cc:1:1: error: 'n' does not name a type
1 | n = int(input())
| ^
|
s649491632 | p02258 | C++ | n = int(input())
r = [int(input()) for i in range(n)]
r_temp_min = r[0]
ans = r[1]-r[0]
for r_i in r[1:]:
if ans < (r_i - r_temp_min):
ans = r_i - r_temp_min
for i,r_i in enumerate(r):
if r_temp_min <= r_i:
continue
ans -= r_i - r_temp_min
r_temp_min = r_i
print(ans)
| a.cc:1:1: error: 'n' does not name a type
1 | n = int(input())
| ^
|
s666838496 | p02258 | C++ | n = int(input())
r = [int(input()) for i in range(n)]
r_temp_min = r[0]
ans = r[1]-r[0]
for r_i in r[1:]:
if ans < (r_i - r_temp_min):
ans = r_i - r_temp_min
for r_i in r:
if r_temp_min <= r_i:
continue
ans = ans - r_i + r_temp_min
r_temp_min = r_i
print(ans)
| a.cc:1:1: error: 'n' does not name a type
1 | n = int(input())
| ^
|
s152766166 | p02258 | C++ | #include <iostream>
int main()
{
int number;
std::cin >> number;
int price[number];
for (int i = 0; i < number; i++) {
std::cin >> price;
}
int maximum = price[1] - price[0];
int low_index = 0;
int high_index = 1;
for (int i = 0; i < number; i++) {
if (price[lo... | a.cc: In function 'int main()':
a.cc:10:18: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int [number]')
10 | std::cin >> price;
| ~~~~~~~~ ^~ ~~~~~
| | |
| | int [number]
| ... |
s420005484 | p02258 | C++ | #include <iostream>
int main() {
int n, result=0, f_result=0;
cin >> n;
int num[n];
for(int i=0; i<n; i++) {
cin >> num[i];
}
for(i=0; i<n-1; i++) {
for(int j=i+1; j<n; j++) {
result = num[j] - num[i];
if(i==0 && j==1) {
f_r... | a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
6 | cin >> n;
| ^~~
| 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 ... |
s085170767 | p02258 | C++ | #include <iostream>
using namespace std;
int main() {
int n, result=0, f_result=0;
cin >> n;
int num[n];
for(int i=0; i<n; i++) {
cin >> num[i];
}
for(i=0; i<n-1; i++) {
for(int j=i+1; j<n; j++) {
result = num[j] - num[i];
if(i==0 && j==1) ... | a.cc: In function 'int main()':
a.cc:14:9: error: 'i' was not declared in this scope
14 | for(i=0; i<n-1; i++) {
| ^
|
s265928337 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
#define MAX 1000000000
int main() {
int n, result=MAX*2, minnum=0;
cin >> n;
int num[n];
for(int i=0; i<n; i++) {
cin >> num[i];
}
minnum = num[0];
for(int i=0; i<n; i++) {
min = min(minnum, nu... | a.cc: In function 'int main()':
a.cc:19:33: error: overloaded function with no contextual type information
19 | min = min(minnum, num[i]);
| ^
a.cc:20:33: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator-'
20 | ... |
s329642045 | p02258 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
#define MAX 1000000000
int main() {
int n, result=MAX*2, m=0;
cin >> n;
int num[n];
for(int i=0; i<n; i++) {
cin >> num[i];
}
m = num[0];
for(int i=0; i<n; i++) {
m = min(m, num[i]);
re... | a.cc: In function 'int main()':
a.cc:20:21: error: no matching function for call to 'max(<unresolved overloaded function type>, int)'
20 | result = max(max, num[i]-m);
| ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bi... |
s388715903 | p02258 | C++ | #include <iostream>
#include <limits>
int main()
{
unsigned int n = 0;
int min = std::numeric_limits<int>::max();
int max_gap = std::numeric_limits<int>::min();
std::cin >> n;
unsinged int R = 0;
for (unsigned int i = 0; i < n; i++)
{
std::cin >> R;
if (R - min > max_gap){ max_gap = R - min; }
if (R < m... | a.cc: In function 'int main()':
a.cc:12:9: error: 'unsinged' was not declared in this scope; did you mean 'unsigned'?
12 | unsinged int R = 0;
| ^~~~~~~~
| unsigned
a.cc:15:29: error: 'R' was not declared in this scope
15 | std::cin >> R;
| ... |
s661520141 | p02258 | C++ | #include<algorithm>
#include<iostream>
using namespace std;
static const int MAX = 200000;
int main{
int R[MAX], n;
cin >> n;
for (int i = 0; i < n; i++) cin >> R[i];
// Initial value of maximum profit and minimum value
int maxp = -1000000000;
int minv = 0;
for (int i = 0; i < n; i++){
maxp = max(... | a.cc:6:5: error: cannot declare '::main' to be a global variable
6 | int main{
| ^~~~
a.cc:7:3: error: expected primary-expression before 'int'
7 | int R[MAX], n;
| ^~~
a.cc:7:3: error: expected '}' before 'int'
a.cc:6:9: note: to match this '{'
6 | int main{
| ^
a.cc:9:3: ... |
s265038467 | p02258 | C++ | int c_2_5() {
//string s;
int n;
cin >> n;
// int price[n];
vector<int> price(n);
REPEAT(i, n) {
cin >> price[i];
}
int maxPrice[n];
int currentMaxPrice;
currentMaxPrice = 0; // or -infinite
for (int i = n - 1; i >= 0; i--) {
if (price[i] > currentMaxPrice) {
currentMaxPrice = price[i];
}
maxPrice... | a.cc: In function 'int c_2_5()':
a.cc:4:9: error: 'cin' was not declared in this scope
4 | cin >> n;
| ^~~
a.cc:6:9: error: 'vector' was not declared in this scope
6 | vector<int> price(n);
| ^~~~~~
a.cc:6:16: error: expected primary-expression before 'int'
6 | ... |
s218464595 | p02258 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int data[200000],n;
cin >> n;
//vector<int> data = {25,36,4,55,71,18,30,71,89,65,34,56,23,12,45,79};
//cin >> n;
int i;
for (i=0;i<n;i++) cin >> data[i];
vector<int> maxp = {};
int lmin = dat... | a.cc: In function 'int main()':
a.cc:35:20: error: no match for 'operator<<' (operand types are 'std::basic_ostream<char>' and '<unresolved overloaded function type>')
35 | cout << -1 << end;
| ~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/iostream:41,
from a.cc:1... |
s154353008 | p02258 | C++ | #include<iostream>
using namespace std:
static const int MAX = 200000
int main(){
int n, R[MAX];
int min, max;
int max_diff=0;
bool min_flag = false;
int diff;
cin >> n ;
for(int t=0; t<n; t++){
cin >> R[t];
if(t==0){
min = R[t];
max = R[t];
}
else if (t==1){
max_diff = R[t] - R[t-1];
}
else{
if(R[t] < min){
... | a.cc:2:20: error: expected ';' before ':' token
2 | using namespace std:
| ^
| ;
a.cc:2:20: error: expected unqualified-id before ':' token
|
s424887352 | p02258 | C++ | #include<iostream>
using namespace std:
static const int MAX = 200000
int main(){
int n, R[MAX];
int min, max;
int max_diff=0;
bool min_flag = false;
int diff;
cin >> n ;
for(int t=0; t<n; t++){
cin >> R[t];
if(t==0){
min = R[t];
max = R[t];
}
else if (t==1){
max_diff = R[t] - R[t-1];
}
else{
if(R... | a.cc:2:20: error: expected ';' before ':' token
2 | using namespace std:
| ^
| ;
a.cc:2:20: error: expected unqualified-id before ':' token
|
s247822671 | p02258 | C++ | #include<iostream>
using namespace std:
static const int MAX = 200000
int main(){
int n, R[MAX];
int min, max;
int max_diff=0;
bool min_flag = false;
int diff;
cin >> n ;
for(int t=0; t<n; t++){
cin >> R[t];
if(t==0){
min = R[t];
max = R[t];
}
else if (t==1){
max_diff = R[t] - R[t-1];
}
else{
if(R... | a.cc:2:20: error: expected ';' before ':' token
2 | using namespace std:
| ^
| ;
a.cc:2:20: error: expected unqualified-id before ':' token
|
s184114637 | p02258 | C++ | #include<iostream>
using namespace std;
static const int MAX = 200000;
int main(){
int n, R[MAX];
int min, max;
int max_diff=0;
bool min_flag = false;
int diff;
cin >> n ;
for(int t=0; t<n; t++){
cin >> R[t];
if(t==0){
min = R[t];
max = R[t];
}
else if (t==1){
max_diff = R[t] - R[t-1];
if (R[t] < R[t-1]... | a.cc: In function 'int main()':
a.cc:44:2: error: expected '}' at end of input
44 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s142519497 | p02258 | C++ | #include<iostream>
using namespace std;
static const int MAX = 200000;
int main(){
int n, R[MAX];
int min, max;
int max_diff=0;
bool min_flag = false;
int diff;
cin >> n ;
for(int t=0; t<n; t++){
cin >> R[t];
if(t==0){
min = R[t];
max = R[t];
}
else if (t==1){
max_diff = R[t] - R[t-1];
if (R[t] < R[t... | a.cc: In function 'int main()':
a.cc:27:20: error: expected ')' before ';' token
27 | min_flag = false;
| ^
| )
a.cc:26:9: note: to match this '('
26 | else (
| ^
|
s268602541 | p02258 | C++ | #include<iostream>
using namespace std;
static const int MAX = 200000;
int main(){
int n, R[MAX];
int min, max;
int max_diff=0;
bool min_flag = false;
int diff;
cin >> n ;
for(int t=0; t<n; t++){
cin >> R[t];
if(t==0){
min = R[t];
max = R[t];
}
else if (t==1){
max_diff = R[t] - R[t-1];
if (R[t] < R[t... | a.cc: In function 'int main()':
a.cc:27:20: error: expected ')' before ';' token
27 | min_flag = false;
| ^
| )
a.cc:26:9: note: to match this '('
26 | else (
| ^
a.cc:31:7: error: 't' was not declared in this scope
31 | if(R[t] < min){
... |
s172550243 | p02258 | C++ | #include<iostream>
using namespace std;
static const int MAX = 200000;
int main(){
int n, R[MAX];
int min, max;
int max_diff=0;
bool min_flag = false;
int diff;
cin >> n ;
for(int t=0; t<n; t++){
cin >> R[t];
if(t==0){
min = R[t];
max = R[t];
}
else if (t==1){
max_diff = R[t] - R[t-1];
if (R[t] < R[t... | a.cc: In function 'int main()':
a.cc:48:25: error: expected ';' before '}' token
48 | cout << max_diff << endl
| ^
| ;
49 | }
| ~
|
s508532117 | p02258 | C++ | #include<iostream>
using namespace std;
static const int MAX = 200000;
int main(){
int n, R[MAX];
int min, max;
int max_diff=0;
bool min_flag = false;
int diff;
cin >> n ;
for(int t=0; t<n; t++){
cin >> R[t];
if(t==0){
min = R[t];
max = R[t];
}
else if (t==1){
max_diff = R[t] - R[t-1];
if (R[t] < R[t... | a.cc: In function 'int main()':
a.cc:50:9: error: expected ';' before '}' token
50 | return 0
| ^
| ;
51 | }
| ~
|
s529829948 | p02258 | C++ | #include <algorithm>
#include <vector>
#include <random>
using namespace std;
int main()
{
long int max = -1000000000;
long int Ri;
long int Rj;
int loop;
cin >> loop;
cin >> Ri;
cout << "loop : " << loop << endl;
for (int i = 0; i < loop - 1; i++) {
cin >> Rj;
if (max < Rj - Ri) {
max = Rj - Ri;
}
... | a.cc: In function 'int main()':
a.cc:13:9: error: 'cin' was not declared in this scope
13 | cin >> loop;
| ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
3 | #include <random>
+++ |+#include <iostream>
4 | usi... |
s655423112 | p02258 | C++ | #include<iostream>
#include<string>
using namespace std;
void main() {
int *arr;
int n;
cin >> n;
arr = (int *)malloc(sizeof(int)*n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int maxv = arr[1] - arr[0];
for (int i = 2; i < n; i++) {
for (int j = 0; j < i; j++) {
if (arr[i] - arr[j] > maxv)
maxv... | a.cc:4:1: error: '::main' must return 'int'
4 | void main() {
| ^~~~
|
s163553854 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
void main() {
int R[MAX], n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> R[i];
}
int maxv = -2000000000;
int minv = R[0];
for (int i = 1; i < n; i++) {
maxv = max(maxv, R[i] - minv);
minv = min(minv, R[i]);
}
co... | a.cc:5:1: error: '::main' must return 'int'
5 | void main() {
| ^~~~
|
s659659410 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;
void main() {
int R[MAX], n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> R[i];
}
int maxv = -2000000000;
int minv = R[0];
for (int i = 1; i < n; i++) {
maxv = max(maxv, R[i] - minv);
minv = min(minv, R[i]);
}
co... | a.cc:5:1: error: '::main' must return 'int'
5 | void main() {
| ^~~~
|
s727972567 | p02258 | C++ | #include <stdio.h>
#include <iostream>
using namespace std;
int main (void)
{
int n;
long long a=1000000000,b=0;
int c;
int count=0,ans=0;
cin>>n;
int r[n];
for(int i=0;i<n;i++)
cin>>r[i];
for(int i=0;i<n;i++){
if(a>=r[i]){
a=r[i];
count=i;
}
}
if(count != n-1){
for(int j=count;j<n-1;j++){
if(b<=r[... | a.cc:39:5: error: 'javascript' does not name a type
39 | javascript:void(0)
| ^~~~~~~~~~
|
s211910038 | p02258 | C++ | #include <stdio.h>
#include <iostream>
using namespace std;
int main (void)
{
int n;
long long a=1000000000,b=0;
int c;
int count=0,ans=0;
cin>>n;
int r[n];
for(int i=0;i<n;i++)
cin>>r[i];
for(int i=0;i<n;i++){
if(a>=r[i]){
a=r[i];
count=i;
}
}
if(count != n-1){
for(int j=count;j<n-1;j++){
if(b<=r[... | a.cc:39:5: error: 'javascript' does not name a type
39 | javascript:void(0)
| ^~~~~~~~~~
|
s883279015 | p02258 | C++ | #include <vector>
int main(int argc, char* argv[])
{
int idx = 0;
int min = argv[2];
int price = 0;
int maxProfit = 0;
for (idx = 0; idx < argv[1]; idx++) {
price = argv[2+idx];
if (min > price) {
min = price;
}
maxProfit = price - min;
}
return maxProfit;
}
| a.cc: In function 'int main(int, char**)':
a.cc:6:18: error: invalid conversion from 'char*' to 'int' [-fpermissive]
6 | int min = argv[2];
| ~~~~~~^
| |
| char*
a.cc:10:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
... |
s811389412 | p02258 | C++ | #include <vector>
int main(int argc, char* argv[])
{
int idx = 0;
int min = std::stoi(argv[2]);
int price = 0;
int maxProfit = 0;
for (idx = 0; idx < argv[1]; idx++) {
price = std::stoi(argv[2+idx]);
if (min > price) {
min = price;
}
maxProfit = price - min;
}
return maxProfit;
}
| a.cc: In function 'int main(int, char**)':
a.cc:6:17: error: 'stoi' is not a member of 'std'
6 | int min = std::stoi(argv[2]);
| ^~~~
a.cc:2:1: note: 'std::stoi' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
1 | #include <vector>
+++ |+#include ... |
s932036719 | p02258 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int temp = 0;
int n = 0;
cin >> n;
int minv = 0;
int maxv = -1.01 * RMAX;
for(int i = 0 ; i < n ; i++)
{
cin >> temp;
if(i == 0)
{
minv = temp;
}
else
{
maxv = max(maxv, temp - minv);
minv = min(m... | a.cc: In function 'int main()':
a.cc:12:24: error: 'RMAX' was not declared in this scope
12 | int maxv = -1.01 * RMAX;
| ^~~~
|
s797081647 | p02258 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int R[200000];
for(int i=0;i<n;i++)
cin >> R[i];
int min=R[0],maxv=R[0];
for(int i=1;i<n;i++){
maxv=max(maxv,maxv-R[i]);
minv=min(minv,R[i]);
}
cout << maxv << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:5: error: 'minv' was not declared in this scope; did you mean 'min'?
12 | minv=min(minv,R[i]);
| ^~~~
| min
a.cc:12:13: error: 'min' cannot be used as a function
12 | minv=min(minv,R[i]);
| ~~~^~~~~~~~~~~
|
s970527194 | p02258 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int R[200000];
for(int i=0;i<n;i++)
cin >> R[i];
int min=R[0],maxv=R[0];
for(int i=1;i<n;i++){
maxv=max(maxv,maxv-R[i]);
minv=min(minv,R[i]);
}
cout << maxv << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:5: error: 'minv' was not declared in this scope; did you mean 'min'?
12 | minv=min(minv,R[i]);
| ^~~~
| min
a.cc:12:13: error: 'min' cannot be used as a function
12 | minv=min(minv,R[i]);
| ~~~^~~~~~~~~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.