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

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;//n乗を効率的に求める
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n/2);
  x *= x;
  if (n%2 == 1) x *= 2;
  return x;
}

mint choose(int n, int a) {
  mint x = 1, y = 1;
  rep(i,a) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}



int main() {
  int n, k;
  cin >> n >> k;
  mint a=k*(k-1)/2;
  mint b=(2*n-k+1)*k/2;
  mint ans=b-a+1;
  mint kans=ans;
  
  for (int i=k+1; i<=n+1; i++) {
      kans+=n-i*2+2;
    ans+=kans;
    
  }
  cout << ans.x << 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;
 
int main(){
  ll ans,n,k,i,a,b,j;
  cin >> n >> k;
  ans=0;
  a=0;
  b=0;
  for(j=0;j<k;j++){
      a+=j;
      b+=n-j;
  }
  ans+=b-a+1;
  ans=ans%1000000007;
  for(i=k;i<=n;i++){
    a+=i;
    b+=n-i;
    ans+=b-a+1;
    ans=ans%1000000007;
  }
  cout << ans;
}

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;
//<<setprecision(30)
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i < (ll)(n); i++)
#define INF 1000000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
  ll N,K; cin>>N>>K;
  ll res = 0;
  for(ll i = K; i <= N+1; i++){
    ll s = i*(i-1)/2;
    ll e = i*N - s;
    s%=MOD;
    //e%=MOD;
    //cout<<s<<" "<<e<<endl;
    res += (e-s+1)%MOD;
  }
  cout<<res%MOD<<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;

int64_t mod = 1000000007;

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

	int64_t ans = 0;
	for (int64_t i = k; i <= n + 1; i++) {
		// (最大-最小)+1個が個数
		int64_t mini = (0 + i - 1) * i / 2;
		int64_t maxi = (n - i + 1 + n) * i / 2;
		int64_t temp = maxi - mini + 1;
		ans += temp;
		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;
#define FAST       			ios_base :: sync_with_stdio(false); cin.tie(NULL);

int main() {
  FAST;
  int64_t N, K, A, S;
  cin >> N >> K;
  A = 1000000007LL;
  S = 0LL;
  for (int64_t i = K; i <= N + 1; i++) {
    S += ((i % A) * (N % A)) % A;
    S += - ((i % A)* (i % A)) % A;
    S += i;
    S += 1;
    S %= A; 
  }
  cout << S << 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

//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define REV(v) reverse(v.begin(),v.end())
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)
#define dout(n) cout<<# n<<" = "<<n<<endl;
#define v1out(v) FOR(j,0,v.size()){cout<<v[j]; if(j!=(ll)v.size()-1)cout<<" ";else cout<<endl; }
#define v2out(v) FOR(i,0,v.size())v1out(v[i]);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k;cin>>n>>k;
    ll ans = 0;
    ll MOD = 1e9+7;
    FOR(i,k,n+2){
        (ans += (n+n-i+1)*i/2 - (i-1)*i/2 + 1) %= MOD;
    }
    cout<<ans<<endl;
}

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

import java.util.*;
public class Main{
  long factorial(int n, long ans){
    if(n <= 1) return ans;
    return factorial(n-1, ans*n);  
  }
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    long mod = Math.pow(10^9)+7;
    long ans = 0;
    long fact[] = new long[n+2];
    fact[n+1] = factorial(n+1, 1);
    for(int i = 0 ; i <= n-k+1; i++){
      if(fact[k+i] == 0) fact[k+i] = factorial(k+i, 1);
      if(fact[n-k-i] == 0) fact[n-k-i] = factorial(n-k-i, 1);
      ans += factorial[n+1]/(fact[k+i]*fact[n-k+i+1]);
    }
    if(ans > mod) ans = ans % mod;
    System.out.println(ans);
  }
}

Compiler output:
Main.java:11: error: method pow in class Math cannot be applied to given types;
    long mod = Math.pow(10^9)+7;
                   ^
  required: double,double
  found:    int
  reason: actual and formal argument lists differ in length
Main.java:14: error: non-static method factorial(int,long) cannot be referenced from a static context
    fact[n+1] = factorial(n+1, 1);
                ^
Main.java:16: error: non-static method factorial(int,long) cannot be referenced from a static context
      if(fact[k+i] == 0) fact[k+i] = factorial(k+i, 1);
                                     ^
Main.java:17: error: non-static method factorial(int,long) cannot be referenced from a static context
      if(fact[n-k-i] == 0) fact[n-k-i] = factorial(n-k-i, 1);
                                         ^
Main.java:18: error: cannot find symbol
      ans += factorial[n+1]/(fact[k+i]*fact[n-k+i+1]);
             ^
  symbol:   variable factorial
  location: class Main
5 errors
Language: C

#include<iostream>
using namespace std;
const int mod=1e9+7; 
int main(){
	long long res=0;
	long long n,k;
	cin>>n>>k;
	
	while(k<=n+1){
		long long qian=((k-1)*k/2)%mod,hou=((2*n%mod-k%mod+1)*k/2)%mod;
		res=(res+hou-qian+1+mod)%mod;
		k++;
	} 
	cout<<res;
} 

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

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

long long int n, k;
long long int M = 1e+9 + 7;
int main()
{
    cin >> n >> k;
    long long int ans = 1, s1 = 0, s2 = 0;
    for (long long int i = n; i > n - k; i--)
        s2 += i;
    for (long long int i = 0; i < k; i++)
        s1 += i;
    for (long long int i = k; i <= n; i++)
    {
        // cout<<s1<<" "<<s2;
        ans = ((ans + (s2 - s1+1) % M) % M + M) % M;
        s2 += n - i;
        s1 += i;
    }
    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

// Reading stuff 
// check the modulus 
// for tree case n=1


#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")
 
#include <bits/stdc++.h>
#include <vector> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;

#define int         long long
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define mp          make_pair
#define all(a)      (a).begin(),(a).end()
#define FF           first
#define SS           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define rep(i,a,b)  for(int i=a;i<b;i++)
const ll hell=1000000007;
const ll mod=998244353;



int solve(){    
 
  int n,k;
  cin>>n>>k;

  int dp[n+2]={0};
  dp[0]=0;
  dp[1]=0;
  rep(i,2,n+2)dp[i]=(dp[i-1]+i-1+hell)%hell;

  int ans=0;

  rep(i,k,n+2)
  {  
     //cout<<dp[n+1]-dp[n-i+1]<<" "<<dp[i]<<endl;
     ans+=(dp[n+1]-dp[n-i+1]-dp[i]+1);
     ans+=2*hell;
     ans%=hell;
  }

  cout<<ans<<endl;


return 0;
}

 
signed main()
{    


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


int t=1;                                                                                                                  
//cin>>t;
int k=1;

    while(t--)
     {
      //cout<<"Case #"<<k<<": ";
      k++;
      solve();
     }
    return 0;
  }

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

#include<iostream>
using std::cout;
using std::cin;
using std::endl;

int combination(int, int);
int factorial(int);

int main()
{
  int n, k;
  cin >> n >> k;
  int64_t mod_number = 1000000007
  
  int64_t sum = 0;
  for (int i = k; i < n + 1; i ++)
  {
    sum += combination(n + 1, k);
  }
  
  cout << mod_number << endl;
//  cout << sum % mod_number << endl;
  return 0;
}

int factorial(int n)
{
  if (n == 1) return 1;
  else return n * factorial(n - 1);
}

int combination(int n, int r)
{
  return factorial(n) / (factorial(n - r) * factorial(r));
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:3: error: expected ',' or ';' before 'int64_t'
   15 |   int64_t sum = 0;
      |   ^~~~~~~
a.cc:18:5: error: 'sum' was not declared in this scope
   18 |     sum += combination(n + 1, k);
      |     ^~~
Language: C

#include <bits/stdc++.h> 

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define endl "\n"

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

  int N,K;
  cin>>N>>K;
  vector<ll>sum(N+1,0);
  for(int i=1;i<=N;i++)sum[i]+=(i+sum[i-1])%MOD;
  ll ans=0;
  for(int i=K-1;i<=N;i++){
    if(i==N)ans++;
    else ans=((ans+sum[N]-sum[N-i-1]-sum[i]+1)%MOD+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;
long long XX(long long X)
{
	return (X*(X+1)/2ll)%1000000007ll;
}
int main()
{
	long long A,B;
    cin>>A>>B;
    long long Ans=0;
    for(long long i=B;i<=A+1;i++)
    {
    	Ans+=(XX(A)-XX(B-1)-XX(C)+2000000015ll)%1000000007ll;
        Ans%=1000000007ll;
    }
    cout<<Ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:32: error: 'C' was not declared in this scope
   14 |         Ans+=(XX(A)-XX(B-1)-XX(C)+2000000015ll)%1000000007ll;
      |                                ^
Language: C++


import sys
import math
import fractions
import bisect
import queue
import heapq
import collections
import itertools
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint=====================================
N, K = map(int, input().split())
N, M = map(int, input().split())
A, B = map(int, input().split())

H, W = map(int, input().split())

L, R = map(int, input().split())

1行のstring=================================
S, T = input().split()

1行の整数配列================================
P = list(map(int,input().split()))

A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
D = list(map(int,input().split()))

L = list(map(int,input().split()))
R = list(map(int,input().split()))

T = list(map(int,input().split()))

改行あり整数==================================
X = []
Y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    X.append(x1)
    Y.append(y1)

A = []
for i in range(N):
    a=int(input())
    A.append(a)

Pair = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    Pair.append((x1, y1))
    
2次元整数配列=====================================
A = []
for i in range(N):
    tmp = list(map(int,input().split()))
    A.append(tmp)


N行M列の初期化====================================
dp = [[VAL] * RETU for i in range(GYO)]

'''


N, K = map(int, input().split())

ans = 0

for i in range(K, N+2):

    lim = ((N  + N + 1 - i) * i) // 2 
    m = ((i - 1)         * i) // 2 

    ans += lim - m + 1
    ans %= MOD

print(ans)



Compiler output:
a.cc:16:1: error: empty character constant
   16 | '''
      | ^~
a.cc:16:3: warning: missing terminating ' character
   16 | '''
      |   ^
a.cc:16:3: error: missing terminating ' character
a.cc:70:1: error: empty character constant
   70 | '''
      | ^~
a.cc:70:3: warning: missing terminating ' character
   70 | '''
      |   ^
a.cc:70:3: error: missing terminating ' character
a.cc:2:1: error: 'import' does not name a type
    2 | import sys
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define bit(n) (1<<(n))
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<bool> vb;
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; }
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
int const INF = 1001001001;


// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
long long val;
constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
if (val < 0) val += MOD;
}
constexpr int getmod() { return MOD; }
constexpr Fp operator - () const noexcept {
return val ? MOD - val : 0;
}
constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
constexpr Fp& operator += (const Fp& r) noexcept {
val += r.val;
if (val >= MOD) val -= MOD;
return *this;
}
constexpr Fp& operator -= (const Fp& r) noexcept {
val -= r.val;
if (val < 0) val += MOD;
return *this;
}
constexpr Fp& operator *= (const Fp& r) noexcept {
val = val * r.val % MOD;
return *this;
}
constexpr Fp& operator /= (const Fp& r) noexcept {
long long a = r.val, b = MOD, u = 1, v = 0;
while (b) {
long long t = a / b;
a -= t * b; swap(a, b);
u -= t * v; swap(u, v);
}
val = val * u % MOD;
if (val < 0) val += MOD;
return *this;
}
constexpr bool operator == (const Fp& r) const noexcept {
return this->val == r.val;
}
constexpr bool operator != (const Fp& r) const noexcept {
return this->val != r.val;
}
friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
return os << x.val;
}
friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
if (n == 0) return 1;
auto t = modpow(a, n / 2);
t = t * t;
if (n & 1) t = t * a;
return t;
}
};

const int MOD = 1000000007;
using mint = Fp<MOD>;

// 愚直計算による二項係数計算
mint com(long long n, long long r) {
mint res = 1;
for (long long i = 0; i < r; ++i) {
res *= (n-i);
res /= (i+1);
}
return res;
}

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

ll N,K; cin >> N >> K;

mint ans = 0;
for(ll i = K; i <= N+1; ++i) {
    ll l = ((i-1)*i)/2;
    ll r = ((2*N - i + 1)*i)/2;
    ans += r - l + 1;
}
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 rep(i,N) for(int i=0; i<N; i++)
#define lint long long
#define square_vector(name,N,M) vector<vector<lint>>name(N,vector<lint>(M,0))
#define sort(V) sort(V.begin(),V.end())

int main() {
  lint N,K;
  cin >> N >> K;
  lint ans = 0;
  lint mod = 1000000007;
  lint term = 1;
  for (lint i=1; i<N+2; i++) {
    term += N;
    term += mod;
    term -= (i-1)*2;
    term %= mod;
    if (i >= K) {
      ans += term;
      ans %= mod;
    }
  }
  cout << ans << 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 <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const ll MOD = 1'000'000'007;

ll inv(ll x) {
	ll pow = MOD - 2;
	ll res = 1;

	while (pow > 0) {
		if (pow & 1) {
			res = res * x % MOD;
		}

		pow /= 2;
		x = x * x % MOD;
	}

	return res;
}

ll suff[400'000];
ll pref[400'000];

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

	int n, k;
	cin >> n >> k;

	for (int i = n; i >= 0; i--) {
		suff[i] = i + (i == n ? 0 : suff[i + 1]);
		suff[i] %= MOD;
	}

	pref[0] = 0;

	for (int i = 1; i <= n; i++) {
		pref[i] = pref[i - 1] + i;
		pref[i] %= MOD;
	}

	ll res = 0;

	for (int i = k; i <= n + 1; i++) {
		res = (res + suff[n - i + 1] - pref[i - 1] + 1 + MOD) % MOD;
	}

	cout << res;

	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>

using namespace std;

typedef long long ll;

namespace comb {
	ll fact[500001];
	ll fact_inv[500001];
	const ll MOD = 1000000007;

	ll modpow(ll a, ll b) {
		ll base = 1, kakeru = a;
		while (b > 0) {
			if (b & 1)base *= kakeru, base %= MOD;
			kakeru *= kakeru, kakeru %= MOD;
			b >>= 1;
		}
		return base;
	}

	void setup() {
		fact[0] = 1, fact[1] = 1;
		for (int i = 2; i <= 500000; i++) {
			fact[i] = (fact[i - 1] * i) % MOD;
		}

		fact_inv[500000] = modpow(fact[500000], MOD - 2);

		for (int i = 499999; i >= 0; i--) {
			fact_inv[i] = fact_inv[i + 1] * (i + 1);
			fact_inv[i] %= MOD;
		}

	}

	ll combination(int a, int b) {
		if (a - b < 0)return 0;
		ll ret = fact[a];
		ret *= fact_inv[b], ret %= MOD;
		ret *= fact_inv[a - b], ret %= MOD;
		return ret;
	}

	ll permutation(int a, int b) {
		if (a - b < 0)return 0;
		ll ret = fact[a];
		ret *= fact_inv[a - b], ret %= MOD;
		return ret;
	}

	ll homogeneous(int a, int b) {
		return combination(a + b - 1, b);
	}

}

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

	ll ans = 0;
	for (ll i = k; i <= n + 1; i++) {
		ans += n * (n + 1) / 2 - (n - i) * (n - i + 1) / 2 - i * (i - 1) / 2 + 1;
		ans %= comb::MOD;
	}
	cout << ans << endl;
	return 0;
}

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

/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;

#define io(F) string t_="";ifstream fin(t_+F+".in");ofstreamfout(t_+F+".out")
#define qio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
#define graph unordered_map<int, unordered_set<int>>
typedef long long ll;

ll ps[300000];

int main() {
	qio; ll n, k; cin >> n >> k;
	forl(i, 0, 299999) { ps[i] += i; ps[i+1] += ps[i]; }
	ll tot = 0;
	forl(i, k-1, n+1) {
		if(i == n) tot += 1;
		else tot += ps[n]-ps[n-i-1]-ps[i]+1;
		tot %= 1000000007;
	}
	println(tot);
}


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

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int, int> pii;

inline bool valid(int x, int n) {
    return 0 <= x && x < n;
}

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};

template <typename T>
inline T pop(queue<T>& q) {
    T front = q.front();
    q.pop();
    return front;
}

template <typename T>
inline T gcd(T a, T b) {
    for (; b; a %= b, swap(a, b));
    return a; 
}

template <typename T>
tuple<T, T, T> xgcd(T a, T b) {
    if (b == 0) return {1, 0, a};
    T x, y, g;
    tie(x, y, g) = xgcd(b, a%b);
    return {y, x-(a/b)*y, g};
}

const ll M = 1000000007ll;
inline ll func(ll n, ll k) {
    return ((k*(n-k+1)%M)+1) % M;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int N, K; cin >> N >> K;
    ll rst = 0;
    for (int k = K; k <= N+1; k++) {
        rst = (rst + func(N, k)) % M;
    }
    cout << rst % M;
}

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 _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int n, k;
string s, t;
vector<int> v, pref;

int32_t main(){_
   
   cin >> n >> k;
   ++n;

   for (int i = 0; i < n; ++i)
   {
      v.push_back(i);
      if (pref.empty()){
         pref.push_back(i);
      }
      else{
         pref.push_back(pref.back()+i);
      }
   }

   int ans = 0;
   for (int i = k-1; i < n; ++i)
   {
      //starting k and ending k
      int st = pref[i];
      int sz = (int)(pref.size());
      int end = pref.back() - ((sz-1-i-1 < 0) ? 0 : pref[sz-1-i-1]);
      ans += end - st + 1;
      ans %= mod; 
   }

   cout<<ans;

   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 itn int
#define REP(i, n) for (ll i = 0; i < n; i++)
#define IREP(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i < b + 1; i++)
#define all(v) v.begin(), v.end()
#define SENTINEL 2000000000
#define NIL -1
using namespace std;
typedef long long ll;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;
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 n,k;
    cin >> n >> k;
    vector<ll> v1(n+1);
    ll ans=0;
    v1[0]=0;
    REP(i,n+1){
        if(i==0)continue;
        v1[i]=v1[i-1]+i;
    }
    vector<ll> v2(n+1);
    v2[0]=n;
    IREP(i,n+1){
        if(i==n)continue;
        v2[n-i]=v2[n-i-1]+i;
    }
    for(int i=k;i<=n+1;i++){
        ans += v2[i-1]-v1[i-1]+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 <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define mxn (ll)1e5
#define mod (ll)(1e9+7)
#define mod1 (ll)(998244353)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){
	ll n,k,i,s=0;cin>>n>>k;
	for(i=k;i<=n+1;i++){
		ll l=(i*(i-1))/2;
		ll r=(n*(n+1)-(n-i)*(n-i+1))/2;
//		cout<<i<<" "<<l<<" "<<r<<endl;
		s=(s+r-l+1+mod)%mod;
	}cout<<s<<endl;
}


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

#include<bits/stdc++.h>
using namespace std;
int main () {
  int N, K;
  cin >> N >> K;
  vector<int>sum_u(N + 1);
  sum_u[0] = 0;
  vector<int>sum_a(N + 1);
  sum_a[0] = N;
  for (int i = 1; i <= N; i ++) {
    sum_u[i] = sum[i - 1] + i;
    sum_a[i] = sum[i - 1] + N - i;
  }
  const int mod = 1e9 + 7;
  int ans = 0;
  for (int i = N + 1; i >= K; i --) {
    ans += sum_a[i] - sum_u[i] + 1;
    ans %= mod;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: 'sum' was not declared in this scope; did you mean 'sum_a'?
   11 |     sum_u[i] = sum[i - 1] + i;
      |                ^~~
      |                sum_a
Language: C++

#include<cstdio>
#include<cstring>
#include<string>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<map>
#include<ctime>

using namespace std;

template <typename T>

inline T read()
{
	T x=0,f=1;char c=getchar();
	while(!isdigit(c))
	{if(c=='-') f=-f;c=getchar();}
	while(isdigit(c))
	{x=(x<<3)+(x<<1)+(c-48);c=getchar();}
	return x*f;
}

#define lint long long int
#define ulint unsigned lint

const int inf=1e9+1e7;

lint ans=0;
int n,k;

int main(void)
{

	// freopen("testdata.in","r",stdin);
	// freopen("testdata.out","w",stdout);

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

	for(int i=k;i<=n;i++)
	{
		(ans+=(lint)(i*(n*n-i-i)/2))%=Mod;
	}

	printf("%lld\n",ans);

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:43:47: error: 'Mod' was not declared in this scope
   43 |                 (ans+=(lint)(i*(n*n-i-i)/2))%=Mod;
      |                                               ^~~
Language: C

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

ll MOD = 1e9+7;
int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll N, K; cin >> N >> K;
	
	ll ans = 1;
	FOR(k, K, N+1) {
		// how many we take
		ll hi = 1LL * N * (N + 1) / 2 - 1LL * (N - k) * (N - k + 1) / 2;
		ll lo = 1LL * k * (k - 1) / 2;
		ans += hi - lo + 1;
		ans %= MOD;
	}
	print(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 <bits/stdc++.h> 
using namespace std; 
  
int fact(int n); 
  
int nCr(int n, int r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
 
int fact(int n) 
{ 
    int res = 1; 
    for (int i = 2; i <= n; i++) 
        ans = ans * i; 
    return ans; 
} 
  
int main() 
{ 
    int n,k;
  	cin>>n>>k;
  	cout<< nCr(n+1,k) <<endl;
} 

Compiler output:
a.cc: In function 'int fact(int)':
a.cc:15:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |         ans = ans * i;
      |         ^~~
      |         abs
a.cc:16:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |     return ans;
      |            ^~~
      |            abs
Language: C++

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = MOD + 2; //1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";

int main() 
{
   int n,k;
    cin>>n>>k;
    ll sum=0;
    FOR(i,k,n+1)
    {
      ll mn=(i*(i-1)/2)%MOD;
      ll mx=((i*n)%MOD-mn)%MOD;
      sum=(sum+mx-mn+1)%MOD;
    }
    cout<<sum<<endl;
  } 
   return 0;
}

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

#include<cstdio>

typedef long long ll;
const ll mod = 1E+9 + 7;

ll n, k, ans;

int main() {
	scanf("%lld%lld", &n, &k);
	while(k <= n + 1) {
		ans = (ans + (2 * n - k + 1) * k / 2 - (k - 1) * k / 2 + 1) % mod;
		++k;
	}
	printf("%lld", ans);
}

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

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <map>
#include <cstdlib>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

int main()
{
    const ll MOD = 1e9+7;
    ll N, K;
    cin >> N >> K;
    ll ans = 0;
    for(ll i=K; i<=N+1; i++){
        ans += i * (N-i+1) + 1;
        ans %= MOD;
    }

    cout << ans << 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>

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 1e9+7;

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

  llong ans = 0;
  llong mini = 0, maxi = 0;
  for (int i = 1; i <= N + 1; ++i) {
    mini += i - 1;
    maxi += N - i + 1;

    if (mini <= maxi && i >= K) {
      ans = (ans + (maxi - mini + 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>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
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 ll MOD = 1e9+7;

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

    ll ans = 0;
    ll left = 0;
    ll right = N;
    REPi(i,1,N+2){
        if(K <= i){
            ll num = right - left + 1;
            //printf("%lld %lld\n", left, right);
            ans += num;
            ans %= MOD;
        }
        left += i;
        right += N-i;
    }

    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>

using namespace std;

typedef long long ll;

namespace comb {
	ll fact[500001];
	ll fact_inv[500001];
	const ll MOD = 1000000007;

	ll modpow(ll a, ll b) {
		ll base = 1, kakeru = a;
		while (b > 0) {
			if (b & 1)base *= kakeru, base %= MOD;
			kakeru *= kakeru, kakeru %= MOD;
			b >>= 1;
		}
		return base;
	}

	void setup() {
		fact[0] = 1, fact[1] = 1;
		for (int i = 2; i <= 500000; i++) {
			fact[i] = (fact[i - 1] * i) % MOD;
		}

		fact_inv[500000] = modpow(fact[500000], MOD - 2);

		for (int i = 499999; i >= 0; i--) {
			fact_inv[i] = fact_inv[i + 1] * (i + 1);
			fact_inv[i] %= MOD;
		}

	}

	ll combination(int a, int b) {
		if (a - b < 0)return 0;
		ll ret = fact[a];
		ret *= fact_inv[b], ret %= MOD;
		ret *= fact_inv[a - b], ret %= MOD;
		return ret;
	}

	ll permutation(int a, int b) {
		if (a - b < 0)return 0;
		ll ret = fact[a];
		ret *= fact_inv[a - b], ret %= MOD;
		return ret;
	}

	ll homogeneous(int a, int b) {
		return combination(a + b - 1, b);
	}

}

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

	ll ans = 0;
	for (int i = k; i <= n + 1; i++) {
		ans += comb::combination(n + 1, i);
		ans %= comb::MOD;
	}
	cout << ans << 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<bits/stdc++.h>
using namespace std;
#define num 1000000007
//#define num 998244353
#define REP(i,a,n) for(ll i=a;i<n;i++)
#define inarr(i,a,n,A) for(ll i=a;i<n;i++) { cin>>A[i]; }
#define vll vector<long long>
#define pii pair <int,int>
#define pll pair<long long, long long>
#define vpii vector< pair <int,int>>
#define vpll vector< pair<long long, long long>>
#define max(a,b) ((a>b)?a:b)
#define min(a,b) ((a>b)?b:a)
#define max3(a,b,c) ((a>b)?(a>c)?a:c:(b>c)?b:c)
#define min3(a,b,c) ((a<b)?(a<c)?a:c:(b<c)?b:c)
#define avg(a,b) ((a)+(b))/2
#define pb push_back
#define pob pop_back
#define sf int flag=0     //Remember semicolon
#define assmin(a,b) if(b<=a) { a=b; }
#define assmax(a,b) if(b>=a) { a=b; }
#define f first
#define s second
#define fix(f,n) std::fixed<<std::setprecision(n)<<f
#define all(x) x.begin(), x.end()
#define M_PI 3.14159265358979323846
#define epsilon (double)(0.00000000001)
typedef long long ll;
ll mod(ll a, ll b)
{
	if(a%b<0)
	{
		return a%b + b;
	}
	return a%b;
}
 
 
ll mod_exp(ll a, ll b, ll c)
{
	ll res=1;
	a=a%c;
	while(b>0)
	{
		if(b%2==1)
		{
			res=(res*a)%c;
		}
		b/=2;
		a=(a*a)%c;
	}
	return res;
}
ll mymod(ll a,ll b)
{
    return ((a%b)+b)%b;
}
bool prime[200001];
void SieveOfEratosthenes() 
{ 
    memset(prime, true, sizeof(prime)); 
    prime[1]=false;
    for (int p=2; p*p<=200000; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*p; i<=200000; i += p) 
                prime[i] = false; 
        } 
    } 
    return;
}
ll powe[200005];
void power()
{
    powe[0]=1;
    REP(i,1,200005)
    {
        powe[i]=mymod(2*powe[i-1],num);
    }
}
ll gcdExtended(ll,ll,ll *,ll *);
ll modInverse(ll a, ll m) 
{ 
    ll x, y; 
    ll g = gcdExtended(a, m, &x, &y); 
        ll res = (x%m + m) % m;
        return res;
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
    ll x1, y1; 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
    return gcd; 
}
ll n; 
struct node
{
	vll adj;
    ll dist;
   // ll max_depth;
    ll cwgd;
};
ll facto[200005], pre[200005];
ll nCr(ll n, ll r)
{
    ll a=facto[n];
    a = mymod(a*modInverse(facto[r],num),num);
    a = mymod(a*modInverse(facto[n-r],num),num);
    return a;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    pre[0]=0;
    REP(i,1,200005)
    {
        pre[i] = i+pre[i-1];
    }
    facto[0]=1;
    REP(i,1,200005)
    {
        facto[i] = i*facto[i-1];
        facto[i] = mymod(facto[i],num);
    }
    ll n,k;
    cin>>n>>k;
    ll ans = 0;
    REP(i,k,n+2)
    {   
        ll up = pre[n] - pre[n-i];
        ll down = pre[i-1];
       // cout<<up<<" "<<down<<endl;
        ans+=up-down+1;
        ans=mymod(ans,num);
    }
    cout<<ans<<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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

/* modとる */
inline ll modu(ll a){
    return(a % mod + mod) % mod;
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    ll N = in<ll>(),K = in<ll>();
    ll sum = 0;
    for(ll i = K;i < N+2;i++){
        sum = modu(sum + modu(1 + (i * (2*N-i+1) - i*(i-1))/2));
    }
    cout << sum << "\n";
}

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

//
// Created by yamunaku on 2020/04/19.
//

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main(){
    //CFS;
    ll n, k;
    cin >> n >> k;
    n++;
    ll ans = 0;
    repl(i, k, n + 1){
        ans = (ans + i * (n - i) + 1) % MOD;
    }
    cout << ans << endl;
    return 0;
}

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

#include<iostream>
using namespace std;
#define mod 1000000007
#define int long long int
int32_t main()
{
	int n,k;
	cin>>n>>k;
	int answer=0;
	int j;
	for(j=k;j<=n+1;j++)
	{
		int max=j*n-(j*(j-1))/2;
		int min=(j*(j-1))/2;
		answer=answer+(max-min+1);
		answer=answer%mod;
	}
	cout<<answer<<endl;
}


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

/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──██████████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define int long long
#define read(a) int a; cin >> a;
#define readb(a, b) int a, b; cin >> a >> b;
#define readc(a, b, c) int a, b, c; cin >> a >> b >> c;
#define readarr(a, n) int a[(n) + 1] = {}; fori (i, 1, (n)) {cin >> a[i];}
#define readmat(a, n, m) int a[n + 1][m + 1] = {}; fori (i, 1, n) {fori (j, 1, m) cin >> a[i][j];}

#define print(a) cout << a << endl;
#define printarr(a, n) fori (i, 1, n) cout << a[i] << " "; cout << endl;
#define printv(v) for (int i: v) cout << i << " "; cout << endl;
#define printmat(a, n, m) fori (i, 1, n) {fori (j, 1, m) cout << a[i][j] << " "; cout << endl;} cout << endl;
#define all(v) v.begin(), v.end()
#define sz(s) (int)(s.size())
#define pb push_back
#define fi first
#define se second
#define rz resize
#define fori(i, a, b) for (int i = (a); i <= (b); i++)
#define ford(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
#define setprec(x) cout << fixed << setprecision(x)
 
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair <int, int>> vpi;
typedef vector < vector <int> > vvi;
 
const int INF = 4e18;
const int mod = 1e9+7; 

     
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    //start from here

    readb(n, k);
    int sum1 = 0, sum2 = 0;

    fori(i, 0, k-1) sum1 += i;
    ford(i, n, n-k+1) sum2 += i;

    int n1 = k-1; int n2 = n-k+1;

    int ans = 0;

    fori(i, k, n+1)
    {
	    int cnt = (sum2-sum1+1);
	    cnt %= mod;
	    ans += cnt;
	   	ans %= mod;
	   	n1++; n2--;
	   	sum1 += n1; sum2 += n2;
    }

    cout << ans;

    return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
//int T[2005]={0};
int main(){
  ll n ,j ;
  cin>>n>>j;
ll ans=0;
  for(ll k=j;k<=n+1;k++){
  ll a=(((k-1)*k)/2)%MOD;
  ll b=(((n+n-k+1)*k)/2)%MOD;
  ans+=(b-a+1+MOD)%MOD;
  ans%=MOD;
  ///cout<<" "<<ans<<endl;
}

    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.