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

#include<iostream>
using namespace std;
int main(){
	int N,K,pro;
	unsigned long int sum;
	cin>>N>>K;
	for(int i=K;i<=N+1;i++){
		pro=1;
		cou=0;
		for(int t=N-i+1;t<=N+1;t++)pro*=t;
		for(int t=1;t<=i;t++)pro/=t;
		sum+=pro;
		sum%=1000000007;
	}
	cout<<sum<<endl;
}

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

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

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

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

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

int main() {
  int N, K;
  cin >> N >> K;
  int count = 0;
  for(int i = K; i < N + 1; i++) {
    count = count + (N * (N + 1)) / 2 - ((N-i) * (N - i + 1)) / 2 - (i * (i - 1)) / 2 + 1;
  }
  count++;
  while (count >= 1000000007){
    count %= 1000000007;
  }
  cout << count << 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;

int64_t n,k;
int64_t div=100000007;

int64_t frac(int64_t val){
  if(val == 0) return 1;
  else return(val-1)*val%div;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int64_t comb(int64_t val){
  return modinv(frac(n),(frac(val)*frac(n-val)))%div - (val-1)%div;
}

int main(){
  cin >> n >> k;
  int64_t cnt=0;
  for(int i=k;i<n+1;i++){
    cnt+=comb(k)%div;
  }
  cout << cnt << endl;
}

Compiler output:
a.cc:5:9: error: 'int64_t div' redeclared as different kind of entity
    5 | int64_t div=100000007;
      |         ^~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:992:14: note: previous declaration 'div_t div(int, int)'
  992 | extern div_t div (int __numer, int __denom)
      |              ^~~
a.cc: In function 'int64_t frac(int64_t)':
a.cc:9:25: error: invalid operands of types 'int64_t' {aka 'long int'} and '<unresolved overloaded function type>' to binary 'operator%'
    9 |   else return(val-1)*val%div;
      |              ~~~~~~~~~~~^~~~
a.cc: In function 'int64_t comb(int64_t)':
a.cc:25:49: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator%'
   25 |   return modinv(frac(n),(frac(val)*frac(n-val)))%div - (val-1)%div;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
a.cc:25:63: error: invalid operands of types 'int64_t' {aka 'long int'} and '<unresolved overloaded function type>' to binary 'operator%'
   25 |   return modinv(frac(n),(frac(val)*frac(n-val)))%div - (val-1)%div;
      |                                                        ~~~~~~~^~~~
a.cc: In function 'int main()':
a.cc:32:17: error: invalid operands of types 'int64_t' {aka 'long int'} and '<unresolved overloaded function type>' to binary 'operator%'
   32 |     cnt+=comb(k)%div;
      |          ~~~~~~~^~~~
Language: C++

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

#include<math.h>

#include "header.h"
typedef long long ll;
using namespace std;

ll comb(ll a, ll b)
{
	ll bunshi = 1;
	for(ll i = 0; i != b; i++)
	{
		bunshi *= a - i; 
	}
	return bunshi / kaizyo(b);
}

int main()
{
	// ll n, k;
	// vector<ll> a;
	// cin >> n >> k;
	// for(ll i = 0; i < n-1; i++)
	// {
	// 	ll v;
	// 	cin >> v;
	// 	a.push_back(v);
	// }

	// vector<ll> num(n , 0);
	// for(ll i = 0; i < n-1; i++)
	// {
	// 	num.at((a.at(i) - 1))++;
	// }

	// for(ll i = 0; i < n; i++)
	// {
	// 	cout << num.at(i) << endl;
	// }

	ll n, k;
	cin >> n >> k;
	
	ll num = 0;
	for(ll i = 0; i <= k; i++)
	{
		num += comb(n+1, k+i);
	}
	num -= n - 2;
	cout << num;
	return 0;
}

Compiler output:
a.cc:8:10: fatal error: header.h: No such file or directory
    8 | #include "header.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
using namespace std;
int main(){
	int N,K,pro,cou;
	unsigned long int sum;
	cin>>N>>K;
	for(int i=K;i<=N+1;i++){
		pro=1;
		cou=0;
		for(int t=N-i+1;t<=N+1;t++){
			cou++;
			pro*=t/cou;
		}
		pro/=i!;
		sum+=pro;
		sum%=1000000007;
	}
	cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:23: error: expected ';' before '!' token
   14 |                 pro/=i!;
      |                       ^
      |                       ;
Language: C

nk = input('').split(' ')
n = int(nk[0])+1
k = int(nk[1])

x=1
mod = 10 ** 9 + 7

for i in range(k,n+1):
    p=1
    for j in range(k,i+1):
        p*=j
        p%=mod
    p/=i
    x+=p

print(int(x))


Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | nk = input('').split(' ')
      | ^~
main.c:1:1: error: type defaults to 'int' in declaration of 'nk' [-Wimplicit-int]
main.c:1:6: error: implicit declaration of function 'input' [-Wimplicit-function-declaration]
    1 | nk = input('').split(' ')
      |      ^~~~~
main.c:1:12: error: empty character constant
    1 | nk = input('').split(' ')
      |            ^~
main.c:1:15: error: request for member 'split' in something not a structure or union
    1 | nk = input('').split(' ')
      |               ^
main.c:2:1: error: expected ',' or ';' before 'n'
    2 | n = int(nk[0])+1
      | ^
Language: C++

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

int64_t n,k;
const int64_t div=100000007;

int64_t frac(int64_t val){
  if(val == 0) return 1;
  else return(val-1)*val%div;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int64_t comb(int64_t val){
  return modinv(frac(n),(frac(val)*frac(n-val)))%div - (val-1)%div;
}

int main(){
  cin >> n >> k;
  int64_t cnt=0;
  for(int i=k;i<n+1;i++){
    cnt+=comb(k)%div;
  }
  cout << cnt << endl;
}

Compiler output:
a.cc:5:15: error: 'const int64_t div' redeclared as different kind of entity
    5 | const int64_t div=100000007;
      |               ^~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/stdlib.h:992:14: note: previous declaration 'div_t div(int, int)'
  992 | extern div_t div (int __numer, int __denom)
      |              ^~~
a.cc: In function 'int64_t frac(int64_t)':
a.cc:9:25: error: invalid operands of types 'int64_t' {aka 'long int'} and '<unresolved overloaded function type>' to binary 'operator%'
    9 |   else return(val-1)*val%div;
      |              ~~~~~~~~~~~^~~~
a.cc: In function 'int64_t comb(int64_t)':
a.cc:25:49: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator%'
   25 |   return modinv(frac(n),(frac(val)*frac(n-val)))%div - (val-1)%div;
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
a.cc:25:63: error: invalid operands of types 'int64_t' {aka 'long int'} and '<unresolved overloaded function type>' to binary 'operator%'
   25 |   return modinv(frac(n),(frac(val)*frac(n-val)))%div - (val-1)%div;
      |                                                        ~~~~~~~^~~~
a.cc: In function 'int main()':
a.cc:32:17: error: invalid operands of types 'int64_t' {aka 'long int'} and '<unresolved overloaded function type>' to binary 'operator%'
   32 |     cnt+=comb(k)%div;
      |          ~~~~~~~^~~~
Language: C++

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

long long sum_ra(long long fi, long long la)
{
	return (fi + la) * (la - fi + 1) / 2;
}

int main()
{
	long long n, k;
	cin >> n >> k;
	unsigned long long sum = 0;
	for (long long i = k; i <= n + 1; i++)
	{
		sum += ((sum_ra(n - i + 1, n) - sum_ra(0, i - 1)) + 1);
		sum %= long long(1e9 + 7);
	}
	cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:24: error: expected primary-expression before 'long'
   17 |                 sum %= long long(1e9 + 7);
      |                        ^~~~
Language: C

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

const int MAX = 200001;

int fac[200010];
int finv[200010];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    finv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        finv[i] = MOD - finv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * finv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


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

	int ans = 0;
	for(int i = k; i <= n; i++) {
		ans += COM(n+1, i), ans %= MOD;
		// cout << n+1 << " " << i << " " << COM(n+1, i) << endl;
		// ans -= (i-1);
		//cout << COM(n+1, i) << endl;
		ans += MOD;
		int d = n+1-i;
		ans -= d * (d-1) / 2;
		ans %= MOD;
	}
	cout << ans + 1 << 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 _GLIBCXX_DEBUG
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define vl vector<ll>

int main(){
    ll M=1000000007;
    ll n,k;cin>>n>>k;
    ll sum=0;

    vl s(n+1);rep(i,n+1)s[i]+=i;//s[0]~s[n]のn+1個

    for(ll i=k;i<n+1;i++){
        sum+=s[n]-s[n-i]-s[i-1]+1
        if(sum>1000000007)sum%1000000007;
    }

    cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:34: error: expected ';' before 'if'
   16 |         sum+=s[n]-s[n-i]-s[i-1]+1
      |                                  ^
      |                                  ;
   17 |         if(sum>1000000007)sum%1000000007;
      |         ~~
Language: C

#include<stdio.h>
int main(void){
	long long int n,k,ans=0,temp;
	scanf("%lld %lld",&n,k);
	for(int i=k;i<n+2;i++){
		temp=i*(2*n-i+1)/2;
		temp-=i*(i+1)/2;
		ans+=(temp%1000000007);
		ans=ans%1000000007
	}
	printf("%lld",ans);
}

Compiler output:
main.c: In function 'main':
main.c:9:35: error: expected ';' before '}' token
    9 |                 ans=ans%1000000007
      |                                   ^
      |                                   ;
   10 |         }
      |         ~
Language: C

#include <stdio.h>
#include <math.h>

int main(void)
{
  long int i, n, k, min = 0, max = 0, sum = 0, result = 0;
  
  scanf("%ld %ld", &n, &k);
  
  for( i = 0; i <= n; i++ ){
      min += i;
      max += n-i;

      if( i >= k-1 ){
        sum += ( max - min + 1 );
      }
  }

    result = sum % 1000000007;
  printf("%ld\n", result);
  return 0;

Compiler output:
main.c: In function 'main':
main.c:21:3: error: expected declaration or statement at end of input
   21 |   return 0;
      |   ^~~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
int N, K;
cin >> N;
cin >> K;
int s = 0;
for (int i = K ; i <= N +1; ++i) s += i*( N*2 -i +3)/2 +1;
  s = s % 1000000007
  cout << s << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:21: error: expected ';' before 'cout'
    9 |   s = s % 1000000007
      |                     ^
      |                     ;
   10 |   cout << s << endl;
      |   ~~~~
Language: C

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

int main()
{
    ll N, K;
    cin >> N >> K;
    ll ans = 0;
    for (ll i = K; i < N + 2; i++)
    {
        ll sum1 = i * (i - 1) / 2;
        ll sum2 = i * ((N - i + 1) + N) / 2;
        ll sum = (sum2 % MOD - sum1 % MOD) % MOD;
        if (sum < 0)
        {
            sum += MOD;
        }
        ans += (sum + 1) % MOD;
        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 = 0; const int d = c + 1;
  int e[d] = {0}; int f[d];
  for (int i = b; i <= d; i++) {
  e[i] = 1; f[i] = 1;
    for (int j = 0; j < i; j++) {
      e[i] *= n-j; f[i] *= ( j + 1 ); }
      e[i] /= f[i];
      c += e[i]; }
      cout << (c < 1000000007 ? (c % 1000000007) : c) << '\n';
      }
      

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: 'n' was not declared in this scope
   13 |       e[i] *= n-j; f[i] *= ( j + 1 ); }
      |               ^
Language: C

n,k=map(int,input().split())
def po(a,t,p):
    bi=str(format(t,"b"))#2進表現に
    res=1
    for i in range(len(bi)):
    res=(res*res) %p
        if bi[i]=="1":
          res=(res*a) %p
    return res
print(po(2,n+1,1000000007)-po(2,k-1,1000000007))

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 'def'
    2 | def po(a,t,p):
      | ^~~
main.c:3:26: error: stray '#' in program
    3 |     bi=str(format(t,"b"))#2進表現に
      |                          ^
main.c:3:27: error: invalid suffix "進表現に" on integer constant
    3 |     bi=str(format(t,"b"))#2進表現に
      |                           ^~~~~~~~~
Language: C

#include <bits/stdc++.h>

using namespace std;

const long long MOD = 1e9 + 7;



int main(void){
  long long N,K;
  long long min=0;
  long long max=0;
  long long sum=0;

  cin >> N >> K;

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

  for(int i=K;i<=N;i++){
    sum = (sum + (max - min + 1))%MOD;
    min = min + i;
    max = max + N - i;
  }

  cout << sum%MOD + 1 << 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)++)
int main(){
  int64_t N;
  int K;
  cin >> N >> K;
  int64_t ans = 0;
  for (int64_t i = K; i < N+2; i ++){
    ans += ((N + 2) * (N+1) /2) - (i * (i+1) /2) - ((N + 1 - i) * (N + 2-i) / 2) + 1;
  }
  
  int64_t a = 1000000007;
  cout << ans % a << 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++

//
//  sum_of_large_number.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

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


int main(int argc, const char* argv[]) {

  int n, k;
  std::cin >> n >> k;

  ll C[n+2];
  memset(C, 0, sizeof(C));

  C[0] = 1;  // nC0 is 1

    for (int i = 1; i <= n+1; i++)
    {
        C[i] = (((n - i + 2) * C[i-1]) / i) % mod;
    }

  ll sum = 0;
  for (int i = k; i <= n+1; i++) {
    (sum += C[i]) %= mod;
    int repeat = ((n+1) / i) - 1;
    sum = (sum - repeat + mod) % mod;
  }
  std::cout << sum << std::endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:22:3: error: 'memset' was not declared in this scope
   22 |   memset(C, 0, sizeof(C));
      |   ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <math.h>
  +++ |+#include <cstring>
   11 | using namespace std;
Language: C

#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0L)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 10*10
#define EPS 1e-9

//----***パーツ***----
#define fr first
#define se second

//----***入出力***---
#define print(out) cout<< out  << "\n";
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);};}initial_;

int N,M,K;
string S;

signed main(){
  cin>>N>>K;
  int sum=0;
  vector<int> v(200100,0);
  REP(i,1,N+1){
    v[i]+=i+v[i-1];
  }

  REP(i,K,N+1){
    int left=v[i-1],right=v[N]-v[N-i];
    sum+=right-left+1;
    sum%=MOD;
  }
  sum++;
  print(sum)


}


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>
long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}
int main(int argc, const char * argv[]) {



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

    /////////////////////
    // Write code below /
    /////////////////////
    int N,K,i;
    long long int ans = 0;

    cin >>N>>K;

    for(i = K;i < N+1;i++){
        ans += combi(N+1,i);
    }
    cout <<ans<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:13:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   13 |     cin.tie(0);
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:14:5: error: 'ios' has not been declared
   14 |     ios::sync_with_stdio(false);
      |     ^~~
a.cc:27:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   27 |     cout <<ans<<endl;
      |     ^~~~
      |     std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:27:17: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   27 |     cout <<ans<<endl;
      |                 ^~~~
      |                 std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~
Language: C

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
int chrtoint(char a){
int i;
for (i = 48; i<=57; i++)
if (toascii(i)==a) return i-48;
return 0;
}

void main(){
char n1[80];
char n2[80];
int rs[80];
int c1, c2;

int i,j,m, cmax, sum;

//printf("Enter First Number:");
scanf("%s", &n1);
//rintf("\nEnter Second Number:");
scanf("%s", &n2);
c1 = strlen(n1);
c2 = strlen(n2);

strrev(n1);
strrev(n2);

cmax = c1;
if(c1<c2){
cmax = c2;
}

m=0;
for(i=0; i< cmax; i++){
if(c1==c2 || (i < c1 && i < c2)){
sum = m+chrtoint(n1[i])+chrtoint(n2[i]);
}else if(i >=c1){
sum = m+chrtoint(n2[i]);
}else if(i >=c2){
sum = m+chrtoint(n1[i]);
}
rs[i] = sum%10;
m = sum/10;
}

if(m){
rs[i]=m;
i++;
}

//printf("\nResult: ");
for(j=0; j < i; j++){
printf("%d", rs[i-j-1]);
}

}


Compiler output:
main.c: In function 'main':
main.c:27:1: error: implicit declaration of function 'strrev'; did you mean 'strsep'? [-Wimplicit-function-declaration]
   27 | strrev(n1);
      | ^~~~~~
      | strsep
Language: C

#include <iostream>
using namespace std;
int main(void){
    int64_t N, K;
    cin >> N >> K;
    
    int64_t sum = 0;
    
    for (int i = 0; i < N - K + 2; i++){
        sum += ((N - K + 1 - i) + N) * (K + i) / 2 - (0 + (K + i - 1)) * (K + i) / 2 + 1;
    }
            if (sum > 1000000007)
            sum %= 1000000007;
    cout << sum << endl;
}


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

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
int chrtoint(char a){
int i;
for (i = 48; i<=57; i++)
if (toascii(i)==a) return i-48;
return 0;
}

void main(){
char n1[80];
char n2[80];
int rs[80];
int c1, c2;

int i,j,m, cmax, sum;

printf("Enter First Number:");
scanf("%s", &n1);
printf("\nEnter Second Number:");
scanf("%s", &n2);
c1 = strlen(n1);
c2 = strlen(n2);

strrev(n1);
strrev(n2);

cmax = c1;
if(c1<c2){
cmax = c2;
}

m=0;
for(i=0; i< cmax; i++){
if(c1==c2 || (i < c1 && i < c2)){
sum = m+chrtoint(n1[i])+chrtoint(n2[i]);
}else if(i >=c1){
sum = m+chrtoint(n2[i]);
}else if(i >=c2){
sum = m+chrtoint(n1[i]);
}
rs[i] = sum%10;
m = sum/10;
}

if(m){
rs[i]=m;
i++;
}

printf("\nResult: ");
for(j=0; j < i; j++){
printf("%d\n", rs[i-j-1]);
}

}

Compiler output:
main.c: In function 'main':
main.c:27:1: error: implicit declaration of function 'strrev'; did you mean 'strsep'? [-Wimplicit-function-declaration]
   27 | strrev(n1);
      | ^~~~~~
      | strsep
Language: C++

#include<iostream>
using namespace std;
int main(){
	int N,K,pro;
	unsigned long int sum;
	cin>>N>>K;
	for(int i=K;i<=N+1;i++){
		pro=1;
		for(int t=N-i+1;t<=N+1;t++){
			pro*=t;
		}
		pro/=i!;
		sum+=pro;
		sum%=1000000007;
	}
	cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:23: error: expected ';' before '!' token
   12 |                 pro/=i!;
      |                       ^
      |                       ;
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:12:11: error: 'N' was not declared in this scope
   12 |     sum+=(N-k*k+k+1)%m;
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}
int main(int argc, const char * argv[]) {
 
 
 
    cin.tie(0);
    ios::sync_with_stdio(false);
 
    /////////////////////
    // Write code below /
    /////////////////////
    int N,K,i;
    long long int ans = 0;
 
    cin >>N>>K;
 
    for(i = K;i < N+1;i++){
        ans += combination(N+1,i);
    }
    cout <<ans<<endl;
 
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}
int main(int argc, const char * argv[]) {



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

    /////////////////////
    // Write code below /
    /////////////////////
    int N,K,i;
    long long int ans = 0;

    cin >>N>>K;

    for(i = K;i < N+1;i++){
        ans += combination(N+1,i);
    }
    cout <<ans<<endl;

    return 0;
}
提出情報

Compiler output:
a.cc:37:11: error: redefinition of 'uintmax_t combination(unsigned int, unsigned int)'
   37 | uintmax_t combination(unsigned int n, unsigned int r) {
      |           ^~~~~~~~~~~
a.cc:3:11: note: 'uintmax_t combination(unsigned int, unsigned int)' previously defined here
    3 | uintmax_t combination(unsigned int n, unsigned int r) {
      |           ^~~~~~~~~~~
a.cc:47:5: error: redefinition of 'int main(int, const char**)'
   47 | int main(int argc, const char * argv[]) {
      |     ^~~~
a.cc:13:5: note: 'int main(int, const char**)' previously defined here
   13 | int main(int argc, const char * argv[]) {
      |     ^~~~
a.cc:69:1: error: '\U000063d0\U000051fa\U000060c5\U00005831' does not name a type
   69 | 提出情報
      | ^~~~~~~~
Language: C++

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

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

ll mysum(int x, int n){
	return n/2*(x*2+n)%MOD;
}

int main(){
	int N, K;
	cin >> N >> K;
	COMinit();
	ll sum = 0;
	for(int i = K; i <= N+1; i++){
		sum = (sum+mysum(N-i, i)-mysum(0, i))%MOD;
	}
	cout << sum << endl;

	return 0;	
}

Compiler output:
a.cc:6:15: error: 'MAX' was not declared in this scope
    6 | long long fac[MAX], finv[MAX], inv[MAX];
      |               ^~~
a.cc:6:26: error: 'MAX' was not declared in this scope
    6 | long long fac[MAX], finv[MAX], inv[MAX];
      |                          ^~~
a.cc:6:36: error: 'MAX' was not declared in this scope
    6 | long long fac[MAX], finv[MAX], inv[MAX];
      |                                    ^~~
a.cc: In function 'int main()':
a.cc:15:9: error: 'COMinit' was not declared in this scope
   15 |         COMinit();
      |         ^~~~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
	int N,K,pro;
	unsigned long int sum;
	cin>>N>>K;
	for(int i=K;i<=N+1;i++){
		pro=1
		for(int t=N-i+1;t<=N+1;t++){
			pro*=t/i;
		}
		sum+=pro;
		sum%=1000000007;
	}
	cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: expected ';' before 'for'
    8 |                 pro=1
      |                      ^
      |                      ;
    9 |                 for(int t=N-i+1;t<=N+1;t++){
      |                 ~~~   
a.cc:9:33: error: 't' was not declared in this scope
    9 |                 for(int t=N-i+1;t<=N+1;t++){
      |                                 ^
Language: C++

#include<iostream>
using namespace std;
int main(){
	int N,K,pro;
	unsigned long int sum;
	cin>>N>>K;
	for(int i=K;i<=N+1;i++){
		pro=1
		for(int t=N-i+1;t<=N+1;t++){
			pro*=t/i;
		}
		sum+=pro;
		sum%=(10^9)+7;
	}
	cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:22: error: expected ';' before 'for'
    8 |                 pro=1
      |                      ^
      |                      ;
    9 |                 for(int t=N-i+1;t<=N+1;t++){
      |                 ~~~   
a.cc:9:33: error: 't' was not declared in this scope
    9 |                 for(int t=N-i+1;t<=N+1;t++){
      |                                 ^
a.cc:13:25: warning: result of '10^9' is 3; did you mean '1e9'? [-Wxor-used-as-pow]
   13 |                 sum%=(10^9)+7;
      |                         ^
      |                       ---
      |                       1e
a.cc:13:23: note: you can silence this warning by using a hexadecimal constant (0xa rather than 10)
   13 |                 sum%=(10^9)+7;
      |                       ^~
      |                       0xa
Language: C++

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

int fact(int n) {
   if (n == 0 || n == 1)
      return 1;
   else
      return n * fact(n - 1);
}

int comb(int n, int r){
  return fact(n) / (fact(r) * fact(n-r));
}


int main() {
    int n; cin>>n; n++1;
    int k; cin>>k;
    int count = 0;

    for (int i = 0; i<n-1; i++){
      count += comb(n, k+i);
    }

    cout<<count;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:23: error: expected ';' before numeric constant
   18 |     int n; cin>>n; n++1;
      |                       ^
      |                       ;
Language: C

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <numeric>

// 1 2 3 4
// 3 4 5 6 7 
// 4 - 11
// 

using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)

const ll mod = 1000000007;

using namespace std;



int main() {
	int n, k;
	cin >> n >> k;
	ll low = 0;
	ll high = n;
	ll ans = 0;
	
	for (int i = 0; i <= n; i++) {
		//cout << "i:" << i;
		//cout << " low:" << low;
		//cout << " high:" << high;


		 
		if (i >= k - 1) {	
			ans = (ans + (high - low + 1 + mod) % mod) % mod;
			//cout << " ans:" << ans; 
		}
		//cout << endl;

		low = (low + (i + 1)) % mod;
		high = (high + n - i - 1 + mod) % mod;
	} 
	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 <cstdio>
#include <cmath>
#include <iostream>
#include <cstring>
#define ll long long
using namespace std;
ll a[200001],f[200001][21],t,D;
int n,m;
bool flag;
void change(int u){  //用change函数来进行修改
    f[u][0]=a[u];
    for(int i=1;u-(1<<i)>=0;i++) f[u][i]=max(f[u][i-1],f[u-(1<<(i-1))][i-1]);
}
ll find(int x,int y){
    double t=log(y-x+1)/log(2);
    int K=t;
    return max(f[y][K],f[x+(1<<K)-1][K]);
}
int main(){
    memset(f,0,sizeof(f));
    scanf("%d%lld",&m,&D);
    for (int i=1;i<=m;i++){
        char c;
        cin>>c;
        ll x;
        if (c=='A'){  //根据题面的操作，注意细节。
            scanf("%lld",&x);
            a[++n]=(x+t)%D;
            change(n);
        }else{
            int L; scanf("%d",&L);
            ll ans;
            if (L==1){
                printf("%lld\n",a[n]);
                t=a[n]; continue;
            }
            ans=find(n-L+1,n);
            printf("%lld\n",ans); t=ans;
        }
    }
    return 0;
}

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

#include<bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
 
vector<long long> fact_inv, inv, Com;
 
/*  init_nCk :二項係数のための前処理
    計算量:O(n)
*/
void init_nCk(int n, int SIZE) {
    fact_inv.resize(SIZE + 5);
    inv.resize(SIZE + 5);
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < SIZE + 5; i++) {
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
    }
    Com.resize(SIZE + 5);
    Com[0] = 1;
    for (int i = 1; i < SIZE + 5; i++) {
        Com[i] = Com[i - 1] * ((n - i + 1) * inv[i] % MOD) % MOD;
    }
}
 
/*  nCk :MODでの二項係数を求める(前処理 int_nCk が必要)
    計算量:O(1)
*/
long long nCk(int k) {
    assert(!(k < 0));
    return Com[k];
}

int main(){
  long long N;
  long long K;
  cin>>N>>K;
  if(K==N+1){
    cout<<1<<endl;
  }
  else{
    long long sum=0;
    init_nCk(N+1,N+1);
    for(int i=K;i<N+2;i++){
      sum=sum+nCk(i);
    }
  }
  cout<<sum<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:9: error: 'sum' was not declared in this scope
   48 |   cout<<sum<<endl;
      |         ^~~
Language: C++

#include<stdio.h>

int main()
{
	long N,K;
	long sum = 0;
	scanf_s("%ld %ld", &N, &K);

	for (int i = K; i <= N + 1; i++) {
			sum += (N - i + 1) * i + 1;
			sum %= 1000000007;
	}

	printf("%ld", sum);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    7 |         scanf_s("%ld %ld", &N, &K);
      |         ^~~~~~~
      |         scanf
Language: C

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

int32_t main() 
{
      int p=1000000007;
      int n,k,ans=0;
      cin>>n>>k;
      int i;
      for(i=k;i<=n+1;i++)
      {
            int a,b,c,d;
            a=((i)*(i-1));
            c=(a/2);
            b=((i)*(2*n-i+1));
            d=b/2;
            //cout<<"i "<<i<<" a "<<a<<" b "<<b<<endl;
            ans=(ans+(d-c)+1)%p;
            //cout<<ans<<endl;
      }


      cout<<ans%p<<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 <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
using namespace std;


#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>

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


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

#include <bits/stdc++.h>
using namespace std;
 
 
	 
int main() {
  	int N,K;
  	cin >> N >>K;
	int answer;
  	answer = ((N+1)*(N*N+2*N+6)-(K-1)*(-2*K*K+(4+3*N)*K+6))/6;
  	
  	cout << answer%(pow(10,9)+7) << endl;
  
}

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

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

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

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

#include<bits/stdc++.h>
#define ll ll
#define pb push_back
using namespace std;
const ll M = 1e10 + 7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k;
    cin>>n>>k;
    ll Ans = 0;
    ll x = 0, y = 0, p=0, q=n;
    for(int i=1 ; i<=k ; i++)
    {
        x+=p, y+=q;
        p++, q--;
    }
    ll ss1 = x, ss2=y;
    while(ss1 <= ss2)
    {
        Ans+=(ss2-ss1+1+Mod)%Mod;
        Ans%=Mod;
        ss1+=p, ss2+=q;
        p++, q--;
    }
    cout<<Ans<<endl;
    return 0;
}


Compiler output:
a.cc:2:12: error: 'll' does not name a type
    2 | #define ll ll
      |            ^~
a.cc:5:7: note: in expansion of macro 'll'
    5 | const ll M = 1e10 + 7;
      |       ^~
a.cc: In function 'int main()':
a.cc:2:12: error: 'll' was not declared in this scope
    2 | #define ll ll
      |            ^~
a.cc:12:5: note: in expansion of macro 'll'
   12 |     ll Ans = 0;
      |     ^~
a.cc:13:8: error: expected ';' before 'x'
   13 |     ll x = 0, y = 0, p=0, q=n;
      |        ^
a.cc:16:9: error: 'x' was not declared in this scope
   16 |         x+=p, y+=q;
      |         ^
a.cc:16:12: error: 'p' was not declared in this scope
   16 |         x+=p, y+=q;
      |            ^
a.cc:16:15: error: 'y' was not declared in this scope
   16 |         x+=p, y+=q;
      |               ^
a.cc:16:18: error: 'q' was not declared in this scope
   16 |         x+=p, y+=q;
      |                  ^
a.cc:19:8: error: expected ';' before 'ss1'
   19 |     ll ss1 = x, ss2=y;
      |        ^~~
a.cc:20:11: error: 'ss1' was not declared in this scope
   20 |     while(ss1 <= ss2)
      |           ^~~
a.cc:20:18: error: 'ss2' was not declared in this scope
   20 |     while(ss1 <= ss2)
      |                  ^~~
a.cc:22:9: error: 'Ans' was not declared in this scope
   22 |         Ans+=(ss2-ss1+1+Mod)%Mod;
      |         ^~~
a.cc:22:25: error: 'Mod' was not declared in this scope
   22 |         Ans+=(ss2-ss1+1+Mod)%Mod;
      |                         ^~~
a.cc:24:14: error: 'p' was not declared in this scope
   24 |         ss1+=p, ss2+=q;
      |              ^
a.cc:24:22: error: 'q' was not declared in this scope
   24 |         ss1+=p, ss2+=q;
      |                      ^
a.cc:27:11: error: 'Ans' was not declared in this scope
   27 |     cout<<Ans<<endl;
      |           ^~~
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <map>

#define ST_ARR_LEN(array) (sizeof(array)/sizeof(*array))

using namespace std;

using ll = long long;

typedef stack<int> IntStack;
typedef queue<int> IntQueue;
typedef vector<int> IntVector;
typedef list<int> IntList;

typedef struct S{
  int a;
  int b;
} Object;

ll factorial(ll n){
  fac = 1;
  while(n > 0){
    fac *= n;
    n--;
  }
  return fac;
}
ll permutation(ll n, ll k){
  if(k == 0) return 1;
  ll per = n;
  for(int i=1;i<k;i++){
    per *= (n-i);
  }
  return per;
}
ll combination(ll n, ll k){
  if(n-k < k) k = n-k;
  ll com = (permutation(n, k))/(factorial(k));
  return com;
}

int main(){
  int N, K;
  cin >> N >> K;
  
  ll c;
  ll sum  = 0;
  for(int i=K;i<=N+1;i++){
    c = combination(N+1, i);
    sum += c-((N*(N+1)/2)-(i*(2*N-i+1)/2));
  }
  
  cout << sum << endl;
    
}

Compiler output:
a.cc: In function 'll factorial(ll)':
a.cc:29:3: error: 'fac' was not declared in this scope
   29 |   fac = 1;
      |   ^~~
Language: C

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

//int _; 

int n,ans=0,a[3];
string s;
 
int main()
{
	//for(scanf("%d",&_);_;_--)
	long long n,k;
	long long ans=0;
	cin >> n >> k;
	for(long long i=k;i <= n+1;i++)
	{
		ans += (n-i+1)*i+1;
	}
	
	cout << ans%(long long)(10e8+7) << endl;
	return 0;
}

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

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

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

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

#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

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

  ll ans = 0;
  for ( ll i=K; i<=N+1; i++ ) {
    ll mi = (K-1+(i-K)) * i / 2;
    ll ma = (N+(N-(K-1)-(i-K))) * i / 2;
    ans = ((ma - mi + 1) + ans) % MOD;
//  cout << i << " " << mi << " " << ma << " : " << ans << endl;
  }
  cout << ans << endl;
}
n

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'cin' was not declared in this scope
    9 |   cin >> N >> K;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #define REP(i,n) for(int i=0;i<(n);++i)
a.cc:18:3: error: 'cout' was not declared in this scope
   18 |   cout << ans << endl;
      |   ^~~~
a.cc:18:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:18: error: 'endl' was not declared in this scope
   18 |   cout << ans << endl;
      |                  ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #define REP(i,n) for(int i=0;i<(n);++i)
a.cc: At global scope:
a.cc:20:1: error: 'n' does not name a type
   20 | n
      | ^
Language: C

#include<bits/stdc++.h>
using namespace std;
int main(void){
  int N,K,S;
  cin>>N>>K;
  S=N+K;
  cout<<S*2<<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 <vector>
#include <cstdio>
#include <string>
#include <cmath>
#include <algorithm>
#include <climits>
#define ll long long
#define MAX 25 * 1e13
#define N  200010

#define SIZE(A) ((int)A.size())
#define LEN(A) ((int)A.length())
#define MP(A,B) make_pair(A,B)
#define PB(X) push_back(X)
#define EB(X) emplace_back(X)
#define REP(i,a) for(int i=0;i<(a);++i)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()
#define VI vector<int>;

using namespace std;
int MOD = 1000000007;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,k;
  cin >> n >> k;
  ll ret = 0;
  vector<ll> sum(n+1);
  sum[1] = 1;
  for (ll i = 2 ; i <= n ; i++ ) { // range [0,n-1]
    sum[i] = sum[i-1] + i;
    //sum[i] %= MOD;
  }
  for (int l = k ; l <= n+1 ; l++ ) {
    ll mins = 0;
    ll maxs = 0;
    mins = sum[l-1];
    if( l >= n ) maxs = sum[n];
    else {
      maxs = sum[n] - sum[n-l];
    }
    //cout << "max" << maxs << endl;
    //cout << "min" << mins << endl;

    ret += (maxs - mins + 1 );
    ret %= MOD;
  }
  cout << ret << endl;

  return 0;

}



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

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

int main(){
    int N,K,L;
    cin >> N >> K;
    N++;
    L = 0;

    for(int i =K;K<N+1;i++){
        long c = 1;
        int d = N-k+1;
        int e = N;
        int f = 1;
        for(int j = d;j>0;j--){
            c = c*e;
            e--;
        }

        for(int m = d;m>0;m--){
            c = c/f;
            f++;
        }

        L = L+c;
    }

    cout << L << endl;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: error: 'k' was not declared in this scope
   12 |         int d = N-k+1;
      |                   ^
Language: C

#include <bits/stdc++.h>
#include <cmath>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INF = 1e18;
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x;
  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;
  }
  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;}
};
mint choose(int n,int a){
  mint x = 1,y=1;
  rep(i,a){
    x*= n-i;
    y*= i+1;
  }
  return x/y;
}
int main(){
  ll n,k;
  cin>>n>>k;
  vector<ll> sum(n+2,0);
  sum[0]=0;
  rep(i,n+1){
    if(i==0)continue;
    sum[i]=sum[i-1]+i;
  }
  ll ans =0;
  for(int i=k;i<=n+1;i++){
    if(i==n+1)ans++;
    else{
    ans+=(sum[n]-sum[n-i])-sum[i-1]+1;
  }
  ans%=mod;
  }
  cout<<ans<<endl;
}

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

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

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

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