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

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

int main() {
  string text;
  double
  int N;
  int j=1,k=0,time=0,timeall=0;
  cin >> N;
  string s[N];
  int t[N];
  string name;
  
for(int i=0;i<N;i++) {
 cin >> s[i]>>t[i];
 timeall+=t[i];
}

cin>> name;
while(j){
k++;
if(name==s[k-1]) j=0;
}

for(i=0;i<k;i++) timeall-t[i];

 cout <<timeall;

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: two or more data types in declaration of 'N'
    6 |   double
      |   ^~~~~~
a.cc:9:10: error: 'N' was not declared in this scope
    9 |   cin >> N;
      |          ^
a.cc:15:9: error: 's' was not declared in this scope
   15 |  cin >> s[i]>>t[i];
      |         ^
a.cc:15:15: error: 't' was not declared in this scope
   15 |  cin >> s[i]>>t[i];
      |               ^
a.cc:22:10: error: 's' was not declared in this scope
   22 | if(name==s[k-1]) j=0;
      |          ^
a.cc:25:5: error: 'i' was not declared in this scope
   25 | for(i=0;i<k;i++) timeall-t[i];
      |     ^
a.cc:25:26: error: 't' was not declared in this scope
   25 | for(i=0;i<k;i++) timeall-t[i];
      |                          ^
a.cc:27:17: error: expected '}' at end of input
   27 |  cout <<timeall;
      |                 ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C

#include<stdio.h>

int n,t;
char s[100];
int sum = 0;

int main(void){
	scanf("%d", &n);
  
	while ( i = 0; i < n; i++){
    scanf( "%s %d",&s, &t);
    printf("%s %d\n",s, t);
    return sum += t;
    }
  
  printf( "%d\n",sum);
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:17: error: 'i' undeclared (first use in this function)
   10 |         while ( i = 0; i < n; i++){
      |                 ^
main.c:10:17: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:22: error: expected ')' before ';' token
   10 |         while ( i = 0; i < n; i++){
      |               ~      ^
      |                      )
Language: Java

import java.util.Scanner;

public class Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int na=scan.nextInt();
String[] nb=new int[na+1];
int[] nc=new int[na];

int i=0;
for(i=0;i<na;i++){
  nb[i]=scan.next();
  nc[i]=scan.nextInt();
}
  nb[na]=scan.next();

int sum=0;
for(i=0;i<na;i++){
  if(nb[i].equals(nb[na]){
    break;
  }else{
    sum=sum+1;
  }
}

int summ=0;
for(i=sum+1;i<na;i++){
  summ=summ+nc[i];
}
     
System.out.println(summ);
     
     
     
     
     
}
}

Compiler output:
Main.java:19: error: ')' expected
  if(nb[i].equals(nb[na]){
                         ^
1 error
Language: C++

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

int main(){
  int N,sum = 0;
  vector<string> s(N);
  vector<int> t(N);
  string X;
  cin >> N >> X;
  bool A = false;
  int sum = 0;
  for (int i = 0; i < N; i++){
    cin >> s.at(i) >> t.at(i);
    if (s.at(i) == X || A){
      A = true;
      sum += t.at(i);
    }
  }
  for (int i = 0; i < N; i++){
    if (s.at(i) == X){
      sum -= t.at(i);
      break;
    }
  }
  cout << sum << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:7: error: redeclaration of 'int sum'
   11 |   int sum = 0;
      |       ^~~
a.cc:5:9: note: 'int sum' previously declared here
    5 |   int N,sum = 0;
      |         ^~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef struct SONG {
  string title;
  int second;
} song_t;

int main(void) {
  int n; cin >> n;
  song_t playlist[n];

  for (int i = 0; i < n; i++) {
    string str;
    int t;
    cin >> str >> t;
    
    playlist[i].second = t;
    playlist[i].title = str;
  }
  
  int time = 0;
  string lastOfNiwangokunHeard; cin >> lastOfNiwangokunHeard;
  bool isSleep = false;
  for (int i = 0; i < n; i++) {
    if (isSleep) {
      time = playlist[i].second;
      continue;
    }
    if (lastOfNiwangokunHeard == playlist[i].title) {
      isSleep = true;
    }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:2: error: expected '}' at end of input
   35 | }
      |  ^
a.cc:10:16: note: to match this '{'
   10 | int main(void) {
      |                ^
Language: C++

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

int main(){
  int n; cin>>n;
  vector<string> s(n);
  vector<int> t(n);
  for(int i=0; i<n; ++i)cin>>s[i]>>t[i];
  string x; cin>>x;

  int e=0;
  for(int i=0; i<n; ++i)if(x==s[i]){e=i; break;}

  int ans=0;
  for(int i=e+1; i<n; ++i)sum+=t[i];
  cout<<sum<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:27: error: 'sum' was not declared in this scope
   15 |   for(int i=e+1; i<n; ++i)sum+=t[i];
      |                           ^~~
a.cc:16:9: error: 'sum' was not declared in this scope
   16 |   cout<<sum<<endl;
      |         ^~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#define rep(i,n) for (int i=0; i< n; i++)
using namespace std;


int main() {
	int n;
    string s;
	cin >> n;
    vector<pair<string,int>> v(n);
    for (int i=0;i < n;i++){
      int t;
      string s;
      cin >> s >> t;
      pair<string,int> p=make_pair(s,t);
      v[i]=p;
    }
    cin >> x;
  int sum=0;
  for (int i=0;i<n;i++){
    sum+=v[i].second;
    if (v[i]==x) sum=0;
  }
  cout << sum << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:12: error: 'x' was not declared in this scope
   22 |     cin >> x;
      |            ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#define rep(i,n) for (int i=0; i< n; i++)
using namespace std;


int main() {
	int n;
    string s;
	cin >> n;
    vector<pair<string,int>> v(n);
    for (int i=0;i < n;i++){
      int t;
      string s;
      cin >> s >> t;
      pair p=make_pair(s,t);
      v[i]=p;
    }
    cin >> x;
  int sum=0;
  for (int i=0;i<n;i++){
    sum+=v[i].second;
    if (v[i]==x) sum=0;
  }
  cout << sum << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:12: error: 'x' was not declared in this scope
   22 |     cin >> x;
      |            ^
Language: Java

import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int A = sc.nextLong();
   String[] s = new String[N];
   int[] a  = new int[N];
 
   for(int i =0;i<A;i++)
   {
     s[i] = sc.next();
     a[i] = sc.nextInt();
   }
   String sl = sc.next();
   int ans = 0;
   boolean sleep = false;
   for(int i = 0;i<A;i++)
   {
     if(sleep) ans+= a[i];
     else if(sl.equals(s[i]))
     {
       sleep = true;
     }
   }
   System.out.println(ans);
 }
}

Compiler output:
Main.java:5: error: incompatible types: possible lossy conversion from long to int
   int A = sc.nextLong();
                      ^
Main.java:6: error: cannot find symbol
   String[] s = new String[N];
                           ^
  symbol:   variable N
  location: class Main
Main.java:7: error: cannot find symbol
   int[] a  = new int[N];
                      ^
  symbol:   variable N
  location: class Main
3 errors
Language: C

#include<stdio.h>
#include<stdlib.h>
#include <string.h>

int main(void)
{
    int n,t[50],i,ans=0;
    char s[50][101],x[101];

    scanf("%d",&n);
    for ( i = 0; i < n; i++)
    {
        scanf("%s %d",s[i],t+i)
    }
    scanf("%s",x);

    for ( i = 0; i < n; i++)
    {
        if(strcmp(x,s[i])==0) break;
    }

    i++;
    for (; i < n; i++)
    {
        ans+=t[i];
    }

    printf("%d",ans);

    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:32: error: expected ';' before '}' token
   13 |         scanf("%s %d",s[i],t+i)
      |                                ^
      |                                ;
   14 |     }
      |     ~
Language: C++

num = int(input())
L = []
for i in range(num):
  L.append([str(i) for i in input().split()])
target = input()
  
flag = 0
out = 0
for i in range(num):
  if flag == 1:
    out += int(L[i][1])
  if target == L[i][0]:
    flag = 1
    
print(out)

Compiler output:
a.cc:1:1: error: 'num' does not name a type; did you mean 'enum'?
    1 | num = int(input())
      | ^~~
      | enum
Language: C++


#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <iomanip>
#include <cmath>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;

int main()
{
    // 整数の入力
    ll N;
    map<string,ll> data;
    vector<ll> lengthes;
    cin >> N;
    for(int i = 0;i< N;i++){
        string music;
        ll length;
        cin >> music >> length;
        lengthes.push_back(length);
        data[music] = i;
    }
    string X;
    cin >> X;
    ll total = 0;
    for(int i = data[X] + 1;i< N;i++){
        total += lengthes[i];
    }
    cout << total << endl;

    return 0;
}

Compiler output:
a.cc:10:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   10 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){

  ll n;
  cin>>n;
  vstr t(n);
  vll a(n);
  rep(i,n){
    cin>>t[i]>>a[i];
  }
  string w;
  cin>>w;
  ll ans=0;
  ll cu=0;
  rep(i,n){
    if(cu) ans+=a[i];
    if(t[i]==w){
      cu=1;
    }
  }
  COUt(ans);
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:55:3: error: 'COUt' was not declared in this scope; did you mean 'COUT'?
   55 |   COUt(ans);
      |   ^~~~
      |   COUT
Language: Java

import lib.encoding.Haffman;

import java.nio.file.FileSystemLoopException;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main implements Runnable {

    private static int MOD = 1_000_000_007;

    public static void main(String[] args) {
        // Run with 32MB stack
        Thread thread = new Thread(null, new Main(), "", 32 * 1024 * 1024);
        thread.start();
    }

    @Override
    public void run() {
        final Scanner scanner = new Scanner(System.in);
        solve(scanner);
    }

    static void solve(Scanner scanner) {
        int N = Integer.parseInt(scanner.next());
        Map<String, Integer> m = new HashMap<>();
        int total = 0;
        for (int i = 0; i < N; i++) {
            String s = scanner.next();
            int n = Integer.parseInt(scanner.next());
            total += n;
            m.put(s, total);
        }
        String x = scanner.next();
        System.out.println(total - m.get(x));
    }

}



Compiler output:
Main.java:1: error: package lib.encoding does not exist
import lib.encoding.Haffman;
                   ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
    ll N;
    cin>>N;
    vector<ll>X(N);
    rep(i,X){
        cin>>X.at(i);
    }
    ll ans=0;
    for(int i=0; i<N; i++){
        ll count=0;
        for(int j=0; j<N; j++){
            if(i==j){
            }
            else{
                count+=abs(X.at(j)-X.at(i));
                count%=1000000007;
            }
            ans+=count;
        }
    }
    fpr(int i=1; i<N+1; i++){
        ans*=i;
        ans%=1000000007;
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:39: error: invalid cast from type 'std::vector<long long int>' to type 'int'
    4 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                       ^~~~~~~~
a.cc:10:5: note: in expansion of macro 'rep'
   10 |     rep(i,X){
      |     ^~~
a.cc:26:9: error: expected primary-expression before 'int'
   26 |     fpr(int i=1; i<N+1; i++){
      |         ^~~
a.cc:26:18: error: 'i' was not declared in this scope
   26 |     fpr(int i=1; i<N+1; i++){
      |                  ^
Language: C++

#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;
static const ll LOGN=55;

ll moP(ll x, ll n) {
  ll res=1;
  while(n>0) {
    if(n&1) moC(res, *, x);
    moC(x, *, x);
    n>>=1;
  }
  return res;
}

int main(void) {
  ll N;
  cin >> N;
  ll i;
  ll x[MAX];
  ll t[MAX];
  ll s[MAX]={};
  ll kAI=1; //=(N-1)!
  
  for(i=0; i<N; i++) cin >> t[i];
  for(i=0; i<N-1; i++) x[i+1]=t[i+1]-t[i];
  for(i=1; i<N; i++) moC(kAI, *, i);
  
  for(i=1; i<N; i++) {
    s[i]=(s[i-1]+moP(i, MOD-2))%MOD*KAIN%MOD;
  }
  
  ll ans=0;
  for(i=1; i<N; i++) {
    moC(ans, +, x[i]*s[i]%MOD);
  }
  
  pt(ans);
  
  
  
}





Compiler output:
a.cc: In function 'int main()':
a.cc:38:37: error: 'KAIN' was not declared in this scope
   38 |     s[i]=(s[i-1]+moP(i, MOD-2))%MOD*KAIN%MOD;
      |                                     ^~~~
Language: C++

#include
#define int long long
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(),a.end()
#define MP make_pair
#define PB push_back
#define PF push_front
#define FILL(a,b) memset(a,b,sizeof(a))
using namespace std;
int f1[100005],f2[100005],a1[100005],a2[100005];
int n,a[100005],mod=1e9+7;
signed main(){
ios::sync_with_stdio(0);
   cin.tie(0);
int ans=0;
cin>>n;
FOR(i,1,n){
cin>>a[i];
}
FOR(i,1,n){
a1[i]=(a1[i-1]+a[i])%mod;
} 
for(int i=n-1;i>=1;i--){
a2[i]=(a2[i+1]+a[i])%mod;
}
f1[0]=1;
FOR(i,1,n-1){
f1[i]=f1[i-1]*i%mod;
} 
f2[n-1]=n-1;
for(int i=n-2;i>=1;i--){
f2[i]=f2[i+1]*i%mod;
}
f2[n]=f2[n+1]=1;
for(int i=1;i
ans=ans+f2[i+2]*f1[i-1]%mod*(a2[i+1]-a1[n-i-1]);
ans=ans%mod;
}
FOR(i,1,n-1){
ans=ans+f1[n-i-1]*f2[n-i+1]%mod*(a[n]-a[i]);ans=ans%mod;
}
cout<<ans;
return 0;
}

Compiler output:
a.cc:1:9: error: #include expects "FILENAME" or <FILENAME>
    1 | #include
      |         ^
a.cc: In function 'int main()':
a.cc:18:1: error: 'ios' has not been declared
   18 | ios::sync_with_stdio(0);
      | ^~~
a.cc:19:4: error: 'cin' was not declared in this scope
   19 |    cin.tie(0);
      |    ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #include
a.cc:40:14: error: expected ';' before 'ans'
   40 | for(int i=1;i
      |              ^
      |              ;
   41 | ans=ans+f2[i+2]*f1[i-1]%mod*(a2[i+1]-a1[n-i-1]);
      | ~~~           
a.cc:41:48: error: expected ')' before ';' token
   41 | ans=ans+f2[i+2]*f1[i-1]%mod*(a2[i+1]-a1[n-i-1]);
      |                                                ^
      |                                                )
a.cc:40:4: note: to match this '('
   40 | for(int i=1;i
      |    ^
a.cc: At global scope:
a.cc:6:20: error: expected unqualified-id before 'for'
    6 | #define FOR(i,a,b) for(int i=a;i<=b;i++)
      |                    ^~~
a.cc:44:1: note: in expansion of macro 'FOR'
   44 | FOR(i,1,n-1){
      | ^~~
a.cc:44:5: error: 'i' does not name a type
   44 | FOR(i,1,n-1){
      |     ^
a.cc:6:32: note: in definition of macro 'FOR'
    6 | #define FOR(i,a,b) for(int i=a;i<=b;i++)
      |                                ^
a.cc:44:5: error: 'i' does not name a type
   44 | FOR(i,1,n-1){
      |     ^
a.cc:6:37: note: in definition of macro 'FOR'
    6 | #define FOR(i,a,b) for(int i=a;i<=b;i++)
      |                                     ^
a.cc:47:1: error: 'cout' does not name a type
   47 | cout<<ans;
      | ^~~~
a.cc:48:1: error: expected unqualified-id before 'return'
   48 | return 0;
      | ^~~~~~
a.cc:49:1: error: expected declaration before '}' token
   49 | }
      | ^
Language: C++

MOD = 10**9+7
N = int(input())
x = list(map(int, input().split()))

def mod_pow(x, n, mod):
	res = 1
	while n > 0 : 
		if n&1 : 
			res = res * x % mod
		x = x * x % mod
		n >>= 1
	return res

ans = 0
factor = 0

for i in range(1, N):
	factor += mod_pow(i, MOD-2, MOD)
	factor %= MOD
	ans += factor * (x[i] - x[i-1])
	ans %= MOD
for i in range(1, N):
	ans = ans * i % MOD
print(ans)

Compiler output:
a.cc:1:1: error: 'MOD' does not name a type
    1 | MOD = 10**9+7
      | ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
ll gcd(ll a,ll b){
  if(b==0) return a;
  return gcd(b,a%b);
}
ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}

int main() {
  int n;
  cin >> n;
  ll x[n];
  rep(i,n)cin >> x[i];
  ll f=1e9+7;
  ll dp[1e5+1][1e5+1];
  dp[0][1]=1;
  dp[1][1]=1;
  rep1(i,n){
    dp[i][0]=0;
    dp[i][1]=(dp[i-1][1]*i)%f;
    for(int j=2; j<=i; ++j){
      dp[i][j]=((i-j)*dp[i-1][j]+j*dp[i-1][j-1]+dp[i-1][1])%f;
    }
  }
  ll d[n+1];
  d[0]=0;
  rep1(i,n-1)d[i]=(x[i]-x[i-1])%f;
  ll sum=0;
  rep1(i,n-1)sum+=(dp[n-1][i]*d[i])%f;
  cout << sum%f ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:19: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   20 |   ll dp[1e5+1][1e5+1];
      |                ~~~^~
a.cc:20:19: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
   20 |   ll dp[1e5+1][1e5+1];
      |                ~~~^~
      |                   |
      |                   double
a.cc:20:19: error: size of array 'dp' has non-integral type 'double'
a.cc:20:12: error: conversion from 'double' to 'long unsigned int' in a converted constant expression
   20 |   ll dp[1e5+1][1e5+1];
      |         ~~~^~
a.cc:20:12: error: could not convert '(1.0e+5 + (double)1)' from 'double' to 'long unsigned int'
   20 |   ll dp[1e5+1][1e5+1];
      |         ~~~^~
      |            |
      |            double
a.cc:20:12: error: size of array 'dp' has non-integral type 'double'
Language: C++

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

const ll mod = 1000000007;

ll kaijou(ll n)
{
    if (n <= 1)
        return 1;
    else
        return (n * kaijou(n - 1)%mod) % mod;
}

int main(){
    int n;
    cin >> n;
    ll x[n];
    ll y;
    ll kai = kaijou(n-1);
    rep(i, n) cin >> x[i];
    y = 1.0 * kai;
    ll sum = 0;

    rep(i, n-1) {
        sum += y( * (x[i+1]-x[i]))%mod;
        y += (1.0/(i+2.0) * kai)%mod;
    }

    cout << sum << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:19: error: invalid type argument of unary '*' (have 'll' {aka 'long long int'})
   27 |         sum += y( * (x[i+1]-x[i]))%mod;
      |                   ^~~~~~~~~~~~~~~
a.cc:27:34: error: 'y' cannot be used as a function
   27 |         sum += y( * (x[i+1]-x[i]))%mod;
      |                                  ^
a.cc:28:33: error: invalid operands of types 'double' and 'const ll' {aka 'const long long int'} to binary 'operator%'
   28 |         y += (1.0/(i+2.0) * kai)%mod;
      |              ~~~~~~~~~~~~~~~~~~~^~~~
      |                           |      |
      |                           double const ll {aka const long long int}
Language: C++

#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
template<class Type> void line(const Type &a){int cnt=0;for(auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	int n;
	cin>>n;
	
	vi x(n);
	REP(i,n) cin>>x[i];
	
	vector<double> dp(n,0);
	dp[1]=1;
	for(int i=2;i<n;++i) dp[i]=dp[i-1]+1.0/i;
	line(dp);
	
	double ans=0;
	for(int i=n-2;i>=0;--i){
		int tmp=x[i+1]-x[i];
		ans+=tmp*dp[n-1-i];
	}
	
	llong tmp=1;
	for(int i=1;i<n;++i){
		tmp*=i;
		tmp%=MOD;
	}
	
	cout<<int(ans*tmp%MOD)<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:26: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   39 |         cout<<int(ans*tmp%MOD)<<endl;
      |                   ~~~~~~~^
      |                      |
      |                      double
Language: C++

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

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

void Main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    vector<ll> C(N);
    C[0] = 1;
    rep(i, N - 1) {
        C[i + 1] += C[i] + mod_inverse(i + 2, MOD);
    }
    ll ans = 0;
    print(C);
    rep(i, N - 1) {
        ll dis = A[i + 1] - A[i];
        ans += dis * C[i];
        ans %= MOD;
    }
    rep2(i, 1, N) {
        ans *= i;
        ans %= MOD;
    }
    cout << ans << '\n';
}

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


Compiler output:
a.cc: In function 'void Main()':
a.cc:53:5: error: 'print' was not declared in this scope; did you mean 'rint'?
   53 |     print(C);
      |     ^~~~~
      |     rint
Language: C++

#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)



const int mod = 1000000007;
struct mint {
	ll x;
	mint(ll x = 0) :x(x%mod) {}
	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 fact[101010];
mint sum[101010];
mint modpow(ll a, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return (mint)res;
}

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

	ll N;
	cin >> N;
	vector<ll>x(N);
	for (ll i = 0; i < N; i++)cin >> x[i]
	for (int i = 0; i < N; i++)sum[i + 1] = sum[i] + x[i];
	fact[0] = 1;
	for (ll i = 1; i < 101010; i++)fact[i] = fact[i - 1] * i;

	mint ans = 0;
	for (ll k = 2; k < N; k++) {
		mint temp = fact[N - 1] * modpow(k*(k-1),mod-2);
		mint sum1 = (sum[N - 1] - sum[k - 1]);
		mint sum2 = (sum[N - k] - sum[0]);
		sum1 -= sum2;
		temp *= sum1;
		ans += temp;
	}
	for (ll k = 2; k <= N; k++) {
		mint temp = fact[N - 1] * modpow(k-1,mod-2);
		temp *= (x[N-1]-x[N-k]);
		ans += temp;
	}
	puts(ans.x);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:90:46: error: expected ';' before 'for'
   90 |         for (ll i = 0; i < N; i++)cin >> x[i]
      |                                              ^
      |                                              ;
   91 |         for (int i = 0; i < N; i++)sum[i + 1] = sum[i] + x[i];
      |         ~~~                                   
a.cc:91:25: error: 'i' was not declared in this scope
   91 |         for (int i = 0; i < N; i++)sum[i + 1] = sum[i] + x[i];
      |                         ^
Language: C++

#include <bits/stdc++.h>

using namespace std;


void solve(long long n, std::vector<long long> x){

	int cnt = 0;
    int m = n - 1;
    for(int j = 0; j < n; ++j){
        if(1 == j + 1)
            continue;
        for(int i = 0; i < j; ++i){
            cnt = cnt * 2 - (cnt + 1) * cnt;
        }
    }
    cout << cnt << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> x(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
    }
    solve(n, x);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:11: error: 'n' was not declared in this scope
   28 |     solve(n, x);
      |           ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const long long MOD = 1000000007;
const i64 INF = i64(1e18) + 7;

void solve(long long n, std::vector<long long> x){

	int cnt = 0;
    int m = n - 1;
    for(int j = 0; j < n; ++j){
        if(1 == j + 1)
            continue;
        for(int i = 0; i < j; ++i){
            cnt = cnt * 2 - (cnt + 1) * cnt;
        }
    }
    cout << cnt << endl;
}


signed main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> x(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
    }
    solve(n, x);
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:11: error: 'n' was not declared in this scope
   32 |     solve(n, x);
      |           ^
Language: C++

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

int main(){
  int n;
  vector<int> vec;
  cin >> n;
  for(int i=0; i<n; i++){
    int num;
    cin >> num;
    vec.push_back(num);
  }
  int matrixOfDis[2005][2005];
  //i: y, j: x
  for(int i=0; i<2005; i++){
    for(int j=0; j<2005; j++){
      matrixOfDis[i][j] = 0;
    }
  }
  for(int i=0; i<n-1; i++){
    for(int j=n-1; j>i; j--){
      matrixOfDis[i][j] = vec[j] - vec[i];
    }
  }
  int kaijo = n - 1;
  while(kaijo > 0){
    kaijo = (kaijo * (kaijo-1)) % 1000000007;
    kaijo--;
  }
  int matrixOfMagic[2005][2005];
  for(int i=0; i<2005; i++){
    for(int j=0; j<2005; j++){
      matrixOfMagic[i][j] = 0;
    }
  }
  matrixOfMagic[n-2][n-1] = kaijo;
  for(int i=n-3; i>=0; i--){
    for(int j=n-1; j>i; j--){
      if(j == n-1){
        matrixOfMagic[i][j] = (matrixOfMagic[i+1][j] * ((n-i-2)/(n-i-1))) % 1000000007;
      }else if(j == n-2){
        matrixOfMagic[i][j] = matrixOfMagic[i+1][j+1] * (1/(n-i-1)) % 1000000007;
      }else{
        matrixOfMagic[i+1][j+1];
      }
    }
  }
  int sum
  for(int i=0; i<2005; i++){
    for(int j=0; j<2005; j++){
      sum += (matrixOfMagic[i][j] * matrixOfDis[i][j]) % 1000000007;
    }
  } 
  cout << sum;
  return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:3: error: expected initializer before 'for'
   50 |   for(int i=0; i<2005; i++){
      |   ^~~
a.cc:50:16: error: 'i' was not declared in this scope
   50 |   for(int i=0; i<2005; i++){
      |                ^
a.cc:55:11: error: 'sum' was not declared in this scope
   55 |   cout << sum;
      |           ^~~
Language: C++

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

int main(){
  int n;
  vector<int> vec;
  cin >> n;
  for(int i=0; i<n; i++){
    int num;
    cin >> num;
    vec.push_back(num);
  }
  int matrixOfDis[2005][2005];
  //i: y, j: x
  for(int i=0; i<2005; i++){
    for(int j=0; j<2005; j++){
      matrixOfDis[i][j] = 0;
    }
  }
  for(int i=0; i<n-1; i++){
    for(int j=n-1; j>i; j--){
      matrixOfDis[i][j] = vec[j] - vec[i];
    }
  }
  int kaijo = n - 1;
  while(kaijo > 0){
    kaijo = (kaijo * (kaijo-1)) % 1000000007;
    kaijo--;
  }
  int matrixOfMagic[2005][2005];
  for(int i=0; i<2005; i++){
    for(int j=0; j<2005; j++){
      matrixOfMagic[i][j] = 0;
    }
  }
  matrixOfMagic[n-2][n-1] = kaijo;
  for(int i=n-3; i>=0; i--){
    for(int j=n-1; j>i; j--){
      if(j == n-1){
        matrixOfMagic[i][j] = (matrixOfMagic[i+1][j] * ((n-i-2)/(n-i-1))) % 1000000007;
      }else if(j == n-2){
        matrixOfMagic[i][j] = matrixOfMagic[i+1][j+1] * (1/(n-i-1)) % 1000000007;
      }else{
        matrixOfMagic[i+1][j+1];
      }
    }
  }
  int sum sum
  for(int i=0; i<2005; i++){
    for(int j=0; j<2005; j++){
      sum += (matrixOfMagic[i][j] * matrixOfDis[i][j]) % 1000000007;
    }
  } 
  cout << sum;
  return 0;
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:11: error: expected initializer before 'sum'
   49 |   int sum sum
      |           ^~~
a.cc:50:16: error: 'i' was not declared in this scope
   50 |   for(int i=0; i<2005; i++){
      |                ^
a.cc:55:11: error: 'sum' was not declared in this scope
   55 |   cout << sum;
      |           ^~~
Language: C++

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

int main(){
  int n;
  vector<int> vec;
  cin >> n;
  for(int i=0; i<n; i++){
    int num;
    cin >> num;
    vec.push_back(num);
  }
  int matrixOfDis[2005][2005];
  //i: y, j: x
  for(int i=0; i<2005; i++){
    for(int j=0; j<2005; j++){
      matrixOfDis[i][j] = 0;
    }
  }
  for(int i=0; i<n-1; i++){
    for(int j=n-1; j>i; j--){
      matrixOfDis[i][j] = vec[j] - vec[i];
    }
  }
  int kaijo = n - 1;
  while(kaijo > 0){
    kaijo = (kaijo * (kaijo-1)) % 1000000007;
    kaijo--;
  }
  int matrixOfMagic[2005][2005];
  for(int i=0; i<2005; i++){
    for(int j=0; j<2005; j++){
      matrixOfMagic[i][j] = 0;
    }
  }
  matrixOfMagic[n-2][n-1] = kaijo;
  for(int i=n-3; i>=0; i--){
    for(int j=n-1; j>i; j--){
      if(j == n-1){
        matrixOfMagic[i][j] = (matrixOfMagic[i+1][j] * ((n-i-2)/(n-i-1))) % 1000000007;
      }else if(j == n-2){
        matrixOfMagic[i][j] = matrixOfMagic[i+1][j+1] * (1/(n-i-1)) % 1000000007;
      }else{
        matrixOfMagic[i+1][j+1];
      }
    }
  }
  int sum sum
  for(int i=0; i<2005; i++){
    for(int j=0; j<2005; j++){
      sum += (matrixOfMagic[i][j] * matrixOfDis[i][j]) % 1000000007;
    }
  } 
  cout << sum;
  return 0;
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:49:11: error: expected initializer before 'sum'
   49 |   int sum sum
      |           ^~~
a.cc:50:16: error: 'i' was not declared in this scope
   50 |   for(int i=0; i<2005; i++){
      |                ^
a.cc:55:11: error: 'sum' was not declared in this scope
   55 |   cout << sum;
      |           ^~~
a.cc:56:12: error: expected '}' at end of input
   56 |   return 0;
      |            ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

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

int main(){
	int i, num_slimes, num_factorial=1, MOD=pow(10,9)+7;
	int length_all=0, output;
	cin >> num_slimes;
	vector<int> pos_slimes(num_slimes), length_move(num_slimes-1);
	
	for(i=0;i<num_slimes;i++){
		cin >> pos_slimes.at(i);
	}
	for(i=0;i<num_slimes-1;i++){
		length_move.at(i) = pos_slimes.at(i+1)-pos_slimes.at(i);
		length_all += length_move.at(i);
	}
	
	// N-1階乗の計算
	for(i=1;i<num_slimes;i++){
		num_factorial = num_factorial*i % MOD;
	}

	// 距離の計算
	output = num_factorial*length_all;
	for(i=1;i<N-1;i++){
		
	}
	cout << output << endl;
	return 0;
}

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

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll pow(ll x,ll y){
  if(y==0) return 1;
  ll res=pow(x,y/2);
  res*=res;
  res%=mod;
  if(y%2==1) res*=x;
  return res%mod;
}
ll gyaku(ll x){
  return pow(x,mod-2);
}
vector<ll> frac,gfrac;
void set_frac(ll n){
  frac.push_back(1);
  gfrac.push_back(1);
  for(ll i=1;i<=n;i++){
    frac.push_back(frac[i-1]*i%mod);
    gfrac.push_back(gyaku(frac[i]));
  }
}
ll nCr(ll n,ll r){
  ll res=frac[n]*gfrac[r]%mod;
  res*=gfrac[n-r];
  return res%mod;
}

int main(){
  ll n;
  cin>>n;
  vector<ll> vec;
  for(int i=0;i<n;i++){
    ll a;
    cin>>a;
    vec.push_back(a);
  }
  n--;
  if(n>2000) return 0;
  ll nfrac=1;
  ll ans=0;
  for(ll i=1;i<=n;i++){
    nfrac*=i;
    nfrac%=mod;
  }
  set_frac(n+5);
  ll nf=nfrac*gyaku(2);
  ll an=0;
  for(ll i=1;i<=n;i++){
    an*=(i+1);
    an+=frac[i];
    ll kans=an;
    kans*=nf;
    kans%=mod;
    nf*=gyaku(i+2)
    kans+=nfrac;
    ans+=kans*(vec[i]-vec[i-1])%mod;
    ans%=mod;
  }
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:19: error: expected ';' before 'kans'
   59 |     nf*=gyaku(i+2)
      |                   ^
      |                   ;
   60 |     kans+=nfrac;
      |     ~~~~
Language: Java

import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		int[] x = new int[n];
		// スペース区切りの入力
		for ( int i=0; i<n; i++ ) {
			x[i] = sc.nextInt();
		}

		int[] d = new int[n-1];
		for ( int i=0; i<n-1; i++ ) {
			d[i] = x[n-1] - x[i];
		}

		BigInteger t = new BigInteger(0);
		BigInteger t1 = new BigInteger(0);
		t1 = fct(n-1);

		for ( int i=0; i<n-1; i++ ) {
			BigInteger t2 = new BigInteger(0);
			t2 = t1.multiply(i+1);
			t = t.add(t2);
		}

		// 出力
		System.out.println(t);
	}

	private static BigInteger fct(int p){
		if (p <= 1) {
			return (BigInteger.ONE);
		} else {
			return fct(p-1).multiply(BigInteger.valueOf(p));
		}
	}
}

Compiler output:
Main.java:32: error: cannot find symbol
	private static BigInteger fct(int p){
	               ^
  symbol:   class BigInteger
  location: class Main
Main.java:18: error: cannot find symbol
		BigInteger t = new BigInteger(0);
		^
  symbol:   class BigInteger
  location: class Main
Main.java:18: error: cannot find symbol
		BigInteger t = new BigInteger(0);
		                   ^
  symbol:   class BigInteger
  location: class Main
Main.java:19: error: cannot find symbol
		BigInteger t1 = new BigInteger(0);
		^
  symbol:   class BigInteger
  location: class Main
Main.java:19: error: cannot find symbol
		BigInteger t1 = new BigInteger(0);
		                    ^
  symbol:   class BigInteger
  location: class Main
Main.java:23: error: cannot find symbol
			BigInteger t2 = new BigInteger(0);
			^
  symbol:   class BigInteger
  location: class Main
Main.java:23: error: cannot find symbol
			BigInteger t2 = new BigInteger(0);
			                    ^
  symbol:   class BigInteger
  location: class Main
Main.java:34: error: cannot find symbol
			return (BigInteger.ONE);
			        ^
  symbol:   variable BigInteger
  location: class Main
Main.java:36: error: cannot find symbol
			return fct(p-1).multiply(BigInteger.valueOf(p));
			                         ^
  symbol:   variable BigInteger
  location: class Main
9 errors
Language: C++

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
using namespace std;

/* debug macros */
#ifdef WAFDAYO
#define DBG_PRINT(s, t, u) { std::cerr << s << " \e[2m=\e[m \e[1m" << t << "\e[m" << u; }
#else
#define DBG_PRINT(s, t, u) {}
#endif
#define dbg(x) DBG_PRINT(#x, x, std::endl)
#define dbgc(x) DBG_PRINT(#x, x, ", ")
#define idbg(x, i) DBG_PRINT(#x "[" << i << "]", x[i], std::endl)
#define idbgc(x, i) DBG_PRINT(#x "[" << i << "]", x[i], ", ")

/* IO utilities */
struct read_item { read_item() {}; template<class T> operator T() { T t; std::cin >> t; return t; } };

/* types and constants */
typedef long long i64;
const i64 inf = (i64)1.05e18;
// const int inf = (int)1.05e9;
const i64 mod = 1e9 + 7;

int main() {

	const int n = read_item();
	vector<int> xs(n);
	for(int i = 0; i < n; i++) {
		xs[i] = read_item();
	}

	vector<i64> fact(n);
	fact[0] = 1;
	fact[1] = 1;
	for(int i = 2; i <= n; i++) {
		fact[i] = fact[i - 1] * i % mod;
	}

	vector<i64> dp;

	dp.resize(n);
	dp[n - 1] = 0;
	for(int pos = n - 2; pos >= 0; pos--) {
		i64 a = 0;
		for(int j = pos + 1; j < n; j++) {
			a += fact[n - j] * (xs[j] - xs[pos]) % mod;
			a = a % mod;
		}
		dp[pos] = (dp[pos + 1] + a) % mod;
	}

	printF("%lld\n", dp[0]);

	return 0;
}

/* wafdayo~~~ */


Compiler output:
a.cc: In function 'int main()':
a.cc:63:9: error: 'printF' was not declared in this scope; did you mean 'printf'?
   63 |         printF("%lld\n", dp[0]);
      |         ^~~~~~
      |         printf
Language: C++

#include <iostream>
using namespace std;
int main()
{ 
	long int n;
	double mod = 1000000007;
	cin >> n;
	double* x;
	x = new double [n];
	int i;
	double add = 0;
	double c = n - 1;
	for (i = 0;i < n;i++) {
		double a;
		cin >> a;
		a=fmod(a, mod);
		x[i] = a;
		add += a;
	}
	int r = add - x[0];
	double sum = 1;
	for (int i = 1; i <= n - 1; ++i)
	{
		sum *= i;
	}
	double j=r/c;
	double kotae= fmod(j * sum, mod);
	cout << kotae;
	delete[] x;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:19: error: 'fmod' was not declared in this scope; did you mean 'mod'?
   16 |                 a=fmod(a, mod);
      |                   ^~~~
      |                   mod
a.cc:27:23: error: 'fmod' was not declared in this scope; did you mean 'mod'?
   27 |         double kotae= fmod(j * sum, mod);
      |                       ^~~~
      |                       mod
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
 int N;
 cin >> N;
 int x[N];
 int i;
 for(i=0;i<N;++i){
   cin >> x[i];}
 for(i=0;i<N;++i){
    x[i] -= x[0];}
long long int count = 0;
 for(i=0;i<j;++i){
     for(int j=1;j<N;j++){
         count += (x[j]-x[i])*2;
         count %= 1000000007;
     }}
     cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:12: error: 'j' was not declared in this scope
   14 |  for(i=0;i<j;++i){
      |            ^
Language: C++

#include <iostream>
using namespace std;
int main()
{ 
	long int n;
	double mod = 1000000007;
	cin >> n;
	double* x;
	x = new double [n];
	int i;
	double add = 0;
	double c = n - 1;
	for (i = 0;i < n;i++) {
		double a;
		cin >> a;
		fmod(a, mod);
		x[i] = a;
		add += a;
	}
	int r = add - x[0];
	double sum = 1;
	for (int i = 1; i <= n - 1; ++i)
	{
		sum *= i;
	}
	double j=r/c;
	cout << fmod(j*sum, mod);
	delete[] x;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'fmod' was not declared in this scope; did you mean 'mod'?
   16 |                 fmod(a, mod);
      |                 ^~~~
      |                 mod
a.cc:27:17: error: 'fmod' was not declared in this scope; did you mean 'mod'?
   27 |         cout << fmod(j*sum, mod);
      |                 ^~~~
      |                 mod
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
long MOD=1000000007;
int n;
  cin>>n;
  int a[n+1];
  for(int i=1; i<=n; i++) cin>>a[i];
  long sum=0;
  for(int i=1; i<=n-2; i++){
    sum+=i*(a[i+1]-a[i])%MOD
    sum%=MOD;
  }
sum=(sum*4)%MOD*(n-2)%MOD;

  long ss=0;
  for(int i=1; i<n; i++){
    ss-=a[i];
    ss+=a[n];
  }
  while(n>2){
ss*=(n-2);
    n--;
  }
  cout<< sum+ss<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:29: error: expected ';' before 'sum'
   11 |     sum+=i*(a[i+1]-a[i])%MOD
      |                             ^
      |                             ;
   12 |     sum%=MOD;
      |     ~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
long MOD=1000000007;
int n;
  cin>>n;
  int x[n+1];
  for(int i=1; i<=n; i++) cin>>a[i];
  long sum=0;
  for(int i=1; i<=n-2; i++){
    sum+=i*(a[i+1]-a[i])%MOD
    sum%=MOD;
  }
sum=(sum*4)%MOD*(n-2)%MOD;

  long ss=0;
  for(int i=1; i<n; i++){
    ss-=a[i];
    ss+=a[n];
  }
  while(n>2){
ss*=(n-2);
    n--;
  }
  cout<< sum+ss<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:32: error: 'a' was not declared in this scope
    8 |   for(int i=1; i<=n; i++) cin>>a[i];
      |                                ^
a.cc:11:13: error: 'a' was not declared in this scope
   11 |     sum+=i*(a[i+1]-a[i])%MOD
      |             ^
a.cc:18:9: error: 'a' was not declared in this scope
   18 |     ss-=a[i];
      |         ^
Language: C++

#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;

// gcd
LL gcd(LL a, LL b) {
	while(b){
		auto t=a%b;
		a=b;
		b=t;
	}
	return a;
}

//lcm
LL lcm(LL a, LL b) {return a/gcd(a,b)*b;}

// a>=0, b>=0, x*a+y*b=gcd>=0, a>0,b>0=>abs(y)<=a,abs(x)<=b
LL gcdex(LL a,LL b,LL& x, LL& y){
	LL ax=1,ay=0;
	LL bx=0,by=1;
	while(b){
		LL r=a/b;
		LL t=a-r*b; a=b; b=t;
		LL tx=ax-r*bx; ax=bx; bx=tx;
		LL ty=ay-r*by; ay=by; by=ty;
	}
	x=ax;
	y=ay;
	return a;
}
LL modinv(LL a, LL m){
	LL x,y;
	gcdex(a,m,x,y);
	if(x<0){
		x+=m;
	} else if(x>=m){
		x-=m;
	}
	return x;
}
const long long M = 1000000007;

void solve(long long N, std::vector<long long> x){
	vector<LL> dif;
	LL ret=0;
	LL s=0;
	int u=0,v=N-2;
	for(int i=1;i<N-1;i++){
		LL a=modinv(i,M);
		LL b=modinv(i+1,M);
		s+=M+x[v]-x[u];
		s%=M;
		u++;
		v--;
		//cerr << s << ", " << i << ", " << i+1<<endl;
		ret+=s*a%M*b%M;
		ret%=M;
	}
	for(int i=1;i<N;i++){
		LL a=modinv(i,M);
		ret+=(x[N-1]-x[N-1-i])*a%M;
		//cerr << x[N-1]-x[N-1-i] << ", " << i << endl;
		ret%=M;
	}
	for(int i=1;i<N;i++){
		ret*=i;
		ret%=M;
	}
	cout << ret << endl;

}

int main(){
#if 0
	int a[5]={1,2,3,4,5};
	int v[7]={};
	do{


Compiler output:
a.cc:99: error: unterminated #if
   99 | #if 0
a.cc: In function 'int main()':
a.cc:98:12: error: expected '}' at end of input
   98 | int main(){
      |           ~^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
// nPnの順列に対して処理を実行する
void foreach_permutation(int n, std::function<void(int *)> f) {

}



int main(){
    ll N;
  cin >>N;
  ll x[N];
  for(ll i=0;i<N;i++){
  cin>>x[i];
  }
  ll ans=0;
  ll flag=0;
  ll indexes[N-1];
  ll p=1000000007;
  for (ll i = 0; i < N-1; i++)indexes[i] = i;
  do {
	for(ll n=0;n<N-1;n++){
    	for(ll m=n;m<N-1;m++){
        if(indexes[n]<indexes[m]){ans=ans-x[n]+x[m];flag=1;}
          
        }
      if(flag==0){
      ans=ans+x[N-1]-x[n];}
      flag=0;
if(ans>p){ans=ans-p;}
     }   
    
  } while (std::next_permutation(indexes, indexes + N-1));
  



    
   cout << ans<< endl;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
// nPnの順列に対して処理を実行する
void foreach_permutation(int n, std::function<void(int *)> f) {

}



int main(){
    ll N;
  cin >>N;
  ll x[N];
  for(ll i=0;i<N;i++){
  cin>>x[i];
  }
  ll ans=0;
  ll flag=0;
  ll indexes[N-1];
  ll p=1000000007;
  for (ll i = 0; i < N-1; i++)indexes[i] = i;
  do {
	for(ll n=0;n<N-1;n++){
    	for(ll m=n;m<N-1;m++){
        if(indexes[n]<indexes[m]){ans=ans-x[n]+x[m];flag=1;}
          
        }
      if(flag==0){
      ans=ans+x[N-1]-x[n];}
      flag=0;
if(ans>p){ans=ans-p;}
     }   
    
  } while (std::next_permutation(indexes, indexes + N-1));
  



    
   cout << ans<< endl;
}


Compiler output:
a.cc:49:6: error: redefinition of 'void foreach_permutation(int, std::function<void(int*)>)'
   49 | void foreach_permutation(int n, std::function<void(int *)> f) {
      |      ^~~~~~~~~~~~~~~~~~~
a.cc:6:6: note: 'void foreach_permutation(int, std::function<void(int*)>)' previously defined here
    6 | void foreach_permutation(int n, std::function<void(int *)> f) {
      |      ^~~~~~~~~~~~~~~~~~~
a.cc:55:5: error: redefinition of 'int main()'
   55 | int main(){
      |     ^~~~
a.cc:12:5: note: 'int main()' previously defined here
   12 | int main(){
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#include "utils/macros.hpp"
#include "modulus/mint.hpp"
#include "modulus/factorial.hpp"
#include "modulus/choose.hpp"
using namespace std;
template <typename T> istream & operator >> (istream & in, vector<T> & xs) { REP (i, xs.size()) { in >> xs[i]; } return in; }

constexpr int MOD = 1e9 + 7;
mint<MOD> solve(int n, const vector<int> & x) {
    mint<MOD> ans = 0;
/*
    // O(n^2)
    REP (r, n) REP (l, r) {  // [l, r]
        int a = r - l - 1;
        int b = n - r + l - 1;
        ans += choose<MOD>(n - 1, a + 1 + (r != n - 1)) * fact<MOD>(a) * fact<MOD>(b - (r != n - 1)) * (x[r] - x[l]);
    }
*/
/*
    REP (r, n - 1) REP (l, r) {  // [l, r]
        ans += choose<MOD>(n - 1, r - l + 1) * fact<MOD>(r - l - 1) * fact<MOD>(n - r + l - 2) * x[r];
        ans -= choose<MOD>(n - 1, r - l + 1) * fact<MOD>(r - l - 1) * fact<MOD>(n - r + l - 2) * x[l];
    }
    int r = n - 1;
    REP (l, r) {  // [l, r]
        int a = r - l - 1;
        int b = n - r + l - 1;
        ans += choose<MOD>(n - 1, a + 1) * fact<MOD>(a) * fact<MOD>(b) * (x[r] - x[l]);
    }
*/
    vector<mint<MOD> > k(n - 1);
    REP3 (len, 1, n - 1) {
        k[len] = k[len - 1] + choose<MOD>(n - 1, len + 1) * fact<MOD>(len - 1) * fact<MOD>(n - len - 2);
    }
    REP (i, n - 1) {
        ans += k[i] * x[i];
        ans -= k[n - i - 2] * x[i];
    }
    int r = n - 1;
    REP (l, r) {  // [l, r]
        int a = r - l - 1;
        int b = n - r + l - 1;
        ans += choose<MOD>(n - 1, a + 1) * fact<MOD>(a) * fact<MOD>(b) * (x[r] - x[l]);
    }
    return ans;
}

int main() {
    int n; cin >> n;
    vector<int> x(n); cin >> x;
    cout << solve(n, x) << endl;
    return 0;
}


Compiler output:
a.cc:2:10: fatal error: utils/macros.hpp: No such file or directory
    2 | #include "utils/macros.hpp"
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.