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

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#define rep(i, n) for (int i=0; i<(n); ++i)
#define repr(i, a, b) for (int i=a; i<(b); ++i)
#define reprev(i, n) for (int i=n-1; i>=0; --i)
#define reprrev(i, a, b) for (int i=b-1; i>=(a); --i)
using namespace std;
namespace mp = boost::multiprecision;
typedef long long ll;
typedef pair<int, int> P;

const ll MOD = 1e9+7;

long long gcd(long long a, long long b) {
	if (a % b == 0) {
		return (b);
    } else {
		return (gcd(b, a % b));
    }
}

mp::cpp_int lcm(mp::cpp_int a, mp::cpp_int b) {
    return a * b / gcd(a, b);
}

int main() {
    cout << fixed << setprecision(10);
    
    int N; cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    mp::cpp_int lcmn = 1;

    map<int, ll> mpv; 
    rep(i, N) {
        int a = A[i];
        int b = 2;
        int count = 0;
        while (b*b <= a) {
            if (a%b == 0) {
                count += 1;
                a /= b;
            } else {
                if (count != 0) {
                    if (mpv.find(b)) {
                        // キーが存在すれば
                        mpv[b] = max(mpv[b], count);
                    } else {
                        mpv[b] = count;
                    }
                }
                count = 0;
                b += 1;
            }
        }
    }
    for (auto x : mp) {
        lcmn *= x.first*x.second;
    }
    // cout << "lcmn " << lcmn << endl;
    mp::cpp_int ans = 0;
    rep(i, N) {
        ans += lcmn/A[i];
        ans %= MOD;
    }

    cout << ans << endl;

    return 0;
}

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

#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp> 
using namespace boost::multiprecision::cpp_int; 
using namespace std;
typedef cpp_int ll; 
  
// Utility function to find 
// GCD of 'a' and 'b' 
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
  
// Returns LCM of array elements 
ll findlcm(int arr[], int n) 
{ 
    // Initialize result 
    ll ans = arr[0]; 
  
    // ans contains LCM of arr[0], ..arr[i] 
    // after i'th iteration, 
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
  
    return ans; 
} 
int main()
{
  int n;
  cin>>n;
  ll sum=0;
  int i,a[n];
  for(i=0;i<n;i++)
    cin>>a[i];
  ll c=findlcm(a,n);
  for(i=0;i<n;i++)
  {
    sum+=(c/a[i]);
  }
  sum%=(1000000007);
  cout<<sum<<endl;
  return 0;
}
  


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

#include<bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define F first
#define S second
ll inf=100000000000000000,mod=1000000007;
ll prime[1000006];
unordered_map<ll, ll> max_map;
#define MAX 1000006
// Function to return a^n
ll power(ll a, ll n)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2) % mod;
    p = (p * p) % mod;
    if (n & 1)
        p = (p * a) % mod;
    return p;
}

// Function to find the smallest prime factors
// of numbers upto MAX
void sieve()
{
    prime[0] = prime[1] = 1;
    for (ll i = 2; i < MAX; i++) {
        if (prime[i] == 0) {
            for (ll j = i * 2; j < MAX; j += i) {
                if (prime[j] == 0) {
                    prime[j] = i;
                }
            }
            prime[i] = i;
        }
    }
}

// Function to return the LCM modulo M
ll lcmModuloM(const ll* ar, ll n)
{

    for (ll i = 0; i < n; i++) {
        ll num = ar[i];
        unordered_map<ll, ll> temp;

        // Temp stores mapping of prime factor to
        // its power for the current element
        while (num > 1) {

            // Factor is the smallest prime factor of num
            ll factor = prime[num];

            // Increase count of factor in temp
            temp[factor]++;

            // Reduce num by its prime factor
            num /= factor;
        }

        for (auto it : temp) {

            // Store the highest power of every prime
            // found till now in a new map max_map
            max_map[it.first] = max(max_map[it.first], it.second);
        }
    }

    ll ans = 1;

    for (auto it : max_map) {
        ans = (ans * power(it.F, it.S)) % mod;
    }

    return ans;
}
int main(){
  f
	ios::sync_with_stdio(false);
	cin.tie(0);
    ll n;
    cin>>n;
    ll arr[n],gg[n],lc[n],num;
    for(ll i=0;i<n;i++)
    cin>>arr[i];
    sieve();
    lc[0]=lcmModuloM(arr, n);
    ll barr[n];
    for(ll i=0;i<n;i++)
    {
       barr[i]=(lc[0]*power(arr[i],mod-2))%mod;
    }
    ll sum=0;
    for(ll i=0;i<n;i++)
    sum=(sum+barr[i])%mod;
    cout<<sum<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:78:3: error: 'f' was not declared in this scope
   78 |   f
      |   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
    while (a && b) {
        if (a >= b)
            a %= b;
        else
            b %= a;
    }
    return a + b;
}

int lcm(int a, int b) {
    return (a / gcd(a, b)) * b;
}
int main()
{
     int n;
     cin>>n;
     int long long a[n];
  int long long A=1;
  for(int i=0;i<n;i++)
  {
    cin>>a[i];
    A=lcm(A,a[i])%mod;
  }
  int long long sum=0;
  int long long mod=1e7;
  for(int i=0;i<n;i++)
  {
     sum+=((A/a[i])%mod);
  }
  sum=sum%mod;
  cout<<sum;
  return 0;
}

  
  
  


Compiler output:
a.cc: In function 'int main()':
a.cc:25:19: error: 'mod' was not declared in this scope; did you mean 'modf'?
   25 |     A=lcm(A,a[i])%mod;
      |                   ^~~
      |                   modf
Language: C++

#include<iostream>
#include<iomanip>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
#include<tuple>
#include<numeric>
#include<map>
#include<cmath>
#define lli long long int
#define rep(i,n) for(int i=0;i<(int) (n);i++)
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
using namespace std;
int main(){
  int n;
  lli m=1;
  cin>>n;
  vector<int>a(n);
  rep(i,n){
    cin>>a[i];
    m=lcm(m,a[i]);
  }

  lli ans=0;
  rep(i,n){
    ans+=m/a[i];
  }

  cout<<ans%(1000000000+7)<<endl;
  return 0;
}

Compiler output:
a.cc:13:1: error: 'll' does not name a type; did you mean 'lli'?
   13 | ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
      | ^~
      | lli
a.cc:14:1: error: 'll' does not name a type; did you mean 'lli'?
   14 | ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
      | ^~
      | lli
Language: Java

import sys
from math import sqrt
input = sys.stdin.readline


def prime_factor(n):
    factors = []
    for i in range(2, int(sqrt(n))):
        while n % i == 0:
            factors.append(i)
            n //= i
    if n != 1:
        factors.append(n)
    return factors


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

ans = 0
primes = []
for a in A:
    f1 = a
    f2 = 1
    for p in primes:
        if f1 % p == 0:
            f1 //= p
        else:
            f2 = f2 * p % mod
    ans = (ans * f1 + f2) % mod
    primes += prime_factor(f1)
print(ans)


Compiler output:
Main.java:1: error: '.' expected
import sys
          ^
Main.java:2: error: ';' expected
from math import sqrt
    ^
Main.java:2: error: '.' expected
from math import sqrt
                     ^
Main.java:3: error: ';' expected
input = sys.stdin.readline
     ^
4 errors
Language: Java

public class Main {
	public static long mod = 1_000_000_007;
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		BigInteger[] a = new BigInteger[n];
		BigInteger gcd = BigInteger.ZERO, lcm = BigInteger.ONE;
		for(int i = 0; i < n; i++){
			a[i] = new BigInteger(sc.next());
		}
		sc.close();
		gcd = a[0];
		lcm = a[0];
		for(int i = 1; i < n; i++){
			gcd = lcm.gcd(a[i]);
			lcm = lcm.multiply(a[i]);
			lcm = lcm.divide(gcd);
		}
		BigInteger ans = BigInteger.ZERO, tmp = BigInteger.ZERO;
		for(int i = 0; i < n; i++){
			tmp = lcm.divide(a[i]);
			ans = ans.add(tmp);
		}
		System.out.println(ans.mod(BigInteger.valueOf(mod)));
	}
}


Compiler output:
Main.java:4: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		^
  symbol:   class Scanner
  location: class Main
Main.java:4: error: cannot find symbol
		Scanner sc = new Scanner(System.in);
		                 ^
  symbol:   class Scanner
  location: class Main
Main.java:6: error: cannot find symbol
		BigInteger[] a = new BigInteger[n];
		^
  symbol:   class BigInteger
  location: class Main
Main.java:6: error: cannot find symbol
		BigInteger[] a = new BigInteger[n];
		                     ^
  symbol:   class BigInteger
  location: class Main
Main.java:7: error: cannot find symbol
		BigInteger gcd = BigInteger.ZERO, lcm = BigInteger.ONE;
		^
  symbol:   class BigInteger
  location: class Main
Main.java:7: error: cannot find symbol
		BigInteger gcd = BigInteger.ZERO, lcm = BigInteger.ONE;
		                 ^
  symbol:   variable BigInteger
  location: class Main
Main.java:7: error: cannot find symbol
		BigInteger gcd = BigInteger.ZERO, lcm = BigInteger.ONE;
		                                        ^
  symbol:   variable BigInteger
  location: class Main
Main.java:9: error: cannot find symbol
			a[i] = new BigInteger(sc.next());
			           ^
  symbol:   class BigInteger
  location: class Main
Main.java:19: error: cannot find symbol
		BigInteger ans = BigInteger.ZERO, tmp = BigInteger.ZERO;
		^
  symbol:   class BigInteger
  location: class Main
Main.java:19: error: cannot find symbol
		BigInteger ans = BigInteger.ZERO, tmp = BigInteger.ZERO;
		                 ^
  symbol:   variable BigInteger
  location: class Main
Main.java:19: error: cannot find symbol
		BigInteger ans = BigInteger.ZERO, tmp = BigInteger.ZERO;
		                                        ^
  symbol:   variable BigInteger
  location: class Main
Main.java:24: error: cannot find symbol
		System.out.println(ans.mod(BigInteger.valueOf(mod)));
		                           ^
  symbol:   variable BigInteger
  location: class Main
12 errors
Language: C++

#include <bits/stdc++.h>


using namespace std;
const int maxn = 1e6+5;
const int mod = 1e9+7;
void tlfclwx()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
__int64 k[maxn];
__int64 gcd(__int64 a,__int64 b)
{
    return b ? gcd(b,a%b):a;
}
__int64 lcm(__int64 m,__int64 g)
{
    return m/gcd(m,g)*g;
}
int main()
{
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> k[i];
    }
    __int64 a = k[1];
    for(int i = 2; i <= n; i++)
    {
        a = lcm(a, k[i]);
    }
    __int64 sum = 0;
    for(int i = 1; i <= n; i++)
    {
        sum = (sum + a/k[i]%mod)%mod;
    }
    cout << sum%mod <<endl;
}


Compiler output:
a.cc:13:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   13 | __int64 k[maxn];
      | ^~~~~~~
      | __int64_t
a.cc:14:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   14 | __int64 gcd(__int64 a,__int64 b)
      | ^~~~~~~
      | __int64_t
a.cc:18:1: error: '__int64' does not name a type; did you mean '__int64_t'?
   18 | __int64 lcm(__int64 m,__int64 g)
      | ^~~~~~~
      | __int64_t
a.cc: In function 'int main()':
a.cc:28:16: error: 'k' was not declared in this scope
   28 |         cin >> k[i];
      |                ^
a.cc:30:5: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
   30 |     __int64 a = k[1];
      |     ^~~~~~~
      |     __ynf64
a.cc:33:9: error: 'a' was not declared in this scope
   33 |         a = lcm(a, k[i]);
      |         ^
a.cc:33:20: error: 'k' was not declared in this scope
   33 |         a = lcm(a, k[i]);
      |                    ^
a.cc:35:12: error: expected ';' before 'sum'
   35 |     __int64 sum = 0;
      |            ^~~~
      |            ;
a.cc:38:9: error: 'sum' was not declared in this scope
   38 |         sum = (sum + a/k[i]%mod)%mod;
      |         ^~~
a.cc:38:22: error: 'a' was not declared in this scope
   38 |         sum = (sum + a/k[i]%mod)%mod;
      |                      ^
a.cc:38:24: error: 'k' was not declared in this scope
   38 |         sum = (sum + a/k[i]%mod)%mod;
      |                        ^
a.cc:40:13: error: 'sum' was not declared in this scope
   40 |     cout << sum%mod <<endl;
      |             ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define rep2(i,n) for(int i=0;i<=n;i++)
#define repr(i,a,n) for(int i=a;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
#define vector2(a,b,c) vector<vector<int>> a(b/*縦！w*/,vector<int>(c/*横！w*/))
#define INF 1e10
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using Graph = vector<vector<int>>;
int lcm(int a,int b){
 int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
}
  }
  return d*e/f;
    }
signed main(){
  int a;
  cin>>a;
  vector<int> b(a);
  rep(i,a)
    cin>>b[i];
  int c=b[0];
  rep(i,a-1)
    c=lcm(c,b[i+1]);
  int d=0;
  rep(i,a){
    d+=(c/b[i])%MOD; 
    d=d%MOD
    }
  cout<<d<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:5: error: expected ';' before '}' token
   48 |     }
      |     ^
Language: C++

import math

MOD = 1000000000 + 7

N = int(input())
A = list(map(int, input().split()))

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

l = 1
for i in A:
    l = lcm(l, i)

ans = 0
for i in A:
    ans += (l // i) % MOD
print(int(ans % MOD))

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

#define loop(i,a,b) for(ll i=a; i<b; i++)
#define rloop(i,a,b) for(ll i=a; i>b; i--)
#define all(var) var.begin(), var.end()
#define eloop(var) for(auto elem : var)
#define debug(x) cerr<<#x<<" ----> "<<x<<endl;
#define PB push_back
#define MP make_pair
#define tt ll TT; cin>>TT; while(TT--)
#define F first
#define S second
#define SET(a) memset(a,-1,sizeof(a))
#define CLR(a) memset(a, 0, sizeof(a))
#define INF 0x7fffffff
#define LINF 2000000000000000007
#define MOD 1000000007
#define MAX 100005
typedef long long ll;
typedef long double ld;

unsigned ll findlcm(ll arr[], ll n) 
{ 
    unsigned ll ans = arr[0]; 
    loop(i,1,n)
        ans = (((arr[i] * ans))/(__gcd(arr[i], ans))); 
    return ans; 
}

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

    //tt
    {
        ll n;
        cin>>n;
        ll arr[n];
        loop(i,0,n)
            cin>>arr[i];
        unsigned ll lcm = findlcm(arr, n);
        unsigned ll sum = 0;
        loop(i,0,n) {
            sum  = (sum + (lcm/arr[i])%MOD)%MOD;
        }
        cout<<sum<<'\n';

    }
    return 0;
}

Compiler output:
a.cc:23:13: error: expected initializer before 'findlcm'
   23 | unsigned ll findlcm(ll arr[], ll n)
      |             ^~~~~~~
a.cc: In function 'int main()':
a.cc:43:21: error: expected initializer before 'lcm'
   43 |         unsigned ll lcm = findlcm(arr, n);
      |                     ^~~
a.cc:44:21: error: expected initializer before 'sum'
   44 |         unsigned ll sum = 0;
      |                     ^~~
a.cc:46:13: error: 'sum' was not declared in this scope
   46 |             sum  = (sum + (lcm/arr[i])%MOD)%MOD;
      |             ^~~
a.cc:46:31: error: invalid operands of types '<unresolved overloaded function type>' and 'll' {aka 'long long int'} to binary 'operator/'
   46 |             sum  = (sum + (lcm/arr[i])%MOD)%MOD;
      |                            ~~~^~~~~~~
a.cc:48:15: error: 'sum' was not declared in this scope
   48 |         cout<<sum<<'\n';
      |               ^~~
Language: C++

# Your code here!
N = gets.to_i
a = gets.split.map(&:to_i)
l = a[0]
for i in 0..N-1 do
  l = l.lcm(a[i])
end
for i in 0..N-1 do
  a[i] = l/a[i]
end
ans = 0
for i in 0..N-1 do
  ans += a[i]
  ans %= 1000000007
end
print(ans)


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #Your
    1 | # Your code here!
      |   ^~~~
a.cc:5:10: error: too many decimal points in number
    5 | for i in 0..N-1 do
      |          ^~~~
a.cc:8:10: error: too many decimal points in number
    8 | for i in 0..N-1 do
      |          ^~~~
a.cc:12:10: error: too many decimal points in number
   12 | for i in 0..N-1 do
      |          ^~~~
a.cc:2:1: error: 'N' does not name a type
    2 | N = gets.to_i
      | ^
Language: Java

import java.util.*;
import java.io.*;
import java.math.BigInteger;

class FastReader {

    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException  e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}

public class ABC152E {
    public static void main(String[] args) {
        FastReader fr = new FastReader();
        int N = fr.nextInt();
        BigInteger[] A = new BigInteger[N];
        for (int i = 0; i < N; i++) A[i] = new BigInteger("" + fr.nextInt());
        BigInteger mod = new BigInteger("1000000007");
        BigInteger ans = BigInteger.ZERO;
        BigInteger prev = A[0];
        for (BigInteger a : A) {
            BigInteger l = lcm(prev, a);
            BigInteger factor = l.divide(prev).mod(mod);
            ans = (ans.multiply(factor).add(l.divide(a))).mod(mod);
            prev = l;
        }
        System.out.println(ans);
    }

    private static BigInteger lcm(BigInteger a, BigInteger b) {
        return a.multiply(b).divide(gcd(a, b));
    }
    private static BigInteger gcd(BigInteger a, BigInteger b) {
        if (b.equals(BigInteger.ZERO)) return a;
        return gcd(b, a.mod(b));
    }
}


Compiler output:
Main.java:48: error: class ABC152E is public, should be declared in a file named ABC152E.java
public class ABC152E {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
#include "../lib/math/comb.hpp"

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template< typename T >
T mod_pow(T x, T n, const T &p) {
  T ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  Combination<MOD> comb(1000010);

  int n; cin >> n;
  vll a(n);
  vector<map<ll, ll>> vmp(n);
  for(int i=0;i<n;++i) {
    cin >> a[i];
    ll m = a[i];
    for(ll j=2;j*j<=m;++j) {
      while(m % j == 0) {
        vmp[i][j]++;
        m /= j;
      }
    }
    if(m != 1) vmp[i][m]++;

  }

  vector<ll> memo(1000010, 0);
  for(int i=0;i<n;++i) {
    for(auto &e: vmp[i]) {
      memo[e.first] = max(memo[e.first], e.second);
    }
  }

  ll l = 1;
  for(int i=1;i<1000010;++i) {
    if(memo[i] != 0) l *= mod_pow<ll>(i, memo[i], MOD);
    l %= MOD;
  }

  ll su = 0;
  for(int i=0;i<n;++i) {
    su += l * comb.getinv(a[i]) % MOD;
    su %= MOD;
  }
  cout << su << endl;


}


Compiler output:
a.cc:2:10: fatal error: ../lib/math/comb.hpp: No such file or directory
    2 | #include "../lib/math/comb.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define FOR(n) for(int i=0;i<n;i++)
#define For(i,n) for(int i=0;i<n;i++)
#define ll long long
ll mob=1000000007;
int main()
{

ll n;
  cin>>n;
ll a[n];
  FOR(n) cin>>a[i];
  
  ll findlcm(int arr[], int n) 
{ 
    // Initialize result 
    ll ans = arr[0]; 
  
    // ans contains LCM of arr[0], ..arr[i] 
    // after i'th iteration, 
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (__gcd(arr[i], ans))); 
  
    return ans; 
} 

ll k=findlcm(a,n);
ll sum=0;
ll d[n];
  FOR(n)
  {d[i]=k/a[i];
  sum =(sum%mob+d[i]%mob)%mob;
  }




cout<<sum%mob;



return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:1: error: a function-definition is not allowed here before '{' token
   16 | {
      | ^
a.cc:29:6: error: 'findlcm' was not declared in this scope
   29 | ll k=findlcm(a,n);
      |      ^~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long int ll; 
  
// Utility function to find 
// GCD of 'a' and 'b' 
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
  
// Returns LCM of array elements 
ll findlcm(int arr[], int n) 
{ 
    // Initialize result 
    ll ans = arr[0]; 
  
    // ans contains LCM of arr[0], ..arr[i] 
    // after i'th iteration, 
    for (int i = 1; i < n; i++) 
        ans = (((arr[i] * ans)) / 
                (gcd(arr[i], ans))); 
  
    return ans; 
} 
int main()
{
  int n;
  cin>>n;
  int i,a[n];
  for(i=0;i<n;i++)
    cin>>a[i];
  l1 c=findlcm(a,n);
  for(i=0;i<n;i++)
  {
    sum+=(c/a[i]);
  }
  sum%=1000000007;
  cout<<sum<<endl;
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:35:3: error: 'l1' was not declared in this scope; did you mean 'y1'?
   35 |   l1 c=findlcm(a,n);
      |   ^~
      |   y1
a.cc:38:5: error: 'sum' was not declared in this scope
   38 |     sum+=(c/a[i]);
      |     ^~~
a.cc:38:11: error: 'c' was not declared in this scope
   38 |     sum+=(c/a[i]);
      |           ^
a.cc:40:3: error: 'sum' was not declared in this scope
   40 |   sum%=1000000007;
      |   ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
 
long long lcm(long long a, long long b) {
  return (a*b)/__gcd(a, b);  
}
 
int main() {
  int n, a[10005];
  cin >> n;
  for(int i = 1; i <= n; ++i) cin >> a[i];
  long long mn = a[i], res = 0;
  for(int i = 2; i <= n; ++i) {
  	mn = lcm(mn, (long long)a[i]);
  }
  for(int i = 1; i <= n; ++i) {
   res += mn / a[i]; 
  }
  
  cout << res%1000000007;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:20: error: 'i' was not declared in this scope
   13 |   long long mn = a[i], res = 0;
      |                    ^
a.cc:18:4: error: 'res' was not declared in this scope
   18 |    res += mn / a[i];
      |    ^~~
a.cc:21:11: error: 'res' was not declared in this scope
   21 |   cout << res%1000000007;
      |           ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
 
long long lcm(long long a, long long b) {
  return (a*b)/__gcd(a, b);  
}
 
int main() {
  int n;
  cin >> n;
  for(int i = 1; i <= n; ++i) cin >> a[i];
  long long mn = a[i], res = 0;
  for(int i = 2; i <= n; ++i) {
  	mn = lcm(mn, (long long)a[i]);
  }
  for(int i = 1; i <= n; ++i) {
   res += mn / a[i]; 
  }
  
  cout << res%1000000007;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:38: error: 'a' was not declared in this scope
   12 |   for(int i = 1; i <= n; ++i) cin >> a[i];
      |                                      ^
a.cc:13:18: error: 'a' was not declared in this scope
   13 |   long long mn = a[i], res = 0;
      |                  ^
a.cc:13:20: error: 'i' was not declared in this scope
   13 |   long long mn = a[i], res = 0;
      |                    ^
a.cc:18:4: error: 'res' was not declared in this scope
   18 |    res += mn / a[i];
      |    ^~~
a.cc:21:11: error: 'res' was not declared in this scope
   21 |   cout << res%1000000007;
      |           ^~~
Language: C++

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


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

int main() {
  int n;
  cin >> n;
  for(int i = 1; i <= n; ++i) cin >> a[i];
  long long mn = a[i], res = 0;
  for(int i = 2; i <= n; ++i) {
  	mn = lcm(mn, (long long)a[i]);
  }
  for(int i = 1; i <= n; ++i) {
   res += mn / a[i]; 
  }
  
  cout << res%1000000007;
  return 0;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:12:38: error: 'a' was not declared in this scope
   12 |   for(int i = 1; i <= n; ++i) cin >> a[i];
      |                                      ^
a.cc:13:18: error: 'a' was not declared in this scope
   13 |   long long mn = a[i], res = 0;
      |                  ^
a.cc:13:20: error: 'i' was not declared in this scope
   13 |   long long mn = a[i], res = 0;
      |                    ^
a.cc:18:4: error: 'res' was not declared in this scope
   18 |    res += mn / a[i];
      |    ^~~
a.cc:21:11: error: 'res' was not declared in this scope
   21 |   cout << res%1000000007;
      |           ^~~
Language: C++

import math

n = int(input())
a = list(map(int, input().split()))
g = a[0]

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

for i in range(1, n):
    g = lcm(g, a[i])

print(g)

ans = 0
for i in range (0, n):
    ans += g / a[i]
    
ans = ans % 1000000007

print(int(ans))

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

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

int main() {
  int N = 1;
  long long int mod =10e9+7;
  cin >> N;
  int a[N];
  long long int L = 1;
  for(int i=0;i<N;i++){
      cin >> a[i];
      L = L  / __gcd(L, a[i]) * a[i];
  }
  long long int sum = 0;
  for(int i=0;i<N;i++){
      sum += ((L/a[i])%mod);
      sum %= mod;
  }
  cout << sum << endl;
  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:21: error: no matching function for call to '__gcd(long long int&, int&)'
   12 |       L = L  / __gcd(L, a[i]) * a[i];
      |                ~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:12:21: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('long long int' and 'int')
   12 |       L = L  / __gcd(L, a[i]) * a[i];
      |                ~~~~~^~~~~~~~~
Language: Java

n = int(input())
arr = list(map(int,input().split()))

N = pow(10,9)+7
def gcd(a,b):
    if b == 0:return a
    else :return gcd(b,a%b)

def lcm(a,b):
    tmp =  (a*b)/gcd(a,b)
    return tmp

hcm = arr[0]
for i in range(1,n):
    hcm = lcm(hcm,arr[i])

res = 0
for num in arr:
    res += (hcm/num)
    res%=N

print(int(res))
    

    


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
n = int(input())
^
1 error
Language: C++

#include <bits/stdc++.h>
#include "../lib/math/comb.hpp"

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  else return gcd(b, a%b);
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  Combination<MOD> comb(1000010);

  int n; cin >> n;
  vll a(n);
  ll l = 1;
  for(int i=0;i<n;++i) {
    cin >> a[i];
    l = lcm(l, a[i]);
  }
  l %= MOD;

  ll su = 0;
  for(int i=0;i<n;++i) {
    su += l * comb.getinv(a[i]) % MOD;
    su %= MOD;
  }
  cout << su << endl;


}


Compiler output:
a.cc:2:10: fatal error: ../lib/math/comb.hpp: No such file or directory
    2 | #include "../lib/math/comb.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
long long INF = (long long)1E17;
#define i_7 (long long)(1E9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}

//typedef long long ll;
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

//配列のSIZEは問題ごとに定義する必要がある。
const int SIZE = 1'000'010;
long long inv[SIZE+1];//各iの逆元を格納する配列。
long long kai[SIZE+1];//i!のmodを格納する配列。
long long invkai[SIZE+1];//各i!の逆元を格納する配列。
const int MOD=i_7;
void invinit(){//上の配列を初期化する関数。
    inv[1]=1;
    for(int i=2;i<=SIZE;i++){
        inv[i] = MOD - ((MOD/i)*inv[MOD%i])%MOD;
    }
    
    kai[0]=invkai[0]=1;
    for(int i=1;i<=SIZE;i++){
        kai[i]=(kai[i-1]*i)%MOD;
        invkai[i]=(invkai[i-1]*inv[i])%MOD;
    }
}

long long comb(long long a, long long b){
    if(b<0 || a<b){
        return 0;
    }
    return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
}

long long gcd_(long long a, long long b){
  if(a<b){
    std::swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}

int main(){
  invinit();
  using namespace std;
  int n;
  cin>>n;
  long long a[n];
  logn long l = 1;
  REP(i,n){
    cin>>a[i];
    l = lcm_(l, a[i]);
    l = mod(l);
  }
  long long ans = 0;
  REP(i, n){
    ans += mod(inv[a[i]]);
    ans = mod(ans);
  }
  ans *= l;
  ans = mod(ans);
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:75:3: error: 'logn' was not declared in this scope; did you mean 'long'?
   75 |   logn long l = 1;
      |   ^~~~
      |   long
a.cc:78:5: error: 'l' was not declared in this scope
   78 |     l = lcm_(l, a[i]);
      |     ^
a.cc:86:10: error: 'l' was not declared in this scope
   86 |   ans *= l;
      |          ^
Language: C++

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

using edge = pair<int,int>;
using graph = vector<vector<edge>>;

ll dfs(int v, int p, int g, ll num){
    if (v == g) return num;
    for (auto nv : G[v]){
        if (nv.first == p) continue;
        ll next_num = num | (1ll<<nv.second);
        res k = dfs(nv.first, v, g, next_num);
        if (res > 0ll) return res;
    }
    return 0ll;
}

int main(){
    int n; cin >> n;
    graph G(n);
    for (int i = 0; i < n - 1; i++) {
        int a, b; cin >> a >> b; a--; b--;
        G[a].pb(edge(b,i));
        G[b].pb(edge(a,i));
    }

    int m; cin >> m;
    vector<ll> dist(m);
    for (int i = 0; i < m; i++) {
        int a, b; cin >> a >> b; a--; b--;
        dist[i] = dfs(a, -1, b, 0ll);
    }

    ll ans = 0;
    for (int i = 0; i < 1<<m; i++) {
        ll num = 0
        bool check = true;
        for (int j = 0; j < m; j++) if (i & (1<<j)) { num |= dist[j]; check = !check; }
        int k = n - 1 - __builtin_popcount(num);
        if (check) ans += 1ll<<k;
        else ans -= 1ll<<k;
    }

    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'll dfs(int, int, int, ll)':
a.cc:11:20: error: 'G' was not declared in this scope
   11 |     for (auto nv : G[v]){
      |                    ^
a.cc:14:9: error: 'res' was not declared in this scope
   14 |         res k = dfs(nv.first, v, g, next_num);
      |         ^~~
a.cc: In function 'int main()':
a.cc:39:9: error: expected ',' or ';' before 'bool'
   39 |         bool check = true;
      |         ^~~~
a.cc:40:71: error: 'check' was not declared in this scope
   40 |         for (int j = 0; j < m; j++) if (i & (1<<j)) { num |= dist[j]; check = !check; }
      |                                                                       ^~~~~
a.cc:42:13: error: 'check' was not declared in this scope
   42 |         if (check) ans += 1ll<<k;
      |             ^~~~~
Language: C++

#include <bits/stdc++.h>
 
#define R register
#define ll long long
#define sum(a, b, mod) (((a) + (b)) % mod)
 
const int MaxN = 5e5 + 10;
const ll mod = 1ll << 62;
 
struct edge
{
    int next, to;
};
 
edge e[MaxN << 1];
int n, m, cnt;
int head[MaxN], f[MaxN], u[MaxN], v[MaxN];
std::bitset<510> q[25], t[1 << 16];
 
ll fast_pow(ll a, ll b)
{
    ll res = 1;
    while (b)
    {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod, b >>= 1;
    }
    return res;
}
 
void add_edge(int u, int v)
{
    ++cnt;
    e[cnt].to = v;
    e[cnt].next = head[u];
    head[u] = cnt;
}
 
void dfs(int u, int fa)
{
    f[u] = fa;
    for (int i = head[u]; i; i = e[i].next)
    {
        int v = e[i].to;
        if (v == fa) continue;
        dfs(v, u);
    }
}
 
void make(int x, int y, int p)
{
    for (int i = x; i != 1; i = f[i])
        q[p].set(i, 1);
    int cur = y;
    for (; cur != 1 && !q[p][cur]; cur = f[cur])
        q[p].set(cur, 1);
    for (; cur != 1; cur = f[cur])
        q[p].set(cur, 0);
}
 
inline int read()
{
    int x = 0;
    char ch = getchar();
    while (ch > '9' || ch < '0')
        ch = getchar();
    while (ch <= '9' && ch >= '0')
        x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
    return x;
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
//g++ -std=c++11 

using namespace std;

long long N, M;
long long A[55];
long long B[55];
vector<long long> tree[55];
long long U[25];
long long V[25];

//えだ、状態
long long dp[55][33554432];

long long cut[55];

//
bool dfs(long long pa, long long cur, long long tar) {
	if(cur == tar) {
		return true;
	}
	for(auto next: tree[cur]) {
		if(next != pa) {
			if(dfs(cur, next, tar)) {
				return true;
			}
		}
	}
	return false;
}

int main(){
	cin >> N;
	rep(i, N-1) {
		cin >> A[i] >> B[i];
		A[i]--;B[i]--;
		tree[A[i]].push_back(B[i]);
		tree[B[i]].push_back(A[i]);
	}
	cin >> M;
	rep(i, M) {
		cin >> U[i] >> V[i];
		U[i]--;V[i]--;
	}

	rep(i, N-1) {
		rep(j, M) {
			long long u = U[j];
			long long v = V[j];

			//uがA側にある && vがB側にある
			if(dfs(B[i], A[i], u) && dfs(A[i], B[i], v)) {
				cut[i] |= (1<<j);
			}
			//uがB側にある && vがA側にある
			if(dfs(B[i], A[i], v) && dfs(A[i], B[i], u)) {
				cut[i] |= (1<<j);
			}
		}
	}

	dp[0][0] = 1;
	rep(i, N-1) {
		rep(j, (1<<M)) {
			//使う dp[i+1][j|cut[i]] += dp[i][j];
			//使わない
			dp[i+1][j] += dp[i][j];
		}
	}

	cout << dp[N-1][(1<<M) - 1] << endl;
}


Compiler output:
/tmp/ccxNCpQR.o: in function `main':
a.cc:(.text+0x445): relocation truncated to fit: R_X86_64_PC32 against symbol `cut' defined in .bss section in /tmp/ccxNCpQR.o
a.cc:(.text+0x473): relocation truncated to fit: R_X86_64_PC32 against symbol `cut' defined in .bss section in /tmp/ccxNCpQR.o
a.cc:(.text+0x51c): relocation truncated to fit: R_X86_64_PC32 against symbol `cut' defined in .bss section in /tmp/ccxNCpQR.o
a.cc:(.text+0x54a): relocation truncated to fit: R_X86_64_PC32 against symbol `cut' defined in .bss section in /tmp/ccxNCpQR.o
collect2: error: ld returned 1 exit status
Language: C++

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

vector<vector<pair<ll,ll>>> G;
ll a, b;

ll dfs(ll v, ll p, ll g, ll num){
    if(v == g) return num;
    for(auto nv : G[v]){
        if(nv.first != p){
            ll k = dfs(nv.first, v, num^(1ll<<nv.second));
            if(k) return k;
        }
    }
    return 0;
}

int main(){
    ll n; cin >> n;
    G.assign(n,vector<pair<ll,ll>>());
    rep(i,n-1){
        cin >> a >> b;
        a--; b--;
        G[a].pb(make_pair(b,i));
        G[b].pb(make_pair(a,i));
    }
    ll m; cin >> m;
    vector<ll> dist;
    rep(i,m){
        cin >> a >> b;
        a--; b--;
        dist.pb(dfs(a, -1, b, 0ll));
    }
    vector<ll> pow(n); pow[0] = 1; rep(i,n-1) pow[i+1] = pow[i] * 2;
    ll ans = 0;
    rep(i,1ll<<m){
        ll num = 0, count = 0;
        rep(j,m) if(i&(1ll<<j)) { num |= dist[j]; count++; }
        ll k = n-1 - __builtin_popcount(num);
        if(count%2) ans += pow[k]; else ans -= pow[k];
    }
    cout << abs(ans) << endl;
    return 0;
}

Compiler output:
a.cc: In function 'll dfs(ll, ll, ll, ll)':
a.cc:14:23: error: too few arguments to function 'll dfs(ll, ll, ll, ll)'
   14 |             ll k = dfs(nv.first, v, num^(1ll<<nv.second));
      |                    ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:10:4: note: declared here
   10 | ll dfs(ll v, ll p, ll g, ll num){
      |    ^~~
Language: C++

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

struct Edge {
    int to, id;

    Edge(int to, int id): to(to), id(id) {}
};

vector<Edge> g[55];
vector<int> es;

bool dfs(int cur, int t, int p = -1) {
    if(cur == t) return true;
    for(Edge e : g[cur]) {
        if(e.to == p) continue;
        if(dfs(e.to, t, cur)) {
            es.push_back(e.id);
            return true;
        }
    }
    return false;
}


int main() {
    int N;
    cin >> N;
    REP(i, N-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].emplace_back(b, i);
        g[b].emplace_back(a, i);
    }

    int M;
    cin >> M;

    vector<ll> eset(M);
    REP(i, M) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        es = vector<int>();
        dfs(u, v);
        for(int e: es) {
            eset[i] |= 1ll<<e;
        }
    }

    ll ans = 0;
    REP(bit, 1<<M) {
        ll mask = 0;
        REP(j, M)
            if(i >> j & 1) mask |= eset[j];

        int bit_cnt = __builtin_popcountll(mask);
        ll now = 1ll<<(N - 1 - bit_cnt);
        if(__builtin_popcountll(bit)%2 == 0)
            ans += now;
        else
            ans -= now;
    }
    
    printf("%lld\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:93:16: error: 'i' was not declared in this scope
   93 |             if(i >> j & 1) mask |= eset[j];
      |                ^
Language: C++

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

struct Edge {
    int to, id;

    Edge(int to, int id): to(to), id(id) {}
};

vector<Edge> g[55];
vector<int> es;

bool dfs(int cur, int t, int p = -1) {
    if(cur == t) return true;
    for(Edge e : g[cur]) {
        if(e.to == p) continue;
        if(dfs(e.to, t, cur)) {
            es.push_back(e.id);
            return true;
        }
    }
    return false;
}


int main() {
    int N;
    cin >> N;
    G.resize(N);
    REP(i, N-1) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        g[a].emplace_back(b, i);
        g[b].emplace_back(a, i);
    }

    int M;
    cin >> M;

    vector<ll> eset(M);
    REP(i, M) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        es = vector<int>();
        dfs(u, v);
        for(int e: es) {
            eset[i] |= 1ll<<e;
        }
    }

    ll ans = 0;
    REP(bit, 1<<M) {
        ll mask = 0;
        REP(j, M)
            if(i >> j & 1) mask |= eset[j];

        int bit_cnt = __builtin_popcountll(mask);
        ll now = 1ll<<(N - 1 - bit_cnt);
        if(__builtin_popcountll(bit)%2 == 0)
            ans += now;
        else
            ans -= now;
    }
    
    printf("%lld\n", ans);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:5: error: 'G' was not declared in this scope
   66 |     G.resize(N);
      |     ^
a.cc:94:16: error: 'i' was not declared in this scope
   94 |             if(i >> j & 1) mask |= eset[j];
      |                ^
Language: C++

#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <stdlib.h>
#include <queue>
#include <stack>


typedef long double ld;
typedef long long ll;

using namespace std;

#define MAXN 64

vector<int> a[MAXN];
int n, m;
ll ret;
vector<ll> v;
int cnt = 0;
map<pair<int, int>, > edges;

int vis[MAXN];
int pred[MAXN];

void dfs(int cur) {
	vis[cur] = 1;
	for (int i = 0; i < a[cur].size(); i++) {
		int nnext = a[cur][i];
		if (!vis[nnext]) {
			pred[nnext] = cur;
			dfs(nnext);
		}
	}
}

ll path(int s, int t) {
	memset(vis, 0, sizeof(vis));
	memset(pred, -1, sizeof(pred));
	dfs(s);
	ll ret = 0;
	while (t != s) {
		ret |= (ll)1 << edges[make_pair(t, pred[t])];
		t = pred[t];
	}
	return ret;
}

void addedge(int v1, int v2) {
	pair<int, int> p = make_pair(v1, v2);
	cnt++;
	edges[p] = cnt;
	swap(p.first, p.second);
	edges[p] = cnt;
	
	a[v1].push_back(v2);
	a[v2].push_back(v1);

}

/*
set<int> unite(set<int> s1, set<int> s2) {
	set<int> ret;
	for (set<int>::iterator it = s1.begin(); it != s1.end(); it++) {
		ret.insert(*it);
	}
	for (set<int>::iterator it = s2.begin(); it != s2.end(); it++) {
		ret.insert(*it);
	}
	return ret;
}
*/

ll two(int k) {
	ll ret = 1;
	for (int i = 0; i < k; i++) {
		ret *= 2;
	}
	return ret;
}

int bitcnt(ll x) {
	int ret = 0;
	while (x) {
		if (x & 1) {
			ret++;
		}
		x >>= 1;
	}
	return ret;
}

int main() {
	cin >> n;
	for (int i = 0; i < n - 1; i++) {
		int v1, v2;
		cin >> v1 >> v2;
		v1--;
		v2--;
		addedge(v1, v2);
		addedge(v2, v1);
	}
	ret = two(n - 1);
	cin >> m;
	for (int i = 0; i < m; i++) {
		int v1, v2;
		cin >> v1 >> v2;
		v1--;
		v2--;
		v.push_back(path(v1, v2));		
	}
	ll corr = 0;
	for (int mask = 1; mask < (1 << m); mask++) {
		ll cur = 0;
		int parity = 0;
		for (int j = 0; j < m; j++) {
			if (mask & (1 << j)) {
				cur |= v[j];
				parity = 1 - parity;
			}
		}
		ll curval = two(n - 1 - bitcnt(cur));
		if (parity) {
			corr += curval;	
		} else {
			corr -= curval;
		}
	}	
	ret -= corr;
	cout << ret << endl;

	return 0;
}


Compiler output:
a.cc:28:21: error: template argument 2 is invalid
   28 | map<pair<int, int>, > edges;
      |                     ^
a.cc:28:21: error: template argument 4 is invalid
a.cc: In function 'll path(int, int)':
a.cc:50:38: error: no match for 'operator[]' (operand types are 'int' and 'std::pair<int, int>')
   50 |                 ret |= (ll)1 << edges[make_pair(t, pred[t])];
      |                                      ^
a.cc: In function 'void addedge(int, int)':
a.cc:59:14: error: no match for 'operator[]' (operand types are 'int' and 'std::pair<int, int>')
   59 |         edges[p] = cnt;
      |              ^
a.cc:61:14: error: no match for 'operator[]' (operand types are 'int' and 'std::pair<int, int>')
   61 |         edges[p] = cnt;
      |              ^