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

Fixed submission:
n,a,b = map(int,input().split())

#場合分けで考える
#b-aが偶数の場合、お互いに移動すればよい
#b-aが奇数の場合、末端に近いほうが端まで移動し、その後いターン消費して、距離をお互いに詰める

if (b-a)%2==0:
    ans = int((b-a)//2)
else:
    #端までの距離が近いほうの移動ステップ
    #端まで移動した際のお互いの距離は変化していない、そこから1ターン消費する
    #距離が偶数になるのでお互いに移動する
    ans = int(min(a-1,n-b)+1+(b-a-1)//2)

print(ans)

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

#場合分けで考える
#中央にお互い移動する
#aorbが端まで移動して、その後お互いによる

dist = []
if (b-a)%2==0:
    d = (b-a)/2
    dist.append(d)
#aのほうが近い場合
if a-1<=n-b:
    a_dist = a-1
    re_b = b-a_dist
    if (re_b-1)%2==0:
        d = a_dist+(re_b-1)/2
    else:
        d = a_dist+(re_b-2)/2+1
    dist.append(d)
if a-1>n-b:
    b_dist = n-b
    re_a = a-b_dist
    if (n-re_a)%2==0:
        d = b_dist+(n-re_a)/2
    else:
        d = a_dist+(n-re_a-1)/2+1
    dist.append(d)
print(int(min(dist)))
Problem p02900 (python)

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
    
    a,b = map(int,input().split())

    #gcd(a,b)の素因数分解
    import math
    gcd = math.gcd(a,b)

    p = []
    for i in range(2,int(math.sqrt(gcd))+1):
        while gcd % i == 0:
            gcd /= i
            p.append(i)
            
    p.append(int(gcd))
    p.append(1)
    print(len(list(set(p))))

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    input = sys.stdin.readline
    
    a,b = map(int,input().split())

    def make_two_divisors(a,b):
        lower_divisors,upper_divisors = [],[]
        prime_li = [True]*(max(a,b)+1)
        i = 1
        while i*i<=max(a,b):
            if prime_li[i]:
                if a%i==0 and b%i==0:
                    lower_divisors.append(i)
                    #if i != max(a,b)//i and a%(max(a,b)//i)==0 and b%(max(a,b)//i)==0:
                    #    upper_divisors.append(b//i)
                    if i!=1:
                        for j in range(i+i,max(a,b),i):
                            prime_li[j]=False 
            i+=1
        return lower_divisors
    print(len(make_two_divisors(a,b)))

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    input = sys.stdin.readline
    
    a,b = map(int,input().split())

    def make_two_divisors(a,b):
        lower_divisors,upper_divisors = [],[]
        prime_li = [True]*(max(a,b)+1)
        i = 1
        while i*i<=max(a,b):
            if prime_li[i]:
                if a%i==0 and b%i==0:
                    lower_divisors.append(i)
                    #if i != max(a,b)//i and a%(max(a,b)//i)==0 and b%(max(a,b)//i)==0:
                    #    upper_divisors.append(b//i)
                    if i!=1:
                        for j in range(i+i,max(a,b)+1,i):
                            prime_li[j]=False 
            i+=1
        return lower_divisors
    print(len(make_two_divisors(a,b)))

if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    input = sys.stdin.readline
    
    a,b = map(int,input().split())

    def make_two_divisors(a,b):
        lower_divisors,upper_divisors = [],[]
        prime_li = [True]*(max(a,b)+1)
        i = 1
        while i*i<=max(a,b):
            if prime_li[i]:
                if a%i==0 and b%i==0:
                    lower_divisors.append(i)
                    #if i != max(a,b)//i and a%(max(a,b)//i)==0 and b%(max(a,b)//i)==0:
                    #    upper_divisors.append(b//i)
                    if i!=1:
                        for j in range(i+i,max(a,b)+1,i):
                            prime_li[j]=False 
            i+=1
        return lower_divisors + upper_divisors[::-1]
    print(len(make_two_divisors(a,b)))

if __name__=='__main__':
    main()
Problem p02947 (python)

Fixed submission:
from math import factorial
n = int(input())

dic={}
for i in range(n):
    s=''.join(sorted(list(input())))
    dic[s]=dic.get(s,0)+1

ans=0
for key,value in dic.items():
    if value<2:
        continue
    ans+=factorial(value)//(factorial(2)*factorial(value - 2))
print(ans)

Buggy submission (verdict: Runtime Error):
from math import factorial
n = int(input())

dic={}
for i in range(n):
    s=''.join(sorted(list(input())))
    dic[s]=dic.get(s,0)+1

ans=0
for key,value in dic.items():
    if value<2:
        continue
    ans+=int(factorial(value) / factorial(2) / factorial(value - 2))
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())

dic={}
for i in range(n):
    s=''.join(sorted(list(input())))
    dic[s]=dic.get(s,0)+1

ans=0
for key,value in dic.items():
    if value<2:
        continue
    ans+=int(factorial(value) / factorial(2) / factorial(value - 2))
print(ans)

Buggy submission (verdict: Runtime Error):
from math import factorial
n = int(input())

dic={}
for i in range(n):
    s = ''.join(sorted(set(input())))
    dic[s]=dic.get(s,0)+1

ans=0
for key,value in dic.items():
    if value<2:
        continue
    ans+=int(factorial(value) / factorial(2) / factorial(value - 2))
print(ans)
Problem p03030 (python)

Fixed submission:
n = int(input())

map_list = [[0,'abc',0] for i in range(n)]

for i in range(n):
    input_line = input().split()
    map_list[i]=[i,input_line[0],int(input_line[1])]

ans_li = sorted(map_list,key=lambda x:(x[1],-x[2]))
for ans in ans_li:
    print(ans[0]+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
dic = {}
for i in range(1,n+1):
    s,p = map(str,input().split())
    dic[i]=s+str(1/int(p))
for s in sorted(dic.items(),key=lambda x:x[1]):
    print(s[0])
Problem p03244 (python)

Fixed submission:
from collections import Counter
n = int(input())
v_input = list(map(int,input().split()))

odd_li = []
even_li = []
for i in range(n):
    if i%2==0:
        odd_li.append(v_input[i])
    else:
        even_li.append(v_input[i])

odd_count = sorted(Counter(odd_li).items(),key=lambda x:x[1],reverse=True)
even_count = sorted(Counter(even_li).items(),key=lambda x:x[1],reverse=True)

odd_max = odd_count[0][0]
even_max = even_count[0][0]

if odd_max==even_max and len(odd_count)==1:
    ans = n//2

elif odd_max==even_max:
    odd_next = odd_count[1][1]
    even_next = even_count[1][1]
    ans = n//2-odd_count[0][1] + n//2 - max(odd_next,even_next)
else:
    ans = n//2-odd_count[0][1] + n//2 - even_count[0][1]

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
v_input = list(map(int,input().split()))

odd_li = []
even_li = []
for i in range(n):
    if i%2==0:
        odd_li.append(v_input[i])
    else:
        even_li.append(v_input[i])
odd_count = sorted(Counter(odd_li).items(),key=lambda x:x[1])
even_count = sorted(Counter(even_li).items(),key=lambda x:x[1])

odd_max = odd_count[0][0]
even_max = even_count[0][0]

if odd_max==even_max and len(odd_count)==1:
    ans = odd_count[0][1]

elif odd_max==even_max:
    odd_next = odd_count[1][1]
    even_next = even_count[1][1]
    ans = n//2-odd_count[0][1] + n//2 - max(odd_next)
else:
    ans = n//2-odd_count[0][1] + n//2 - even_count[0][1]

print(ans)
Problem p03427 (python)

Fixed submission:
n =input()

#最上位の桁をc,桁数をkとすると、
#c以外が9の場合(ex.49999)はc,9*(k-1)となる
#それ以外の場合、c,9*(k-2),8となる(ex.9995:9989)

c = int(n[0])
k = len(n)
if int(n)<10:
    print(n);exit()
if int(n[1:])==int('9'*(k-1)):
    ans = c+9*(k-1)
else:
    ans = c+9*(k-1)-1

print(ans)

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

#最上位の桁をc,桁数をkとすると、
#c以外が9の場合(ex.49999)はc,9*(k-1)となる
#それ以外の場合、c,9*(k-2),8となる(ex.9995:9989)

c = int(n[0])
k = len(n)

if int(n[1:])==int('9'*(k-1)):
    ans = c+9*(k-1)
else:
    ans = c+9*(k-1)-1

print(ans)
Problem p03436 (python)

Fixed submission:
from collections import deque
h,w = map(int,input().split())
map_input = [list(input()) for i in range(h)]

sx,sy = 0,0
gx,gy = w-1,h-1
#bfsで最短経路を求めて、それ以外のマスを塗りつぶせばよい
black = 0
for i in range(h):
    for j in range(w):
        if map_input[i][j]=='#':
            black+=1

mx = [0,0,1,-1]
my = [1,-1,0,0]

queue = deque([[sx,sy]])
visited = [[0]*w for i in range(h)]
visited[sy][sx] = 1

def bfs(queue,visited):
    while queue:
        x,y = queue.popleft()
        for i in range(4):
            nx = x+mx[i]
            ny = y+my[i]
            if 0<=nx<w and 0<=ny<h:
                if visited[ny][nx]!=0:
                    continue
                if map_input[ny][nx]=='#':
                    continue
                if nx==gx and ny==gy:
                    return visited[y][x]+1
                visited[ny][nx]=visited[y][x]+1
                queue.append([nx,ny])
    return -1

tmp = bfs(queue,visited)
if tmp==-1:
    print(-1)
else:
    ans = h*w-tmp-black
    print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
h,w = map(int,input().split())
map_input = [list(input()) for i in range(h)]

sx,sy = 0,0
gx,gy = w-1,h-1
#bfsで最短経路を求めて、それ以外のマスを塗りつぶせばよい
black = 0
for i in range(h):
    for j in range(w):
        if map_input[i][j]=='#':
            black+=1

mx = [0,0,1,-1]
my = [1,-1,0,0]

queue = deque([[sx,sy]])
visited = [[0]*w for i in range(h)]
visited[sy][sx] = 1

def bfs(queue,visited):
    while queue:
        x,y = queue.popleft()
        for i in range(4):
            nx = x+mx[i]
            ny = y+my[i]
            if 0<=nx<w and 0<=ny<h:
                if visited[ny][nx]!=0:
                    continue
                if map_input[ny][nx]=='#':
                    continue
                if nx==gx and ny==gy:
                    return visited[y][x]+1
                visited[ny][nx]=visited[y][x]+1
                queue.append([nx,ny])

ans = h*w-bfs(queue,visited)-black
print(ans)
Problem p03438 (python)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a_gap = 0
b_gap = 0
for i in range(n):
    if A[i]>B[i]:
        a_gap+=A[i]-B[i]
    if A[i]<B[i]:
        b_gap+=(B[i]-A[i])//2

if b_gap-a_gap<0:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a_gap = 0
b_gap = 0
for i in range(n):
    if A[i]>B[i]:
        a_gap+=A[i]-B[i]
    if A[i]<B[i]:
        b_gap+=B[i]-A[i]

if a_gap*2-b_gap>0:
    print('No')
else:
    print('Yes')
Problem p03569 (python)

Fixed submission:
def main():
    #input data
    import sys
    input = lambda:sys.stdin.readline().strip()
    S = input()
    N = len(S)
    #solve
    left = 0
    right = N-1

    ans = 0
    while left<=right:
        if right==left:
            break
        if S[left]==S[right]:
            left+=1
            right-=1
            continue
        if S[left]!='x' and S[right]!='x':
            print(-1);exit()
        if S[left]=='x':
            left+=1
            ans+=1
        if S[right]=='x':
            right-=1
            ans+=1
    if right>left:
        print(-1)
    else:
        print(ans)


if __name__=='__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    #input data
    import sys
    input = lambda:sys.stdin.readline().strip()
    S = input()
    N = len(S)
    #solve
    left = 0
    right = N-1

    ans = 0
    while True:
        if right==left:
            break
        if S[left]==S[right]:
            left+=1
            right-=1
            continue
        if S[left]!='x' and S[right]!='x':
            print(-1);exit()
        if S[left]=='x':
            left+=1
            ans+=1
        if S[right]=='x':
            right-=1
            ans+=1
    print(ans)


if __name__=='__main__':
    main()
Problem p03695 (python)

Fixed submission:
n = int(input())
a_input=list(map(int,input().split()))

rate_li=[0]*9
top_coder=0
for a in a_input:
    rate_li[min(a//400,8)]+=1
#print(rate_li)
min_ = sum(i!=0 for i in rate_li[:8])
print(max(min_,1),min_+rate_li[-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
a_input=list(map(int,input().split()))

rate_li=[0]*9
top_coder=0
for a in a_input:
    rate_li[a//400]+=1

min_ = sum(i!=0 for i in rate_li[:8])
print(min_,min(8,min_+rate_li[-1]))
Problem p03779 (python)

Fixed submission:
x = int(input())

ans=0
y=0
for i in range(1,x+1):
    y=y+i
    ans+=1
    if y>=x:
        print(ans)
        break

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

dp=[float('inf')]*(x+1)
dp[0]=0
for i in range(1,x+1):
    for j in range((i-1)*i//2+1):
        if 0<=j<=x and 0<=i+j<=x:
            dp[i+j]=min(dp[i+j],i)
print(dp[x])

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

dp=[float('inf')]*(x+1)
dp[0]=0
for i in range(1,x+1):
    for j in range((i-1)*i//2+1):
        if j<=x and i+j<=x:
            dp[i+j]=min(dp[i+j],i)
print(dp[x])
Problem p03799 (python)

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

if n*2>=m:
    print(m//2)
else:
    tmp=m-n*2
    print(n+tmp//4)

Buggy submission (verdict: Runtime Error):
import sys
N, M = map(int, input().split())
S = [0] * M
C = [0] * M
for i in range(M):
    S[i], C[i] = map(int, input().split())

for i in range(1000):
    string = str(i)
    if len(string) != N:
        continue
    flag = True
    for j in range(M):
        if string[S[j] - 1] == str(C[j]):
            None
        else:
            flag = False
            break
    if flag:
        print(i)
        sys.exit(0)
print("-1")
Problem p04043 (python)

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

count5 = len([x for x in [a,b,c] if x==5])
count7 = len([x for x in [a,b,c] if x==7])

if count5==2 and count7==1:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
coutn5 = [x for x in [a,b,c] if x==5]
coutn7 = [x for x in [a,b,c] if x==7]

if len(count5)==2 and len(count7)==1:
  print('YES')
else:
  print('NO')
Problem p02658 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
 
ans = 1
 
a.sort(reverse=True)
 
if 0 not in a:
    for x in range(n):
        ans *= a[x]
 
        if ans > 10**18:
            ans = -1
            break
else:
    ans = 0
 
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input(""))
mul = 1
while N >0 :
    a = int(input(""))
    mul = mul * a
    N -= 1





if mul > 10**18:
    print(-1)
else:
    print(mul)
Problem p02658 (python)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
ans = 1
count = 0
if 0 in A:
    print(0)
else:
    for i in range(n):
        ans *= A[i]
        if ans > 10**18:
            count = 1
            print(-1)
            break
    if count == 0:
        print(ans)

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

n = int(input())
A = list(map(int, input().split()))
ans = np.prod(A)
l = int(math.log10(ans)+1)
if l >= 18:
    print(-1)
else:
    print(int(ans))
Problem p02732 (python)

Fixed submission:
from collections import Counter

n = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
counter_comb = list(map(lambda y: int(y*(y-1)/2), counter.values()))
sum_counter = sum(counter_comb)
for i in range(n):
    z = counter[A[i]]
    if z>0:
        print(sum_counter-(z-1))
    else:
        print(sum_counter)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
counter_comb = list(map(lambda y: int(y*(y-1)/2), counter.values()))
sum_counter = sum(counter_comb)
for i in range(n):
    z = counter[A[i]-1]
    if z>0:
        print(ssum_counter-(z-1))
    else:
        print(sum_counter)
Problem p02760 (python)

Fixed submission:
import numpy as np

A = np.array(list(list(map(int, input().split())) for l in range(3)))
N = int(input())
b = np.array(list(int(input()) for l in range(N)))
bingo = np.zeros((3, 3))
bingo = bingo == 1

for b_i in b:
    hantei = A == b_i
    bingo = np.logical_or(bingo, hantei)

for i in range(3):
    if all(bingo[i]) or all(bingo[:,i]):
        print('Yes')
        exit()

if (bingo[0,0] and bingo[1,1] and bingo[2,2]) or (bingo[0,2] and bingo[1,1] and bingo[2,0]):
    print('Yes')
    exit()

print('No')

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

A = np.array(list(list(map(int, input().split())) for l in range(3)))
N = int(input())
b = np.array(list(int(input()) for l in range(N)))
bingo = np.zeros((3, 3))
bingo = bingo == 1

for b_i in b:
    hantei = A == b_i
    bingo = np.logical_or(bingo, hantei)

for i in range(3):
    if all(bingo[i]) or all(bingo[:,i]):
        print('Yes')
        exit()

if (bingo[0,0] and bingo[1,1] and bingo[2,2]) or (bingo[0,2] and bingo[1,1] and bingo[3,1]):
    print('Yes')
    exit()

print('No')
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
x = [-1]*n
ans = 0
count = 0
for i in range(m):
    s, c = map(int, input().split())
    if (s==1) and (c==0) and(n!=1):
        count = 1
    if x[s-1]!=-1 and x[s-1]!=c:
        count = 1
    if x[s-1] != c:
        ans += c*(10**(n-s))
    x[s-1] = c

if count==1:
    print(-1)
elif n==1 and ans==0:
    print(0)
elif ans>=10**(n-1):
    print(ans)
else:
    print(ans+10**(n-1))

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

ans = [0]*n 

for i in range(m):
    s, c = map(int, input().split())
    if ans[s-1] == 0:
        ans[s-1] = c 
    elif not ans[s-1] == c:
        print(-1)
        break
    if i == m-1:
        if ans[0] == 0:
            print(-1)
        else:
            for j in range(n):
                a = a+ans[j]*(10**(n-j-1))
            print(a)
Problem p02802 (python)

Fixed submission:
import math
n, m = map(int, input().split())
false_count = [1]*n
ans_false_count = [0]*n
ans_success_count = [0]*n

for i in range(m):
    p, s = input().split()
    p = int(p)
    s = str(s)

    if s=='WA':
        false_count[p-1] = int(false_count[p-1]*2)
    else:
        ans_false_count[p-1] += int(false_count[p-1])
        ans_success_count[p-1] = 1
        false_count[p-1] = 0

for j in range(n):
    if ans_false_count [j] != 0:
        ans_false_count[j] = math.log(ans_false_count[j],2)

new_ans_false_count = ans_false_count
print(sum(ans_success_count), int(sum(new_ans_false_count)))

Buggy submission (verdict: Runtime Error):
import math
n, m = map(int, input().split())
false_count = [1]*n
ans_false_count = [0]*n
ans_success_count = [0]*n

for i in range(m):
    p, s = input().split()
    p = int(p)
    s = str(s)

    if s=='WA':
        false_count[p-1] = false_count[p-1]*2 
    else:
        ans_false_count[p-1] += false_count[p-1]
        ans_success_count[p-1] = 1
        false_count[p-1] = 0

for j in range(n):
    if false_count[j] != 0:
        false_count = math.log(false_count[j],2)
    if ans_false_count [j] != 0:
        ans_false_count[j] = math.log(ans_false_count[j],2)

new_ans_false_count = false_count + ans_false_count
print(sum(ans_success_count), int(sum(new_ans_false_count)))

Buggy submission (verdict: Runtime Error):
import math
n, m = map(int, input().split())
false_count = [1]*n
ans_false_count = [0]*n
ans_success_count = [0]*n

for i in range(m):
    p, s = input().split()
    p = int(p)
    s = str(s)

    if s=='WA':
        false_count[p-1] = false_count[p-1]*2 
    else:
        ans_false_count[p-1] += false_count[p-1]
        ans_success_count[p-1] = 1
        false_count[p-1] = 0

false_count = [math.log(i,2) for i in false_count] 

new_ans_false_count = false_count + ans_false_count
print(sum(ans_success_count), int(sum(new_ans_false_count)))
Problem p02813 (python)

Fixed submission:
import itertools

n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))

nlist = list(itertools.permutations(i for i in range(1,n+1)))

ans = abs(nlist.index(p) - nlist.index(q))
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

nlist = list(itertools.permutations(i for i in range(1,n+1)))

ans = abs(index(nlist,p) - index(nlist,q))
Problem p02947 (python)

Fixed submission:
from collections import Counter
n = int(input())
S = [str(sorted(input())) for _ in range(n)]

print(sum(map(lambda x: x * (x - 1) // 2, Counter(S).values())))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
S = [str(sorted(input())) for _ in range(N)]

print(sum(map(lambda x: x * (x - 1) // 2, Counter(S).values())))
Problem p02983 (python)

Fixed submission:
L, R = map(int, input().split())

ans = 2018

if R-L>=2019:
    print(0)
else:
    for i in list(range(L, R)):
        for j in list(range(i+1, R+1)):
            ans = min(ans, i*j % 2019)
    print(ans)

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

L, R = map(int, input().split())
range_L_R = np.array(list(range(L, R+1)))
range_L_R = range_L_R % 2019


if ((R>=673) and (L<=672)) or ((R>=675) and (L<=673)) or 0 in range_L_R:
    print(0)
else:
    print(L*(L+1) % 2019)
Problem p04001 (python)

Fixed submission:
s = str(input())
ans = 0

for i in range(2**(len(s)-1)):
    x = s[0]

    for j in range(len(s)-1):
        if (i>>j) & 1:
            x += '+'
        x += s[j+1]
        
    ans += sum(map(int,x.split('+')))
print(ans)

Buggy submission (verdict: Runtime Error):
s = str(input())
ans = 0

for i in 2**(len(s)-1):
    x = s[0]

    for j in range(len(s)-1):
        if (i>>j) & 1:
            x += '+'
        x += s[j+1]
        
    ans += sum(map(int,x.split('+')))
print(ans)
Problem p02802 (python)

Fixed submission:
# coding: utf-8
n, m = [int(x) for x in input().split(" ")]
ans = 0
pens = 0
prbstate = {}
fins = {}
A = []
for i in range(m):
    A.append(input().split(" "))
for a in A:
    if a[1] == "AC":
        fins.setdefault(a[0], 1)
for x in fins.values():
    ans += x
for i in range(m):
    p, s = A[i]
    prbstate.setdefault(p, 0)
    fins.setdefault(p, 0)
    if s == "AC":
        prbstate[p] += 1
    if s == "WA" and prbstate[p] < 1 and fins[p] == 1:
        pens += 1
print(ans, pens)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
n, m = [int(x) for x in input().split(" ")]
ans = 0
pen = 0
prbstate = {}
fins = {}
A = []
for i in range(m):
    A.append(input().split(" "))

for a in A:
    if a[1] == "AC":
        fins.setdefault(a[0], "AC")

for i in range(m):
    p, s = A[i]
    prbstate.setdefault(p, 0)
    if s == "AC":
        prbstate[p] = 1
    if s == "WA" and prbstate[p] == 0 and fins[p] == "AC":
        pen += 1
for x in prbstate.values():
    ans += x
print(ans, pen)
Problem p02882 (python)

Fixed submission:
# coding: utf-8
import math

a, b, x = [int(y) for y in input().split(" ")]

if a * a * b == x:
    print(0)
else:
    if a * a * b <= 2 * x:
        t = (a * a * a / (a * a * b - x)) / 2
        print(90 - math.degrees(math.atan(t)))
    else:
        t = 2 * (x / (a * b * b))
        print(90 - math.degrees(math.atan(t)))

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

a, b, x = [int(y) for y in input().split(" ")]

if a * a * b <= 2 * x:
    t = (a * a * a / (a * a * b - x)) / 2
    print(90 - math.degrees(math.atan(t)))
else:
    t = 2 * (x / (a * b * b))
    print(90 - math.degrees(math.atan(t)))
Problem p02658 (python)

Fixed submission:
import sys

if __name__ == "__main__":
 
    N = int(input())
 
    P = list(map(int,input().split()))

    if(0 in P):
        print(0)
    else:
        P.sort()

        mult = 1
        for i in P:
            mult *= i 
            if (mult > 10 ** 18):
                print(-1)
                sys.exit()

        print(mult)

Buggy submission (verdict: Runtime Error):
import math

if __name__ == "__main__":

    N = int(input())

    P = (map(int,input().split()))

    mult = 1
    for i in P:
        mult *= i

    if(math.log10(mult) > 18):
        print(-1)
    else:
        print(mult)