criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,l,c=0,e=0,f=0;
  long int  d[n];
  cin>>n>>l;
  for(int i=1;i<=n;i++){
    d[i]=l+i-1;
  }
  for(int i=1;i<=n;i++){
    c+=d[i];
  }
  for(int i=1;i<=n;i++){
    e=max(abs(c-d[i]),e);
  }
  for(int i=1;i<=n;i++){
    if(d[i]==abs(c-e)){
      d[i]=0;
    }
    else{
      d[i]=l+i-1;
    }
  }
  for(int i=1;i<=n;i++){
    f+=d[i];
  }
  cout<<f;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: no matching function for call to 'max(long int, int&)'
   14 |     e=max(abs(c-d[i]),e);
      |       ~~~^~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:14:10: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   14 |     e=max(abs(c-d[i]),e);
      |       ~~~^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:14:10: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   14 |     e=max(abs(c-d[i]),e);
      |       ~~~^~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namepspace std;
int main(){
  int n,l,c=0,e=0,f=0;
  long int  d[n];
  cin>>n>>l;
  for(int i=1;i<=n;i++){
    d[i]=l+i-1;
  }
  for(int i=1;i<=n;i++){
    c+=d[i];
  }
  for(int i=1;i<=n;i++){
    e=max(abs(c-d[i]),e);
  }
  for(int i=1;i<=n;i++){
    if(d[i]==abs(c-e)){
      d[i]=0;
    }
    else{
      d[i]=l+i-1;
    }
  }
  for(int i=1;i<=n;i++){
    f+=d[i];
  }
  cout<<f;
  return 0;
}


Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namepspace'
    2 | using namepspace std;
      |       ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    6 |   cin>>n>>l;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:14:7: error: 'max' was not declared in this scope; did you mean 'std::max'?
   14 |     e=max(abs(c-d[i]),e);
      |       ^~~
      |       std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:27:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |   cout<<f;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#include<bits/stdc++.h>
using namepspace std;
int main(){
  int n,l,c=0,e=0,f=0;
  cin>>n>>l;
  for(int i=1;i<=n;i++){
    d[i]=l+i-1;
  }
  for(int i=1;i<=n;i++){
    c+=d[i];
  }
  for(int i=1;i<=n;i++){
    e=max(abs(c-d[i]),e);
  }
  for(int i=1;i<=n;i++){
    if(d[i]==abs(c-e)){
      d[i]=0;
    }
    else{
      d[i]=l+i-1;
    }
  }
  for(int i=1;i<=n;i++){
    f+=d[i];
  }
  cout<<f;
  return 0;
}

Compiler output:
a.cc:2:7: error: expected nested-name-specifier before 'namepspace'
    2 | using namepspace std;
      |       ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   cin>>n>>l;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:7:5: error: 'd' was not declared in this scope
    7 |     d[i]=l+i-1;
      |     ^
a.cc:10:8: error: 'd' was not declared in this scope
   10 |     c+=d[i];
      |        ^
a.cc:13:17: error: 'd' was not declared in this scope
   13 |     e=max(abs(c-d[i]),e);
      |                 ^
a.cc:13:7: error: 'max' was not declared in this scope; did you mean 'std::max'?
   13 |     e=max(abs(c-d[i]),e);
      |       ^~~
      |       std::max
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: 'std::max' declared here
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
a.cc:16:8: error: 'd' was not declared in this scope
   16 |     if(d[i]==abs(c-e)){
      |        ^
a.cc:24:8: error: 'd' was not declared in this scope
   24 |     f+=d[i];
      |        ^
a.cc:26:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   26 |   cout<<f;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b){return b!=0?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
const ll mod=1e9+7;


int main(){
  int n,l;
  cin >> n >> l;
  int ans = 0;
  int memo = INT_MAX;
  int val;
  for(int i = 1; i <= n; i++){
    ans += l + i - 1;
    if(memo > abs(l+i-1)){
      memo = abs(l+i-1);
      val = l+i-1;
    }
  }
  printf("%d\n", ans-val);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:14: error: 'INT_MAX' was not declared in this scope
   23 |   int memo = INT_MAX;
      |              ^~~~~~~
a.cc:11:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   10 | #include <math.h>
  +++ |+#include <climits>
   11 | #define rep(i,n) for(int i = 0; i < (n); ++i)
Language: C++

include <iostream>
using namespace std;
int main(){
  int l,n;
cin >> n >> l;
  if(l>=0){
    int i=(n-1)*l + l*(l-1)/2 -1 ;
    cout << i;
  }
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:5:1: error: 'cin' was not declared in this scope
    5 | cin >> n >> l;
      | ^~~
a.cc:8:5: error: 'cout' was not declared in this scope
    8 |     cout << i;
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
    int N,L;
    cin >> N >> L;
    int T[210];
    int ans = 0;

    for(int i=0; i<N; i++){
        T[i] = L + i + 1 - 1;
        ans += T[i];
    }

    int P = 10000;

    for(int i=0; i<N; i++){
        if(abs(T[i]) < abs(P)) P = T[i];
    }

    cout << ans - P << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:21:29: error: expected '}' at end of input
   21 |     cout << ans - P << endl;
      |                             ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,L;
    cin >> N >> L;
    if(L>=1)cout << (L-1)*(N-1)+N*(N-1)/2-1 << endl;
    else{
        int ans=L;
        int sum=(L-1)*N+N*(N-1)/2;
        for(i=2;i<N+1;i++){
            if(abs(ans)>abs(L-1+i))ans=L-1+i;
        }
        cout << sum-ans << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: 'i' was not declared in this scope
   10 |         for(i=2;i<N+1;i++){
      |             ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
	int n, l;
	cin >> n >> l;
	
	int a[n]={};
	int sum=0;
	for(int i=0; i<n; i++){
		a[i] = l+i+1-1;
		sum += a[i];
	}
	
	bool flag=true;
	for(int i=0; i<n; i++){
		if(a[i]<=0) flag=false;
	}
	
	int ans=0;
	if(flag==true){
		for(int i=0; i<n; i++) a[i]=abs(a[i]);
		sort(a, a+n);
		for(int i=1; i<n; i++) ans+=a[i];
		cout << ans << endl;
	}else{ 
		sort(a, a+n, greater<int>());
		fir(int i=1; i<n; i++) ans+=a[i];
		cout << ans << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:21: error: expected primary-expression before 'int'
   28 |                 fir(int i=1; i<n; i++) ans+=a[i];
      |                     ^~~
a.cc:28:30: error: 'i' was not declared in this scope
   28 |                 fir(int i=1; i<n; i++) ans+=a[i];
      |                              ^
Language: Java


public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        Integer n = Integer.parseInt(scanner.next());
        Integer l = Integer.parseInt(scanner.next());


        Integer[] taste = new Integer[n];
        for(int i = 1; i <= n; i++) {
            taste[i-1] = l + i - 1;
        }


        int max = taste[0];
        int min = taste[1];
        for(int i = 0; i < taste.length; i++) {
            int v = Math.abs(taste[i]);
            if (v > max) {
                max = v;
            }
            if (v < min) {
                min = v;
            }
        }

        int sum = Stream.of(taste).mapToInt(Integer::intValue).sum();
        System.out.println(sum - min);
    }
}


Compiler output:
Main.java:5: error: cannot find symbol
        Scanner scanner = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
        Scanner scanner = new Scanner(System.in);
                              ^
  symbol:   class Scanner
  location: class Main
Main.java:28: error: cannot find symbol
        int sum = Stream.of(taste).mapToInt(Integer::intValue).sum();
                  ^
  symbol:   variable Stream
  location: class Main
3 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
int N,L;
  cin>>N>>L;
  int a=L+N-1;
  int b;
if(a<=0){
b=a;
}
  else if(L>=0){
  b=L;
  }
  else{
  b=0
  }
  cout<<(a+L)*(a-L+1)/2-b<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:6: error: expected ';' before '}' token
   15 |   b=0
      |      ^
      |      ;
   16 |   }
      |   ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int n,l;
  cin>>n>>l;
  vector<int> a(n);
     for (int i = 0; i < n; i++) {
    a[i] =l+i;
  }
  int s=0;
     for (int i = 0; i < n; i++) {
    s +=a[i];
     }
  int ans =10000000;
     for (int i = 0; i < n; i++) {
   int t = s -a[i];
       if(abs(t-s)<abs(ans-s)){
         ans = t;
       }
     }
  cout<<ans<<endl;
  }


}


Compiler output:
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>
#include <string>
using namespace std;


int main() {
  int N, L;
  cin >> N >> L;
  
  int taste = 0;
  for (int i = 1; i <= N; i++) {
    taste += L+i-1;
  }
  
  int ans = INT_MAX;
  for (int i = 1; i <= N; i++) {
    if(abs(ans) > abs(taste - (L+i-1)) {
      ans = taste - (L+i-1);
    }
  }
  
  
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:39: error: expected ')' before '{' token
   21 |     if(abs(ans) > abs(taste - (L+i-1)) {
      |       ~                               ^~
      |                                       )
a.cc:24:3: error: expected primary-expression before '}' token
   24 |   }
      |   ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
    
    // スペース区切りの整数の入力
    int N,L;
    cin >> N >> L;
    int eated = min(1,L);
  	int r = N*(2*L+(N-1))/2 - (c+eated-1);
    // 出力
    cout << r << endl;
  	
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:36: error: 'c' was not declared in this scope
   10 |         int r = N*(2*L+(N-1))/2 - (c+eated-1);
      |                                    ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
    
    // スペース区切りの整数の入力
    int b,c;
    cin >> b >> c;
    int eated = min(1,c+1);
  	int r = N*(2*b+(N-1))/2 - c+eated-1;
    // 出力
    cout << r << endl;
  	
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'N' was not declared in this scope
   10 |         int r = N*(2*b+(N-1))/2 - c+eated-1;
      |                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> l_l;
typedef pair<int , int> i_i;
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<char> vec;
typedef vector<bool> veb;
typedef vector<string> ves;
typedef vector<vector<ll>> vvl;
typedef vector<vector<int>> vvi;
typedef vector<vector<char>> vvec;
typedef vector<vector<bool>> vveb;
typedef vector<vector<string>> vves;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<(int)(n);i++)
#define rep2(i,n) for(int i=2;i<(int)(n);i++)
#define repk(i,k,n) for(int i=k;i<(int)(n);i++)
#define fs first
#define sc second
#define pb push_back
#define pp pop_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define maxel(a) *max_element(all(a))
#define minel(a) *min_element(all(a))
#define acc accumulate
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define mod (1000000007)
typedef long long int64;
//const int64 INF = 1LL << 58;
#define dame { puts("-1"); return 0;}
#define YES { cout << "YES" << endl; return 0; }
#define NO { cout << "NO" << endl; return 0; }
#define Yes { cout << "Yes" << endl; return 0; }
#define No { cout << "No" << endl; return 0; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

    int n,l;
    cin >> n >> l;
    int r = l + r -1;

    int eat;
    if(r<=0) eat = r;
    else if(l>=0) eat = l;
    else eat = 0;

    cout << ((r+l)*(R-l+1))/2 -eat << endl; 

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:21: error: 'R' was not declared in this scope
   60 |     cout << ((r+l)*(R-l+1))/2 -eat << endl;
      |                     ^
Language: C

#include<stdio.h>
int main(void){
  int a,b,sum=0,i,j,min=101;
  scanf("%d %d",&a,&b);
  int num[a+1];
  for(i=1;i<a;i++){
    num[i]=b+i-1;
    sum+=num[i];
    if(num[i]<min){
      min=num[i];
    }
  }
  num-=min;
  printf("%d",num);
  return 0;
}
  

Compiler output:
main.c: In function 'main':
main.c:13:6: error: assignment to expression with array type
   13 |   num-=min;
      |      ^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,l
    cin >> n >> l;
    int S=0;
    for(int i=0; i<N; i++) S+=L+i;
     if (L<=0 && L+N-1>=0) cout << S;
     else if (abs(L)<abs(L+N-1)) cout << S-L;
       else cout << S-(L+N-1);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:5: error: expected initializer before 'cin'
    5 |     cin >> n >> l;
      |     ^~~
a.cc:7:20: error: 'N' was not declared in this scope
    7 |     for(int i=0; i<N; i++) S+=L+i;
      |                    ^
a.cc:7:31: error: 'L' was not declared in this scope
    7 |     for(int i=0; i<N; i++) S+=L+i;
      |                               ^
a.cc:8:10: error: 'L' was not declared in this scope
    8 |      if (L<=0 && L+N-1>=0) cout << S;
      |          ^
a.cc:8:20: error: 'N' was not declared in this scope
    8 |      if (L<=0 && L+N-1>=0) cout << S;
      |                    ^
Language: C++

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
bool isPrime(int x) {
    if (x<2) return 0;
    else if (x==2) return 1;
    if (x%2==0) return 0;
    for(i=3; i*i<=x; i+=2) if(x%i==0) return 0;
    return 1;
}

vector<int> eratosthenes(const int n) {
    vector<bool> isPrime(n+1, true);
    vector<int> p;
    for(int i=1; i<=n; ++i) {
        if(isPrime[i]) {
            for(int j=2*i; j<=n; j+=i;) {
                isPrime[i] = false;
            }
            p.pb(i);
        }
    }
    return p;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    vector<int> V;
    for(int i=1; i<=n; ++i) {
        V.pb(l+i-1);
    }
    int risou = 0;
    rep(i,n) {
        risou += V[i];
    }
    int act = 0;
    int res  =0;
    int diff = INF;
    rep(i,n) {
        act = risou-V[i];
        if (abs(act-risou) < diff) {
            diff = abs(act-risou);
            res = act;
        }
    }
    cout << res << "\n";

    


}



Compiler output:
a.cc: In function 'bool isPrime(int)':
a.cc:23:9: error: 'i' was not declared in this scope
   23 |     for(i=3; i*i<=x; i+=2) if(x%i==0) return 0;
      |         ^
a.cc: In function 'std::vector<int> eratosthenes(int)':
a.cc:32:38: error: expected ')' before ';' token
   32 |             for(int j=2*i; j<=n; j+=i;) {
      |                ~                     ^
      |                                      )
a.cc:32:39: error: expected primary-expression before ')' token
   32 |             for(int j=2*i; j<=n; j+=i;) {
      |                                       ^
a.cc: In function 'int main()':
a.cc:45:21: error: 'n' was not declared in this scope
   45 |     for(int i=1; i<=n; ++i) {
      |                     ^
a.cc:46:14: error: 'l' was not declared in this scope
   46 |         V.pb(l+i-1);
      |              ^
a.cc:8:25: note: in definition of macro 'pb'
    8 | #define pb(x) push_back(x)
      |                         ^
a.cc:49:11: error: 'n' was not declared in this scope
   49 |     rep(i,n) {
      |           ^
a.cc:4:39: note: in definition of macro 'rep'
    4 | #define rep(i,n) for (int i = 0; i < (n); i++)
      |                                       ^
a.cc:55:11: error: 'n' was not declared in this scope
   55 |     rep(i,n) {
      |           ^
a.cc:4:39: note: in definition of macro 'rep'
    4 | #define rep(i,n) for (int i = 0; i < (n); i++)
      |                                       ^
Language: C++

def chmin(a, b)
  a > b ? b : a
end
n,l = gets.split.map(&:to_i)
tas = []
sum = 0
(1..n).each do |i|
    tas << i + l - 1
    sum += i + l - 1
end

k = tas[0]

(1..n - 1).each do |i|
    if tas[i - 1].abs > tas[i].abs
        k = tas[i]
    end
end

puts sum - k


Compiler output:
a.cc:7:2: error: too many decimal points in number
    7 | (1..n).each do |i|
      |  ^~~~
a.cc:14:2: error: too many decimal points in number
   14 | (1..n - 1).each do |i|
      |  ^~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def chmin(a, b)
      | ^~~
Language: C++

N,L = list(map(int, input().split()))
l = []
l_abs = []
for i in range(N):
    l.append(L+i)
    l_abs.append(abs(L+i))


print(sum(l)-l[l.index(min(l_abs))])


Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N,L = list(map(int, input().split()))
      | ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
  int n,l;
  cin >> n >> l;
  vector<int> b(n);
  for(int i=0;i<n;i++){
    b[i]=l+i
  int sum=0;
  for(int i=1;i<n+1;i++){
    sum+=(l+i-1);
  }
  int ans;
  for(int i=0;i<n;i++){
    ans=max(sum-b[i],sum-b[i+1]);
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: expected ';' before 'int'
   11 |     b[i]=l+i
      |             ^
      |             ;
   12 |   int sum=0;
      |   ~~~        
a.cc:14:5: error: 'sum' was not declared in this scope
   14 |     sum+=(l+i-1);
      |     ^~~
a.cc:18:13: error: 'sum' was not declared in this scope
   18 |     ans=max(sum-b[i],sum-b[i+1]);
      |             ^~~
a.cc:21:2: error: expected '}' at end of input
   21 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
  int n,l;
  cin >> n >> l;
  int sum=0;
  for(int i=1;i<n+1;i++){
    sum+=(l+i-1);
  }
  int ans;
  for(int i=0;i<n;i++){
    ans=max(sum-b[i],sum-b[i+1]);
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'b' was not declared in this scope
   15 |     ans=max(sum-b[i],sum-b[i+1]);
      |                 ^
Language: C++

#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
int N,L;
  cin>>N>>L;
  int A[210];
  int B[210];
  for (int i=0; i<N; i++) A[i]=L+i-1;
  for (int i=0; i<N; i++) B[i]=abs(A[i]);
  sort(B.begin(),B.end());
  int D=B[0];
  int sum=0;
  for (int i=0; i<N; i++) sum+=A[i];
  if (L+N-1<=-1) cout<<sum+D<<endl;
  else cout<<sum-D<<endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:12:10: error: request for member 'begin' in 'B', which is of non-class type 'int [210]'
   12 |   sort(B.begin(),B.end());
      |          ^~~~~
a.cc:12:20: error: request for member 'end' in 'B', which is of non-class type 'int [210]'
   12 |   sort(B.begin(),B.end());
      |                    ^~~
Language: C++

#include<iostream>
#include<cmath>
using namespace std;
int main(){
int N,L;
  cin>>N>>L;
  int A[210];
  int B[210];
  for (int i=0; i<N; i++) A[i]=L+i-1;
  for (int i=0; i<N; i++) B[i]=abs(A[i]);
  sort(B.begin(),B.end());
  int D=B[0];
  int sum=0;
  for (int i=0; i<N; i++) sum+=A[i];
  if (L+N-1<=-1) cout<<sum+D<<endl;
  else cout<<sum-D<<endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: request for member 'begin' in 'B', which is of non-class type 'int [210]'
   11 |   sort(B.begin(),B.end());
      |          ^~~~~
a.cc:11:20: error: request for member 'end' in 'B', which is of non-class type 'int [210]'
   11 |   sort(B.begin(),B.end());
      |                    ^~~
a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   11 |   sort(B.begin(),B.end());
      |   ^~~~
      |   sqrt
Language: C++

#include<iostream>
#include<cmath>
using namespace std;
int main(){
int N,L;
  cin>>N>>L;
  int A[210];
  int B[210]
  for (int i=0; i<N; i++) A[i]=L+i-1;
  for (int i=0; i<N; i++) B[i]=abs(A[i]);
  sort(B.begin(),B.end());
  int D=B[0];
  int sum=0;
  for (int i=0; i<N; i++) sum+=A[i];
  if (L+N-1<=-1) cout<<sum+D<<endl;
  else cout<<sum-D<<endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected initializer before 'for'
    9 |   for (int i=0; i<N; i++) A[i]=L+i-1;
      |   ^~~
a.cc:9:17: error: 'i' was not declared in this scope
    9 |   for (int i=0; i<N; i++) A[i]=L+i-1;
      |                 ^
a.cc:10:27: error: 'B' was not declared in this scope
   10 |   for (int i=0; i<N; i++) B[i]=abs(A[i]);
      |                           ^
a.cc:11:8: error: 'B' was not declared in this scope
   11 |   sort(B.begin(),B.end());
      |        ^
a.cc:11:3: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   11 |   sort(B.begin(),B.end());
      |   ^~~~
      |   sqrt
Language: C++

#include <bits/stdc++.h>
using namespace std;

using ll=long long;
const ll MOD=1000000007;

int main() {
  int n,l;
  cin >> n >> l;
  int sum=n*l+n*(n+1)/2-n;
  if(l=>0){
    cout << sum-l << endl;
  }
  else if(l+n-1>=0){
    cout << sum << endl;
  }
  else{
    cout << sum-(n+l)+1 << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:8: error: expected primary-expression before '>' token
   11 |   if(l=>0){
      |        ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 1;i <= (n);i++)
using namespace std;

int main(){
    int n,l;
    cin >> n >> l;
    vector<int> s(n):
    int sum = 0;
    int s_min = 100;
    rep(i,n){
        s[i] = l + i - 1;
        s_min = min(s_min,s[i]);
        sum += s[i];
    }
    cout << sum - s_min << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:21: error: expected ',' or ';' before ':' token
    8 |     vector<int> s(n):
      |                     ^
a.cc:14:9: error: 'sum' was not declared in this scope
   14 |         sum += s[i];
      |         ^~~
a.cc:16:13: error: 'sum' was not declared in this scope
   16 |     cout << sum - s_min << endl;
      |             ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n,l;
    cin >> n >> l;
    int eat = l-1;
    for (int i = 1; i < n + 1; i++){
        if (abs(eat) > abs(l+i-1)){
            eat = l+i-1;
        }
    }

    cout << (l-1)*n + (n(n-1))/2 - eat << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:25: error: 'n' cannot be used as a function
   14 |     cout << (l-1)*n + (n(n-1))/2 - eat << endl;
      |                        ~^~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main(){
  int n,l,ans,p;
  ans = 0;
  p = 0
  cin >> n >> l;
  for(int i=0;i<n;i++){
    p += l+i}
    
    
  if(l>0){ans  = p-l;}
  else if(l+n-1<0){ans = p-l-n+1}
  else if(l<=0 && l+n-1>=0){ans = p;}
  cout << ans << endl;
  return 0;
}
  
    
    
  


Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: expected ';' before 'cin'
    7 |   p = 0
      |        ^
      |        ;
    8 |   cin >> n >> l;
      |   ~~~   
a.cc:10:13: error: expected ';' before '}' token
   10 |     p += l+i}
      |             ^
      |             ;
a.cc:14:33: error: expected ';' before '}' token
   14 |   else if(l+n-1<0){ans = p-l-n+1}
      |                                 ^
      |                                 ;
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N , A;
  cin >> N >> A;
  int n = N;
  int ans = N + A - 1;
  int wer = 0;
  if(R <= 0){
    wer = ans;
  }
  else if(n >= 0){
    wer = 0;
  }
  int answer = (n + ans) * (n - ans + 1) / 2 - wer;
  cout << answer << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:6: error: 'R' was not declared in this scope
   10 |   if(R <= 0){
      |      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N < A;
  cin >> N >> A;
  int n = N;
  int ans = N + A - 1;
  int wer = 0;
  if(R <= 0){
    wer = ans;
  }
  else if(n >= 0){
    wer = 0;
  }
  int answer = (n + ans) * (n - ans + 1) / 2 - wer;
  cout << answer << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:9: error: expected initializer before '<' token
    5 |   int N < A;
      |         ^
a.cc:6:10: error: 'N' was not declared in this scope
    6 |   cin >> N >> A;
      |          ^
a.cc:6:15: error: 'A' was not declared in this scope
    6 |   cin >> N >> A;
      |               ^
a.cc:10:6: error: 'R' was not declared in this scope
   10 |   if(R <= 0){
      |      ^
Language: C++

#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int n,l ;
   cin >> n >> l ;
   
  int total = 0;
   for(int i=0;i<n;i++)
   {
     total+=l+i ;
   }

   int ans = 0;
   for(int i=0;i<n;i++)
     int tmp;
     tmp = total-l-i;
   if(tmp>ans) ans = tmp;
   }

   cout << ans << endl;
  
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:6: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   18 |      tmp = total-l-i;
      |      ^~~
      |      tm
a.cc:18:20: error: 'i' was not declared in this scope
   18 |      tmp = total-l-i;
      |                    ^
a.cc: At global scope:
a.cc:22:4: error: 'cout' does not name a type
   22 |    cout << ans << endl;
      |    ^~~~
a.cc:24:5: error: expected unqualified-id before 'return'
   24 |     return 0;
      |     ^~~~~~
a.cc:25:1: error: expected declaration before '}' token
   25 | }
      | ^
Language: C++

#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
   int n,l ;
   cin >> n >> l ;
   
  int total = 0;
   for(int i=0;i<n;i++)
   {
     total+=l+i ;
   }

   int df = total;
   int ans = 0;
   for(int i=0;i<n;i++)
     int tmp;
     tmp = total-l-i;
   if(tmp>ans) ans = tmp;
   }

   cout << ans << endl;
  
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:6: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   19 |      tmp = total-l-i;
      |      ^~~
      |      tm
a.cc:19:20: error: 'i' was not declared in this scope
   19 |      tmp = total-l-i;
      |                    ^
a.cc: At global scope:
a.cc:23:4: error: 'cout' does not name a type
   23 |    cout << ans << endl;
      |    ^~~~
a.cc:25:5: error: expected unqualified-id before 'return'
   25 |     return 0;
      |     ^~~~~~
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int n,l;
cin >> n >> l;
int n_min = INF;
ll ans=0;
int count;
REP(i,n) {
  ans += l+i;
  if(n_min>l+i) {
    n_min = l+i;
    count = i;
  }
}
ans -= l+i;
cout << ans << endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: 'i' was not declared in this scope
   25 | ans -= l+i;
      |          ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{  
    int n,l,sum;
    scanf("%d%d",&n,&l);
    for(i=2;i<=n;++i)
    {
       sum+=(l+i-1);
    }
   
    printf("%d",sum);
}
    
    

Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'i' was not declared in this scope
    9 |     for(i=2;i<=n;++i)
      |         ^
Language: C++

 #include<bits/stdc++.h>

using namespace std;

int main(){
  int N,L;
  cin >> N >> L;
  int apple[N];
  int sum = 0;
  for(int i = 0; i < N; i++){
    apple[i] = L + i;
    sum += apple[i];
  }

  if(apple[N - 1] <= 0) sum -= apple[N - 1];
  else if(apple[0] < 0 && apple[N - 1] > 0) //何もしない
  else if(apple[0] >= 0) sum -= apple[0];

  cout << sum << endl;


 
  return 0;
}






Compiler output:
a.cc: In function 'int main()':
a.cc:17:3: error: expected primary-expression before 'else'
   17 |   else if(apple[0] >= 0) sum -= apple[0];
      |   ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,l;
  cin>>n>>l;
  int r=l+n-1;
  int eat;
  if(l>0){
eat=l;
  }
if(r<0){
eat=r;
}
else{
eat=0;
}
cout<<(l+r)*(n-1)/2<<endl;
}
return 0;
}


Compiler output:
a.cc:19:1: error: expected unqualified-id before 'return'
   19 | return 0;
      | ^~~~~~
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rp(i,n) for(int i=1;i<=(int)n;i++)
int main(){
int n,l;cin>>n>>l;
int s;
if(l+n-1<=0)s=l+n-1;
else if(l>=0)s=l;
else s=0;
int sum=0;
rep(i,n) sum+=a[i];
cout<<sum-s<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: 'a' was not declared in this scope
   13 | rep(i,n) sum+=a[i];
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rp(i,n) for(int i=1;i<=(int)n;i++)
int main(){
int n,l;cin>>n>>l;
int a[n];
rep(i,n) a[i]=l+i;
int sum=0;
rep(i,n) sum+=a[i];
rep(i,n) a[i]=abs(a[i]);
sort(a.begin(),a.end());
cout<<sum-a[0]<<endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:8: error: request for member 'begin' in 'a', which is of non-class type 'int [n]'
   13 | sort(a.begin(),a.end());
      |        ^~~~~
a.cc:13:18: error: request for member 'end' in 'a', which is of non-class type 'int [n]'
   13 | sort(a.begin(),a.end());
      |                  ^~~
Language: C++

#include <stdio.h>
int main(void){
  int n,l,i,sum=0;
  scanf("%d%d",&n,for&l);
  for(i=0;i<n;i++) sum+=l+i;
  if(l>0) printf("%d",sum-l);
  else if(l+n>=0) printf("%d",sum);
  else printf("%d",sum+l+n);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:19: error: expected primary-expression before 'for'
    4 |   scanf("%d%d",&n,for&l);
      |                   ^~~
Language: C++

#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>

using namespace std;

int main() 
{
	int N, L;
	cin >> N >> L;
	
  int min = 100 + 200 - 1, sum = 0;
	for (int i = 0; i < N; ++i) {
		int taste = L + (i + 1) - 1;
		if (abs(min) > abs(taste)) min = taste;
		sum += taste;
	}
	cout << sum - min << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'cin' was not declared in this scope
   12 |         cin >> N >> L;
      |         ^~~
a.cc:6:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    5 | #include <map>
  +++ |+#include <iostream>
    6 | 
a.cc:20:9: error: 'cout' was not declared in this scope
   20 |         cout << sum - min << endl;
      |         ^~~~
a.cc:20:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:30: error: 'endl' was not declared in this scope
   20 |         cout << sum - min << endl;
      |                              ^~~~
a.cc:6:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    5 | #include <map>
  +++ |+#include <ostream>
    6 |
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
	int A, B;
  	cin >> A >> B;
  	
  	int total = 0;
  	for(int i = 0; i < A; i++){
      total += B + i;
    }
    
  	if( B > 0 ) cout << total - B << endl;
  	else if( B =< 0 && A + B >= 0) cout << total << endl;
    else cout << total - (B  + A - 1)  << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: expected primary-expression before '<' token
   14 |         else if( B =< 0 && A + B >= 0) cout << total << endl;
      |                     ^
Language: C++

#include<iostream>

using namespace std;

int main()
{
  int n,l,sum=0,tmp;
  int min,axis;
  cin>>n>>l;
  //abs should be used.
  //l is the start value of the flavor.
  tmp=l;
  min=abs(l);
  axis=0;
  for(int i = 0;i<n;i++)
  {
    sum+=tmp;
    tmp++;
    if(abs(l+i)<min)
    {
      axis=i;
      min=abs(l+i);
    }
  }
  sum+=(l+i);
  
  
  cout<<sum<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:11: error: 'i' was not declared in this scope
   25 |   sum+=(l+i);
      |           ^
Language: C++

#include <bits/stdc++.h>
#define ll long long int
#define MOD 1000000007
#define INF 1e18
#define PI 3.14159265358979

using namespace std;

ll power(ll n, ll k){
  ll res = 1;
	while(k > 0){
		if (k & 1) 
      res = res * n % MOD;
		n = n * n % MOD;
		k >>= 1;
	}
	return res;
}

ll genfact(ll n, ll k){

  ll res = 1;
  while (k >= 0){
    res = (res * (n - k)) % MOD;
    k--;
  }

  return res;
}

ll inv(ll n){
  return power(n, MOD - 2);
}

ll fact(ll n){
  return genfact(n, n - 1);
}

ll nck(ll n, ll k){
  if (k == 0)
    return 1;

  return ((genfact(n, k) % MOD) * inv(fact(k))) % MOD;
}



int main(void){
  cin >> s;

  if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3])
    cout << "Bad" << endl;
  else
    cout << "Good" << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:10: error: 's' was not declared in this scope
   49 |   cin >> s;
      |          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,L;
  cin >> N >> L;
  int R = L+N−1;
  int eat;
  if(L>=0){
    eat = L;
  }else if(R<=0){
    eat = R;
  }else eat =0;
  
  cout << (L+R)*N/2-eat << endl;
  
}

Compiler output:
a.cc:10:13: error: extended character − is not valid in an identifier
   10 |   int R = L+N−1;
      |             ^
a.cc: In function 'int main()':
a.cc:10:13: error: 'N\U000022121' was not declared in this scope
   10 |   int R = L+N−1;
      |             ^~~
Language: C++

N,L=map(int,input().split())
taste=list(range(L,N+L))

taste2=[]
for i in range(N):
    taste2.append((taste[i])**2)

X=0
for i in range(N):
    if taste2[i]==min(taste2):
        X+=taste[i]
        
print(sum(taste)-X)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N,L=map(int,input().split())
      | ^
Language: C++

#include <bits/stdc+.h>
using namespace std;
int main(){
  int N,L;
  cin >> N >> L;
  int sum = 0;
  for (int i = 0; i < N; i++) sum += L + i;
  if (L <= 0 && N + L > 0){
    cout << sum;
  } else {
    int First = L;
    int Last = L + N - 1;
    if (abs(First) < abs(Last)){
      cout << sum - First;
    } else {
      cout << sum - Last;
    }
  }
}

Compiler output:
a.cc:1:10: fatal error: bits/stdc+.h: No such file or directory
    1 | #include <bits/stdc+.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
Language: C++

//保留所有权利。
#include<iostream>
#include<stdio.h>//printするよ
#include<vector>
#include<algorithm>//辞書順はnext_permutationだよ
#include<set>
#include<string>
#include<string.h>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<utility>//swapで数値交換するよ
//END OF LIBRARIES.
#define rt "\n"//改行を最速化させるよ
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define vcin(v) for (int i = 0; i < (v).size(); i++) { cin >> (v)[i]; }
#define sort(s) sort(s.begin(),s.end())
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define cncn int cnt=0
#define smsm int sum=0
#define str srting
#define nn int n=0
#define please return
#define AC 0//おまじないだよ
#define Rapid cin.tie(0);ios::sync_with_stdio(false)
//END OF DEFINE.
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vcha;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool; 
//END OF TYPEDEF.

//最大公約数（GCD）を求めるよ
//最小公倍数（LCM）は＜＜　A × B ÷ GCD　 ＞＞で求まるよ

long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}
long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}
//BEGIN OF CODE.
int main(void){
	int n, l;
	cin >> n >> l;
	asas,cncn;
	rep(i, n) {
		ans += l;
		l++;
	}
	if (l < 0) {
		cout << ans << rt
	}
	else if (l = 0) {
		cout << ans << rt;
	}
	else {
		cout << ans - l << rt;
	}
	please AC;
}
//THE END.

Compiler output:
a.cc: In function 'int main()':
a.cc:29:14: error: expected unqualified-id before 'int'
   29 | #define cncn int cnt=0
      |              ^~~
a.cc:67:14: note: in expansion of macro 'cncn'
   67 |         asas,cncn;
      |              ^~~~
a.cc:74:9: error: expected ';' before '}' token
   74 |         }
      |         ^
Language: C++

n, l = map(int, input().split())
a = 0
ap = []
abp = []
while a <= n-1:
    a += 1
    ap.append(l + a - 1)
    abp.append(abs(l + a - 1))
x = abp.index(min(abp))
ap.remove(ap[x])
print(sum(ap))


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n, l = map(int, input().split())
      | ^
Language: C++

//
//  main.cpp
//  ATcode131
//
//  Created by didi on 2020/1/16.
//  Copyright © 2020年 didi. All rights reserved.
//

#include <iostream>
#include <map>
#include <vector>
#include <set>
using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...
    int N, L;
    cin >> N >> L;
    int a = INT_MAX, b = INT_MIN;
    int sum = 0;
    for (int i = 0; i < N; ++i) {
        int k = L + i;
        sum += k;
        if (k >= 0) a = min(a, k);
        if (k <= 0) b = max(b, k);
    }
    if (b == INT_MIN || a < -b) {
        sum -= a;
    } else {
        sum -= b;
    }
    cout << sum;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:19:13: error: 'INT_MAX' was not declared in this scope
   19 |     int a = INT_MAX, b = INT_MIN;
      |             ^~~~~~~
a.cc:13:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   12 | #include <set>
  +++ |+#include <climits>
   13 | using namespace std;
a.cc:25:21: error: 'b' was not declared in this scope
   25 |         if (k <= 0) b = max(b, k);
      |                     ^
a.cc:27:9: error: 'b' was not declared in this scope
   27 |     if (b == INT_MIN || a < -b) {
      |         ^
a.cc:27:14: error: 'INT_MIN' was not declared in this scope
   27 |     if (b == INT_MIN || a < -b) {
      |              ^~~~~~~
a.cc:27:14: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<bits/stdc++.h>

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,n) for(int i=1; i<(n); i++)
#define pii pair<int,int>
#define gsort(x,n) sort((x),(x)+(n),greater<int>())
#define all(x) (x).begin(), (x).end()
#define int int64_t
#define ll long long
#define abs(a) llabs(a)
#define re(s) reverse((s).begin(),(s).end())
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const long long mod = 1000000007;
using namespace std;

signed main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    int n,m,cnt=0,ans=mod;
    cin>>n>>m;

    rep(i,n){
        cnt += m;
        ans = min(ans,abs(m));
        ++m;
    }
    if(cnt < 0) cout<<cnt+ans<<'\n';
    else cout<<cnt-ans<<'\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:18: error: no matching function for call to 'min(int64_t&, long long int)'
   27 |         ans = min(ans,abs(m));
      |               ~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:27:18: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   27 |         ans = min(ans,abs(m));
      |               ~~~^~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:27:18: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   27 |         ans = min(ans,abs(m));
      |               ~~~^~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;main(){int n,l,a;cin>>n>>l;a=0;for(int i=0;i<n;i++)a+=l+i;cout<<(l<=0&&0<=l+n-1?a:(0<l?a-l:a-l-n+1)));}

Compiler output:
a.cc:2:21: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | using namespace std;main(){int n,l,a;cin>>n>>l;a=0;for(int i=0;i<n;i++)a+=l+i;cout<<(l<=0&&0<=l+n-1?a:(0<l?a-l:a-l-n+1)));}
      |                     ^~~~
a.cc: In function 'int main()':
a.cc:2:121: error: expected ';' before ')' token
    2 | using namespace std;main(){int n,l,a;cin>>n>>l;a=0;for(int i=0;i<n;i++)a+=l+i;cout<<(l<=0&&0<=l+n-1?a:(0<l?a-l:a-l-n+1)));}
      |                                                                                                                         ^
      |                                                                                                                         ;
Language: C++

#include<bits/stdc++.h>
using namespace std;main(){int n,l,a;cin>>n>>l;ans=0;for(int i=0;i<n;i++) a+=l+i;if(l<=0&&0<=l+n-1) cout<<a;else if(0<l) cout<<a-l;else cout<<a-(l+n-1);}

Compiler output:
a.cc:2:21: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | using namespace std;main(){int n,l,a;cin>>n>>l;ans=0;for(int i=0;i<n;i++) a+=l+i;if(l<=0&&0<=l+n-1) cout<<a;else if(0<l) cout<<a-l;else cout<<a-(l+n-1);}
      |                     ^~~~
a.cc: In function 'int main()':
a.cc:2:48: error: 'ans' was not declared in this scope; did you mean 'abs'?
    2 | using namespace std;main(){int n,l,a;cin>>n>>l;ans=0;for(int i=0;i<n;i++) a+=l+i;if(l<=0&&0<=l+n-1) cout<<a;else if(0<l) cout<<a-l;else cout<<a-(l+n-1);}
      |                                                ^~~
      |                                                abs