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

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
  int n,x=0,ans=0;
  string s;
  cin>>n>>s;
  for(auto i:s){
    if(i=='I'){
      x++;
    }else{
      x--;
    }
    ans=max(ans,x);
  }
  cout<<"ans"<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:17:21: error: expected '}' at end of input
   17 |   cout<<"ans"<<endl;
      |                     ^
a.cc:5:12: note: to match this '{'
    5 | int main() {
      |            ^
Language: C++

import sys
import math
import bisect

def main():
    n = int(input())
    max_val = 0
    val = 0
    for c in input():
        if c == 'I':
            val += 1
        elif c == 'D':
            val -= 1
        max_val = max(max_val, val)
    print(max_val)

if __name__ == "__main__":
    main()


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

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

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


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

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

int main(){
  int a,b,state,n;
  cin>>n;
  char data;
  cin>>data;
  b=0;
  a=0;
  state=0;
  for(int i=0;i<n;i++){
    if(data[i]=='I')a+=1;
    else if(data[i]=='D')a-=1;
    if(a>b){
      b=a;
      state=i+1;
    }
  }
  cout<<state;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: invalid types 'char[int]' for array subscript
   16 |     if(data[i]=='I')a+=1;
      |            ^
a.cc:17:17: error: invalid types 'char[int]' for array subscript
   17 |     else if(data[i]=='D')a-=1;
      |                 ^
Language: C++

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

int main(){
  int a,b,state;
  cin>>a;
  char data;
  cin>>data;
  b=0;
  a=0;
  state=0;
  for(int i=0;i<sizeof(data)/sizeof(*data);i++){
    if(data[i]=='I')a+=1;
    else if(data[i]=='D')a-=1;
    if(a>b){
      b=a;
      state=i+1;
    }
  }
  cout<<state;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:37: error: invalid type argument of unary '*' (have 'char')
   15 |   for(int i=0;i<sizeof(data)/sizeof(*data);i++){
      |                                     ^~~~~
a.cc:16:12: error: invalid types 'char[int]' for array subscript
   16 |     if(data[i]=='I')a+=1;
      |            ^
a.cc:17:17: error: invalid types 'char[int]' for array subscript
   17 |     else if(data[i]=='D')a-=1;
      |                 ^
Language: C++

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


int main(){
    ll size, ans = ans_tmp = 0;

    string s;
    cin >> size >> s;
    for(int i = 0; i < size(); i++){
        if(s[i] == 'I'){
            ans_tmp++;
            ans = max(ans, ans_tmp);
        }else{
            ans_tmp--;
        }
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:20: error: 'ans_tmp' was not declared in this scope
    7 |     ll size, ans = ans_tmp = 0;
      |                    ^~~~~~~
a.cc:11:28: error: 'size' cannot be used as a function
   11 |     for(int i = 0; i < size(); i++){
      |                        ~~~~^~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,x=0,cnt[105],val=-1000000;
	string s;
	cin>>n;
	cin>>s;
	for(int i=0;i<n;i++){
		if(s[i]=='I') x++;
		else x--;
		cnt[i]=x;
	}
	cnt[n]=0;
	for(int i=0;i<=n;i++) val=max(val,cnt[i]);
	cout<<val<<endl;
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: expected '}' at end of input
   16 |         return 0;
      |                  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int ctoi(const char c) {
    if ('0' <= c && c <= '9') return (c - '0');
    return -1;
}
vector<int> input(int n) {
    vector<int> vec(n);
    for (int i = 0; i < n; i++) {
        cin >> vec.at(i);
    }
    return vec;
}
void output(vector<int> vec) {
    for (int i = 0; i < vec.size(); i++) {
        cout << vec[i] << " ";
    }
    return;
}
vector<vector<int>> input(int n, int m) {
    vector<vector<int>> table(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            cin >> table. at(i).at(j);
        }
    }
    return table;
}
void output(vector<vector<int>> table) {
    for (int i = 0; i < table.size(); i++) {
        for (int j = 0; j < table.at(0).size(); j++) {
            cout << table.at(i).at(j) << " ";
        }
        cout << endl;
    }
}
long long perm(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long perm = 1;
    for (int i = n; i > n - r; i--) {
        perm *= i;
    }
    return perm;
}
long long comb(int n, int r) {
    if (n < r) {
        cout << "error" << endl;
        return 0;
    }
    long long comb = perm(n,r);
    for (int i = r; i > 0; i--) {
        comb /= i;
    }
    return comb;
}
long long homo(int n, int r) {
    return comb(n + r - 1, n - 1);
}
long long fact(int n) {
    long long fact = 1;
    for (int i = n; i > 0; i--) {
        fact *= i;
    }
    return fact;
}
int gcd(int a, int b)
{
    if (a % b == 0)
    {
        return(b);
    }
    else
    {
        return(gcd(b, a % b));
    }
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans=0,x=0;
  for(int i=0;i<n;i++){
    if(s[i]=="I"){
      x++;
    }else{
      x--;
    }
    ans=max(ans,x);
  }
  cout << ans << endl;
}

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

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

int main(){
	
	int n, count=0;
	cin >> n;
	string s;
	cin >> s;
	for (char c: s){
		if ( c == "I") count++;
		else count--;
		maxc = max(maxc,count);
}



Compiler output:
a.cc: In function 'int main()':
a.cc:11:24: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   11 |                 if ( c == "I") count++;
      |                      ~~^~~~~~
a.cc:13:17: error: 'maxc' was not declared in this scope
   13 |                 maxc = max(maxc,count);
      |                 ^~~~
a.cc:14:2: error: expected '}' at end of input
   14 | }
      |  ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C

#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define COIN const int
#define ite iterator
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define sz(s) (s).size()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/

using namespace std;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	string s; int n; ll ans=0,mx=0; cin >>n >>s;
	for (int i=0;i<n;i++) {
		if (s[i]=='I') ans++;
		else ans--;
		mx=max(mx,ans);
	}
	cout <<mx;
	return 0;
}
/******************************************************************************
******************************************************************************/


Compiler output:
main.c:1:10: fatal error: bits/stdc++.h: No such file or directory
    1 | #include <bits/stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin>>n>>s;
    int x=0;
  	int ans=0;
    rep(i,n){
        if(s[i]=='I')x++;
        else x--;
      	chmax(ans,x)
    }
    cout<<ans<<"\n";
}



Compiler output:
a.cc: In function 'int main()':
a.cc:61:21: error: expected ';' before '}' token
   61 |         chmax(ans,x)
      |                     ^
      |                     ;
   62 |     }
      |     ~
Language: C++

//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18);
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
//-std=gnu++17
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    string s;
    cin>>n>>s;
    int x=0;
  	int ans=0;
    rep(i,n){
        if(s[i]=='I')x++;
        else x--;
      	chmax(ans,0)
    }
    cout<<ans<<"\n";
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:21: error: expected ';' before '}' token
   61 |         chmax(ans,0)
      |                     ^
      |                     ;
   62 |     }
      |     ~
Language: C++

#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < n; i++)

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int x = 0;
	set<int> st;
	st.insert(0);
	rep(i, n) {
		if (s[i] == 'D') x--;
		else x++;
		st.insert(x);
	}
	cout << *rbegin(st) << endl;
re

Compiler output:
a.cc: In function 'int main()':
a.cc:40:1: error: 're' was not declared in this scope; did you mean 'rep'?
   40 | re
      | ^~
      | rep
a.cc:40:3: error: expected '}' at end of input
   40 | re
      |   ^
a.cc:26:12: note: to match this '{'
   26 | int main() {
      |            ^
Language: C++

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


Compiler output:
a.cc: In function 'int main()':
a.cc:11:10: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   11 |       ans++;
      |       ~~~^~
a.cc:13:14: error: no 'operator--(int)' declared for postfix '--' [-fpermissive]
   13 |     }else ans--;
      |           ~~~^~
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:8: error: 'a' was not declared in this scope
   10 |     if(a[i]=='I') {
      |        ^
a.cc:11:10: error: no 'operator++(int)' declared for postfix '++' [-fpermissive]
   11 |       ans++;
      |       ~~~^~
a.cc:13:14: error: no 'operator--(int)' declared for postfix '--' [-fpermissive]
   13 |     }else ans--;
      |           ~~~^~
Language: C++

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main() {
  long long N,Q,a,b,count=0;
  string S;
  cin>>N>>S;
  int k=0;
  for (int i=0; i<N; i++){
  if(S.at(i)=='I'){
  count++;}
  else{
  count--;}
  k=max(k,count);}
  cout<<k<<endl;}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:8: error: no matching function for call to 'max(int&, long long int&)'
   15 |   k=max(k,count);}
      |     ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:15:8: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   15 |   k=max(k,count);}
      |     ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

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

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n;
  cin>>n;
  string s;
  cin>>s;
  if(s[0]=='I'){
    a[0]=1;
  }else{
    a[0]=-1;
  }
  for(int i=1;i<n;i++){
    if(s[i]=='I'){
      a[i]=a[i-1]+1;
    }else{
       a[i]=a[i-1]-1;
    }
  }
  sort(a,a+n);
  if(a[n-1]>=0){
  cout<<a[n-1];
}else{
  cout<<0;
}





}



Compiler output:
a.cc: In function 'int main()':
a.cc:12:5: error: 'a' was not declared in this scope
   12 |     a[0]=1;
      |     ^
a.cc:14:5: error: 'a' was not declared in this scope
   14 |     a[0]=-1;
      |     ^
a.cc:18:7: error: 'a' was not declared in this scope
   18 |       a[i]=a[i-1]+1;
      |       ^
a.cc:20:8: error: 'a' was not declared in this scope
   20 |        a[i]=a[i-1]-1;
      |        ^
a.cc:23:8: error: 'a' was not declared in this scope
   23 |   sort(a,a+n);
      |        ^
Language: C++

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: expected initializer before 'string'
    6 |   string s;
      |   ^~~~~~
a.cc:7:10: error: 'n' was not declared in this scope; did you mean 'yn'?
    7 |   cin >> n >> s;
      |          ^
      |          yn
a.cc:7:15: error: 's' was not declared in this scope
    7 |   cin >> n >> s;
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int i,j;
  for(j=0;j<n;j++){
    int x=0;
    for(i=0;i<j;i++){
      if(s.at(i)=='I'){
        x++;
      }
      if(s.at(i)=='D'){
        x--;
      }
      x=max(0,x);
    }
  }
  cout << x;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:11: error: 'x' was not declared in this scope
   21 |   cout << x;
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;

int main()
{
    ft
    ll t,i,j,n,m=-1,l=0,r;
    cin>>s;
    for(char c:s)
    {
        (c=='I')? l++:l--;
        m=max(m,l);
    }
    cout<<m<<"\n";
    return 0;
}



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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:13:15: error: 'I' was not declared in this scope
   13 |     if (s[i]==I){
      |               ^
a.cc:16:15: error: 'D' was not declared in this scope
   16 |     if (s[i]==D){
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
int main()
{
	int n;
	cin>>n;
	int ans=0;
	int maxn=-100;
	while(n--)
	{
		char x;
		cin>>x;
		if(x=='I')ans++;
		else if(x=='D') ans--;
		maxn=max(maxn,ans);
	}
	cout<<maxn<<endl;
	return 0;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

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

signed main(){
    string S;
    cin>>S;
    int x=0;
    int ans=0;
    REP(i,S.size()){
        if(S[i]=='I')x++;
        if(S{i}=='D')x--;
        ans=max(ans,x);
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: expected ')' before '{' token
   14 |         if(S{i}=='D')x--;
      |           ~ ^
      |             )
a.cc:14:12: error: could not convert 'S' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
   14 |         if(S{i}=='D')x--;
      |            ^
      |            |
      |            std::string {aka std::__cxx11::basic_string<char>}
Language: C++

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

signed main(){
    string S;
    cin>>S;
    int x=0;
    int ans=0;
    REP(i,S.size()){
        if(S[i]=='I')x++;
        if(S{i}=='D')x--;
        ans=max(ans,x);
    }
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: expected ')' before '{' token
   14 |         if(S{i}=='D')x--;
      |           ~ ^
      |             )
a.cc:14:12: error: could not convert 'S' from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'bool'
   14 |         if(S{i}=='D')x--;
      |            ^
      |            |
      |            std::string {aka std::__cxx11::basic_string<char>}
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n, i, x = 0, prev = INT_MIN, maxi;
	cin>>n;
	string s;
	cin>>s;
	for (i = 0; i < n; i++)
	{
		if (s[i] == 'I')
			x++;
		else
			x--;
		maxi = max(x, prev);
		prev = a[i];
	}
	cout<<maxi;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:24: error: 'a' was not declared in this scope
   16 |                 prev = a[i];
      |                        ^
Language: C++

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


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

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

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

  ll n, x = 0, ans = 0;
  string s;
  cin >> n >> s;

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

    ans = max(ans, x);
  }

  cout << ans << "\n";
}#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

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

  ll n, x = 0, ans = 0;
  string s;
  cin >> n >> s;

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

    ans = max(ans, x);
  }

  cout << ans << "\n";
}

Compiler output:
a.cc:29:2: error: stray '#' in program
   29 | }#include <bits/stdc++.h>
      |  ^
a.cc:29:3: error: 'include' does not name a type
   29 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:38:5: error: redefinition of 'int main()'
   38 | int main() {
      |     ^~~~
a.cc:10:5: note: 'int main()' previously defined here
   10 | int main() {
      |     ^~~~
Language: C++

//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

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

Compiler output:
a.cc: In function 'int main()':
a.cc:27:18: error: expected ';' before '}' token
   27 |   cout<<MAX<<endl
      |                  ^
      |                  ;
   28 | }
      | ~
Language: C++

int main(){

int n;
string s;
cin>>n;
cin>>s;
int ans=0;
int now=0;
for(int i=0;i<s.size();i++){
if(s[i]=='I'){
	now++;}
	else{
		now--;
	}
	ans=max(ans,now);
}

cout<<ans<<endl;
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:4:1: error: 'string' was not declared in this scope
    4 | string s;
      | ^~~~~~
a.cc:5:1: error: 'cin' was not declared in this scope
    5 | cin>>n;
      | ^~~
a.cc:6:6: error: 's' was not declared in this scope
    6 | cin>>s;
      |      ^
a.cc:15:13: error: 'max' was not declared in this scope
   15 |         ans=max(ans,now);
      |             ^~~
a.cc:18:1: error: 'cout' was not declared in this scope
   18 | cout<<ans<<endl;
      | ^~~~
a.cc:18:12: error: 'endl' was not declared in this scope
   18 | cout<<ans<<endl;
      |            ^~~~
Language: C++

#include <bits/stdc++.h>

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int ans = 0;
    int N; cin >> N;
    string S; cin >> S;
    int ans = 0, pos = 0;
    rep(i, N){
        if(S[i] == 'I') pos++;
        else pos--;
        ans = max(ans, pos);
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: redeclaration of 'int ans'
   15 |     int ans = 0, pos = 0;
      |         ^~~
a.cc:12:9: note: 'int ans' previously declared here
   12 |     int ans = 0;
      |         ^~~
Language: C++

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

int main() {
	int N, S;
	cin >> N >> S;
	int x = 0;
	int record = 0;
	for (int i = 0;i < N;++i) {
		if (S[i] == 'I') {
			x += 1;
		}
		else {
			x -= 1;
		}
		if (x > record) {
			record = x;
		}
	}
	cout << record << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:22: error: invalid types 'int[int]' for array subscript
   10 |                 if (S[i] == 'I') {
      |                      ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  string S;
  cin >> N >> S;
  int ans = 0;
  int count = 0;
  for (int i = 0; i < N; i++) {
    if (S[i] == 'I') {
      count++;
    }
    else if (S[i] == 'D') {
      count--+
    }
    ans = max(ans,count);
  }
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: expected primary-expression before '}' token
   15 |     }
      |     ^
Language: C++

#include<iostream>
using namespace std ;

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

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

#include<iostream>
using namespace std;
int main(){
  int unko,x=0;
  string aho;
  cin>>unko>>aho;
  for(int i;i<aho.size();i++){
    if(aho[i]=="I")
      x++;
    else
      x--;
    unko=max(unko,x);
  }
  cout<<unko<<endl;
}
    


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

#include<iostream>
using namespace std;
int main(){
  int unko;
  string aho;
  cin>>unko>>aho;
  for(int i;i<size(aho);i++){
    unko=max(unko,aho.at(i));
  }
  cout<<unko<<endl;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:8:13: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
    8 |     unko=max(unko,aho.at(i));
      |          ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:8:13: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'})
    8 |     unko=max(unko,aho.at(i));
      |          ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

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

int main() {
    int n,s;
    cin >> n >> s;
    int count=0;
    int ans=0;
    for(int i=0;i<n;i++){
        if(s.at(i)=='I'){
            count++;
        }
        else{
            count--;
        }
        ans=max(ans,count);
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:14: error: request for member 'at' in 's', which is of non-class type 'int'
   10 |         if(s.at(i)=='I'){
      |              ^~
Language: Java

import java.util.*;


public class Main{
  public static void main(String[] arg){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    String S = sc.next();
    char I = 'I';
    int ans = 0;
    int maxAns = 0;
    char[]list = S.toCharArray();
    for(int i = 0; i < N; i++){
      // char A = list[i];
      if(list[i] == I){
        ans +=1;
        if(maxAns<ans){
          maxAns = ans;
        }
      }else{
        ans -=1;
      }
    }
    System.out.println(maxAns);
  }

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

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

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

Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: 'y' was not declared in this scope
   10 |         else if(s[i]='D') --y;
      |                             ^
Language: C++

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

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


Compiler output:
a.cc: In function 'int main()':
a.cc:13:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 |     if(S.at(i) == "I"){
      |        ~~~~~~~~^~~~~~
a.cc:17:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |     }else if(S.at(i) == "D"){
      |              ~~~~~~~~^~~~~~
Language: C++

#include<iostream>
#include<fstream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>

using namespace std;
long long n,h,da=0;
string st;
int main()
{
    cin>>n;
    cin>>st;
    for(int i=0;i<st.size();i++)
    {
        if(st[i]=='I')h++;
        else h--;
        if(h>da)da=h;
        高度。
    }
    cout<<da<<endl;
    return 0;
}

Compiler output:
a.cc:21:9: error: extended character 。 is not valid in an identifier
   21 |         高度。
      |         ^
a.cc: In function 'int main()':
a.cc:21:9: error: '\U00009ad8\U00005ea6\U00003002' was not declared in this scope
   21 |         高度。
      |         ^~~~~~
Language: C++

#include<bits/stdc++.h>
#include<conio.h>
using namespace std;
int getint(void)
{
	int a;
	scanf("%d",&a);
	return a;
}
int main(void)
{
	char p;int n=getint(),sum=0,maxn=0;
	for(int i=1;i<=n;i++)
	{
		p=getch();
		if(p=='I') sum++;
		else sum--;
		maxn=max(maxn,sum);
	}
	printf("%d",maxn);
    return 0;
}

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

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

int main(){
  int N
  string S;
  cin>>N>>S;
  
  int x=0;
  int a=0;
  
  for(int i=0;i<N;i++){
    if(S.at(i)=='I'){
      x++;
      a=max(a,x);
    }else{
      x--;
    }
  }
  cout<<a<<endl;
}
  

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: expected initializer before 'string'
    6 |   string S;
      |   ^~~~~~
a.cc:7:8: error: 'N' was not declared in this scope
    7 |   cin>>N>>S;
      |        ^
a.cc:7:11: error: 'S' was not declared in this scope
    7 |   cin>>N>>S;
      |           ^
Language: C++

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

Compiler output:
a.cc: In function 'int main()':
a.cc:9:20: error: reference to 'max' is ambiguous
    9 |         if(m=='I') max++;
      |                    ^~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:                 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
In file included from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:                 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:3:7: note:                 'int max'
    3 | int n,max,ma;
      |       ^~~
a.cc:10:14: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |         else ans--;
      |              ^~~
      |              abs
a.cc:11:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |         if(ans>ma) max=ma;
      |            ^~~
      |            abs
a.cc:11:20: error: reference to 'max' is ambiguous
   11 |         if(ans>ma) max=ma;
      |                    ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:                 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:                 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:3:7: note:                 'int max'
    3 | int n,max,ma;
      |       ^~~
Language: Java

import java.util.*;
import java.util.Scanner;
class Main {
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    String s=sc.next();
    int max=0;
    int x=0;
    if(s.length==n){
    for(int i=0;i<n;i++) {
      if(s.charAt(i)=='I'){
        x++;
      } else {
        x--;
      }
    }
    if(max<x++){
      max=x++;
    }
    System.out.println(max);
  }
}
}

Compiler output:
Main.java:10: error: cannot find symbol
    if(s.length==n){
        ^
  symbol:   variable length
  location: variable s of type String
1 error
Language: C++

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

int main() {

	int N,x=0,Xmax=0;
  string S;
	cin>>N>>S;
  
  for(int i=0; i<N; i++){
    if(S.at(i)=='I'){x++;}
    else if(S.at(i)=='D'){x--:}
    if(Xmax<x){Xmax=x;}
  }
	
	cout<<Xmax<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:30: error: expected ';' before ':' token
   12 |     else if(S.at(i)=='D'){x--:}
      |                              ^
      |                              ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int max(int a,int b)
{
    return a>b?a:b;
}
int main()
{
    long long n,a[1000001],y,z=-100000;
    string s;
    cin>>n
    for(register int i=0;i<n;i++)
    {
        if(a[i]=='I') y++;
        else y--;
        z=max(y,z);
    }
    cout<<z<<endl;
    exit(0);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:11: error: expected ';' before 'for'
   11 |     cin>>n
      |           ^
      |           ;
   12 |     for(register int i=0;i<n;i++)
      |     ~~~    
a.cc:12:26: error: 'i' was not declared in this scope
   12 |     for(register int i=0;i<n;i++)
      |                          ^
Language: C++


N = int(input())
S = input()

num = 0
ans = 0
for s in S:
    if s == 'I':
        num += 1
    else:
        num -= 1
    ans = max(ans, num)
    
print(ans)

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

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

using ll=long long; 

void solve(){
	int n;
	string s;
	cin>>n>>s;
	int maxi=0;
	int cnt=0;
	for(auto e:s){
		if(e=='I'){
			cnt++
			maxi=max(maxi, cnt);
		}else{
			cnt--;
		}
	}
	cout<<maxi<<endl;
}

signed main(){
	//while(1)
	solve();
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:14:30: error: expected ';' before 'maxi'
   14 |                         cnt++
      |                              ^
      |                              ;
   15 |                         maxi=max(maxi, cnt);
      |                         ~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,t=0,m=0;
string s;
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
    	cin>>s[i];
		if(s[i]=='I') ++t;
		else --t;
		m=max(m,pos);
	}
	cout<<m<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:25: error: 'pos' was not declared in this scope; did you mean 'pow'?
   13 |                 m=max(m,pos);
      |                         ^~~
      |                         pow
Language: C++

#include<cstdio>
using namespace std;
int n;
char s;
int main()
{
	scanf("%d", &n);
	int ans = 0;
	int maxn = -1e9; 
	for(int i = 0; i < n; i++)
	{
		scanf("%c", &s);
		if(s[i] == 'I') ans += 1;
		if(s[i] == 'D') ans -= 1;
		if(maxn < ans) maxn = ans;
	}
	printf("%d\n", maxn);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:21: error: invalid types 'char[int]' for array subscript
   13 |                 if(s[i] == 'I') ans += 1;
      |                     ^
a.cc:14:21: error: invalid types 'char[int]' for array subscript
   14 |                 if(s[i] == 'D') ans -= 1;
      |                     ^
Language: C++

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

typedef long long unsigned ll;


int main(){

    int ret,tmp,n;
    char c;
    cin>>n;

    ret=tmp=0;
    while(n--){
        c=getchar()
        if(c=='I') tmp++;
        else tmp--;

        ret = max(ret,tmp);
    }

    return ret;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:20: error: expected ';' before 'if'
   15 |         c=getchar()
      |                    ^
      |                    ;
   16 |         if(c=='I') tmp++;
      |         ~~          
a.cc:17:9: error: 'else' without a previous 'if'
   17 |         else tmp--;
      |         ^~~~
Language: Java

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		String s = sc.next();
		int ans = 0;
		int temp = 0;
		for (int i = 0; i<n; i++) {
			if(s.charAt(i) == "I") {
				temp++;				
			} else {
				temp--;
			}
			if (ans<=temp) {
				ans=temp;
			}
		}
		System.out.println(ans);
	}

}

Compiler output:
Main.java:13: error: bad operand types for binary operator '=='
			if(s.charAt(i) == "I") {
			               ^
  first type:  char
  second type: String
1 error
Language: C++


#include<bits/stdc++.h>
using namespace std;
int N;
string s;
int main()
{
    cin>>N;
    cin>>s;
    int pos=0;
    for(int i=0;i<s.size();i++){
        if(s[i]=='I')   pos++;
        else            pos--;
    }
    cout<<pos

    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: expected ';' before 'return'
   15 |     cout<<pos
      |              ^
      |              ;
   16 | 
   17 |     return 0;
      |     ~~~~~~
Language: C++

#include <bits/stdc++.h>
#define maxn 1000000005
using namespace std;
char id[maxn];
int sum[maxn];
int main()
{
    int a;
    cin>>a;
    cin>>id;
    int m;
    sum[0]=0;
    for(int i=1;i<=a;i++)
    {
        if(a[i-1]='I')
        sum[i]=sum[i-1]+1;
        else
        sum[i]=sum[i-1]-1;
    }
    for(int i=0;i<=a;i++)
    {
        if(m<=sum[i])
        {
            m=sum[i];
        }
    }
    cout<<m;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: invalid types 'int[int]' for array subscript
   15 |         if(a[i-1]='I')
      |             ^
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  int x=0;
  int max=0;
  cin>>s;
  for(int i=0;s[i]!='\0';i++){
  if(s[i]=='I') x++;
  else(s[i]=='D') x--;

  if(max<x) x=max;
  }
  cout<<x<<endl;

  return 0;
}


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

#include<iostream>
#include<string>
using namespace std;
int main(){
  string s;
  int x=0;
  int max=0;
  for(int i=0;s[i]!='\0';i++){
  if(s[i]=='I') x++;
  else(s[i]=='D') x--;

  if(max<x) x=max;
  }
  cout<<x<<endl;

  return 0;
}


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

#include<iostream>
#include<iostream>
using namespace std;
int main(){
  string s;
  int x=0;
  int max=0;
  for(int i=0;s[i]!='\0';i++){
  if(s[i]=='I') x++;
  else(s[i]=='D') x--;

  if(max<x) x=max;
  }
  cout<<x<<endl;

  return 0;
}


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

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


}


Compiler output:
main.c: In function 'main':
main.c:14:40: error: expected ';' before '{' token
   14 |                         else(s[i]=='D'){
      |                                        ^
      |                                        ;
main.c:18:41: error: 'else' without a previous 'if'
   18 |                                         else(y>x)
      |                                         ^~~~
main.c:18:50: error: expected ';' before 'x'
   18 |                                         else(y>x)
      |                                                  ^
      |                                                  ;
   19 |                                                 x=y;}
      |                                                 ~
Language: C

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


}


Compiler output:
main.c: In function 'main':
main.c:14:40: error: expected ';' before 'y'
   14 |                         else(s[i]=='D')
      |                                        ^
      |                                        ;
   15 |                                 y=x-1;
      |                                 ~       
main.c:18:50: error: expected ';' before 'x'
   18 |                                         else(y>x)
      |                                                  ^
      |                                                  ;
   19 |                                                 x=y;}
      |                                                 ~
Language: C++

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


}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:40: error: expected ';' before 'y'
   14 |                         else(s[i]=='D')
      |                                        ^
      |                                        ;
   15 |                                 y=x-1;
      |                                 ~       
a.cc:18:50: error: expected ';' before 'x'
   18 |                                         else(y>x)
      |                                                  ^
      |                                                  ;
   19 |                                                 x=y;}
      |                                                 ~
Language: C

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


}


Compiler output:
main.c: In function 'main':
main.c:12:26: error: 'I' undeclared (first use in this function)
   12 |                 if(s[i]==I)
      |                          ^
main.c:12:26: note: each undeclared identifier is reported only once for each function it appears in
main.c:14:36: error: 'D' undeclared (first use in this function)
   14 |                         else(s[i]==D)
      |                                    ^
main.c:14:38: error: expected ';' before 'y'
   14 |                         else(s[i]==D)
      |                                      ^
      |                                      ;
   15 |                                 y=x-1;
      |                                 ~     
main.c:18:50: error: expected ';' before 'x'
   18 |                                         else(y>x)
      |                                                  ^
      |                                                  ;
   19 |                                                 x=y;}
      |                                                 ~
Language: C

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


}


Compiler output:
main.c: In function 'main':
main.c:14:37: error: expected ';' before 'y'
   14 |                         else(s[i]=D)
      |                                     ^
      |                                     ;
   15 |                                 y=x-1;
      |                                 ~    
main.c:18:50: error: expected ';' before 'x'
   18 |                                         else(y>x)
      |                                                  ^
      |                                                  ;
   19 |                                                 x=y;}
      |                                                 ~