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

// Sakhiya07 - Yagnik Sakhiya
 
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
 
#define mp make_pair
#define bp __builtin_popcountll
#define MOD  1000000007
const int N = 200500;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));

void solve()
{
     ll n,k;
     cin >> n >> k;
     ll ans = 0;
     for(ll i=k;i<=n+1;i++)
     {
          ll mini = (i*(i-1))/2;
          mini %= MOD;
          ll maxi =  (i*n)%MOD - mini + MOD;;
          maxi %= MOD;
          maxi = maxi - mini + MOD;
          maxi %= MOD;
          maxi++;
          ans = (ans + maxi)%MOD;
     }
     cout<<ans;
}

int main()
{
     FAST;
     ll t = 1;
   //  cin >> t;
     while(t--)
     {
          solve();
     }
}

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

#include <iostream>
using namespace std;
const long long int mod = 1000000007;
long long int N,K;

long long int S(long long int x){
 return (N+1)*x*(x+1)/2-x*(x+1)*(x+2)/6+x; 
  
}
int main()
{
    cout << fixed << setprecision(18);
    cin>>N>>K;
    
  
    cout<<(S(N+1)-S(K-1))%mod<<endl;
}    


Compiler output:
a.cc: In function 'int main()':
a.cc:12:22: error: 'setprecision' was not declared in this scope
   12 |     cout << fixed << setprecision(18);
      |                      ^~~~~~~~~~~~
a.cc:2:1: note: 'std::setprecision' is defined in header '<iomanip>'; this is probably fixable by adding '#include <iomanip>'
    1 | #include <iostream>
  +++ |+#include <iomanip>
    2 | using namespace std;
Language: C++

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

int main (){
  ll N,K;cin>>N>>K;
  ll INF = 1e9 + 7;
  ll s = K*(K-1)/2, g=(2*N-K+1)*K/2;
    for (ll i = K; i < N + 2; i++) {
      ans += g - s + 1;
      ans %= INF;
      s += i;
      g += N - i;
      if (ans < 0) {
        ans = i;
        break;
      }
    }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |       ans += g - s + 1;
      |       ^~~
      |       abs
a.cc:21:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   21 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C

#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
#define ff first
#define ss second
#define int long long 
#define endl "\n"
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);	

const int MOD = 1e9 + 7;
const int N = 2e5 + 5;
int a[N] ;
int n , k;

void solve(){
	cin >> n >> k;
	
	int sum  = 0;
	if(n+1==k)
	{	cout << "1" <<endl; return;}
	
	
	int lminsum = k*(k-1)/2;
	int rmaxsum = n*(n+1)/2   - (n-k)*(n-k+1)/2;
	int addr = n-k;
		
	sum = ( rmaxsum - lminsum + 1 ) % MOD;
	for(int i = k ; i<=n ; i++){
		lminsum += i;
		rmaxsum += addr;
		
		sum +=( rmaxsum - lminsum + 1 ) % MOD;
		addr --;
	}
	
	cout << sum % MOD <<endl;
}

int32_t main(){
	FAST;
	int t=1;
	//cin>>t;
	while(t--)
		solve();
	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 int ll;
const double PI=3.14159265358979323846;
constexpr long long int MOD = 1000000007;

int main(){
    ll N,K; cin>>N>>K;
    ll ans=0;
    for(ll i=K;i<=N+1;i++){
        int L=i*(i-1)/2;
        int R=N*i-L;
        ans+=R-L+1;
    }
    cout<<ans%MOD;
    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>
long n,k,a,i;main(){std::cin>>n>>k;for(i=k;i<n+2;i++)a=(a+i*(n-i+1)+1)%(1e9+7);std::cout<<a;}

Compiler output:
a.cc:2:14: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | long n,k,a,i;main(){std::cin>>n>>k;for(i=k;i<n+2;i++)a=(a+i*(n-i+1)+1)%(1e9+7);std::cout<<a;}
      |              ^~~~
a.cc: In function 'int main()':
a.cc:2:71: error: invalid operands of types 'long int' and 'double' to binary 'operator%'
    2 | long n,k,a,i;main(){std::cin>>n>>k;for(i=k;i<n+2;i++)a=(a+i*(n-i+1)+1)%(1e9+7);std::cout<<a;}
      |                                                        ~~~~~~~~~~~~~~~^~~~~~~~
      |                                                                    |       |
      |                                                                    |       double
      |                                                                    long int
Language: C++

#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
  long long int a,b;
    long long int pre = 0;
    cin >> a >> b;
  for(ll m = b; m < b+2; m++)
  {
    ll p = (b*(b-1));
    p = p/2;
    ll pu = (a+(a-b+1))*b);
    pu /= 2;
    ll ru = pu - p +1;
    ru %= mod;
    pre += ru;
    pre%=mod;
  }
  cout << pre << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:26: error: expected ',' or ';' before ')' token
   13 |     ll pu = (a+(a-b+1))*b);
      |                          ^
a.cc:16:11: error: 'mod' was not declared in this scope; did you mean 'modf'?
   16 |     ru %= mod;
      |           ^~~
      |           modf
Language: C++

long n,k,a,i;main(){std::cin>>n>>k;for(i=k;i<n+2;i++)a=(a+i*(n-i+1)+1)%(1e9+7);std::cout<<a;}

Compiler output:
a.cc:1:14: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    1 | long n,k,a,i;main(){std::cin>>n>>k;for(i=k;i<n+2;i++)a=(a+i*(n-i+1)+1)%(1e9+7);std::cout<<a;}
      |              ^~~~
a.cc: In function 'int main()':
a.cc:1:26: error: 'cin' is not a member of 'std'
    1 | long n,k,a,i;main(){std::cin>>n>>k;for(i=k;i<n+2;i++)a=(a+i*(n-i+1)+1)%(1e9+7);std::cout<<a;}
      |                          ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | long n,k,a,i;main(){std::cin>>n>>k;for(i=k;i<n+2;i++)a=(a+i*(n-i+1)+1)%(1e9+7);std::cout<<a;}
a.cc:1:71: error: invalid operands of types 'long int' and 'double' to binary 'operator%'
    1 | long n,k,a,i;main(){std::cin>>n>>k;for(i=k;i<n+2;i++)a=(a+i*(n-i+1)+1)%(1e9+7);std::cout<<a;}
      |                                                        ~~~~~~~~~~~~~~~^~~~~~~~
      |                                                                    |       |
      |                                                                    |       double
      |                                                                    long int
a.cc:1:85: error: 'cout' is not a member of 'std'
    1 | long n,k,a,i;main(){std::cin>>n>>k;for(i=k;i<n+2;i++)a=(a+i*(n-i+1)+1)%(1e9+7);std::cout<<a;}
      |                                                                                     ^~~~
a.cc:1:85: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

const ll MAX = 200001;
const ll MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

template<class T,class U>
long long nCr(T n, U k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(void){
    COMinit();

    ll n,k,ans;

    cin >> n >> k;

    ans = 0;
    for(ll i=k-1; i<=n; i++){
        ans = (ans + (nCr(n, i)))%MOD;
        ans = (ans + (n-i))%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>
long n,k,a,m=1e9+7;main(){std::cin>>n>>k;while(k<n+2){a=(a+i*(n-i+1)+1)%m;k++;}std::cout<<a;}

Compiler output:
a.cc:2:20: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | long n,k,a,m=1e9+7;main(){std::cin>>n>>k;while(k<n+2){a=(a+i*(n-i+1)+1)%m;k++;}std::cout<<a;}
      |                    ^~~~
a.cc: In function 'int main()':
a.cc:2:60: error: 'i' was not declared in this scope
    2 | long n,k,a,m=1e9+7;main(){std::cin>>n>>k;while(k<n+2){a=(a+i*(n-i+1)+1)%m;k++;}std::cout<<a;}
      |                                                            ^
Language: C

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

int main() {
  long long n, k;
  cin >> n >> k;
  cout << (2 * k * k * k - 3 * k * k * n - 6 * k * k + 3 * k * n - 2 * k + 
           n * n * n + 3 * n * n + 8 * n + 12) / 6 % 1000000007 << 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;
int main(){
    int N,K;
    int i;
    cin>>N>>K;
    int count=0;
    for(i=K;i<=N;i++ ){
    count+=N*K-K*K+1}
    cout<<count<<endl;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: expected ';' before '}' token
    9 |     count+=N*K-K*K+1}
      |                     ^
      |                     ;
Language: C

#include<bits/stdc++.h>
using namespace std;
 
#define rep(i, a, n) for(int i=a; i<n; i++)
#define ll long long
#define all(x) begin(x), end(x)
#define toInt(x) (x - '0')
#define pll pair<ll, ll>
#define pli pair<ll, int>

const long long INF = 1LL<<60;
const int inf = 1 << 30;
const int mod = 1e9+7;


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; }

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

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> v(n+1);
  rep(i, 0, n+1){
    v[i] = i;
  }
  unordered_set<long long > st;
  vector<long long> s(n+1);
  s[0] = 0;
  rep(i, 1, n){
    s[i] = s[i-1] + v[i];
    // cout << s[i] << endl;
  }

  long long ans = 0;
  long long L, R;
  for (long long i=k; i<=n+1; i++){
    L = i * (i-1) / 2;
    R = i * (2 * n - i + 1) / 2;
    ans += (R - L + 1);
    ans %= mod;
  }
  cout << ans << endl;
}


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

// #pragma GCC optimize(“O2”)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include<bitset>
using namespace std;
#define pi 3.14159265358979323846264338327950254
 #define STDIN freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);//************************************


using namespace std;

typedef long long LL;
typedef long long ll;

const int N = 300010, mod = 1e9 + 7;


int fact[N], infact[N];


int qmi(int a, int k, int p)
{
    int res = 1;
    while (k)
    {
        if (k & 1) res = (LL)res * a % p;
        a = (LL)a * a % p;
        k >>= 1;
    }
    return res;
}

ll pre[N];
int main()
{
    //STDIN
    

    int a, b;
    scanf("%d%d", &a, &b);
    for (int i = 1; i <= a+1; i++)
    {
        pre[i] += pre[i-1] + i-1;
    }
    ll sum = 0;
    for (int i = b; i <= a + 1; i++)
    {
        sum = (pre[a+1]-pre[a-i+1]-pre[i] +1 + sum)% mod;
    }
    cout << sum << 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<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cmath>
#include<iostream>
using namespace std;
template<class _T>inline void read(_T &_a)
{
	bool f=0; char _c=getchar(); _a=0;
	while(_c<'0'||_c>'9'){ if(_c=='-') f=1; _c=getchar(); }
	while(_c>='0'&&_c<='9'){ _a=(_a<<3)+(_a<<1)-'0'+_c; _c=getchar(); }
	if(f) _a=-_a;
}

int n,k;
long longans,sum[200001];

int main()
{
	read(n); read(k);
	for (int i=1;i<=n;++i) sum[i]=sum[i-1]+i;
	while(k<=n+1)
	{
		ans+=sum[n]-sum[n-k]-sum[k-1];
		ans%=1000000007;
		++k;
	}
	printf("%lld",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   25 |                 ans+=sum[n]-sum[n-k]-sum[k-1];
      |                 ^~~
      |                 abs
a.cc:29:23: error: 'ans' was not declared in this scope; did you mean 'abs'?
   29 |         printf("%lld",ans);
      |                       ^~~
      |                       abs
Language: C++

using namespace std;
typedef long long ll;
#define MOD 1000000007
 
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
 
  ll n, k;
  cin >> n >> k;
 
  ll total = 0;
  for (ll i = k; i < n + 1; i++)
  {
    ll max = (n + n - i + 1) * i / 2;
    ll min = (i - 1) * i / 2;
    ll val = max - min + 1;
 
    total += val;
    //total %= MOD;
  }
 
  //if (total < 0)
  //  total += MOD;
 
  total += 1;
  //total %= MOD;
  cout << total << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'ios_base' has not been declared
    7 |   ios_base::sync_with_stdio(false);
      |   ^~~~~~~~
a.cc:8:3: error: 'cin' was not declared in this scope
    8 |   cin.tie(nullptr);
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:29:3: error: 'cout' was not declared in this scope
   29 |   cout << total << endl;
      |   ^~~~
a.cc:29:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:29:20: error: 'endl' was not declared in this scope
   29 |   cout << total << endl;
      |                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
Language: C++

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

int power(int x, int y, int p) 
{ 
    int res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
  
// Returns n^(-1) mod p 
int modInverse(int n, int p) 
{ 
    return power(n, p-2, p); 
} 
  
// Returns nCr % p using Fermat's little 
// theorem. 
int nCrModPFermat(int n, int r, int p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    int fac[n+1]; 
    fac[0] = 1; 
    for (int i=1 ; i<=n; i++) 
        fac[i] = fac[i-1]*i%p; 
  
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
} 

int main()
{
  int n,r;
  cin>>n>>r;
  if(n+1<r)
    cout<<0<<endl;
  else
  {
    cout<<nCrModPFermat(n, r, mod)<<endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:60:4: error: expected '}' at end of input
   60 |   }
      |    ^
a.cc:52:1: note: to match this '{'
   52 | {
      | ^
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 all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	ll ans = 0;
	for (ll i = k; i <= n + 1; ++i) {
		ll mx = (n - i + n + 1) * i / 2;
		ll mn = i * (i - 1) / 2;
		(ans += mx - mn + 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 <string>
#include <vector>
//#include <cmath>

using namespace std;

int main()
{
	int N, K, i, j, k, count = 0, countA = 0;
	string str;
	cin >> N >> K;
	for (i = 0;i < K;++i)
		count += i;//0～Kまでの総和
	for (j = K;j < N+1;++j)//最低K～最大N+1個まで選ぶ
		for(i=0;i<j;++i)
		countA += N-i;//0～Nまでの総和
		
	cout << countA - count;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'string' was not declared in this scope
   10 |         string str;
      |         ^~~~~~
a.cc:3:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    2 | #include <vector>
  +++ |+#include <string>
    3 | //#include <cmath>
a.cc:11:9: error: 'cin' was not declared in this scope
   11 |         cin >> N >> K;
      |         ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <vector>
  +++ |+#include <iostream>
    3 | //#include <cmath>
a.cc:18:9: error: 'cout' was not declared in this scope
   18 |         cout << countA - count;
      |         ^~~~
a.cc:18:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C

#include <bits/stdc++.h>
using namespace std;
using lli=long long int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using vi=vector<int>;  using vs=vector<string>; using gi=greater<int>;
#define soao(c) sort((c).begin(),(c).end()) //昇順
#define sodo(c) sort((c).begin(),(c).end(),gi()) //降順
#define rev(c) reverse((c).begin(), (c).end())

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


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

#include <bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(ll i =(l);(i)<(r);(i)++)
const ll MOD=1e9+7;
using namespace std;
int main(){
    ll n,k;
    cin>>n>>k;
    ll ans=0;
    rep(num,k,n+2){
        ans+=( ((n+1)*n)/2-((n-num+1)*(n-num))/2-((num-1)*num)/2 )+1;
        ans%=MOD;
    }
    cout<<ans<<endl;
}


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

#include<iostream>int main(){int64_t n,k,a=0;std::cin>>n>>k;for(int i=k;i<n+2;i++)a=(a+i*(n-i+1)+1)%1000000007;std::cout<<a<<std::endl;}

Compiler output:
a.cc:1:23: warning: extra tokens at end of #include directive
    1 | #include<iostream>int main(){int64_t n,k,a=0;std::cin>>n>>k;for(int i=k;i<n+2;i++)a=(a+i*(n-i+1)+1)%1000000007;std::cout<<a<<std::endl;}
      |                       ^~~~
a.cc:1:9: fatal error: iostream>in: No such file or directory
    1 | #include<iostream>int main(){int64_t n,k,a=0;std::cin>>n>>k;for(int i=k;i<n+2;i++)a=(a+i*(n-i+1)+1)%1000000007;std::cout<<a<<std::endl;}
      |         ^~~~~~~~~~~~~
compilation terminated.
Language: C

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

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

//参考：http://ehafib.hatenablog.com/entry/2015/12/23/164517
//インクルード
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 10000007 //10^9+7
#define PB push_back
#define MP make_pair
#define F first
#define S second
// #MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

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


Compiler output:
a.cc: In function 'int main()':
a.cc:47:54: error: 'mod' was not declared in this scope; did you mean 'modf'?
   47 |         ans+=((n*(n+1)/2)-(i*(i-1)/2)-(x*(x+1)/2)+1)%mod;
      |                                                      ^~~
      |                                                      modf
Language: C++

#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
#define fir first
#define sec second
#define m_p make_pair
#define y1 ygftgfgcdtfgxffgx
#define y2 yfdsesgvtyghftfvv
#define x1 xvyr6cf6fgcfgf676
#define x2 xcr6rfc5r66y6r6fr
#define up_bound upper_bound
#define low_bound lower_bound
#define next_per next_permutation
#define pb push_back
#define i_to_s to_string
typedef priority_queue<int> p_queue;
typedef priority_queue<int, vector<int>, greater<int> > min_p_queue;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int mon[20]={31,28,31,30,31,30,31,31,30,31,30,31};
ll gcd(ll x,ll y){return ((y==0)?x:gcd(y,x%y));}
ll n,k,sum1,sum2,ans;
const ll mod=1e9;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n>>k;
//	while(k<=n){
//		sum1=0,sum2=0;
//		for(ll i=0;i<k;i++)sum1+=i,sum1%=mod;
//		for(ll i=0;i<k;i++)sum2+=(n-i),sum2%=mod;
//		ans+=((sum2+mod-sum1+1)%mod);ans%=mod;
//		k++;
//	}
//	cout<<ans;
	cin>>n>>k;
	for(int i=k;i<n+2;i++)ans=(ans+i*(n-i+1)+1)%mod;
	cout<<a;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:15: error: 'a' was not declared in this scope
   42 |         cout<<a;
      |               ^
Language: C

#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

const long long MOD = 1e9 + 7;

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

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

	long long result = 0;
	for (long long i = K; i <= N + 1; i++)
	{
		long long left = i * (i - 1) / 2;
		long long right = N * (N + 1) / 2 - (N - i) * (N - i + 1) / 2;
		long long count = right - left + 1;
		result = (result + count) % MOD;
	}

	cout << result % MOD;

	return 0;
}


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

use proconio::input;
const MODN:i128 = 1000000007;

fn main() {
    input!{
        n:i128,
        k:i128,
    }
    let mut ans = 0;
    for sel in k..=n+1{
        ans = ((ans as i128) % MODN + (((2*n-(sel-1)) * sel / 2 - (sel-1) * sel / 2 + 1_i128)) % MODN) as i32;
    }
    println!("{}",ans);
}

Compiler output:
main.c:1:1: error: unknown type name 'use'
    1 | use proconio::input;
      | ^~~
main.c:1:13: error: expected '=', ',', ';', 'asm' or '__attribute__' before '::' token
    1 | use proconio::input;
      |             ^~
main.c:2:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
    2 | const MODN:i128 = 1000000007;
      |           ^
main.c:4:1: error: unknown type name 'fn'
    4 | fn main() {
      | ^~
main.c: In function 'main':
main.c:5:5: error: 'input' undeclared (first use in this function); did you mean 'int'?
    5 |     input!{
      |     ^~~~~
      |     int
main.c:5:5: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:10: error: expected ';' before '!' token
    5 |     input!{
      |          ^
      |          ;
main.c:10:9: error: expected '(' before 'sel'
   10 |     for sel in k..=n+1{
      |         ^~~
      |         (
main.c:10:9: error: 'sel' undeclared (first use in this function)
   10 |     for sel in k..=n+1{
      |         ^~~
main.c:11:87: error: invalid suffix "_i128" on integer constant
   11 |         ans = ((ans as i128) % MODN + (((2*n-(sel-1)) * sel / 2 - (sel-1) * sel / 2 + 1_i128)) % MODN) as i32;
      |                                                                                       ^~~~~~
Language: C++

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

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

    long int total = 0;

    for(long int i=K;i<=N+1;i++) {
        long int min = ((i-1)*i/2);
        long int max = ((N+N-i+1)*i/2);

        total += (max - min + 1)%1000000007;
    }

    cout << total << endl;


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

#include <bits/stdc++.h>

using namespace std;
int main()
{
    // 整数の入力
    int N,K;
    cin >> N >> K;
    // スペース区切りの整数の入力
    int ans = 0;
    for (i = K; i < N+2; i++){
        ans += i(N-i+1)+1;
    }
    cout << ans%1000000007;
    return 0;
}

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

#include <iostream>
using namespace std;

const long long MOD = 1000000007;

int main() {
    long long N, K;

    cin >> N >> K;

    long long p;
    for (int i = 0; i < 99; i++) {
        p = (p * 10) % MOD;
    }

    long long sum = 0;

    for (long long k = K; k <= N + 1; k++) {
        long long min = (0 + k - 1) * k / 2;
        long long max = (N + N - k + 1) * k / 2;

        min %= MOD;
        max %= MOD;

        sum += (max - min + 1);
    }

    cout << sum % MOD << endl;
}


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

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


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

    ll n,k;
    cin >> n >> k;
    ll ans = 0;
    for(ll i = k; i<n+2; i++){
        ll tmp =  i*(2*n-i+1)/2 - i*(i-1)/2 + 1;
        /*cout << i << " ";
        cout << i*(2*n-i+1)/2 ;
        cout << i*(i-1)/2 <<endl; */
        ans += tmp;
        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 rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート
#define INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main() {
    int N,K;cin >> N >> K;
    LL ans = 0;
    vector<LL> rui(N+2);
    rep(i,N+1){
        rui[i+1] = rui[i] + i+1;
    }

    for(int i = K;i <= N+1;i++){
        LL mini = rui[i];
        LL maxi = rui[N+1] - rui[N+1-i];
        LL tmp = maxi - mini + 1;
        ans += tmp;
        ans %= MOD;
    }

    cout << ans << endl;
}

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

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

int main(){
    long long N,K;
    cin >> N >> K;
    long long sum=0;
    long long min,max;
    min=0;
    max=0;
    for(long long i=1;i<K;i++){
        min=min+i-1;
        max=max+N-(i-1);
    }
    for(long long i=K;i<=N+1;i++){
        min=min+i-1;
        max=max+N-(i-1);
        sum=(sum+1+max-min)%(1e9+7);
    }

    cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:28: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   24 |         sum=(sum+1+max-min)%(1e9+7);
      |             ~~~~~~~~~~~~~~~^~~~~~~~
      |                       |         |
      |                       |         double
      |                       long long int
Language: C++

#include <bits/stdc++.h>

using namespace std;
int main()
{
    // 整数の入力
    int N,K;
    cin >> N >> K;
    // スペース区切りの整数の入力
    ans = ((N+1)*(N*N+2*N+6)-(K-1)*(-2*K*K+(3*N+4)*K+6))/6;
    cout << ans%1000000007;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |     ans = ((N+1)*(N*N+2*N+6)-(K-1)*(-2*K*K+(3*N+4)*K+6))/6;
      |     ^~~
      |     abs
Language: C++

#include <bits/stdc++.h>

using namespace std;
int main()
{
    // 整数の入力
    int N,K;
    cin >> N >> K;
    // スペース区切りの整数の入力
    ans = ((N+1)(N*N+2*N+6)-(K-1)(-2*K*K+(3*N+4)*K+6))/6;
    cout << ans%1000000007;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |     ans = ((N+1)(N*N+2*N+6)-(K-1)(-2*K*K+(3*N+4)*K+6))/6;
      |     ^~~
      |     abs
a.cc:10:17: error: expression cannot be used as a function
   10 |     ans = ((N+1)(N*N+2*N+6)-(K-1)(-2*K*K+(3*N+4)*K+6))/6;
      |            ~~~~~^~~~~~~~~~~
a.cc:10:34: error: expression cannot be used as a function
   10 |     ans = ((N+1)(N*N+2*N+6)-(K-1)(-2*K*K+(3*N+4)*K+6))/6;
      |                             ~~~~~^~~~~~~~~~~~~~~~~~~~
Language: C

#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind
#define rt (a); return (a); 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 1000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
llint gcd(llint a, llint b) {
	if (b > a)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
llint Tow(int n) {//2のn乗
	if (n == 0)return 1;
	llint x = Tow(n / 2);
	x %= mod;
	x *= x;
	x %= mod;
	if (n % 2 == 1)x *= 10;
	x %= mod;
	return x;
}

int main() {
	int n,k;
	cin >> n >> k;
	int ans = 0;
	map<int, int> S;
	stack<string> st;
	st.push("");
	while (!st.empty()) {
		string now = st.top();
		st.pop();
		if (now.size() == n+1) {
			int sum = 0,x=0;
			rep(i, 0, n+1) {
				if (now[i] == '1') {
					sum+=i;
					x++;
				}
			}
			if (S[sum] == 0 && x >= k) {
				ans++;
				ans %= mod;
				S[sum] = 1;
			}

		}
		else {
			for (int i = 2 - 1; i >= 0; i--) {
				string next = now + to_string(i);
				st.push(next);
			}
		}
	}
	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

//xenowi`tz -- Jai Shree Ram
#include<bits/stdc++.h>
using namespace std;

#define fori(i,a,b) for (long long int i = a; i <= b ; ++i)
#define ford(i,a,b) for(long long int i = a;i >= b ; --i)
#define mk make_pair
#define mod 1000000007
#define MAXN 200005
#define pb push_back
#define vec vector<long long int>
#define ll long long
#define rnd mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count())
#define pi pair<long long int,long long int>
#define sc second
#define fs first


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	ll n, k;
	cin >> n >> k;
	
	ll ans = 0;

	fori(i,k,n+1) {
		ll l = i*(i-1)/2;
		ll r = i*(2*n-i+1)/2;
		if (l <= r) {
			ans += (r-l+1);		
		}
	}

	cout << ans << endl;

	return 0;
}


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 <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <bits/stdc++.h>
using namespace std;
long long int mod=1000000007;
set<long long int> hoge;
long long int c(long long int n,long long int r){
  long long int re=1;
  for(int i=0; i<r; i++){
    re*=n-i;
    re%=mod;
  }
  for(int i=0; i<r; i++){
    re/=r-i;
    re%=mod;
  }
  return re;
}
int main(void){
  long long int n;
  cin>>n;
  long long int k;
  cin>>k;
  long long int low;
  long long int high;
  long long int ruiseki_low[n+1];
  ruiseki_low[0]=0;
  long long int ruiseki_high[n+1];
  ruiseki_high[0]=n;
  for(int i=1; i<=n; i++){
    ruiseki_low[i]=ruiseki_low[i-1]+i;
    ruiseki_high[i]=ruiseki_high[i-1]+n-i;
  }
  long long int ans=0;
  for(int i=k; i<=n+1; i++){
    low=ruiseki_low[i-1];
    high=ruiseki_high[i-1];
    ans+=high-low+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>
#define exrep(i, a, b) for(long long i = a; i <= b; i++)
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  ll n,k;
  cin >> n >> k;
  ll ans=0;
  exrep(r,k,n+1){
    ans+=r*(n-r+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 <bits/stdc++.h>

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

#define MOD 1000000007

#pragma region Debug
void debug_out() { cout << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cout << H << " ";
	debug_out(T...);
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
#pragma endregion

// コンパイル時、エイリアス「debug」を使用 --> マクロが使えるように

void solve(){
	#define int ll
	// ここに処理を記述
	// コンパイル時はエイリアス「gpp」--> c++17でコンパイル
	ll N, K;
	cin >> N >> K;

	// 累積和
	vector<ll> sum(N+1,0);
	rep(i,N){
		sum[i+1] += sum[i] + (i+1);
		sum[i+1] = sum[i+1] % MOD;
	}

	ll ans = 0;
	FOR(i,K,N+1){
		ll min = sum[i-1];
		min = min % MOD;
		ll max = sum[N] - sum[N-i];
		max = max % MOD;
		// debug(min, max);
		ll plus = max - min + 1;
		if(plus < 0) plus += MOD;
		ans += plus;
		ans = ans % MOD;
	}
	// 全部選んだ時
	ans += 1;

	cout << ans << endl;

}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	
	solve();
	return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,k,a=0;cin>>n>>k;
    for(int t=k;t<n+2;t++)a+=((n-t+1)*t+1)%MOD;
    printf("%lld\n",a);}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:44: error: 'MOD' was not declared in this scope
    5 |     for(int t=k;t<n+2;t++)a+=((n-t+1)*t+1)%MOD;
      |                                            ^~~
Language: C

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


using namespace std;

const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;


//#define DEBUG

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ":" << (A) << std::endl;
#else
#define PRINT(A)
#endif

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 A, B;
int a[10010][10010], b[1000];
int dp[10010][3];
 
int main()
{
    ll N, K; cin >> N >> K;
    ll sum = 0;
    
    ll upperSum;
    ll lowerSum;

    for(ll k = K; k <= N+1; k++){
        
        upperSum = (N+1)*N/2 -(N-k+1)*(N-k)/2;
        lowerSum = (k)*(k-1)/2;
        PRINT(upperSum)
        PRINT(lowerSum)
        sum += upperSum - lowerSum + 1;
        
        sum = sum % mod;
    }

    cout << sum << 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;
int main(){
	long long n,k,sum=0;
	cin>>n>>k;
	for(long long i=k;i<=n+1;i++){
		sum+=(n*i-i*i+i+1);
	}
	cout<<sum%1000000007;
	return 0;
}

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

#include<iostream>
using namespace std;

int main(){
    long long n, k;
    cin >> n >> k;
    long long sum = 0;
    for(long long i = k; i <= n+1; i++){
        long long min = i * (i-1) / 2;
        long long max = n * i - min;
        sum += max - min + 1;
    }
    sum %= 1000000007;
    cout << sum << endl;
    return 0;
}

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

N,K=map(int,input().split())
ans=0
for i in range(K,N+2):
    kos=i*(N-i+1)+1
    ans=(ans+kos)%(10**9+7)
print(ans)

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:3: error: type defaults to 'int' in declaration of 'K' [-Wimplicit-int]
    1 | N,K=map(int,input().split())
      |   ^
main.c:1:5: error: implicit declaration of function 'map' [-Wimplicit-function-declaration]
    1 | N,K=map(int,input().split())
      |     ^~~
main.c:1:9: error: expected expression before 'int'
    1 | N,K=map(int,input().split())
      |         ^~~
main.c:2:1: error: expected ',' or ';' before 'ans'
    2 | ans=0
      | ^~~
Language: C

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
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; }
typedef long long ll;
typedef pair<int,int> P;

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 {
    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 {
    mint res(*this);
    return res/=a;
  }
};


int main(){
    ll n,k;
    cin >> n >> k;
    mint ans = 0;
    for(ll i=k;i<=n+1;i++){
        ans += (2*n-i+1)*i/2;
        ans -= i*(i-1)/2;
        ans += 1;
    }
    cout << ans.x << 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 ll = long long;
using P = pair<int, int>;

const int MOD = 1000000007;
const int MAX = 200000;

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

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

#include <iostream>

using namespace std;

int main () {
  int a, b; 
  cin >> a >> b;
  long int c[100] = {0}; const int d = b + 1;
  const int g = b + 2; int h = 0;
 long int e[g]; long int f[g];
  for (int i = b; i <= d; i++) {
  e[i] = 1; f[i] = 1;
    for (int j = 0; j < i; j++) {
      e[i] *= d - j; f[i] *= ( j + 1 ); }
      e[i] /= f[i];
      }
      for (int i = b; i <= d; i++) {
      c[h] += e[i];
      if(c[h] >= 1000000007) {
      c[h] %= 1000000007; h += 1; 
      }
     long int sum;
     for (int i = 0; i <= h; i++)
     sum += c[h];
     cout << sum;
     }
      


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

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll N,K,a,b,ans=0;
  cin>>N>>K;
  for(ll i=K;i<=N+1;i++){
  a=(2*N-i+1)*i/2;
  else{b=(i-1)*i/2;}
  ans+=a-b+1;
  }
  cout<<ans%1000000007<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'else' without a previous 'if'
    9 |   else{b=(i-1)*i/2;}
      |   ^~~~
Language: C++

#include <iostream>
#include <math.h>
using namespace std;
typedef long long ll;

int main(){
  ll n, k;
  cin >> n >> k;
  ll min = 0;
  ll max = 0;
  ll count = 0;
  for (k; k<=n+1; k++){
    
    for(int j=0; j<k; j++){
      min += j;
      max += (n-j);
    }
    count += (max-min+1);
    min = 0;
    max = 0;
    
  }
  cout << count % (pow(10, 9) + 7) << endl;
  return 0;
}


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

#include <iostream>

using namespace std;

int main () {
  int a, b; 
  cin >> a >> b;
  long int c[100] = {0}; const int d = c + 1;
  const int g = c + 2; int h = 0;
 long int e[g]; long int f[g];
  for (int i = b; i <= d; i++) {
  e[i] = 1; f[i] = 1;
    for (int j = 0; j < i; j++) {
      e[i] *= d - j; f[i] *= ( j + 1 ); }
      e[i] /= f[i];
      }
      for (int i = b; i <= d; i++) {
      c[h] += e[i];
      if(c[h] >= 1000000007) {
      c[h] %= 1000000007; h += 1; 
      }
     long int sum;
     for (int i = 0; i <= h; i++)
     sum += c[h];
     cout << sum;
     }
      


Compiler output:
a.cc: In function 'int main()':
a.cc:8:42: error: invalid conversion from 'long int*' to 'int' [-fpermissive]
    8 |   long int c[100] = {0}; const int d = c + 1;
      |                                        ~~^~~
      |                                          |
      |                                          long int*
a.cc:9:19: error: invalid conversion from 'long int*' to 'int' [-fpermissive]
    9 |   const int g = c + 2; int h = 0;
      |                 ~~^~~
      |                   |
      |                   long int*
a.cc:26:7: error: expected '}' at end of input
   26 |      }
      |       ^
a.cc:5:13: note: to match this '{'
    5 | int main () {
      |             ^