submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3
values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s092507239 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
//long long
using ll = long long;
//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
// begin() en... | a.cc: In function 'int main()':
a.cc:38:13: error: expected ';' before 'vector'
38 | cin >> n
| ^
| ;
39 | vector<int> a(n);
| ~~~~~~
a.cc:40:22: error: 'a' was not declared in this scope
40 | REP(i, n) cin >> a[i];
| ^
a.c... |
s209778081 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(N);
for(int i = 0; i < N; i++){
cin >> a[i];
}
long long sum = 0;
long long ans = 0;
for(int i = 0; i < N; i++){
sum += a[i];
if(i % 2 == 0){
if(sum < 0){
... | a.cc: In function 'int main()':
a.cc:7:19: error: 'N' was not declared in this scope
7 | vector<int> a(N);
| ^
|
s831566189 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> a(n);
for (int i=0; i<n; i++) cin >> a[i];
int odd = 0; even = 0; sum = 0;
for (int i=0; i<n; i++){
sum += a[i];
if(i%2==0&&sum<=0){
odd += abs(sum)+1;
sum = +1;
}
else if(i%2==1&&sum... | a.cc: In function 'int main()':
a.cc:11:16: error: 'even' was not declared in this scope
11 | int odd = 0; even = 0; sum = 0;
| ^~~~
a.cc:11:26: error: 'sum' was not declared in this scope
11 | int odd = 0; even = 0; sum = 0;
| ^~~
|
s965276594 | p03739 | C++ | #include<bits/stdc++.h>
using namespace std;
#define ll long long;
LL ans1,ans2,sum;
int n;
int a[100010];
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
sum=0;
for(int i=1,s=1;i<=n;i++,s*=-1){
sum+=a[i];
if(sum*s<=0) ans1+=abs(sum-s),sum=s;
}
sum=0;
for(int i=1,s=-1;i<=n;i++,s*=-1){
... | a.cc:4:1: error: 'LL' does not name a type; did you mean 'll'?
4 | LL ans1,ans2,sum;
| ^~
| ll
a.cc: In function 'int main()':
a.cc:11:9: error: 'sum' was not declared in this scope
11 | sum=0;
| ^~~
a.cc:14:30: error: 'ans1' was not declared in this scope
14 | ... |
s925298641 | p03739 | C++ | #include <bits/stdc++.h>
#define int ll
#define abs(x) llabs((x))
using namespace std;
typedef long long ll;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
int count=0;
int ans=0;
for(int i=0;i<n;i++){
count+=a[i];
if(i%2==0){
... | a.cc:2:13: error: '::main' must return 'int'
2 | #define int ll
| ^~
a.cc:7:1: note: in expansion of macro 'int'
7 | int main()
| ^~~
|
s400580488 | p03739 | C++ | #include <iostream>
#include <math.h>
//#include <numeric>
#include <vector>
//#include <map>
#include <algorithm>
using namespace std;
#define n_max 100000
#define N_max 100
#define rep(i, a, n) for(int i = a; i < n; i++)
#define rrep(i, a, n) for(int i = a; i > n; i--)
#define lrep(i, a, n) for(long int i = a; i < ... | a.cc: In function 'int main()':
a.cc:68:21: error: 'tmp1' was not declared in this scope; did you mean 'tmp2'?
68 | cout << min(tmp1, tmp2) << endl;
| ^~~~
| tmp2
|
s081296645 | p03739 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long long N,sum,ans,ans2;
cin>>N;
sum=0;
vector<long long>x(N);
for(int i=0;i<N;i++){
cin>>x[i];
}
for(int i=0;i<N;i++){
sum+=x[i];
if(i%2==0&&sum<=0){
ans+=1-sum;
sum=1;
}
if(i%2==1&&sum>=0){
ans+=1+sum;
... | a.cc: In function 'int main()':
a.cc:38:21: error: 'sum2' was not declared in this scope; did you mean 'sum'?
38 | cout<<min(sum,sum2)<<endl;
| ^~~~
| sum
|
s280008744 | p03739 | C++ | #include <iostream>
#include <vector>
#include <cmath>
int main(void) {
// in
int n;
std::cin >> n;
std::vector<long long> a(n);
for(int i = 0; i < n; ++i) std::cin >> a[i];
// sum
int cost_all = 0;
std::vector<long long> s(n, 0);
for(int k = 0; k < 2; ++k) {
int cost = 0;
if(k == 0) {
s[0] = (a[0] ... | a.cc: In function 'int main()':
a.cc:49:22: error: 'cost' was not declared in this scope; did you mean 'cosl'?
49 | std::cout << cost << std::endl;
| ^~~~
| cosl
|
s655056600 | p03739 | C++ | #include <iostream>
#include <vector>
using namespace std;
#define int long long
int main() {
int N; cin >> N;
vector<int> S(N + 1);
S[0] = 0;
for (int i = 1; i <= N; ++i) {
cin >> S[i];
S[i] += S[i - 1];
}
int ians = (1 << 30);
for (int j = -1; j <= 1; j += 2) {
... | cc1plus: error: '::main' must return 'int'
|
s151491315 | p03739 | C++ | // AtCoder-Template.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include <iostream>
#include <algorithm>
#include <bitset>
#include <bits/stdc+++.h>
using namespace std;
using ll = long long;
#define FOR(i,N) for(auto i=0; i<N; ++i)
/* clang-format off */
template <class T> inline void chmin(T& a, co... | a.cc:7:10: fatal error: bits/stdc+++.h: No such file or directory
7 | #include <bits/stdc+++.h>
| ^~~~~~~~~~~~~~~~
compilation terminated.
|
s498141669 | p03739 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main(){
int n;cin>>n;
int a[n];
for(int i = 0; n > i; i++)cin>>a[i];
long long sh = 0;
long long nw = 0;
for(int i = 0; n > i; i++){
(long long)nw += a[i];
if(i % 2 == 0)if(nw<=0)(long long)sh += 1-nw,nw=1;
if(i % 2 == 1)if(nw>=0)(lon... | a.cc: In function 'int main()':
a.cc:11:5: error: lvalue required as left operand of assignment
11 | (long long)nw += a[i];
| ^~~~~~~~~~~~~
a.cc:12:28: error: lvalue required as left operand of assignment
12 | if(i % 2 == 0)if(nw<=0)(long long)sh += 1-nw,nw=1;
| ... |
s435550792 | p03739 | C++ | #include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define pii pair<int, int>
#define read_input freopen("in.txt","r", stdin)
#define print_output freopen("out.txt","w", stdout)
typedef long long ll;
typedef long double ld;
using namespace std;
int sign(int x) {
if(x > 0) return 1;
... | a.cc: In function 'int main()':
a.cc:37:26: error: no matching function for call to 'min(int, ll&)'
37 | if(not s) x = min(-1, x);
| ~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
... |
s082645750 | p03739 | C++ | #include <iostream>
#define T true
#define F false
using namespace std;
int main(void) {
int num, i = 1, a;
long long sum, ans = 0;
bool sig = T;
cin >> num >> sum;
if (sum < 0)
sig = F;
for (; i < num; i++) {
scanf_s("%d", &a);
if (sum == 0) {
if (a >= 0) {
sum--;
sig = F;
}
else
sum... | a.cc: In function 'int main()':
a.cc:15:17: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
15 | scanf_s("%d", &a);
| ^~~~~~~
| scanf
|
s235261323 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long> A(n, 0);
for (int i = 0; i<n; i++) cin >> A[i];
long long cnt1=0, acm1=0, cnt2=0, acm2=0;
for(int i = 0; i<n; i++) {
acm1+=A[i];
acm2+=A[i];
if(i%2) {
if(acm1>0);
else {
cnt1 += abs... | a.cc: In function 'int main()':
a.cc:39:2: error: expected '}' at end of input
39 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s003099129 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long> A(n, 0);
for (int i = 0; i<n; i++) cin >> A[i];
long long cnt1=0, acm1=0, cnt2=0, acm2=0;
for(int i = 0; i<n; i++) {
acm1+=A[i];
acm2+=A[i];
if(i%2) {
if(acm1>0);
else {
cnt1 += abs... | a.cc: In function 'int main()':
a.cc:24:5: error: expected '}' before 'else'
24 | else {
| ^~~~
a.cc:13:13: note: to match this '{'
13 | if(i%2) {
| ^
a.cc:38:2: error: expected '}' at end of input
38 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
... |
s962771706 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, ans;
cin >> n;
int A[n];
for (int i = 0; i<n; i++) cin >> A[i];
int cnt=0, acm=0, ans=0;
for(int i = 0; i<n; i++) {
if(i%2) {
if(acm+A[i]>0) acm+=A[i];
else {
cnt += abs(acm+A[i]) + 1;
acm = 1;
}
}
... | a.cc: In function 'int main()':
a.cc:9:21: error: redeclaration of 'int ans'
9 | int cnt=0, acm=0, ans=0;
| ^~~
a.cc:5:10: note: 'int ans' previously declared here
5 | int n, ans;
| ^~~
|
s269566266 | p03739 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main(){
int N;
cin >> N;
vector<long long int> A(N);
for(int i = 0; i < N; i++) cin >> A[i];
long long unsigned int cnt, cnt1 ,cnt2 = 0;
long long unsigned int M = 0;
M = A[0];
for(int i = 1 ; i... | a.cc: In function 'int main()':
a.cc:21:18: error: call of overloaded 'abs(long long unsigned int)' is ambiguous
21 | cnt1 += abs(1 - M);
| ~~~^~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
... |
s312060938 | p03739 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main(){
int N;
cin >> N;
vector<long long int> A(N);
for(int i = 0; i < N; i++) cin >> A[i];
long long unsigned int cnt, cnt1 ,cnt2 = 0;
long long unsigned int M = 0;
M = A[0];
for(int i = 1 ; i... | a.cc: In function 'int main()':
a.cc:21:18: error: call of overloaded 'abs(long long unsigned int)' is ambiguous
21 | cnt1 += abs(1 - M);
| ~~~^~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
... |
s460516986 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
long zero = 0;
int N;
cin >> N;
vector<int> sum(N,0);
int now;
cin >> now;
sum[0] = now;
for (int i=1; i<N; i++) {
cin >> now;
sum[i] = sum[i-1] + now;
}
long change = 0;
long ansp = 0;
int i = 0;
while (i<N) {
ansp += ... | a.cc: In function 'int main()':
a.cc:42:42: error: expected ';' before 'i'
42 | change += max(1-(sum[i]+change),zero)
| ^
| ;
43 | i++;
| ~
|
s528616735 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
long zero = 0;
int N;
cin >> N;
vector<int> sum(N,0);
int now;
cin >> now;
sum[0] = now;
for (int i=1; i<N; i++) {
cin >> now;
sum[i] = sum[i-1] + now;
}
long change = 0;
long ansp = 0;
int i = 0;
while (i<N) {
ansp += ... | a.cc: In function 'int main()':
a.cc:21:16: error: no matching function for call to 'max(long int, int)'
21 | ansp += max(1-(sum[i]+change),0);
| ~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc... |
s355914894 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> sum(N,0);
int now;
cin >> now;
sum[0] = now;
for (int i=1; i<N; i++) {
cin >> now;
sum[i] = sum[i-1] + now;
}
long change = 0;
long ansp = 0;
int i = 0;
while (i<N) {
ansp += max(1-(sum[i]+cha... | a.cc: In function 'int main()':
a.cc:20:16: error: no matching function for call to 'max(long int, int)'
20 | ansp += max(1-(sum[i]+change),0);
| ~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc... |
s459200573 | p03739 | C++ | #include <cstdio>
#include <iostream>
#define ll long long
const int MAXN = 1e5 + 7;
const ll Inf = 1ll << 60;
using namespace std;
ll a[MAXN];
ll sum, ans = INF, res, n;
int main() {
bool flag = 0;
cin>>n;
for(int i = 1; i <= n; i++)
cin>>a[i];
for(int i = 1; i <= n; i++) {
sum += a[i];
if(!flag) { // i... | a.cc:9:15: error: 'INF' was not declared in this scope; did you mean 'Inf'?
9 | ll sum, ans = INF, res, n;
| ^~~
| Inf
a.cc: In function 'int main()':
a.cc:13:14: error: 'n' was not declared in this scope
13 | cin>>n;
| ^
a.cc:21:33: error: 'res'... |
s962686586 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> a(N);
for (int i=0; i<N; i++) {
cin >> a.at(i);
}
int ans1 = 0, ans2 = 0, sum1 = 0, sum2 = 0;
for (int i=0; i<N; i++) {
sum1 += a.at(i);
if (i%2 == 0 && sum <= 0) {
an... | a.cc: In function 'int main()':
a.cc:14:25: error: 'sum' was not declared in this scope; did you mean 'sum2'?
14 | if (i%2 == 0 && sum <= 0) {
| ^~~
| sum2
a.cc:25:25: error: 'sum' was not declared in this scope; did you mean 'sum2'?
25 | ... |
s391183419 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> a(N);
for (int i=0; i<N; i++) {
cin >> a.at(i);
}
int ans1 = 0, ans2 = 0, sum1 = 0, sum2 = 0;
for (int i=0; i<N; i++) {
sum += a.at(i);
if (i%2 == 0 && sum <= 0) {
ans... | a.cc: In function 'int main()':
a.cc:13:9: error: 'sum' was not declared in this scope; did you mean 'sum2'?
13 | sum += a.at(i);
| ^~~
| sum2
a.cc:24:9: error: 'sum' was not declared in this scope; did you mean 'sum2'?
24 | sum += a.at(i);
| ^~~
| ... |
s620697140 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<int> a(N);
for (int i=0; i<N; i++) {
cin >> a.at(i);
}
int ans1 = 0, ans2 = 0; sum = 0;
for (int i=0; i<N; i++) {
sum += a.at(i);
if (i%2 == 0 and sum <= 0) {
ans1 += -sum+... | a.cc: In function 'int main()':
a.cc:11:29: error: 'sum' was not declared in this scope
11 | int ans1 = 0, ans2 = 0; sum = 0;
| ^~~
|
s449197702 | p03739 | C++ | #include <iostream>
#include <algorithm>
#include <string>
#define int long long
using namespace std;
int main() {
int n;
int A[100001];
cin >> n;
for(int i = 0; i < n; i++) {
cin >> A[i];
}
int sum = 0;
int counter = 0;
// 偶数番目が正
for(int i = 0; i < n; i++) {
sum += A[i];
if(i % 2 == 0)... | cc1plus: error: '::main' must return 'int'
|
s060704035 | p03739 | C++ | #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define int long long
int main() {
int n;
int A[100001];
cin >> n;
for(int i = 0; i < n; i++) {
cin >> A[i];
}
int sum = 0;
int counter = 0;
// 偶数番目が正
for(int i = 0; i < n; i++) {
sum += A[i];
if(i % 2 == 0)... | cc1plus: error: '::main' must return 'int'
|
s499948199 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define llong long long int
#define ullong unsigned long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
int main (int argc, char *argv[]) {
cin.tie(0);
ios::sync_with_stdio(false);
int n, a[100001];
cin >> n;
rep(i, ... | a.cc: In function 'int main(int, char**)':
a.cc:29:24: error: 's' was not declared in this scope
29 | sum_a = -1;s
| ^
|
s782323627 | p03739 | C++ | #include "bits/stdc++.h"
#define readInt(x) scanf_s("%d", &x)
#define readStr(x) scanf("%s", x)
#define rep(i, n) for(int i=0; i<(n); ++i)
#define chmax(x, y) (x > (y) ? x : x = (y))
#define chmin(x, y) (x < (y) ? x : x = (y))
#define write(x) cout << (x) << endl
using namespace std;
typedef long long ll;
typedef unsig... | a.cc: In function 'int main()':
a.cc:2:20: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
2 | #define readInt(x) scanf_s("%d", &x)
| ^~~~~~~
a.cc:19:5: note: in expansion of macro 'readInt'
19 | readInt(n);
| ^~~~~~~
|
s786918566 | p03739 | C++ | #include <bits/stdc++.h>
#define INF (1<<31) - 1 //INT_MAX/2
#define MOD 1000000007
#define PI acos(-1)
using ll = long long;
using ull = unsigned long long;
int main(int argc, char *argv[])
{
int n;
std::cin >> n;
std::vector<int> a(n);
for (int i = 0; i < n; i++) {
std::cin >> a[i];
... | a.cc: In function 'int main(int, char**)':
a.cc:22:25: error: 'N' was not declared in this scope
22 | for (int i = 0; i < N; i++) {
| ^
a.cc:26:17: error: 'sum' was not declared in this scope; did you mean 'sum1'?
26 | if (sum <= 0) {
| ^~~
... |
s849650034 | p03739 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <cmath>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl
//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariabl... | a.cc: In function 'int main()':
a.cc:47:13: error: expected primary-expression before 'long'
47 | cout << long long min(solve(1), solve(-1)) << endl;
| ^~~~
|
s927865618 | p03739 | C++ | #include<iostream>
#include<algorithm>
typedef long long lint;
using namespace std;
int main()
{
int n;
lint A[100010]={};
bool flag=false;
lint tmp,sum;
lint ans[]={0,0};
cin >> n;
for(int i=0;i<n;i++)
cin >> A[i];
if(A[0]==0)
{
flag=true;
A[0]=1;
ans[0]++;
}
tmp=0,sum=0;
for(int i=0;i<n;i++)
... | a.cc: In function 'int main()':
a.cc:53:35: error: 'elseA' was not declared in this scope
53 | if(A[0]>0)A[0]=-1;elseA[0]=1;
| ^~~~~
|
s521264896 | p03739 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
#include <string.h>
#include <bitset>
#include <map>
#include <climits>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> an(n);
for (int i = 0; i < n; ++i)
{
cin >> an[i];
}
... | a.cc: In function 'int main()':
a.cc:50:13: error: 'assert' was not declared in this scope
50 | assert(new_sign == -sign);
| ^~~~~~
a.cc:10:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
9 | #include <climits>
+++ |+#inc... |
s357236683 | p03739 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <string>
#include <string.h>
#include <bitset>
#include <map>
#include <climits>
using namespace std;
int main()
{
int n;
cin >> n;
vector<int> an(n);
for (int i = 0; i < n; ++i)
{
cin >> an[i];
}
... | a.cc: In function 'int main()':
a.cc:54:13: error: 'assert' was not declared in this scope
54 | assert(new_sign == -sign);
| ^~~~~~
a.cc:10:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
9 | #include <climits>
+++ |+#inc... |
s045908362 | p03739 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
long n;
cin >> n;
long a[n],sum = 0;
for(long i = 0;i < n;i++){
cin >> a[i];
}
long kekka = 0;
for(long i = 0;i < n;i++){
sum += a[i];
if(i % 2 == 0 && sum >= 0){
kekkka += sum + 1;
sum = -1;
}
if(i % 2 == 1 && sum <... | a.cc: In function 'int main()':
a.cc:15:7: error: 'kekkka' was not declared in this scope; did you mean 'kekka'?
15 | kekkka += sum + 1;
| ^~~~~~
| kekka
|
s472725288 | p03739 | C++ | #include<bits/stdc++.h>
using namespace std
const int MAX_N = 1e5;
int N, a[MAX_N+5];
int solve(int next){
int s = 0, cnt = 0;
for(int i=0;i<N;i++){
s += a[i];
if(next==1 && s<=0){
cnt += next - s; s = 1;
}else if(next==-1 && s>=0){
cnt += s - next; s = -1;
}
next *= -1;
}
r... | a.cc:2:20: error: expected ';' before 'const'
2 | using namespace std
| ^
| ;
3 |
4 | const int MAX_N = 1e5;
| ~~~~~
|
s160731978 | p03739 | C++ |
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#include <queue>
using namespace std;
int main(){
int n;
cin >> n;
int64_t sum = 0;
vector<int64_t> arr;
for (int i = 0; i < n; ++i) {
int64_t ai;
cin >> ai;
sum += ai;
arr.push_back(sum);
}
in... | a.cc: In function 'int main()':
a.cc:28:34: error: no matching function for call to 'max(long long int, __gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type)'
28 | b1 += max(0LL, 1 - arr[i]-s1);
| ~~~^~~~~~~~~~~~~~~~~~~~
In file include... |
s368044228 | p03739 | C++ | #include<bits/stdc++.h>
int main(){
int n,chk;
long long ans=0;
scanf("%d %d",&n,&m);
vector<int> a(n);
for (auto&e:a) scanf("%d"&e);
chk=a[0];
for (int i=1;i<n;i++) {
if (i%2) {
chk+=a[i];
if (chk>=0) {
ans+=chk+1;
chk=-1;
... | a.cc: In function 'int main()':
a.cc:6:23: error: 'm' was not declared in this scope
6 | scanf("%d %d",&n,&m);
| ^
a.cc:7:5: error: 'vector' was not declared in this scope
7 | vector<int> a(n);
| ^~~~~~
a.cc:7:5: note: suggested alternatives:
In file included from /... |
s595197106 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
typedef long long ll;
int main(){
int n;
cin >> n;
vector<in... | a.cc: In function 'int main()':
a.cc:59:14: error: no matching function for call to 'min(ll&, int&)'
59 | res = min(res,res1);
| ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from... |
s901809520 | p03739 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int N;
cin >> N;
vector<int> a(N);
for (int i = 0; i < N; i++) {
cin >> a[i];
}
ll ans = 0;
while (ans < N && a[ans] == 0) ans++;
ll sum;
if (ans == 0) sum = a[0];
else if (ans < N && a[ans + 1] > 0) sum = -1;
else sum... | a.cc: In function 'int main()':
a.cc:15:3: error: 'll' was not declared in this scope
15 | ll ans = 0;
| ^~
a.cc:16:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
16 | while (ans < N && a[ans] == 0) ans++;
| ^~~
| abs
a.cc:18:5: error: expected ';' b... |
s762128932 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
ll n, ans = 1ll << 60;
ll a[maxx];
int main() {
cin >> n;
for(int i = 1; i <= n; i++) cin >> a[i];
int flag = 0;
LL sum = 0;
LL res = 0;
for(int i = 1; i <= n; i++) {
sum += a[i];
if(flag == 0){
if(sum <= 0) {
... | a.cc: In function 'int main()':
a.cc:12:9: error: 'LL' was not declared in this scope; did you mean 'll'?
12 | LL sum = 0;
| ^~
| ll
a.cc:13:11: error: expected ';' before 'res'
13 | LL res = 0;
| ^~~~
| ;
a.cc:15:17: error: 'sum' was not... |
s918938696 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
long long s1,s2,c1,c2,a;
for(int i=1; i <= n; i++){
cin >> a;
s1 += a;
s2 += a;
if(i % 2){ //奇数桁目
if (s1 <= 0) c1 += 1 - s1,s1 = 1; //総和が負
if (s2 >= 0) c2 += 1 + s2,s2 = -1; //総... | a.cc:10:19: error: extended character is not valid in an identifier
10 | if(i % 2){ //奇数桁目
| ^
a.cc:14:15: error: extended character is not valid in an identifier
14 | else { //偶数桁目
| ^
a.cc:15:47: error: extended character is not valid in an iden... |
s389716527 | p03739 | C++ | #include<iostream>
using namespace std;
int main(){
int n, ans=0, d=0;
cin >> n;
int a[n];
cin >> a[0];
int sum[0]=a[0];
for(int i=1; i<n; i++){
cin >> a[i];
sum[i] = sum[i-1] + a[i];
}
for(int i=1; i<n; i++){
if((sum[i-1]+d)*(sum[i]+d)>=0){
d -= sum[i]+1;
ans += abs(sum[i]+1);
... | a.cc: In function 'int main()':
a.cc:8:17: error: array must be initialized with a brace-enclosed initializer
8 | int sum[0]=a[0];
| ~~~^
|
s707638255 | p03739 | Java | import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.function.IntFunction;
import java.util.function.Supplier;
import java.util.stream.IntStream;
import java.util.stream.Stream;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scann... | Main.java:30: error: incompatible types: possible lossy conversion from long to int
int bit=a[i-1]/Math.abs(a[i-1]);
^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
|
s435882480 | p03739 | C++ | #include<cstdio>
using namespace std;
int main(){
int n, d, a = 0, b = 0, cnta = 0, cntb = 0, i, ans;
scnaf("%d", &n);
for(i = 0; i < n; i++){
scanf("%d", &d);
a += d; b += d;
if(i%2){
if(a > -1){cnta += a + 1; a = -1;}
if(b < 1){cntb += 1 - b; b = 1;}
}else{
if(b > -1){cntb +... | a.cc: In function 'int main()':
a.cc:6:3: error: 'scnaf' was not declared in this scope; did you mean 'scanf'?
6 | scnaf("%d", &n);
| ^~~~~
| scanf
a.cc:19:3: error: 'cout' was not declared in this scope
19 | cout << ans << endl;
| ^~~~
a.cc:2:1: note: 'std::cout' is defined in header... |
s398836705 | p03739 | C++ | include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define rep(i, a) for (int i = 0; i < (int) (a); i++)
#define reps(i, a, b) for (int i = (int) (a); i < (int) (b); i++)
#define rrep(i, a) for (int i = (int) a-1; i >= 0; i--)
#define rreps(i, a, b) for (int i = (int) (a)-1; i >... | a.cc:1:1: error: 'include' does not name a type
1 | include <bits/stdc++.h>
| ^~~~~~~
a.cc:34:1: error: 'vector' does not name a type
34 | vector<int> a;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:39:9: error: 'cin' was not declared in this scope
39 | cin >> N;
| ^~~
a.cc:... |
s181225304 | p03739 | C++ | #include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x) cerr << #x << " = " << (x) << endl;
#de... | a.cc: In function 'int main()':
a.cc:28:36: error: no matching function for call to 'max(int, long long int)'
28 | ans1 += max(0, -sum1 + 1);
| ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x8... |
s054557640 | p03739 | C++ | //Sequence.cpp (C)
#include <iostream>
using namespace std;
long long ans(int n, int*, int change);
int main(){
int n;
int a[110000];
cin >> n;
for(int i = 0; i < n; i++) cin >> a[i];
long long pAns,nAns;
pAns = ans(n,a,1);
nAns = ans(n,a,-1);
printf("%d\n",min(pAns,nAns));
}
int ans(int n, int *a, i... | a.cc:18:5: error: ambiguating new declaration of 'int ans(int, int*, int)'
18 | int ans(int n, int *a, int change){
| ^~~
a.cc:5:11: note: old declaration 'long long int ans(int, int*, int)'
5 | long long ans(int n, int*, int change);
| ^~~
|
s512666543 | p03739 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n; cin >> n;
vector<int> a(n + 1); for (int i = 1; i <= n; i++) cin >> a[i];
vector<int> a1; a1 = a;
long long int sum1 = 0, ans1 = ;
for (int i = 1; i <= n; i++) {
sum1 += a1[i];
if (i % 2 == 1 && sum1 <... | a.cc: In function 'int main()':
a.cc:10:34: error: expected primary-expression before ';' token
10 | long long int sum1 = 0, ans1 = ;
| ^
|
s390380247 | p03739 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n; cin >> n;
vector<int> a(n + 1); for (int i = 1; i <= n; i++) cin >> a[i];
vector<int> a1; a1 = a;
long long int sum1 = 0, ans1 = ;;
for (int i = 1; i <= n; i++) {
sum1 += a1[i];
if (i % 2 == 1 && sum1 ... | a.cc: In function 'int main()':
a.cc:10:34: error: expected primary-expression before ';' token
10 | long long int sum1 = 0, ans1 = ;;
| ^
|
s688199118 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long> vector;
long long temp;
for(int i=0; i<n; i++) {
cin >> temp;
vector.push_back(temp);
}
long long answer1=0;
long long answer2=0;
long long sum1=0;
long long sum2=0;
for(int i=0; i<n; i++) ... | a.cc: In function 'int main()':
a.cc:27:9: error: 'answer' was not declared in this scope; did you mean 'answer2'?
27 | answer += abs(1-vector[0]);
| ^~~~~~
| answer2
|
s599981525 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long> vector;
long long temp;
for(int i=0; i<n; i++) {
cin >> temp;
vector.push_back(temp);
}
long long answer1=0;
long long answer2=0;
long long sum1=0;
long long sum2=0;
for(int i=0; i<n; i++)... | a.cc: In function 'int main()':
a.cc:81:4: error: expected '}' at end of input
81 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s062601921 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long> vector;
long long temp;
for(int i=0; i<n; i++) {
cin >> temp;
vector.push_back(temp);
}
long long answer1=0;
long long answer2=0;
long long sum1=0;
long long sum2=0;
for(int i=0; i<n; i++)... | a.cc: In function 'int main()':
a.cc:58:3: error: 'else' without a previous 'if'
58 | else if(sum2 < 0) {
| ^~~~
a.cc:59:24: error: 'i' was not declared in this scope
59 | if(sum2 + vector[i] > 0){ //和の符号がデフォルトで異なるとき
| ^
a.cc:69:24: error: 'i' was not declared in this ... |
s992510017 | p03739 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
using namespace std;
int inf = 1e9;
int main() {
int n; cin >> n;
vector<int> a(n);
for(int i=0; i<n; i++)... | a.cc: In function 'int main()':
a.cc:35:12: error: no matching function for call to 'min(int&, long long int&)'
35 | ans = min(ans, cnt);
| ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr... |
s121502514 | p03739 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
using namespace std;
using ll = long long;
map <int ,int> mpa,mp... | a.cc: In function 'int main()':
a.cc:31:3: error: 'sum' was not declared in this scope
31 | sum=0;
| ^~~
|
s757331796 | p03739 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
using namespace std;
using ll = long long;
map <int ,int> mpa,mp... | a.cc: In function 'int main()':
a.cc:30:3: error: 'cnt1' was not declared in this scope
30 | cnt1=0,cnt2=0;
| ^~~~
a.cc:30:10: error: 'cnt2' was not declared in this scope
30 | cnt1=0,cnt2=0;
| ^~~~
a.cc:31:3: error: 'sum' was not declared in this scope
31 | sum=0;
| ^~~
|
s341789444 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
#define forx(i,a,b) for(int i=(a);i<(b);i++)
#define rep(j,n) for(int j=0;j<(n);j++)
typedef long long ll;
int main()
{
int n,ansa=0,ansb=0,suma=0,sumb=0;
cin>>n;
rep(i,n){
int a,b;
cin>>b;
a=b;
if(i%2==0){
if... | a.cc: In function 'int main()':
a.cc:21:22: error: expected ';' before 'a'
21 | ansa=1-a-suma
| ^
| ;
22 | a=1-suma;
| ~
|
s862212213 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
#define forx(i,a,b) for(int i=(a);i<(b);i++)
#define rep(j,n) for(int j=0;j<(n);j++)
typedef long long ll;
int main()
{
int n,ansa=0,ansb=0,suma=0;sumb=0,cin>>n;
bool plus=true;
rep(i,n){
int a,b;
cin>>b;
a=b;
while... | a.cc: In function 'int main()':
a.cc:10:32: error: 'sumb' was not declared in this scope; did you mean 'suma'?
10 | int n,ansa=0,ansb=0,suma=0;sumb=0,cin>>n;
| ^~~~
| suma
|
s400940927 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
#define forx(i,a,b) for(int i=(a);i<(b);i++)
#define rep(j,n) for(int j=0;j<(n);j++)
typedef long long ll;
int main()
{
int n,ansa=0,ansb=0,suma=0;sumb=0,cin>>n;
bool plus=true;
rep(i,n){
int a,b;
cin>>b;
a=b;
while... | a.cc: In function 'int main()':
a.cc:10:32: error: 'sumb' was not declared in this scope; did you mean 'suma'?
10 | int n,ansa=0,ansb=0,suma=0;sumb=0,cin>>n;
| ^~~~
| suma
|
s932090730 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
#define forx(i,a,b) for(int i=(a);i<(b);i++)
#define rep(j,n) for(int j=0;j<(n);j++)
typedef long long ll;
int main()
{
int n,ansa=0,ansb=0,suma=0;sumb=0;
cin>>n;
bool plus=true;
rep(i,n){
int a,b;
cin>>b;
a=b;
... | a.cc: In function 'int main()':
a.cc:10:32: error: 'sumb' was not declared in this scope; did you mean 'suma'?
10 | int n,ansa=0,ansb=0,suma=0;sumb=0;
| ^~~~
| suma
|
s162461985 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
#define forx(i,a,b) for(int i=(a);i<(b);i++)
#define rep(j,n) for(int j=0;j<(n);j++)
typedef long long ll;
int main()
{
int n,ansa=0,ansb=0,suma=0;sumb=0;
cin>>n;
bool plus=true;
vector<int>a(n);
rep(i,n){
int a,b;
cin>>t[i];
... | a.cc: In function 'int main()':
a.cc:10:32: error: 'sumb' was not declared in this scope; did you mean 'suma'?
10 | int n,ansa=0,ansb=0,suma=0;sumb=0;
| ^~~~
| suma
a.cc:18:12: error: 't' was not declared in this scope
18 | cin>>t... |
s083729982 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
#define forx(i,a,b) for(int i=(a);i<(b);i++)
#define rep(j,n) for(int j=0;j<(n);j++)
typedef long long ll;
int main()
{
int n,ansa=0,ansb=0,sum=0;
cin>>n;
bool plus=true;
vector<int>t(n);
rep(i,n){
int a;
cin>>t(i);
a=t(i);
wh... | a.cc: In function 'int main()':
a.cc:16:13: error: no match for call to '(std::vector<int>) (int&)'
16 | cin>>t(i);
| ~^~~
a.cc:17:10: error: no match for call to '(std::vector<int>) (int&)'
17 | a=t(i);
| ~^~~
a.cc:35:10: error: no match for call to '(std::vector<int>) ... |
s543467610 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
#define forx(i,a,b) for(int i=(a);i<(b);i++)
#define rep(j,n) for(int j=0;j<(n);j++)
typedef long long ll;
int main()
{
int n,ansa=0,ansb=0,sum=0;
cin>>n;
bool plus=true;
rep(i,n){
int a;
cin>>a;
while(plus&&sum+a<=0){
a++;... | a.cc: In function 'int main()':
a.cc:26:17: error: expected ';' before '}' token
26 | plus=!plus
| ^
| ;
27 | }
| ~
a.cc:44:17: error: expected ';' before '}' token
44 | plus=!plus
| ^
| ... |
s070156303 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
#define forx(i,a,b) for(int i=(a);i<(b);i++)
#define rep(j,n) for(int j=0;j<(n);j++)
typedef long long ll;
int main()
{
int n,ansa=0,ansb=0;
cin>>n;
bool plus=true;
rep(i,n){
int a;
cin>>a;
while(plus&&sum+a<=0){
a++;
... | a.cc: In function 'int main()':
a.cc:17:19: error: 'sum' was not declared in this scope
17 | while(plus&&sum+a<=0){
| ^~~
a.cc:21:20: error: 'sum' was not declared in this scope
21 | while(!plus&&sum+a>=0){
| ^~~
a.cc:25:7: error: 'sum' was not declared... |
s114803863 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,ans,sum;
cin>>n;
vector<int>a(n);
for(int i=0;i<n;i++){
cin>>a.at(i);
}
sum=a.at(0);
for(int i=0;i<n-1;i++){
while(sum>0&&sum+a.at(i+1)>=0)||(sum<0&&sum+a.at(i+1)<=0)){
if(a.at(i)<0){
... | a.cc: In function 'int main()':
a.cc:16:31: error: expected primary-expression before '||' token
16 | while(sum>0&&sum+a.at(i+1)>=0)||(sum<0&&sum+a.at(i+1)<=0)){
| ^~
|
s585839321 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,ans;
cin>>n;
vector<int>a(n);
for(int i=0;i<n;i++){
cin>>a.at(i);
}
for(int i=0;i<n-1;i++){
int sum=0;
for(int j=i;j>=0;j--)sum+=a.at(j);//sum
while(p*a.at(i+1)>=0||p+a.at(i+1)==0){
... | a.cc: In function 'int main()':
a.cc:18:13: error: 'p' was not declared in this scope
18 | while(p*a.at(i+1)>=0||p+a.at(i+1)==0){
| ^
|
s838397699 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,ans;
cin>>n;
vector<int>a(n);
for(int i=0;i<n;i++){
cin>>a.at(i);
}
for(int i=0;i<n-1;i++){
while(a.at(i)*a.at(i+1)>=0){
if(a.at(i)>0){
a.at(i+1)--;
ans++;
}
... | a.cc: In function 'int main()':
a.cc:37:2: error: expected '}' at end of input
37 | }
| ^
a.cc:5:1: note: to match this '{'
5 | {
| ^
|
s838179672 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,ans;
cin>>n;
vector<int>a(n);
for(int i=0;i<n;i++){
cin>>a.at(i);
}
for(int i=0;i<n-1;i++){
while(a.at(i)*a.at(i+1)>=0){
if(a.at(i)>0){
a.at(i+1)--;
ans++;
if(... | a.cc: In function 'int main()':
a.cc:20:13: error: 'p' was not declared in this scope
20 | if(p==0)p++;
| ^
a.cc:25:13: error: 'p' was not declared in this scope
25 | if(p==0)p++;
| ^
a.cc:39:2: error: expected '}' at end of input
39 | }
| ^
a.cc:5:1... |
s197656881 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,ans;
cin>>n;
vector<int>a(n);
for(int i=0;i<n;i++){
cin>>a.at(i);
}
for(int i=0;i<n-1;i++){
int p=0;
for(int j=i+1;j>=0;j--)p+=a.at(j);
while(a.at(i)*a.at(i+1)<0||p=0){
if(a.at(i)>0){
... | a.cc: In function 'int main()':
a.cc:15:32: error: lvalue required as left operand of assignment
15 | while(a.at(i)*a.at(i+1)<0||p=0){
| ~~~~~~~~~~~~~~~~~~~^~~
|
s237191834 | p03739 | C++ | #define _GLIBCXX_DEBUG
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
int main() {
in... | a.cc: In function 'int main()':
a.cc:61:21: error: 'a2m' was not declared in this scope; did you mean 'a2'?
61 | sum2 += a2m[i];
| ^~~
| a2
|
s009561721 | p03739 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);i++)
int main(){
int n; cin >> n;
int a[n]; REP(i,n) cin >> a[i];
long long sum = 0;
long long count = 0;
long long tmp = 0;
REP(i,n){
if(i%2==0){
s... | a.cc: In function 'int main()':
a.cc:55:16: error: no matching function for call to 'min(long long int&, int&)'
55 | cout << min(count,count2) << endl;
| ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/std... |
s261515109 | p03739 | C++ | #include <iostream>
using namespace std;
typedef long long int lli
int main() {
int n;
cin >> n;
int a[100000];
for (int i = 0;i<n;i++) { cin >> a[i]; }
//最初が正のケース
lli Mp = 0;
int Sp = 0;
int dif = 0;
for (int i = 0;i<n;i++) {
Sp += a[i];
if (i % 2 == 0) {
if (Sp<=0) {
dif = 1 - Sp;
Mp += dif... | a.cc:6:1: error: expected initializer before 'int'
6 | int main() {
| ^~~
|
s451488557 | p03739 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<cstdio>
#include<stack>
#include<queue>
#include<fstream>
#include<cstdio>
using namespace std;
#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000
#define rep(i,n) for(int i=0;i<n;i+... | a.cc: In function 'std::string IntToString(ll)':
a.cc:45:9: error: 'sprintf_s' was not declared in this scope; did you mean 'sprintf'?
45 | sprintf_s(x, "%lld", a); string s = x;
| ^~~~~~~~~
| sprintf
a.cc: In function 'll StringToInt(std::string)':
a.cc:51:9: error: 'strcpy_s' wa... |
s995719475 | p03739 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int sign(int a){
if (a > 0)
return 1;
else
if (a < 0)
return -1;
else
return 0;
}
int main(void){
int n;
cin >> n;
int sum = 0, s = 1;
int a;
int num = 0;
for (int i = 0; i < n; i++){
cin >> a;
sum += a;
if (i != 0 && (sign(s) ... | a.cc: In function 'int main()':
a.cc:31:53: error: lvalue required as left operand of assignment
31 | if (i != 0 && (sign(s) == sign(sum) || sum = 0)){
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~
|
s511706406 | p03739 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(void){
int n;
cin>>n;
vector<int> a(n);
cin>>a[0];
for(int i=1;i<n;i++){
cin>>a[i];
a[i]+=a[i-1];
}
if(a[0]<0){
for(int i=0;i<n;i++){
a[i]*=-1;
}
}
int ans=0,def=0;
... | a.cc: In function 'int main()':
a.cc:7:5: error: 'vector' was not declared in this scope
7 | vector<int> a(n);
| ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
2 | #include <algorithm>
+++ |+#include <vector>
3 | u... |
s751768559 | p03739 | C++ | #include<iostream>
#include<cstdlib>
using namespace std;
int main(void){
int n,a;
unsigned long long sum= 0,ans=0;
int s;
cin>>n;
cin>>sum;
if(sum>0)
s = 1;
else
s = -1;
for(int i=1;i<n;i++){
cin>>a;
sum+=a;
if(sum*s>0){
ans+=abs(sum)+1;
sum = -s;
}
if(sum>0)... | a.cc: In function 'int main()':
a.cc:22:15: error: call of overloaded 'abs(long long unsigned int&)' is ambiguous
22 | ans+=abs(sum)+1;
| ~~~^~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from ... |
s209627399 | p03739 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
int main(){
bool ch = false;//falseの時は和が一個前で負
long long N,i;
long long ans=0,count=0;
cin >> N;
long long a[N];
cin >> a[0];
ans+=a;
if(ans>0)ch = true;
else ch = false;
for(i=1;i<N;i++){
cin >> a[i];
if(ch/*ans > 0*/){
if(... | a.cc: In function 'int main()':
a.cc:12:6: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
12 | ans+=a;
| ~~~^~~
| |
| long long int*
|
s619750186 | p03739 | C++ | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MOD 1000000007
# define INF (1 < <29)
#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;
#define MODA... | a.cc:95:14: fatal error: debug.h: No such file or directory
95 | #include "debug.h"
| ^~~~~~~~~
compilation terminated.
|
s909914532 | p03739 | C++ | x = input().split(" ")
a = int(x[0])
b = int(x[1])
if (a>b):
print("GREATER")
elif(a==b):
print("EQUAL")
else:
print("LESS")
| a.cc:1:1: error: 'x' does not name a type
1 | x = input().split(" ")
| ^
|
s100607750 | p03739 | C++ | #include <iostream>
#include <cassert>
#include <queue>
#define INF 922337203685477580
typedef long long ll;
using namespace std;
int main() {
int n;
cin >> n;
ll a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
ll op = 0LL;
ll sum = 0LL;
sum = a[i];
for (int i = 1; i < n; i++) {
ll a;
... | a.cc: In function 'int main()':
a.cc:21:11: error: 'i' was not declared in this scope
21 | sum = a[i];
| ^
|
s595269629 | p03739 | C++ | #include <iostream>
#include <string>
using namespace std;
int main(){
int n,i,c=0;
cin >> n;
int a[n],s[2];
//入力
for (i=0;i<n;i++){
cin >> a[i];
}
//操作
s[0] = a[0],s[1]=0;
for (i=1;i<n;i++){
s[1] = s[0]+a[i];
if (s[0]*s[1] >=0){//符号一致(または0)していたら符号を一致させない方向へ動かす
... | a.cc: In function 'int main()':
a.cc:27:15: error: expected primary-expression before ';' token
27 | cout <<c<<;
| ^
|
s503249745 | p03739 | Java | import java.util.ArrayList;
import java.util.Scanner;
public class ABC {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
// 整数の入力
int n = sc.nextInt();
int a[] = new int[n];
for(int i = 0;i<a.length;i++)
{
a[i] = sc.nextInt();
}
int b[] = new int[n];
b[0] ... | Main.java:5: error: class ABC is public, should be declared in a file named ABC.java
public class ABC {
^
1 error
|
s164361653 | p03739 | C++ | #include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define VS vector<string>
#define ll long long int
#define debug(x) cout << x << " :" <<#x << endl
int main(void) {
int n;
cin >> n;
vector<ll> a(100001);
ll s;
REP(i,n) {
cin >{ s;
a[i] = s; ... | a.cc: In function 'int main()':
a.cc:12:9: error: 'i' was not declared in this scope
12 | REP(i,n) {
| ^
a.cc:12:5: error: 'REP' was not declared in this scope
12 | REP(i,n) {
| ^~~
a.cc:48:2: error: expected '}' at end of input
48 | }
| ^
a.cc:7:16: note: to match this '... |
s714040355 | p03739 | C++ | #include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define VS vector<string>
#define ll long long int
#define debug(x) cout << x << " :" <<#x << endl
int main(void) {
int n;
cin >> n;
vector<ll> a(100001);
ll s;
REP(i,n) {
cin >{ s;
a[i] = s; ... | a.cc: In function 'int main()':
a.cc:12:9: error: 'i' was not declared in this scope
12 | REP(i,n) {
| ^
a.cc:12:5: error: 'REP' was not declared in this scope
12 | REP(i,n) {
| ^~~
a.cc:48:2: error: expected '}' at end of input
48 | }
| ^
a.cc:7:16: note: to match this '... |
s780624808 | p03739 | C++ | #include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>... | a.cc: In function 'int main()':
a.cc:67:36: error: 'a' was not declared in this scope
67 | if(sum[i]<0)flag=false;a
| ^
|
s057332894 | p03739 | C++ | #include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <stdlib.h>
#include <list>
#include <queue>
#include <map>
#include <stack>
#include <set>
#define inf 0x3f3f3f3f
#define PI acos(double(-1))
using namespace std;
typedef long lon... | a.cc: In function 'int main()':
a.cc:100:25: error: expected ';' before '}' token
100 | num=min(num,cnt)
| ^
| ;
101 | }
| ~
|
s829845496 | p03739 | C++ | #include <stdio.h>
#include<math.h>
int main(void) {
// your code goes here
long int a[100000];
int n,count= 0;
scanf("%d",&n);
int i;
for(i = 0;i<n;i++)
{
scanf("%ld",&a[i]);
};
int new = a[0]+a[1];
int pos;
if(new <0)
pos= 0;
else
pos = 1;
for(i = 2;i<n;i++)
{
new... | a.cc: In function 'int main()':
a.cc:13:21: error: expected unqualified-id before 'new'
13 | int new = a[0]+a[1];
| ^~~
a.cc:15:24: error: expected type-specifier before '<' token
15 | if(new <0)
| ^
a.cc:21:21: error: expected... |
s198499402 | p03739 | C++ | if(a[0]==0){
ans1++;
sum0=1;
}else{
sum0=a[0];
}
REP(i,1,n){
sum1=sum0+a[i];
if(sum1*sum0<0){
}else if(sum1*sum0>0){
ans1+=abs(sum1)+1;
sum1=-1*sum0/abs(sum0);
}else{
ans1++;
sum1=-1*sum0/abs(sum0);
}
sum0=sum1;
} | a.cc:1:3: error: expected unqualified-id before 'if'
1 | if(a[0]==0){
| ^~
a.cc:4:4: error: expected unqualified-id before 'else'
4 | }else{
| ^~~~
a.cc:7:6: error: expected constructor, destructor, or type conversion before '(' token
7 | REP(i,1,n){
| ^
|
s181583568 | p03739 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <limits.h>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
int n;
vector<long long> A;
long long ans1 = 0;
long long ans2 = 0;
long long sum = 0;
... | a.cc: In function 'int main()':
a.cc:31:5: error: 'is_plus' was not declared in this scope
31 | is_plus = true;
| ^~~~~~~
|
s076154503 | p03739 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <limits.h>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
int n;
vector<long long> A;
int j;
bool is_plus;
long long ans = 0;
long lo... | a.cc: In function 'int main()':
a.cc:57:21: error: expected primary-expression before ';' token
57 | ans+;;
| ^
|
s249807114 | p03739 | C++ | #include <cstdio>
#include <algorithm>
using namespace std;
int main(){
int n;
scanf("%d", &n);
int a[n];
for (int i = 0; i < n; i++) scanf(" %d", &a[i]);
int S = a[0];
int j = 0;
for (int i = 1; i < n; i++){
if (S * (S+a[i]) < 0){
S += a[i];
}
else if ... | a.cc: In function 'int main()':
a.cc:21:24: error: expected ';' before 'S'
21 | else (S < 0) S = 1;
| ^~
| ;
a.cc: At global scope:
a.cc:31:11: error: expected constructor, destructor, or type conversion before '(' token
31 | printf("%d\n", ... |
s456732795 | p03739 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <limits.h>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
int n;
vector<long long> A;
int j;
bool is_plus;
long long ans = 0;
long lo... | a.cc: In function 'int main()':
a.cc:25:5: error: 'S' was not declared in this scope
25 | S.push_back(0);
| ^
|
s834354286 | p03739 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <limits.h>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
int n;
vector<long long> S;
vector<long long> A;
bool is_plus;
int ans;
int ans1 = 0;... | a.cc:38:35: error: stray '#' in program
38 | else if ( A[i] < 0 ) {#include <iostream>
| ^
a.cc: In function 'int main()':
a.cc:38:36: error: 'include' was not declared in this scope
38 | else if ( A[i] < 0 ) {#include <iostream>
| ... |
s440798248 | p03739 | C++ | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<string>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll INFF=0x3f3f3f3f3f3f3f3f;
int ... | a.cc: In function 'int main()':
a.cc:54:12: error: redeclaration of 'll sum'
54 | ll sum=0,t=a[0];
| ^~~
a.cc:49:12: note: 'll sum' previously declared here
49 | ll sum=0;
| ^~~
|
s564708361 | p03739 | C++ | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<string>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll INFF=0x3f3f3f3f3f3f3f3f;
ll a... | a.cc:76:5: error: expected unqualified-id before 'return'
76 | return 0;
| ^~~~~~
a.cc:77:1: error: expected declaration before '}' token
77 | }
| ^
|
s840860108 | p03739 | C++ | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<string>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll INFF=0x3f3f3f3f3f3f3f3f;
ll a... | a.cc:76:5: error: expected unqualified-id before 'return'
76 | return 0;
| ^~~~~~
a.cc:77:1: error: expected declaration before '}' token
77 | }
| ^
|
s868270635 | p03739 | C++ | #include <cstdio>
using namespace std;
int main(){
long double n;
scanf("%Lf", &n);
long double a[n];
for (int i = 0; i < n; i++) scanf(" %Lf", &a[i]);
int S = a[0];
int j = 0;
for (int i = 1; i < n; i++){
if (S * (S+a[i]) < 0){
S += a[i];
}
else {
... | a.cc: In function 'int main()':
a.cc:7:19: error: conversion from 'long double' to 'long unsigned int' in a converted constant expression
7 | long double a[n];
| ^
a.cc:7:19: error: could not convert 'n' from 'long double' to 'long unsigned int'
7 | long double a[n];
| ... |
s103036923 | p03739 | C++ | #include <iostream>
#include <math.h>
using namespace std;
int a(long long int z) {
if (z > 0) return 1;
else if (z < 0) return -1;
else return 0;
}
int main(){
long long int n, sum = 0, in, ans = 0;
cin >> n >> sum;
for(int i = 1;i<n;i++){
cin >> in;
if(i == 1){
if(sum == 0){
sum = -1 * a(in);
... | a.cc:35:9: error: expected unqualified-id before 'if'
35 | if (sum == 0) ans++;
| ^~
a.cc:36:9: error: 'cout' does not name a type
36 | cout << ans << endl;
| ^~~~
a.cc:37:9: error: expected unqualified-id before 'return'
37 | return 0;
| ^~~~~~... |
s393083299 | p03739 | Java | import java.util.*;
// ABC 6-C
// http://abc006.contest.atcoder.jp/tasks/abc006_3
public class Main {
public static void main (String[] args) throws java.lang.Exception {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] nums = new int[n];
for (int i = 0; i < n; i++) {
nums[i] = in.n... | Main.java:20: error: incompatible types: possible lossy conversion from long to int
answer = solve(nums, 0, 0);
^
Main.java:22: error: incompatible types: possible lossy conversion from long to int
answer = solve(nums, nums[0], 1);
^
2 errors
|
s323434467 | p03739 | C++ | #include<iostream>
using namespace std;
long int abs(long int a){
if(a<0)return -a;
else return a;
}
bool isDifAbs(long int a,long int b){
if(a*b<0)return true;
return false;
}
int main(){
int n;
long int sum,tmp,ttmp,ans=0;
cin >> n;
cin >> sum;
for(int i=1;i<n;i++){
cin ... | a.cc: In function 'int main()':
a.cc:23:29: error: call of overloaded 'abs(long int&)' is ambiguous
23 | if(sum<0)tmp=abs(tmp)+1;
| ~~~^~~~~
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.