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

#include <iostream>
#include <string>
#include <algorithm>

int main()
{
  int N;
  std::string S;
  std::cin >> S;
  std::cin >> N;
  int siz = sizeof(S);
  
  for(int i = 0; i < siz; ++i)
  {
    int sign = S[i]
      value = sign + N;
      if(value > 90)
        S[i] = S[i] + (value - 90);
    else
      S[i] = S[i] + N;
  }
  
  std::cout << S;
  return 0;
}
    
  }
  

Compiler output:
a.cc: In function 'int main()':
a.cc:16:7: error: expected ',' or ';' before 'value'
   16 |       value = sign + N;
      |       ^~~~~
a.cc:17:10: error: 'value' was not declared in this scope
   17 |       if(value > 90)
      |          ^~~~~
a.cc: At global scope:
a.cc:27:3: error: expected declaration before '}' token
   27 |   }
      |   ^
Language: C++

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

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int i = 'A';
  int k = 'a';
  int h = i-k;
  for(int j=0;j<s.size();j++){
    s.at(j) += n;
    if(s.at(j) >= i){
      s.at(j) -= h;
    }
  }
  cout << s << endl;
      
  
  
  return 0;
}

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


#include <iostream>
#include <string>
#include <array>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
using namespace  std;
#define ND -100
#define pb push_back
#define ins inset
#define g2(i,j,arr) arr[i][j]
#define g3(i,j,k,arr) arr[i][j][k]
#define g4(i,j,k,l,arr) arr[i][j][k][l]
#define g5(i,j,k,l,m,arr) arr[i][j][k][l][m]
#define g6(i,j,k,l,m,n,arr) arr[i][j][k][l][m][n]
#define var auto
//typedef int i;
typedef long l;
typedef long long ll;
typedef string s;
typedef char c;
typedef pair<int, int> pii;

typedef vector<int> vi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef set<pii> spii;

const int Max = 1e6;

int main()
{
	s str;
	int n;
	cin >> n >> str;

	for (char c : str)
	{
		int i = int(c) - int('A');
		int shiftedIndex = (i + n) % 26;
		char c = char(shiftedIndex + int('A'));
		cout << c;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:22: error: redeclaration of 'char c'
   45 |                 char c = char(shiftedIndex + int('A'));
      |                      ^
a.cc:41:19: note: 'char c' previously declared here
   41 |         for (char c : str)
      |                   ^
Language: C++

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

long long int digit(long long int x){
  long long int p=0;
  while(x>0){
    p++;
    x/=10;
  }
  return p;
}

int main(){
  string before="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  int a;
  string s;
  cin>>a>>s;
  int k;
  for(int i=0;i<s.size();i++){
    for(int j=0;j<n;j++){
      if(before.at(j)==s.at(i)){
        k=j;
        break;
      }
    }
    s.at(i)=before.at((k+a)%26);
  }
  cout<<s<<endl;
}

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

#include <bits/stdc++.h>

using namespace std;
int main()
{
	s str;
	int n;
	cin >> n >> str;

	for (char c : str)
	{
		int i = int(c) - int('A');
		int shiftedIndex = (i + n) % 26;
		char c = char(shiftedIndex + int('A'));
		cout << c;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:9: error: 's' was not declared in this scope
    6 |         s str;
      |         ^
a.cc:8:21: error: 'str' was not declared in this scope; did you mean 'std'?
    8 |         cin >> n >> str;
      |                     ^~~
      |                     std
a.cc:14:22: error: redeclaration of 'char c'
   14 |                 char c = char(shiftedIndex + int('A'));
      |                      ^
a.cc:10:19: note: 'char c' previously declared here
   10 |         for (char c : str)
      |                   ^
Language: C

#include<stdio.h>
int main(void)
{
  int i=0,num;
  char str1[8],str2[12000];
  fgets(str1,sizeof(str1),stdin);
  sscanf(str,"%d",&num);
  fgets(str2,sizeof(str),stdin);
  while(str2[i] != \0)
  {
    if((str2[i]+num)<='Z')
    {
      printf("%c",str2[i]+num);
    }else
    {
      int num1 = str2[i]-num;
      printf("%c",'A'+num1);
    }
      i++;
  }
  printf("\n");
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:10: error: 'str' undeclared (first use in this function); did you mean 'str2'?
    7 |   sscanf(str,"%d",&num);
      |          ^~~
      |          str2
main.c:7:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:20: error: stray '\' in program
    9 |   while(str2[i] != \0)
      |                    ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <stdlib.h>
#include <math.h>

#define REP(i, n) for (int i = 0; i < n; i++)

typedef int long long ill;
typedef int long il;

using namespace std;
int main()
{
    int n;
    char s[100000];
    cin>>n;
    cin>>s;

    for(int i=0;i<strlen(s);i++){
        s[i]+=n;
        while(s[i]>'Z'){
            s[i]+=-'Z'+'A'-1;
        }
    }
    printf("%s\n",s);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:19: error: 'strlen' was not declared in this scope
   23 |     for(int i=0;i<strlen(s);i++){
      |                   ^~~~~~
a.cc:9:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    8 | #include <math.h>
  +++ |+#include <cstring>
    9 |
Language: C++

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

int main() {
    int N;
    string S;
    cin >> N, S;
    rep(i, S.size + 1){
        S.at(i) = S.at(i) + N;
    }
    cout << S;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
    9 |     rep(i, S.size + 1){
      |            ~~^~~~
a.cc:3:45: note: in definition of macro 'rep'
    3 | #define rep(i, n) for (int i = 0; i < (int)(n); i++)
      |                                             ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  string s;
  cin>>n>>s;
  int l=s.size();
  for(int i=0;i<l;++i)
    if(s[i]+n>122)
      cout<<a[i]+n-122;
    else cout<<s[i]+n;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:13: error: 'a' was not declared in this scope
   11 |       cout<<a[i]+n-122;
      |             ^
Language: C

#include<stdio.h>
int main(void)
{
  int i=0,num;
  char str1[8],str2[12000];
  fgets(str1,sizeof(str1),stdin);
  sscanf(str1,"%d",&num);
  fgets(str2,sizeof(str2),stdin);
  while(str2[i] != '\0')
  {
    if((str2[i]+num)<='Z')
    {
      printf("%c",str2[i]+num);
    }else
    {
      int num1 = str2[i]-num;
      printf("%c",'A'+num1
    }
      i++
  }
  printf("\n");
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:17:27: error: expected ')' before '}' token
   17 |       printf("%c",'A'+num1
      |             ~             ^
      |                           )
   18 |     }
      |     ~                      
main.c:17:27: error: expected ';' before '}' token
   17 |       printf("%c",'A'+num1
      |                           ^
      |                           ;
   18 |     }
      |     ~                      
main.c:19:10: error: expected ';' before '}' token
   19 |       i++
      |          ^
      |          ;
   20 |   }
      |   ~
Language: C

#include <stdio.h>
#include <cstring>

int main() {
    char s[10001];
    int n;
    scanf("%d", &n);
    scanf("%s", s);
    
    int len = strlen(s);
    int a = (int)'A';
    int z = (int)'Z';
    for(int i = 0; i < len; i++) {
        int c = (int)s[i] - a;
        printf("%c", (char)((c + n) % (z - a) + a));
    }
}

Compiler output:
main.c:2:10: fatal error: cstring: No such file or directory
    2 | #include <cstring>
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  string s;
  cin>>n>>s;
  int l=s.size();
  for(int i=0;i<l;++i)
    if(a[i]+n>122)
      cout<<a[i]+n-122;
    else cout<<s[i]+n;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:8: error: 'a' was not declared in this scope
   10 |     if(a[i]+n>122)
      |        ^
Language: C

#include<stdio.h>
int main(void)
{
  int i=0,num;
  char str1[8],str2[12000];
  fgets(str1,sizeof(str1),stdin);
  sscanf(str,"%d",&num);
  fgets(str2,sizeof(str),stdin);
  while(str2[i] != \0)
  {
    if((str2[i]+num)<='Z')
    {
      printf("%c",str2[i]+num);
    }else
    {
      int num1 = str2[i]-num;
      printf("%c",'A'+num1
    }
      i++
  }
  printf("\n");
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:7:10: error: 'str' undeclared (first use in this function); did you mean 'str2'?
    7 |   sscanf(str,"%d",&num);
      |          ^~~
      |          str2
main.c:7:10: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:20: error: stray '\' in program
    9 |   while(str2[i] != \0)
      |                    ^
main.c:17:27: error: expected ')' before '}' token
   17 |       printf("%c",'A'+num1
      |             ~             ^
      |                           )
   18 |     }
      |     ~                      
main.c:17:27: error: expected ';' before '}' token
   17 |       printf("%c",'A'+num1
      |                           ^
      |                           ;
   18 |     }
      |     ~                      
main.c:19:10: error: expected ';' before '}' token
   19 |       i++
      |          ^
      |          ;
   20 |   }
      |   ~
Language: C++

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

int main() {
    int N;
    string S;
    cin >> N, S;
    SizeS = S.size() + 1;
    rep(i, SizeS){
        S.at(i) = S,at(i) + N;
    }
    cout << S;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:5: error: 'SizeS' was not declared in this scope
    9 |     SizeS = S.size() + 1;
      |     ^~~~~
a.cc:11:19: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} in assignment
   11 |         S.at(i) = S,at(i) + N;
      |                   ^
      |                   |
      |                   std::string {aka std::__cxx11::basic_string<char>}
a.cc:11:21: error: 'at' was not declared in this scope
   11 |         S.at(i) = S,at(i) + N;
      |                     ^~
Language: C++

#include <stdio.h>
int main()
{
char str[10000];
int N;
scanf("%d",&N);
scanf("%s",str);
for (int count=0;count<10000;count++)
{
	if(str[count]>='A')&&(str[count]<='Z')
	{
		str[count]+=N;
		if(str[count]>'Z')
		{
			str[count]-=26;
		}
		printf("%c",str[count]);
	}
	else break;
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:30: error: expected identifier before '(' token
   10 |         if(str[count]>='A')&&(str[count]<='Z')
      |                              ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define fs first
#define sc second
typedef vector<ll> vl;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<tuple<ll,ll>> vtl;
typedef pair<ll, ll> l_l;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

void solve(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    rep(i,s.size()){
        if(s[i]-'A'+n<=25)s[i]=s[i]+n;
        else s[i]='A'+n-(26-(s[i]-'A'));
    }
    cout<<s<<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<stdio.h>
int main(void)
{
  int i=0,num;
  char str1[8],str2[12000];
  fgts(str1,sizeof(str),stdin);
  sscanf(str,"%d",&num);
  fgets(str2,sizeof(str),stdin);
  while(str2[i] != \0)
  {
    printf("%c",str2[i]+num);
    i++
  }
  printf("\n");
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:6:3: error: implicit declaration of function 'fgts'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    6 |   fgts(str1,sizeof(str),stdin);
      |   ^~~~
      |   fgets
main.c:6:20: error: 'str' undeclared (first use in this function); did you mean 'str2'?
    6 |   fgts(str1,sizeof(str),stdin);
      |                    ^~~
      |                    str2
main.c:6:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:20: error: stray '\' in program
    9 |   while(str2[i] != \0)
      |                    ^
main.c:12:8: error: expected ';' before '}' token
   12 |     i++
      |        ^
      |        ;
   13 |   }
      |   ~
Language: C++

#include <stdio.h>
char str[10000];
int N;
scanf("%d",&N);
scanf("%s",str);
for (int count=0;count<10000;count++)
{
	if(str[count]>='A')&&(str[count]<='Z')
	{
		str[count]+=N;
		if(str[count]>'Z')
		{
			str[count]-=26;
		}
		printf("%c",str[count]);
	}
	else break;
}


Compiler output:
a.cc:4:6: error: expected constructor, destructor, or type conversion before '(' token
    4 | scanf("%d",&N);
      |      ^
a.cc:5:6: error: expected constructor, destructor, or type conversion before '(' token
    5 | scanf("%s",str);
      |      ^
a.cc:6:1: error: expected unqualified-id before 'for'
    6 | for (int count=0;count<10000;count++)
      | ^~~
a.cc:6:18: error: 'count' does not name a type
    6 | for (int count=0;count<10000;count++)
      |                  ^~~~~
a.cc:6:30: error: 'count' does not name a type
    6 | for (int count=0;count<10000;count++)
      |                              ^~~~~
Language: C++

//おまじないc++
#include <iostream>
#include<cmath>
#include<vector>
#include <algorithm>
using namespace std;
 
int main() {
  int n;
  cin>>n;
  string s;
  cin>>s;
  int siz=s.size();
    
  
  vec<char> alp(26);
  
  alp.at(0)='A';
  
  for(int i=1;i<26;i++){
    alp.at(i)='A'+i;
  }
  
  for(int i=0;i<siz;i++){
    for(int j=0;j<26;j++){
      if(s.at(i)==alp.at(j)){
        cout<<alp.at((j+n)%26);
        break;
      }
    }
  }
}
  
  
  

Compiler output:
a.cc: In function 'int main()':
a.cc:16:3: error: 'vec' was not declared in this scope
   16 |   vec<char> alp(26);
      |   ^~~
a.cc:16:7: error: expected primary-expression before 'char'
   16 |   vec<char> alp(26);
      |       ^~~~
a.cc:18:3: error: 'alp' was not declared in this scope
   18 |   alp.at(0)='A';
      |   ^~~
Language: C++

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


int main()
{
	
	int n;
	std::string a;
	std::cin >> n >> a;
	for (int i = 0; i < a.length; i++)
	{
		if (a[i] == 'Z')
		{
			a[i] = 'A'+n-1;
		}
		else a[i] = a[i] + n;
	}
	std::cout <<a << std::endl;
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:31: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   15 |         for (int i = 0; i < a.length; i++)
      |                             ~~^~~~~~
      |                                     ()
Language: C++

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

int main() {

	string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZA";

	int N = 0;
	cin >> N;

	string str;
	cin >> str;

	for (int i = 0; i < str.size(); i++) {
		str[i] = *(find(alphabet.begin(), alphabet.end(), str[i]) + N);
	}

	cout << str << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:32: error: no matching function for call to 'find(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
   16 |                 str[i] = *(find(alphabet.begin(), alphabet.end(), str[i]) + N);
      |                            ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:16:32: note:   '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   16 |                 str[i] = *(find(alphabet.begin(), alphabet.end(), str[i]) + N);
      |                            ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(void)
{
	int n;
  	string s;
  	cin >> n >> s;
  	for(int i=0;i<s.size();i++){
   		int temp=(int)s[i];
      	temp+=n;
      	if(temp<=90)
          	s[i]=(char)temp;
      	else
          	s[i]=(char)(temp-26);
    }
  	cout << s[i];
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:19: error: 'i' was not declared in this scope
   17 |         cout << s[i];
      |                   ^
Language: C++

n = int(input())
s = input()
t =''
for c in s:
    temp = ord(c) + n
    if temp>90:temp-=26
    t = t + chr(temp)
print(t)

Compiler output:
a.cc:3:4: error: empty character constant
    3 | t =''
      |    ^~
a.cc:1:1: error: 'n' does not name a type
    1 | n = int(input())
      | ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n;
string s;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n >> s;
    int len = s.length();
    for (int i = 0; i < len; i++) {
        s[i] = ((s[i] - 'A') + N)%26 + 'A';
    }
    cout << s << E;
    //system("pause");
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:32: error: 'N' was not declared in this scope
   20 |         s[i] = ((s[i] - 'A') + N)%26 + 'A';
      |                                ^
Language: C++

#include <iostream>
#include <string>
#include <map>

int main()
{
	using i32 = std::int32_t;
	using str = std::string;
	using ch = str::value_type;

	i32 N;
	std::cin >> N;

	str S;
	std::cin >> S;

	std::map<ch, ch> convert;
	for (i32 i = 0; i < 26; ++i)
	{
		convert['A' + i] = 'A' + (i + N) % 26;
	}

	for (auto&& CH : S)
	{
		std::cout << convert[CH];
	}
	std::cout << std::endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:26: error: 'int32_t' in namespace 'std' does not name a type
    7 |         using i32 = std::int32_t;
      |                          ^~~~~~~
a.cc:11:9: error: 'i32' was not declared in this scope
   11 |         i32 N;
      |         ^~~
a.cc:12:21: error: 'N' was not declared in this scope
   12 |         std::cin >> N;
      |                     ^
a.cc:18:17: error: expected ';' before 'i'
   18 |         for (i32 i = 0; i < 26; ++i)
      |                 ^~
      |                 ;
a.cc:18:25: error: 'i' was not declared in this scope
   18 |         for (i32 i = 0; i < 26; ++i)
      |                         ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n;
    string s;
    cin >> n >> s;
    rep(i, s.size()) {
        char c = s[i];
        c += n;
        if (c - 'A' >= 26) c -= 26;
        cout << c;
    }
    cout << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'i' was not declared in this scope
    7 |     rep(i, s.size()) {
      |         ^
a.cc:7:5: error: 'rep' was not declared in this scope
    7 |     rep(i, s.size()) {
      |     ^~~
Language: C++

///Mn kotr el labawy mb2t4 nawy
#include<bits/stdc++.h>

#define ll long long
using namespace std;
const int N = 2e5 + 5;
const int MOD =  998244353;

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

  int  n; cin >> n;
  cin >> s;
  
  for(auto & c : s){
    c -= 'a';
    c += n;
    c %= 26;
    c += 'a';
  }
  cout << s << endl;
  
  return 0;
}


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

#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ii pair<int,int>
//#define int long long
using namespace std;
int main(){
    int n;
  string str;
  cin >> n >> str;
  for(int i=0;i<str.size();i++){
    if(str[i]+n<='Z')
    cout << str[i]+n
    else cout << str[i]+n-'Z'+'A'-1;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: expected ';' before 'else'
   13 |     cout << str[i]+n
      |                     ^
      |                     ;
   14 |     else cout << str[i]+n-'Z'+'A'-1;
      |     ~~~~
Language: C++

#include <iostream>

int main()
{
	char s[1024];
	char e[1024];

	int delta;
	scanf("%d, %s",&delta, s);

	for (int i = 0; i < strlen(s); i++) {
		e[i] = s[i] + delta;
	}

	printf("%s", e);

}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:29: error: 'strlen' was not declared in this scope
   11 |         for (int i = 0; i < strlen(s); i++) {
      |                             ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |
Language: C++

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <atcoder/all>
//using namespace atcoder;
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

template <typename T>
bool chmax(T &a, const T& b) {if (a < b) {a = b;return true;}return false;}

int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    int n;
    cin>>n;
    vector<P> a(n);
    vector<vector<int>> g(n,vector<int>(0));
    int x,y;
    rep(i,n-1){
        cin>>x>>y;
        a[i]=P(x-1,y-1);
        g[x-1].emplace_back(y-1);
        g[y-1].emplace_back(x-1);
    }
    int num_col=0;
    int par=-1;
    rep(i,n){
        x=g[i].size();
        if(chmax(num_col,x)) par=i;
    }
    cout<<num_col<<endl;
    map<P,int> col;
    int cnt=0;
    queue<P> que;
    que.emplace(par,0);
    while(cnt<n-1){
        tie(x,y)=que.front();
        que.pop();
        int now=1;
        for(auto z:g[x]){
            if(col[P(x,z)] || col[P(z,x)]) continue;
            if(now==y) now ++;
            col[P(x,z)]=now;
            cnt ++;
            que.emplace(z,now);
            now ++;
        }
    }
    rep(i,n-1){
        tie(x,y)=a[i];
        cout<<max(col[P(x,y)],col[P(y,x)]<<endl;
    }
}/*
./problem.exe
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:67:42: error: invalid operands of types 'std::map<std::pair<int, int>, int>::mapped_type' {aka 'int'} and '<unresolved overloaded function type>' to binary 'operator<<'
   67 |         cout<<max(col[P(x,y)],col[P(y,x)]<<endl;
Language: C++

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) (((n) >> (k)) & 1) /*nのk bit目*/
namespace mydef {
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
bool dbg = true;
}  // namespace mydef
using namespace mydef;
#define pb push_back
//#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
#define pi pair<int, int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define asn ans

#include "/home/khorie/mylibrary/graph/Graph.hpp"

int N;
Graph<int> G;
int ans[202020];

void f(int idx = 0, int par = -1, int clr = 0) {
    int tmp = 1;
    for (auto& nxt : G[idx]) {
        if (nxt == par)
            continue;
        while (tmp == clr)
            tmp++;
        f(nxt, idx, tmp);
        ans[nxt.id] = tmp;
        tmp++;
    }
}

void solve() {
    f();
    for (int i = 0; i < N - 1; i++) {
        cout << ans[i] << endl;
    }
}

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

    cin >> N;
    G.build_tree(N);

    solve();
    return 0;
}


Compiler output:
a.cc:80:10: fatal error: /home/khorie/mylibrary/graph/Graph.hpp: No such file or directory
   80 | #include "/home/khorie/mylibrary/graph/Graph.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<vector>
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define mk make_pair
#define fastio ios_base::sync_with_stdio(false); cout.tie(NULL);
using namespace std;

int main()
{
	fastio;
	
	int n,a,b,i,j,mn=-1;
	cin>>n;
	vector<int> ar[n+1];
	vector<pair<int,int>> v;
	
	for(i=0;i<n-1;i++)
		cin>>a>>b , ar[a].pb(b) , ar[b].pb(a) , v.pb({a,b});
	
	for(i=1;i<=n;i++)
	{
		int tmp=ar[i].size();
		mn=max(mn,tmp);
	}
	
	int vis[mn];
	map<pair<int,int>,int> mp,ans;
	
	for(i=1;i<=n;i++)
	{
		memset(vis,0,sizeof(int)*ar[i].size());
		
		for(auto el : ar[i])
		{
			if(ans.find({i,el})!=ans.end())
				vis[ans[{i,el}]-1]=1;
			else if(ans.find({el,i})!=ans.end())
				vis[ans[{el,i}]-1]=1;
		}
		
		for(auto el : ar[i])
		{
			if(mp.find({i,el})==mp.end() && mp.find({el,i})==mp.end())
			{
				int start = lower_bound(vis,vis+mn)
				for(j=0;j<ar[i].size();j++)
				{
					if(vis[j]==0)
					{
						ans[{i,el}]=ans[{el,i}]=j+1;
						vis[j]=1;
						mp[{el,i}]=mp[{i,el}]=1;
						break;
					}
				}
			}
		}
	}
	
	cout<<mn<<"\n";
	for(auto pair : v)
		cout<<ans[pair]<<"\n";
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:56: error: no matching function for call to 'lower_bound(int [mn], int*)'
   48 |                                 int start = lower_bound(vis,vis+mn)
      |                                             ~~~~~~~~~~~^~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1530 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:1963:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1963:5: note:   candidate expects 4 arguments, 2 provided
a.cc:49:59: error: expected ';' before ')' token
   49 |                                 for(j=0;j<ar[i].size();j++)
      |                                                           ^
      |                                                           ;
Language: C++

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

int main() {
  int n;
  cin >> n;
  vector<vector<int>> v(n),edx(n-1),edy(n-1);
  rep(i,n-1){
      int x,y;
      x--;y--;
      edx[i].push_back(i);edy[i].push_back(i);
      v[x].push_back(i);
      v[y].push_back(i);
  }
  int cans=0;
  rep(i,n) cans=max(cans,ount(v[i].begin(),v[i].end()));
  vector<int> ans(n);
  ans[0]=1;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:26: error: 'ount' was not declared in this scope
   19 |   rep(i,n) cans=max(cans,ount(v[i].begin(),v[i].end()));
      |                          ^~~~
Language: C++

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

int main() {
  int n;
  cin >> n;
  vector<vector<int>> v(n),edx(n-1),edy(n-1);
  rep(i,n-1){
      int x,y;
      x--;y--;
      edx[i].push_back(i);edy[i].push_back(i);
      v[x].push_back(i);
      v[y].push_back(i);
  }
  int cans=0;
  rep(i,n) chmax(cans,v[i].count());
  vector<int> ans(n);
  ans[0]=1;
  
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:19:28: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'count'
   19 |   rep(i,n) chmax(cans,v[i].count());
      |                            ^~~~~
a.cc:19:12: error: 'chmax' was not declared in this scope
   19 |   rep(i,n) chmax(cans,v[i].count());
      |            ^~~~~
Language: C++

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//using namespace boost::multiprecision;
typedef long long int ll;
typedef long double ld;
#define PI 3.141592653589793
#define MOD 1000000007
#define ALL(obj) (obj).begin(),(obj).end()
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;}
const ll INF = 1LL << 60;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
bool pairCompareSecond(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.second < secondElof.second;
}
//四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct edge{//グラフに使うヤツ
    ll from,to,cost;
};

typedef vector<vector<edge> > G;
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

int main(){
    ll n;
    cin >> n;
    pair<ll,ll> g[n];
    vector<ll> ki[n];
    for (ll i=0;i<n-1;i++){
        ll a,b;
        cin >> a >> b;
        g[i]=make_pair(a-1,b-1);
        ki[b-1].push_back(i);
        ki[a-1].push_back(i);
    }
    ll color[n];
    fill(color,color+n,-1);
    queue<ll> que;
    que.push(0);
    color[0]=1;
    bool visited[n];
    fill(visited,visited+n,true);
    visited[0]=false;
    while(!que.empty()){
        ll pa=que.front();
        ll x=g[pa].first;
        que.pop();
        ll p=1;
        for (ll i=0;i<ki[x].size();i++){
            if (visited[ki[x][i]]){
                if (p==color[x])p++;
                que.push(ki[x][i]);
                color[ki[x][i]]=p;
                p++;
                visited[ki[x][i]]=false;
            }
        }
        ll x=g[pa].second;
        ll p=1;
        for (ll i=0;i<ki[x].size();i++){
            if (visited[ki[x][i]]){
                if (p==color[x])p++;
                que.push(ki[x][i]);
                color[ki[x][i]]=p;
                p++;
                visited[ki[x][i]]=false;
            }
        }
    }
    ll ans=0;
    for (ll i=0;i<n-1;i++){
        ans=max(ans,color[i]);
    }
    cout << ans << endl;
    for (ll i=0;i<n-1;i++){
        cout << color[i] << endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:67:12: error: redeclaration of 'll x'
   67 |         ll x=g[pa].second;
      |            ^
a.cc:55:12: note: 'll x' previously declared here
   55 |         ll x=g[pa].first;
      |            ^
a.cc:68:12: error: redeclaration of 'll p'
   68 |         ll p=1;
      |            ^
a.cc:57:12: note: 'll p' previously declared here
   57 |         ll p=1;
      |            ^
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << -1; return;}
#define yes {cout << "Yes"; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

const int N = 1e5 + 7;

int ans[N];

void dfs(int v, int p, int c) {
    ans[v] = c;
    for (int u : g[v])
        if (u != p)
            dfs(u, v, 3 - c);
}

void solve() {
    int n; cin >> n;
    loop(i, n - 1) {
        int u, v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    dfs(1, 1, 1);
    loop1(i, n)
        cout << ans[i] << " ";
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void dfs(ll, ll, ll)':
a.cc:50:18: error: 'g' was not declared in this scope
   50 |     for (int u : g[v])
      |                  ^
a.cc: In function 'void solve()':
a.cc:60:9: error: 'g' was not declared in this scope
   60 |         g[u].pb(v);
      |         ^
Language: C++

//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int n,k;
vector<int> adj[MAX];
int parent[MAX]={0};
bool vis[MAX]={0};
void bfs(int s){
	queue<int> q;
	q.push(s);
	vis[s]=true;
	while(!q.empty()){
		int x=q.front();
		q.pop();
		if(k<(int)adj[x].size())
			k=adj[x].size();
		int curr=1;
		for(int i=0;i<adj[x].size();i++){
			if(curr==parent[x])
				curr++;
			if(vis[adj[x][i]]==0){
				q.push(adj[x][i]);
				vis[adj[x][i]]=true;
				parent[adj[x][i]]=curr;
				curr++;
			}
		}
	}
	return 0;
}
int solve()
{
	cin>>n;
	int a[n],b[n];
	for(int i=0;i<n-1;i++)
	{
		cin>>a[i]>>b[i];
		adj[a[i]].pb(b[i]);
		adj[b[i]].pb(a[i]);
	}
	bfs(a[0]);
	cout<<k<<endl;
	for(int i=2;i<=n;i++)	cout<<parent[i]<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}






Compiler output:
a.cc: In function 'void bfs(long long int)':
a.cc:69:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   69 |         return 0;
      |                ^
Language: C++

//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int n,k;
vector<int> adj[MAX];
int parent[MAX]={0};
bool vis[MAX]={0};
void bfs(int s){
	queue<int> q;
	q.push(s);
	vis[s]++;
	while(!q.empty()){
		int x=q.front();
		q.pop();
		if(k<(int)adj[x].size())
			k=adj[x].size();
		int curr=1;
		for(int i=0;i<adj[x].size();i++){
			if(curr==parent[x])
				curr++;
			if(vis[adj[x][i]]==0){
				q.push(adj[x][i]);
				vis[adj[x][i]]=1;
				parent[adj[x][i]]=curr;
				curr++;
			}
		}
	}
	return 0;
}
int solve()
{
	cin>>n;
	int a[n],b[n];
	for(int i=0;i<n-1;i++)
	{
		cin>>a[i]>>b[i];
		adj[a[i]].pb(b[i]);
		adj[b[i]].pb(a[i]);
	}
	bfs(a[0]);
	cout<<k<<endl;
	for(int i=2;i<=n;i++)	cout<<parent[i]<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}






Compiler output:
a.cc: In function 'void bfs(long long int)':
a.cc:51:14: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   51 |         vis[s]++;
      |         ~~~~~^
a.cc:69:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   69 |         return 0;
      |                ^
Language: C++

//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include<stdlib.h>
#include<stdio.h>
#define test ll t; cin>>t; while(t--)
#define FOR(p,n) for(ll i=p;i<(ll)n;i++)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int n,k;
vector<int> adj[MAX];
int parent[MAX]={0};
bool vis[MAX]={0};
void bfs(int s){
	queue<int> q;
	q.push(s);
	vis[s]++;
	while(!q.empty()){
		int x=q.front();
		q.pop();
		if(k<(int)adj[x].size())
			k=adj[x].size();
		int curr=1;
		for(int i=0;i<adj[x].size();i++){
			if(curr==parent[x])
				curr++;
			if(vis[adj[x][i]]==0){
				q.push(adj[x][i]);
				vis[adj[x][i]]=1;
				parent[adj[x][i]]=curr;
				curr++;
			}
		}
	}
}
int solve()
{
	cin>>n;
	int a[n],b[n];
	for(int i=0;i<n-1;i++)
	{
		cin>>a[i]>>b[i];
		adj[a[i]].pb(b[i]);
		adj[b[i]].pb(a[i]);
	}
	bfs(a[0]);
	cout<<k<<endl;
	for(int i=2;i<=n;i++)	cout<<parent[i]<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}






Compiler output:
a.cc: In function 'void bfs(long long int)':
a.cc:51:14: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
   51 |         vis[s]++;
      |         ~~~~~^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> V;
typedef pair<int,int> P;
typedef vector<vector<int>> Graph;

struct Edge {
    int to ,id;
};

vector<vector<Edge>> g;
vector<int> ans;

void dfs(int v, int c=-1, int p=-1){
    int k=1;
    rep(i,g[v].size()){
        int u = g[v][i].to, ei = g[v][i].id;
        if(u==p) continue;
        if(k == c) ++k;
        ans[ei] = k; k++;
        dfs(u,ans[ei],v);
    }
}

int main() {
    int n;
    cin >> n;
    g.resize(n)
    ans = vector<int>(n-1);
    rep(i,n-1) {
        int a,b;
        cin >> a >> b;
        --a;--b;
        g[a].push_back((Edge){b,i});
        g[b].push_back((Edge){a,i});
    }
    dfs(0);
    int mx =0;
    rep(i,n) mx = max(mx,int(g[i].size()));
    cout << mx << endl;
    rep(i,n-1){
        cout << ans[i] << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:16: error: expected ';' before 'ans'
   31 |     g.resize(n)
      |                ^
      |                ;
   32 |     ans = vector<int>(n-1);
      |     ~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> V;
typedef pair<int,int> P;
typedef vector<vector<int>> Graph;

struct Edge {
    int to ,id;
};

vector<vector<Edge>> g;
vector<int> ans;

void dfs(int v, int c=-1, int p=-1){
    int k=1;
    rep(i,g[v].size()){
        int u = g[v][i].to, ei = g[v][i].id;
        if(u==p) continue;
        if(k == c) ++k;
        ans[ei] = k; k++;
        dfs(u,ans[ei],v)
    }
}

int main() {
    int n;
    cin >> n;
    g.resize(n)
    ans = vector<int>(n-1);
    rep(i,n-1) {
        int a,b;
        cin >> a >> b;
        --a;--b;
        g[a].push_back((Edge){b,i});
        g[b].push_back((Edge){a,i});
    }
    dfs(0);
    int mx =0;
    rep(i,n) mx = max(mx,int(g[i].size()));
    cout << mx << endl;
    rep(i,n-1){
        cout << ans[i] << endl;
    }
}

Compiler output:
a.cc: In function 'void dfs(int, int, int)':
a.cc:24:25: error: expected ';' before '}' token
   24 |         dfs(u,ans[ei],v)
      |                         ^
      |                         ;
   25 |     }
      |     ~                    
a.cc: In function 'int main()':
a.cc:31:16: error: expected ';' before 'ans'
   31 |     g.resize(n)
      |                ^
      |                ;
   32 |     ans = vector<int>(n-1);
      |     ~~~