criyle/codenet-compile-errors huggingface dataset:
Language: Java

import java.util.ArrayList;
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int N = scn.nextInt();
		Pair[] P = new Pair[N-1];

		ArrayList<ArrayList<Integer>> Path = new ArrayList<ArrayList<Integer>>();

		for(int i = 0;i < N;i++) {
			Path.add(new ArrayList<Integer>());
		}

		for(int i = 0;i < N-1;i++) {
			int a = scn.nextInt()-1, b = scn.nextInt()-1;
			P[i] = new Pair(a,b);
			Path.get(a).add(b);
			Path.get(b).add(a);
		}
		int K = 0;
		for(int i = 0;i < N;i++) {
			K = Math.max(K, Path.get(i).size());
		}
		ArrayList<ArrayList<Integer>> num = new ArrayList<ArrayList<Integer>>();
		for(int i = 0;i < N;i++) {
			num.add(new ArrayList<Integer>());
		}

		System.out.println(K);
		for(int i = 0;i < N-1;i++) {
			Pair p = P[i];
			for(int j = 1;j <= K;j++) {
				if(num.get(p.first).contains(j) || num.get(p.second).contains(j)) {
					continue;
				}
				System.out.println(j);
				num.get(p.first).add(j);
				num.get(p.second).add(j);
				break;
			}
		}
	}

}

Compiler output:
Main.java:9: error: cannot find symbol
		Pair[] P = new Pair[N-1];
		^
  symbol:   class Pair
  location: class Main
Main.java:9: error: cannot find symbol
		Pair[] P = new Pair[N-1];
		               ^
  symbol:   class Pair
  location: class Main
Main.java:19: error: cannot find symbol
			P[i] = new Pair(a,b);
			           ^
  symbol:   class Pair
  location: class Main
Main.java:34: error: cannot find symbol
			Pair p = P[i];
			^
  symbol:   class Pair
  location: class Main
4 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
const ll mod = (ll)1e9 + 7;
const ll INF = (ll)2e18;
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}

class DColoringEdgesOnTree {
public:
    int N;
    vector<int> next[110000];
    int color[110000] = {0};
    unordered_map<string, int> ans;
    int val = 1;

    void dfs(int now, int before = 1) {
        vector<int> ac;
        if (now == 1) {
            int number = 1;
            for (int temp : next[now]) {
                if (color[temp] != 0) continue;
                val = max(val, number);
                color[temp] = number++;
                ans[to_string(now) + " + " + to_string(temp)] = color[temp];
                ans[to_string(temp) + " + " + to_string(now)] = color[temp];
                ac.push_back(temp);
            }
        } else {
            int number = 1;
            for (int temp : next[now]) {
                if (color[temp] != 0) continue;
                if (number == color[before]) ++number;
                if (number == color[now]) ++number;
                if (number == color[before]) ++number;
                val = max(val, number);
                color[temp] = number++;
                ans[to_string(now) + " + " + to_string(temp)] = color[temp];
                ans[to_string(temp) + " + " + to_string(now)] = color[temp];
                ac.push_back(temp);
            }
        }
        for (int temp : ac) {
            dfs(temp, now);
        }
    }

	void solve(std::istream& in, std::ostream& out) {
	    in >> N;
	    color[1] = -1;
	    vector<pair<int, int>> record(N);
	    rep(i, N - 1) {
	        in >> record[i].first >> record[i].second;
	        next[record[i].first].push_back(record[i].second);
            next[record[i].second].push_back(record[i].first);
	    }
	    dfs(1);
	    out << val << endl;
	    rep(i, N - 1) {
	        out << ans[to_string(record[i].first) + " + " + to_string(record[i].second)] << endl;
	    }
	}
};


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

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

int main(){
  int n; cin>>n;
  vector<int> ans(n,-1)
  vector<vector<int>> tree(n);
  for(int i=0;i<n-1;i++){
    int a,b; cin>>a>>b;
    a--; b--;
    tree[a].push_back(b);
  }
  queue<int> que;
  que.push(0);
  ans[0]=0;
  int color=1;
  while(!que.empty()){
    int x=que.front();
    que.pop();
    int now=1,out=ans[x];
    for(int i=0;i<tree[x].size();i++){
      if(out==now) now++;
      int child=tree[x][i];
      if(ans[child]==-1){
        que.push(child);
        ans[child]=now;
        if(now>color) color=now;
        now++;
      }
    }
  }cout<<color<<endl;
  for(int i=1;i<n;i++){
    if(ans[i]==-1) cout<<1<<endl;
    else cout<<ans[i]<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'vector'
    7 |   vector<vector<int>> tree(n);
      |   ^~~~~~
a.cc:11:5: error: 'tree' was not declared in this scope; did you mean 'free'?
   11 |     tree[a].push_back(b);
      |     ^~~~
      |     free
a.cc:21:19: error: 'tree' was not declared in this scope; did you mean 'free'?
   21 |     for(int i=0;i<tree[x].size();i++){
      |                   ^~~~
      |                   free
Language: C++

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

int n;
int C[100005];
vector<int>G[100005];
bool V[100005];

int main(){
	cin>>n;
	
	for(int i=1,a,b;i<n;i++){
		cin>>a>>b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	
	queue<int>Q;
	V[1]=1;
	int u,v;
	Q.push(1);
	vector<int>k;
	
	while(!Q.empty()){
		u = Q.front();Q.pop();
		
		V[u]=1;
		
		for(int i=0;i<G[u].size();i++){
			v = G[u][i];
			if(!V[v]){
				Q.push(v)
			} else {
				k.insert(lower_bound(k.begin(),k.end(),C[v]),C[v]);
			}
		}
		
		for(int i=0;i<k.size();i++){
			if(k[i]!=i+1){
				for(int j=0;j<G[u].size();j++){
					if(!V[G[u][i]])C[G[u][i]]=i;				
				}
				break;
			}
		}
		
		k.clear();
	}
	
	for(int i=1;i<=n;i++){
		cout<<C[i]<<'\n';
	}
}













Compiler output:
a.cc: In function 'int main()':
a.cc:32:42: error: expected ';' before '}' token
   32 |                                 Q.push(v)
      |                                          ^
      |                                          ;
   33 |                         } else {
      |                         ~
Language: C++

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

int n;
int C[100005];
vector<int>G[100005];
bool V[100005];

int main(){
	cin>>n;
	
	for(int i=1,a,b;i<n;i++){
		cin>>a>>b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	
	queue<int>Q;
	V[1]=1;
	int u,v;
	Q.push(1);
	vector<int>k;
	
	while(!Q.empty()){
		u = Q.front();Q.pop();
		
		V[u]=1;
		
		for(int i=0;i<G[u].size();i++){
			v = G[u][i];
			if(!V[v]){
				Q.push()
			} else {
				k.insert(lower_bound(k.begin(),k.end(),C[v]),C[v]);
			}
		}
		
		for(int i=0;i<k.size();i++){
			if(k[i]!=i+1){
				for(int j=0;j<G[u].size();j++){
					if(!V[G[u][i]])C[G[u][i]]=i;				
				}
				break;
			}
		}
		
		k.clear();
	}
	
	for(int i=1;i<=n;i++){
		cout<<C[i]<<'\n';
	}
}













Compiler output:
a.cc: In function 'int main()':
a.cc:32:39: error: no matching function for call to 'std::queue<int>::push()'
   32 |                                 Q.push()
      |                                 ~~~~~~^~
In file included from /usr/include/c++/14/queue:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:157,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_queue.h:283:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(const value_type&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; value_type = int]'
  283 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:283:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_queue.h:288:7: note: candidate: 'void std::queue<_Tp, _Sequence>::push(value_type&&) [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >; value_type = int]'
  288 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/14/bits/stl_queue.h:288:7: note:   candidate expects 1 argument, 0 provided
Language: C++

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

pi MAP[100010];
vector<int> adj[100010];
int t[100010][100010];
int Max=0;

void dfs(int now, int par, int color)
{
    int nuri = 1;
    for(auto u:adj[now]){
        if (u==par) continue;
        if (nuri==color) nuri++;
        t[now][u] = nuri;
        t[u][now] = nuri;
        Max = max(Max, nuri);
        dfs(u,now,nuri);
        nuri++;
    }
}

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;

    rep(i, n-1){
        int a, b; cin>>a>>b;
        MAP[i] = mp(a, b);
        adj[a].pb(b);
        adj[b].pb(a);
    }
    dfs(1,0,0);
    cout << Max << endl;
    rep(i, n-1){
        int a, b;
        tie(a, b) = MAP[i];
        cout << t[a][b] << endl;
    }
    return 0;
}


Compiler output:
/tmp/ccGGUivn.o: in function `dfs(int, int, int)':
a.cc:(.text+0xec): relocation truncated to fit: R_X86_64_PC32 against symbol `Max' defined in .bss section in /tmp/ccGGUivn.o
a.cc:(.text+0xfc): relocation truncated to fit: R_X86_64_PC32 against symbol `Max' defined in .bss section in /tmp/ccGGUivn.o
/tmp/ccGGUivn.o: in function `main':
a.cc:(.text+0x278): relocation truncated to fit: R_X86_64_PC32 against symbol `Max' defined in .bss section in /tmp/ccGGUivn.o
collect2: error: ld returned 1 exit status
Language: C++


#include<bits/stdc++.h>
using namespace std;
vector<int>adj[100005];
int aa[100005];
int prev[100005];
bool color[100005];
queue<int>myqueue;
void bfs(int n,int x)
{
   aa[1] = 1 ;
   prev[1]= 0 ;
   aa[0] = 0 ;
   color[1] = 0 ;
    while(!myqueue.empty())
    {
        int s = myqueue.front();
        myqueue.pop();
        int r=1;
        for(int i = 0 ; i < adj[s].size() ; i++ )
        {
            if(color[adj[s][i]]==1)
            {
                myqueue.push(adj[s][i]) ;
               // cout<<r<<" ";
                if(r==aa[prev[s]])r++;
               // cout<<r<<endl;
                aa[adj[s][i]] = r ;
                r++;
                color[adj[s][i]] = 0 ;
                prev[adj[s][i]] = s ;

            }
        }
    }




}
int main()
{
    int n;
    cin>>n ;
    for(int i = 1 ; i < n ; i++)
    {
        int x,y;
        cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    for(int i = 1 ; i <= n ; i++ )
    {
        color[i]=1;
    }
    myqueue.push(1);
    bfs(n,1);
     for(int i = 1 ; i <= n ; i++ )
    {
        cout<<aa[i]<<endl;
    }


    return 0;
}


Compiler output:
a.cc: In function 'void bfs(int, int)':
a.cc:12:4: error: reference to 'prev' is ambiguous
   12 |    prev[1]= 0 ;
      |    ^~~~
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:2:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:6:5: note:                 'int prev [100005]'
    6 | int prev[100005];
      |     ^~~~
a.cc:26:26: error: reference to 'prev' is ambiguous
   26 |                 if(r==aa[prev[s]])r++;
      |                          ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:6:5: note:                 'int prev [100005]'
    6 | int prev[100005];
      |     ^~~~
a.cc:31:17: error: reference to 'prev' is ambiguous
   31 |                 prev[adj[s][i]] = s ;
      |                 ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:6:5: note:                 'int prev [100005]'
    6 | int prev[100005];
      |     ^~~~
Language: C++


#include<bits/stdc++.h>
using namespace std;
vector<int>adj[100005];
int aa[100005];
int prev[100005];
bool color[100005];
queue<int>myqueue;
void bfs(int n,int x)
{
   aa[1] = 1 ;
   prev[1]= 0 ;
   aa[0] = 0 ;
   color[1] = 0 ;
    while(!myqueue.empty())
    {
        int s = myqueue.front();
        myqueue.pop();
        int r=1;
        for(int i = 0 ; i < adj[s].size() ; i++ )
        {
            if(color[adj[s][i]]==1)
            {
                myqueue.push(adj[s][i]) ;
               // cout<<r<<" ";
                if(r==aa[prev[s]])r++;
               // cout<<r<<endl;
                aa[adj[s][i]] = r ;
                r++;
                color[adj[s][i]] = 0 ;
                prev[adj[s][i]] = s ;

            }
        }
    }




}
int main()
{
    int n;
    cin>>n ;
    for(int i = 1 ; i < n ; i++)
    {
        int x,y;
        cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    for(int i = 1 ; i <= n ; i++ )
    {
        color[i]=1;
    }
    myqueue.push(1);
    bfs(n,1);
     for(int i = 1 ; i <= n ; i++ )
    {
        cout<<aa[i]<<endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'void bfs(int, int)':
a.cc:12:4: error: reference to 'prev' is ambiguous
   12 |    prev[1]= 0 ;
      |    ^~~~
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:2:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:6:5: note:                 'int prev [100005]'
    6 | int prev[100005];
      |     ^~~~
a.cc:26:26: error: reference to 'prev' is ambiguous
   26 |                 if(r==aa[prev[s]])r++;
      |                          ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:6:5: note:                 'int prev [100005]'
    6 | int prev[100005];
      |     ^~~~
a.cc:31:17: error: reference to 'prev' is ambiguous
   31 |                 prev[adj[s][i]] = s ;
      |                 ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:6:5: note:                 'int prev [100005]'
    6 | int prev[100005];
      |     ^~~~
Language: C++

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

const int N = 100010;
vector<int> G[N];
vector<bool> seen(N);
bool Color[N][N]; // [vertex][used_color]

int n;


void dfs(int now, int k, map<pair<int, int>, int> &color_mp){
    seen[now] = true;
    for(int i = 0; i < (int)G[now].size(); i++){
        int to = G[now][i];
        if(seen[to]) continue;
        for(int j = 0; j < k; j++){
            if(!Color[now][j] and !Color[to][j]){
                Color[now][j] = true;
                Color[to][j] = true;
                
                int aa = now, bb = to;
                if(aa > bb) swap(aa, bb);
                color_mp[make_pair(aa, bb)] = j;
                break;
            }
        }
    }
    return;
}

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

    cin >> n;

    vector<int> A(n - 1), B(n - 1);
    map<pair<int, int>, int> color_map;
    for(int i = 0; i < n - 1; i++){
        cin >> A[i] >> B[i];
        if(A[i] > B[i]){
            swap(A[i], B[i]);
        }
        A[i]--; B[i]--;
        G[A[i]].push_back(B[i]);
        G[B[i]].push_back(A[i]);
        color_map[make_pair(A[i], B[i])] = -1;
    }

    // 辺が出てる最大の頂点を求める = 塗り分けの数
    int max_edge_num = 0, idx = -1;
    for(int i = 0; i < n; i++){
        max_edge_num = max(max_edge_num, (int)G[i].size());
        if(max_edge_num == (int)G[i].size()){
            idx = i;
        }
    }

    cout << max_edge_num << endl;
    dfs(idx, max_edge_num, color_map);
    for(int i = 0; i < n; i++){
        if(seen[i]) continue;
        dfs(i, max_edge_num, color_map);
    }

    for(int i = 0; i < n - 1; i++){
        cout << color_map[make_pair(A[i], B[i])] + 1<< endl;
    }


    return 0;
}

Compiler output:
/tmp/ccw4iYEh.o: in function `main':
a.cc:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccw4iYEh.o
a.cc:(.text+0x258): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccw4iYEh.o
a.cc:(.text+0x28e): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccw4iYEh.o
a.cc:(.text+0x4de): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccw4iYEh.o
a.cc:(.text+0x593): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccw4iYEh.o
a.cc:(.text+0x63c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccw4iYEh.o
a.cc:(.text+0x6d4): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccw4iYEh.o
collect2: error: ld returned 1 exit status
Language: C++

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

const int N = 100010;
vector<int> G[N];
vector<bool> seen(N);
bool Color[N][N]; // [vertex][used_color]

int n;


void dfs(int now, int k, map<pair<int, int>, int> &color_mp){
    seen[now] = true;
    for(int i = 0; i < (int)G[now].size(); i++){
        int to = G[now][i];
        if(seen[to]) continue;
        for(int j = 0; j < k; j++){
            if(!Color[now][j] and !Color[to][j]){
                Color[now][j] = true;
                Color[to][j] = true;
                
                int aa = now, bb = to;
                if(aa > bb) swap(aa, bb);
                color_mp[make_pair(aa, bb)] = j;
                break;
            }
        }
    }
    return;
}

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

    cin >> n;

    vector<int> A(n - 1), B(n - 1);
    map<pair<int, int>, int> color_map;
    for(int i = 0; i < n - 1; i++){
        cin >> A[i] >> B[i];
        if(A[i] > B[i]){
            swap(A[i], B[i]);
        }
        A[i]--; B[i]--;
        G[A[i]].push_back(B[i]);
        G[B[i]].push_back(A[i]);
        color_map[make_pair(A[i], B[i])] = -1;
    }

    // 辺が出てる最大の頂点を求める = 塗り分けの数
    int max_edge_num = 0, idx = -1;
    for(int i = 0; i < n; i++){
        max_edge_num = max(max_edge_num, (int)G[i].size());
        if(max_edge_num == (int)G[i].size()){
            idx = i;
        }
    }

    cout << max_edge_num << endl;
    dfs(idx, max_edge_num, color_map);
    for(int i = 0; i < n; i++){
        if(seen[i]) continue;
        dfs(i, max_edge_num, color_map);
    }

    for(int i = 0; i < n - 1; i++){
        cout << color_map[make_pair(A[i], B[i])] + 1<< endl;
    }


    return 0;
}

Compiler output:
/tmp/ccv3x6nQ.o: in function `main':
a.cc:(.text+0x236): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccv3x6nQ.o
a.cc:(.text+0x258): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccv3x6nQ.o
a.cc:(.text+0x28e): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccv3x6nQ.o
a.cc:(.text+0x4de): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccv3x6nQ.o
a.cc:(.text+0x593): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccv3x6nQ.o
a.cc:(.text+0x63c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccv3x6nQ.o
a.cc:(.text+0x6d4): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccv3x6nQ.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
#include <cassert>
using namespace std;
typedef long long ll;
#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

int N;
int a[100010];
int b[100010];
int deg[100010];
vector<int> G[100010];

int main ()
{
    cin >> N;
    REP(i,N - 1) cin >> a[i + 1] >> b[i + 1];
    REP(i,N - 1) {
        deg[a[i + 1]]++;
        deg[b[i + 1]]++;
        G[a[i + 1]].push_back(b[i + 1]);
        G[b[i + 1]].push_back(a[i + 1]);
    }

    vector<pair<int,int>> ord;
    REP(i,N) {
        ord.push_back(make_pair(deg[i + 1], i + 1));
    }

    sort(ord.begin(), ord.end());
    reverse(ord.begin(), ord.end());

    map<pair<int,int>, int> ans;
    REP(i,ord.size()) {
        int idx = ord[i].second;
        //cerr << "! " << idx << endl;
        set<int> used;
        REP(j,G[idx].size()) {
            pair<int,int> e = make_pair(min(idx, G[idx][j]), max(idx, G[idx][j]));
            if (ans.find(e) != ans.end()) {
                used.insert(ans[e]);
                //cerr << e.first << " " << e.second << endl;
            }
        }
        int cnt = 1;
        REP(j,G[idx].size()) {
            pair<int,int> e = make_pair(min(idx, G[idx][j]), max(idx, G[idx][j]));
            if (ans.find(e) == ans.end()) {
                while (used.find(cnt) != used.end()) cnt++;
                ans[e] = cnt;
                used.insert(cnt);
                //cerr << cnt << endl;
            }
        }
    }

    set<int> col;
    for (auto &x: ans) {
        if (ans.second == 0) {
            assert(false);
        }
        col.insert(x.second);
    }

    cout << col.size() << endl;
    REP(i,N - 1) {
        pair<int,int> e = make_pair(min(a[i + 1], b[i + 1]), max(a[i + 1], b[i + 1]));
        cout << ans[e] << endl;
    }
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:79:17: error: 'class std::map<std::pair<int, int>, int>' has no member named 'second'
   79 |         if (ans.second == 0) {
      |                 ^~~~~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;


int main(){
  int N,k=0;
  cin>>N;
  
  int A[N],B[N],K[N+1];
  REP(i,N+1) K[i]=0;
  
  REP(i,N){
    cin>>A[i]>>B[i];
    K[A[i]]++;
    K[B[i]]++;
  }
  
  REP(i,N+1) chmax(k,K[i]);
  
  bool L[N+1][k+1];
  REP(i,N+1){
    REP(i,k+1){
      L[i][j]=true;
    }
  }
  
  
  co(k);
  
  REP(i,N){
    for(int j=1; j<=k; ++j){
      if(L[A[i]][j]==true && L[B[i]][j]==true){
        co(j);
        L[A[i]][j]==false;
        L[B[i]][j]==false;
        break;
      }
    }
  }
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:49:12: error: 'j' was not declared in this scope
   49 |       L[i][j]=true;
      |            ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;


int main(){
  int N,k=0;
  cin>>N;
  
  int A[N],B[N],K[N+1];
  REP(i,N+1) K[i]=0;
  
  REP(i,N){
    cin>>A[i]>>B[i];
    K[A[i]]++;
    K[B[i]]++;
  }
  
  REP(i,N+1) chmax(k,K[i]);
  
  bool L[N+1][K+1];
  REP(i,N+1){
    REP(i,k+1){
      L[i][j]=true;
    }
  }
  
  
  co(k);
  
  REP(i,N){
    for(int j=1; j<=k; ++j){
      if(L[A[i]][j]==true && L[B[i]][j]==true){
        co(j);
        L[A[i]][j]==false;
        L[B[i]][j]==false;
        break;
      }
    }
  }
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:16: error: conversion from 'int*' to 'long unsigned int' in a converted constant expression
   46 |   bool L[N+1][K+1];
      |               ~^~
a.cc:46:16: error: could not convert '(((int*)(& K)) + 4)' from 'int*' to 'long unsigned int'
   46 |   bool L[N+1][K+1];
      |               ~^~
      |                |
      |                int*
a.cc:46:16: error: size of array 'L' has non-integral type 'int*'
a.cc:49:12: error: 'j' was not declared in this scope
   49 |       L[i][j]=true;
      |            ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
using namespace std;


int main(){
  int N,K=0;
  cin>>N;
  
  int A[N],B[N],K[N+1];
  REP(i,N+1) K[i]=0;
  
  REP(i,N){
    cin>>A[i]>>B[i];
    K[A[i]]++;
    K[B[i]]++;
  }
  
  REP(i,N+1) chmax(K,K[i]);
  
  bool L[N+1][K+1];
  REP(i,N+1){
    REP(i,K+1){
      L[i][j]=true;
    }
  }
  
  
  co(K);
  
  REP(i,N){
    for(int j=1; j<=K; ++j){
      if(L[A[i]][j]==true && L[B[i]][j]==true){
        co(j);
        L[A[i]][j]==false;
        L[B[i]][j]==false;
        break;
      }
    }
  }
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: conflicting declaration 'int K [(N + 1)]'
   35 |   int A[N],B[N],K[N+1];
      |                 ^
a.cc:32:9: note: previous declaration as 'int K'
   32 |   int N,K=0;
      |         ^
a.cc:36:15: error: invalid types 'int[int]' for array subscript
   36 |   REP(i,N+1) K[i]=0;
      |               ^
a.cc:40:6: error: invalid types 'int[int]' for array subscript
   40 |     K[A[i]]++;
      |      ^
a.cc:41:6: error: invalid types 'int[int]' for array subscript
   41 |     K[B[i]]++;
      |      ^
a.cc:44:23: error: invalid types 'int[int]' for array subscript
   44 |   REP(i,N+1) chmax(K,K[i]);
      |                       ^
a.cc:49:12: error: 'j' was not declared in this scope
   49 |       L[i][j]=true;
      |            ^
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

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

vector<int> G[100'010];
int maxdeg = 0;
map<pair<int, int>, int> color;
void dfs(int v, int p){
  //bool used[k] = {};
  int ban_c =  color[make_pair(p,v)];
  int now = 1;
  for(int nv:G[v]){
    if(nv == p){
      //used[color[make_pair(p,v)] - 1] = true;
      continue;
    }else{
      if(now == ban_c){
        now++;
      }
      color[make_pair(nv,v)] = color[make_pair(v,nv)] = now;
      now++;
      dfs(nv, v);//ちょっと微妙
    }
  }
  return;
}

int main(){
  
  int n;
  cin>>n;
  int a[n-1],b[n-1];
  REP(i,n-1){
    cin>>a[i]>>b[i];
    a[i]--;b[i]--;
    G[a[i]].push_back(b[i]);
    G[b[i]].push_back(a[i]);
  }
  REP(i,n){
    maxdeg = max(maxdeg, (int)G[i].size());
  }
  dfs(0, -1);
  cout<<maxdeg<<endl;
  REP(i,n-1){
    int c = map[make_pair(a[i],b[i])];
    cout<<c<<endl;
  }
  return 0; 
}


Compiler output:
a.cc: In function 'int main()':
a.cc:91:16: error: missing template arguments before '[' token
   91 |     int c = map[make_pair(a[i],b[i])];
      |                ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll N, A[100010], B[100010], ans[100010][100010];
vector<vector<ll>> G;

void dfs(int v, int pv, int col) {
  int nc = 1;
  for(int nv: G[v]) {
    if(nv == pv) continue;
    if(col == nc) ++nc;
    dfs(nv, v, nc);
    ans[v][nv] = ans[nv][v] = nc;
    ++nc;
  }
}

int main() {
  cin.tie(0); ios_base::sync_with_stdio(false);
  cin >> N;
  G.resize(N);
  for(int i = 0; i < N - 1; ++i) {
    cin >> A[i] >> B[i];
    --A[i], --B[i];
    G[A[i]].push_back(B[i]);
    G[B[i]].push_back(A[i]);
  }

  dfs(0, -1, 0);

  ll k = 0;
  for(int i = 0; i < N-1; ++i) {
    k = max(k, ans[A[i]][B[i]]);
  }
  cout << k << endl;
  for(int i = 0; i < N-1; ++i) {
    cout << ans[A[i]][B[i]] << endl;
  }

  return 0;
}


Compiler output:
/tmp/ccU2Il5P.o: in function `dfs(int, int, int)':
a.cc:(.text+0x23): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccU2Il5P.o
/tmp/ccU2Il5P.o: in function `main':
a.cc:(.text+0x191): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccU2Il5P.o
a.cc:(.text+0x27d): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccU2Il5P.o
a.cc:(.text+0x2cc): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccU2Il5P.o
/tmp/ccU2Il5P.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x48a): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccU2Il5P.o
a.cc:(.text+0x4a3): relocation truncated to fit: R_X86_64_PC32 against symbol `G' defined in .bss section in /tmp/ccU2Il5P.o
collect2: error: ld returned 1 exit status
Language: C++

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

vector<vector<pair<int, int>>> G(100000);
vector<int> ans;

void dfs(pair<int, int> data, int k){
	ans[data.second] = k;
	int cnt = (k == 1 ? 2 : 1);
	for(auto i : G[data.first]){
		dfs(i, cnt);
		cnt++;
		if(cnt == k){
			cnt++;
		}
	}
}

int32_t main(){
	int n;
	cin >> n;
	ans.resize(n - 1);
	for(int i = 0; i < n - 1; i++){
		int v1, v2;
		cin >> v1 >> v2;
		v1--; v2--;
		G[v1].push_back({v2, i});
	}
	dfs({0, 0}, 1);
	cout << *max_element(ans.begin(), ans.end()) << endl;
	int _min = *min_element(ans.begin(), ans.end())
	for(int i = 0; i < n - 1; i++){
		cout << ans[i] - _min + 1 << endl;
	}
}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:33:9: error: expected ',' or ';' before 'for'
   33 |         for(int i = 0; i < n - 1; i++){
      |         ^~~
a.cc:33:24: error: 'i' was not declared in this scope
   33 |         for(int i = 0; i < n - 1; i++){
      |                        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll MOD=1000000007;
//const ll MOD=998244353;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}



int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N;
  cin>>N;
  vector<ll> cnt(N,0);
  for(int i=1;i<N;i++){
    ll a,b;
    cin>>a>>b;
    a--; b--;
    cnt[a]++;
    cnt[b]++;
  }
  ll mx=0;
  for(auto &I:cnt){mx=max(mx,I);}
  cout<<mx<<endl;
  え、なんで構築なんですか？

  return 0;
}


Compiler output:
a.cc:36:3: error: extended character 、 is not valid in an identifier
   36 |   え、なんで構築なんですか？
      |   ^
a.cc: In function 'int main()':
a.cc:36:3: error: '\U00003048\U00003001\U0000306a\U00003093\U00003067\U000069cb\U00007bc9\U0000306a\U00003093\U00003067\U00003059\U0000304b\U0000ff1f' was not declared in this scope
   36 |   え、なんで構築なんですか？
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
using namespace std;
typedef long long LL;
LL n,k,a[200005];
LL pre[200005] = {0};
map <LL,LL> mp;
LL tot = 0;
int main(){
	ios::sync_with_stdio(false);
	cin >> n >> k;
	for(LL i = 1;i <= n;i ++){
		cin >> a[i]; a[i] --; a[i] %= k;
		pre[i] = pre[i - 1] + a[i]; pre[i] %= k;
    }
	mp[pre[0]] = 1;
	for(LL i = 1;i <= n;i ++){
		if(i >= k) mp[pre[i - k]] --;
		tot += mp[pre[i]]； 
		mp[pre[i]] ++;
	}
	cout << tot << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:34: error: expected ';' before '\U0000ff1b'
   24 |                 tot += mp[pre[i]]；
      |                                  ^~
      |                                  ;
Language: C++

#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處

LL a[200005];
LL prefix[200005];

unordered_map<LL, LL> m;
LL n, k;

LL mod(LL x) {
    return ((x % k) + k) % k;
}

int main() {
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    if (k == 1) {
        cout << n << endl;
        return;
    }
    prefix[0] = 0;
    for (int i = 1; i <= n; i++) {
        prefix[i] = prefix[i - 1] + a[i];
    }
    LL ans = 0;
    m[0] = 1;
    for (int i = 1; i <= n; i++) {
        ans += m[mod(prefix[i] - i)];
        if (i >= k - 1) {
            m[mod(prefix[i - k + 1] - (i - k + 1))]--;
        }
        // printf("ans = %lld\n", ans);
        m[mod(prefix[i] - i)]++;
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: return-statement with no value, in function returning 'int' [-fpermissive]
   25 |         return;
      |         ^~~~~~
Language: C++

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

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

long long MOD = 1000000000 + 7;
long long MAX = 1000000000000000000;

int main(){
  cout << setprecision(10);
  int N;
  ll K;
  cin >> N >> K;
  vector<ll> A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }

  vector<ll> B(N+1);
  B[0] = 0;
  for(int i = 0; i < N; i++){
    B[i+1] = B[i] + A[i];
  }

  map<ll, int> m;
  ll ans = 0;
  for(int i = 0; i <= N; i++){

    if(i >= K){
      ll del = (B[i-K] - (i-K) ) % K;
      m[del]--;
    }

    ll tmp = ( B[i] -i ) % K;

    if(m.count(tmp) == 0){
      m[tmp]++;
    } else {
      ans += m[tmp];
      m[tmp]++;
    }

  }
  cout << ans << endl;
}
#include<bits/stdc++.h>
using namespace std;

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

long long MOD = 1000000000 + 7;
long long MAX = 1000000000000000000;

int main(){
  cout << setprecision(10);
  int N;
  ll K;
  cin >> N >> K;
  vector<ll> A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }

  vector<ll> B(N+1);
  B[0] = 0;
  for(int i = 0; i < N; i++){
    B[i+1] = B[i] + A[i];
  }

  map<ll, int> m;
  ll ans = 0;
  for(int i = 0; i <= N; i++){

    if(i >= K){
      ll del = (B[i-K] - (i-K) ) % K;
      m[del]--;
    }

    ll tmp = ( B[i] -i ) % K;

    if(m.count(tmp) == 0){
      m[tmp]++;
    } else {
      ans += m[tmp];
      m[tmp]++;
    }

  }
  cout << ans << endl;
}


Compiler output:
a.cc:53:11: error: redefinition of 'long long int MOD'
   53 | long long MOD = 1000000000 + 7;
      |           ^~~
a.cc:7:11: note: 'long long int MOD' previously defined here
    7 | long long MOD = 1000000000 + 7;
      |           ^~~
a.cc:54:11: error: redefinition of 'long long int MAX'
   54 | long long MAX = 1000000000000000000;
      |           ^~~
a.cc:8:11: note: 'long long int MAX' previously defined here
    8 | long long MAX = 1000000000000000000;
      |           ^~~
a.cc:56:5: error: redefinition of 'int main()'
   56 | int main(){
      |     ^~~~
a.cc:10:5: note: 'int main()' previously defined here
   10 | int main(){
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
map<long long int,long long int> mp;
long long int s[100005];
int main(){
    long long int n;
    long long int m;
    cin >> n >> m;
    long long int a[n];
    long long int ans=0;
    for(long long int i=0;i<n;i++){
        cin >> a[i];
        s[i+1] = s[i] + a[i];
        if(i+1>=m)mp[(s[i+1-m]-i-1+m)%m]--;//mをこえると手前が使えなくなっていく
        ans+=mp[(s[i+1]-i-1)%m];
        mp[(sum-i-1)%m]++;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:13: error: 'sum' was not declared in this scope
   16 |         mp[(sum-i-1)%m]++;
      |             ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  long long N, K;
  cin >> N >> K;
  long long A[200100];
  for(long long i = 0; i < N; i++) cin >> A[i];
  
  long long s[200100];
  for(long long i = 0; i < N; i++) s[i] = 0;
  for(long long i = 0; i < N+1; i++) s[i+1] = s[i] + A[i];


  // REP(i, N+1) cout << s[i] << ' ';
  // cout << endl;
  for(long long i = 0; i < N+1; i++) s[i] = (s[i] - i) % K;
  // REP(i, N+1) cout << s[i] << ' ';
  // cout << endl;

  map<long long, long long> mp;
  long long ans = 0;
  for(long long i)
  for(long long j = 1; j <= N; j++) {
    ans += mp[s[j]];
    // cout << j << " " << mp[s[j]] << endl;;
    // if (0 <= j - K + 1 <= N) 
    if(0 <= j-K+1 <= N) mp[s[j-K+1]] = max(mp[s[j-K+1]]-1, 0LL);
    // if (j + 1 <= N) 
    mp[s[j]]++;
  }  
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:18: error: expected ';' before ')' token
   30 |   for(long long i)
      |                  ^
      |                  ;
a.cc:30:18: error: expected primary-expression before ')' token
a.cc:30:18: error: expected ';' before ')' token
   30 |   for(long long i)
      |                  ^
      |                  ;
Language: C++

#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=200111;
const int inf=1000000007;
const int mod=1000000007;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

vvl comb(int n) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k])%mod;
		}
	}
	return v;
}

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll __gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

int keta(ll a){
	int ke=1;
	while(a/=10)ke++;
	return ke;
}

vector<long long> enum_divisors(long long N) {
	vector<long long> res;
	for (long long i = 1; i * i <= N; ++i) {
		if (N % i == 0) {
			res.push_back(i);
			// 重複しないならば i の相方である N/i も push
			if (N/i != i) res.push_back(N/i);
		}
	}
	// 小さい順に並び替える
	sort(res.begin(), res.end());
	return res;
}

ll zyou(ll x,ll n){
	ll y=1;
	rep(i,0,n){
		y*=x;
	}
	return y;
}
const double PI = 3.1415926535897932384626433;

int main() {
	ll n,k,a[2*M];
	cin>>n>>k;
	rep(i,0,n)cin>>a[i];
	ll ans=0;
	if(n=<k){
		rep(i,0,n){
			ll sum=0;
			rep(j,0,n){
				if(i+j>=n)break;
				sum=(sum+a[i+j])%k;
				if(sum==j+1)ans++;
			}
		}
	}else{
		rep(i,0,n){
			ll sum=0;
			rep(j,0,k-1){
				if(i+j>=n)break;
				sum=(sum+a[i+j])%k;
				if(sum==j+1)ans++;
			}
		}
		print(ans);
	}


}


Compiler output:
a.cc: In function 'int main()':
a.cc:117:14: error: expected primary-expression before '<' token
  117 |         if(n=<k){
      |              ^
Language: C++

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

int main(){
// 10 7
// 14+15+92+65+35+89+79+32+38+46
    int n, k;
    cin >> n >> k;
    vector<int> int_seq(n);
    rep(i, n){cin >> int_seq.at(i);}

    vector<int> cumulative_sum(n+1);
    int tmp_sum = 0;
    cumulative_sum.at(0) = -1;
    for (int i = 1; i < (n+1); ++i){
        tmp_sum += int_seq.at(i-1);
        cumulative_sum[i] = tmp_sum - 1;
        // printf("cum_sum %d\n", cumulative_sum[i]);
    }
    vector<int> cntr(n);
    long long ans = 0;
    queue<int> q;
    for (int i = 0; i < (n); ++i){
        ans += cntr[cumulative_sum[i]];
        cntr[cumulative_sum[i]]++;
        q.push(cumulative_sum[]);
        if (q.size() == k){
            cntr[q.front()]--;
            q.pop();
        }
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:31: error: expected primary-expression before ']' token
   28 |         q.push(cumulative_sum[]);
      |                               ^
Language: C++

#include <iostream>
#include<algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <queue>
#include<map>
#include<set>
#include<sstream>
#define INF 0x3f3f3f3f
#define DOF 0x7f7f7f7f
#define mem(a,b) memset(a,b,sizeof(a))
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
typedef long long ll;
using namespace std;
const int maxn=2e5+10;
ll a[maxn],sum[maxn];
map<unsigned int,ll>num;
ll ans;
int main()
{
    int n,k;cin>>n>>k;
    for(int i=1;i<=n;++i){
        cin>>a[i];
        sum[i]=sum[i-1]+a[i];
    }
    for(int i=0;i<=n;++i){
        if(i>=k){
            num((s[i-k]-(i-k))%k)--;
        }
        if((num[sum[i]-i)%k]){
            ans+=num[(sum[i]-i)%k];
        }
        num[(sum[i]-i)%k]++;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:29:18: error: 's' was not declared in this scope
   29 |             num((s[i-k]-(i-k))%k)--;
      |                  ^
a.cc:31:25: error: expected ']' before ')' token
   31 |         if((num[sum[i]-i)%k]){
      |                         ^
      |                         ]
a.cc:31:28: error: expected ')' before ']' token
   31 |         if((num[sum[i]-i)%k]){
      |           ~                ^
      |                            )
a.cc:31:28: error: expected primary-expression before ']' token
Language: C++

#include <bits/stdc++.h>
typedef long long LL;
const int N = 1e5 + 5;
LL a[N * 5], k, n;
LL ans = 0, sum[N * 5] = {0};
map<unsigned int, LL> num;
int main() {
cin >> n >> k;
for (int i = 1; i <= n; ++i) {
scanf("%lld",a+i);
sum[i] = sum[i - 1] + a[i];
}
for (int i = 0; i <= n; ++i) {
if (i - k >= 0) {
num[(sum[i - k] - (i - k)) % k]--;
}
if (num.count((sum[i] - i) % k)) {
ans += num[(sum[i] - i) % k];
}
num[(sum[i] - i) % k]++;
}
cout << ans;
return 0;
}

Compiler output:
a.cc:6:1: error: 'map' does not name a type
    6 | map<unsigned int, LL> num;
      | ^~~
a.cc: In function 'int main()':
a.cc:8:1: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 | cin >> n >> k;
      | ^~~
      | std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:15:1: error: 'num' was not declared in this scope; did you mean 'sum'?
   15 | num[(sum[i - k] - (i - k)) % k]--;
      | ^~~
      | sum
a.cc:17:5: error: 'num' was not declared in this scope; did you mean 'sum'?
   17 | if (num.count((sum[i] - i) % k)) {
      |     ^~~
      |     sum
a.cc:20:1: error: 'num' was not declared in this scope; did you mean 'sum'?
   20 | num[(sum[i] - i) % k]++;
      | ^~~
      | sum
a.cc:22:1: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   22 | cout << ans;
      | ^~~~
      | std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~