Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03759 (python)

Fixed submission:
a, b, c = input().split()

a = int(a)
b = int(b)
c = int(c)

print('YES') if b-a == c-b else print('NO')

Buggy submission (verdict: Runtime Error):
n = int(input())
S=[]
for i in range(n):
    S.append(input())

ans = []
#チェックする文字をS[0]から取得
for i in S[0]:
    #すべてのSについてチェックする文字の存在判定
    hantei=[]
    for j in range(1,n):
        hantei.append(S[j].find(i)) #存在する位置をリストに追加
    if min(hantei) >= 0: ans.append(i)

#辞書順にする
ans.sort()
#文字列にする
ans2 = ''.join(ans)
print(ans2)
Problem p03761 (python)

Fixed submission:
n = int(input())
S=[]
for i in range(n):
    S.append(input())

ans = []

if n>1:
    #チェックする文字をS[0]から取得
    for i in S[0]:
        #すべてのSについてチェックする文字の存在判定
        hantei=[]
        for j in range(1,n):
            idx = S[j].find(i)
            hantei.append(idx) #存在する位置をリストに追加
            if idx >= 0: S[j] = S[j][:idx] + S[j][idx+1:] #存在した場合はそれを除去そておく
        if min(hantei) >= 0: ans.append(i)
else:
    ans = [i for i in S[0]]

#辞書順にする
ans.sort()
#文字列にする
ans2 = ''.join(ans)
print(ans2)

Buggy submission (verdict: Runtime Error):
n = int(input())
S=[]
for i in range(n):
    S.append(input())

ans = []
#チェックする文字をS[0]から取得
for i in S[0]:
    #すべてのSについてチェックする文字の存在判定
    hantei=[]
    for j in range(1,n):
        idx = S[j].find(i)
        hantei.append(idx) #存在する位置をリストに追加
        if idx >= 0: S[j] = S[j][:idx] + S[j][idx+1:] #存在した場合はそれを除去そておく
    if min(hantei) >= 0: ans.append(i)

#辞書順にする
ans.sort()
#文字列にする
ans2 = ''.join(ans)
print(ans2)

Buggy submission (verdict: Runtime Error):
n = int(input())
S=[]
for i in range(n):
    S.append(input())

ans = []
#チェックする文字をS[0]から取得
for i in S[0]:
    #すべてのSについてチェックする文字の存在判定
    hantei=[]
    for j in range(1,n):
        hantei.append(S[j].find(i)) #存在する位置をリストに追加
    if min(hantei) >= 0: ans.append(i)

#辞書順にする
ans.sort()
#文字列にする
ans2 = ''.join(ans)
print(ans2)
Problem p03712 (python)

Fixed submission:
[x, y] = map(int, raw_input().strip().split())
st = []
for i in range(x):
    st.append(raw_input().strip())
print "#" * (y + 2)
for i in range(x):
    print "#" + st[i] + "#"
print "#" * (y + 2)

Buggy submission (verdict: Runtime Error):
[x, y] = map(int, raw_input().strip().split())
a = raw_input().strip()
b = raw_input().strip()
print "#" * (y + 2)
print "#" + a + "#"
print "#" * (y + 2)
Problem p03711 (python)

Fixed submission:
import numpy as np

data = input()
data = data.split()
x = int(data[0])
y = int(data[1])

vec_1 = []
vec_2 = []
group = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]


for i in range(3):
	if x in group[i]:
		vec_1.append(1)
	else:
		vec_1.append(0)

for i in range(3):
	if y in group[i]:
		vec_2.append(1)
	else:
		vec_2.append(0)

vec_1 = np.array(vec_1)
vec_2 = np.array(vec_2)


if sum(vec_1 * vec_2) == 1:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
size = input()
size = size.split()

print("#" * (int(size[1]) + 2))

for i in range(int(size[0])):
	row = input()
	print("#" + row + "#")

print("#" * (int(size[1]) + 2))
Problem p03721 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N, K = map(int, raw_input().split())
R = [0] * (10**5+10) 

for i in xrange(N):
     ia, ib = map(int, raw_input().split())
     R[ia] += ib

k = 0
c = 0
while k < K:
    c += 1
    k += R[c]
print c

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N, K = map(int, raw_input().split())
R = [0] * (10**5) 

for i in xrange(N):
     ia, ib = map(int, raw_input().split())
     R[ia] += ib

k = 0
c = 0
while k < K:
    c += 1
    k += R[c]
print c

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
import numpy as np
N, K = map(int, raw_input().split())

def test():
    ia, ib = map(int, raw_input().split())
    return np.ones(ib) * ia

R = np.array([test() for i in xrange(N)])
print int(np.sort(R.flatten())[K-1])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
import numpy as np
N, K = map(int, raw_input().split())
R = []
for i in xrange(K):
    ia, ib = map(int, raw_input().split())
    R.extend([ia, ib])

R = sorted(R)
R.reverse()

count = 1
c = 0
r = R.pop()

for i in xrange(N):
    while count == r and len(R) > 0:
        c += 1
        r = R.pop()

    print c
    count += 1
    c = 0
Problem p03719 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a<=c and c<=b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = [int(input()) for i in range(3)]
if N[0] <= N[2] <= N[1]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = [int(input()) for i in range(3)]
if N[2] > N[0] and N[2] < N[1]:
    print("Yes")
else:
    print("No")
Problem p04043 (python)

Fixed submission:
a, b, c = map(str, input().split())
N = a + b + c
if N == "557" or N == "575" or N == "755":
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
N = int(input())
if N == 557 or N == 575 or N == 755:
    print("Yes")
else:
    print("No")
Problem p03732 (python)

Fixed submission:
import copy
N, W = [int(i) for i in input().split(' ')]
dic = {}
dic_num = {}
dic4calc  = {}

for i in range(N):
    new_w, new_v = [int(i) for i in input().split(' ')]
    if new_w in dic:
        dic[new_w].append(new_v)
    else:
        dic[new_w] = [new_v]
        
w = sorted(list(dic.keys()))
for wi in w:
    dic[wi].sort(reverse=True)
    dic_num[wi] = len(dic[wi])
    dic4calc[wi] = 0

cond = []
def rec(i, rest, dic4calc):
    if rest<w[i]:
        cond.append(dic4calc)
        return

    if i+1<len(w):
        new_dic4calc = copy.deepcopy(dic4calc)
        rec(i+1, rest, new_dic4calc)
    if not dic_num[w[i]]-dic4calc[w[i]]==0:
        new_dic4calc = copy.deepcopy(dic4calc)
        new_dic4calc[w[i]] += 1
        rec(i, rest-w[i], new_dic4calc)
    if i+1>=len(w):
        cond.append(dic4calc)
        return

rec(0, W, dic4calc)
ans = 0
for c in cond:
    total = 0
    for wi in w:
        total += sum(dic[wi][:c[wi]])
    if ans < total:
        ans = total
        
print(ans)

Buggy submission (verdict: Runtime Error):
import copy
N, W = [int(i) for i in input().split(' ')]
dic = {}

for i in range(N):
    new_w, new_v = [int(i) for i in input().split(' ')]
    if new_w in dic:
        dic[new_w].append(new_v)
    else:
        dic[new_w] = [new_v]
for key in dic.keys():
    dic[new_w].sort(reverse=True)
w = list(dic.keys())

def rec(i, j, _dic):
    if w[i]>j:
        return 0
    cand = []
    if len(_dic[w[i]])>=1:
        new_dic = copy.deepcopy(_dic)
        val = new_dic[w[i]].pop(0)
        cand.append(val+rec(i, j-w[i], new_dic))
    if i+1<len(w):
        cand.append(rec(i+1,j, _dic))
    return max(cand)

print(rec(0, W, dic))
Problem p03739 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split(' ')]
_a = [-1*i for i in a]

def func(l):
    _ans = 0
    product = 0
    for i in range(n):
        product += l[i]
        if i%2 == 0:
            if product<=0:
                _ans += abs(product) + 1
                product = 1
        elif i%2 == 1:
            if product>=0:
                _ans += abs(product) + 1
                product = -1
    return _ans

ans = min(func(a), func(_a))
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_list = [int(i) for i in input().split(' ')]
total = [a_list[0]]
counter = 0

for a in a_list[1:]:
    total.append(total[-1] + a)
    
if total[0]==0:
    total = map(lambda n: n-int(total[1]/abs(total[1])), total)
for i in range(1,n):    
    if total[i-1]<0 and total[i]<=0:
        counter += abs(total[i])+1
        total[i:] = list(map(lambda n: n-(total[i])+1, total[i:]))
    elif total[i-1]>0 and total[i]>=0:
        counter += abs(total[i])+1
        total[i:] = list(map(lambda n: n-(total[i])-1, total[i:]))
    else:
        continue

print(counter)
Problem p03777 (python)

Fixed submission:
arg = input().split(' ')
a = arg[0]
b = arg[1]

if a=='D':
    b = 'D' if b=='H' else 'H'
    
print(b)

Buggy submission (verdict: Runtime Error):
arg = input().split(' ')
a = arg[0]
b = arg[1]'

if a=='D':
    b = 'D' if b=='H' else 'H'
    
print(b)

Buggy submission (verdict: Runtime Error):
x = abs(int(input()))
total = 0
for i in range(x+1):
    total += i
    if total >= x:
        print(i)
        break
Problem p03719 (python)

Fixed submission:
A,B,C = map(int, raw_input().split())

if A <= C and B >= C:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
d={}
N,K=map(int,raw_input().split())

for i in xrange(N):
    a,b=map(int,raw_input().split())
#    print a,b
    if a in d:
        d[a] = d[a] + b
    else:
        d[a]=b
#    td={}
#    cnt=0
#    print d
#    for key in sorted(d):
#        print key
#        if cnt<=K:
#            td[key]=d[key]
#        else:
#            break
#    d=td

aa=None
cnt=0
#print d
for k in sorted(d):
    aa=k
    cnt+=d[k]
#    print cnt
    if cnt>=K:
        break
print aa
Problem p03719 (python)

Fixed submission:
# -*- coding: utf-8 -*-
x=input()
y=[]
y=x.split(" ")

if int(y[2])>=int(y[0]) and int(y[2])<=int(y[1]):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

x = input()
y=[]
y=x.split(" ")
N=int(y[0])
M=int(y[1])

z=[]
for i in range(M):
	temp1=input()
	temp2=temp1.split(" ")
	for j in temp2:
		j=int(j)
		z.append(j)

dict={}
for i in range(N):
	i+=1
	dict[i]=0

for i in z:
	dict[i]=dict[i]+1

for i in range(N):
	i+=1
	print(dict[i])
Problem p03721 (python)

Fixed submission:
import numpy as np

L = np.zeros(10**5).astype(int)
N, K = list(map(int, input().split(' ')))
for _ in range(N):
    a, b = list(map(int, input().split(' ')))
    L[a-1] += b
    
tot = 0
for i in range(10**5):
    tot += L[i]
    if tot >= K:
        print(i+1)
        break

Buggy submission (verdict: Runtime Error):
import numpy as np

N, K = list(map(int, input().split(' ')))
L = np.zeros(N).astype(int)
for _ in range(N):
    a, b = list(map(int, input().split(' ')))
    L[a-1] += b
    
tot = 0
for i in range(N):
    tot += L[i]
    if tot >= K:
        break
print(i+1)

Buggy submission (verdict: Runtime Error):
import numpy as np

N, K = list(map(int, input().split(' ')))
L = np.zeros(N).astype(int)
for _ in range(N):
    a, b = list(map(int, input().split(' ')))
    L[a-1] += b
    
tot = 0
for i in range(N):
    tot += L[i]
    if tot >= K:
        print(i+1)
        break

Buggy submission (verdict: Runtime Error):
import numpy as np

N, K = list(map(int, input().split(' ')))
L = np.zeros(N).astype(int)
for _ in range(N):
    a, b = list(map(int, input().split(' ')))
    L[a-1] += b
    
tot = 0
for i in range(N):
    tot += L[i]
    if tot >= K:
        print(i)
        break
Problem p03729 (python)

Fixed submission:
a, b, c = input().split()
if a[-1] == b[0] and b[-1] == c[0]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a, b, c = [int(i) for i in input().split()]
for i in range(2, b+1):
    if a*i % b == c:
        print("YES")
        break
    else:
        print("NO")
Problem p03759 (python)

Fixed submission:
a, b, c = map(int,input().split())
if (b-a)  == (c-b):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a, b, c = input().split()
if b-a  == c-b:
    print("YES")
else:
    print("NO")
Problem p03719 (python)

Fixed submission:
a,b,c = map(int,input().split())
if a <= c and c <= b:
 print ("Yes")
else:
 print ("No")

Buggy submission (verdict: Runtime Error):
    a,b,c = map(int,input().split())
     
    if a <= b and b <= c:
     print ("Yes")
    else:
     print ("No")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input(),split())

if a <= b and b <= c:
 print ("Yes")
else:
 print ("No")
Problem p03720 (python)

Fixed submission:
n,m = map(int,input().split())
road = []

for i in range(m):
    a,b = [int(i) for i in input().split()]
    road.append([a,b])

road = sum(road,[])
#print(road)
    
for j in range(n):
   print (road.count(j+1))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
ls = []
b_num = 0

for i in range(n):
    a,b = [int(i) for i in input().split()]
    if b_num <= k:
        tmp = [a] * b
        ls.extend(tmp)
        ls.sort()
        b_num += b
    else:
        if(a <= ls[-1]):
            tmp = [a] * b
            ls.extend(tmp)
            ls.sort()
        
print(ls[k-1])
Problem p03721 (python)

Fixed submission:
n,k = map(int,input().split())
ls = []

for i in range(n):
    a,b = [int(i) for i in input().split()]
    ls.append([a,b])

ls.sort()
for a,b in ls:
    if b >= k:
        print(a)
        break
    else:
        k -= b

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
ls = []

for i in range(n):
    a,b = [int(i) for i in input().split()]
    ls.append([a,b])

ls.sort()
for a,b in ls:
    if b >= k:
        print(x)
        break
    else:
        k -= b

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
ls = []
b_num = 0

for i in range(n):
    a,b = [int(i) for i in input().split()]
    if b_num < k:
        tmp = [a] * b
        ls.extend(tmp)
        #ls.sort()
        b_num += b
    else:
        if(a <= ls.max):
            tmp = [a] * b
            ls.extend(tmp)

ls.sort()
print(ls[k-1])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
ls = []
b_num = 0

for i in range(n):
    a,b = [int(i) for i in input().split()]
    if b_num <= b:
        tmp = [a] * b
        ls.extend(tmp)
        ls.sort
        b_num += b
    else:
        if(a < ls[-1]):
            tmp = [a] * b
            ls.extend(tmp)
            ls.sort
        
print(ls[k-1])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
ls = []
b_num = 0

for i in range(n):
    a,b = [int(i) for i in input().split()]
    if b_num <= b:
        tmp = [a] * b
        ls.extend(tmp)
        ls.sort
        b_num += b
    else:
        if(a < ls[-1]):
            tmp = [a] * b
            ls.extend(tmp)
            ls.sort
            b_num += b  
        
print(ls[k-1])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
ls = []
b_num = 0

for i in range(n):
    a,b = [int(i) for i in input().split()]
    if b_num <= b:
        tmp = [a] * b
        ls.extend(tmp)
        ls.sort
        b_num += b
    else:
        if(a > ls[-1]):
            break
        else:
            tmp = [a] * b
            ls.extend(tmp)
            ls.sort
            b_num += b  
        
print(ls[k-1])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
ls = []

for i in range(n):
    a,b = [int(i) for i in input().split()]
    tmp = [a] * b
    ls.append(tmp)

ls = sum(ls,[])
ls.sort(k-1)
print(ls)
Problem p03795 (python)

Fixed submission:
n = int(input())
x = n / 15
res = 800 * n - 200 * int(x)
print(res)

Buggy submission (verdict: Runtime Error):
n = int(row())
print n
Problem p03796 (python)

Fixed submission:
N = int(input())
P = 10**9 + 7

power = 1

for i in range(1,N+1):
 power = (i * power % P)

print(power)

Buggy submission (verdict: Runtime Error):
N = int(input())
power = 1

for i in range(1,N+1):
 power = (i * power % P) 

print(power)
Problem p03760 (python)

Fixed submission:
def main():
    o = input()
    e = input()

    if len(o) == len(e):
        pw = [o[i]+e[i] for i in range(len(o))]
    else:
        pw = [o[i]+e[i] for i in range(len(e))]
        pw.append(o[-1])

    print("".join(pw))


if __name__ == "__main__":

    main()

Buggy submission (verdict: Runtime Error):
def main():
    o = input()
    e = input()

    pw = [0]*(len(o)+len(e))

    for i in range(len(o)):
        pw[i*2] = o[i*2]

    for i in range(len(e)):
        pw[i*2 + 1] = e[i*2 + 1]

    print("".join(pw))

    # if len(o) == len(e):
    #     pw = [o[i]+e[i] for i in range(len(o))]
    # else:
    #     pw = [o[i]+e[i] for i in range(len(e))]
    #     pw.append(o[-1])
    # 
    # print("".join(pw))
    # 


if __name__ == "__main__":

    main()
Problem p03845 (python)

Fixed submission:
def main():
    n = int(input())
    t = list(map(int, input().split()))
    m = int(input())

    p = [0 for i in range(m)]
    x = [0 for i in range(m)]

    for i in range(m):
        p[i], x[i] = map(int, input().split())

    for i in range(m):
        print(sum(t) - t[p[i] - 1] + x[i])


if __name__ == "__main__":

    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    t = list(map(int, input().split()))
    m = int(input())

    x = [0 for i in range(m)]

    for i in range(m):
        _, x[i] = map(int, input().split())

    for i in range(m):
        print(sum(t) - t[i] + x[i])


if __name__ == "__main__":

    main()
Problem p03944 (python)

Fixed submission:
def main():
    x_max, y_max, n = map(int, input().split())
    x_min, y_min = 0, 0

    for n in range(n):
        x, y, a = map(int, input().split())

        if (a == 1) and (x > x_min):
            x_min = x
        elif (a == 2) and (x < x_max):
            x_max = x
        elif (a == 3) and (y > y_min):
            y_min = y
        elif (a == 4) and (y < y_max):
            y_max = y

        if (x_max <= x_min) or (y_max <= y_min):
            print(0)
            return

    print((x_max - x_min) * (y_max - y_min))

if __name__ == "__main__":

    main()

Buggy submission (verdict: Runtime Error):
def main():
    x_max, y_max, n = map(int, input().split())
    x_min, y_min = 0, 0

    for n in range(n)def main():
    x_max, y_max, n = map(int, input().split())
    x_min, y_min = 0, 0

    for n in range(n):
        x, y, a = map(int, input().split())

        if a == 1:
            x_min = max(x_min, x)
        elif a == 2:
            x_max = min(x_max, x)
        elif a == 3:
            y_min = max(y_min, y)
        elif a == 4:
            y_max = min(y_max, y)

    print(max(0, x_max - x_min) * max(0, y_max - y_min))

        # if (a == 1) and (x > x_min):
        #     x_min = x
        # elif (a == 2) and (x < x_max):
        #     x_max = x
        # elif (a == 3) and (y > y_min):
        #     y_min = y
        # elif (a == 4) and (y < y_max):
        #     y_max = y
        # 
        # if (x_max <= x_min) or (y_max <= y_min):
        #     print(0)
        #     return

    # print((x_max - x_min) * (y_max - y_min))

if __name__ == "__main__":

    main()
:
        x, y, a = map(int, input().split())

        if a == 1:
            x_min = max(x_min, x)
        elif a == 2:
            x_max = min(x_max, x)
        elif a == 3:
            y_min = max(y_max, y)
        elif a == 4:
            y_max = min(y_max, y)

    print(max(0, x_max - x_min) * max(0, y_max - y_min))

        # if (a == 1) and (x > x_min):
        #     x_min = x
        # elif (a == 2) and (x < x_max):
        #     x_max = x
        # elif (a == 3) and (y > y_min):
        #     y_min = y
        # elif (a == 4) and (y < y_max):
        #     y_max = y
        # 
        # if (x_max <= x_min) or (y_max <= y_min):
        #     print(0)
        #     return

    # print((x_max - x_min) * (y_max - y_min))

if __name__ == "__main__":

    main()
Problem p03761 (python)

Fixed submission:
# -*- coding: utf-8 -*-
from string import ascii_lowercase


def list_n():
    return [int(e) for e in input().split()]


def list_s():
    return [s for e in input().split()]


def main(n, ss):
    answer = ''
    for c in ascii_lowercase:
        answer += c * min([s.count(c) for s in ss])
    return answer


if __name__ == '__main__':
    n = int(input())
    ss = [input() for _ in range(n)]
    print(main(n, ss))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from string import ascii_lowercase


def list_n():
    return [int(e) for e in input().split()]


def list_s():
    return [s for e in input().split()]


def main(n, ss):
    answer = ''
    for c in ascii_lowercase:
        answer += c * min([s.count(c) for s in ss])
    return answer


if __name__ == '__main__':
    n = int(input())
    ss = list_s()
    print(main(n, ss))
Problem p03773 (python)

Fixed submission:
# -*- coding: utf-8 -*-


def main():
    a, b = [int(e) for e in input().split()]
    answer = (a + b) % 24
    return answer


print(main())

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def main():
    a, b = [int(e) for e in input().split()]
    answer = (a + b) % 23
    return answer


print((main())
Problem p03797 (python)

Fixed submission:
s, c = [int(e) for e in input().split()]


def main(s, c):
    if s >= c // 2:
        return c // 2
    else:
        ret = s
        c -= s * 2
        ret += c // 4
        return ret


ans = main(s, c)
print(ans)

Buggy submission (verdict: Runtime Error):
s, c = [int(e) for e in input().split()]


def main(s, c):
    ret = 0
    for i in range(s):
        ret += 1
        c   -= 2
    ret += c // 4
    return ret


ans = main(n)
print(ans)
Problem p03813 (python)

Fixed submission:
x = int(input())


if x < 1200:
    print("ABC")
else:
    print("ARC")

Buggy submission (verdict: Runtime Error):
x = input()


if x < 1200:
    print("ABC")
else:
    print("ARC")
Problem p03827 (python)

Fixed submission:
# -*- coding: utf-8 -*-


def main(n, s):
    count = 0
    max_values = []
    for c in s:
        if c == 'I':
            count += 1
            max_values.append(count)
        else:
            count -= 1
    max_values = max_values if max_values else [0]
    return max(max_values) if 0 < max(max_values) else 0


if __name__ == '__main__':
    n = int(input())
    s = input()
    answer = main(n, s)
    print(answer)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def main(n, s):
    count = 0
    max_values = []
    for c in s:
        if c == 'I':
            count += 1
            max_values.append(count)
        else:
            count -= 
    max_values = max_values if max_values else [0]
    return max(max_values) if 0 < max(max_values) else 0


if __name__ == '__main__':
    n = int(input())
    s = input()
    answer = main(n, s)
    print(answer)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def main(n, s):
    count = 0
    max_values = []
    for c in s:
        if c == 'I':
            count += 1
            max_values.append(count)
        else:
            count -= 1
    max_values = max_values if max_values else 0
    return max(max_values) if 0 < max(max_values) else 0


if __name__ == '__main__':
    n = int(input())
    s = input()
    answer = main(n, s)
    print(answer)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def main(n, s):
    count = 0
    max_values = []
    for c in s:
        if c == 'I':
            count += 1
            max_values.append(count)
        else:
            count -= 1
    return max(max_values) if 0 < max(max_values) else 0


if __name__ == '__main__':
    n = int(input())
    s = input()
    answer = main(n, s)
    print(answer)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


def main(n, s):
    count = 0
    max_values = []
    for c in s:
        if c == 'I':
            count += 1
            max_values.append(count)
        else:
            count -= 1
    return max(max_values) if 0 < max(max_values) else 0


if __name__ == '__main__':
    n = int(input())
    s = int(input())
    answer = main(n, s)
    print(answer)