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

#include<stdio.h>

int main(void){
 int n,a[1001],i,j,b,c,min;

 while(1){
  scanf_s("%d",&n);
  min=1000000;

  if(n==0){
   break;
  }
  for(i=0;i<n;i++){
   scanf_s("%d",&a[[i]);
  }
  for(i=0;i<n;i++){
   for(j=n-1;j>i;j--){
    if(a[j-1]<a[j]){
     b=a[j-1];a[j-1]=a[j];a[j]=b;
    }
   }
  }
  for(i=0;i<n;i++){
   c=a[i]-a[i+1];
   if(min>c){
    min=c;
   }
  }
  printf("%d\n",min);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    7 |   scanf_s("%d",&n);
      |   ^~~~~~~
      |   scanf
a.cc:14:19: error: two consecutive '[' shall only introduce an attribute before '[' token
   14 |    scanf_s("%d",&a[[i]);
      |                   ^
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:3:15: note: to match this '{'
    3 | int main(void){
      |               ^
Language: C++

#include<stdio.h>

int main(void){
 int n,a[1001],i,j,b,c,min;

 while(1){
  scanf("%d",&n);
  min=1000000;

  if(n==0){
   break;
  }
  for(i=0;i<n;i++){
   scanf("%d",&a[i]);
  }
  for(i=0;i<n;i++){
   for(j=n-1;j>i;j--){
    if(a[j-1]<a[j]){
     b=a[j-1];a[j-1]=a[j];a[j]=b;
    }
   }
  }
  for(i=0;i<n;i++){
   c=a[i]-a[i+1];
   if(min>c){
    min=c;
   }
  }
  printf("%d\n",min);
}

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

#include<stdio.h>

int main(void){
 int n,a[1001],i,j,b,c,min;

 while(1){
  scanf("%d",&n);
  min=1000000;

  if(n==0){
   break;
  }
  for(i=0;i<n;i++){
   scanf("%d",&a[i]);
  }
  for(i=0;i<n-1;i++){
   for(j=n-1;j>i;j--){
    if(a[j-1]<a[j]){
     b=a[j-1];a[j-1]=a[j];a[j]=b;
    }
   }
  }
  for(i=0;i<n;i++){
   c=a[i]-a[i+1];
   if(min>c){
    min=c;
   }
  }
  printf("%d\n",min);
}

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


def solve(N):
    A = list(map(int, input().split()))
    ans = 1e9
    for i in range(N):
        for j in range(N):
            if i != j:
                d = abs(A[i] - A[j])
                if ans > d:
                    ans = d
    print(ans)

while True:
    N = int(input())
    if N > 0:
        solve(N)
    else:
        break

Compiler output:
a.cc:2:1: error: 'def' does not name a type
    2 | def solve(N):
      | ^~~
Language: C++

#include<iostream>
#include<cstdlib>
using namespace std;
int main(){
	int n;
	int a[1000];

	while(1){
		cin>>n;

		if(n==0)
			break;

		for(int i=0;i<n;i++){
			cin>>a[i];
		}

		int diff=1000000;

		for(int i=0;i<(n-1);i++){
			for(int j=i+1;j<n;j++){
				if(diff>abs(a[i]-[j]))
					diff=abs(a[i]-a[j]);
			}
		}

		cout<<diff<<endl;
	
	}

	return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:22:53: error: expected '{' before ')' token
   22 |                                 if(diff>abs(a[i]-[j]))
      |                                                     ^
a.cc: In function 'int main()':
a.cc:22:49: error: no match for 'operator-' (operand types are 'int' and 'main()::<lambda()>')
   22 |                                 if(diff>abs(a[i]-[j]))
      |                                             ~~~~^~~~
      |                                                | |
      |                                                | main()::<lambda()>
      |                                                int
In file included from /usr/include/c++/14/string:48,
                 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_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:22:53: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
   22 |                                 if(diff>abs(a[i]-[j]))
      |                                                     ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:22:53: note:   mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
   22 |                                 if(diff>abs(a[i]-[j]))
      |                                                     ^
Language: C++

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

int main(){
	while(1){
		int n;
		cin>>n;
		if(n==0)
			break:
		int a[n];
		for(int i=0;i<n;i++){
			cin>>a[i];
		}
		int s=1000001;
		for(int i=0;i<n;i++){
			for(int j=0;j<n-1;j++){
				if(s>abs(a[i]-a[j])){
					s=abs(a[i]-a[j]);
				}
			}
		}
		cout<<s<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:30: error: expected ';' before ':' token
   10 |                         break:
      |                              ^
      |                              ;
a.cc:10:30: error: expected primary-expression before ':' token
a.cc:13:30: error: 'a' was not declared in this scope
   13 |                         cin>>a[i];
      |                              ^
a.cc:18:42: error: 'a' was not declared in this scope
   18 |                                 if(s>abs(a[i]-a[j])){
      |                                          ^
Language: C++

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

int main(){
	while(1){
		int n;
		cin>>n;
		if(n==0)
			break:
		int a[1000];
		for(int i=0;i<n;i++){
			cin>>a[i];
		}
		int s=1000001;
		for(int i=0;i<n;i++){
			for(int j=0;j<n-1;j++){
				if(s>abs(a[i]-a[j])){
					s=abs(a[i]-a[j]);
				}
			}
		}
		cout<<s<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:30: error: expected ';' before ':' token
   10 |                         break:
      |                              ^
      |                              ;
a.cc:10:30: error: expected primary-expression before ':' token
a.cc:13:30: error: 'a' was not declared in this scope
   13 |                         cin>>a[i];
      |                              ^
a.cc:18:42: error: 'a' was not declared in this scope
   18 |                                 if(s>abs(a[i]-a[j])){
      |                                          ^
Language: C++

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

int main(){
	while(1){
		int n;
		cin>>n;
		
		if(n==0){
			break;
		}
		
		int a[1000];
		for(int i=0;i<n;i++){
			cin>>a[i];
		}
		int dif=10000000;
		for(int i=0;i<n-1;i++){
			for(int j=i+1;j<n;j++){
				int =abs(a[i]-a[j]);
				if(d<dif){
					dif=d;
				}
			}
		}
		cout<<if<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:37: error: expected unqualified-id before '=' token
   21 |                                 int =abs(a[i]-a[j]);
      |                                     ^
a.cc:22:36: error: 'd' was not declared in this scope
   22 |                                 if(d<dif){
      |                                    ^
a.cc:27:23: error: expected primary-expression before 'if'
   27 |                 cout<<if<<endl;
      |                       ^~
Language: C++

#include "stdafx.h"
#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{

	int n = 1;
	
	while (cin >> n) {
		int ans = 1000001;
		if (n == 0)
			break;
		int a[1000];
		for (int i = 0;i < n;i++) {
			cin >> a[i];
		}
		for (int i = 0;i < n - 1;i++) {
			for (int j = i + 1;j < n;j++) {
				if (ans > abs(a[i] - a[j]))
					ans = abs(a[i] - a[j]);
			}
		}
			cout << ans << endl;

	}
	return 0;
}

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

void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  
  while(1){
    int n; rd(n); if(n==0) break;
    auto a=readln.split.to!(int[]);
    sort(a);
    int mn=1_000_000_000;
    foreach(i; 0..(n-1)) mn=min(mn, a[i+1]-a[i]);
    writeln(mn);
  }
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
void wr(T...)(T x){
  import std.stdio;
  foreach(e; x) write(e, " ");
  writeln();
}

Compiler output:
a.cc:9:16: error: too many decimal points in number
    9 |     foreach(i; 0..(n-1)) mn=min(mn, a[i+1]-a[i]);
      |                ^~~
a.cc:1:1: error: '::main' must return 'int'
    1 | void main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:2:3: error: 'import' was not declared in this scope
    2 |   import std.stdio, std.string, std.conv, std.algorithm;
      |   ^~~~~~
a.cc:5:12: error: 'rd' was not declared in this scope
    5 |     int n; rd(n); if(n==0) break;
      |            ^~
a.cc:6:12: error: 'readln' was not declared in this scope
    6 |     auto a=readln.split.to!(int[]);
      |            ^~~~~~
a.cc:7:5: error: 'sort' was not declared in this scope; did you mean 'short'?
    7 |     sort(a);
      |     ^~~~
      |     short
a.cc:8:12: error: unable to find numeric literal operator 'operator""_000_000_000'
    8 |     int mn=1_000_000_000;
      |            ^~~~~~~~~~~~~
a.cc:9:13: error: 'i' was not declared in this scope
    9 |     foreach(i; 0..(n-1)) mn=min(mn, a[i+1]-a[i]);
      |             ^
a.cc:10:5: error: 'writeln' was not declared in this scope
   10 |     writeln(mn);
      |     ^~~~~~~
a.cc: At global scope:
a.cc:14:6: error: variable or field 'rd' declared void
   14 | void rd(T...)(ref T x){
      |      ^~
a.cc:14:9: error: 'T' was not declared in this scope
   14 | void rd(T...)(ref T x){
      |         ^
a.cc:22:6: error: variable or field 'wr' declared void
   22 | void wr(T...)(T x){
      |      ^~
a.cc:22:9: error: 'T' was not declared in this scope
   22 | void wr(T...)(T x){
      |         ^
Language: C++

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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-6;

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

const int64 mod = 1e9+7;

int main(void){
	int32 N;
	while(cin >> N && N){
		vector<int32> x(N);
		REP(i, N) cin >> x[i];
		int32 res = 0;
		sort(all(x));
		REP(i, n-1) res = min(res, x[i+1]-x[i]);
		cout << res << endl;
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:24: error: 'n' was not declared in this scope
   33 |                 REP(i, n-1) res = min(res, x[i+1]-x[i]);
      |                        ^
a.cc:6:38: note: in definition of macro 'REP'
    6 | #define REP(i, n) for(int i = 0;i < (n);i++)
      |                                      ^
Language: C++

int main(){
  int a[1001];

  int c[1001];

  int b, mn;

  mn = 1000000;

  while(1){

    cin >> b;

    if(b == 0) break;

    for(int i=0;i<b;i++){
      cin >> a[i];
    }
    for(int j=0;j<b+1;j++){
      for(int i=0;i<b;i++){
	if(a[i] < a[i+1]) swap(a[i],a[i+1]);
      }
    }
    for(int i=0;i<b-1;i++){
      c[i] = a[i] - a[i+1];
    }

    for(int i=0;i<b-1;i++){
      if(c[i]<mn) mn = c[i];
    }

    cout << mn << endl;

  }


}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'cin' was not declared in this scope
   12 |     cin >> b;
      |     ^~~
a.cc:21:27: error: 'swap' was not declared in this scope
   21 |         if(a[i] < a[i+1]) swap(a[i],a[i+1]);
      |                           ^~~~
a.cc:32:5: error: 'cout' was not declared in this scope
   32 |     cout << mn << endl;
      |     ^~~~
a.cc:32:19: error: 'endl' was not declared in this scope
   32 |     cout << mn << endl;
      |                   ^~~~
Language: C++

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

int main() {
    int n;
    while (cin >> n, n) {
        vector<int> a(n);
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        sort(a.begin(), a.end());
        int ans = 1 << 20A;
        for (int i = 0; i + 1 < n; i++) {
            ans = min(ans, a[i + 1] - a[i]);
        }
        cout << ans << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:24: error: unable to find numeric literal operator 'operator""A'
   12 |         int ans = 1 << 20A;
      |                        ^~~
Language: C++

import java.util.*;                                                              
  public class Main{
  public static void main(String args[]) throws Exception{
  Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();sc.nextLine();
  while(N!=0){
   int[] array = new int[N];
   String s = sc.nextLine();
   String[] a = s.split(" ");
   for(int i=0;i<N;i++){
    array[i]=Integer.parseInt(a[i]);
   }
   Arrays.sort(array);
   int abs= 1000;
   for(int k=0;k<N-1;k++){
    if(abs>array[k+1]-array[k]){
    abs=array[k+1]-array[k];
    }
   }
 System.out.println(abs);
 N = sc.nextInt();sc.nextLine();
 }
}
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:3: error: expected unqualified-id before 'public'
    2 |   public class Main{
      |   ^~~~~~
Language: C++

#include<iostream>
#include<algorithm>
#define SEISEKI 10000000

using namespace std;

int main() {
	while (1) {
		int n;
		int ans=SEISEKI;

		cin >> n;
		int a[1001];
		if (n == 0)break;
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}

		int ans = a[1] - a[0];

		sort(a, a+n);	//昇順

		for (int i = 0; i<n; i++) {
			for (int j = i + 1; j < n; j++) {
				ans = min(ans, abs(a[i] - a[j]));
			}
		}
		cout << ans<<endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:21: error: redeclaration of 'int ans'
   19 |                 int ans = a[1] - a[0];
      |                     ^~~
a.cc:10:21: note: 'int ans' previously declared here
   10 |                 int ans=SEISEKI;
      |                     ^~~
Language: Java

import java.util.Arrays;
import java.util.Scanner;

public class B {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (true) {
            int n = sc.nextInt();

            if (n == 0)
                break;

            SortMap[] list = new SortMap[26];
            for (int i = 'A'; i <= 'Z'; i++) {
                list[i - 65] = new SortMap((char)i);
            }

            int i = 0;
            for (i = 0; i < n; i++) {
                int a = (int) sc.next().charAt(0);
                for (SortMap m: list) {
                    if (m.i == a) {
                        m.n ++;
                        break;
                    }
                }
                Arrays.sort(list);
                SortMap sa = list[0];
                SortMap sb = list[1];
                // System.out.println(sa);
                // System.out.println(sb);
                if (sa.n > sb.n + (n - i - 1)) {
                    for (int j = 0; j < n - i - 1; j++) {
                        sc.next();
                    }
                    break;
                }
            }

            Arrays.sort(list);
            SortMap s1 = list[0];
            SortMap s2 = list[1];
            if (s1.n == s2.n) {
                System.out.println("TIE");
            } else {
                System.out.println(((char) s1.i) + " " + ((int)i + 1));
            }

//            for (int i = 0; i < n; i++) {
//                int tmp = (int)sc.next().charAt(0) -65;
//
//                nums[tmp]++;
//
//                if (first != tmp) {
//                    if (nums[second] < nums[tmp]) {
//                        if (nums[first] < nums[tmp]) {
//                            second = first;
//                            first = tmp;
//                        }
//                        else {
//                            if (second != tmp) {
//                                second = tmp;
//                            }
//                        }
//                    }
//                }
//
//                if (nums[first] > nums[second] + (n - i - 1)) {
//                    for (int j = 0; j < n - i - 1; j++) {
//                        sc.next();
//                    }
//                    break;
//                }
//            }
//
//            if (nums[first] == nums[second])
//                System.out.println("TIE");
//            else
//                System.out.println((char)(first+65) + " " + nums[first]);
        }
    }

    static class SortMap implements Comparable<SortMap> {
        public char i;
        public int n;

        public SortMap(char i) {
            this.i = i;
            this.n = 0;
        }

        @Override
        public String toString() {
            return "SortMap{" +
                    "i=" + i +
                    ", n=" + n +
                    '}';
        }
        @Override
        public int compareTo(SortMap o) {
            return o.n - this.n;
        }
    }
}

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

#include <stdio.h>

int main(void){
	int num, sum[30], first, second;
	char ch[101];

	while(1){
		scanf("%d", &num);
		if(num == 0) break;
		for(int i=0; i<num; i++){
			scanf(" %c", &ch[i]);

			ch[i] -= 'A';

		}

		for(int i=0; i<30; i++){
			sum[i] =0;
		}

		first = int(ch[0]);
		second = 29;
		for(int i=0; i<num; i++){
			sum[ch[i]]++;
			if(sum[ch[i]] > sum[first]){
				second = first;
				first = int(ch[i]);
			} else if(sum[second] < sum[ch[i]] && ch[i] != first){
				second = int(ch[i]);
			}
			if(sum[first] > sum[second] + num - i-1){
				printf("%c %d\n", first+'A', i+1);
				goto END;
			}
		}
		printf("TIE\n");
END:;
	}

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:21:25: error: expected expression before 'int'
   21 |                 first = int(ch[0]);
      |                         ^~~
main.c:27:41: error: expected expression before 'int'
   27 |                                 first = int(ch[i]);
      |                                         ^~~
main.c:29:42: error: expected expression before 'int'
   29 |                                 second = int(ch[i]);
      |                                          ^~~
Language: C

#include <stdio.h>

int main(void){
	int num, sum[30], first, second;
	char ch[101];

	while(1){
		scanf("%d", &num);
		if(num == 0) break;
		for(int i=0; i<num; i++){
			scanf(" %c", &ch[i]);
			ch[i] -= 'A';
		}

		for(int i=0; i<30; i++){
			sum[i] =0;
		}
		first = ch[0];
		second = 29;
		for(int i=0; i<num; i++){
			sum[ch[i]]++;
			if(sum[ch[i]] > sum[first]){
				second = first;
				first = ch[i];
			} else if(sum[second] < sum[ch[i]] && ch[i] != first){
				second = int(ch[i]);
			}
			if(sum[first] > sum[second] + num - i-1){
				printf("%c %d\n", first+'A', i+1);
				goto END;
			}
		}
		printf("TIE\n");
END:;
	}//endwhile

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:26:42: error: expected expression before 'int'
   26 |                                 second = int(ch[i]);
      |                                          ^~~
Language: C

#include <stdio.h>

int main(void){
	int num, sum[30], first, second;
	char ch[101];

	while(1){
		scanf("%d", &num);
		if(num == 0) break;
		for(int i=0; i<num; i++){
			scanf(" %c", &ch[i]);
			ch[i] -= 'A';

		}

		for(int i=0; i<30; i++){
			sum[i] =0;
		}
		first = int(ch[0]);
		second = 29;
		for(int i=0; i<num; i++){
			sum[ch[i]]++;
			if(sum[ch[i]] > sum[first]){
				second = first;
				first = int(ch[i]);
			} else if(sum[second] < sum[ch[i]] && ch[i] != first){
				second = int(ch[i]);
			}
			if(sum[first] > sum[second] + num - i-1){
				printf("%c %d\n", first+'A', i+1);
				goto END;
			}
		}
		printf("TIE\n");
END:;
	}//endwhile

	return 0;
}


Compiler output:
main.c: In function 'main':
main.c:19:25: error: expected expression before 'int'
   19 |                 first = int(ch[0]);
      |                         ^~~
main.c:25:41: error: expected expression before 'int'
   25 |                                 first = int(ch[i]);
      |                                         ^~~
main.c:27:42: error: expected expression before 'int'
   27 |                                 second = int(ch[i]);
      |                                          ^~~
Language: C++

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

struct Pair{
	int vote=0;
	char name;
};

bool cmp(Pair p1,Pair p2){
	return p1.vote>p2.vote;
}

int main (){
    int n;
	while(cin>>n && n){
		bool isTIE=true;
		vector<Pair> v(26);
		for(int i=0;i<26;i++)v[i].name='A'+i;
		for(int i=0;i<n;i++){
			char c; cin>>c;
			v[c-'A'].vote++;
			vector<Pair> temp_v=v;
			sort(temp_v.begin(),temp_v.end(),cmp);
			if(temp_v[0].vote-temp_v[1].vote>n-i-1){
				cout<<temp_v[0].name<<" "<<i+1<<endl;
				isTIE=false;
				break;
			}
		}
		if(isTIE)cout<<"TIE"<<endl;
	}
}



Compiler output:
a.cc: In function 'int main()':
a.cc:25:25: error: 'sort' was not declared in this scope; did you mean 'short'?
   25 |                         sort(temp_v.begin(),temp_v.end(),cmp);
      |                         ^~~~
      |                         short
Language: C++

#include<iostream>
using namespace std;

int main(){
    int n;
    while(true){
        cin>>n;
        if(n==0){break;}
        int table[26]={0};
        char cha[n+1],m_cha[2];

        for(int i=0;i<n;i++)cin>>chara[i];
        for(int t=0;t<n;t++){
            table[cha[t]-'A']++;
            if(table[cha[t]-'A']>maxi1){
                maxi1=table[cha[t]-'A'];
                m_cha[0]=cha[t];
            }
            else if(table[cha[t]-'A']>maxi2)maxi2=table[cha[t]-'A'];
            if(maxi1-maxi2 >= n-t){
                cout<<m_cha[0]<<" "<<t+1<<endl;
                break;
            }
            if(t==n-1)
                if(maxi1==maxi2)
                    cout<<"TIE"<<endl;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:34: error: 'chara' was not declared in this scope; did you mean 'char'?
   12 |         for(int i=0;i<n;i++)cin>>chara[i];
      |                                  ^~~~~
      |                                  char
a.cc:15:34: error: 'maxi1' was not declared in this scope
   15 |             if(table[cha[t]-'A']>maxi1){
      |                                  ^~~~~
a.cc:19:39: error: 'maxi2' was not declared in this scope
   19 |             else if(table[cha[t]-'A']>maxi2)maxi2=table[cha[t]-'A'];
      |                                       ^~~~~
a.cc:20:16: error: 'maxi1' was not declared in this scope
   20 |             if(maxi1-maxi2 >= n-t){
      |                ^~~~~
a.cc:20:22: error: 'maxi2' was not declared in this scope
   20 |             if(maxi1-maxi2 >= n-t){
      |                      ^~~~~
a.cc:25:20: error: 'maxi1' was not declared in this scope
   25 |                 if(maxi1==maxi2)
      |                    ^~~~~
a.cc:25:27: error: 'maxi2' was not declared in this scope
   25 |                 if(maxi1==maxi2)
      |                           ^~~~~
Language: C++

#include<iostream>
using namespace std;

int main(){
    int n;
    while(true){
        cin>>n;
        if(n==0){break;}
        int table[26]={0},max1=0,max2=0;
        char cha[n+1],m_cha[2];
        for(int i=0;i<n;i++)cin>>chara[i];
        for(int t=0;t<n;t++){
            table[cha[t]-'A']++;
            if(table[cha[t]-'A']>max1){
                max1=table[cha[t]-'A'];
                m_cha[0]=cha[t];
            }
            else if(table[cha[t]-'A']>max2)max2=table[cha[t]-'A'];
            if(max1-max2 >= n-t){
                cout<<m_cha[0]<<" "<<t+1<<endl;
                break;
            }
            if(t==n-1)
                if(max1==max2)
                    cout<<"TIE"<<endl;
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:34: error: 'chara' was not declared in this scope; did you mean 'char'?
   11 |         for(int i=0;i<n;i++)cin>>chara[i];
      |                                  ^~~~~
      |                                  char
Language: C++

var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=input.trim().split("\n");
while (true) {
   var n = arr.shift() - 0;
   if (n == 0) break;
   var a = arr.shift().split(" ");
   var flag = false;
   var obj = {};
   for (var i = 0; i < n; i++) {
      obj[a[i]] = obj[a[i]] + 1 || 1;
      var s = [];
      for (var k in obj) s.push([obj[k], k]);
      s.sort(function(a, b) {
         return a[0] < b[0];
      });
      var nokori = a.length - (i + 1);
      if (s.length == 1) s[1] = [0];
      if (s[0][0] == s[1][0]) continue;
      if (s[0][0] > s[1][0] + nokori) {
         console.log(s[0][1], i + 1);
         flag = true;
         break;
      }
   }
   if (flag == false) console.log("TIE");
}

Compiler output:
a.cc:1:21: warning: multi-character character constant [-Wmultichar]
    1 | var input = require('fs').readFileSync('/dev/stdin', 'utf8');
      |                     ^~~~
a.cc:1:40: warning: multi-character literal with 10 characters exceeds 'int' size of 4 bytes
    1 | var input = require('fs').readFileSync('/dev/stdin', 'utf8');
      |                                        ^~~~~~~~~~~~
a.cc:1:54: warning: multi-character character constant [-Wmultichar]
    1 | var input = require('fs').readFileSync('/dev/stdin', 'utf8');
      |                                                      ^~~~~~
a.cc:1:1: error: 'var' does not name a type
    1 | var input = require('fs').readFileSync('/dev/stdin', 'utf8');
      | ^~~
a.cc:2:1: error: 'var' does not name a type
    2 | var arr=input.trim().split("\n");
      | ^~~
a.cc:3:1: error: expected unqualified-id before 'while'
    3 | while (true) {
      | ^~~~~
Language: C++


#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
using namespace std;

int main() {
	while(true) {
		map<string, int> mp;
		map<string, int> mpp;
		vector<string> list;
		string str;
		int n;
		cin >> n;
		for (int i = 0; i < n; ++i) {
			cin >> str;
			list.emplace_back(str);
			auto itr = mp.find(str);
			if (itr != mp.end()) {
				mp[str]++;
			}
			else {
				mp.insert(make_pair(str, 1));
			}
		}
		int y = 0;
		for (auto j = mp.begin(); j != mp.end(); ++j) {
			if (n / mp.size() + 1 == j->second) {
				y++;
			}
		}
		cout << y << endl;
		if (y == 0) {
			cout << mp.begin->first << " " << n / 2 + 1 << endl;
		}
		if (y == 1) {
			for (int i = 0; i < n; ++i) {
				auto itr = mpp.find(list[i]);
				if (itr != mpp.end()) {
					mpp[list[i]]++;
				}
				else {
					mpp.insert(make_pair(list[i], 1));
				}
				for (auto j = mpp.begin(); j != mpp.end(); ++j) {
				if (n / mpp.size() + 1 == j->second) {
				cout << j->first << " " << j->second+1 << endl;
				}
				}
			}
		}
		else {
			cout << "TIE" << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:36: error: invalid use of member function 'std::map<std::__cxx11::basic_string<char>, int>::begin' (did you forget the '()' ?)
   37 |                         cout << mp.begin->first << " " << n / 2 + 1 << endl;
      |                                 ~~~^~~~~
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
using namespace std;

int main() {
	while(true) {
		map<string, int> mp;
		map<string, int> mpp;
		vector<string> list;
		string str;
		int n;
		cin >> n;
		for (int i = 0; i < n; ++i) {
			cin >> str;
			list.emplace_back(str);
			auto itr = mp.find(str);
			if (itr != mp.end()) {
				mp[str]++;
			}
			else {
				mp.insert(make_pair(str, 1));
			}
		}
		int y = 0;
		for (auto j = mp.begin(); j != mp.end(); ++j) {
			if (n / mp.size() + 1 == j->second) {
				y++;
			}
		}
		if (y == 0) {
			cout << mp.begin->first << " " << n / 2 + 1 << endl;
		}
		if (y == 1) {
			for (int i = 0; i < n; ++i) {
				auto itr = mpp.find(list[i]);
				if (itr != mpp.end()) {
					mpp[list[i]]++;
				}
				else {
					mpp.insert(make_pair(list[i], 1));
				}
				for (auto j = mpp.begin(); j != mpp.end(); ++j) {
				if (n / mpp.size() + 1 == j->second) {
				cout << j->first << " " << j->second+1 << endl;
				}
				}
			}
		}
		else {
			cout << "TIE" << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:36: error: invalid use of member function 'std::map<std::__cxx11::basic_string<char>, int>::begin' (did you forget the '()' ?)
   35 |                         cout << mp.begin->first << " " << n / 2 + 1 << endl;
      |                                 ~~~^~~~~
Language: C++

#include <iostream>
#include <vector>
#include <map>
using namespace std;
typedef map<string, int> M;

int main() {
  int n, t, f;
  string c, ans, first;
  vector<int> v;
  while(cin >> n, n){
    M m;
    t = 0;
    f = 1;
    for (int i = 0; i < n; ++i){
      cin >> c;
      m[c] += 1;
      v.erase(v.begin(), v.end());
      for (M::iterator itr = m.begin(); itr != m.end(); ++itr) {
	v.push_back(-itr->second);
	if (itr->second > t) {
	  first = itr->first;
	  t = itr->second;
	}
      }
      sort(v.begin(), v.end());
      if (f && ((v.size() > 1 && -v[1]+n-1-i < t) || -v[0] > n/2)) {
	cout << first << " " << i+1 << endl;
	f = 0;
      }
    }
    if (f) cout << "TIE" << endl;
    m.erase(m.begin(), m.end());
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:7: error: 'sort' was not declared in this scope; did you mean 'short'?
   26 |       sort(v.begin(), v.end());
      |       ^~~~
      |       short
Language: C++

#include <stdio.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <string>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> P;
int n,c[26];
string t[105];
int main(){
	while(1){
		cin >> n; if(n==0) return 0;
		memset(c,0,sizeof(c));
		for(int i=1;i<=n;i++) cin >> t[i];
		for(int i=1;i<=n;i++){
			string s=t[i]; c[s[0]-'A']++;
			vector<int>vi;
			for(int j=0;j<26;j++){
				vi.pb(c[j]);
			}
			sort(vi.begin(),vi.end());
			if(vi[25] > vi[24]+n-i){
				char ch;
				for(int j=0;j<26;j++)if(vi[25]==c[j])ch='A'+j;
				printf("%c %d\n",ch,i); goto nxt;
			}
		}
	  puts("TIE"); nxt:;
  }
}
		

Compiler output:
a.cc: In function 'int main()':
a.cc:15:17: error: 'memset' was not declared in this scope
   15 |                 memset(c,0,sizeof(c));
      |                 ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <iostream>
  +++ |+#include <cstring>
    5 | #include <string>
Language: C++

#include <stdio.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
#define pb push_back
#define mp make_pair
typedef pair<int,int> P;
int n,c[26];
string t[105];
int main(){
	while(1){
		cin >> n; if(n==0) return 0;
		memset(c,0,sizeof(c));
		for(int i=1;i<=n;i++) cin >> t[i];
		for(int i=1;i<=n;i++){
			string s=t[i]; c[s[0]-'A']++;
			vector<int>vi;
			for(int j=0;j<26;j++){
				vi.pb(c[j]);
			}
			sort(vi.begin(),vi.end());
			if(vi[25] > vi[24]+n-i){
				char ch;
				for(int j=0;j<26;j++)if(vi[25]==c[j])ch='A'+j;
				printf("%c %d\n",ch,i); goto nxt;
			}
		}
	  puts("TIE"); nxt:;
  }
}
		

Compiler output:
a.cc: In function 'int main()':
a.cc:16:17: error: 'memset' was not declared in this scope
   16 |                 memset(c,0,sizeof(c));
      |                 ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <stdlib.h>
  +++ |+#include <cstring>
    7 | using namespace std;
Language: C++

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

struct topnano{char a; int t;};

int main(){
    int n,k=1;
    while(cin>>n){
        if(n==0){break;}
        char c[n],al[30];
        cin>>c[0];
        al[0]=c[0];
        for(int i=1;i<n;i++){
            cin>>c[i];
            for(int j=0;j<k;j++){
                if(al[j]==c[i]){break;}
                else if(j==k-1){
                    al[k]=c[i];
                    k++;
                    break;
                }
            }
        }
        if(k==1){
            cout<<al[0]<<" "<<1+(n/2)<<endl;
        }else{
            int votes[k];
            for(int i=0;i<k;i++){
                votes[i]=0;
            }
            struct topnano ichii,nii;
            ichii.t=0;
            nii.t=0;
            for(int i=0;i<n;i++){
                for(int j=0;j<k;j++){
                    if(c[i]==al[j]){
                        votes[j]++;
                        if(ichii.t<votes[j]){
                            ichii.t=votes[j];
                            ichii.a=al[j];
                        }else if(nii.t<votes[j]){
                            nii.t=votes[j];
                            nii.a=al[j];
                        }
                        break;
                    }
                }
                if(ichii.t > n - ichii.t + nii.t){
                    cout<<ichii.a<<" "<<ichi.t+1<<endl;
                    break;
                }
                if(i==n-1){
                    if(chii.t==nii.t){
                        cout<<"TIE"<<endl;
                    }else{
                        cout<<ichii.a<<" "<<ichi.t+1<<endl;
                    }
                }
            }
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:50:41: error: 'ichi' was not declared in this scope; did you mean 'ichii'?
   50 |                     cout<<ichii.a<<" "<<ichi.t+1<<endl;
      |                                         ^~~~
      |                                         ichii
a.cc:54:24: error: 'chii' was not declared in this scope; did you mean 'ichii'?
   54 |                     if(chii.t==nii.t){
      |                        ^~~~
      |                        ichii
a.cc:57:45: error: 'ichi' was not declared in this scope; did you mean 'ichii'?
   57 |                         cout<<ichii.a<<" "<<ichi.t+1<<endl;
      |                                             ^~~~
      |                                             ichii
Language: C++

#include <iostream>
using namespace std;

int main(){
	while(1){
		int n;
		cin>>n;
		if(n == 0)
			break;
		
		char  c[100];
		for(int i=0; i<n; i++){
		  cin>>c[i];
		}

		int cnt[26] = 0;
		for(int i=0; i<n; i++){
		  cnt[(int)(c[i]-'A')]++;

		  int max1=-1;
		  int max2 = -1;
		  for(int j=0; j<26; j++){
		    if(cnt[j]>max1){
		      max2 = max1; 
		      max1=cnt[j];
		    }
		    else if(cnt[j]>max2){
		      max2 = cnt[j];
		    }
		  }

		  if(max1-max2>n-(i+1)){
		    for(int j=~; j<26; j++){
		      if(cn[j]==max1){
			cout<<(char)(j+'A')<<' ';
			break;
		      }
		    }
		    cout<<(i+1)<<endl;
		    break;
		  }

		  if(i==n-1){
		    cout<<"TIE"<<endl;
		    break;
		  }
		}
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:31: error: array must be initialized with a brace-enclosed initializer
   16 |                 int cnt[26] = 0;
      |                               ^
a.cc:33:32: error: expected primary-expression before ';' token
   33 |                     for(int j=~; j<26; j++){
      |                                ^
a.cc:34:26: error: 'cn' was not declared in this scope; did you mean 'cnt'?
   34 |                       if(cn[j]==max1){
      |                          ^~
      |                          cnt
Language: C++

// ConsoleApplication5.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//



//???????¢?????????????????????§j??????????????????

#include "stdafx.h"
#include <iostream>
using namespace std;

int main()
{
	while (true) {
		int n;
		cin >> n;
		if (n == 0)
			break;
		charc[100];
		for (int i = 0; i < n; i++)
		{
			cin >> c[i];
		}

		int cnt[26] = [0];

		for (int i = 0; i < n; i++)
		{
			int max1 = -1;
			int max2 = -1;
			for (int j = 0; j < 26; j++)
			{
				if (cnt[j] > max1) {
					max2 = max1;
					max1 = cnt[j];
				}
			}
			if (max1 - max2 > n - (i + 1)) {
				if (cnt[j] = max1) {
					cout << (char)(j + 'A') << ' ';
					break;
				}
			}
			cout << (i + 1) << endl;
			break;
		}
		if (i == n - 1) {
			cout << "TIE" << endl;
			break;
		}
	}
}
	}
	return 0;
}

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

#include<iostream>
using namespace std;

int main(){
	while(1){
		int n;
		cin>>n;
		
		char c[100];
		for(int i=0;i<n;i++){
			cin>>c[i];
		}

		int cnt[26]={0};

		for(int i=0;i<n;i++){
			cnt[(int)(c[i]-'A')]++;
			
			int max1=-1;
			int max2=-1;

			for(int j=;j<26;j++){
				if(cnt[j]>max1){
					max2=max1;
					max1=cnt[j];
				}
				else if(cnt[j]>max2){
					max2=cnt[j];
				}
			}
		
			if(max1-max2>n-(i+1)){
				for(int j=0;j<26;j++){
					if(cnt[j]==max1){
						cout<<(char)(j+'A')<<" ";
						break;
					}
				}
				cout<<(i+1)<<endl;
				break;
			}

			if(i==(n-1)){
				cout<<"TIE"<<endl;
				break;
			}
		}
	}
		
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:35: error: expected primary-expression before ';' token
   22 |                         for(int j=;j<26;j++){
      |                                   ^
Language: C++

#include<iostream>

using namespace std;

int main(){
while(1){
 int n;
 cin>>n;

 if(n==0){break;}

 char c[1000];
 for(int i=0;i<n;i++){
	cin>>c[i];
 }

 int cnt[26]={0};

 for(int i=0;i<n;i++){
	cnt[(int)(c[i]-'A')]++;

	int max1=-1;
	int max2=-1;

	for(int j=0;j<26;j++){
		if(cnt[j]>max1){
			max2=max1;
			max1=cnt[j];
		}else if(cnt[j]>max2){
			max2=cnt[j];
		}
 	}

 	if(max1-max2>n-(j+1)){
		for(int j=0;j<26;j++){
			if(cnt[j]==max1){
				cout<<(char)(j+'A')<<' ';
				break;
			}
		}
		cout<<(i+1)<<endl;
		break;
	}
	if(i==n-1){
		cout<<"TIE"<<endl;
		break;
	}
 }
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:25: error: 'j' was not declared in this scope
   34 |         if(max1-max2>n-(j+1)){
      |                         ^
Language: C++

#include<iostream>
using namespace std;


int main(){
	while(true){
		int n;
		cin>>n;
		
		if(n==0)
			break;
		
		char c[100];
		
		for(int i=0;i<n;i++){
			cin>>c[i];
		}

		int cnt[26]=[0];
			
		for(int i=0;i<n;i++){
			cnt[(int)(c[i]-'A')]++;
			
			int max1 =-1;
			int max2 =-1;
		
			for(int j=0;j<26;j++){
				if(cnt[j]>max1){
					max2 = max1;
					max1 = cnt[j];
			}else if(cnt[j]>max2){
				max2 = cnt[j];
			}
		}

		if(max1-max2>n-(i+1)){
			for(int j=0;j<26;j++){
				if(cnt[j]==max1){
					cout<<(char)(j+'A')<<' ';
					break;
				}
			}
			cout<<(i+1)<<endl;
			break;
		}

		if(i==n-1){
			cout<<"TIE"<<endl;
			break;
		}
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:30: error: expected identifier before numeric constant
   19 |                 int cnt[26]=[0];
      |                              ^
a.cc: In lambda function:
a.cc:19:32: error: expected '{' before ';' token
   19 |                 int cnt[26]=[0];
      |                                ^
a.cc: In function 'int main()':
a.cc:19:29: error: array must be initialized with a brace-enclosed initializer
   19 |                 int cnt[26]=[0];
      |                             ^~~
Language: C++

#include <iostream>
using namespace std;

int main() {
	while (true) {
		int n;
		cin >> n;

		if (n == 0)
			break;
		char c[100];
		for (int i = 0;i < n;i++) {
			cin >> c[i];
		}

		int cnt[26] = { 0 };

		for (int i = 0;i < n;i++) {
			cnt[(int)(c[i] - 'A')]++;

			int max1 = -1;
			int max2 = -2;

			for (int j = 0;j < 26;j++) {
				if (cnt[j] > max1) {
					max2 = max1;
					max1 = cnt[j];
				}
			}

			if (max1 - max2 > n - (i + 1)) {
				for (int j = 0;j < 26;j++) {
					if (cnt[j] == max1) {
						cout << (char)(j + 'A') << ' ';
						break;
					}
				}
				cout << (i + 1) << endl;
				break;
			}

			if (i == n - 1) {
				cout << "TIE" << endl;
				break;
			}
		}
		return 0;
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:48:10: error: expected '}' at end of input
   48 |         }
      |          ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include "iostream"
using namespace std;

int main(){
   while(true){
     int n;
     cin>>n;

     if(n==0) break;

     char c[100];
     for (int i = 0; i < n; i++) {
         cin>>c[i];
    }
     int cnt[26]=[0];

     for (int i = 0; i < n; i++) {
         cit[(int)(c[i]-'A')]++;
         int max1=-1;
         int max2=-1;

         for (int j = 0; j < 26; j++) {
             if(cnt[j]>max1){
                 max2=max1;
                 max1=cnt[j];
            }
             else if{
                 max2=cnt[j];
                }
            }
         if(max1-max2>n-(i+1)){
             for (int j = 0; j < 26; j++) {
                 if(cnt[j]==max1){
                     cout<<(char)(j+'A')<<' ';
                     break;
                    }
                }

             if(i==n-1){
                 cout<<"TIE"<<endl;
                 break;
                }
            }
        }
    }
    retuen 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:15:19: error: expected identifier before numeric constant
   15 |      int cnt[26]=[0];
      |                   ^
a.cc: In lambda function:
a.cc:15:21: error: expected '{' before ';' token
   15 |      int cnt[26]=[0];
      |                     ^
a.cc: In function 'int main()':
a.cc:15:18: error: array must be initialized with a brace-enclosed initializer
   15 |      int cnt[26]=[0];
      |                  ^~~
a.cc:18:10: error: 'cit' was not declared in this scope; did you mean 'cnt'?
   18 |          cit[(int)(c[i]-'A')]++;
      |          ^~~
      |          cnt
a.cc:27:21: error: expected '(' before '{' token
   27 |              else if{
      |                     ^
      |                     (
a.cc:46:5: error: 'retuen' was not declared in this scope
   46 |     retuen 0;
      |     ^~~~~~
Language: C++

#include <iostream>
using namespace std;

int main(){
   while(true){
       int n;
       cin>>n;

       if(n==0) break;

       char c[100];
       for (int i = 0; i < n; i++) {
            cin>>c[i];
        }

        int cnt[26]=[0];

        for (int i = 0; i < n; i++) {
            cit[(int)(c[i]-'A')]++;
            int max1=-1;
            int max2=-1;

            for (int j = 0; j < 26; j++) {
                if(cnt[j]>max1){
                    max2=max1;
                    max1=cnt[j];
                }
                else if{
                    max2=cnt[j];
                }
            }
            if(max1-max2>n-(i+1)){
                for (int j = 0; j < 26; j++) {
                    if(cnt[j]==max1){
                        cout<<(char)(j+'A')<<' ';
                        break;
                    }
                }
                cout<<(i+1)<<endl;
                break;
            }

            if(i==n-1){
                    cout<<"TIE"<<endl;
                    break;
            }
        }
    }
    retuen 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:22: error: expected identifier before numeric constant
   16 |         int cnt[26]=[0];
      |                      ^
a.cc: In lambda function:
a.cc:16:24: error: expected '{' before ';' token
   16 |         int cnt[26]=[0];
      |                        ^
a.cc: In function 'int main()':
a.cc:16:21: error: array must be initialized with a brace-enclosed initializer
   16 |         int cnt[26]=[0];
      |                     ^~~
a.cc:19:13: error: 'cit' was not declared in this scope; did you mean 'cnt'?
   19 |             cit[(int)(c[i]-'A')]++;
      |             ^~~
      |             cnt
a.cc:28:24: error: expected '(' before '{' token
   28 |                 else if{
      |                        ^
      |                        (
a.cc:49:5: error: 'retuen' was not declared in this scope
   49 |     retuen 0;
      |     ^~~~~~
Language: C++

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
typedef pair<int,int> P;

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

void solve(string &s)
{
    int cnt[26]={0};
    P a[26];
    REP(i,s.size()){
        cnt[s[i]-'A']++;
        REP(j,26) a[i]=P(cnt[j],j);
        sort(a,a+26);
        reverse(a,a+26);
        if(a[0].first>a[1].first+(n-i-1)){
            cout<<(char)('A'+a[0].second)
                <<" "<<i+1<<endl;
            return;
        }
    }
    cout<<"TIE"<<endl;
}

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

    int n;
    while(cin>>n,n){
        string s;
        REP(i,n) cin>>s;
        solve(s);
    }
}


Compiler output:
a.cc: In function 'void solve(std::string&)':
a.cc:20:35: error: 'n' was not declared in this scope
   20 |         if(a[0].first>a[1].first+(n-i-1)){
      |                                   ^
Language: C++

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

int main(){
  char c;
  int n,num[30],maxp,secp,maxn,secn,flag;
  cin >> n;
  while(n!=0){
    fill(num.num+30.0);
    maxn=0;
    secn=0;
    maxp=secp=30;
    for(int i=1;i<=n;i++){
      flag=0;
      cin >> c;
      num[c-'A']++;
      for(int j=0;j<n;j++)
        if(maxn<num[j]){
          maxn=num[j];
          maxp=j;
        }
      for(int j=0;j<n;j++)
        if(maxn<num[j]&&j!=maxp){
          secn=num[j];
          secp=j;
        }
      if(maxn-secn>n-i){
        c='A'+maxp;
        cout << c << " " << i << endl;
        flag=1;
        break;
      }
    }
    if(flag==0)
      cout << "TIE" << endl;
    cin >> n;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: request for member 'num' in 'num', which is of non-class type 'int [30]'
    9 |     fill(num.num+30.0);
      |              ^~~
Language: C++

import sys
sys.setrecursionlimit(10**6)


def main():
	n = int(input())
	if n == 0:
		return
	c = [ord(i)-65 for i in input().split(" ")]
	getnum = [0 for i in range(30)]
	mnum = 29
	snum = 29
	flg = True
	for i in range(n):
		getnum[c[i]] += 1
		if getnum[c[i]] >= getnum[mnum] and mnum != c[i]:
			snum = mnum
			mnum = c[i]
		elif getnum[c[i]] >= getnum[snum] and snum != c[i] and mnum != c[i]:
			snum = c[i]
		if getnum[mnum] > getnum[snum] + (n-1) - i:
			print(chr(mnum+65),i+1)
			flg = False
			break
	if flg:
		print("TIE")
	main()
	return

main()


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