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

import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        int cnt = 0;
        int max = 0;
        for(int i = 0; i < S; i++){
            char c = S.charAt(i);
            if(c == 'I'){
                cnt++;
                max = Math.max(max,cnt);
            }else{
                cnt--;
            }
        }
        System.out.println(cnt);
    }
}

Compiler output:
Main.java:10: error: bad operand types for binary operator '<'
        for(int i = 0; i < S; i++){
                         ^
  first type:  int
  second type: String
1 error
Language: Java

import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        int cnt = 0;
        int max = ;
        for(int i = 0; i < S; i++){
            char c = S.charAt(i);
            if(c == 'I'){
                cnt++;
                max = Math.max(max,cnt);
            }else{
                cnt--;
            }
        }
        System.out.println(cnt);
    }
}

Compiler output:
Main.java:9: error: illegal start of expression
        int max = ;
                  ^
1 error
Language: C++

include<bits/stdc++.h>
using namespace std;
string a;
int ans,l,maxx=-1*0x7fffffff;
int main(){
    cin>>l>>a;
    for(int i=0;i<l;i++){
        ans+=(a[i]=='I')?1:-1;
        maxx=max(ans,maxx);
    }
    if(maxx==-1)maxx=0;
    cout<<maxx<<endl;
    return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc:3:1: error: 'string' does not name a type
    3 | string a;
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:6:5: error: 'cin' was not declared in this scope
    6 |     cin>>l>>a;
      |     ^~~
a.cc:6:13: error: 'a' was not declared in this scope
    6 |     cin>>l>>a;
      |             ^
a.cc:9:14: error: 'max' was not declared in this scope; did you mean 'maxx'?
    9 |         maxx=max(ans,maxx);
      |              ^~~
      |              maxx
a.cc:12:5: error: 'cout' was not declared in this scope
   12 |     cout<<maxx<<endl;
      |     ^~~~
a.cc:12:17: error: 'endl' was not declared in this scope
   12 |     cout<<maxx<<endl;
      |                 ^~~~
Language: C++

#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<list>
#include<map>
#include<memory>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>
//#include<windows.h>
//#include<time.h>

#define r(a,b,c) for(int a=b;a<=c;++a)
#define INF 0x7fffffff
#define ll long long

using namespace std;

inline int read()
{
	int a=0,b=1;
	char c=getchar();
	while(c<='0'||c>'9')
	{
		/*
		if(c=='-')
		{
		    b=-1;
		}
		*/
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		a=a*10+c-'0';
		c=getchar();
	}
	return a*b;
}

void write(int n)
{
	/*
	if(n<0)
	{
	    n=-n;
	    putchar('-');
	}
	*/
	if(n>10)
	{
		write(n/10);
	}
	putchar(n%10+'0');
}
int a,t,Max = -1;
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d%s",&a,c);
	for(int i = 0 ; i < a ; ++ i)
	{
		if(c[i] == 'I')
		{
			t ++;
		}
		else t --;
		Max = max(Max,t);
	}
	printf("%d",Max);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:25: error: 'c' was not declared in this scope
   72 |         scanf("%d%s",&a,c);
      |                         ^
Language: C++

#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<list>
#include<map>
#include<memory>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<utility>
#include<vector>
//#include<windows.h>
//#include<time.h>

#define r(a,b,c) for(int a=b;a<=c;++a)
#define INF 0x7fffffff
#define ll long long

using namespace std;

inline int read()
{
	int a=0,b=1;
	char c=getchar();
	while(c<='0'||c>'9')
	{
		/*
		if(c=='-')
		{
		    b=-1;
		}
		*/
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		a=a*10+c-'0';
		c=getchar();
	}
	return a*b;
}

void write(int n)
{
	/*
	if(n<0)
	{
	    n=-n;
	    putchar('-');
	}
	*/
	if(n>10)
	{
		write(n/10);
	}
	putchar(n%10+'0');
}

int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	scanf("%d%s",&a,c);
	for(int i = 0 ; i < a ; ++ i)
	{
		if(c[i] == 'I')
		{
			t ++;
		}
		else t --;
		Max = max(Max,t);
	}
	printf("%d",Max);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:72:23: error: 'a' was not declared in this scope
   72 |         scanf("%d%s",&a,c);
      |                       ^
a.cc:72:25: error: 'c' was not declared in this scope
   72 |         scanf("%d%s",&a,c);
      |                         ^
a.cc:77:25: error: 't' was not declared in this scope
   77 |                         t ++;
      |                         ^
a.cc:79:22: error: 't' was not declared in this scope
   79 |                 else t --;
      |                      ^
a.cc:80:17: error: 'Max' was not declared in this scope
   80 |                 Max = max(Max,t);
      |                 ^~~
a.cc:80:31: error: 't' was not declared in this scope
   80 |                 Max = max(Max,t);
      |                               ^
a.cc:82:21: error: 'Max' was not declared in this scope
   82 |         printf("%d",Max);
      |                     ^~~
Language: C++

#include<iostream>
using namespace std;

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int count = 0;
  int answer = 0;
  for(int i =0;i < N;i++) {
    if(S.at(i) == 'I') {
      count+=;
      if(answer < count){
        answer = count;
      }
    }
    if(S.at(i) == 'D') {
      count = count - 1;
    }
    cout << answer << endl;
  }

Compiler output:
a.cc: In function 'int main()':
a.cc:13:14: error: expected primary-expression before ';' token
   13 |       count+=;
      |              ^
a.cc:22:4: error: expected '}' at end of input
   22 |   }
      |    ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include<iostream>
using namespace std;

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  int count = 0;
  int answer = 0;
  for(int i =0;i < N;i++) {
    if(S.at(i) == 'I') {
      count++;
      if(answer < count){
        answer = count;
      }
    }
    if(S.at(i) == 'D') {
      count--;
    }
    cout << answer << endl;
  }

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

#include<iostream>
using namespace std;

int main() {
  int N;
  string S;
  int count = 0;
  int answer = 0;
  for(int i =0;i < N;i++) {
    if(S.at(i) == 'I') {
      count++;
      if(answer < count){
        answer = count;
      }
    }
    if(S.at(i) == 'D') {
      count--;
    }
  }

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

#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3)

//  Increment Decrement.cpp
//
//  Created by WinnieJt on 2019/3/21.
//
//  Copyright © 2019 金天. All rights reserved.

#include<bits/stdc++.h>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cerrno>
#include<clocale>
#include<cmath>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<utility>
#include<vector>
#include<cwchar>
#include<cwctype>
typedef double db;
typedef long long ll;
ll maxn=23333;
using namespace std;
char x[maxn];
ll n,pre,hig;
ll cmp(ll a,ll b)
{
    if(a>=b) return a;
    else return b;
}
int main(void)
{
    ios::sync_with_stdio(false);
    cin >> n;
    for(ll i=0;i<n;i++) cin >> x[i];
    for(ll i=0;i<n;i++)
    {
        if(x[i]=='I') pre++;
        else if(x[i]=='D') pre--;
        hig=cmp(hig,pre);
    }
    cout << hig << endl;
    return 0;
}


Compiler output:
a.cc:51:8: error: size of array 'x' is not an integral constant-expression
   51 | char x[maxn];
      |        ^~~~
Language: C++

#include <cstdio>
#include <iostream>
using namespace std;
char s[110];
int n,pos,maxn;//pos存储当前高度，maxn存储最高高度
int main()
{
    scanf("%d%s",&n,s+1);//读入字符串的长度和字符串
    for(int i=1;i<=n;++i)
    {
        if(s[i]=='I') ++pos;//判断如果是‘I’，高度++
        else --pos;//否则高度--
        maxn=max(maxn,pos);//每次选取最大值
    }
    printf("%d\n",maxn);//输出答案
    return 0;//完美结束


Compiler output:
a.cc: In function 'int main()':
a.cc:16:14: error: expected '}' at end of input
   16 |     return 0;//完美结束
      |              ^
a.cc:7:1: note: to match this '{'
    7 | {
      | ^
Language: Java

import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
  int n=sc.nextInt();
  String po[]=sc.next().split("",0);
  int x=0,y=0;
  for(int i=0;i<n;i++){
    y+=(po[i].equals("I"))?1:-1;
    x=Math.max(x,y)
  }
    System.out.println(x);
}
}


Compiler output:
Main.java:10: error: ';' expected
    x=Math.max(x,y)
                   ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n; 
long long z__,maxx;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		char a;
		cin>>a;
		if(a=='I')
		z__++;
		else
		z__--;
		if(z>maxx)
		{
			maxx=z;
		}
	}
	cout<<maxx;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:20: error: 'z' was not declared in this scope
   16 |                 if(z>maxx)
      |                    ^
Language: C++

#include<cstdio>
#include<string>
#include<cstring>
int main (){
	char a[105];
	int a,b,i,n;
	scanf("%d",&n);
    for(int i=0;i<n;i++){
    	scanf("%c",&a[i]);
    	if(a[i] == 'I'){
    		a=a+1;
    		}
    		b=n-a;
    		c=a-b;
    		if(c>=0) printf("%d",c);
    		else if(c<0) printf("0");
    		}
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:13: error: conflicting declaration 'int a'
    6 |         int a,b,i,n;
      |             ^
a.cc:5:14: note: previous declaration as 'char a [105]'
    5 |         char a[105];
      |              ^
a.cc:11:18: error: incompatible types in assignment of 'char*' to 'char [105]'
   11 |                 a=a+1;
      |                 ~^~~~
a.cc:13:20: error: invalid operands of types 'int' and 'char [105]' to binary 'operator-'
   13 |                 b=n-a;
      |                   ~^~
      |                   | |
      |                   | char [105]
      |                   int
a.cc:14:17: error: 'c' was not declared in this scope
   14 |                 c=a-b;
      |                 ^
Language: C

#include <stdio.h>
int main(){
int k,i,max=0,a=0;
scanf ("%d",&k);
char s;
scanf ("%s",s);
for (i=0;i<k;i++){
if (s[i]=='I'){
a++;
}
else if (s[i]=='D'){
a--;
}
if (max>a){
max=a;
}
}
  printf ("%d",max);
return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:6: error: subscripted value is neither array nor pointer nor vector
    8 | if (s[i]=='I'){
      |      ^
main.c:11:11: error: subscripted value is neither array nor pointer nor vector
   11 | else if (s[i]=='D'){
      |           ^
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    int x=0,xmax=0;
    int n,i;
    cin >> n;
    string s;
    cin >> s;
    for(i=0;i<n;i++){
      if(s[i]=="I")x++;else x--;
      xmax=max(x,xmax);
    }
    cout << xmax;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   18 |       if(s[i]=="I")x++;else x--;
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<iomanip>
#include<algorithm>
#include<queue>
#include<stack>
#include<map>
using namespace std;
#define ll long long
int main(){
    int x=0,xmax=0;
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(i=0;i<n;i++){
      if(s[i]=="I")x++;else x--;
      xmax=max(x,xmax);
    }
    cout << xmax;
    return 0;
}


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

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

int main() {
  int n,i,x=0,ans=0;
  string s;
  cin>>n>>s;
  
  for(i=0;i<n;i++){
    if(s[i]=='I')
      x++;
    else(s[i]=='D')
      x--;
    if(ans<x)
      ans=x;
  }
  cout<<x;
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: expected ';' before 'x'
   12 |     else(s[i]=='D')
      |                    ^
      |                    ;
   13 |       x--;
      |       ~
Language: C++

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

	int x = 0, max = 0;
	int n;
	string s;
	cin >>n>> s;

	for (int i = 0; i < (int)s.length(); i++)
	{
		if (s[i] == 'I') {
			x++;
		}
		else {
			x--;
		}
		if (x > max) {
			max = x;
		}

	}

	cout << max << endl;
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:9: error: 'cin' was not declared in this scope
    2 |         cin.tie(0);
      |         ^~~
a.cc:3:9: error: 'ios' has not been declared
    3 |         ios::sync_with_stdio(false);
      |         ^~~
a.cc:7:9: error: 'string' was not declared in this scope
    7 |         string s;
      |         ^~~~~~
a.cc:8:19: error: 's' was not declared in this scope
    8 |         cin >>n>> s;
      |                   ^
a.cc:24:9: error: 'cout' was not declared in this scope
   24 |         cout << max << endl;
      |         ^~~~
a.cc:24:24: error: 'endl' was not declared in this scope
   24 |         cout << max << endl;
      |                        ^~~~
Language: C++

#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;

int main(void){
  int n;
  cin >> n;
  string input;
  cin >> input;
  
  vector<int> value(n) = {0};

  for(int i = 0; i < n; i++){
    
    if(input[i] == 'I'){
      value[i+1] = value[i]++;
    } else {
      value[i+1] = value[i]--;
    }
  }
  sort(value.begin(), value.end(), greater<int>());
  cout << value[0] << endl;
  return 0;
}

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

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

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  int ans=0;
  for(int i=0;i<n;i++){
    cin >> c;
    if(c=='I'){
      x++;
    }else{
      x--;
    }
    ans=max(ans,x);
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:12: error: 'c' was not declared in this scope
   25 |     cin >> c;
      |            ^
a.cc:27:7: error: 'x' was not declared in this scope
   27 |       x++;
      |       ^
a.cc:29:7: error: 'x' was not declared in this scope
   29 |       x--;
      |       ^
a.cc:31:17: error: 'x' was not declared in this scope
   31 |     ans=max(ans,x);
      |                 ^
a.cc:4:24: note: in definition of macro 'max'
    4 | #define max(a,b) ((a)>(b)?(a):(b))
      |                        ^
Language: C++

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N;
	string S;
	cin >> N >> S;
	ll x = 0;
	ll res = -1;
	REP(i, N){
		x += (S[i]=='I'?+1;-1);
		res = max(res, x);
	}
	cout << res << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:35: error: expected ':' before ';' token
   31 |                 x += (S[i]=='I'?+1;-1);
      |                                   ^
      |                                   :
a.cc:31:35: error: expected primary-expression before ';' token
a.cc:31:35: error: expected ')' before ';' token
   31 |                 x += (S[i]=='I'?+1;-1);
      |                      ~            ^
      |                                   )
a.cc:31:38: error: expected ';' before ')' token
   31 |                 x += (S[i]=='I'?+1;-1);
      |                                      ^
      |                                      ;
Language: C++

#include <iostream>
using namespace std;

int main() {
	int n, x;
	string s;
	cin >> n >> s;

	x = 0;
	for (int i = 0; i < n; i ++) {
		if (s[i] == "I") x ++;
		if (s[i] == "D") x --;
	}

	cout << x << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   11 |                 if (s[i] == "I") x ++;
a.cc:12:26: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   12 |                 if (s[i] == "D") x --;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,now,ans;
char ch;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>u;
        if(ch=='I')now++;
        else
        now--;
        ans=max(ans,now);
    }
    cout<<ans<<endl;
    return 0;
}

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

#include<stdio.h>{

	int main(){
		int max=0,x=0,i,n;
		char S[n];
		scanf("%d",&n);
		scanf("%s",S);
		for(i=0;i<n;i++){
			if(S[i]=='I'){
				x++;
			}
			else{
				x--;
			}
			if(x>max){
				max=x;
		}
		printf("%d",max);
	}

Compiler output:
main.c:1:18: warning: extra tokens at end of #include directive
    1 | #include<stdio.h>{
      |                  ^
main.c: In function 'main':
main.c:19:9: error: expected declaration or statement at end of input
   19 |         }
      |         ^
Language: C

#include <stdio.h>
int main(void){
  int N,a,b,i;
  char S[N];
  scanf("%d %s",&N,S);
  a,b=0;
  for(i=0;i<N;i++){
   if(S[i]==I)
     a++;
    else a--;
    if(a<b)
      a=b;
  }
  printf("%d",b);
  return 0;
}
  
  
  

Compiler output:
main.c: In function 'main':
main.c:8:13: error: 'I' undeclared (first use in this function)
    8 |    if(S[i]==I)
      |             ^
main.c:8:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include<iostream>
using namespace std;

int main(){
  int n;cin>>n;
  string s;cin>>s;
  int max=0,x=0;
  for(int i=0;i<n;i++){
    if(s[i]=='I')x++;
    if(s[i]=='D')x--;
    max=max(max,x);
  }
  cout<<max<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: 'max' cannot be used as a function
   11 |     max=max(max,x);
      |         ~~~^~~~~~~
Language: C++

#include<iostream>
using namespace std;

int main()
{   int t;
    cin>>t;
    string x;
char 'I','D';
    getline(cin , x);
    int z=0;
    for(int y=0 ; y<t; y++)
    {
        if(x.at(y)=I){z=z+1;}
        if(x.at(y)=D){z=z-1;}
    }
    cout<<z;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:6: error: expected unqualified-id before 'I'
    8 | char 'I','D';
      |      ^~~
a.cc:13:20: error: 'I' was not declared in this scope
   13 |         if(x.at(y)=I){z=z+1;}
      |                    ^
a.cc:14:20: error: 'D' was not declared in this scope
   14 |         if(x.at(y)=D){z=z-1;}
      |                    ^
Language: C++

#include<iostream>
using namespace std;

int main()
{   int t;
    cin>>t;
    string x;
    getline(cin , x);
    int z=0;
    for(int y=0 ; y<t; y++)
    {
        if(x.at(y)=I){z=z+1;}
        if(x.at(y)=D){z=z-1;}
    }
    cout<<z;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: 'I' was not declared in this scope
   12 |         if(x.at(y)=I){z=z+1;}
      |                    ^
a.cc:13:20: error: 'D' was not declared in this scope
   13 |         if(x.at(y)=D){z=z-1;}
      |                    ^
Language: C++

#include <iostream>
#include <string.h>
using namespace std;
int main ()
{
    int N;
    int x=0;
    cin>> N;
    string str1("I") ;
    string str2("D") ;
    string newarr [N];
    for (int i=0; i++ ; i<N)
    {
        cin>> newarr[i];
    }
    for (int i=0 ; i++ ; i<N)
    {
        if (newarr[i]= str1) {x++;}
        if (newarr[i]= str2) {x=x-1 ;}
    }
    int max;
    for (int i=0 ; i<N; i++)
    if (int max = newarr[0]){cout<< newarr[0];}
    if (int newarr[i]>newarr[0]){max= newarr[i];
    cout<< max;}

}

}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:22: error: could not convert 'newarr[i].std::__cxx11::basic_string<char>::operator=(str1)' from 'std::__cxx11::basic_string<char>' to 'bool'
   18 |         if (newarr[i]= str1) {x++;}
      |             ~~~~~~~~~^~~~~~
      |                      |
      |                      std::__cxx11::basic_string<char>
a.cc:19:22: error: could not convert 'newarr[i].std::__cxx11::basic_string<char>::operator=(str2)' from 'std::__cxx11::basic_string<char>' to 'bool'
   19 |         if (newarr[i]= str2) {x=x-1 ;}
      |             ~~~~~~~~~^~~~~~
      |                      |
      |                      std::__cxx11::basic_string<char>
a.cc:23:27: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in initialization
   23 |     if (int max = newarr[0]){cout<< newarr[0];}
      |                   ~~~~~~~~^
      |                           |
      |                           std::string {aka std::__cxx11::basic_string<char>}
a.cc:24:20: error: 'i' was not declared in this scope
   24 |     if (int newarr[i]>newarr[0]){max= newarr[i];
      |                    ^
a.cc:24:13: error: condition declares an array
   24 |     if (int newarr[i]>newarr[0]){max= newarr[i];
      |             ^~~~~~
a.cc: At global scope:
a.cc:29:1: error: expected declaration before '}' token
   29 | }
      | ^
Language: C++

#include <iostream>
#include <string.h>
using namespace std;
int main()
{
    int N;
    int x=0;
    cin>> N;
    string arr [2] = {I , D} ;
    string newarr [N];
    for (int i=0; i++ ; i<N)
    {
        cin>> newarr[i];
    }
    for (int i=0 ; i++ ; i<N)
    {
        if (newarr[i]= arr[0]) {x++;}
        if (newarr[i]= arr[1]) {x=x-1 ;}
    }
    int max;
    for (int i=0 ; i<N; i++)
    if (int max = newarr[0]){cout<< newarr[0];}
    if (int newarr[i]>newarr[0]){max= newarr[i];
    cout<< max;}

}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:23: error: 'I' was not declared in this scope
    9 |     string arr [2] = {I , D} ;
      |                       ^
a.cc:9:27: error: 'D' was not declared in this scope
    9 |     string arr [2] = {I , D} ;
      |                           ^
a.cc:17:22: error: could not convert 'newarr[i].std::__cxx11::basic_string<char>::operator=(arr[0])' from 'std::__cxx11::basic_string<char>' to 'bool'
   17 |         if (newarr[i]= arr[0]) {x++;}
      |             ~~~~~~~~~^~~~~~~~
      |                      |
      |                      std::__cxx11::basic_string<char>
a.cc:18:22: error: could not convert 'newarr[i].std::__cxx11::basic_string<char>::operator=(arr[1])' from 'std::__cxx11::basic_string<char>' to 'bool'
   18 |         if (newarr[i]= arr[1]) {x=x-1 ;}
      |             ~~~~~~~~~^~~~~~~~
      |                      |
      |                      std::__cxx11::basic_string<char>
a.cc:22:27: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int' in initialization
   22 |     if (int max = newarr[0]){cout<< newarr[0];}
      |                   ~~~~~~~~^
      |                           |
      |                           std::string {aka std::__cxx11::basic_string<char>}
a.cc:23:20: error: 'i' was not declared in this scope
   23 |     if (int newarr[i]>newarr[0]){max= newarr[i];
      |                    ^
a.cc:23:13: error: condition declares an array
   23 |     if (int newarr[i]>newarr[0]){max= newarr[i];
      |             ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
int x=0;
int n;
string s;
int arr[s.length()];
for(int i=0;i<n;i++)
{
if (s.at(i)=='I'){ x=x+1;
arr[i]=x;}
else
{
x=x-1;
arr[i]=x;
}
for(int i=0;i<s.length()-1;i++)
{
if(arr[i+1]<=arr[i]) arr[i+1]=arr[i];
}
cout<<arr[s.length()];
}

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

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

int main()
{
  int x=0,a[150],k;
  char S[150];
  cin>>N;
  cin>>S;
  a[0]=0;
  for(int i=0; i<N; i++)
  {
    if(S[i]=='I')
     x++;
    else if(S[i]=='D')
     x--;
    a[i+1]=x;
  }
  k=a[0];
  for (int i=1; i<N+1;i++)
  {
    if(k<a[i])
     k=a[i];
  }
  cout<<k;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: 'N' was not declared in this scope
    9 |   cin>>N;
      |        ^
Language: C

#include<stdio.h>
#include<string.h>
int main()
{
    int x=0;
    char arr[30];
    int N;
    N=strlen(arr);
    int i,t;
    for(i=0;i<=N-1;i++)
    {
        if(arr(i)==I)
            x++;
        else if(arr(i)==D)
        
            x--;
        if(x++>x || x-->x)
            t=x;
    }
    return(t);
}

Compiler output:
main.c: In function 'main':
main.c:12:12: error: called object 'arr' is not a function or function pointer
   12 |         if(arr(i)==I)
      |            ^~~
main.c:6:10: note: declared here
    6 |     char arr[30];
      |          ^~~
main.c:12:20: error: 'I' undeclared (first use in this function)
   12 |         if(arr(i)==I)
      |                    ^
main.c:12:20: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:17: error: called object 'arr' is not a function or function pointer
   14 |         else if(arr(i)==D)
      |                 ^~~
main.c:6:10: note: declared here
    6 |     char arr[30];
      |          ^~~
main.c:14:25: error: 'D' undeclared (first use in this function)
   14 |         else if(arr(i)==D)
      |                         ^
Language: C++

#include<iostream>
using namespace std;

int main()
{
  int x=0,a[150],k;
  char S[150];
  cin>>S;
  a[0]=0;
  for(int i=0; i<strlen(S); i++)
  {
    if(S[i]=='I')
     x++;
    else if(S[i]=='D')
     x--;
    a[i]=x;
  }
  k=a[0];
  for (int i=1; i<strlen(S);i++)
  {
    if(k<a[i])
     k=a[i];
  }
  cout<<k;
  
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:18: error: 'strlen' was not declared in this scope
   10 |   for(int i=0; i<strlen(S); i++)
      |                  ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
a.cc:19:19: error: 'strlen' was not declared in this scope
   19 |   for (int i=1; i<strlen(S);i++)
      |                   ^~~~~~
a.cc:19:19: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: Java

import java.util.*;
public class Main
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int N=in.nextInt();
String S=in.nextLine();
int x=max=0;
for (int i=0; i<N; i++)
{
char c=ScharAt(i);
if(c=='I')
x++;
else
x--;
if(x>max)
max=x;
}
System.out.println(max);
}
}


Compiler output:
Main.java:9: error: cannot find symbol
int x=max=0;
      ^
  symbol:   variable max
  location: class Main
Main.java:12: error: cannot find symbol
char c=ScharAt(i);
       ^
  symbol:   method ScharAt(int)
  location: class Main
Main.java:17: error: cannot find symbol
if(x>max)
     ^
  symbol:   variable max
  location: class Main
Main.java:18: error: cannot find symbol
max=x;
^
  symbol:   variable max
  location: class Main
Main.java:20: error: cannot find symbol
System.out.println(max);
                   ^
  symbol:   variable max
  location: class Main
5 errors
Language: C++

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

int main(){
	string s;
	int n;
	cin>>n;
	cin>>s;
	int max=x,x=0;

	for(int i=0;i<s.length();i++){
		if(s[i]=='I')
			x++;
		else if(s[i]=='D')
			x--;
		if(max<x)
			max=x;
	}
	cout<<max<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:17: error: 'x' was not declared in this scope
   10 |         int max=x,x=0;
      |                 ^
Language: C++

n = int(input())
s = input()
x = 0
alist = [0]
for i in range(n):
    if s[i]=='I':
        x += 1
    else:
        x -= 1 
    alist.append(x)

print(max(alist))

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

#include<stdio.h>
int main()
{
	char s[n];
	int i;
	int n;
	int x = 0;
	int max;
	max = x;
	scanf("%d%d%d%c",&i,&n,&x,&s[i]);
	for(i = 0; i <= n; i++)
{	
		if(s[i] == 'I') 
			printf("%d = x\n",x++);
		if(s[i] == 'D') 
			printf("%d = x\n",x--);
}	
        printf("%d\n",max);
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:16: error: 'n' was not declared in this scope
    4 |         char s[n];
      |                ^
a.cc:10:36: error: 's' was not declared in this scope
   10 |         scanf("%d%d%d%c",&i,&n,&x,&s[i]);
      |                                    ^
Language: C

#include<cstdio>
main(){
	int n,a = 0,x = 0;
	char s[105];
	scanf("%d",&n);
	scanf("%s",s);
	for(int i = 0;i < n ; i++){
		if(s[i] == 'I'){
			x = x + 1;
			}
		else if (s[i] == 'D'){
			x = x - 1;
			}
		if(a >= x) continue;
		else if (a < x){
			a = x ;
			}
		}
	printf("%d\n",a);
	}

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

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

char a[100000];
int main()
{
	int x = 0, max = 0;
	int N,i;
	scanf("%d",&N);
	scanf("%s",a);
	N = strlen(a);
	for(i = 0; i < N; i++)
	{
		if(a[i] == 'I')
		{
			x++;
			max = max > x ? max : x;
		}
		if(a[i] == 'D')
		{
			x--;
		}
	}
	printf("%d\n",max);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: 'strlen' was not declared in this scope
   14 |         N = strlen(a);
      |             ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include<iostream>
  +++ |+#include <cstring>
    4 | typedef long long ll;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,x,ans;
string s;
int main(){
    cin>>n>>s;
    for (int i=0;i<n;i++){
        if (s[i]=="I") x++;
        if (s[i]=="D") x--;
        if (x>ans) ans=x;
    }
    cout<<ans<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |         if (s[i]=="I") x++;
a.cc:9:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |         if (s[i]=="D") x--;
Language: C

#include <stdio.h>

char s[101];//文字列//

int main(void) {
	int i;
	int n;//文字数//
	int x = 0;
	int max = 0;

	scanf_s("%d", &n);
	
	for (i = 0; i <= n; i++) {
		scanf("%c", &s[i]);
	}

	   	  
	for (i = 1; i <= n; i++) {
		if (s[i] == 'I') {
			x = x + 1;
		}
		else {
			x = x - 1;
		}

		if (x > max) {
			max = x;
		}
	}

	printf("%d", max);
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:9: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
   11 |         scanf_s("%d", &n);
      |         ^~~~~~~
      |         scanf
Language: C++

#include <iostream>
using namespace std;

int main(){
  int n, x = 0, ans = 0;
  string s;
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == "I") {
      x++;
    } else {
      x--;
    }
    if (x > ans) ans = x;
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |     if (s[i] == "I") {
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
  int n, x=0, m=0;
  string s;
  cin >> n >> s;
  for(int i=0; i<n; i++){
    if(s[i]=="I"){
      x++;
      if(m<x)m=x;
    }else{
      x--;
    }
  }
  cout << m << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    9 |     if(s[i]=="I"){
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;

//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

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

	int x = 0;
	int max = 0;

	REP(i, n){
		if (s[i] == 'I') x++;
		else (s[i] == 'D') x--;
		if (x > max) max = x;
	}

	cout << max << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:35: error: expected ';' before 'x'
   24 |                 else (s[i] == 'D') x--;
      |                                   ^~
      |                                   ;
Language: C++

#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main()
{
  int n; cin >> n;
  int x = 0;
  int res = 0;
  for (int i = 0; i < n; i++) {
    char s; cin >> s;
    if (s == 'I')   x += 1;
    else (s == 'D') x -= 1;
    res = max(x, res);
  }

  cout << res << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: expected ';' before 'x'
   15 |     else (s == 'D') x -= 1;
      |                    ^~
      |                    ;
Language: C++

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

int main(){
  int a,i,array[101];
  string s;
  cin>>a>>s;
  array[0]=0
  for(i=1;i<a+1;i++){
    if(s.at(i)=='D'){
      array[i]=array[i-1]-1;
    }else{
      array[i]=array[i-1]+1;
    }
  }
  sort(array,array+a);
  cout<<array[a]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: expected ';' before 'for'
    8 |   array[0]=0
      |             ^
      |             ;
    9 |   for(i=1;i<a+1;i++){
      |   ~~~        
a.cc:9:20: error: expected ';' before ')' token
    9 |   for(i=1;i<a+1;i++){
      |                    ^
      |                    ;
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(void){
    int n,ma=0,x=0;
    string s;
    cin>>n>>s;
    for(int i=0;i<s.length;i++){
        if(s[i]=='I'){
            x++;
            ma=max(x,ma);
        }else{
            x--;
        }
    }
    cout<<ma;
    return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
string s;
int main(){
    cin>>s>>s;
    int cnt=0,ans=0;
    for(char c:s){
        if(c=="I")cnt++;
        else cnt--;
        ans=max(ans,cnt);
    }
    cout<<ans<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |         if(c=="I")cnt++;
      |            ~^~~~~
Language: C++

#include<iostream>
#include<string>

int main()
{
	/*
	// 整数の入力
	int a;
	cin >> a;
	// スペース区切りの整数の入力
	int b, c;
	cin >> b >> c;
	// 文字列の入力
	string s;
	cin >> s;
	// 出力
	cout << (a + b + c) << " " << s << endl;
	*/
	//23:23
	int x = 0;

	string S;
	int N;
	cin >> N;
	cin >> S;
	int max = 0;

	for (int n = 0; n < N; n++) {
		if (S[n] == 'I') { x++; }
		if (S[n] == 'D') { x--; }
		if (max < x)max = x;
	}
	cout << max;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:9: error: 'string' was not declared in this scope
   22 |         string S;
      |         ^~~~~~
a.cc:22:9: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included 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:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:24:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   24 |         cin >> N;
      |         ^~~
      |         std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:25:16: error: 'S' was not declared in this scope
   25 |         cin >> S;
      |                ^
a.cc:33:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   33 |         cout << max;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(){
char S[100];
int i,N,x=0,max=0;
scanf("%s%s",&N,&S);
for(i=0;i<"N";i++){
   if(S[i]=="I"){
   x+=1;
   if(x>max){
      max=x;
   }
   }
   else{
   x-=x;
   }
printf("%d",max);

}


}



}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 | for(i=0;i<"N";i++){
      |         ~^~~~
a.cc:8:11: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |    if(S[i]=="I"){
      |       ~~~~^~~~~
a.cc: At global scope:
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(){
char S[100];
int i,N,x=0,max=0;
scanf("%d%s",&N,&S);
for(i=0;i<N;i++){
   if(S[i]==I){
   x+=1;
   if(x>max){
      max=x;
   }
   }
   else{
   x-=x;
   }
printf("%d",max);

}


}



}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: 'I' was not declared in this scope
    8 |    if(S[i]==I){
      |             ^
a.cc: At global scope:
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#include <iostream>
using namespace std;
int main(void)
{
    string num,mozi;
    int x,y = 0;
    
    cin >> num >> mozi;
    
    for(int i = 0;i <= num - 1;++i)
    {
        if(mozi[i] = "I")
            x = x + 1;
        else
            x = x - 1;
        if(y <= x)
            y = y + 1;
    }
    
    cout << y << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:28: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
   10 |     for(int i = 0;i <= num - 1;++i)
      |                        ~~~ ^ ~
      |                        |     |
      |                        |     int
      |                        std::string {aka std::__cxx11::basic_string<char>}
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:10:30: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
   10 |     for(int i = 0;i <= num - 1;++i)
      |                              ^
/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:10:30: note:   'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
   10 |     for(int i = 0;i <= num - 1;++i)
      |                              ^
a.cc:12:22: error: invalid conversion from 'const char*' to '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} [-fpermissive]
   12 |         if(mozi[i] = "I")
      |                      ^~~
      |                      |
      |                      const char*
Language: C++

#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
using ll =long long;

int main (void) {
  int N;
  cin  >> N;
  int x=0,ans=0;
  while(n--){
    char c = getchar();
    x+= c == 'I'?1:-1;
    if (x>ans) ans=x;
  }
  cout << ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'n' was not declared in this scope
   15 |   while(n--){
      |         ^
Language: C

int a;int b;int c;int main(){
  scanf("%d",&a);
  char d[a+1];
  scanf("%s",d);
  for(;a---1;){
    d[7-a]=='I'?++b:--b;
    b>c?c=b:c+=0;
  }
  printf("%d\n",c);
}

Compiler output:
main.c: In function 'main':
main.c:2:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    2 |   scanf("%d",&a);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | int a;int b;int c;int main(){
main.c:2:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    2 |   scanf("%d",&a);
      |   ^~~~~
main.c:2:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:7:14: error: lvalue required as left operand of assignment
    7 |     b>c?c=b:c+=0;
      |              ^~
main.c:9:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    9 |   printf("%d\n",c);
      |   ^~~~~~
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:9:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

a;b;c;main(){
  scanf("%d",&a);
  char d[a+1];
  scanf("%s",d);
  for(;a---1;){
    d[7-a]=='I'?++b:--b;
    b>c?c=b:c+=0;
  }
  printf("%d\n",c);
}

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | a;b;c;main(){
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:3: warning: data definition has no type or storage class
    1 | a;b;c;main(){
      |   ^
main.c:1:3: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
main.c:1:5: warning: data definition has no type or storage class
    1 | a;b;c;main(){
      |     ^
main.c:1:5: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int]
main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int]
    1 | a;b;c;main(){
      |       ^~~~
main.c: In function 'main':
main.c:2:3: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
    2 |   scanf("%d",&a);
      |   ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | a;b;c;main(){
main.c:2:3: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
    2 |   scanf("%d",&a);
      |   ^~~~~
main.c:2:3: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:7:14: error: lvalue required as left operand of assignment
    7 |     b>c?c=b:c+=0;
      |              ^~
main.c:9:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
    9 |   printf("%d\n",c);
      |   ^~~~~~
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:9:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:9:3: note: include '<stdio.h>' or provide a declaration of 'printf'