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

#include <iostream>
#include <string>
using namespace std;
int main(){
  int N,M,ac,wa;
  ac=0;
  wa=0;
  cin>>N>>M;
vector<int> P(M,0);
vector<int> ok(N,0);
vector<string> S(M,0);
for(int i=0;i<M;i++){cin>>P[i]>>S[i];}
for(int i=0;i<M;i++){
if(ok[P[i]-1]==0&S[i]=='WA'){
  wa++;
  ok[P[i]-1]=1;
    }else if(ok[P[i]-1]==0&S[i]=='AC'){
  ac++;
  ok[P[i]-1]=1;
}
}
  cout<<ac<<wa;
 
}

Compiler output:
a.cc:14:24: warning: multi-character character constant [-Wmultichar]
   14 | if(ok[P[i]-1]==0&S[i]=='WA'){
      |                        ^~~~
a.cc:17:34: warning: multi-character character constant [-Wmultichar]
   17 |     }else if(ok[P[i]-1]==0&S[i]=='AC'){
      |                                  ^~~~
a.cc: In function 'int main()':
a.cc:9:1: error: 'vector' was not declared in this scope
    9 | vector<int> P(M,0);
      | ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | #include <string>
a.cc:9:8: error: expected primary-expression before 'int'
    9 | vector<int> P(M,0);
      |        ^~~
a.cc:10:8: error: expected primary-expression before 'int'
   10 | vector<int> ok(N,0);
      |        ^~~
a.cc:11:14: error: expected primary-expression before '>' token
   11 | vector<string> S(M,0);
      |              ^
a.cc:11:16: error: 'S' was not declared in this scope
   11 | vector<string> S(M,0);
      |                ^
a.cc:12:27: error: 'P' was not declared in this scope
   12 | for(int i=0;i<M;i++){cin>>P[i]>>S[i];}
      |                           ^
a.cc:14:4: error: 'ok' was not declared in this scope
   14 | if(ok[P[i]-1]==0&S[i]=='WA'){
      |    ^~
a.cc:14:7: error: 'P' was not declared in this scope
   14 | if(ok[P[i]-1]==0&S[i]=='WA'){
      |       ^
Language: C++

# include <bits/stdc++.h>
# define ll 
# define pb push_back
# define pf push_front
# define mpi make_pair
# define pi pair<ll,ll>
# define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
# define mod 1000000007
# define endl "\n"
using namespace std;
int main()
{
  fast
  ll n,m,ans1=0,ans2=0;
  cin>>n>>m;
  vector <pi> v;
  for(ll i=0;i<n;i++)
  {
    v.pb(mpi(0,0));
  }
  while(m--)
  {
    ll x;
    string s;
    cin>>x>>s;
    if((v[x-1].second)==0)
    {
      if(s[0]=='W')
      {
        (v[x-1].first)++;
      }
      else
      {
        v[x-1].second=1;
      }
    }
  }
  for(ll i=0;i<v.size();i++)
  {
    if(v[i].second==1)
    {
    ans1+=v[i].first;
    }
    ans2+=v[i].second;
  }
  cout<<ans2<<" "<<ans1<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:6: error: 'n' was not declared in this scope; did you mean 'yn'?
   14 |   ll n,m,ans1=0,ans2=0;
      |      ^
      |      yn
a.cc:14:8: error: 'm' was not declared in this scope; did you mean 'tm'?
   14 |   ll n,m,ans1=0,ans2=0;
      |        ^
      |        tm
a.cc:14:10: error: 'ans1' was not declared in this scope
   14 |   ll n,m,ans1=0,ans2=0;
      |          ^~~~
a.cc:14:17: error: 'ans2' was not declared in this scope
   14 |   ll n,m,ans1=0,ans2=0;
      |                 ^~~~
a.cc:6:23: error: template argument 1 is invalid
    6 | # define pi pair<ll,ll>
      |                       ^
a.cc:16:11: note: in expansion of macro 'pi'
   16 |   vector <pi> v;
      |           ^~
a.cc:6:23: error: template argument 2 is invalid
    6 | # define pi pair<ll,ll>
      |                       ^
a.cc:16:11: note: in expansion of macro 'pi'
   16 |   vector <pi> v;
      |           ^~
a.cc:16:13: error: template argument 1 is invalid
   16 |   vector <pi> v;
      |             ^
a.cc:16:13: error: template argument 2 is invalid
a.cc:17:10: error: 'i' was not declared in this scope
   17 |   for(ll i=0;i<n;i++)
      |          ^
a.cc:3:13: error: request for member 'push_back' in 'v', which is of non-class type 'int'
    3 | # define pb push_back
      |             ^~~~~~~~~
a.cc:19:7: note: in expansion of macro 'pb'
   19 |     v.pb(mpi(0,0));
      |       ^~
a.cc:23:8: error: 'x' was not declared in this scope
   23 |     ll x;
      |        ^
a.cc:38:10: error: 'i' was not declared in this scope
   38 |   for(ll i=0;i<v.size();i++)
      |          ^
a.cc:38:18: error: request for member 'size' in 'v', which is of non-class type 'int'
   38 |   for(ll i=0;i<v.size();i++)
      |                  ^~~~
Language: C++

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

int main() {

int N,M;
 cin >> N >>M;
 int pi[N];
 string si[N]
 int sama=0, samb=0;
 for(int i=0;i<N;i++){
  cin >>pi[i]>>si[i];
  }
  int i=0,k=0;
  while(i<N){
  for(int j=0;j<N;j++){
  if(pi[j]==i||k==i){
  if(si[j]=="AC"){
  sama++;
  k++;}
  else samb++;}
  i++;}


  cout<<sama<<endl;
   cout<<samb<<endl;}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:2: error: expected initializer before 'int'
   10 |  int sama=0, samb=0;
      |  ^~~
a.cc:12:16: error: 'si' was not declared in this scope; did you mean 'i'?
   12 |   cin >>pi[i]>>si[i];
      |                ^~
      |                i
a.cc:18:6: error: 'si' was not declared in this scope; did you mean 'i'?
   18 |   if(si[j]=="AC"){
      |      ^~
      |      i
a.cc:19:3: error: 'sama' was not declared in this scope
   19 |   sama++;
      |   ^~~~
a.cc:21:8: error: 'samb' was not declared in this scope
   21 |   else samb++;}
      |        ^~~~
a.cc:25:9: error: 'sama' was not declared in this scope
   25 |   cout<<sama<<endl;
      |         ^~~~
a.cc:26:10: error: 'samb' was not declared in this scope
   26 |    cout<<samb<<endl;}
      |          ^~~~
a.cc:26:22: error: expected '}' at end of input
   26 |    cout<<samb<<endl;}
      |                      ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

int main() {
  int N,M;
  cin >> N;
  cin >> M;
  vector<int> p(M);
  vector<string> S(M);
  vector<int> problem(N+1);
  int ans_c=0;
  int ans_p=0;
  for (int i=0; i<M; i++){
   cin >> p.at(i);
   cin >> S.at(i);
   if (S.at(i)=="AC" && problem.at(p.at(i)) != 2) {
     ans_c=ans_c+1;
     problem.at(p.at(i))=2;
   }
   if (S.at(i)=="WA" && problem.at(p.at(i)) != 2) {
     ans_p=ans_p+1;
     if (problem.at(p.at(i))==0) problem.at(p.at(i))=1;
   }
  }
  cout << ans_c << ' ' << ans_p << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:3: error: 'cin' was not declared in this scope
    3 |   cin >> N;
      |   ^~~
a.cc:5:3: error: 'vector' was not declared in this scope
    5 |   vector<int> p(M);
      |   ^~~~~~
a.cc:5:10: error: expected primary-expression before 'int'
    5 |   vector<int> p(M);
      |          ^~~
a.cc:6:10: error: 'string' was not declared in this scope
    6 |   vector<string> S(M);
      |          ^~~~~~
a.cc:6:18: error: 'S' was not declared in this scope
    6 |   vector<string> S(M);
      |                  ^
a.cc:7:10: error: expected primary-expression before 'int'
    7 |   vector<int> problem(N+1);
      |          ^~~
a.cc:11:11: error: 'p' was not declared in this scope
   11 |    cin >> p.at(i);
      |           ^
a.cc:13:25: error: 'problem' was not declared in this scope
   13 |    if (S.at(i)=="AC" && problem.at(p.at(i)) != 2) {
      |                         ^~~~~~~
a.cc:17:25: error: 'problem' was not declared in this scope
   17 |    if (S.at(i)=="WA" && problem.at(p.at(i)) != 2) {
      |                         ^~~~~~~
a.cc:22:3: error: 'cout' was not declared in this scope
   22 |   cout << ans_c << ' ' << ans_p << endl;
      |   ^~~~
a.cc:22:36: error: 'endl' was not declared in this scope
   22 |   cout << ans_c << ' ' << ans_p << endl;
      |                                    ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll i,j,k,n,m,x=0,s=0,y=0,z=0,d=0,f=0,p=0;
	cin>>n>>m;
	vector<pair<ll,string> > vv;string sss;
	for(i=0;i<m;i++)
	{
		cin>>d>>sss;
		vv.push_back(make_pair(d,sss));
	}
	//for(i=0;i<vv.size();i++) cout<<vv[i].first<<" "<<vv[i].second<<endl;
/*	ll temp=0;
	for(i=1;i<vv.size();i++)
{p=0;
for(j=0;j<vv.size()-i;j++)
{if(vv[j].first>vv[j+1].first)
{temp=vv[j].first;
vv[j].first=vv[j+1].first;
vv[j+1].first=temp;
sss=vv[j].second;
vv[j].second=vv[j+1].second;
vv[j+1].second=sss;
/*temp=ar[j];
ar[j]=ar[j+1];
ar[j+1]=temp;*/
p=1;
	
}
}
if(p==0)
{break;
	
}
	
	
}*/
//	sort(vv.begin(),vv.end());
d=0;z=0;
//	for(i=0;i<vv.size();i++) cout<<vv[i].first<<" "<<vv[i].second<<endl;
	
	for(i=0;i<m;i++)
	{
		if(z==1 && vv[i].first!=vv[i-1].first) z=0;
		if(z==0)
		{	
		if(vv[i].first==vv[i+1].first)
		{
	//	cout<<i<<" "<<vv[i].second<<endl;
			if(vv[i].second=="WA")
			{
				y=y+1;continue;
			}
			if(vv[i].second=="AC")
			{p=p+1;z=1;d=d+y;y=0;continue;
			}
		}
		else
		{
			if(vv[i].second=="WA")
			{
				y=0;continue;
			}
			if(vv[i].second=="AC")
			{p=p+1;z=1;d=d+y;y=0;continue;
			}
		}
		}
	}
	cout<<p<<" "<<d;

	
}

Compiler output:
a.cc:32:1: error: expected declaration before '}' token
   32 | }
      | ^
a.cc:33:1: error: expected unqualified-id before 'if'
   33 | if(p==0)
      | ^~
a.cc:39:1: error: expected declaration before '}' token
   39 | }*/
      | ^
a.cc:39:3: error: expected unqualified-id before '/' token
   39 | }*/
      |   ^
a.cc:41:5: error: 'z' does not name a type
   41 | d=0;z=0;
      |     ^
a.cc:44:9: error: expected unqualified-id before 'for'
   44 |         for(i=0;i<m;i++)
      |         ^~~
a.cc:44:17: error: 'i' does not name a type
   44 |         for(i=0;i<m;i++)
      |                 ^
a.cc:44:21: error: 'i' does not name a type
   44 |         for(i=0;i<m;i++)
      |                     ^
a.cc:72:9: error: 'cout' does not name a type
   72 |         cout<<p<<" "<<d;
      |         ^~~~
a.cc:75:1: error: expected declaration before '}' token
   75 | }
      | ^
Language: Java

import java.util.Scanner;

public class Main {

    public static void main(String[] args)  {
        //input
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] t = new int[n];
        int[] f = new int[n];

        for (int i = 0; i < m; i++) {
            int v = sc.nextInt() - 1;
            String s = sc.next();
            if (s.contains("AC")) {
                t[v] = 1;
            } else if (t[v] != 1){
                f[v] += 1;
            }
        }

        //解析
        int ct_t = 0;
        int ct_f = 0;
        for (int i = 0; i < n; i++) {
            ct_t += (t[i] == 0)? 0 : 1;
            ct_f += f[i];
        }

        System.out.println(ct_t + " " + ct_f);
    }

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

#include <cstdio>
#include <cctype>
#include <bitset>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
inline int gc()noexcept { return getchar_unlocked(); }
inline int input()noexcept {
	int v = 0; char c = gc();
	for (; isdigit(c); c = gc()) {
		v *= 10;
		v += c - '0';
    }
	return v;
}
bitset<100002> flag;
int main() {
  int n = input(), m = input();
  vector<int> cnt(n);
  int a1 = 0, a2 = 0;
  rep(i, m) {
    int p = input(); --p;
    char c = gc(); gc(); gc();
    if (!flag.test(p)) {
      switch(c) {
        case 'A':
          flag.set(p);
          ++a1;
          break;
        case 'W':
          ++cnt[p];
          break;
      }
    }
  }
  rep(i, n)if (flag.test(i))a2 += cnt[i];
  printf("%d %d", a1, a2);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: 'vector' was not declared in this scope
   18 |   vector<int> cnt(n);
      |   ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <bitset>
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:18:10: error: expected primary-expression before 'int'
   18 |   vector<int> cnt(n);
      |          ^~~
a.cc:30:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   30 |           ++cnt[p];
      |             ^~~
      |             int
a.cc:35:35: error: 'cnt' was not declared in this scope; did you mean 'int'?
   35 |   rep(i, n)if (flag.test(i))a2 += cnt[i];
      |                                   ^~~
      |                                   int
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;
    int p[m];
    string s[m];
    int ac=0, wa=0;
    int ac1flag[n]=0;
    for(int i=0; i<m; i++){
        cin >> p[i] >> s[i];
        if(s[i] == "AC"){
            if(ac1flag[i] == 0){
            ac1flag[i] == 1;
            }
        }else{ // "WA"
            if(ac1flag[i]==0){
                wa++;
            }
        }
    }
    cout << ac << " " << wa << endl;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: array must be initialized with a brace-enclosed initializer
    9 |     int ac1flag[n]=0;
      |                    ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
string s[100005];
int q[100005];
int main(){
	int n,m,i,j,pos=0,x=0,ca=0,p=0;
	bool b;
	cin>>m>>m;
	for(i=1;i<=m;i++){
		cin>>q[i]>>s[i];
	}
	for(i=1;i<m;i++){
		for(j=i;j<m;j++){
			if(q[j]>q[j+1]){
				swap(q[j],q[j+1]);
				swap(s[j],s[j+1]);
			}
		}
	}
	for(i=1;i<=m;i++){
		if(s[i]=="AC") b=true;
		else b=false;
		if(pos!=q[i]){
			x=0;
			pos=[i];
			if(b==true){
				ca++;
				x=-1;
			}
			else{
				p++;
			}
		}else if(x==0){
			if(b==true){
				ca++;
				x=-1;
			}
			else{
				p++;
			}
		}
	}
	cout<<ca<<" "<<p;
	return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:25:32: error: expected '{' before ';' token
   25 |                         pos=[i];
      |                                ^
a.cc: In function 'int main()':
a.cc:25:29: error: cannot convert 'main()::<lambda()>' to 'int' in assignment
   25 |                         pos=[i];
      |                             ^~~
      |                             |
      |                             main()::<lambda()>
Language: C++

import java.util.Scanner;

public class Main {

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

    int N = scan.nextInt();
    int M= scan.nextInt();
    int[][] array = new int[N][2];
    for (int i = 0; i < M; i++) {
      int mondai = scan.nextInt() - 1;
      // AC = 1 WA = 0
      if ( " AC".equals(scan.nextLine())) {
        array[mondai][1] = 1;
      } else {
        if (array[mondai][1] != 1) {
          array[mondai][0] += 1;
        }
      }
    }
    int waResultCount = 0;
    int acResultCount = 0;
    for (int i = 0; i < N; i++) {
      if (array[i][0] > 0) {
        waResultCount += array[i][0];
      }
      if (array[i][1] == 1) {
        acResultCount += 1;
      }
    }
    System.out.println(acResultCount + " " + waResultCount);
  }
}


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

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

int main(){
    int n,m;
    cin>>n>>m;
    set<int> as;
    map<int,int> ws;
    for(int i=0 ;i<n; i++){
        int p;
        string s;
        cin>>p>>s;
        if(s == "AC"){
            as.insert(p);
        }else if(s == "WC"){
            ws[p]++;
        }
    }

    int cntac = 0;
    int cntwc =0;

    for(auto itr : as){
        cntac++;
        cntwc += ws[*itr];
    }
    cout << cntac << cntwc <<endl;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:21: error: invalid type argument of unary '*' (have 'int')
   26 |         cntwc += ws[*itr];
      |                     ^~~~
Language: Java

import java.util.*;
public class Main{
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
      int N = sc.nextInt();
      int M = sc.nextInt();
      int[] p=new int[N+1];
      int ac=0,n,ans;
      int[] pena=new int[N+1]:
      String res;
      for(int i=0;i<M;i++){
        n = sc.nextInt();
        res = sc.next();
        if(res.equals("AC")){
          if(p[n]!=1){
            p[n]=1;
            ac++;
            ans +=pena[n]
          }
        }else if(res.equals("WA")){
          if(p[n]!=1){
            pena[n]++;
          }
        }
      }
     System.out.print(ac);
     System.out.print(" ");
     System.out.println(ans);
   }
}

Compiler output:
Main.java:9: error: ';' expected
      int[] pena=new int[N+1]:
                             ^
Main.java:18: error: ';' expected
            ans +=pena[n]
                         ^
2 errors
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
const int MOD = 1000000007;
const int INF = INT_MAX;



int main(int argc, char const *argv[])
{
    long long int n, m;
    cin >> n >> m;
    long long int p[m];
    string s[m];
    for (int i=0; i < m; i++){
        cin >> p[i] >> s[i];
    }

    int flag[n];
    for (int i=0; i < n; i++){
        flag[i] = 0;
    }
    
    long long int ac = 0;
    long long int wa = 0;
    for (int i=0; i < m; i++){
        if ((s[i])[0] == 'A'  &&  (s[i])[1] == 'C'){
            if (flag[p[i]-1] == 0){
                ac++;
                flag[p[i]-1] = 1;
            }
        }
        else{
            if (flag[p[i]-1] == 0){
                wa++;
            }
        }
    }


    cout << ac << endl;
    cout << wa << endl;


    

    return 0;
}




//              g++ -std=c++1z  

Compiler output:
a.cc:9:17: error: 'INT_MAX' was not declared in this scope
    9 | const int INF = INT_MAX;
      |                 ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cstdio>
  +++ |+#include <climits>
    3 |
Language: C

#include <stdio.h>

int main(void){
  int n, m;
  int p[9999];
  char s[9999][2];
  
  scanf("%d %d", &n, &m);
  for(int i=0; i<m; i++){
    scanf("%d %s", &p[i], s[i]);
  }
  int ac[9999], wa[9999];
  for(int i=0; i<m; i++){
    ac[i] = wa[i] = 0;
  }
  int count = 1;
  for(int i = 0; i < m; i++){
    if(p[i] == count){
      if(s[i][0] == "W"){
        wa[i] = 1;
      }else{
        ac[i] = 1;
      }
    }else{
      count ++;
      i --;
    }
  }
  int a, w;
  for(int =0; i< m; i++){
    if(ac[i] == 1) a++;
    if(wa[i] == 1) w++;
  }
  printf("%d %d", a, w);
  return 0;
}
      

Compiler output:
main.c: In function 'main':
main.c:19:18: warning: comparison between pointer and integer
   19 |       if(s[i][0] == "W"){
      |                  ^~
main.c:30:11: error: expected identifier or '(' before '=' token
   30 |   for(int =0; i< m; i++){
      |           ^
main.c:30:15: error: 'i' undeclared (first use in this function)
   30 |   for(int =0; i< m; i++){
      |               ^
main.c:30:15: note: each undeclared identifier is reported only once for each function it appears in
Language: Java

import java.util.*;

class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
Integer f[] = new Integer[m];
int ac = 0;
int wa = 0;
for(int i=1;i<n;i++){
    int p = sc.nextInt();
    String s = sc.next();
    if(s.contains("AC"){
        if(f[p]==0){
            f[p]++
            ac++;
        }
    }else{
        wa++;
    }
}
System.out.println(ac);
System.out.println(wa);
}
}


Compiler output:
Main.java:14: error: ')' expected
    if(s.contains("AC"){
                       ^
Main.java:16: error: ';' expected
            f[p]++
                  ^
2 errors
Language: C++

#include<iostream>
#include<string>
using namespace std;
typedef long long ll;


int main(){
    int N, M; cin >> N >> M;
    string judge;
    ll p[M], s[M], AC_num=0, pena[N], problem[N], temp;
    for(int i=0; i<M; i++){
        cin >> temp >> judge;
        p[i] = temp-1;
        if(judge == "AC") s[i] = 1;
        else s[i] = 0;
    }
    for(int i=0; i<N; i++){
        problem[i] = 0;
        pena[i] = 0;
    }
    for(int i=0; i<M; i++){
        if(s[i] == 0 && problem[p[i]] == 0){
            pena[p[i]] += 1; 
            //cout << "i=" << i <<", p[i]="<< p[i] <<", pena added" << endl;       
        }else if(s[i] == 1 && problem[p[i]] == 0){
            problem[p[i]] = 1;
            //cout << "i=" << i <<", p[i]=" << p[i] << ", AC added" << endl;
        }
    }
    ll ans_AC=0, ans_penalty=0;
    for(int i=0; i<N; i++){
        ans_AC += 1;
        //cout << "AC: " << i << endl;
        ans_penalty += pena[i];
        //cout << "pena: " << i << endl;
        }
    }
    cout << ans_AC << " " << ans_penalty << endl;
}

Compiler output:
a.cc:38:5: error: 'cout' does not name a type
   38 |     cout << ans_AC << " " << ans_penalty << endl;
      |     ^~~~
a.cc:39:1: error: expected declaration before '}' token
   39 | }
      | ^
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
  int n,m;
  int *result;
  int i;
  int tmp;
  int *success;
  int *penalty;
  int total_s=0,total_p=0;
  char tmp_s[3];
  char *ac="AC";
  char *wa="WA";
  
  scanf("%d %d",&n,&m);
  result=(int*)malloc(sizeof(int)*n);
  success=(int*)malloc(sizeof(int)*n);
  penalty=(int*)malloc(sizeof(int)*n);
  for(i=0;i<n;i++){
    result[i]=0;
    success[i]=0;
    penalty[i]=0;
  }
  
  for(i=0;i<m;i++){
    scanf("%d %s",&tmp,tmp_s);
    if(result[tmp-1]==0 && strncmp(tmp_s,wa,2)==0){
      penalty[tmp-1]++;
    } else if(result[tmp-1]==0 && strncmp(tmp_s,ac,2)==0){
      success[tmp-1]++;
      result[tmp-1]=1;
    }
  }
  
  for(i=0;i<n;i++){
    if(success[i]==1){
      total_p+=penalty[i];
      total_s++;
    }
  
  printf("%d %d",total_s,total_p);
  free(result);
}


Compiler output:
main.c: In function 'main':
main.c:45:1: error: expected declaration or statement at end of input
   45 | }
      | ^
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
const int MOD = 1000000007;
const int INF = INT_MAX;



int main(int argc, char const *argv[])
{
    long long int n, m;
    cin >> n >> m;
    long long int p[m];
    string s[m];
    for (int i=0; i < m; i++){
        cin >> p[i] >> s[i];
    }

    int flag[n];
    for (int i=0; i < n; i++){
        flag[i] = 0;
    }
    
    long long int ac = 0;
    long long int wa = 0;
    for (int i=0; i < m; i++){
        if (s[i] == "AC"){
            if (flag[p[i]-1] == 0){
                ac++;
                flag[p[i]-1] = 1;
            }
        }
        else{
            if (flag[p[i]-1] == 0){
                wa++;
            }
        }
    }


    cout << ac << endl;
    cout << wa << endl;


    

    return 0;
}




//              g++ -std=c++1z  

Compiler output:
a.cc:9:17: error: 'INT_MAX' was not declared in this scope
    9 | const int INF = INT_MAX;
      |                 ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cstdio>
  +++ |+#include <climits>
    3 |
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;

    int p[m];
    string s[m];

    for (int i=0; i<m; i++) {
        cin >> p[i] >> s[i];
    }

    int penalty_count[n+1];
    memset(penalty_count, 0, sizeof(penalty_count));

    bool is_ac[n+1];
    for (int i=0; i<n+1; i++)
        is_ac[i] = false;

    int success = 0;
    for (int i=0; i<m; i++) {
        if (is_ac[p[i]]) {
            continue;
        }

        bool current_is_ac =  s[i] == "AC";
        if (current_is_ac) {
            is_ac[p[i]] = true;
            success++;
        } else {
            penalty_count[p[i]]++;
        }
    }

    int penalty = 0;
    for (int i=1; i<n+1; i++) {
        if (is_ac[i]) {
            penalty += penalty_count[i];
        }
    }

    cout << success << " " << penalty << endl;
}


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

# include <stdio.h>
void merge(int *a, int na, int *b, int nb){
	int ta[na],tb[nb], i;
	for(i=0; i< na; i++)
		ta[i]= a[i];
	for(i=0;i <nb; i++)
		tb[i] =  b[i];

	int ia=0, ib=0;
	i=0;
	while(ia<na && ib<nb)
		a[i++] = (ta[ia] < tb[ib]) ? ta[ia++] : tb[ib++];
	
	while(ia<na)
		a[i++]= ta[ia++];
	while(ib<nb)
		a[i++]= tb[ib++];
}

void mergeSort(int *a, int n){
	if(n<=1)
		return;
	mergeSort(a, n/2);
	mergeSort(a+ n/2, n - n/2);
	merge(a, n/2, a+n/2, n -n/2);
}
int main()
{
int n,m,c[100001],k;
scanf("%d%d",&n,&m);
if(m==0)
{
printf("0 0");
return 0;
}
int a[m];
char str[m][2];
for(int i=0;i<m;i++)
scanf("%d %s",&a[i],str[i]);
int count1=0,count2=0;
for(int i=1;i<m;i++)
{
if(str[i][0]=='A')
{c[count1++]=a[i];
k=i;}
}
mergeSort(c,count1);int count=1;
for(int i=1;i<count1;i++)
if(c[i]!=c[i-1])
count++;
//printf("%d\n",k);
for(int i=0;i<k;i++)
{
//printf("c=%d\n",count2);
//printf("%c\n",str[i][0]);
if(str[i][0]=='W')
count2++;
//printf("c=%d\n",count2);
}
printf("%d %d",count,count2);
return 0;
}



























# include <stdio.h>
void merge(int *a, int na, int *b, int nb){
	int ta[na],tb[nb], i;
	for(i=0; i< na; i++)
		ta[i]= a[i];
	for(i=0;i <nb; i++)
		tb[i] =  b[i];

	int ia=0, ib=0;
	i=0;
	while(ia<na && ib<nb)
		a[i++] = (ta[ia] < tb[ib]) ? ta[ia++] : tb[ib++];
	
	while(ia<na)
		a[i++]= ta[ia++];
	while(ib<nb)
		a[i++]= tb[ib++];
}

void mergeSort(int *a, int n){
	if(n<=1)
		return;
	mergeSort(a, n/2);
	mergeSort(a+ n/2, n - n/2);
	merge(a, n/2, a+n/2, n -n/2);
}
int main()
{
int n,m,c[100001],k;
scanf("%d%d",&n,&m);
if(m==0)
{
printf("0 0");
return 0;
}
int a[m];
char str[m][2];
for(int i=0;i<m;i++)
scanf("%d %s",&a[i],str[i]);
int count1=0,count2=0;
for(int i=1;i<m;i++)
{
if(str[i][0]=='A')
{c[count1++]=a[i];
k=i;}
}
mergeSort(c,count1);int count=1;
for(int i=1;i<count1;i++)
if(c[i]!=c[i-1])
count++;
//printf("%d\n",k);
for(int i=0;i<k;i++)
{
//printf("c=%d\n",count2);
//printf("%c\n",str[i][0]);
if(str[i][0]=='W')
count2++;
//printf("c=%d\n",count2);
}
printf("%d %d",count,count2);
return 0;
}





























Compiler output:
main.c:91:6: error: redefinition of 'merge'
   91 | void merge(int *a, int na, int *b, int nb){
      |      ^~~~~
main.c:2:6: note: previous definition of 'merge' with type 'void(int *, int,  int *, int)'
    2 | void merge(int *a, int na, int *b, int nb){
      |      ^~~~~
main.c:109:6: error: redefinition of 'mergeSort'
  109 | void mergeSort(int *a, int n){
      |      ^~~~~~~~~
main.c:20:6: note: previous definition of 'mergeSort' with type 'void(int *, int)'
   20 | void mergeSort(int *a, int n){
      |      ^~~~~~~~~
main.c:116:5: error: redefinition of 'main'
  116 | int main()
      |     ^~~~
main.c:27:5: note: previous definition of 'main' with type 'int()'
   27 | int main()
      |     ^~~~
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{    int n,m,i,countwa=0,countac=0,a[100005]={0},t;
    scanf("%d %d",&m,&n);
    getchar();
    for(i=0;i<n;i++)
    {   char s[3];
        scanf("%d",&t);
        getchar();
        gets(s);
       if(s[0]=='A'&&s[1]=='C'&&a[t]==0)a[t]=1,countac++;

       if(s[0]=='W'&&s[1]=='A'&&a[t]==0)countwa++;
    }
    printf("%d %d",countac,countwa);

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   13 |         gets(s);
      |         ^~~~
      |         getw
Language: C++


  vector<string> S(M);
  
  for (int i = 0; i < M; i++) {
  	cin >> P.at(i) >> S.at(i);
  }
  
  int errors = 0;
  int corrects = 0;
  
  for (int i = 1; i < N + 1; i++) {
    for (int j = 0; j < M; j++) {
      if (P.at(j) == i) {
        if (S.at(j) == "WA") {
          errors += 1;
        }
        else if (S.at(j) == "AC") {
          corrects += 1;
          break;
        }
      }
      else {
        continue;
      }
    }
  }
  
  cout << corrects << " " << errors << endl;

}

Compiler output:
a.cc:2:3: error: 'vector' does not name a type
    2 |   vector<string> S(M);
      |   ^~~~~~
a.cc:4:3: error: expected unqualified-id before 'for'
    4 |   for (int i = 0; i < M; i++) {
      |   ^~~
a.cc:4:19: error: 'i' does not name a type
    4 |   for (int i = 0; i < M; i++) {
      |                   ^
a.cc:4:26: error: 'i' does not name a type
    4 |   for (int i = 0; i < M; i++) {
      |                          ^
a.cc:11:3: error: expected unqualified-id before 'for'
   11 |   for (int i = 1; i < N + 1; i++) {
      |   ^~~
a.cc:11:19: error: 'i' does not name a type
   11 |   for (int i = 1; i < N + 1; i++) {
      |                   ^
a.cc:11:30: error: 'i' does not name a type
   11 |   for (int i = 1; i < N + 1; i++) {
      |                              ^
a.cc:28:3: error: 'cout' does not name a type
   28 |   cout << corrects << " " << errors << endl;
      |   ^~~~
a.cc:30:1: error: expected declaration before '}' token
   30 | }
      | ^
Language: C++

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

typedef long long ll;

int n;
int m;
int MAX_N=100000;
int MAX_N=100000;
int p[100000];
string s[100000];
int ac[100000];
ll count[100000];

void solve();
int main(){
  scanf("%d",&n);
  scanf("%d",&m);
  for(int i=0;i<m;i++){
    scanf("%d",&p[i]);
    cin >> s[i];
  }
  for(int i=0;i<MAX_N;i++){
    ac[i]=0;
  }
  for(int i=0;i<MAX_N;i++){
    count[i]=0;
  }
  solve();
  return 0;
}

void solve(){
  for(int i=0;i<m;i++){
    int num = p[i];
    if(ac[num-1]==0){
      if(s[i]=="AC"){
        ac[num-1]=1;
      }
      else{
        count[num-1]+=1;
      }
    }
  }
  int total_ac=0;
  ll total_penalty=0;
  for(int i=0;i<n;i++){
    total_ac+=ac[i];
  }
  for(int i=0;i<n;i++){
    total_penalty+=count[i];
  }
  printf("%d %ld\n",total_ac,total_penalty);
}

Compiler output:
a.cc:11:5: error: redefinition of 'int MAX_N'
   11 | int MAX_N=100000;
      |     ^~~~~
a.cc:10:5: note: 'int MAX_N' previously defined here
   10 | int MAX_N=100000;
      |     ^~~~~
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
const int MOD = 1000000007;
const int INF = INT_MAX;


int fact(int n){
    int a=1;
    for (int i=1; i <= n; i++){
        a *= i;
    }

    return a;
}

int main(int argc, char const *argv[])
{
    int n, m;
    cin >> n >> m;
    int p[m];
    string s[m];
    for (int i=0; i < m; i++){
        cin >> p[i] >> s[i];
    }

    int flag[n];
    for (int i=0; i < n; i++){
        flag[i] = 0;
    }
    
    int ac = 0;
    int wa = 0;
    for (int i=0; i < m; i++){
        if (s[i] == "AC"){
            if (flag[p[i]-1] == 0){
                ac++;
                flag[p[i]-1] = 1;
            }
        }
        else{
            if (flag[p[i]-1] == 0){
                wa++;
            }
        }
    }


    cout << ac << endl;
    cout << wa << endl;


    

    return 0;
}




//              g++ -std=c++1z  

Compiler output:
a.cc:9:17: error: 'INT_MAX' was not declared in this scope
    9 | const int INF = INT_MAX;
      |                 ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cstdio>
  +++ |+#include <climits>
    3 |
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, m;
  cin >> n >> m;
  
  if (m = 0) {
    cout << "0 0" << endl;
    goto end;
  }
  
  vector<int> ac(n);
  vector<int> isac(n);
  for (int i = 0; i < n; i++) {
    ac.at(i) = 0;
    isac.at(i) = 0;
    }
  
  int numac, pe;
  numac = pe = 0;
  
  for (int i = 0; i < m; i++) {
    int p; string s;
    cin >> p >> s;
    p--;
    
    if (isac.at(p) == 0) {
      ac.at(p)++;
      if (s == "AC") {
        isac.at(p) = 1;
        numac++;
      }
    }
  }
  
  for (int i = 0; i < n; i++)
    pe += (ac.at(i) - 1) * isac.at(i);
  cout << numac << " " << pe << endl;
  
  end:
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:3: error: jump to label 'end'
   41 |   end:
      |   ^~~
a.cc:10:10: note:   from here
   10 |     goto end;
      |          ^~~
a.cc:14:15: note:   crosses initialization of 'std::vector<int> isac'
   14 |   vector<int> isac(n);
      |               ^~~~
a.cc:13:15: note:   crosses initialization of 'std::vector<int> ac'
   13 |   vector<int> ac(n);
      |               ^~
Language: C++

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

int main() {
  int N, K;
  cin >> N;
  cin >> K;
  int ans[N];
  int tru[N];
  memset(ans, 0, sizeof(ans));
  memset(tru, 0, sizeof(tru));

  for (int m_i = 0; m_i < M; m_i++) {
    int q_i;
    string result;
    cin >> q_i;
    q_i--;
    cin >> result;
    if (result == "AC") {
      tru[q_i] = 1;
    } else {
      if (!tru[q_i]) {
        ans[q_i] += 1;
      }
    }
  }

  int rig = 0;
  int pen = 0;
  for (int n_i = 0; n_i < N; n_i++) {
    rig += tru[n_i];
    if (tru[n_i]) {
      pen += ans[n_i];
    }
  }
  cout << rig << " " << pen << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:27: error: 'M' was not declared in this scope
   13 |   for (int m_i = 0; m_i < M; m_i++) {
      |                           ^
Language: Java

mport java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt(), M = sc.nextInt();
		if(M == 0)System.out.println(0 + " " + 0);
		else if(M == 1) {
			if(sc.next().equals("WA")) {
				System.out.println(0 + " " + 1);
            }else {
            	System.out.println(1 + " " + 0);
            }
		}
		else {
			int c = sc.nextInt(), bc = c, ans = 0, pe = 0;
			String ch=null;
			boolean bb = false;
			
			for(int i = 0; i < M-1; i++) {
				ch = sc.next();
				if(c == bc) {
					if(!bb) {
						if(ch.equals("WA")) {
							pe++;
							System.out.println("p11");
						}else {
							ans++;
							bb = true;
							System.out.println("p12");
						}
					}
					bc = c;
					c=sc.nextInt();
				}else{
						if(ch.equals("WA")) {
							pe++;
							bb = false;
							System.out.println("p21");
						}else {
							ans++;
							bb = true;
							System.out.println("p22");
						}
					
					bc = c;
					c=sc.nextInt();
				}
			}
			System.out.println(ans +" " + pe);
		}
		
	}
	
}


Compiler output:
Main.java:1: error: class, interface, enum, or record expected
mport java.util.Scanner;
^
1 error
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

typedef long long int ll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
const int MOD = 1000000007;
const int INF = INT_MAX;


int fact(int n){
    int a=1;
    for (int i=1; i <= n; i++){
        a *= i;
    }

    return a;
}

int main(int argc, char const *argv[])
{
    int n, m;
    cin >> n >> m;
    int p[m];
    string s[m];
    for (int i=0; i < m; i++){
        cin >> p[i] >> s[i];
    }

    int flag[n];
    for (int i=0; i < n; i++){
        flag[i] = 0;
    }
    
    int ac = 0;
    int wa = 0;
    for (int i=0; i < m; i++){
        if (s[i] == "AC"){
            if (flag[p[i]-1] == 0){
                ac++;
                flag[p[i]-1] = 1;
            }
        }
        else{
            if (flag[p[i]-1] == 0){
                wa++;
            }
        }
    }


    cout << ac << endl << wa << endl;


    

    return 0;
}




//              g++ -std=c++1z  

Compiler output:
a.cc:9:17: error: 'INT_MAX' was not declared in this scope
    9 | const int INF = INT_MAX;
      |                 ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cstdio>
  +++ |+#include <climits>
    3 |
Language: C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
  int n,m;
  int *result;
  int i;
  int tmp;
  int success=0;
  int penalty=0;
  char tmp_s[3];
  char *ac="AC";
  char *wa="WA";
  
  scanf("%d %d",&n,&m);
  result=(int*)malloc(sizeof(int)*n);
  for(i=0;i<n;i++){
    result[i]=0;
  }
  
  for(i=0;i<n,i++){
    scanf("%d %s",&tmp,tmp_s);
    if(result[tmp-1]==0 && strncmp(tmp_s,wa,2)==0){
      penalty++;
    } else if(result[tmp-1]==0 && stncmp(tmp_s,ac,2)==0){
      success++;
      result[tmp-1]=1;
    }
  }
  
  printf("%d %d",success,penalty);
  free(result);
}

Compiler output:
main.c: In function 'main':
main.c:22:18: error: expected ';' before ')' token
   22 |   for(i=0;i<n,i++){
      |                  ^
      |                  ;
main.c:26:35: error: implicit declaration of function 'stncmp'; did you mean 'strncmp'? [-Wimplicit-function-declaration]
   26 |     } else if(result[tmp-1]==0 && stncmp(tmp_s,ac,2)==0){
      |                                   ^~~~~~
      |                                   strncmp
Language: Java

import java.util.*;

//update 2020/1/1 23:01

public class Main{

  static Scanner sc = new Scanner(System.in);
  static StringBuilder sb = new StringBuilder();

  public static void main(String[] args) {

    int n = nextInt();
    int m = nextInt();



    Arrays.fill(memo,false);

    int ok = 0;
    int nok = 0;

    boolean[] memo = new boolean[n+1];
    int[] wa = new int[n+1];


    int[] p = new int[m];
    String[] s = new String[m];

    for(int i=0;i<m;i++){
      p[i] = nextInt();
      s[i] = next();

      if(!memo[p[i]] && s[i].equals("WA")){ //まだ正解してない
        wa[p[i]] ++;
      }
      else if(!memo[p[i]] && s[i].equals("AC")){ //今正解した
        nok += wa[p[i]];
        memo[p[i]] = true;
        ok ++;
      }
    }



    System.out.println(ok+" "+nok);

  }
  /*
    static String toSmall(String s){
      char c = s.charAt(0);
      //if(Character.isUpperCase(c)){
      if(c<=90){
        c += 32;
      }
      return String.valueOf(c);
    }
    static String toBig(String s){
      char c = s.charAt(0);
      //if(Character.isLowerCase(c)){
      if(c>=97){
        c -= 32;
      }
      return String.valueOf(c);
    }
  */

  static String toSmall(String s){
    return s.toLowerCase();
  }

  static String toBig(String s){
    return s.toUpperCase();
  }

  static String next(){
    return sc.next();
  }

  static int nextInt(){
    return Integer.parseInt(sc.next());
  }

  static long nextLong(){
    return Long.parseLong(sc.next());
  }

  static double nextDouble(){
    return Double.parseDouble(sc.next());
  }

  static String[] splitString(String s){
    return s.split("");
  }

  static char[] splitChar(String s){
    return s.toCharArray();
  }

  static int charToInt(char a){
    return a - 48;
  }

////////////////////////////////////////////
  public static int max(int[] a){
    int lng = a.length;
    int max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
  public static long max(long[] a){
    int lng = a.length;
    long max = a[0];
    for(int i=1;i<lng;i++){
      max = Math.max(max,a[i]);
    }
    return max;
  }
////////////////////////////////////////////

////////////////////////////////////////////
  public static int min(int[] a){
    int lng = a.length;
    int min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
  public static long min(long[] a){
    int lng = a.length;
    long min = a[0];
    for(int i=1;i<lng;i++){
      min = Math.min(min,a[i]);
    }
    return min;
  }
////////////////////////////////////////////

}


Compiler output:
Main.java:17: error: cannot find symbol
    Arrays.fill(memo,false);
                ^
  symbol:   variable memo
  location: class Main
1 error
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
    int n,m,p[100005];
    int hoji;
    char s[5];
    int flag[100005];
    int wac[100005];
    int wa=0,ac=0;

    for(int count2=0;count2<m;count2++){
        flag[count2]=0;
        int wac[100005]=0;
        }
    scanf("%d %d",&n,&m);
    for(int count=0;count<m;count++){
        scanf("%d",&hoji);
        scanf("%s",s);
        if(s[0]=='W'&&flag[hoji]!=1){wac[count]++;continue;}//AC前でWA
        if(s[0]=='A'&&flag[hoji]!=1){ac++;flag[hoji]=1,wa=wa+wac[count];continue;}//初AC
        if(s[0]=='W'&&flag[hoji]==1){continue;}//AC後にWA
        if(s[0]=='A'&&flag[hoji]==1){continue;}//AC後にAC
    }
    printf("%d %d",ac,wa);
}


Compiler output:
main.c: In function 'main':
main.c:14:25: error: invalid initializer
   14 |         int wac[100005]=0;
      |                         ^
Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define ll          long long
#define pb          push_back
#define eb 			emplace_back
#define mp 			make_pair
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define vii         vector<pii>
#define mi          map<ll,ll>
#define mii         map<pii,ll>
#define all(a)      (a).begin(),(a).end()
#define fi          first
#define si          second
#define sz(x)       (ll)x.size()
#define endl        '\n'
#define checkbit(n, b) ((n >> b) & 1)
#define mod        1000000007
#define puts(n)		cout<<n;
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define setbits(x) __builtin_popcount(x)
#define mset(m,v) memset(m,v,sizeof(m))
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    
    ll n,m;
    cin>>n>>m;
    vector <ll> p;
    vector <string > s;
    map <ll,bool> m1;
    for(ll i=0;i<m;i++){
        ll a;
        string x;
        cin>>a>>x;
        p.pb(a);
        s.pb(x);
        if(x=="AC") m1[a]=true;
    }
    ll cor=m1.size(),pen=0;
    mi count,vis;
	for(ll i=0;i<m;i++){
        if(s[i]=="WA" && viz[p[i]]==0){
        count[p[i]]++;
        }
        else if(s[i]=="AC" && viz[p[i]]==0){
            pen+=count[p[i]];
            viz[p[i]]=1;
        }
    }
    cout<<cor<<" "<<pen;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:26: error: 'viz' was not declared in this scope; did you mean 'vis'?
   46 |         if(s[i]=="WA" && viz[p[i]]==0){
      |                          ^~~
      |                          vis
Language: C++

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

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> p(m);
	vector<string> s(m);
	for(int i=0; i<m; i++){
		int a;
		cin >> a >> s.at(i);
		a--;
		p.at(i) = a;
	}
	vector<bool> ac(n);
	vector<int> num(n) = {0};
	for(int i=0; i<n; i++){
		ac.at(i) = false;
	}
	int score = 0;
	int pena = 0;
	for(int i=0; i<m; i++){
		if(s.at(i) == "WA"){
			if(!ac.at(p.at(i))){
				num.at(p.at(i))++;
			}
		}else{
			if(!ac.at(p.at(i))){
				score++;
				ac.at(p.at(i))=true;
			}
		}
	}
	for(int i=0; i<n; i++){
		if(ac.at(i)){
			pena += num.at(i);
		}
	}
	cout << score << " " << pena << endl;  	
}



Compiler output:
a.cc: In function 'int main()':
a.cc:16:28: error: expected ',' or ';' before '=' token
   16 |         vector<int> num(n) = {0};
      |                            ^
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void){
    int n,m,p[100005];
    int hoji;
    char s[5];
    int flag[100005];
    int wa[100005];
    int wa=0,ac=0;

    for(int count2=0;count2<m;count2++){
        flag[count2]=0;
        int wa[100005]=0;
        }
    scanf("%d %d",&n,&m);
    for(int count=0;count<m;count++){
        scanf("%d",&hoji);
        scanf("%s",s);
        if(s[0]=='W'&&flag[hoji]!=1){wa[count]++;continue;}//AC前でWA
        if(s[0]=='A'&&flag[hoji]!=1){ac++;flag[hoji]=1,wa=wa+wa[count];continue;}//初AC
        if(s[0]=='W'&&flag[hoji]==1){continue;}//AC後にWA
        if(s[0]=='A'&&flag[hoji]==1){continue;}//AC後にAC
    }
    printf("%d %d",ac,wa);
}


Compiler output:
main.c: In function 'main':
main.c:10:9: error: conflicting types for 'wa'; have 'int'
   10 |     int wa=0,ac=0;
      |         ^~
main.c:9:9: note: previous declaration of 'wa' with type 'int[100005]'
    9 |     int wa[100005];
      |         ^~
main.c:14:24: error: invalid initializer
   14 |         int wa[100005]=0;
      |                        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
//define
typedef pair<int,int>pi;
#define elif else if
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define Rep(x,y) for(int k=x;k<y;k++)
#define all(x) x.begin(),x.end()
#define pb push_back
#define vint vector<int>
#define vvint vector<vector<int>>
#define vtr vector<string>
#define vvtr vector<vector<string>>
#define vhar vector<char>
#define vvhar vector<vector<char>>
#define mod 100000007
#define elif else if
#define str string
int sum(int a){
  int b=0;
  while(true){
    if(a>=1){
      a%=10;
      b+=a%=10;
    }
    else break;
  }
  return b;
}
int main(){
  int N,M,O,P=0,c=0,c2=0,crash=0,nowtab=1;
  double D,D2;
  char C;
  str S,T,U;
  cin>>N>>M;
  vint p(M);
  vtr s(M);
  vint B(N);rep(0,N)B[i]=0;
  rep(0,M){
    cin>>p[i]>>s[i];
  }
  rep(0,M){
    if(B[p[i]-1]==1)crach++;
    else if(B[p[i]-1]==0&&s[i]=="AC"){
      B[p[i]-1]=1;
      c++;
    }
    else if(B[p[i]-1]==0&&s[i]=="WA"){
      c2++;
    }
  }
  cout<<c<<" "<<c2<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:21: error: 'crach' was not declared in this scope; did you mean 'crash'?
   44 |     if(B[p[i]-1]==1)crach++;
      |                     ^~~~~
      |                     crash
Language: C++

#include <iostream>
#include <cstdio>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <queue>
#include <cmath>
#include <cstring>
using namespace std;

#ifdef ENABLE_LL
#define int long long
#endif

#ifdef ENABLE_LL
#define I "%lld"
#define II "%lld%lld"
#define III "%lld%lld%lld"
#define IIII "%lld%lld%lld%lld"
#define IN "%lld\n"
#define IIN "%lld%lld\n"
#define IIIN "%lld%lld%lld\n"
#define IIIIN "%lld%lld%lld%lld\n"
#else
#define I "%d"
#define II "%d%d"
#define III "%d%d%d"
#define IIII "%d%d%d%d"
#define IN "%d\n"
#define IIN "%d%d\n"
#define IIIN "%d%d%d\n"
#define IIIIN "%d%d%d%d\n"
#endif

#ifdef __LOCALE__
#define see(a) std::cout << #a << "=" << a << std::endl
#define ses(a) std::cout << #a << "=" << a << " " 
#else
#define see(a) //std::cout << #a << "=" << a << std::endl
#define ses(a)
#endif
#define repe(a,b) for (int a=0;a<(int)b.size();a++)
#define rep(i,n) for (int i=0;i<n;i++)
#define repa(i,n) for (int i=1;i<=n;i++)
#define repi(i,a,b) for (int i=a;i<=b;i++) 
#define repb(i,a,b) for (int i=a;i>=b;i--)
typedef pair < int , int > pr;
typedef pair < pr  , int > prr;
#define L first
#define R second
template <class T> inline bool checkMin(T& a , T b) { return (a > b ? a=b,1 : 0); }
template <class T> inline bool checkMax(T& a , T b) { return (a < b ? a=b,1 : 0); }
class Scanner{ private: istream& ist;public: Scanner(istream& in):ist(in){} string next(){ string r; ist >> r; return r; } string nextLine(){ string r; getline(ist,r); return r; } int nextInt(){ int r; ist >> r; return r; } double nextDouble(){ double r; ist >> r; return r; }};
Scanner sc(cin);

const int N = 100005;
int st[N];
int n, m;

void init() {
    scanf(II,&n,&m);
}

int pe[N];
void solve() {
    int a =0;
    rep (i,m) {
        int p; scanf("%d",&p); string s; cin >> s;
        if (s == "WA") {
            if (st[p] != 2) {
                st[p] = 1;
                pe[p]++;
            }
        }else {
            if (st[p] != 2) a++;
            st[p] = 2;
        }
    }
    int pee =0 ; repa (i,n) if (st[i] r= 2) pee+=pe[i];
    printf("%d %d\n", a, pee);
}


#ifdef ENABLE_LL
#undef int
#endif
int main(){
    init();
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:81:38: error: expected ')' before 'r'
   81 |     int pee =0 ; repa (i,n) if (st[i] r= 2) pee+=pe[i];
      |                                ~     ^~
      |                                      )