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

#pragma region ヘッダー
#define _CRT_SECURE_NO_WARNINGS

#ifdef _____MY_DEBUG_____
#define VS_ENDPAUSE()	(system("pause"))
#define DEBUG_OUT(...)  (printf(__VA_ARGS__))
#else
#define VS_ENDPAUSE()
#define DEBUG_OUT(...)
#endif

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef signed long long int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;
#define int int64

#ifndef INT8_MIN
#define INT8_MIN	(-127)
#endif
#ifndef INT8_MAX
#define INT8_MAX	( 128)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX	( 255)
#endif
#ifndef INT16_MIN
#define INT16_MIN	(-32768)
#endif
#ifndef INT16_MAX
#define INT16_MAX	( 32767)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX	( 65535)
#endif
#ifndef INT32_MIN
#define INT32_MIN	(-2147483648)	// -2 * 10^9
#endif
#ifndef INT32_MAX
#define INT32_MAX	( 2147483647)	//  2 * 10^9
#endif
#ifndef UINT32_MAX
#define UINT32_MAX	( 4294967295)	//  4 * 10^9
#endif
#ifndef INT64_MIN
#define INT64_MIN	(-9223372036854775808)	// -9 * 10^18
#endif
#ifndef INT64_MAX
#define INT64_MAX	( 9223372036854775807)	//  9 * 10^18
#endif
#ifndef UINT64_MAX
#define UINT64_MAX	( 18446744073709551615)	// 18 * 10^18
#endif

void func(void);
#pragma endregion

int32 main(void)
{
    func();
    VS_ENDPAUSE();
    return 0;
}

uint64 gcd(uint64 a, uint64 b)
{
    uint64 tmp;
    if(b > a){ swap(a, b); }
    while(b > 0){
        tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}
void func(void)
{
//DEBUG_OUT("----\n");
    int N;
    cin >> N;

    if(N==1){
        int tmp;
        cin >> tmp;
        cout << tmp << endl;
        return;
    }

    int ggd;
    int prev;
    uint64 mul = 0;
    cin >> prev;
    mul = prev;
    for(int i=1; i<N; i++){
        int tmp;
        cin >> tmp;
        ggd = getGgd(prev, tmp);
        prev = ggd;

        mul *= tmp / ggd;;
        prev = mul;
    }

DEBUG_OUT("-----\n");
    cout << mul << endl;
    
    return;
}



Compiler output:
a.cc: In function 'void func()':
a.cc:111:15: error: 'getGgd' was not declared in this scope
  111 |         ggd = getGgd(prev, tmp);
      |               ^~~~~~
Language: C++

import math as m
from functools import reduce
 
n=int(input())
l=[]
def f(a,b):
    return int(a*b/m.gcd(a,b))
for i in range(n):
    l.add(int(input()))
print(reduce(f,l))

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

import math

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

n = int(input())
t = [i for i in range(n)]
for i in range(n):
    t[i] = int(input())

ans = t[0]
for i in range(1, n):
    ans = lcm(ans, t[i])

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<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
long long n,m[101],ans;
int gcd(int x , int y)
{
	if(!y)
	return x;
	else return gcd(y , x%y);
}
int main()
{
	cin>>n;
	if(n==1)
	{
		cin>>m[1]
		cout<<m[1];
		return 0;
	}
	for(int i=1;i<=n;i++)
	{
		cin>>m[i];
		ans=max(m[i],ans);
	}
	for(int i=1;i<=n;i++)
	{
		if(!(ans%m[i]))
		continue;
		ans=ans/gcd(ans,m[i])*m[i];
	}
	cout<<ans;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:70:26: error: expected ';' before 'cout'
   70 |                 cin>>m[1]
      |                          ^
      |                          ;
   71 |                 cout<<m[1];
      |                 ~~~~
Language: C++

#include <iostream>
#include "string.h"
#include <vector>
#include <cstdlib>
#include <cmath>
#include <algorithm>

using namespace std;

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

unsigned long long lcm(unsigned long long a,unsigned long long b){
	if(a == b) return a;
	return  a / g * b;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<unsigned long long> T(N);
	for(int i = 0;i < N;i++) cin >> T[i];
	unsigned long long tmp ;
	if(N == 1){
		cout << T[0] << endl;
		return 0;
	}else{
		if(T[0] > T[1])	tmp = lcm(T[0],T[1]);
		else if(T[0] < T[1]) tmp = lcm(T[1],T[0]);
		else tmp = T[0];
		for(int i = 2;i < N;i++){
			if(tmp > T[i]) tmp = lcm(tmp,T[i]);
			else if(tmp < T[i]) tmp = lcm(T[i],tmp);
		}
	}
	if(tmp == 0) cout << T[0] << endl;
	else cout << tmp << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'long long unsigned int lcm(long long unsigned int, long long unsigned int)':
a.cc:17:21: error: 'g' was not declared in this scope
   17 |         return  a / g * b;
      |                     ^
Language: C

#include<stdio.h>
int main(void){
int N,i,m,c=1;
scanf("%d",&N);
int T[N];
for(i=0;i<N;i++){
     scanf("%d",&T[i]);
}
m=T[0];
for(i=0;i<N:i++){
     if(m<T[i]){
       m=T[i];
     }
}
for(i=0;i<N;i++){
     if(m%T[i]){
        c++;
        m*=c;
     }
}
printf("%d\n",m);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:10:12: error: expected ';' before ':' token
   10 | for(i=0;i<N:i++){
      |            ^
      |            ;
Language: C

#include <stdio.h>

int main(void) {
    int N,i;
    long long T[100],ans[99],a,b,n;
    scanf("%d",&N);
    for (i = 0; i < N; i++) {
        scanf("%lld",&T[i]);
    }
    a = T[0];
    b = T[1];
    x = a * b;
    for (n = 2;;n++) {
        if ((a % n == 0) && (b % n == 0)) {
            a /= n;
            b /= n;
        } else if (n > a || n > b) {
            break;
        }
    }
    ans[0] =  x / b;
    for (i = 1; i < N  - 1; i++) {
        a = ans[i - 1];
        b = T[i + 1];
        x = a * b;
        for (n = 2;;n++) {
            if ((a % n == 0) && (b % n == 0)) {
                a /= n;
                b /= n;
            } else if (n > a || n > b) {
                break;
            }
        }
        ans[i] =  x / b;
    }
    printf("%lld\n",ans[N - 2]);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:12:5: error: 'x' undeclared (first use in this function)
   12 |     x = a * b;
      |     ^
main.c:12:5: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

int main()
{
    long long N,T[105],k=0,r;
	for(long long i=0;i<N;i++)
	{
		cin>>T[i];
		for(long long j=1;j<=1000000000000000000;j++)
		{
			for(long long i=0;i<N;i++)
			{
				if(j%T[i]==0)
				{
					k++;										
			        if(k==N)    
		            {
		                r=j;
			            cout<<r;
			            return 0;
		            }			 
				}							       
			}			
		}			
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:17: error: 'cin' was not declared in this scope
    6 |                 cin>>T[i];
      |                 ^~~
a.cc:17:37: error: 'cout' was not declared in this scope
   17 |                                     cout<<r;
      |                                     ^~~~
Language: C++

#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdlib>
using namespace std;

typedef long long ll;

int lu(int m,int n){

	int t;
	if(m<n)  
	{
		m=m+n;
		n=m-n;
		m=m-n;
	}
	while(n!=0)
	{
		t=m%n;	
		m=n;
		n=;
	}	
	return m;
}
int zheng(int a,int b){
	return a/lu(a,b)*b;
}

int main()
{
	int N;
	ll s,a[105];
	while (~scanf("%d",&N)){
		s=1;
		for(int i=1;i<=N;i++){
			scanf("%I64d",&a[i]);
			s=zheng(s,a[i]);
		}
		printf("%I64d\n",s);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int lu(int, int)':
a.cc:23:19: error: expected primary-expression before ';' token
   23 |                 n=;
      |                   ^
Language: Java

import java.util.Scanner;
public class Main3 {

	public static void main(String[] args) {
		Scanner stdIn=new Scanner(System.in);
		int length=stdIn.nextInt();
		int time[]=new int[length];
		for(int i=0;i<length;i++){
			time[i]=stdIn.nextInt();
	}
		for(int i=0;i<length;i++){
			for(int j=0;j<length-1;j++){
				int k;
				if(time[j]>time[j+1]){
					k=time[j+1];
					time[j+1]=time[j];
					time[j]=k;
				}
					
			}

	}
		 long ans=1;
		for(int i=0;i<length;i++){
			if(Judge(i,time,length))
				ans*=time[i];
			
		}
		
		 System.out.println(ans);
 


}
public static boolean Judge(int i,int time[],int length){
		for(int j=i+1;j<length;j++){
			if(time[j]%time[i]==0)
				return false;
		}
		return true;
	}
	

	 
}


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

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

long long gcd(long long a, long long b)
{
    while (b) {
        long long tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}

int main()
{
    int n;
    long double s[100 + 5];
    while (cin>>n && n) {
        memset(s, 0, sizeof s);
        for (int i = 0; i < n; i++)
            cin >> s[i];
        long double w = s[0] / gcd(s[0], s[1])* s[1];
        for (int i = 2; i < n; i++) {
                 w = w / gcd(w, s[i]) * s[i];
        }
        printf("%.Lf\n", w);
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:9: error: 'memset' was not declared in this scope
   20 |         memset(s, 0, sizeof s);
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<iostream>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: Java

import java.util.*;
public class Main2 {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    long[] T  = new long[num];
    for(int i = 0; i<num; i++) {
      T[i] = sc.nextLong();
    }
    if(num == 1) {
      System.out.println(T[0]);
      return;
    }
    for(int i = 0; i<num-1; i++){
      long m = T[i];
      long n = T[i+1];
      T[i+1] = lcm(m, n);
    }
    System.out.println(T[num-1]);
  }

  public static long gcd(long m, long n) {
       if(m < n) return gcd(n, m);
       if(n == 0) return m;
       return gcd(n, m % n);
   }

   public static long lcm(long m, long n) {
       return m * n / gcd(m, n);
   }
}


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

// C++ program to find LCM of n elements
#include <bits/stdc++.h>
#include<stdio.h>
using namespace std;
typedef long long int ll;

// Utility function to find GCD of 'a' and 'b'
long long int gcd(long long int a, long long int b)
{
    if (b==0)
        return a;
    return gcd(b, a%b);
}

// Returns LCM of array elements
ll findlcm(long long 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;
}

// Driver Code
int main()
{
    int i,s,l=0;
    scanf("%d",&s);
    long long int arr[s],p,maxi=0;
    for(i=0;i<s;i++)
    {
        scanf("%lld",&arr[i]);
        if(arr[i]>1000000000)
        {
            if(arr[i]>=maxi){
              maxi=arr[i]
              p=arr[i];
              l=-1;
            }
        }
    }
    if(l==-1)
        printf("%lld",p);
    else{
    int n = sizeof(arr)/sizeof(arr[0]);
    printf("%lld", findlcm(arr, n));}
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:26: error: expected ';' before 'p'
   42 |               maxi=arr[i]
      |                          ^
      |                          ;
   43 |               p=arr[i];
      |               ~
Language: Java

import java.util.*;
public class Main2 {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int num = sc.nextInt();
    long[] T  = new long[num];
    for(int i = 0; i<num; i++) {
      T[i] = sc.nextLong();
    }
    if(num == 1) {
      System.out.println(T[0]);
      return;
    }
    for(int i = 0; i<num-1; i++){
      long m = T[i];
      long n = T[i+1];
      T[i+1] = lcm(m, n);
    }
    System.out.println(T[num-1]);
  }

  private static long gcd(long m, long n) {
       if(m < n) return gcd(n, m);
       if(n == 0) return m;
       return gcd(n, m % n);
   }

   private static long lcm(long m, long n) {
       return m * n / gcd(m, n);
   }
}


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

#include <iostream>
using namespace std;
int main() {
	int n;
	cin >> n;
	long int t[100];
	for(int i=0;i<n;i++){
		cin >> t[i];
	}
	sort(t,t+n);
	long int ans = t[n-1];
	long int a, b, r;
	for(int i=0;i<n-1;i++){
		if(ans%t[i]!=0){ 
			a = ans;
			b = t[i];
			r = a%b;
			while(r != 0){
				a = b;
				b = r;
				r = a%b;
			}
			ans = (ans*t[i])/b;
		}
	}
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |         sort(t,t+n);
      |         ^~~~
      |         short
Language: C++

#include<iostream>
using namespace std;
long long N,T[105],k=0,r;
int main()
{
	for(long long i=0;i<N;i++)
	{
		cin>>T[i];
		for(long long j=0;j<=T[N-1];j++)
		{
			if(j%T[i]==0)
			{
				k++;
				
			}			
			if(k==N)    
		    {
		        r=j;
			    cout<<r;
			    break;
		    }			    
		}			
	}
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:24:18: error: expected '}' at end of input
   24 |         return 0;
      |                  ^
a.cc:5:1: note: to match this '{'
    5 | {
      | ^
Language: C++

#include<iostream>
#include<string>
#include<numeric>

using namespace std;


unsigned long long d[2000];

int main()
{
	int n, s = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> d[i];
		s += i;
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < (n / pow(2, i + 1)) - 1; j++)
		{
			unsigned long long r, a, b, x;
			a = d[2 * j];
			b = d[2 * j + 1];
			r = a % b;
			x = a * b;

			while (r != 0) {
				a = b;
				b = r;
				r = a % b;
			}
			d[j] = x / b;
		}
	}
	unsigned long long r, a, b, x;
	a = d[0];
	b = d[n - 1];
	r = a % b;
	x = a * b;

	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	cout << x / b << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:42: error: 'pow' was not declared in this scope
   21 |                 for (int j = 0; j < (n / pow(2, i + 1)) - 1; j++)
      |                                          ^~~
Language: C++

#include<iostream>
#include<string>
#include<numeric>

using namespace std;


unsigned long long d[2000];

int lcm(int x, int y)
{
	if (x == 0 || y == 0)  // 引数チェック
	{
		fprintf(stderr, "引数エラーです。\n");
		return 0;
	}

	return (x * y / std::gcd(x, y));
}
int main()
{
	int n, s = 0;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> d[i];
		s += i;
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < (n / pow(2, i + 1)) - 1; j++)
		{
			unsigned long long r, a, b, x;
			a = d[2 * j];
			b = d[2 * j + 1];
			r = a % b;
			x = a * b;

			while (r != 0) {
				a = b;
				b = r;
				r = a % b;
			}
			d[j] = x / b;
		}
	}
	unsigned long long r, a, b, x;
	a = d[0];
	b = d[n - 1];
	r = a % b;
	x = a * b;

	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	cout << x / b << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:42: error: 'pow' was not declared in this scope
   31 |                 for (int j = 0; j < (n / pow(2, i + 1)) - 1; j++)
      |                                          ^~~
Language: C++

import urllib.request
from bs4 import BeautifulSoup
import re
import sys
import os
import time
import subprocess
import datetime


def gcd(a, b):
    if a < b:
        c = a
        a = b
        b = c

    r = a % b

    while r > 0:
        a = b
        b = r
        r = a % b

    return b

    # ll gcd(ll a, ll b) {
    #   if (a < b)
    #     swap(a, b);
    #   ll r = a % b;
    #
    #   while (r) {
    #     a = b;
    #     b = r;
    #     r = a % b;
    #   }
    #
    #   return b;
    # }


N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
# a = list(map(int, input().split()))

ans = a[0]

for i in range(N):
    if i == 0:
        continue

    g = gcd(ans, a[i])
    ans = ans * a[i] // g

print(ans)


Compiler output:
a.cc:26:7: error: invalid preprocessing directive #ll
   26 |     # ll gcd(ll a, ll b) {
      |       ^~
a.cc:27: error: unterminated #if
   27 |     #   if (a < b)
a.cc:1:1: error: 'import' does not name a type
    1 | import urllib.request
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C

        #include <stdio.h>
        #include <stdlib.h>
long long int gcd(long long int a, long long int b) {

	long long int tmp;

	while (a % b != 0)
	{
		tmp = b;
		b = a % b;
		a = tmp;
	}

	return b;
}

long main3() {

	long long int num_n;
	long long int i, j;
	long long int res = 1;

	long *clock;

	scanf("%d\n", &num_n);

	clock = (long long int *) malloc(sizeof(long long int *) * num_n);
//	fflush(stdin);

	for (i = 0; i < num_n; i++) {
		scanf("%lld\n", &clock[i]);
//		fflush(stdin);
	}

	for (i = 0; i < num_n; i++) {
		res *= (clock[i]/gcd(res,clock[i]));
	}

	printf("%lld",res);
	fflush(stdout);

	return 0;

}

Compiler output:
main.c: In function 'main3':
main.c:27:15: error: assignment to 'long int *' from incompatible pointer type 'long long int *' [-Wincompatible-pointer-types]
   27 |         clock = (long long int *) malloc(sizeof(long long int *) * num_n);
      |               ^
Language: C++

#include<algorithm>

using namespace std;

long long T[100];

int main()
{
	int N;
	long long MaxValue = 0;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> T[i];
		MaxValue = max(MaxValue, T[i]);
	}

	long long count = MaxValue;
	bool check = true;
	while (true)
	{
		for (int i = 0; i < N; i++)
		{
			if ((count % T[i]) != 0)
			{
				check = false;
				break;
			}
		}
		if (check)
		{
			cout << count << endl;
			return 0;
		}
		check = true;
		count += MaxValue;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:9: error: 'cin' was not declared in this scope
   11 |         cin >> N;
      |         ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<algorithm>
  +++ |+#include <iostream>
    2 | 
a.cc:32:25: error: 'cout' was not declared in this scope
   32 |                         cout << count << endl;
      |                         ^~~~
a.cc:32:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:32:42: error: 'endl' was not declared in this scope
   32 |                         cout << count << endl;
      |                                          ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<algorithm>
  +++ |+#include <ostream>
    2 |
Language: Java

package com.hhs.xgn.atcoder.abc070;

import java.math.BigInteger;
import java.util.Scanner;

public class C {
	public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        while(s.hasNext()){
            int n=s.nextInt();
            BigInteger mul=BigInteger.ONE;
            BigInteger mul2;
            BigInteger[] arr=new BigInteger[n];
            for(int i=0;i<n;i++){
                arr[i]=s.nextBigInteger();
                mul2=mul.multiply(arr[i]);
                mul=arr[i].gcd(mul);
                mul=mul2.divide(mul);
            }
            System.out.println(mul);
        }
    }
}


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

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
using namespace std;
const int maxn=1e18+5;
int n;
int t[maxn];
int main()
{
	scanf("%d",&n);
	while(n--)
	{
		for(int i=0;i<n;i++)
			scanf("%d",&t[i]);
		int u,v,r,s,i,d;
 
      scanf("%u%u",&u,&v);
      while(u !=0 && v!= 0)
 
     {
 
 
      d=u*v;
 
     while(v!=0)
 
     {
 
      r=u%v;
 
      u=v;
 
      v=r;
 
     }
 
     printf("%u %u\n",u,d/u);
     scanf("%u%u",&u,&v);
    }
 


Compiler output:
a.cc:10:20: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   10 | const int maxn=1e18+5;
      |                ~~~~^~
a.cc:12:7: error: size of array 't' exceeds maximum object size '9223372036854775807'
   12 | int t[maxn];
      |       ^~~~
a.cc: In function 'int main()':
a.cc:44:6: error: expected '}' at end of input
   44 |     }
      |      ^
a.cc:17:9: note: to match this '{'
   17 |         {
      |         ^
a.cc:44:6: error: expected '}' at end of input
   44 |     }
      |      ^
a.cc:14:1: note: to match this '{'
   14 | {
      | ^
Language: Java

import java.util.*;
public class C{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        long[] t=new long [n];int i;long max_GCD;
        for(i=0;i<n;i++){
            t[i]=sc.nextLong();
        }
        System.out.println(max_gcd(t));
    }

    static long gcd(long a,long b){
        long x,tmp,ans,r;
          x = a * b;
           if(a<b){
            tmp = a;
            a = b;
            b = tmp;
            }
            r = a % b;
         while(r!=0){
            a = b;
            b = r;
            r = a % b;
         }
         ans=(long)x/b;
         return ans;
    }
    static long max_gcd(long[] x){
        int i;
        int len=x.length;
        long s=gcd(x[0],x[1]);
        for(i=2;i<len;i++){
            s=gcd(x[i],s);
        }
        return s;
    }
}

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

import java.util.*;

public class Main{
	public static void main(String[] args){
	    Scanner scanner = new Scanner(System.in);
		int n=scanner.nextInt();
	    long[] array = new long[n];
	    long ans=-1;
	    for(int i=0;i<n;i++){   
		array[i]=scanner.nextLong();
	    }
	    for(int i=0;i<n-1;i++){
		array[i+1]=(lcm(array[i],array[i+1]));
	    }
	    ans = array[n-1];
		System.out.println(ans);
	}
private static long lcm(long m, long n) {
    return m * n / gcd(m, n);
}
private static long gcd(long m, long n) {
    if(m < n) return gcd(n, m);
    if(n == 0) return m;
    return gcd(n, m % n);
}

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

#include<cstdio>
int main(){
	int n;
	scanf("%d",&n);
	int a[n];
	long long int m;
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	b[0]=a[0];
	for(int i=0;i<n;i++){
		int x;
		if(a[i+1]>=m)x=m;
		else x=a[i+1];
		
		for(int j=x;j>=1;j--){
			if((a[i+1]%j==0)&&(m%j==0)){
				m=a[i+1]*m/j;
				break;
			}
		}
	}
	printf("%lli",m);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'b' was not declared in this scope
   10 |         b[0]=a[0];
      |         ^
Language: C

#include <stdio.h>

int main(void) {
　  int N,i,j;
  　long T[100],ans[99];
    scanf("%d",&N);
    for (i = 0; i < N; i++) {
        scanf("%ld",&T[i]);
    }
    for (j = 1;;j++) {
        if ((T[0] * j) % T[1] == 0) {
            ans[0] = T[0] * j;  
            break;
        }
    }
    for (i = 1; i < N  - 1; i++) {
        for (j = 1;;j++) {
            if ((ans[i - 1] * j) % T[i + 1] == 0) {
                ans[i] = ans[i - 1] * j;
                break;
            }
        }
    }
    printf("%ld\n",&ans[N - 2]);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:4:1: error: stray '\343' in program
    4 | <U+3000>  int N,i,j;
      | ^~~~~~~~
main.c:5:3: error: stray '\343' in program
    5 |   <U+3000>long T[100],ans[99];
      |   ^~~~~~~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

unsigned long long getGcd(unsigned long long a, unsigned long long b) {
    unsigned long long c;

    while (b) {
        c = a % b;
        a = b;
        b = c;
    }

    return a;
}

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

    int n;
    cin >> n;

    vector<unsigned long long> v;

    unsigned long long t;

    cin >> t;

    unsigned long long gcd = t;
    unsigned long long prod = t;

    for (int i = 1; i < n; ++i) {
        cin >> t;

        gcd = getGcd(gcd, t);

        if (t % prod == 0) {
            prod = t;
        } else {
            prod *= t;
        }
    }

    cout << prod / gcd;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:5: error: 'vector' was not declared in this scope
   25 |     vector<unsigned long long> v;
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | 
a.cc:25:12: error: expected primary-expression before 'unsigned'
   25 |     vector<unsigned long long> v;
      |            ^~~~~~~~
Language: C++

#include<cstdio>
int main(){
	int n;
	scanf("%d",&n);
	int a[n];
	double b[n];
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	b[0]=a[0];
	for(int i=0;i<n;i++){
		int x;
		if(a[i+1]>=b[i])x=b[i];
		else x=a[i+1];
		
		for(int j=x;j>=1;j--){
			if((a[i+1]%j==0)&&(b[i]%j==0)){
				b[i+1]=a[i+1]*b[i]/j;
				break;
			}
		}
	}
	printf("%f",b[n-1]);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:48: error: invalid operands of types 'double' and 'int' to binary 'operator%'
   17 |                         if((a[i+1]%j==0)&&(b[i]%j==0)){
      |                                            ~~~~^~
      |                                               | |
      |                                               | int
      |                                               double
Language: C++

#include<iostream>
#include<algorithm>

using namespace std;

long long T[100];

int gcd(int x, int y)
{
	int r;
	while ((r = x % y) != 0)
	{
		x = y;
		y = r;
	}
	return y;
}

int main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> T[i];
	}
	int Ans = 1;
	for (int i = 0; i < N; i++)
	{
		Ans = gcd(T[i], Ans);
	}
	cout << Ans << endl
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:28: error: expected ';' before 'return'
   32 |         cout << Ans << endl
      |                            ^
      |                            ;
   33 |         return 0;
      |         ~~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
long long gcd(long long  a,long long  b)
{
	if(b == 0)
		return a;
	return gcd(b,a%b);
}
int main()
{
	int N;
	while(~scanf("%d",&N))
	{
		long long a[200];
		for(int i=0;i<N;++i)
		{
			scanf("%lld",&a[i]);
		}
		long long k;
		sort(a,a+N);
		temp = a[0];
		for(int i=1;i<N;++i)
		{
			if(a[i]>=temp && a[i]%temp == 0)
			{
				temp=a[i];
			}
			else
			{
				k = gcd(temp,a[i]);
				temp = temp*a[i]/k;
			}
		}
		printf("%lld\n",temp);
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: 'temp' was not declared in this scope; did you mean 'tm'?
   23 |                 temp = a[0];
      |                 ^~~~
      |                 tm
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll gcd(ll a, ll b)
{
    if(b==0) return a;
    else return gcd(b, a%b);
}
ll lcm(ll a, ll b)
{
    ll gc = gcd(a,b);
    ll ret;
    if(a%gc==0){
        ret = (a/gc)*b;
    }
    else{
        ret = (b/gc)*a;
    }
}
int main()
{
    ll n;
    cin>>n;
    ll arr[n];
    for(int i=0; i<n; i++){
        cin>>arr[i];
    }
    ll ans = arr[0];
    for(int i=1; i<n; i++){
        ans = lcm(ans, arr[i]);
    }
    cout<<ans<<endl;
]    return 0;
}


Compiler output:
a.cc: In function 'long long int lcm(long long int, long long int)':
a.cc:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
a.cc: In function 'int main()':
a.cc:33:1: error: expected primary-expression before ']' token
   33 | ]    return 0;
      | ^
Language: C++

#include<cstdio>
long long n,a[101],Min,Max;
long long gcd(long long x,long long y)
{if(!y) return x;
 else return gcd(y,x%y);
}
long long lcm(long long x,long long y)
{long long z;
 z=gcd(x,y);
 return x*y/z;
}
int main()
{scanf("%lld",&n);
memset(a,0,sizeof(a));
 for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
  Max=gcd(a[1],a[2]);
  for(int i=3;i<=n;i++)Max=gcd(Max,a[i]);
  //printf("%lld\n",Max);
  Min=lcm(a[1],a[2]);
  for(int i=1;i<=n;i++)Min=lcm(Min,a[i]);
  printf("%lld\n",Min);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:1: error: 'memset' was not declared in this scope
   14 | memset(a,0,sizeof(a));
      | ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<cstdio>
  +++ |+#include <cstring>
    2 | long long n,a[101],Min,Max;
Language: C++

#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>

using namespace std;

using ll = unsigned long long int;
const double M_PI = 3.14159265358979323846;

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

	return gcd(b%a,a);
}

int main() {

	ll n,res,g;
	cin >> n >> g;

	res = g;

	for (int i = 1; i < n; i++) {
		ll a;
		cin >> a;
		g = gcd(res, a);
		res /= g;
		res *= a;
		//cout << "g: " << g << endl;
		//cout << "res: " << res << endl;
	}

	cout << res << endl;


}



Compiler output:
In file included from /usr/include/c++/14/cmath:47,
                 from a.cc:5:
a.cc:16:14: error: expected unqualified-id before numeric constant
   16 | const double M_PI = 3.14159265358979323846;
      |              ^~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <numeric>
using namespace std;

#define ll unsigned long long

ll times[101];

ll gcd(ll a, ll b) 
{
    return b == 0 ? a : gcd(b, a % b);
}

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

int main()
{
    ll n;

    cin >> n;

    for (int i = 0; i < n; ++i)
        cin >> times[i];

    cout << ll(accumulate(times, times + n, ll(1), lcm)) << '\n';
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:12: error: expected primary-expression before 'unsigned'
    6 | #define ll unsigned long long
      |            ^~~~~~~~
a.cc:29:13: note: in expansion of macro 'll'
   29 |     cout << ll(accumulate(times, times + n, ll(1), lcm)) << '\n';
      |             ^~
Language: C++

#include<iostream>
using namespace std;
_int64 gcd(_int64 i,_int64 j)
{
	_int64 c,temp;
	_int64 tempi=i,tempj=j;
	if(j>i)
	{
		temp=j;
		j=i;
		i=temp;
	}
	while(j)
	{
		c=i%j;
		i=j;
		j=c;
	}
	return tempi/i*tempj;
}
int main()
{
	/*int t;
	cin>>t;
	double x1,y1,x2,y2,x3,y3;
	double a,k;
	while(t--)
	{
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		a=(y2-y1)/((x2-x1)*(x2-x1));
		k=(y3-y2)/(x3-x2);

	}*/
	int n;
	_int64 t;
	while(cin>>n)
	{
		_int64 k=1;
		while(n--)
		{
			cin>>t;
			k=gcd(k,t);
		}
		cout<<k<<endl;
	}
	return 0;
}

Compiler output:
a.cc:3:1: error: '_int64' does not name a type
    3 | _int64 gcd(_int64 i,_int64 j)
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:35:9: error: '_int64' was not declared in this scope
   35 |         _int64 t;
      |         ^~~~~~
a.cc:38:23: error: expected ';' before 'k'
   38 |                 _int64 k=1;
      |                       ^~
      |                       ;
a.cc:41:30: error: 't' was not declared in this scope
   41 |                         cin>>t;
      |                              ^
a.cc:42:25: error: 'k' was not declared in this scope
   42 |                         k=gcd(k,t);
      |                         ^
a.cc:42:27: error: 'gcd' was not declared in this scope
   42 |                         k=gcd(k,t);
      |                           ^~~
a.cc:44:23: error: 'k' was not declared in this scope
   44 |                 cout<<k<<endl;
      |                       ^
Language: C

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll g(ll a,ll b)
{
    if(b==0)
        return a;
    else
        return g(b,a%b);
}
int main()
{
    int n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    ll x,lcm, gcd=a[0];
    for(int i=0;i<n;i++)
    {
        x=gcd;
        gcd=g(a[i],gcd);
        lcm=(x*a[i])/gcd;
    }
    cout<<lcm;
        return 0;
}


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

#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<algorithm>
#include<complex>
#include<cstdlib>
#include<cctype>

#define DBG cout << '!' << endl;
#define REP(i,n) for(int i = 0;i < (n);i++)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cout << v[i] << ' ';cout << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cout << v[a][b] << ' ';cout << endl;}cout << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

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

ll function(ll a,ll b)
{
	ll ret = gcd(a,b);
	
	return a/ret*b;
}

int main()
{
	int n;
	cin >> n;
	
	ll num[n];
	cin >> num[0];
	ll ret = num[0];
	
	for(int i = 1;i < n;i++)
	{
		cin >> num[i];
		ret = function(ret,num[i]);
	}
	
	cout << ret << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:23: error: reference to 'function' is ambiguous
   60 |                 ret = function(ret,num[i]);
      |                       ^~~~~~~~
In file included from /usr/include/c++/14/functional:59,
                 from a.cc:5:
/usr/include/c++/14/bits/std_function.h:111:11: note: candidates are: 'template<class _Signature> class std::function'
  111 |     class function;
      |           ^~~~~~~~
a.cc:41:4: note:                 'll function(ll, ll)'
   41 | ll function(ll a,ll b)
      |    ^~~~~~~~
Language: Java

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    long ans = 1;
    for(int i = 0; i < N; i++) {
      long t = sc.nextLong();
      long u = gcd(t, ans);
      ans = t * (ans / u);
    }
    
    System.out.println(ans);
  }
  
  public static long gcd(long a, long b) {
    if(b == 0) return a;
    return gcd(b, a % b);
  }
}

Compiler output:
Main.java:8: error: cannot find symbol
    for(int i = 0; i < N; i++) {
                       ^
  symbol:   variable N
  location: class Main
1 error
Language: C++

#include <iostream>
using namespace std;

long long int a[110];

int main () {

int n;
cin>>n;
long long int maxi=0;
for (int i=0; i<n; i++) {
	cin>>a[i];
	if (a[i]>maxi) {maxi=a[i];}
}
long long int p=maxi;
while (0==0) {
	int br=0;
	for (int i=0; i<n; i++) {
		if (maxi%a[i]==0) {br++;}
		else {break;}
	}
	if (br==n) {cout<<maxi; return 0;}
	maxi=maxi+p;
}

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

//code by 27.
#include<stdio.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
#include<stack>
#include<fstream>
#include<stdlib.h>
#include<set>
#include<cassert>
#include<climits>
#include<cmath>
#include<memory.h>
#include<conio.h>
#include<windows.h>
#include<ctime>
using namespace std;
long long gcd(long long a,long long b)
{
	long long t1=a;
	long long t2=b;
	while(t1!=0)
	{
		if(t1<t2)swap(t1,t2);
		t1=t1%t2;
	}
	return t2;
}
int main()
{
	int n;
	cin>>n;
	long long s;
	cin>>s;
	long long t;
	for(int i=2;i<=n;i++)
	{
		cin>>t;
		s=s/gcd(s,t)*t;
	}
	cout<<s;
    return 0;
}

Compiler output:
a.cc:19:9: fatal error: conio.h: No such file or directory
   19 | #include<conio.h>
      |         ^~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
struct edge{long long to, cost;};
typedef pair<long long,long long > P;
struct graph{
  long long V;
  vector<vector<edge> > G;
  vector<long long> d;
  graph(long long n){
    init(n);
  }
  void init(long long n){
    V = n;
    G.resize(V);
    d.resize(V);
    for(int i=1;i<V;i++){
      d[i] = INF;
    }
  }
  void add_edge(long long s, long long t,long long cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }
  void dijkstra(long long s){
    for(int i=1;i<V;i++){
      d[i] = INF;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      long long v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};
int main(){
  int N;cin>>N;
  graph g(N);
  vector<int>A(N-1);
  vector<int>B(N-1);
  vector<int>C(N-1);
  for(int i=0;i<N-1;i++){
    cin>>A[i]>>B[i]>>C[i];
    g.add_edge(A[i]-1,B[i]-1,C[i]);
  }
  int Q,K;cin>>Q>>K;
  g.dijkstra(K);
  vector<int>x(Q);
  vector<int>y(Q);
  long long ans=0;
  for(int i=0;i<Q;i++){
    cin>>x[i]>>y[i];
    ans+=g.d[x[i]-1]+g.d[y[i]-1];
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In member function 'void graph::init(long long int)':
a.cc:17:14: error: 'INF' was not declared in this scope
   17 |       d[i] = INF;
      |              ^~~
a.cc: In member function 'void graph::dijkstra(long long int)':
a.cc:27:14: error: 'INF' was not declared in this scope
   27 |       d[i] = INF;
      |              ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
struct edge{long long to, cost;};
typedef pair<long long,long long > P;
struct graph{
  long long V;
  vector<vector<edge> > G;
  vector<long long> d;
  graph(long long n){
    init(n);
  }
  void init(long long n){
    V = n;
    G.resize(V);
    d.resize(V);
    REP(i,V){
      d[i] = INF;
    }
  }
  void add_edge(long long s, long long t,long long cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }
  void dijkstra(long long s){
    REP(i,V){
      d[i] = INF;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      ll v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};
int main(){
  int N;cin>>N;
  graph g(N);
  vector<int>A(N-1);
  vector<int>B(N-1);
  vector<int>C(N-1);
  for(int i=0;i<N-1;i++){
    cin>>A[i]>>B[i]>>C[i];
    g.add_edge(A[i]-1,B[i]-1,C[i]);
  }
  int Q,K;cin>>Q>>K;
  g.dijkstra(K);
  vector<int>x(Q);
  vector<int>y(Q);
  long long ans=0;
  for(int i=0;i<Q;i++){
    cin>>x[i]>>y[i];
    ans+=g.d[x[i]-1]+g.d[y[i]-1];
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In member function 'void graph::init(long long int)':
a.cc:16:9: error: 'i' was not declared in this scope
   16 |     REP(i,V){
      |         ^
a.cc:16:5: error: 'REP' was not declared in this scope
   16 |     REP(i,V){
      |     ^~~
a.cc: In member function 'void graph::dijkstra(long long int)':
a.cc:26:9: error: 'i' was not declared in this scope
   26 |     REP(i,V){
      |         ^
a.cc:26:5: error: 'REP' was not declared in this scope
   26 |     REP(i,V){
      |     ^~~
a.cc:34:7: error: 'll' was not declared in this scope
   34 |       ll v = p.second;
      |       ^~
a.cc:35:12: error: 'v' was not declared in this scope
   35 |       if(d[v]<p.first) continue;
      |            ^
a.cc:36:22: error: 'v' was not declared in this scope
   36 |       for(auto e : G[v]){
      |                      ^
Language: C++

#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
#include<bitset>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define pb(b) push_back(b) 
#define all(a) a.begin(),a.end()
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define llpvec vector<pair<ll,ll>>
#define size_(a,b) (a,vector<ll>(b))
#define S 21
llfor;////////////////////////////////////////////////////////////
vector<vector<pair<ll,ll>>>path;
vector<ll>dis;
void dfs(ll a){ 
 for(i,0,path[a].size()){
  if(dis[path[a][i].first]!=1e18)continue;
  dis[path[a][i].first]=dis[a]+path[a][i].second;
  //cout<<a<<" "<<path[a][i].first<<" "<<dis[path[a][i].first]<<endl;
  dfs(path[a][i].first);
 }
}

int main(){
 ll n;
 cin>>n;
 ll a,b,c;
 path.resize(n);
 dis.resize(n,1e18);
 rep(i,0,n-1){
  cin>>a>>b>>c;
  a--;b--;
  path[a].pb(make_pair(b,c));
  path[b].pb(make_pair(a,c));
 }
 ll q,k;
 cin>>q>>k;
 k--;
 dis[k]=0;
 dfs(k);

 //pnn;rep(i,0,n)cout<<i<<" "<<dis[i]<<endl;pnn;
 rep(i,0,q){
  cin>>a>>b;
  a--;b--;
  ll ans=dis[a]+dis[b];
  pr(ans);
 }
return 0;}

Compiler output:
a.cc: In function 'void dfs(long long int)':
a.cc:46:24: error: expected ';' before ')' token
   46 |  for(i,0,path[a].size()){
      |                        ^
      |                        ;
a.cc:46:22: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   46 |  for(i,0,path[a].size()){
      |          ~~~~~~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:992:7: note: declared here
  992 |       size() const _GLIBCXX_NOEXCEPT
      |       ^~~~
a.cc:52:1: error: expected primary-expression before '}' token
   52 | }
      | ^
a.cc:51:3: error: expected ';' before '}' token
   51 |  }
      |   ^
      |   ;
   52 | }
      | ~  
a.cc:52:1: error: expected primary-expression before '}' token
   52 | }
      | ^
a.cc:51:3: error: expected ')' before '}' token
   51 |  }
      |   ^
      |   )
   52 | }
      | ~  
a.cc:46:5: note: to match this '('
   46 |  for(i,0,path[a].size()){
      |     ^
a.cc:52:1: error: expected primary-expression before '}' token
   52 | }
      | ^
Language: C++


#include <bits/stdc++.h>  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
using namespace std;
typedef long long ll;
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 


void dfs(ll cur,ll d, vector<vector<pair<ll,ll>>> &adj, vector<ll> &distances){
  distances[cur] =d;
  for(auto p:adj[cur])
  	if(!distances[p.first])
      dfs(p.first,d+p.second,adj,distances);
  
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  ll n;
  vector<vector<pair<ll,ll>>> adj(n+1);
  for(ll i=0;i<n-1;i++){
  	ll a,b,c;
    cin>>x>>y>>w;
    adj[x].push_back({y,w});
    adj[y].push_back({x,w});
  }
  ll q,k;
  cin>>q>>k;
  vector<ll> distances(n+1);
  distances[k]=-1;
  for(ll i=0;i<q;i++){
  	ll x,y;
    cin>>a>>b;
    cout<<distances[a]+distances[b]<<endl;
  }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:10: error: 'x' was not declared in this scope
   25 |     cin>>x>>y>>w;
      |          ^
a.cc:25:13: error: 'y' was not declared in this scope
   25 |     cin>>x>>y>>w;
      |             ^
a.cc:25:16: error: 'w' was not declared in this scope
   25 |     cin>>x>>y>>w;
      |                ^
a.cc:35:10: error: 'a' was not declared in this scope
   35 |     cin>>a>>b;
      |          ^
a.cc:35:13: error: 'b' was not declared in this scope
   35 |     cin>>a>>b;
      |             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long N;
long long a, b;
long long c;
long long tree[10005][10005];
long long dist[100005];
int main(){
    cin>>N;
    for(long long i=0; i<N-1; i++){
        cin>>a>>b>>c;
        a--;b--;
        tree[a][b] = c;
        tree[b][a] = c;
        dist[i] = -1;
    }

     for(long long i=0; i<=N; i++){
        dist[i] = -1;
    }

    long long Q,K;
	cin>>Q>>K;
    K--;
    dist[K] = 0;
    queue<long long> que;

    que.push(K);
    while(!que.empty()){
        long long v;
		v = que.front(); que.pop();
		for(long long i=0;i<N;i++){
			if(tree[v][i]  && dist[i]<0) {
			    que.push(i);
                dist[i] = dist[v] + tree[v][i];
			}
		}
    }
    for(long longi = 0; i < Q; i++){
        long longx, y;
        cin >> x >> y;
        x--;y--;
        cout << dist[x]+dist[y] << endl;
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:25: error: 'i' was not declared in this scope
   39 |     for(long longi = 0; i < Q; i++){
      |                         ^
a.cc:41:16: error: 'x' was not declared in this scope
   41 |         cin >> x >> y;
      |                ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int N;
int a, b;
long long c;
long long tree[10005][10005];
long long dist[100005];
int main(){
    cin>>N;
    for(int i=0; i<N-1; i++){
        cin>>a>>b>>c;
        a--;b--;
        tree[a][b] = c;
        tree[b][a] = c;
        dist[i] = -1;
    }

     for(int i=1; i<=N; i++){
        dist[i] = -1;
    }

    int Q,K;
	cin>>Q>>K;
    K--;
    dist[K] = 0;
    queue<int> que;

    que.push(K);cout<<"------------------------1"<<endl;
    while(!que.empty()){
        int v;
		v = que.front(); que.pop();
		for(int i=0;i<N;i++){
			if(tree[v][i]  && dist[i]<0) {
			    que.push(i);
                dist[i] = dist[v] + tree[v][i];
			}
		}
		cout<<endl;
    }
    long long ans;
    for(long long i = 0; i < Q; i++){
        int x, y; cin >> x >> y;
        x--;y--;
        cout <<<< dist[x]+dist[y] << endl;
    }

}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:16: error: expected primary-expression before '<<' token
   44 |         cout <<<< dist[x]+dist[y] << endl;
      |                ^~