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

#include <bits/stdc++.h>
using namespace std;
#define SORT(a) sort((a).begin(), (a).end())
#define RSORT(a) reverse((a).begin(), (a).end())
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;
const long long INF = 1LL << 60;
// const int INF=1010101010;
using Graph = vector<vector<int>>;
#define MOD 1000000007

int main() {
  long long n, k;
  cin >> n >> k;  // k個以上選ぶn
  long long total = 0;
  for (long long i = k; i <= n + 1; i++) {  //選ぶ個数
    total += (n - i + 1 + n) * i / 2 - (0 + i - 1) * i / 2 + 1;
    total %= MOD;
  }
  cout << total << endl;
}

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

#include <bits/stdc++.h>
#define f(n) ((n + 1LL) * (n) / 2)
using namespace std;
const int mod = 1e9 + 7;

int main() {

    int n, k; 
	cin >> n >> k;
    int ans = 1;
    
    for (int i = k; i <= n; i++) 
        ans = (ans + f(n) - f(n - i) - f(i - 1) + 1) % mod;
    
    cout << ans << endl;
    return 0;
}

Compiler output:
main.c: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>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <iomanip>
#include <map>
#include <queue>
#include <list>


#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
//#define RREP(i, n ,N) for(ll i = (N-1); i >= (n); i--)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define INF 1e9
#define vint vector<int>

using namespace std;
typedef long long  ll;

const long long M = 1e9+7;

vector<ll> fac(300001); //n!(mod M)
vector<ll> ifac(300001); //k!^{M-2} (mod M)
//a,bの範囲的にこれだけ配列を用意していけば十分

ll mpow(ll x, ll n){ //x^n(mod M) ←普通にpow(x,n)では溢れてしまうため，随時mod計算
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}

ll comb(ll a, ll b){ //aCbをmod計算
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}

int main()
{
    ll n,k;
    cin >> n >> k;

    //大した量ではないので，先にfax[i]とifax[i]を全て計算しておく
    fac[0] = 1;
    ifac[0] = 1;
    for(ll i = 0; i<=200000; i++){
        fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
        ifac[i+1] = ifac[i]*mpow(i+1, M-2) % M; // k!^{M-2} (mod M) ←累乗にmpowを採用
    }

    ll ans = 0;
    ll tmp = 0;
    ll under = 0;
    ll top = 0;
    for(ll i = 0; i < k; i++){
        under += i;
        top += n - i;
    }
    for(ll i = k; i <= n+1; i++){

        tmp = comb(n+1, i);
//        p(tmp);
        ans += min((top - under + 1) % M, tmp % M);
//        max = 0;
        under += i;
        top += n - i;
    }

//    ans = comb(n, k);

    p(ans%M);
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bug1( x ) cout << (#x) <<"="<< x << endl;
#define bug2( x , y ) cout << (#x) <<"="<< (x) << "    " << (#y) << "="<< (y) << endl;
#define bug3( x , y , z ) cout << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << endl;
#define bug4( x , y , z , w) cout << (#x) <<"="<<(x) << "    " << (#y) <<"="<< (y) << "    " << (#z) <<"="<< (z) << "    " << (#w) <<"="<< w << endl;
#define bugn( x , n ){ cout<<(#x)<<":";for(int i=0;i<n;i++)cout<<(#x)<<"["<<i<<"]:"<< x[i] << "    "; cout<<endl;}
#define bugnm( x , n , m ){ cout<<(#x)<<endl;for(int i=0;i<n;i++){ cout<<"Row #"<<i<<":"; for(int j=0;j<m;j++) cout<<x[i][j]<<"     "; cout << endl;}}
using namespace std;	


const int MOD = 1e9+7;
int RangeSum(int n){
	return n * ( n + 1)/2;
}
int32_t main()
{
    IOS
    int n,k;cin>>n>>k;
    int ans = 0;
    for(int i=k;i<=n+1;i++){
		int minsum =  RangeSum(i-1);
		int maxsum =  RangeSum(n) - RangeSum(n-i);
		minsum%=MOD;
		maxsum%=MOD;
		ans+=  ( maxsum - minsum + 1 +MOD )%MOD;
		ans%= MOD;
		//bug3(i,minsum,maxsum);
	}
	cout << ans << endl;
   
}

				
			
	

	
			
	
	
	
	
	

	

	

	
		


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

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

const mod = 1000000007;

int main() {
  int n,k;
  cin >> n >> k;
  
  long ans = 0;
  for(int i=k; i<=n; i++){
    long a = (1 + i + n*i -i*i) % mod;
    ans = (ans + a) % mod;
  }
  cout << ans << endl;
}
  


Compiler output:
a.cc:4:7: error: 'mod' does not name a type
    4 | const mod = 1000000007;
      |       ^~~
a.cc: In function 'int main()':
a.cc:12:35: error: 'mod' was not declared in this scope; did you mean 'modf'?
   12 |     long a = (1 + i + n*i -i*i) % mod;
      |                                   ^~~
      |                                   modf
Language: C

//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <complex>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

struct Mod {
    static uint64_t PRIME;
    struct LocalPrime {
        uint64_t backup;
        LocalPrime(uint64_t prime) { backup = exchange(Mod::PRIME, prime); }
        ~LocalPrime() { Mod::PRIME = backup; }
    };
    uint64_t value = 0;
    Mod()
    : value(0) {}
    Mod(ll v) {
        if (v >= 0) {
            value = v % PRIME;
        } else {
            value = PRIME - (-v) % PRIME;
        }
    }
    Mod operator+(const Mod& rhs) const { return Mod(*this) += rhs; }
    Mod& operator+=(const Mod& rhs) {
        value += rhs.value;
        if (value >= PRIME) {
            value -= PRIME;
        }
        return *this;
    }
    Mod operator-(const Mod& rhs) const { return Mod(*this) -= rhs; }
    Mod& operator-=(const Mod& rhs) {
        if (value < rhs.value) {
            value += PRIME;
        }
        value -= rhs.value;
        return *this;
    }
    Mod operator*(const Mod& rhs) const { return Mod(*this) *= rhs; }
    Mod& operator*=(const Mod& rhs) {
        value = (value * rhs.value) % PRIME;
        return *this;
    }
    Mod inv() const { return power(*this, PRIME - 2); }
    Mod operator/(const Mod& rhs) const { return Mod(*this) /= rhs; }
    Mod& operator/=(const Mod& rhs) {
        *this *= rhs.inv();
        return *this;
    }
    static Mod power(Mod rhs, ll exp) {
        Mod ans = 1;
        while (exp > 0) {
            if (exp % 2) {
                ans *= rhs;
            }
            rhs *= rhs;
            exp /= 2;
        }
        return ans;
    }
};
uint64_t Mod::PRIME = 1000000007;

int main() {
    ll N, K;
    cin >> N >> K;
    Mod ans = 0;
    rep(k,K,N+2) {
        ll mn = (k * (k-1)) / 2;
        ll mx = (k * (2 * N - (k - 1))) / 2;
        ll cnt = mx - mn + 1;
        ans += cnt;
    }
    cout << ans.value << endl;
}


Compiler output:
main.c:5:10: fatal error: algorithm: No such file or directory
    5 | #include <algorithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
using namespace std;
 
int main() {
	int NumSum=0;
  
  	int N, k;
  	cin >> N >> k;
  	
  	for(int i=k;i<=N+1;i++){
    	NumSum+=((N+N-(i-1))*i/2)-((i-1)*i/2)+1;
    }
  	NumSum%=pow(10, 9)+7;
  	cout << NumSum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   15 |         NumSum%=pow(10, 9)+7;
      |         ~~~~~~^~~~~~~~~~~~~~
a.cc:15:15: note:   in evaluation of 'operator%=(int, __gnu_cxx::__promote<double>::__type {aka double})'
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
using namespace std;
 
int main() {
	int NumSum=0;
  
  	int N, k;
  	cin >> N >> k;
  	
  	for(int i=k;i<=N+1;i++){
    	NumSum+=((N+N-(i-1))*i/2)-((i-1)*i/2)+1;
    }
  	NumSum%=pow(10, 9)+7
  	cout << NumSum << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:15:15: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   15 |         NumSum%=pow(10, 9)+7
      |         ~~~~~~^~~~~~~~~~~~~~
a.cc:15:15: note:   in evaluation of 'operator%=(int, __gnu_cxx::__promote<double>::__type {aka double})'
Language: C

#include <bits/stdc++.h>
#define ALL(A) (A).begin(), (A).end()
#define ll long long
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };  // i<4:4way i<8:8way
int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };

const ll mod = 1e9 + 7;
const ll INF = -1 * ((1LL << 63) + 1);
const int inf = -1 * ((1 << 31) + 1);

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n,k;
    cin >> n >> k;
    ll ans = 0;
    for(ll i=k;i<=n+1;i++){
        // i個選ぶとする
        ll mn = (i-1)*i/2LL;
        ll mx = (n + n - i + 1) * i / 2LL;
        ans += (mx - mn + 1 + mod);
        ans %= mod;
        // 最低値は(0+i-1)*i/2;
        // 最大値は (n + n-i) *i /2;
    }
    cout << ans << endl;
}

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

#include <iostream>

using namespace std;

int n, k;
long long maxsum, minsum, sum[200001], r;
int mod = 1000000007;

int main()
{
  cin >> n >> k;
  for (int i = 1; i <= n; i++)
    sum[i] = sum[i - 1] + i;
  for (int i = k; i <= n + 1; i++) {
    minsum = sum[i - 1];
    maxsum = sum[n] - sum[n - i];
    r += (maxsum - minsum + 1);
    r %= mod;
  }
  cout << r % mod;
  return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

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

long long calc(long long a, long long b) {
  return (a+b) * (b-a+1) / 2;
}

long long main() {
  long long n, k;
  long long count = 0;
  long long MOD = 1000000007;
  cin >> n >> k;
  for (long long i = k; i <= n+1; i++) {
    count += calc(n-i+1, n) - calc(0, i-1) + 1;
    count %= MOD;
  }
  cout << count % MOD << endl;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C

#include <bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

int const MOD = 1e9 + 7;

int main() {
  int N, K; cin >> N >> K;
  ll ans = 0;
  REP(k, K, N + 2) {
    ans += (ll)(N - k + 1 + N) * k / 2 - (ll)(k - 1) * k / 2 + 1;
    ans %= MOD;
  }
  cout << ans << endl;
}


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

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

int main() {
  int n, k;
  int count = 0;
  int MOD = 10 ** 9 + 7;
  cin >> n >> k;
  for (int i = k; i < n+2; i++) {
    count += (i * (n-i+1) + 1) % MOD;
  }
  cout << count << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:17: error: invalid type argument of unary '*' (have 'int')
    7 |   int MOD = 10 ** 9 + 7;
      |                 ^~~
Language: C

#include <iostream>
#include <cmath>
using namespace std;

int main(){
    long long n, k;
    cin >> n >> k;
    const int MOD = 1000000007;
    long long add;
    long long sum = 0;

    for(long long i=k;i<=n+1;i++){
        long long minsum = i * (i - 1) / 2;
        long long maxsum = i * ((2 * n) - i + 1) / 2;
        add = maxsum - minsum + 1;
        sum = (sum + add) % MOD;
    }
    cout << sum << endl;
    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
using namespace std;

int main(){
    long long n, k;
    cin >> n >> k;
    const int MOD = 1000000007;
    long long add;
    long long sum = 0;

    for(long long i=k;i<=n+1;i++){
        long long minsum = i * (i - 1) / 2;
        long long maxsum = i * ((2 * n) - i + 1) / 2;
        add = maxsum - minsum + 1;
        sum = (sum + add) % MOD;
    }
    cout << sum << endl;
    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

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

int main(){
    long long n, k;
    cin >> n >> k;
    const int MOD = 1000000007;
    long long add;
    long long sum = 0;

    for(long long i=k;i<=n+1;i++){
        long long minsum = i * (i - 1) / 2;
        long long maxsum = i * ((2 * n) - i + 1) / 2;
        add = maxsum - minsum + 1;
        sum = (sum + add) % MOD;
    }
    cout << sum << endl;
    return 0;
}

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

#include<iostream>
using namespace std;

int main(){
    long long n, k;
    cin >> n >> k;
    const int MOD = 1000000007;
    long long add;
    long long sum = 0;

    for(long long i=k;i<=n+1;i++){
        long long minsum = i * (i - 1) / 2;
        long long maxsum = i * ((2 * n) - i + 1) / 2;
        add = maxsum - minsum + 1;
        sum = (sum + add) % MOD;
    }
    cout << sum << endl;
    return 0;
}

Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

#define INF 1e9
#define MAXN 100005
#define MOD 1000000007
#define ll long long
#define vi vector<int>
#define vll vector<long long>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pii pair<int, int>

ll ans = 0, N, K, minVal, maxVal;

vector<ll> csum;

void solve(){
    for(int k = K; k <= N+1; ++k){
        maxVal = csum[N+1] - csum[N+1-k];
        minVal = csum[k] - csum[1];
        // cout << maxVal << " - " << minVal << endl;
        ans += maxVal - minVal + 1;
        ans %= MOD;
    }

    cout << ans << endl;
}

int main(){
    cin >> N >> K;

    csum.resize(N+1);

    csum[0] = 0;
    rep(i, N+1) csum[i+1] = csum[i] + i;

    // cout << csum[2] << endl;

    solve();
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  long long int n,k,ans=0,mod=1000000007;
  cin>>n>>k;
  for(long long int i=k;i<=n+1;i++)
  {
    ans=(ans+i*(n+1-i)+1);
    ans=ans%mod;
  }
  cout<<ans;

Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: expected '}' at end of input
   13 |   cout<<ans;
      |             ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main()
{
	int N;
	cin >> N;

	int K;
	cin >> K;

	int ans = 0;

	for (int i = K; i < N; i++)
	{
		ans += method(N) / method(i);
	}

	return ans;
}

int method(int x)
{
	if (x > 1)
	{
		return x * method(x - 1);
	}
	else
	{
		return 1;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:24: error: 'method' was not declared in this scope
   17 |                 ans += method(N) / method(i);
      |                        ^~~~~~
Language: C++

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

int main(){
	int N,K;
	cin>>N>>K;
	int M=N+2;
	int cnt=0;
	for(int i=K;K<M;i++){
		int max=K*(2*(N+1)-(K-1))/2;
		int min=K*(K-1)/2;
		int sum=max-min+1;
		cnt+=sum;
	}
	count<<cnt<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<<'
   15 |         count<<cnt<<endl;
      |         ~~~~~^~~~~
Language: C++

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

int main(){
	int N,K;
	cin>>N>>K;
	int M=N+2;
	int cnt=0;
	for(int i=K;K<M;i++){
		int max=K*(2*(N+1)-(K-1))/2;
		int min=K*(K-1)/2
		int sum=max-min+1;
		cnt+=sum;
	}
	count<<cnt<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: expected ',' or ';' before 'int'
   12 |                 int sum=max-min+1;
      |                 ^~~
a.cc:13:22: error: 'sum' was not declared in this scope
   13 |                 cnt+=sum;
      |                      ^~~
a.cc:15:14: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<<'
   15 |         count<<cnt<<endl;
      |         ~~~~~^~~~~
Language: C++


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

int main() {

	long long N, K;
	cin >> N >> K;

	long long base = pow(10, 9) + 7;

	long long ans = 0;
	long long v_max = 0;
	long long v_min = 0;
	for (long long i = K; i <= (N + 1); i++) {
		v_min = i * (i - 1) / 2;
		v_min = v_min % base;
		v_max = (N + 1) * N / 2 - (N - i) * (N - i + 1) / 2;
		v_max = v_max % base;
		ans += v_max - v_min + 1;
		ans = ans % base;
		if (ans < 0) {
			ans = base + ans;
		}
	}

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:26: error: 'pow' was not declared in this scope
   12 |         long long base = pow(10, 9) + 7;
      |                          ^~~
Language: C

#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<long long, long long> pllll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector< pair<int, int> > vii;
typedef vector< pair<long long, long long> > vllll;
typedef map<int, int> mii;
typedef map<long long, long long> mllll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0ll)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
#define bitsum(x) __builtin_popcount(x)
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  ll n, k;
  cin >> n >> k;
  // ll n, m, k;
  // cin >> n >> m >> k;
  for(ll i = k; i <= n + 1; i++) {
    ll buttom = i * (i - 1) / 2;
    ll top = i * (2 * n - i + 1) / 2;
    // printf("%lld %lld\n", buttom, top);
    (ans += (top - buttom + 1)) %= MOD;
  }
  cout << ans << endl;
  return 0;
}



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

#include <bits/stdc++.h>
#define r(i,n) for(int i = 0; i<n; i++)
typedef long long ll;
using namespace std;
const ll mod=1000000007;

int main() {
  ll n,k;
  cin >> n >> k;
  ll s[n+1]={};
  r(i,n)s[i+1]=s[i]+i+1;
  ll ans=0;
  for(int i=k;i<=n+1;i++){
    if(i==n+1)ans+=1;
    else{
      ans+=(s[n]-s[n-i])-s[i-1]+1;
    }
  }
  cout<<ans%mod<<endl;
}

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

#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define sec second
#define fir first
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;};
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;};



signed main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	
	int n, k;
	cin >> n >> k;
	int left = 0, right = 0;
	int res = 0;

	for(int i = 1; i <= n+1; i++) {
		left += i - 1;
		right += n - (i - 1);
		if(i >= k) {
			res += (right - left + 1);
			res %= MOD;
		}
	}
	cout << res << endl;
	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define all(v) v.begin(), v.end()
ll gcd(ll a,ll b) {
  return b? gcd(b,a%b): a;  
}
ll lcm(ll a,ll b) {
  return a*b/gcd(a,b);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string outputYesNo(bool ans){
  return (ans?"Yes":"No");
}
const ll mod=1000000007;
int main() {
  ll n,k;cin>>n>>k;
  ll ans=0;
  for(int i=k;i<n+2;i++){
    ans+=i*(n-i+1)+1;
    ans%=mod;
  }
  cout<<ans%mod<<endl;
  return 0;
}

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

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

#pragma GCC optimize "trapv"
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(int i=a; i<b; i++)
#define drep(i,a,b) for(int i=a; i>b; i--)
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define inf 1e+18L
#define mod 1000000007

const auto pi = 3.14159265358979;

template <typename T>
T numdigits(T n)
{
    return (floor(log10(n)) + 1);
}

template <typename T>
T modpower(T x, T y, T m=mod)
{
    T res = 1;
    x %= m;
    if(x == 0) return 0;
    while(y > 0)
    {
        if(y&1) res = (res*x)%m;
        y >>= 1;
        x = (x*x)%m;
    }
    return res;
}

void solve()
{
    //code
    ll n, k;
    cin >> n >> k;
    cout << ((2*k*k*k-3*k*k*n-6*k*k+3*k*n-2*k+n*n*n+3*n*n+8*n+12)/6)%mod;
}

int main()
{
    FASTIO
//    int t;
//    cin >> t;
//    while(t--)
        solve();
    return 0;
}


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

#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1e+9;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}




int main() {
  int N,K;
  cin >> N >> K;
  ll ans = 0;
  for(int i = K; i <= N+1; i++) {
    ll l = i*(2*N-i+1)/2;
    l%=mod;
    ll r = i*(i-1)/2;
    r%=mod;
    if(l-r<=0) l+=mod;
    ans += l - r + 1;
    ans %= mod;
  }
  
    
  

  
  cout << ans << endl;
}


Compiler output:
main.c:1:10: fatal error: algorithm: No such file or directory
    1 | #include <algorithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C

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

int main(){
  
  int N, K;
  long long Sum = 0;
  cin >> N >> K;

  for (int i = K; i < N + 2; i++){
    
    Sum += i * ((N + N - i + 1)/2 - (0 + i - 1) /2) + 1;
  }
  cout << Sum << endl;
}

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

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <climits>
#include <utility>
typedef long long ll;
using namespace std;

const ll MOD = 1e9 + 7;

int main(void){
  ll n, k, i;
  ll sum = 0;

  cin >> n >> k;

  ll right, left;
  right = (k-1) * k / 2;
  left = (n+n-k+1) * k / 2;

  for(i=k;i<=n+1;i++){
    sum += (left-right+1);
    sum %= MOD;

    right += i;
    right %= MOD;
    left += (n-i);
    left %= MOD;
  }

  if(sum<0) sum += MOD;

  cout << sum << endl;

  return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main()
{
    ll n, k; cin >> n >> k;

	ll ans = 0;

	for (ll i = k; i <= n + 1; i++) {

		ll minSum = i * (i - 1) / 2;
		ll maxSum = i * n - minSum;

		ans = (ans + (maxSum - minSum + 1) % mod) % mod;

	}

	cout << ans << endl;

    return 0;

}

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

	#include<bits/stdc++.h>
	using namespace std;
	#define fo(i,n) for(int i=0;i<n;i++)
	#define pb push_back
	#define mp map<int,int>
	#define ump unordered_map<int,int>
	#define vi vector<int>
	#define M INT_MAX
	#define MI INT_MIN
	#define ll long long int
	#define pii pair<int,int>
	#define F first
	#define S second
	#define fall(i,a,b) for(int i=a;i<b;i++)
	#define pi 3.1415926535
	ll MOD=1e9+7;
	void solve()
	{
			ll n,k,ans=0;
			cin>>n>>k;
                  
			ll arr[n+10];
			arr[0]=0;
			for(int i=1;i<=(n+1);i++)
			arr[i]=arr[i-1]+i;

			for(int i=k;i<=(n+1);i++)
			{
				ll mini=arr[i];
				ll maxi=arr[n+1]-arr[n-i+1];
				ans+=(maxi-mini+1);
				ans%=MOD;
			}
			cout<<ans<<endl;
	}
	int main()
	{
		ios_base::sync_with_stdio(false);
	      cin.tie(NULL);
		solve();
	}

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

/**
 *    author:  math2do
 *    created: 20.04.2020 15:36:09 IST
**/

#include <bits/stdc++.h>

using namespace std;

const int mod = (int) (1e9 + 7);

inline int mul(int a, int b) {
  long long res = (long long) a * b;
  a = (int) (res % mod);
  if (a < 0) {
    a += mod;
  }
  return a;
}

inline int power(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = mul(res, a);
    }
    b >>= 1;
    a = mul(a, a);
  }
  return res;
}

inline void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

inline void sub(int &a, int b) {
  a -= b;
  if (a < 0) {
    a += mod;
  }
}

const int N = 2 * (int) (1e5) + 1;
int fact[N + 1];
int ifact[N + 1];

inline int inv(int x) {
  return power(x, mod - 2);
}

void pre_process() {
  fact[0] = 1;
  for (int i = 1; i <= N; i++) {
    fact[i] = mul(fact[i - 1], i);
  }
  for (int i = 0; i <= N; i++) {
    ifact[i] = inv(fact[i]);
  } 
}

inline nCr(int n, int r) {
  int temp = mul(fact[n], ifact[n - r]);
  int res = mul(temp, ifact[r]);
  return res;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  pre_process();
  int n, k;
  cin >> n >> k;
  int ans = 0;
  for (int r = k; r <= n + 1; r++) {
    int ret = nCr(n + 1, r);
    add(ans, ret);
    sub(ans, max(0, n - r));
  } 
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc:65:8: error: ISO C++ forbids declaration of 'nCr' with no type [-fpermissive]
   65 | inline nCr(int n, int r) {
      |        ^~~
Language: C++

#include <bits/stdc++.h>
#define int long long
 
using namespace std;
 
const int mod = 1e9 + 7;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, k, ans = 0;
    cin >> n >> k;
    for (int i = k; i <= n + 1; ++i) {
        ans = (ans + i * (n - i + 1) + 1) % mod;
    }
    cout << ans;
    return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <iostream>

using namespace std;


int main()
{
	int N, K;
	cin >> N >> K;

	int ans = 0;
	int max = 0, min = 0;
	int mod = pow(10, 9) + 7;

	// Initialize max, min values
	for (int i = 0; i < K; ++i)
	{
		max += N - i;
		min += i;
	}

	// Calculate ans
	for (int i = K; i <= N; ++i)
	{
		ans += (max - min + 1) % mod;

		// Update max, min values
		max += N - i;
		min += i;
	}
	ans += 1;

	cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: 'pow' was not declared in this scope
   13 |         int mod = pow(10, 9) + 7;
      |                   ^~~
Language: C

#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
using namespace std;
using ll = long long;
using ull = long long unsigned;
using P = pair<ll,ll>;
//const int 1001001001;
const int NMAX=8;
const int MOD=1000000007;
const int dbase=80*160;

int main(){
	int n,k;
	cin>>n>>k;
	vector<int> l(n+1);
	vector<int> r(n+1);
	int cnt=0;
	for(int i=0;i<=n;i++){
		cnt+=i;
		cnt%=MOD;
		l[i]=cnt;
	}
	cnt=0;
	for(int i=n;i>=0;i--){
		cnt+=i;
		cnt%=MOD;
		r[i]=cnt;
	}
  int ans=0;
  for(int i=k;i<=n+1;i++){
		ans+=r[n-i+1]-l[i-1]+1;
	//	cout<<ans<<endl;
		ans%=MOD;
	}
	cout<<ans;







}


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

#include <iostream>

using namespace std;

typedef long long ll;

const ll mod = 1e9 + 7;

ll n;
ll k;
ll fsum;
ll bsum;
ll ans;
int main() {
  cin >> n >> k;

  for(int i = 0; i < k; i++) fsum += i;
  for(int i = n; i > n - k; i--) bsum += i;
  ans += bsum - fsum + 1;
  for(int i = k; i <= n; i++) {
    fsum += i;
    bsum += n - i;
    ans += bsum - fsum + 1;
  }

  cout << ans % mod << endl;
}
  
 


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repeq(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define rep1eq(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using Int = long long;

const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    ll n,k;
    cin >> n >> k;
    ll ans=0,m=0,M=n;
    rep1(i,2,n+2){
        m = m+(i-1);
        M = M+n-(i-1);
        //cout << "m:"<<m<<" M:"<<M<<endl;
        if(i>=k){
            ans += (M-m+1); 
        }
    }

    ans = ans%MOD;
    cout << ans << endl;
    return 0;
    
}

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

#include<stdio.h>

int mod(int num, int need) {
	int patan = 0;
	int min = 0, max = 0;

	//�ŏ��l�ƍő��l�����߂��΂���

	//�ŏ��l
	for (int i = 0; i < need; i++)
		min += i;

	//�ŏ��l
	for (int i = 1; i <= need; i++)
		max += num - i;

	return max - min + 1;
}

int main(void) {
	int n, k, i, num = 0;

	scanf_s("%d%d", &n, &k);

	for (i = 0; i < (n + 1) - (k - 1); i++) {
		num += mod(n + 1, k + i);
	}

	printf("%d\n", num);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:23:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   23 |         scanf_s("%d%d", &n, &k);
      |         ^~~~~~~
      |         scanf
Language: C++

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

int main() {
	int n,k;
	cin>>n>>k;
	
	ll ans=0;
	for(int i=k;i<=n+1;i++){
		ll max,min;
		max=(2*n+1-i)*i/2;
		min=(i-1)*i/2;
		ans+=max-min+1;
	}
	
	cout<<ans%(pow(10,9.0)+7)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: invalid operands of types 'll' {aka 'long long int'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   18 |         cout<<ans%(pow(10,9.0)+7)<<endl;
      |               ~~~^~~~~~~~~~~~~~~~
      |               |               |
      |               |               __gnu_cxx::__promote<double>::__type {aka double}
      |               ll {aka long long int}
Language: C++

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

int main() {
	int n,k;
	cin>>n>>k;
	
	ll ans=0;
	for(int i=k;i<=n+1;i++){
		ll max,min;
		max=(2*n+1-i)*i/2;
		min=(i-1)*i/2;
		ans+=max-min+1;
	}
	
	cout<<ans%(pow(10,9)+7)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:18: error: invalid operands of types 'll' {aka 'long long int'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   18 |         cout<<ans%(pow(10,9)+7)<<endl;
      |               ~~~^~~~~~~~~~~~~~
      |               |             |
      |               |             __gnu_cxx::__promote<double>::__type {aka double}
      |               ll {aka long long int}
Language: C

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

int main() {
	int n,k;
	cin>>n>>k;
	
	ll ans=0;
	for(int i=k;i<=n+1;i++){
		ll max,min;
		max=(2*n+1-i)*i/2;
		min=(i-1)*i/2;
		ans+=max-min+1;
	}
	
	cout<<ans<<endl;
}


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

#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define int long long
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << '\n'; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
const ll MOD = 1e9 + 7 ;
const ll N = 2e5 + 10 ;
const ll INF = 1e18 + 10 ;
const double pi = acos(-1) ;
int sum(int x){
    return x * ( x + 1) / 2;
}
int fix(int x){
    return (x % MOD + MOD) % MOD ;
}
signed main(){
    fastio
    int n , k ;
    cin >> n >> k ;
    // 0 1 2 3
    n++;
    int ans = 0 ;
    for(int i = k; i <= n; i++){
        int nix = sum(i - 1) ;
        int nax = sum(n - 1) - sum(n - i - 1) ;
        ans += nax - nix + 1;
        ans = fix(ans) ;
    }
    cout << ans << endl;
    return 0 ;
}

Compiler output:
main.c:4:10: fatal error: bits/stdc++.h: No such file or directory
    4 | #include "bits/stdc++.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C

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

int main() {
  long long N;
  long long K;
  cin>>N>>K;
  long long sum=0;
  for(long long i=K;i<N+2;i++){
    sum +=i*(N+1-i)+1 ;
   
  }
  cout<<sum%1000000007<<endl;
}




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

#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> P;
typedef priority_queue<P,vector<P>,greater<P>> P_queue;

#define REP(i,a,b) for(int i=(int)a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define mp make_pair
#define ALL(a) a.begin(),a.end()
#define SORT(a) sort(ALL(a))
#define U_ERASE(V) V.erase(unique(ALL(V)), V.end());

const ll MOD=998244353;
const ll mod=1000000007;
const ll INF=1e15;
vec dx={1,0,-1,0};
vec dy={0,1,0,-1};

int main(){
    ll N,K; cin>>N>>K;
    ll ans=0;
    REP(i,K,N+2){
        ans+=(i*(N-i+1));
        ans++;
        ans%=mod;
    }
    cout<<ans<<endl;
}

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

#include <iostream>//cout<<right で右揃え
#include <iomanip>//cout<<setw(数字) で空白による桁揃え
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstdlib>//abs()で整数絶対値
#include <cmath>//abs()かfabs()で少数絶対値
#include <functional>//sort第三引数greater<型名>()で降順

#define M 1000000007

using namespace std;
using ll = long long int;

int main(){
    int N,K;cin>>N>>K;
    ll sum = 0;
    for(ll i=K;i<=N+1;i++){
        ll min = i * (i - 1) / 2;
        ll max = i * (N - (i - 1) + N) / 2;
        sum += max - (min - 1);
        sum %= M;
    }
    cout << sum << endl;
    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>//cout<<right で右揃え
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <iostream>
using namespace std;

int main(){

    int n, k, i, j;
    long int sum=0, a=0, b=0;
    cin >> n >> k;

    
    for(i=k;i<=n+1;i++){
        for(j=0;j<i;j++){
            a += j;
            b += n-j;
        }
        sum += b-a+1;
        a=0; b=0;
    }

    cout << sum << endl;

    return 0;
}

Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <bits/stdc++.h>
#define rep(i,n)    for(int i = 0; i < (n) ; ++i)
#define orep(i,n)   for(int i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(int i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()   // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

const int mod = 1000000007;
int main() {
  ll n,k;
  cin >> n >> k;

  ll res = 0;
  for(ll i = k; i < n+2;i++) {
    ll mn = (i-1)*i/2;
    ll mx = i*(2*n-i+1)/2;
    res += mx - mn + 1;
    res = res % mod;
  }
  if(res<0) res+= mod;
  cout << res << endl;

  return 0;
}


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

#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <cstdio>

using namespace std;


double lowerSum[200001];
double upperSum[200001];

int main()
{
	int n, k;

	cin >> n >> k;

	long ans = 0;
	lowerSum[0] = 0;
	upperSum[0] = 0;

	for (int i = 0; i <= n; ++i)
	{
		lowerSum[i + 1] = lowerSum[i] + i;
		upperSum[i + 1] = upperSum[i] + (n - i);
	}



	for (int i = k; i <= n; ++i)
	{
		double t = upperSum[i] - lowerSum[i] + 1;
		ans = (double(ans) + t) - floor( (double(ans) + t) / 1000000007 ) * 1000000007;
	}
	ans = (ans + 1) % 1000000007;

	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:43: error: 'floor' was not declared in this scope
   35 |                 ans = (double(ans) + t) - floor( (double(ans) + t) / 1000000007 ) * 1000000007;
      |                                           ^~~~~
Language: C

#include <bits/stdc++.h>
using intl = long long;
using itnl = long long;
using itn = int;
using ld = long double;
using namespace std;
#define rep(i, n) for(intl i = 0; i < (intl)(n); i++)
#define rrep(i, n) for(intl i = (intl)(n) - 1; i >= 0; i--)
#define repi(i, a, b) for(intl i = (intl)(a); i < (intl)(b); i++)
#define rrepi(i, a, b) for(intl i = (intl)(a); i > (intl)(b); i--)
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,1,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define alength(a) (sizeof(a) / sizeof(a[0]))
#define cin(i, a) rep(i, alength(a))cin >> a[i]
#define ccin(i, j, a) rep(i, alength(a))rep(j, alength(a[i]))cin >> a[i][j]
#define debug(x) cout << #x << ":" << x << endl
#define rdebug(i,x) rep(i, alength(x))cout << #x << "[" << i << "]:" << x[i] << endl
#define sqrt sqrtl
#define itn int
#define double ld
#define pb push_back
#define mp make_pair
#define pii pair<intl,intl>
const intl INF = 1e9;
const intl MOD = 1e9+7;
const ld EPS = 1.0e-14;//-9
const ld PI = 3.141592653589;
void fp(bool f){cout << (f ? "Yes" : "No") << endl;}
void fp(bool f, string s, string t){cout << (f ? s : t) << endl;}
intl kai(intl k){
    intl a = 1;
    for(int i = 2; i <= k; i++){
        a *= i;
    }
    return a;
}
intl gcd(intl a, intl b){
    if(!b)return a;
    return gcd(b, a % b);
}
intl lcm(intl a,intl b){
    return a / gcd(a, b) * b;
}
intl digit10(intl a){
    intl b = 0;
    do{
        a /= 10;
        b++;
    }while(a);
    return b;
}
signed main(){
    cout << fixed << setprecision(10);
    intl n,k;
    cin >> n >> k;
    intl cnt = 0;
    repi(i,k,n+2){
        intl large =  0.5 * n * (n + 1) - 0.5 * (n - i) * (n + 1 - i);
        intl small = 0.5 * i * (i + 1) - i;
        cnt += large - small + 1;
        cnt %= MOD;
    }
    cout << cnt << endl;
    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
#define m 1000000007
int main(){
  long long n,k;
  cin>>n>>k;
  long long res=0;
  for(long long i=K;i<=n+1;i++){
    long long first=i*(i-1)/2;
    long long second=(n*2-i+1)*i/2;
    long long tot=sec-first+1;
    res=(res+tot)%MOD;
  }
  cout<<res<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:19: error: 'K' was not declared in this scope
    8 |   for(long long i=K;i<=n+1;i++){
      |                   ^
a.cc:11:19: error: 'sec' was not declared in this scope
   11 |     long long tot=sec-first+1;
      |                   ^~~
a.cc:12:19: error: 'MOD' was not declared in this scope
   12 |     res=(res+tot)%MOD;
      |                   ^~~
Language: C++

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

const int mod = 1e9 + 7;
int main()
{
	int n, k;
	scanf_s("%d%d", &n, &k);
	long long  ans = 0;
	for (int i = k; i <= n; i++)
		ans += 1LL * (n - i + 1 + n)*i / 2 - 1LL * (i - 1)*i / 2 +1;
	ans++;
	ans %= mod;
	printf("%lld\n", ans);
}
//int

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   10 |         scanf_s("%d%d", &n, &k);
      |         ^~~~~~~
      |         scanf