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

#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;

typedef struct tree_st{
  int counter;
  int num;
  int next[1000];
} Tree;

void culc(int p, int x,Tree* tree){
  tree[p].counter += x;
  for(int i = 0;i < tree[p].num;i++){
    culc(tree[p].next[i],x,tree);
  }
}

int main(void){
  int N,Q;
  int a,b;
  int p,x;
  cin >> N >> Q;
  Tree *tree = (Tree*)malloc(sizeof(Tree)*(N+1));
  int *t = (int*)malloc(sizeof(int)*N);
  for(int i = 0;i < N+1;i++){
    tree[i].counter = 0;
    tree[i].num = 0;
  }
  for(int i = 0;i < N-1;i++){
    cin >> a >> b;
    tree[a].next[tree[a].num] = b;
    tree[a].num++;
  }
  for(int i = 0;i < Q;i++){
    t[i] = 0;
  }
  for(int i = 0;i < Q;i++){
    cin >> p >> x;
    t[p-1] += x;
  }
  for(int i = 0;i < Q;i++){
    if(t[i]!=0){
      calc(i+1,t[i],tree);
    }
  }
  for(int i = 0;i < N;i++){
    cout << tree[i+1].counter;
    if(i != N-1){
      cout << " ";
    }
  }
  cout << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:7: error: 'calc' was not declared in this scope; did you mean 'culc'?
   44 |       calc(i+1,t[i],tree);
      |       ^~~~
      |       culc
Language: C++

#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>

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

int main(){
	int n = 1;
	int q = 1;
	int a, b;
	cin >> n >> q;

	vector<int> arr[n-1];
	for (int i = 0; i < n-1; i++) {
		cin >> a >> b;
		arr[a-1].push_back(b);
	}

	mp::cpp_int score[n];
	mp::cpp_int sum[n];
	for (int i = 0; i < n; i++) {
		score[i] = 0;
		sum[i] = 0;
	}
	for (int i = 0; i < q; i++) {
		cin >> a >> b;
		sum[a-1] += b;
		score[a-1] += b;
	}
	for (int i = 0; i < n-1; i++) {
		int size = arr[i].size();
		for (int j = 0; j < size; j++) {
			sum[arr[i][j]-1] += sum[i];
			score[arr[i][j]-1] += sum[i];
		}
	}
	cout << score[0];
	for (int i = 1; i < n; i++) {
		cout << " " << score[i];
	}
	return 0;
}

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

n,q=input().split()
n=int(n)
q=int(q)
l=[[] for i in range(n)]
def count(p,x,l,counter):
    counter[p-1]+=x
    for i in l[p-1]:
        counter[i-1]+=x
        if l[i-1]:
            count2(i,x,l,counter)
def count2(p,x,l,counter):
    for i in l[p-1]:
        counter[i-1]+=x
        if l[i-1]:
            count2(i,x,l,counter)
for i in range(n-1):
    a,b=input().split()
    a=int(a)
    b=int(b)
    l[a-1].append(b)
counter=[0 for i in range(n)]
for i in range(q):
    p,x=input().split()
    p=int(p)
    x=int(x)
    count(p,x,l,counter)
for i in counter:
    print(i,end=" ")
print()



Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,q=input().split()
      | ^
Language: C++

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

void SHORISHORI(int &root, int &value, vector<int> &counter, vector<vector<int> > &wood) {
    counter.at(root) += value;
    for (auto &x: wood.at(root)) {
        SHORISHORI(x, value, counter, wood);
    }
    return;
}

int main() {
    int n, q;
    scanf("%d %d", &n, &q);
    vector<int> counter(n, 0);
    vector<vector<int> > wood(n);
    rep(i,n-1) {
        int c, cc;
        scanf("%d %d", &c, &cc);
        wood.at(c-1).push_back(cc-1);
    }
    rep(i,q) {
        int c, v;
        scanf("%d %d", &c, &v);
        SHORISHORI(c-1, v, counter, wood);
    }
    rep(i,n-1) printf("%d ", counter.at(i));
    printf("%d\n", counter.at(n-1));
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:21: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   27 |         SHORISHORI(c-1, v, counter, wood);
      |                    ~^~
a.cc:6:22: note:   initializing argument 1 of 'void SHORISHORI(int&, int&, std::vector<int>&, std::vector<std::vector<int> >&)'
    6 | void SHORISHORI(int &root, int &value, vector<int> &counter, vector<vector<int> > &wood) {
      |                 ~~~~~^~~~
Language: C++

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
using namespace std;
using namespace __gnu_pbds;

// types - only for stuff used a lot 
using ll = long long;
using pll = pair<ll,ll>;
using ordered_set = tree<
	pll,
	null_type,
	less<pll>,
	rb_tree_tag,
	tree_order_statistics_node_update>;
// insert, find_by_order, and order_of_key
#define vv vector
#define Pp pair

// IO
#define get(x) scanf("%d",&x)
#define getl(x) scanf("%lld",&x);

// Operations
#define pb push_back
#define pob pop_back
#define sz(a) int(a.size()) 
#define re(a,b) a=max(a,b) // relax
#define ri(a,b) a=min(a,b) // relaxi

// Debugging

#ifndef LOCAL
#define cerr if (0) cerr
#else
#define cerr cout
#endif

#define print(arr,n) {for (int _ = 0; _ < n; _++) cerr<<arr[_]<<" "; cerr << endl; }
#define printv(vec)  {for (int _ : vec) cerr<<_<<" "; cerr<<endl;}

const int mod = 1e9+7, oo = 1e9;
const ll loo = 1e18;

// Functions 
ll modpow(ll a, ll b) {
	ll ans = 1; // faster modpow than recursive
	for (; b; b/=2,a=a*a%mod)
		if (b&1) ans = (ans*a)%mod;
	return ans;
}
ll gcd(ll a, ll b) {
	while (a) b%=a,swap(a,b);
	return b;
}
#define bitcount __builtin_popcountll
#define f(i,a,b) for (int i = a; i < b; i++)
#define fr(i,a,b) for (int i = b-1; i >= a; i--)


/* 

   ALRIGHT HACKERS, THIS IS WHERE THE ACTUAL CODE BEGINS
   Time to get demoted :)

 */

const bool DEBUG = 1;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	if (DEBUG) freopen("input.txt", "r", stdin);
	if (DEBUG) freopen("output.txt", "w", stdout);
	clock_t start = clock();
#endif
	
  	int N,Q; cin>>N>>Q;
  	int val[N];
  	fill(val,val+N,0);
  	vi adj[N];
  	f(i,0,N-1) {
		int a,b; cin>>a>>b;
      	adj[--a].pb(--b);
      	adj[b].pb(a);
    }
  	f(q,0,Q) {
    	int v,x; cin>>v>>x;
      	val[--v] += x;
    }
  	auto dfs = [&](int v, int p) {
      	if (p != -1) val[v] += val[p];
      	for (int w : adj[v]) if (w != p)
        	dfs(w,v);
    };
  	dfs(0);
  	f(i,0,N) cout << val[i] << " \n"[i == N-1];

#ifdef LOCAL
	cout << setprecision(12) << (long double)(clock()-start) / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:82:9: error: 'vi' was not declared in this scope; did you mean 'vv'?
   82 |         vi adj[N];
      |         ^~
      |         vv
a.cc:85:9: error: 'adj' was not declared in this scope
   85 |         adj[--a].pb(--b);
      |         ^~~
a.cc: In lambda function:
a.cc:94:22: error: 'adj' was not declared in this scope
   94 |         for (int w : adj[v]) if (w != p)
      |                      ^~~
a.cc:95:17: error: use of 'dfs' before deduction of 'auto'
   95 |                 dfs(w,v);
      |                 ^~~
a.cc: In function 'int main()':
a.cc:97:12: error: no match for call to '(main()::<lambda(int, int)>) (int)'
   97 |         dfs(0);
      |         ~~~^~~
a.cc:92:20: note: candidate: 'main()::<lambda(int, int)>'
   92 |         auto dfs = [&](int v, int p) {
      |                    ^
a.cc:92:20: note:   candidate expects 2 arguments, 1 provided
Language: C

#include<stdio.h>
int box[200000][200000];
int sum[200000];
void plu(int a,int b){
  int x=0;
  sum[a]+=b;
  while(box[a][x]){
    plu(box[a][x],b);
    x++;
  }
}
int main(void){
  int i,n,q,a,b,x;
  scanf("%d%d",&n,&q);
  for(i=1;i<n;i++){
    scanf("%d%d",&a,&b);
    x=0;
    while(box[a][x]){
      x++;
    }
    box[a][x]=b;
  }
  for(i=0;i<q;i++){
    scanf("%d%d",&a,&b);
    plu(a,b);

  }
  x=0;
  while(sum[x]){
    printf("%d",sum[x]);
    if(sum[++x]){
      printf(" ");
    }
  }
  printf("\n");
  return(0);
}


Compiler output:
/tmp/ccMoj56D.o: in function `plu':
main.c:(.text+0x25): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccMoj56D.o
main.c:(.text+0x42): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccMoj56D.o
/tmp/ccMoj56D.o: in function `main':
main.c:(.text+0x1d2): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccMoj56D.o
main.c:(.text+0x203): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccMoj56D.o
main.c:(.text+0x228): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/ccMoj56D.o
collect2: error: ld returned 1 exit status
Language: C++

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

int main() {
	int n, qe;
	cin>>n>>qe;
	vector<vector<int>> a(n);
	for (int i = 0; i < n-1; i++) {
		int s, e;
		cin>>s>>e;
		a[s-1].push_back(e-1);
		a[e-1].push_back(s-1);
	}
	vector<long long int> c(n);
	for (int i = 0; i < qe; i++) {
		int ve, va;
		cin>>ve>>va;
		c[ve-1] += va;
	}
	vector<long long int> an(n);
	queue<pair<int, long long int>> q;
	vector<int> v(n, 0);
	q.push({0, c[0]});
	v[0] = 1;
	while (!q.empty()) {
		pair<int, long long int> pa = q.front();
		q.pop();
		int x = pa.first;
		long long int y = pa.second;
		an[x] = y;
		for (int i = 0; i < a[x].size(); i++) {
			if (v[a[x][i]] == 0) {
				v[a[x][i]] = 1;
				q.push({a[x][i], c[a[x][i]] + y});
			}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:26: error: expected '}' at end of input
   35 |                         }
      |                          ^
a.cc:31:55: note: to match this '{'
   31 |                 for (int i = 0; i < a[x].size(); i++) {
      |                                                       ^
a.cc:35:26: error: expected '}' at end of input
   35 |                         }
      |                          ^
a.cc:25:28: note: to match this '{'
   25 |         while (!q.empty()) {
      |                            ^
a.cc:35:26: error: expected '}' at end of input
   35 |                         }
      |                          ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <vector>

#define MAX 200001

bool is_visited[MAX];
std::vector<std::vector<int>> relation;

// clear log of visiting of N points existed
void clear(int N){
	for(int i = 1; i <= N; ++i) is_visited[i] = false;
}

// root : start point
// i : now visit
void DFSUtil(int root, int i, const std::vector<std::vector<int>>& path){
	if(is_visited[i]) return;
  
  	is_visited[i] = true;
  	if(i != root) relation[root].push_back(i);
  	for(int j = 0; j < path[i].size(); ++j){
    	DFSUtil(root, path[i][j]);
    }
  
  	return ;
}

void findRelations(int N, const std::vector<std::vector<int>>& path){
	relation.resize(N+1);
  	for(int i = 1; i <= N; ++i){
    	DFSUtil(i, i, path);
    }
  	return ;
}

int main(void){
	int N, Q;
  	std::cin >> N >> Q;
  	
  	std::vector<std::vector<int>> path(N+1);
  	int a, b;
  	// path initialization
  	for(int i = 1; i < N; ++i){
    	std::cin >> a >> b;
      	path[a].push_back(b);
      	path[b].push_back(a);
    }
  
  	// realation initialization
  	findRelations(N, path);
  
  	std::vector<int> count(N+1, 0);
  	int p, x;
  	for(int i = 0; i < Q; ++i){
    	std::cin >> p >> x;
      	for(int j = 0; j < relation[p].size(); ++j){
        	count[relation[p][j]] += x;	
        }
    }
  
  	for(int i = 1; i <= N; ++i){
    	std::cout << count[i] << " ";
    }
  
  	return 0;
}


Compiler output:
a.cc: In function 'void DFSUtil(int, int, const std::vector<std::vector<int> >&)':
a.cc:22:16: error: too few arguments to function 'void DFSUtil(int, int, const std::vector<std::vector<int> >&)'
   22 |         DFSUtil(root, path[i][j]);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~
a.cc:16:6: note: declared here
   16 | void DFSUtil(int root, int i, const std::vector<std::vector<int>>& path){
      |      ^~~~~~~
Language: C++

#include <iostream>
#include <vector>

#define MAX 200001

bool is_visited[MAX];
std::vector<std::vector<int>> relation;

// clear log of visiting of N points existed
void clear(int N){
	for(int i = 1; i <= N; ++i) is_visited[i] = false;
}

// root : start point
// i : now visit
void DFSUtil(int root, int i, const std::vector<std::vector<int>>& path){
	if(is_visited[i]) return;
  
  	is_visited[i] = true;
  	if(i != root) realtion[root].push_back(i);
  	for(int j = 0; j < path[i].size(); ++j){
    	DFS(root, path[i][j]);
    }
  
  	return ;
}

void findRelations(int N, const std::vector<std::vector<int>>& path){
	relation.resize(N+1);
  	for(int i = 1; i <= N; ++i){
    	DFSUtil(i, i, path);
    }
  	return ;
}

int main(void){
	int N, Q;
  	std::cin >> N >> Q;
  	
  	std::vector<std::vector<int>> path(N+1);
  	int a, b;
  	// path initialization
  	for(int i = 1; i < N; ++i){
    	std::cin >> a >> b;
      	path[a].push_back(b);
      	path[b].push_back(a);
    }
  
  	// realation initialization
  	findRelations(N, path);
  
  	std::vector<int> count(N+1, 0);
  	int p, x;
  	for(int i = 0; i < Q; ++i){
    	std::cin >> p >> x;
      	for(int j = 0; j < relation[p].size(); ++j){
        	count[relation[p][j]] += x;	
        }
    }
  
  	for(int i = 1; i <= N; ++i){
    	std::cout << count[i] << " ";
    }
  
  	return 0;
}

Compiler output:
a.cc: In function 'void DFSUtil(int, int, const std::vector<std::vector<int> >&)':
a.cc:20:23: error: 'realtion' was not declared in this scope; did you mean 'relation'?
   20 |         if(i != root) realtion[root].push_back(i);
      |                       ^~~~~~~~
      |                       relation
a.cc:22:9: error: 'DFS' was not declared in this scope
   22 |         DFS(root, path[i][j]);
      |         ^~~
Language: C++

#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>

int solve(std::vector<std::vector<long long int> > &G, std::vector<long long int> &counter, std::vector<long long int> counted, long long int index, long long int carryover);

int main(){
  long long int N, Q;
  scanf("%lld%lld", &N, &Q);
  
  std::vector<std::vector<long long int> > G(N);
  long long int tmp1, tmp2;
  for(int i = 0; i < N-1; i++){
    scanf("%lld%lld", &tmp1, &tmp2);
    G[tmp1-1].push_back(tmp2-1);
    G[tmp2-1].push_back(tmp1-1);
  }
  
  std::vector<long long int> counter, counted;
  for(int i = 0; i < N; i++){
    counter.push_back(0);
    counted.push_back(0);
  }
  
  for(int i = 0; i < Q; i++){
    scanf("%lld%lld", &tmp1, &tmp2);
    counter[tmp1-1] += tmp2;
  }
  
  solve(G, counter, counted, 0, 0);
  
  for(int i = 0; i < N; i++){
    std::cout << counter[i] << " ";
  }
  std::cerr << std::endl;
  
  return 0;
}

int solve(std::vector<std::vector<long long int> > &G, std::vector<long long int> &counter, std::vector<long long int> &counted, long long int index, long long int carryover){
  
  // update the given point
  counter[index] += carryover;
  counted[index] = 1;
  
  // update the child nodes
  long long int n = G[index].size();
  for(long long int i = 0; i < n; i++){
    if(counted[G[index][i]] == 0){
      solve(G, counter, counted, G[index][i], counter[index]);
    }
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int solve(std::vector<std::vector<long long int> >&, std::vector<long long int>&, std::vector<long long int>&, long long int, long long int)':
a.cc:53:12: error: call of overloaded 'solve(std::vector<std::vector<long long int> >&, std::vector<long long int>&, std::vector<long long int>&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&, __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)' is ambiguous
   53 |       solve(G, counter, counted, G[index][i], counter[index]);
      |       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:8:5: note: candidate: 'int solve(std::vector<std::vector<long long int> >&, std::vector<long long int>&, std::vector<long long int>, long long int, long long int)'
    8 | int solve(std::vector<std::vector<long long int> > &G, std::vector<long long int> &counter, std::vector<long long int> counted, long long int index, long long int carryover);
      |     ^~~~~
a.cc:43:5: note: candidate: 'int solve(std::vector<std::vector<long long int> >&, std::vector<long long int>&, std::vector<long long int>&, long long int, long long int)'
   43 | int solve(std::vector<std::vector<long long int> > &G, std::vector<long long int> &counter, std::vector<long long int> &counted, long long int index, long long int carryover){
      |     ^~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,q;
int ver[200005],next[200005],head[200005];
int w[200005],l[200005],c[200005];
int x,y;
void dfs(int s) {
	for(int i=head[s];i;i=next[i]) {
		l[ver[i]]+=l[s];
		dfs(ver[i]);
	}
	//cout<<s<<" "<<l[s]<<endl;
}
int main() {
	cin>>n>>q;
	for(int i=1;i<n;i++) {
		scanf("%d%d",&x,&y);
		ver[i]=y;
		next[i]=head[x];
		head[x]=i;
	}
	for(int i=1;i<=q;i++) {
		scanf("%d%d",&w[i],&c[i]);
		l[w[i]]+=c[i];
	}
	dfs(1);
	for(int i=1;i<=n;i++) cout<<l[i]<<" ";
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:8:31: error: reference to 'next' is ambiguous
    8 |         for(int i=head[s];i;i=next[i]) {
      |                               ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:4:17: note:                 'int next [200005]'
    4 | int ver[200005],next[200005],head[200005];
      |                 ^~~~
a.cc: In function 'int main()':
a.cc:19:17: error: reference to 'next' is ambiguous
   19 |                 next[i]=head[x];
      |                 ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:4:17: note:                 'int next [200005]'
    4 | int ver[200005],next[200005],head[200005];
      |                 ^~~~
Language: C++

#include <bits/stdc++.h>
#include "Local_Debug.h"
using namespace std;
#define Endl endl
typedef long long ll;
const int MAXN = (int)2e5 + 5;
ll n, q, u, v, p, x, a[MAXN];
vector<ll> g[MAXN];
void dfs(ll idx, ll val)
{
	a[idx] += val;
	for (auto i : g[idx])
		if (i > idx)
			dfs(i, val);
}
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	while (cin >> n >> q)
	{
		for (ll i = 1; i <= n; ++i)
			vector<ll>().swap(g[i]), a[i] = 0;
		for (ll i = 2; i <= n&&cin >> u >> v; ++i)
			g[u].emplace_back(v), g[v].emplace_back(u);
		while (q--&&cin >> p >> x)
			dfs(p, x);
		for (ll i = 1; i <= n; ++i)
			cout << a[i] << ' ';
		cout << endl;
	}
}
/*
4 3
1 2
2 3
2 4
2 10
1 100
3 1

6 2
1 2
1 3
2 4
3 6
2 5
1 10
1 10
*/

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

int n,q;
vector<vector<int>> g(200000);
vector<int> cnt(200000,0);

void bfs(int p, int x){
    cnt[p]+=x;
    for(auto v:g[p]){
        bfs(v,x);
    }
}

int main(){
    cin>>n >>q;
    g.resize(n);
    cnt.resize(n);
    //グラフ作成
    for(int i=0;i<n-1;i++){
        int a,b;
        cin>>a >>b;
        a--; b--;
        g[a].push_back(b);
    }
    //q回操作を行う
    for(int i=0;i<q;i++){
        int p,x;
        cin>>p >>x;
        p--;
        bfs(p,x);
    }
    for(int i=0;i<n;i++){
        cout<<cnt[i];
        if(i!=n-1)cout<<" ";
    }
    cout<<endl;
    return 0;
}

Compiler output:
a.cc:2:1: error: 'vector' does not name a type
    2 | vector<vector<int>> g(200000);
      | ^~~~~~
a.cc:3:1: error: 'vector' does not name a type
    3 | vector<int> cnt(200000,0);
      | ^~~~~~
a.cc: In function 'void bfs(int, int)':
a.cc:6:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
    6 |     cnt[p]+=x;
      |     ^~~
      |     int
a.cc:7:16: error: 'g' was not declared in this scope
    7 |     for(auto v:g[p]){
      |                ^
a.cc: In function 'int main()':
a.cc:13:5: error: 'cin' was not declared in this scope
   13 |     cin>>n >>q;
      |     ^~~
a.cc:14:5: error: 'g' was not declared in this scope
   14 |     g.resize(n);
      |     ^
a.cc:15:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
   15 |     cnt.resize(n);
      |     ^~~
      |     int
a.cc:31:9: error: 'cout' was not declared in this scope
   31 |         cout<<cnt[i];
      |         ^~~~
a.cc:34:5: error: 'cout' was not declared in this scope
   34 |     cout<<endl;
      |     ^~~~
a.cc:34:11: error: 'endl' was not declared in this scope
   34 |     cout<<endl;
      |           ^~~~
Language: Java

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Queue;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt(), Q = scn.nextInt();
		GraphWay[] GW = new GraphWay[N];
		int[] C = new int[N];

		for(int i = 0;i < N;i++) {
			GW[i] = new GraphWay();
		}
		for(int i = 0;i < N-1;i++) {
			int a = scn.nextInt()-1, b = scn.nextInt()-1;
			GW[a].add(b);
		}
		for(int i = 0;i < Q;i++) {
			int p = scn.nextInt()-1, c = scn.nextInt();
			C[p] +=c;
		}
		int[] ans = new int[N];
		Queue<Pair> DQ = new ArrayDeque<Pair>();
		DQ.add(new Pair(0,0));
		while(!DQ.isEmpty()) {
			Pair p = DQ.poll();
			int n = p.first;
			int v = p.second + C[n];
			ans[n] += v;
			for(int next:GW[n].getItr()) {
				DQ.add(new Pair(next,v));
			}
		}
		Printer.printArrayLine(ans);

	}

}
class Printer{
	static void printArrayLine(int[] a) {
		int N = a.length;
		for(int i = 0;i < N;i++) {
			System.out.print(a[i] + ((i==N-1)?"\n":" "));
		}
	}

	static void printMatrix(int[][] a) {
		int N = a.length;
		int M = a[0].length;
		for(int i = 0;i < N;i++) {
			printArrayLine(a[i]);
		}
	}
}

class GraphWay{//有向パス
	ArrayList<Integer> to;
	public GraphWay() {
		to = new ArrayList<Integer>();
	}

	void add(int t) {
		to.add(t);
	}

	Iterable<Integer> getItr() {
		return to;
	}
}

class Pair implements Comparable<Pair>{
	int first,second;
	public Pair(int f,int s) {
		this.first = f;
		this.second = s;
	}
	@Override
	public int compareTo(Pair o) {//Comparatorを自由記述せよ(これはfirstが小さい順, secondが小さい順)
		if(this.first < o.first) {
			return -1;
		}
		if(this.first > o.first) {
			return 1;
		}
		if(this.second < o.second) {
			return -1;
		}
		if(this.second > o.second) {
			return 1;
		}

		return 0;
	}


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

#include<stdio.h>
#include<vector>
#include<algorithm>
#include<iostream>
using namespace std;
const long long maxn=200000+10;

long long n,q;
vector<long long> a[maxn];
long long avl[maxn]={0},first[maxn],last[maxn],stack[maxn],cnt=0;
long long aa[maxn]={0};

void DFS(long long u){
  avl[u]=1;cnt++;stack[cnt]=u;first[u]=cnt;
  for(long long i=0;i<a[u].size();i++){
    long long v=a[u][i];
    if (avl[v]==0){
      DFS(v);
    }
  }
  last[u]=cnt;
}

long long main(){
//  freopen("input.txt","r",stdin);
  scanf("%lld%lld",&n,&q);
  for(long long i=1;i<n;i++){
    long long u,v;
    scanf("%lld%lld",&u,&v);
    a[u].push_back(v);
    a[v].push_back(u);
  }
  DFS(1);
//  for(long long i=1;i<=n;i++) cout<<stack[i]<<" ";cout<<endl;
//  for(long long i=1;i<=n;i++) cout<<first[i]<<" ";cout<<endl;
//  for(long long i=1;i<=n;i++) cout<<last[i]<<" ";cout<<endl;
  for(long long i=1;i<=q;i++){
    long long p,x;
    scanf("%lld%lld",&p,&x);
    aa[first[p]]+=x;
    aa[last[p]+1]-=x;
  }
  for(long long i=1;i<=n;i++) aa[i]+=aa[i-1];
  for(long long i=1;i<=n;i++) cout<<aa[i]<<" ";
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: Java


import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	static class Tree{
		List<Tree> children;
		long add;
		public Tree() {
			children = new ArrayList<D.Tree>();
		}
		void propagate(){
			for(Tree child : children){
				child.add += add;
				child.propagate();
			}
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Q = sc.nextInt();
		Tree nodes[] = new Tree[N];		
		for(int i = 0 ; i < N - 1 ; ++i){
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			if(nodes[a] == null){
				nodes[a] = new Tree();
			}
			if(nodes[b] == null){
				nodes[b] = new Tree();
			}
			nodes[a].children.add(nodes[b]);
		}
		for(int i = 0 ; i < Q ; ++i){
			int p = sc.nextInt() - 1;
			int x = sc.nextInt();
			nodes[p].add += x;
		}
		nodes[0].propagate();
		
		for(int i = 0 ; i < N ; ++i){
			if(i > 0){
				System.out.print(" ");
			}
			System.out.print(nodes[i].add);
		}
		System.out.println();
	}
}


Compiler output:
Main.java:12: error: package D does not exist
			children = new ArrayList<D.Tree>();
			                          ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define fi first
#define endl "\n"
#define se second
#define ll long long
const int N = 200030;
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
const ll mod =    1e9+7;
int n,q;
vector<int> g[N];
int arr[N];
bool b[N];
dfs(int x,int ind)
{
arr[ind]+=x;
x=arr[ind];
b[ind]=true;
for(int i=0;i<g[ind].size();i++)
{
	if(!b[g[ind][i]])
	{
		dfs(x,g[ind][i]);
	}
}
}
int main()
{ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n>>q;
rep(i,0,n-1)
{
	int x,y;
	cin>>x>>y;
	g[x].push_back(y);
	g[y].push_back(x);
	
	
}
rep(i,0,q)
{
	int x,y;
	cin>>x>>y;
	arr[x]+=y;
}
dfs(0,1);
rep(i,1,n+1)
cout<<arr[i]<<" ";
}

Compiler output:
a.cc:14:1: error: ISO C++ forbids declaration of 'dfs' with no type [-fpermissive]
   14 | dfs(int x,int ind)
      | ^~~
a.cc: In function 'int dfs(int, int)':
a.cc:26:1: warning: no return statement in function returning non-void [-Wreturn-type]
   26 | }
      | ^
Language: C++

#include <iostream>
#include<bits/stdc++.h>
#define  ll long long
 using namespace std;
vector<ll>q[200003];
ll l[200003],r[200003];
ll ans;
void dfs(ll a,ll fa)
{ l[a]=++ans;
    for(ll i=0;i<q[a].size();i++)
    { ll ii=q[a][i];
        if(ii==fa)continue;
        dfs(ii,a);
    }
    r[a]=ans;
}
ll sum[200003];
int main()
{
    ll n,m;
    cin>>n>>m;
    for(ll i=1;i<n;i++)
    {
        ll a,b;
        cin>>a>>b;
        q[a].push_back(b);
        q[b].push_back(a);
    }
    dfs(1,0);
    while(m--)
    {
        ll a,b;
        cin>>a>>b;
        sum[l[a]]+=b;
        sum[r[a]+1]-=b;
    }
    for(ll i=1;i<=n;i++)
    {
        sum[i]+=sum[i-1];
        prllf(i==n?"%lld\n":"%lld ",sum[i]);
    }
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:40:9: error: 'prllf' was not declared in this scope
   40 |         prllf(i==n?"%lld\n":"%lld ",sum[i]);
      |         ^~~~~
Language: C++

//{{{
#include<algorithm>
#include<cmath>
#include<deque>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(printde) FUNC(printdbe) FUNC(printdwe) FUNC(printdu);
#endif
template <template <class T, class = std::allocator<T>> class V, class E>
istream& operator >> (istream& in, V<E>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

vector<int> cnts;
struct Graph{
    struct Node{
        vector<int> dests;
        int id;
        int l;
    };
    vector<Node> nodes;
    Graph(int num): nodes(num){ }
    int id(Node* n){ return n - &nodes[0]; }
    int id(Node& n){ return &n - &nodes[0]; }
    void print(){ for(auto& node : nodes){ prints(id(node), node.dests); } }
    void add1Edge(int from, int dest){
        nodes[from].dests.push_back(dest);
    }
    void add2Edge2(int from, int dest){
        add1Edge(from, dest);
        add1Edge(dest, from);
    }
    void dfs(int idx, int& cnt, int from = -1){
        nodes[idx].l = cnt;
        for(int didx : nodes[idx].dests){
            if(didx == from){ continue; }
            dfs(didx, cnt, idx);
        }
        nodes[idx].id = cnt;
        cnt++;
    }
};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n, q;
    cin >> n >> q;
    Graph g(n);
    cnts.resize(n + 1);
    for(int i = 0; i < n - 1; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        g.add2Edge2(a, b);
    }
    int cnt = 0;
    g.dfs(0, cnt);
    for(int i = 0; i < q; i++){
        int p, x;
        cin >> p >> x;
        p--;
        cnts[g.nodes[p].l] += x;
        cnts[g.nodes[p].id + 1] += -x;
    }
    printde(cnts);
    for(int i = 0; i < n; i++){
        cnts[i + 1] += cnts[i];
    }
    for(int i = 0; i < n; i++){
        cout << cnts[g.nodes[i].id] << ' ';
    }
}


Compiler output:
a.cc: In member function 'void Graph::print()':
a.cc:43:44: error: 'prints' was not declared in this scope; did you mean 'print'?
   43 |     void print(){ for(auto& node : nodes){ prints(id(node), node.dests); } }
      |                                            ^~~~~~
      |                                            print
Language: C++

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

int main() {
    string s, t;
    cin >> s >> t;
    int n = s.size(), m = t.size();
    vector<vector<int>> is(26);
    rep(i,n) is[s[i]-'a'].push_back(i);
    rep(i,n) is[s[i]-'a'].push_back(i+n);
    ll ans = 0;
    int p = 0;
    rep(i,m) {
        int c = t[i]-'a';
        int (is[c].size() == 0) {
            cout << -1 << endl;
            return 0;
        } 
        p = *lower_bound(is[c].begin(), is[c].end(), p) + 1;
        if (p >= n) {
            p -= n;
            ans += n;
        }
    } 
    ans += p;
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:32: error: expected ';' before '{' token
   19 |         int (is[c].size() == 0) {
      |                                ^~
      |                                ;
Language: C++

contest
son

10
==
contest
programming

-1
==
contest
sentence

33
==
a
a

1
==
a
aaa

3
==
aba
aa

3
==
abab
ababab

6
==
abcde
edcba

21
==
abcda
cacaa

11


Compiler output:
a.cc:1:1: error: 'contest' does not name a type; did you mean 'const'?
    1 | contest
      | ^~~~~~~
      | const
Language: C++

#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

int main(){
    string s,t; cin >> s >> t;
    ll n = sz(s), mm = sz(t);
    set<char> S, T;
    rep(i, 0, n){
        S.insert(s[i]);
    }
    rep(i, 0, mm){
        T.insert(t[i]);
    }
    bool b = true;
    for(auto x: T){
        if(S.find(x) == S.end()){
            b = false;
        }
    }
    if(!b){
        prtl(-1);
    }else{
        map<char, vll> m;
        rep(i, 0, n){
            if(m.find(s[i]) == m.end()){
                vll h(0);
                h.emplace_back(i);
                m[s[i]] = h;
            }else{
                m[s[i]].emplace_back(i);
            }
        }
        ll p = -1;
        ll c = 0;
        rep(i, 0, mm){
            char k = t[i];
            vll v = m[k];
            //if(upper_bound(v.begin(), v.end(), p) == v.end()){
                //p = v[0];
                //c++;
            //}else{
                //p = *upper_bound(v.begin(), v.end(), p);
            }
        }
        prtl(n*c+p+1);
    }   
}

Compiler output:
a.cc: In function 'int main()':
a.cc:71:16: error: 'c' was not declared in this scope
   71 |         prtl(n*c+p+1);
      |                ^
a.cc:8:26: note: in definition of macro 'prtl'
    8 | #define prtl(x) cout << (x) << endl
      |                          ^
a.cc:71:18: error: 'p' was not declared in this scope
   71 |         prtl(n*c+p+1);
      |                  ^
a.cc:8:26: note: in definition of macro 'prtl'
    8 | #define prtl(x) cout << (x) << endl
      |                          ^
a.cc: At global scope:
a.cc:73:1: error: expected declaration before '}' token
   73 | }
      | ^
Language: C++

#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define sz(x) ((ll)(x).size())
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define debug(v) cout << #v<< ": " << v <<endl;
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;

int main(){
    string s,t; cin >> s >> t;
    ll n = sz(s), mm = sz(t);
    set<char> S, T;
    rep(i, 0, n){
        S.insert(s[i]);
    }
    rep(i, 0, mm){
        T.insert(t[i]);
    }
    bool b = true;
    for(auto x: T){
        if(S.find(x) == S.end()){
            b = false;
        }
    }
    if(!b){
        prtl(-1);
    }else{
        map<char, vll> m;
        rep(i, 0, n){
            if(m.find(s[i]) == m.end()){
                vll h(0);
                h.emplace_back(i);
                m[s[i]] = h;
            }else{
                m[s[i]].emplace_back(i);
            }
        }
        ll p = -1;
        ll c = 0;
        rep(i, 0, mm){
            char k = t[i];
            vll v = m[k];
            //if(upper_bound(v.begin(), v.end(), p) == v.end()){
                //p = v[0];
                //c++;
            }else{
                //p = *upper_bound(v.begin(), v.end(), p);
            }
        }
        prtl(n*c+p+1);
    }   
}


Compiler output:
a.cc: In function 'int main()':
a.cc:67:14: error: 'else' without a previous 'if'
   67 |             }else{
      |              ^~~~
a.cc:71:16: error: 'c' was not declared in this scope
   71 |         prtl(n*c+p+1);
      |                ^
a.cc:8:26: note: in definition of macro 'prtl'
    8 | #define prtl(x) cout << (x) << endl
      |                          ^
a.cc:71:18: error: 'p' was not declared in this scope
   71 |         prtl(n*c+p+1);
      |                  ^
a.cc:8:26: note: in definition of macro 'prtl'
    8 | #define prtl(x) cout << (x) << endl
      |                          ^
a.cc: At global scope:
a.cc:73:1: error: expected declaration before '}' token
   73 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef std::function<bool (int64_t x)> FT;
int64_t f(int64_t i, int64_t e, const FT &g)
  {auto m = 0LL, t = e;
  while (llabs(i - e) > 1) {m = (i + e) / 2; if (g(m)) i = m; else e = m;}
  return g(i) ? i : t;}
int main()
  {string s, t; cin >> s >> t;
  map<char, vector<int>> m;
  for (int i = 0; i < s.size(); ++i) m[s[i]].push_back(i);
  auto i = 0LL, ans = 0LL;
  for (auto c: t)
    {auto is = m[c];
    if (is.empty()) {puts("-1"); return 0;}
    auto g = [&](int64_t x) {return i <= is[x];};
    auto j = f(is.size() - 1, -1, g);
    if (j == -1)
      {ans += s.size();
      i = 0; i = is[f(is.size() - 1, -1, g)] + 1;}
    else i = is[j] + 1;}
  ans += i; cout << ans << endl;}

Compiler output:
a.cc: In function 'int64_t f(int64_t, int64_t, const FT&)':
a.cc:5:4: error: inconsistent deduction for 'auto': 'long long int' and then 'long int'
    5 |   {auto m = 0LL, t = e;
      |    ^~~~
Language: C++

#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    string s, t; cin >> s >> t;

    map<char, vector<int>> cnt;
    for(int i=0; i<s.size(); i++){
        cnt[c].push_back(i);
    }

    for(char c : t){
        if(cnt[c].empty()){
            cout << -1 << endl;
            return 0;
        }
    }

    int p = 0, q = -1;
    for(char c : t){
        const auto& v = cnt[c];
        int a = upper_bound(v.begin(), v.end(), q) - v.begin();
        if(a != v.size()){
            q = v[a];
            continue;
        }
        p++;
        q = v[0];
    }

    cout << long(p) * s.size() + q + 1 << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: 'c' was not declared in this scope
   13 |         cnt[c].push_back(i);
      |             ^
Language: C++

#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
    string s, t; cin >> s >> t;

    map<char, vector<int>> cnt;
    for(int i=0; i<s.size(); i++){
        cnt[c].push_back(i);
    }

    for(char c : t){
        if(cnt[c].empty()){
            cout << -1 < ,endl;
            return 0;
        }
    }

    int p = 0, q = -1;
    for(char c : t){
        const auto& v = cnt[c];
        int a = upper_bound(v.begin(), v.end(), q) - v.begin();
        if(a != v.size()){
            q = v[a];
            continue;
        }
        p++;
        q = v[0];
    }

    cout << long(p) * s.size() + q + 1 << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:13: error: 'c' was not declared in this scope
   13 |         cnt[c].push_back(i);
      |             ^
a.cc:18:26: error: expected primary-expression before ',' token
   18 |             cout << -1 < ,endl;
      |                          ^
Language: C++

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

typedef long long ll;
typedef pair<int,int> pii;

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  string S,T;
  cin >> S;
  cin >> T;
  int S_size = S.size();

  S = S + S;


  map<char,vector<int>>  pos;
  for(int i = 0; i < S.size(); i++){
    pos[S[i]].push_back(i);
  }


  int now_pos = 0;
  for(int i = 0; i < T.size(); i++){
    if(pos.count(T[i]) == 0){
      cout << -1 << endl;
      return 0;
    }
    if(i == 0){
      now_pos = pos[T[i]].at(0);
    } else { 
      // T[i]のリストの中で、now_posより大きいものを選ぶ
      int tmp_index = upper_bound(pos[T[i]].begin(), pos[T[i]].end(), now_pos) - pos[T[i]].begin(); 
      int tmp_pos = pos[T[i]].at(tmp_index);
      if(tmp_pos >= S_size){
        ans++;
        now_pos = pos[T[i]].at(0);
      } else { 
        now_pos = tmp_pos;
      }
    }
  }

  ll ret = (ll)ans * (ll) S_size;
  ret += ll(now_pos) + 1;

  cout << ret << endl;


}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   38 |         ans++;
      |         ^~~
      |         abs
a.cc:46:16: error: 'ans' was not declared in this scope; did you mean 'abs'?
   46 |   ll ret = (ll)ans * (ll) S_size;
      |                ^~~
      |                abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define cvector vector<char>
#define svector vector<string>
#define lque queue<ll>
#define lpque priority_queue<ll>
#define dlpque priority_queue<ll,lvector,greater<ll>>
#define P pair<ll,ll>
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define rep(i,n) for(ll i=0; i<n; ++i)
#define print(a) cout << (a) << endl

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s,t;cin>>s>>t;
  string ss=s+s;
  ll aa=ss.length(),b=t.length(),pos=0,ans=0,num=0;
  bool isok=true;
  map<char,lvector> mp;
  rep(i,aa) mp[ss[i]].emplace_back(i);
  rep(i,b) {
    print_vec(mp[t[i]]);
    auto itr=lower_bound(ALL(mp[t[i]]),pos);
    if(itr==mp[t[i]].end()) {
      pos=0;num++;
      itr=lower_bound(ALL(mp[t[i]]),pos);
      if(itr==mp[t[i]].end()) {ans=-1;isok=false;}      
    }
    if(!isok) break;
    pos=*itr;
    ans=aa*num+pos+1;
  }
  print(ans);
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:5: error: 'print_vec' was not declared in this scope
   26 |     print_vec(mp[t[i]]);
      |     ^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main(){
  string s, t;
  cin >> s >> t;
  vector<vector<int>> arf(26,vector<int>(0));
  for(int i=0; i<(int)s.size(); ++i){
    int x=s[i]-'a';
    arf[x].push_back(i+1);
  }
  for(int i=0; i<26; ++i){
    arf[i].push_back(INF);
  }
  ll ans=0;
  int num=0;
  for(int i=0; i<(int)t.size(); ++i){
    int x=t[i]-'a';
    if(arf[x].size() == 1){ cout << -1 << endl; return 0;}
    auto itr = upper_bound(arf[x].begin(),arf[x].end(),num);
    int newnum;
    if(*itr == INF) newnum = arf[x][0];
    else newnum = *itr;
    if(newnum <= num){
      ans += s.size() - num + newnum;
    }else{
      ans += newnum - num;
    }
    num = newnum;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'll' was not declared in this scope
   16 |   ll ans=0;
      |   ^~
a.cc:26:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |       ans += s.size() - num + newnum;
      |       ^~~
      |       abs
a.cc:28:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   28 |       ans += newnum - num;
      |       ^~~
      |       abs
a.cc:32:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   32 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C++

#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000

vector<int> nxt[26];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S, T;
    cin >> S >> T;
    S += S;
    rep(i, 26) {
        rep(j, S.length()) {
            if(S[j] == 'a' + i) nxt[i].push_back(j);
        }
    }
    ll ans = 1;
    int x = 0;
    rep(i, T.length()) {
        int prev = x;
        int k = T[i] - 'a';
        auto itr = lower_bound(nxt[k].begin(), nxt[k].end(), x);
        if(itr == nxt[k].end()) {
            cout << -1 << endl;
            return 0;
        }
        ans += *itr - prev;
        x = *itr % (S.length() / 2);
        //cout << prev << " "<< x <<" " << ans << endl;
    }
    cout << ans << endl;


    return 0;



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

#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#define REP(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using arr = vector<ll>;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;
constexpr int MAX = 2020;

string s, t;
set<int> st[26];

int main()
{
  cin >> s >> t;
  s += s;
  int n = (int)s.size();
  int m = (int)t.size();


  for(int i = 0; i < n; ++i) {
    st[s[i] - 'a'].insert(i);
  }

  ll ans = 0, pos = 0;
  for(int i = 0; i < m; ++i) {
    if (st[t[i] - 'a'].empty()) {
      cout << -1;
      return 0;
    }
    int next = st[t[i] - 'a'].lower_bound(pos) - st.begin();
    ans += next - pos;
    pos %= n;
  }
  cout << ans;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:53: error: request for member 'begin' in 'st', which is of non-class type 'std::set<int> [26]'
   36 |     int next = st[t[i] - 'a'].lower_bound(pos) - st.begin();
      |                                                     ^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using arr = vector<ll>;
constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;
constexpr int MAX = 2020;

string s, t;
set<int> st[26];

int main()
{
  cin >> s >> t;
  s += s;
  int n = (int)s.size();
  int m = (int)t.size();


  for(int i = 0; i < n; ++i) {
    st[s[i] - 'a'].insert(i);
  }

  ll ans = 0, pos = 0;
  for(int i = 0; i < m; ++i) {
    if (st[t[i] - 'a'].empty()) {
      cout << -1;
      return 0;
    }
    int next = st[t[i] - 'a'].lower_bound(pos) - st.begin();
    ans += next - pos;
    pos %= n;
  }
  cout << ans;
  return 0;
}

Compiler output:
a.cc:15:1: error: 'set' does not name a type
   15 | set<int> st[26];
      | ^~~
a.cc: In function 'int main()':
a.cc:26:5: error: 'st' was not declared in this scope; did you mean 't'?
   26 |     st[s[i] - 'a'].insert(i);
      |     ^~
      |     t
a.cc:31:9: error: 'st' was not declared in this scope; did you mean 't'?
   31 |     if (st[t[i] - 'a'].empty()) {
      |         ^~
      |         t
a.cc:35:16: error: 'st' was not declared in this scope; did you mean 't'?
   35 |     int next = st[t[i] - 'a'].lower_bound(pos) - st.begin();
      |                ^~
      |                t