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

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <queue>
#include <utility>
#include <map>
#include <bitset>
#include <numeric>
#define ll long long
using namespace std;
using p = pair<ll, ll>;
ll dx[8]={ 0, 1, 0,-1, 1, 1,-1,-1}; // x軸方向への変位
ll dy[8]={ 1, 0,-1, 0, 1,-1, 1,-1}; // y軸方向への変位
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

ll fun(ll a){
    ll ans = 1;
    ll mod = 1000000007;
    for(ll i = 1; i <= a; i++)
        ans = ans * i % mod;
    return ans;
}
ll comb(ll n, ll r){
    ll child = 1, mother = 1;
    ll mod = 1000000007;
    for(ll i = 1; i <= r; i++){
        child = child * (n-i+1) % mod;
        mother = mother * i % mod;
    }
    //mother = modpow(mother, mod-2, mod);
    ll ans = child / mother;
    return ans;
}

int main(void){
    ll n, k;
    cin >> n >> k;
    ll INF = 1e+9+7;
    ll ans = 0;
    ll sum[n+1];
    for(ll i = 0; i <= n; i++){
        if(i==0) sum[i] = 0;
        else sum[i] = sum[i-1]+i;
    }
    for(ll i = k; i <= n; i++){
        ll a = sum[n]-sum[n-i];
        ll b = sum[i-1];
        ll c = a-b+1;
       // cout << a << " " << b << " " << ans << endl;
        ans = (ans + c)%INF;
    }
    ans = (ans+1)%INF;
    cout << ans << 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 fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define printd(x) printf("%.12f\n", x);
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;

const ll MOD = 1000000007;

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

	ll ans = 0;
	ll dw = k * (k-1) / 2;
	ll up = n * (n+1) / 2 - (n-k) * (n-k+1) / 2;
	ans += up - dw + 1;
	ans %= MOD;
	
	for (int i = k + 1; i <= n + 1; i++) {
		up += n - i + 1;
		dw += i - 1;
		ans += up - dw + 1;
		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

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////

int n,k;
signed main(){
  cin>>n>>k;
  int ans = 0;
  repd(i,k,n+2){
    int s = i*(2*n-i+1)/2%MOD-i*(i-1)/2%MOD+1;
    add(ans, s);
  }
  cout << ans << endl;
}



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

#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
#include <list>
#include <cmath>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define mp make_pair
#define pb push_back
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9+7;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;

    ll 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;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}


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

#include<iostream>
using namespace std;
int main() {
	int N, K;
	long int mod=pow(10, 9) + 7;
	cin >> N >> K;
	
	long long int total = 0;
	for (int i = K; i < N + 2; i++) {

		total += N * (N + 1) / 2 - (N - i)*(N - i + 1) / 2 - ((i - 1)*i) / 2 + 1;
	}
	cout << total%mod;

}

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

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

Compiler output:
a.cc:3:9: error: expected initializer before numeric constant
    3 | int mod 1e9 +7;
      |         ^~~
a.cc: In function 'int main()':
a.cc:15:10: error: 'mod' was not declared in this scope; did you mean 'modf'?
   15 |     ans%=mod;
      |          ^~~
      |          modf
Language: C

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        "\n"
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define inf        1000000000000000000
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
  int n,k;
  cin>>n>>k;
  ll sum=0;
  ll min=0;
  	for(int i=0;i<k;i++)
  	min+=i;
  ll max=0;
	  for(int i=n;i>n-k;i--)
  	   max+=i;
  	sum=max-min+1;
  	k++;
  while(k<=n+1)
  {
  	
    
	  min+=k-1; 	
      max+=n-k+1;
  	sum+=max-min+1;
  	   sum%=mod;
   k++;
   } 
  
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>

using namespace std;
#define ll long long
#define rp(i,start,end) for(ll i =start ; i<end; i++)


int main(){


ll N;
ll K;

ll sum =0;

cin >> N >> K;

rp(i,K,N+2){

    sum = sum +(N+1)*N/2 -(N-i)*(N-i+1)/2 - (i-1)*i/2 +1;
   

}


ll ans =sum%(1000000007);

cout << ans << 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 WHOLE(v) (v).begin(), (v).end()
#define REV_WHOLE(v) (v).rbegin(), (v).rend()
using i64 = int64_t;
using namespace std;
template<class F>auto recursive(F f){return[f](auto...a){return f(f,a...);};}
template<class I,class V=typename I::value_type>V sum_up(const I&l,const I&r){V v;for(I i=l;i!=r;i++)v=i==l?*i:v+*i;return v;}
template<class I,class T=iterator_traits<I>>I operator+(I it,int n){for(int i=0;i<n;i++)it++;return it;}
template<class I,class T=iterator_traits<I>>I operator-(I it,int n){for(int i=0;i<n;i++)it--;return it;}
template<class T>using rev_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>using vector2d=vector<vector<T>>;
struct fixprec{int p;fixprec(int p):p(p){}};
ostream&operator<<(ostream&o,fixprec f){return o<<fixed<<setprecision(f.p);}
void R_YESNO(bool p){cout<<(p?"YES":"NO")<<endl;}
void R_YesNo(bool p){cout<<(p?"Yes":"No")<<endl;}
int main() {
    i64 m = 1e9+7;
    i64 N, K;
    cin >> N >> K;
    i64 ans = 0;
    ans += (K * (K - 1) * (2 * K - 1)) / 6;
    ans -= (N * (N + 1) * (2 * N + 1)) / 6;
    ans += ((N + 1) * N * (N + 1)) / 2;
    ans -= ((N + 1) * K * (K - 1)) / 2;
    ans += N - K + 2;
    cout << (ans % m) << 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 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)
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;

const int mod = 1000000007;
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 { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t)
      return 1;
    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 { return mint(*this) /= a; }
};
istream &operator>>(istream &is, const mint &a) { return is >> a.x; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }

int main() {
  ll n, k;
  cin >> n >> k;
  mint ans(0);
  for (ll i = k; i < n + 2; i++) {
    mint st(i * (i - 1) / 2);
    mint goal((2 * n + 1 - i) * i / 2 + 1);
    ans += goal;
    ans -= st;
  }
  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 rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
const int INF = 1e8;
int MOD = 1e9+7;
int main() {
  long long N, K;
    cin >> N >> K;
    long long res = 0;
    for (long long k = K; k <= N+1; ++k) {
        long long first = k * (k-1) / 2;
        long long final = (N*2-k+1) * k / 2;
        long long add = final - first + 1;
        res = (res + add) % MOD;
    }
    cout << res << 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;
  cin >> n >> k;
  vector<int> p(n+1);
  for(int i=0;i<=n;i++) p[i]=i;
  vector<long> q(n+2);
  q[0] = 0;
  for(int i=1;i<=n+1;i++) q[i] = q[i-1]+p[i-1];
  long ans = 0;
  long mod = 1000000007;
  for (int i=k;i<=n+1;i++){
    ans += (q[n+1]-q[n+1-i]-q[i]+1)%mod;
  }
  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>

#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

using ll = long long;
using P = pair<int, int>;

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

ll mod(ll val, ll m) {
  ll res = val % m;
  if (res < 0) res += m;
  return res;
}

ll f(ll l, ll r) {
  ll res = (r * (r + 1)) / 2 - ((l - 1) * l) / 2;
  return res;
}

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

  ll res = 0;
  for (ll i = k; i <= n + 1; ++i) {
    ll maxV = f(n - i + 1, n);
    ll minV = f(0, i - 1);
    res = (res + ((maxV - minV + 1) % MOD)) % 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>
#define rep(i,n) for (int i =0;i<n;i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  ll n,k;
  cin >> n >> k;
  ll min=0,max=0;
  ll curr=0,ans=0;
  rep(i,k){
    min+=i;
    max+=n-i;
    curr = i;
  }
  for(ll i = k;i<=n+1;i++){
    ans+=(max-min+1);
    curr++;
    max+=n-curr;min+=curr;
  }
  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;

using vi = vector<int>;
using ll = long long;
using ld = long double;

#define rep(i,a,b) for(auto i = (a); i < (b); ++i)
#define trav(a,x) for(auto& a: x)
#define all(a) begin(a),end(a)
#define sz(a) (int)size(a)
#define PB push_back

struct edge{int to;};
using graph = vector<vector<edge>>;

const int MOD = 1000000007;
const int inv2 = 500000004;
auto add(auto a, auto b){return ((ll) a + b) % MOD;}
auto sub(auto a, auto b){return ((ll) a - b + MOD) % MOD;}
auto mult(auto a, auto b){return (ll) a * b % MOD;}
auto sum(auto a, auto b) { // inclusive
  auto gap = (b - a + 1);
  auto res = add(mult(gap, a), mult(mult(gap, gap - 1), inv2));
  return res;
}

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

    int n, k;
    cin >> n >> k;
    ++n; // so we can work on range [1...n]
    auto res = 0LL;
    rep(taken, k, n + 1) {
      auto lo = sum(1, 1 + taken - 1);
      auto hi = sum(n - taken + 1, n);
      auto delta = add(sub(hi, lo), 1);
      //cout << lo << " " << hi << endl;
      //cout << delta << '\n';
      res = add(res, delta);
    }
    cout << res << '\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++

#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<int,int>;

//mintを使って定義すれば、modを常に取り続けてくれる。

const int mod = 1000000007;
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 {
        //tが0なら1を返す
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    //for prime mod
    //逆元を求める、mod-2乗
    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;
}

mint g(int n,int k) {
    mint z = 0;
    while(k <= n+1){
        z += 1+(n+1-k)*k;
        ++k;
    }
    return z;
}

int main(){
    int n, k;
    cin >> n >> k;
    int ans;
    ans = g(n,k);
    cout << ans << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:92:12: error: cannot convert 'mint' to 'int' in assignment
   92 |     ans = g(n,k);
      |           ~^~~~~
      |            |
      |            mint
Language: C

#include <algorithm>
#include <iostream>

using namespace std;

const int MD = 1000000007;

int main() {
	long long n, k; cin >> n >> k;
	long long x = n - (k - 1) + 1;
	// cout << x * (k * 3 * (k - 2 + x) + x * (x - 3) + 2) / 6 << '\n';
	/*
	n * x
	(n - 1) * x
	...
	(n - k + 1) * x
	(n - k - 0) * (x - 1) = n * x - 1n - k(x - 1) - 0x + 0 + 0
	(n - k - 1) * (x - 2) = n * x - 2n - k(x - 2) - 1x + 1 + 1
	(n - k - 2) * (x - 3) = n * x - 3n - k(x - 3) - 2x + 4 + 2
	(n - k - 3) * (x - 4) = n * x - 4n - k(x - 4) - 3x + 9 + 3
	...
	*/
	/*
	x(3nx + 6nk - 3n - 3kk + 3k - xx + 2x - 3xk + x - 2 + 3k - 3kk + 6k - 3xk - xx - 2 + 3x)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
                                        6


																				*/
	// cout << x * (3 * (n * (n + x) - (n - k) * (n - k + 1)) + (x - 1) * (-x + 2 - 3 * k)) / 6 << '\n';
	// cout << x * (3 * n * x + 6 * n * k - 3 * n - 3 * k * k + 3 * k - x * x + 2 * x - 3 * x * k + x - 2 + 3 * k - 3 * k * k + 6 * k - 3 * x * k - x * x - 2 + 3 * x) / 6 << '\n';
	cout << x * (3 * n * x + 6 * k * n - 3 * n - 6 * k * k + 12 * k - 2 * x * x + 6 * x - 6 * k * x + 2) / 6 % MD << '\n';
	// cout << x * (((x - k * (x + n - k + 2)) * 2 + n * (x - 1)) * 3 - (x * x - 5) * 2) / 6 << '\n';
	return 0;
}


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

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

// マクロ //
#define rep(i,N) for(lint i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) (x) * (x)
#define db(i) cout << #i << " = " << i;

// 型エイリアス //
using lint = long long;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vi = vector<int>;
using vli = vector<lint>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvli = vector<vli>;
using vvb = vector<vb>;
using vvc = vector<vc>;
using vvs = vector<vs>;
using mii = map<int, int>;
using mili = map<int, lint>;
using mci = map<char, int>;
using mcli = map<char, lint>;
using msi = map<string, int>;
using msli = map<string, lint>;


// 関数 //
template<class T, class Q> lint gcd_(T a, Q b) {
    int t;
    while (b != 0) {
        t = a % b;
        a = b;
        b = t;
    }
    return a;
}

template<class T, class Q> lint lcm_(T a, Q b) {
    return a * b / gcd(a, b);
}

double distance(pii a, pii b) {
    double dist;
    dist = sqrt(x2(a.first - b.first) + x2(a.second - b.second));
    return dist;
}

lint perm(int a) {
    lint perm = 1;
    for (int i = a; i >= 1; i--) {
        perm *= i;
    }
    return perm;
}

lint combination(int n, int m) {
    long double c = 1;
    for (int i = n, k = 1; i > m; i--, k++) {
        c *= i;
        c /= k;
    }
    return (lint)c;
}

template<class T, class Q> inline bool chmin(T& a, Q b) {
    if (a > b) { 
        a = b;
        return true; 
    }
    return false;
}

template<class T, class Q> inline bool chmax(T& a, Q b) {
    if (a < b) { 
        a = b; 
        return true; 
    }
    return false;
}

// 定数 //
const double pi = acos(-1);
const int mod = 1000000007;
const int MOD = 998244353;
const int inf = 1045141919;
const lint linf = ((1LL << 62) - 1);


// キーワード //
#define elif else if

// End of Template //



int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
        
    lint N, K;
    cin >> N >> K;

    vli max(N + 1);
    vli min(N + 1);
    lint tori = 0;
    rep(i, N + 1) {
        min[i] = i * (i + 1) / 2;
        max[i] = (N + N - (i + 1) + 1) * (i + 1) / 2;
    }
    for (int i = K - 1; i < N + 1; i++) {
        tori = (tori + (max[i] - min[i] + 1) % mod) % mod;
    }
    cou(tori);
}

Compiler output:
main.c:2:9: 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 long long int ll;
ll const mod = 1e9+7;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k;
    cin>>n>>k;
    ll ans = 0;
    for(int i = k; i <= n; i++){
        ll L = i * (i-1) / 2;
        ll R = n * i - L;
        ans += R - L + 1;
    }
    cout<<ans%mod<<"\n";

    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++

/**
 * D - Sum of Large Numbers
 * https://atcoder.jp/contests/abc163/tasks/abc163_d
 */
#include <bits/stdc++.h>
using namespace std;

int mod10 = mod(109+7) ;
 
int main() {
    // 10100, 10100+1, ..., 10100+N の N+1 個の数があります。
    // この中から K 個以上の数を選ぶとき、その和としてあり得るものの個数を mod(109+7) で求めてください。
    int N, K;
    cin >> N >> K;

    int pattern = 0;
    for (int i = K; i < N + 1; i++) {
        // (N + 1) c (i);
        int bunshi = 1, bunbo = 1;
        for (int cnt = 0; cnt < i; cnt++) {
            bunshi *= N + 1 - cnt;
        }
        for (int cnt = 0; cnt < i; cnt++) {
            bunbo *= cnt + 1;
        }

        // cout << bunshi << ' ' << bunbo << endl;
        pattern += bunshi / bunbo;
        pattern = pattern % pow(10, 9) + 7;
    }

    cout << pattern << endl;
}
 

Compiler output:
a.cc:8:13: error: 'mod' was not declared in this scope; did you mean 'modf'?
    8 | int mod10 = mod(109+7) ;
      |             ^~~
      |             modf
a.cc: In function 'int main()':
a.cc:29:27: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   29 |         pattern = pattern % pow(10, 9) + 7;
      |                   ~~~~~~~ ^ ~~~~~~~~~~
      |                   |            |
      |                   int          __gnu_cxx::__promote<double>::__type {aka double}
Language: C

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define IO(i, o) freopen(i, "r", stdin), freopen(o, "w", stdout)

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

const int mod = 1e9 + 7;
long long n, k;

int main(){
	//IO("input.txt", "output.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> k;
	long long sum = 0;
	for(long long i = k; i <= n + 1; i++){
		long long low = (i * (i - 1)) / 2;
		long long high = (i * (n + n - i + 1)) / 2;
		sum = (sum + (high - low + 1) % mod) % mod;
	}
	cout << sum << "\n";
	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 N 200123
#define ll long long
using namespace std;

int m, n;
int main(){
	cin >> m >> n;
	while(m != n + 1){
		soma+=m;
		m--;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'soma' was not declared in this scope
   10 |                 soma+=m;
      |                 ^~~~
Language: C++

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

const int MOD = 1000000007
int main(){
  long long N, K;
  cin >> N >> K;
  long long res = 0;
  for (long long k = K; k <= N + 1; k++){
    long long begin = k * (k - 1) / 2;
    long long end = (2 * N - k + 1) * k / 2;
    long long add = end - begin + 1;
    res += add;
  }
  cout << res << endl;
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc:5:1: error: expected ',' or ';' before 'int'
    5 | int main(){
      | ^~~
Language: C

N = [int(e) for e in input().split()]
nums = []
u = 10**9 + 7
t = 0
s = 0
Min =0
Max =0
for i in range(0,N[1]):
    Min += i
    t = i+1
    Max += N[0] - i
    s = N[0] - i -1
ans = Max - Min + 1
for k in range(N[1]+1,N[0]+2):
    Min += t
    t += 1
    Max += s
    s -= 1
    ans += Max - Min + 1
print(ans%u)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | N = [int(e) for e in input().split()]
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:5: error: expected expression before '[' token
    1 | N = [int(e) for e in input().split()]
      |     ^
main.c:2:1: error: expected ',' or ';' before 'nums'
    2 | nums = []
      | ^~~~
Language: C

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

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

    ll res = 0;
    for(ll i=k; i<=n+1; i++){
        ll max = i*(2*n-i+1)/2;
        ll min = i*(i-1)/2;
        // out(max-min+1);
        res += (max - min+1)%mod;
    }
    out(res%mod);

 
}


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

#include <stdio.h>
#define m 1000000007
int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    unsigned long long b[200003]={},i,j,s=0;
    for(i=1;i<=n+1;i++) {
        b[i]=1+i*(n+1-i);
        b[i]=a[i]%m;
    }
    for(j=k;j<=n+1;j++) {
        s+=b[j];
    }
    printf("%llu\n",s%m);
    

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: 'a' was not declared in this scope
   10 |         b[i]=a[i]%m;
      |              ^
Language: Java

import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		long N = sc.nextInt();
		long K = sc.nextInt();
		long ans = 0;
		long nSum = (N+1)*N/2+1;

		for(long k = K; k<=N+1; k++) {
			ans+=((2*N+1-k)*k/2-(k-1)*k/2+1);
			ans%=Math.pow(10,9)+7;
//			System.out.println(ans);
		}

		ans%=Math.pow(10,9)+7;

		System.out.println(ans);


	}

Compiler output:
Main.java:25: error: reached end of file while parsing
	}
	 ^
1 error
Language: C

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long n,m,k,sum=0,a=0,b=0;
  long long mod = 1000000007;
  cin >> n >> k;
  for (long long i=k;i<=n;i++){
    a = k*(k+1)/2;
    b = n*(n+1)/2 - (n-k)*(n-k+1)/2;
    sum += b - a + 1;
    sum %= mod;
  }
  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<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

ll MOD = (ll)pow(10, 9) + 7;

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

  ll ans = 0;

  rep2(k, K, N + 2){
    ans += (ll)k * (ll)(2*N - k + 1) / 2 - (ll)k * (ll)(k - 1) / 2 + 1;
    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 <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cmath>
#include <ios>
#include <ctype.h>
#include <stack>
#include <istream>
#include <stdio.h>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <functional>
#include <bitset>
#include <list>
#include <deque>
#include <time.h>
#include <random>
#include <iomanip>
#include <fstream>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define pint pair<int,int>
const int INF = 1000000007;
const long double EPS = 1e-15;
const long double PI = acos(-1);
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
using Graph_weighted = vector<vector<pair<int,int>>>;
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); }
ll ceil(const ll a, const ll b) { return (a + b - 1) / b; }
int main(){
  ll n,k;
  cin >> n >> k;
  ll ans = 0;
  for(int i = k; i <= n + 1; i++){
    ll a = i * (i - 1) / 2,b = n * i - a;
    ans += b - a + 1;
  }
  cout << ans % INF << 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,a,b) for(int i=a; i< (int)(b); ++i)
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
typedef long double ld;
using ll=long long;
using namespace std;
const int mod=1e9+7;
const ld pi = (acos(-1));


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  
  ll n,k; cin >> n >> k;
  ll ans=0;
  for(ll i=k; i<=n+1;++i){
    ll first = i*(i-1)/2;
    ll last =(n*2-i+1)*i /2;
    ll add = last-first+1;
    ans=(ans+add)%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>
using ll = long long;
const int MOD = 1000000007;
int main()
{
  int n,k;
  std::cin>>n>>k;
  ll res = ((n * (n + 1) % MOD * (n + 2) % MOD + k * (k - 1) % MOD * (2 * k - 3 * n - 4) % MOD) % MOD * modInverse(6) % MOD + n - k + 2) % MOD;
  std::cout<<res<<std::endl;
}

ll modInverse(ll x) {
  return pow(x, mod - 2);
}

ll pow(ll x, ll n) {
    ll mod = MOD;
    ll res = 1;
    while (n > 0) {
        if (n % 2 == 1) res = res * x % mod;
        x = x * x % mod;
        n = n / 2;
    }
    return res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:105: error: 'modInverse' was not declared in this scope
    8 |   ll res = ((n * (n + 1) % MOD * (n + 2) % MOD + k * (k - 1) % MOD * (2 * k - 3 * n - 4) % MOD) % MOD * modInverse(6) % MOD + n - k + 2) % MOD;
      |                                                                                                         ^~~~~~~~~~
a.cc: In function 'll modInverse(ll)':
a.cc:13:17: error: 'mod' was not declared in this scope
   13 |   return pow(x, mod - 2);
      |                 ^~~
a.cc:13:10: error: 'pow' was not declared in this scope
   13 |   return pow(x, mod - 2);
      |          ^~~
Language: C++

#include<iostream>
using ll = long long;
const int MOD = 1000000007;
int main()
{
  int n,k;
  std::cin>>n>>k;
  ll res = ((n * (n + 1) % MOD * (n + 2) % MOD + k * (k - 1) % MOD * (2 * k - 3 * n - 4) % MOD) % MOD * modInverse(6) % MOD + n - k + 2) % MOD;
  std::cout<<res<<std::endl
}

ll modInverse(ll x) {
  return pow(x, mod - 2)
}

ll pow(ll x, ll n) {
    ll mod = MOD;
    ll res = 1;
    while (n > 0) {
        if (n % 2 == 1) res = res * x % mod;
        x = x * x % mod;
        n = n / 2;
    }
    return res;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:105: error: 'modInverse' was not declared in this scope
    8 |   ll res = ((n * (n + 1) % MOD * (n + 2) % MOD + k * (k - 1) % MOD * (2 * k - 3 * n - 4) % MOD) % MOD * modInverse(6) % MOD + n - k + 2) % MOD;
      |                                                                                                         ^~~~~~~~~~
a.cc:9:28: error: expected ';' before '}' token
    9 |   std::cout<<res<<std::endl
      |                            ^
      |                            ;
   10 | }
      | ~                           
a.cc: In function 'll modInverse(ll)':
a.cc:13:17: error: 'mod' was not declared in this scope
   13 |   return pow(x, mod - 2)
      |                 ^~~
a.cc:13:10: error: 'pow' was not declared in this scope
   13 |   return pow(x, mod - 2)
      |          ^~~
a.cc:13:25: error: expected ';' before '}' token
   13 |   return pow(x, mod - 2)
      |                         ^
      |                         ;
   14 | }
      | ~
Language: C

#include<iostream>
using ll = long long;
const int MOD = 1000000007;
int main()
{
  int n,k;
  std::cin>>n>>k;
  ll res = ((n * (n + 1) % MOD * (n + 2) % MOD + k * (k - 1) % MOD * (2 * k - 3 * n - 4) % MOD) % MOD * modInverse(6) % MOD + n - k + 2) % MOD;
  std::cout<<res<<std::endl
}

ll modInverse(ll x) {
  return pow(x, mod - 2)
}

ll pow(ll x, ll n) {
    ll mod = MOD;
    ll res = 1;
    while (n > 0) {
        if (n % 2 == 1) res = res * x % mod;
        x = x * x % mod;
        n = n / 2;
    }
    return res;
}

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

//Created by Kira

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

#define IOS cin.sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair<int,int> 
#define pb push_back
#define vi vector<int> 
using ll = long long;

const int mod = 1e9 + 7;

ll pwr(ll a, ll b);
	



int main(){
   IOS

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

	vector<ll> v;
	v.pb(0); v.pb(0);
	for(int i = 1; i <= n; i++){
		v.pb(v.back() + i);
	}

	ll ans = 0;
	for(int r = k; r <= n+1; r++){
		ll lo = v[r] - v[0];
		ll hi = v[n + 1] - v[n + 1 - r];
		//cout<<lo<<" "<<hi<<"\n";
		ans += (hi - lo + 1 + mod)%mod;
		if(ans >= mod)ans -= mod;
	}

	cout<<ans<<"\n";







}

ll pwr(ll a, ll b){
   a %= mod;	//Remove mod if not required
   ll res = 1;
   while(b > 0){
	if(b&1)
		res = res * a % mod;
		a = a * a % mod;
	b >>= 1;
	}

	return res;
}



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

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll,ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(),v.end())
#define ull unsigned long long
#define tell(a) cout<<a<<" "
#define el cout<<endl
#define rev(v) reverse(v.begin(),v.end())
#define rep(i,a,n) for(int i=a;i<n;i++)
#define M 1000000007
ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){   if (y & 1)res = (res*x) % p;y = y>>1;
x = (x*x) % p;}return res;}

int main()
{
	IOS;
	ll n,k;
	cin>>n>>k;
	ll ans=0;
	for(ll i=k;i<=n+1;i++)
	{
		ans+=(n*i-(i)*(i-1)+1)%M;
		ans%=M;
	}
	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

using System;
using System.Linq;
using System.Collections.Generic;

using E = System.Linq.Enumerable;

public class Program
{
    const long Mod = (long)1e9 + 7;
    
    public static void Main()
    {
        var nk = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
        var (n, k) = (nk[0], nk[1]);

        var count = new Modular(0, Mod);
        for (; k <= n + 1; ++k)
        {
            count += k * (n - k + 1) + 1;
        }
    
        Console.WriteLine(count.Value);
    }
    
    readonly struct Modular
    {
        public readonly long Mod;
        public readonly long Value;

        public Modular(long x, long m) : this() => (this.Value, this.Mod) = ((x + m) % m, m);

        public static Modular operator +(Modular a, long x) => new Modular(a.Value + x, a.Mod);
        public static Modular operator -(Modular a, long x) => new Modular(a.Value - x + a.Mod, a.Mod);
        public static Modular operator *(Modular a, long x) => new Modular(a.Value * x, a.Mod);
        public static Modular operator /(Modular a, long x) => new Modular(a.Value / x, a.Mod);
    }
}


Compiler output:
main.c:1:1: error: unknown type name 'using'
    1 | using System;
      | ^~~~~
main.c:2:1: error: unknown type name 'using'
    2 | using System.Linq;
      | ^~~~~
main.c:2:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    2 | using System.Linq;
      |             ^
main.c:3:1: error: unknown type name 'using'
    3 | using System.Collections.Generic;
      | ^~~~~
main.c:3:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    3 | using System.Collections.Generic;
      |             ^
main.c:5:1: error: unknown type name 'using'
    5 | using E = System.Linq.Enumerable;
      | ^~~~~
main.c:5:17: error: request for member 'Linq' in something not a structure or union
    5 | using E = System.Linq.Enumerable;
      |                 ^
main.c:7:1: error: unknown type name 'public'
    7 | public class Program
      | ^~~~~~
main.c:7:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Program'
    7 | public class Program
      |              ^~~~~~~
Language: C

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int MOD = 1e9 + 7;

int N, K;

ll sum(ll l, ll r) {
    return (l+r) * (r-l+1) / 2;
}

int main(){
    cin >> N >> K;
    ll ans = 0;
    for (int i=K; i<=N+1; i++) {
        ll mn = sum(0, i-1);
        ll mx = sum(N+1-i, N);
        ans += mx - mn + 1;
        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 "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

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; }
template<class T>
T GCD(T a, T b) {if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }
template<class T>
inline T upper(T a, T b) {return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	int low = 0, high = 0, ans = 0;

	for (int i = 1; i < n + 2; ++i) {
		low += i - 1;
		high += n - i + 1;

		if (i >= k) {
			ans += high - low + 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;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef unordered_set<int> si;
typedef pair<int, int> pp;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#define all(e) (e).begin(), (e).end()


template <typename T>
void printV(vector<T> A) {
    if (A.empty()) cerr << "EMTPY\n";
    else { 
        cerr << "[";
        for (int i = 0; i < A.size() -1 ; ++i) {
            cerr << A[i] << ", ";
        }
        if (A.size()) cerr << A.back() << "]\n";
    }
}


template <typename T>
void printVV(vector<vector<T>> A) {
    cerr << "[";
    for (auto v : A) {
        printV<T>(v);
    }
    cerr << "]";
}

template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
    cerr << name << ": " << arg1 << endl;
}

template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&& ...args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << ": " << arg1 << " |";
    __f(comma + 1, args...);
}

int main(int argc, char **argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, k; cin >> n >> k;
    
    ll ans = 1;
    ll mod = 1e9 + 7;
    for (; k <= n; ++k) {
        ll m = k * (k - 1) / 2, M = k * (n - k + 1 + n) / 2;
        ans += M - m + 1;
        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;

	for (int i = 0; i < need; i++)
		min += i;

	for (int i = 1; i <= need; i++)
		max += num - i;

	return max - min + 1;
}

int main(void) {
	unsigned long 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:19:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   19 |         scanf_s("%d%d", &n, &k);
      |         ^~~~~~~
      |         scanf
Language: C

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)



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

  ll n,k;
  cin >> n >> k;
  ll ans = 0;
  ll mod = 1e9+7;
  for(ll i = k; i<=n+1; i++){
    ans += (n-i+1)*i +1;
    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 <iostream>
#include <cmath>

typedef unsigned long long L_LONG;

int main(){
  const L_LONG mod = 7 + std::pow(10,9);
  
  L_LONG N = 0;
  L_LONG k = 0;
  
  std::cin >> N >> k;
  
  L_LONG sum = 0;
  for(L_LONG cnt = k ; cnt <= N+1 ; cnt++){
    L_LONG big = (cnt*(2*N-cnt+1))/2;
    L_LONG small = (cnt*(cnt-1))/2;
    sum = ( sum + ( big - small + 1 ) ) % mod;
  }
  
  std::cout << sum << std::endl;
  
  return 0;
}

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

N, K = map(int, input().split())
MAX = 10 ** 9 + 7

res = 0

def calc_sum(l, r):
  return ((l+r) * (r-l+1)) // 2

for i in range(K, N+2):
  low = calc_sum(0,i-1)
  high = calc_sum(N-i+1,N)
  res = (res + (high-low+1)) % MAX

print(res)

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | N, K = map(int, input().split())
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'N' [-Wimplicit-int]
main.c:1:4: error: type defaults to 'int' in declaration of 'K' [-Wimplicit-int]
    1 | N, K = map(int, input().split())
      |    ^
main.c:1:8: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | N, K = map(int, input().split())
      |        ^~~
main.c:1:12: error: expected expression before 'int'
    1 | N, K = map(int, input().split())
      |            ^~~
main.c:2:1: error: expected ',' or ';' before 'MAX'
    2 | MAX = 10 ** 9 + 7
      | ^~~
Language: C

#include <iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <cstring>
#include <map>
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	ll n, k; cin >> n >> k;
	ll ans = 0;
	// 4
	//01 ~ 23 : 1 ~ 5 : 5
	//012 ~ 123 : 3 ~ 6 : 4
	//0123 : 1
	//n - k
	for (ll i = k; i <= n; i++) {
		ll t = n - i;
		ll Left = (i - 1) * i / (ll)2;
		ll Right = n * (n + 1) / (ll)2 - t * (t + 1) / (ll)2;
		ans += (Right - Left + (ll)1);
		ans %= mod;
	}

	cout << (ans + 1) % mod << '\n';

}

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;
#define ll long long
const N=2e5+10;
const ll mod=1e9+7;
ll a[N]; 
int n,k;
int main(){
  cin>>n>>k;
  ++n;
  for(int i=1;i<=n;i++) a[i]=i-1;
  for(int i=1;i<=n;i++) a[i]+=a[i-1];
  ll ans=0;
   for(int i=k;i<=n;i++) 
     {
     	ll mi=a[i];
     	ll mx=a[n]-a[n-i];
     	ans=(ans+mx-mi+1)%mod;
	 }
	 cout<<ans;
return 0;
}

Compiler output:
a.cc:4:7: error: 'N' does not name a type
    4 | const N=2e5+10;
      |       ^
a.cc:6:6: error: 'N' was not declared in this scope
    6 | ll a[N];
      |      ^
a.cc: In function 'int main()':
a.cc:11:25: error: 'a' was not declared in this scope
   11 |   for(int i=1;i<=n;i++) a[i]=i-1;
      |                         ^
a.cc:12:25: error: 'a' was not declared in this scope
   12 |   for(int i=1;i<=n;i++) a[i]+=a[i-1];
      |                         ^
a.cc:16:15: error: 'a' was not declared in this scope
   16 |         ll mi=a[i];
      |               ^