Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int,input().split()))

for i in range(N):
    print(a.count(i+1))

Fixed submission:
N = int(input())
a = list(map(int,input().split()))
b = [0]*N
for i in a:
    b[i-1] += 1
for i in b:
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
import itertools
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
    
K = int(input())
cnt = 0
    
for v in itertools.product(range(1,K+1),repeat=3):
    cnt += gcd(v[0],v[1],v[2])
    
print(cnt)



Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
    
K = int(input())
cnt = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            cnt += gcd(i,j,k)
            
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
    
K = int(input())
cnt = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            cnt += gcd(i,j,k)
            
print(cnt)

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
    
K = int(input())
cnt = 0
for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            cnt += gcd(i,j,k)
            
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())

p = list(map(int,input().split()))
max = 0
for i in range(N-K+1):
    tmp = 0
    tmp += (1+p[i])/2
    for j in range(K-1):
        tmp += (1+p[i+j+1])/2
    if max < tmp:
        max = tmp
        
print(max)




Fixed submission:
N,K = map(int,input().split())

p = list(map(int,input().split()))
max = 0
for i in range(K):
    max += (1+p[i])/2
tmp = max
for i in range(K,len(p)):
    tmp -= (1+p[i-K])/2
    tmp += (1+p[i])/2
    #print(max)
    if max < tmp:
        max = tmp
    #print(max)    
print(max)




#ロケットペンシル方式

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())

p = list(map(int,input().split()))
max = 0
for i in range(N-K+1):
    tmp = 0
    tmp += ((p[i]*(1+p[i]))/2)/p[i]
    for j in range(K-1):
        tmp += ((p[i+j+1]*(1+p[i+j+1]))/2)/p[i+j+1]
    if max < tmp:
        max = tmp
        
print(max)



Fixed submission:
N,K = map(int,input().split())

p = list(map(int,input().split()))
max = 0
for i in range(K):
    max += (1+p[i])/2
tmp = max
for i in range(K,len(p)):
    tmp -= (1+p[i-K])/2
    tmp += (1+p[i])/2
    #print(max)
    if max < tmp:
        max = tmp
    #print(max)    
print(max)




#ロケットペンシル方式
Buggy python submission (verdict: Runtime Error):
S = str(input())
Slist = list(S)
newlist = list(reversed(Slist))
ans != 0
for i in range((len(S)//2)):
  if Slist[i] == newlist[i]:
    ans += 1
    
print(ans)

Fixed submission:
S = str(input())
Slist = list(S)
newlist = list(reversed(Slist))
ans = 0
for i in range((len(S)//2)):
  if Slist[i] != newlist[i]:
    ans += 1
    
print(ans)

Buggy python submission (verdict: Runtime Error):
S = str(input())
Slist = list(S)
newlist = list(reversed(Slist))
ans = 0
for i in range((len(S)//2)):
  if Slist[i] == newlist[i]:
    a += 1
    
print(ans)
  


Fixed submission:
S = str(input())
Slist = list(S)
newlist = list(reversed(Slist))
ans = 0
for i in range((len(S)//2)):
  if Slist[i] != newlist[i]:
    ans += 1
    
print(ans)
Buggy python submission (verdict: Runtime Error):
n= int(input())
a=list(map(int,input().split()))
i=0
j=0
p=0
while(i<len(a)):
  j=i+1
  s=0
  while(j<len(a)):
    s=s+a[j]
   	j=j+1
  p=p+s*a[i]
  i=i+1
print(p)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
i=0
j=0
p=0
while(i<len(a)):
  j=i+1
  s=0
  while(j<len(a)):
      s=s+a[j]
      j=j+1
  
  p=p+s*a[i]
  i=i+1
print(p)
Buggy python submission (verdict: Runtime Error):
a,b=[int(x) for x in input().split()]
i=1
def gcd(a,b):
  a,b=max(a,b),min(a,b)
  if a%b==0:
    return b
  else:
    return gcd(b,a%b)
g=gcd(a,b)
l=[]
while(i*i<=g):
    if g%i==0 and i*i!=g:
        l.append(i)
        l.append(g//i)
    if i*i==g:
        l.append(i)
    i=i+1
l=sorted(l)
i=1
while(i<len(l)):
    if l[i]!=0:
        j=i+1
        while(j<len(l)):
            if l[j]%l[i]==0:
                l[j] = 0
            j=j+1
    i=i+1
l=list(filter ( lambda x:x!=0,l))
print(len(l))


Fixed submission:
import math
n=int(input())
print(math.ceil(n/2)/n)

Buggy python submission (verdict: Runtime Error):

a,b=[int(x) for x in input().split()]
i=1
def gcd(a,b):
  a,b=max(a,b),min(a,b)
  if a%b==0:
    return b
  else:
    return gcd(b,a%b)
g=gcd(a,b)
l=[]
while(i*i<=g):
    if g%i==0 and i*i!=g:
        l.append(i)
        l.append(g//i)
    if i*i==g:
        l.append(i)
    i=i+1
l=sorted(l)
i=1
while(i<len(l)):
    if l[i]!=0:
        j=i+1
        while(j<len(l)):
            if l[j]%l[i]==0:
                l[j] = 0
            j=j+1
    i=i+1
l=list(filter ( lambda x:x!=0,l))
print(len(l))


Fixed submission:
import math
n=int(input())
print(math.ceil(n/2)/n)
Buggy python submission (verdict: Runtime Error):
import math
a,b=[int(x) for x in input().split()]
i=1
g=math.gcd(a,b)
l=[]
while(i*i<=g):
    if g%i==0 and i*i!=g:
        l.append(i)
        l.append(g//i)
    if i*i==g:
        l.append(i)
    i=i+1
l=sorted(l)
i=1
while(i<len(l)):
    if l[i]!=0:
        j=i+1
        while(j<len(l)):
            if l[j]%l[i]==0:
                l[j] = 0
            j=j+1
    i=i+1
l=list(filter ( lambda x:x!=0,l))
print(len(l))


Fixed submission:
a,b=[int(x) for x in input().split()]
i=1
def gcd(a,b):
  a,b=max(a,b),min(a,b)
  if a%b==0:
    return b
  else:
    return gcd(b,a%b)
g=gcd(a,b)
l=[]
while(i*i<=g):
    if g%i==0 and i*i!=g:
        l.append(i)
        l.append(g//i)
    if i*i==g:
        l.append(i)
    i=i+1
l=sorted(l)
i=1
while(i<len(l)):
    if l[i]!=0:
        j=i+1
        while(j<len(l)):
            if l[j]%l[i]==0:
                l[j] = 0
            j=j+1
    i=i+1
l=list(filter ( lambda x:x!=0,l))
print(len(l))

Buggy python submission (verdict: Runtime Error):
import math
a,b=[int(x) for x in input().split()]
i=1
g=math.gcd(a,b)
l=[]
while(i*i<=g):
    if g%i==0:
        l.append(i)
        l.append(g//i)
    i=i+1
l=sorted(l)
i=1
while(i<len(l)):
    if l[i]!=0:
        j=i+1
        while(j<len(l)):
            if l[j]%l[i]==0:
                l[j] = 0
            j=j+1
    i=i+1
l=list(filter ( lambda x:x!=0,l))
print(len(l))


Fixed submission:
a,b=[int(x) for x in input().split()]
i=1
def gcd(a,b):
  a,b=max(a,b),min(a,b)
  if a%b==0:
    return b
  else:
    return gcd(b,a%b)
g=gcd(a,b)
l=[]
while(i*i<=g):
    if g%i==0 and i*i!=g:
        l.append(i)
        l.append(g//i)
    if i*i==g:
        l.append(i)
    i=i+1
l=sorted(l)
i=1
while(i<len(l)):
    if l[i]!=0:
        j=i+1
        while(j<len(l)):
            if l[j]%l[i]==0:
                l[j] = 0
            j=j+1
    i=i+1
l=list(filter ( lambda x:x!=0,l))
print(len(l))
Buggy python submission (verdict: Runtime Error):
s=["Sunny","Cloudy","Rainy"]
a=input()
if a=="Sunny":
    print(Cloudy)
elif a=="Cloudy":
    print(Rainy)
else:
    print(Sunny)

Fixed submission:
s=["Sunny","Cloudy","Rainy"]
a=input()
if a=="Sunny":
    print("Cloudy")
elif a=="Cloudy":
    print("Rainy")
else:
    print("Sunny")
Buggy python submission (verdict: Runtime Error):
n,x=map(int,input().split())
a=list(map(int,input().split()))
i,s=0,0
while s<=x:
  s=s+a[i]
  i=i+1
print(i)

Fixed submission:
x,a=map(int,input().split())
if x<a:
  print("0")
else:
  print("10")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

A_sunuke = [a - (i+1) for (i,a) in enumerate(A)]

sunuke_cnts = set(A_sunuke) 

idx, cnt = 0, 0
for i in sunuke_cnts:
    a_cnt = A_sunuke.count(i)
    if cnt < a_cnt:
        cnt = a_cnt
        idx = i 

rtn = sum([abs(a - idx) for a in A_sunuke])
print(rtn)

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

A_sunuke = sorted(a - (i+1) for (i,a) in enumerate(A))

center = A_sunuke[len(A) // 2]

rtn = sum([abs(a - center) for a in A_sunuke])
print(rtn)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

A = list(map(int, input().split()))

min_idx = A.index(min(A))

if K >= N:
    print(1)
else:
    if (n-1)%(k-1):
        print((N - 1) // (K - 1) + 1)
    else:
        print((N - 1)// (K - 1))

Fixed submission:
N, K = map(int, input().split())

A = list(map(int, input().split()))

min_idx = A.index(min(A))

if K >= N:
    print(1)
else:
    if ((N-1)%(K-1) == 0):
        print((N - 1)// (K - 1))
    else:
        print((N - 1) // (K - 1) + 1)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())

if A <= 8 or B <= 8:
    return "Yay!"
else:
    return ":("

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

if(A<=8 and B<=8):
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
D, N = map(int,input().split())

if(N !=100):
    print((100 ** D) * N)    
else:
    print((100 ** D) * (N + 1)

Fixed submission:
D, N = map(int,input().split())

if(N !=100):
    print((100 ** D) * N)
else:
    print((100 ** D) * (N + 1))
Buggy python submission (verdict: Runtime Error):
def poll_height(n):
    if n:
        return n + poll_height(n - 1)
    else:
        return 0

a, b = map(int, input().split())

difference_a_b = b - a 
print(poll_height(difference_a_b) - b)

Fixed submission:
def poll_height(n):
    rtn = 0
    for i in range(n):
        rtn += i+1
    return rtn

a, b = map(int, input().split(" "))

difference_a_b = b - a
print(poll_height(difference_a_b) - b)
Buggy python submission (verdict: Runtime Error):
S = input()

def count_common(a, b):
    min_char = set(min(a, b))
    max_char = set(max(a, b))
    return len(max_char) - len(max_char-min_char)

rtn = 0
for i in range(N):
    a = S[:i]
    b = S[i:]
    tmp = count_common(a, b)
    if rtn < tmp:
        rtn = tmp

print(rtn)

Fixed submission:
N = int(input())
S = input()

def count_common(a, b):
    min_char = set(min(a, b))
    max_char = set(max(a, b))
    return len(max_char) - len(max_char - min_char)

rtn = 0
for i in range(N):
    a = S[:i]
    b = S[i:]
    tmp = count_common(a, b)
    if rtn < tmp:
        rtn = tmp

print(rtn)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

rtn = N 

def count_change(func, s): 
    return len(list(filter(func, s)))

for i in range(N):
    west_change = count_change(lambda x: x=="W", S[:i]) 
    east_change = count_change(lambda x:x=="E", S[i+1:])
    change_num = west_change + east_change
    if change_num < rtn and change_num!=0:    
        rtn = change_num

print(rtn)

Fixed submission:
N = int(input())
S = input()

lE = [0] * N
lW = [0] * N
le = lw = 0
for i in range(N):
    if S[i] == "E":
        le += 1
    else:
        lw += 1
    lE[i] = le
    lW[i] = lw

rtn = lE[-1] - lE[0]

for i in range(1, N):
    tmp = lW[i-1] + lE[-1] - lE[i]
    if tmp <= rtn:
        rtn = tmp


print(rtn)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
 
lE = [0] * N 
lW = [0] * N 
le = lw = 0 
for i in range(N):
    if S[i] == "E":
        le += 1
    else:
        lw += 1
    lE[i] = le
    lW[i] = lw
 
rtn = lE[-1] - lE[0] 
 
for i in range(1, N - 1): 
    tmp = lW[i-1] + lE[-1] - lE[i]
    if tmp <= rtn:
        rtn = tmp 
 
most_east = lW[-2] 
if most_east <= rtn:
    rtn = count
 
print(rtn)

Fixed submission:
N = int(input())
S = input()

lE = [0] * N
lW = [0] * N
le = lw = 0
for i in range(N):
    if S[i] == "E":
        le += 1
    else:
        lw += 1
    lE[i] = le
    lW[i] = lw

rtn = lE[-1] - lE[0]

for i in range(1, N):
    tmp = lW[i-1] + lE[-1] - lE[i]
    if tmp <= rtn:
        rtn = tmp


print(rtn)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
K = int(input())
str_len = len(s)
substrings = []  

def get_substrings(substr_len):
    if substr_len == 0:
        return
    else:
        for i in range(0, str_len + 1 - substr_len):
            sub_s = s[i:i+substr_len]
            if not(sub_s in substrings):
                substrings.append(sub_s)
        get_substrings(substr_len - 1)

get_substrings(str_len)
substrings.sort()

print(substrings[K - 1])

Fixed submission:
s = input()
K = int(input())
str_len = len(s)
substrings = []

def get_substrings(substr_len):
    if substr_len == K + 1:
        return
    else:
        for i in range(0, str_len + 1 - substr_len):
            sub_s = s[i:i+substr_len]
            if not(sub_s in substrings):
                substrings.append(sub_s)
        get_substrings(substr_len + 1)

get_substrings(1)
substrings.sort()

print(substrings[K - 1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]
ans = 100100100
for i in range(1,101) :
    s = 0
    for o in x :
        s+=(i-x)*(i-x)
    ans = min(ans,s)
print(ans)

Fixed submission:
n = int(input())
x = [int(i) for i in input().split()]
ans = 100100100
for i in range(1,101) :
    s = 0
    for o in x :
        s+=(i-o)*(i-o)
    ans = min(ans,s)
print(ans)
Buggy python submission (verdict: Runtime Error):
yobi = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
yobi = yobi.reverse()
s = input()
for i in range(7):
  if s == yobi[i]:
    print(i+1)

Fixed submission:
yobi = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
yobi.reverse()
s = input()
for i in range(7):
  if s == yobi[i]:
    print(i+1)

Buggy python submission (verdict: Runtime Error):
yobi = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
yobi = yobi.reverse
s = input()
for i in range(7):
  if s == yobi[i]:
    print(i+1)

Fixed submission:
yobi = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
yobi.reverse()
s = input()
for i in range(7):
  if s == yobi[i]:
    print(i+1)

Buggy python submission (verdict: Runtime Error):
yobi = [MON,TUE,WED,THU,FRI,SAT,SUN]
s = input()
for i in range(7):
  if s == yobi[i]:
    print(i+1)

Fixed submission:
yobi = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
yobi.reverse()
s = input()
for i in range(7):
  if s == yobi[i]:
    print(i+1)
Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
if n%2==1 or s[:n//2]==s[n//2:] :
    print("No")
else:
    print("Yes")
return 0

Fixed submission:
n = int(input())
s = input()
if n%2==1 or s[:n//2]!=s[n//2:] :
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
if n%2==1 or s[:n/2]==s[n/2:]:
    print("No")
else:
    print("Yes")
return 0

Fixed submission:
n = int(input())
s = input()
if n%2==1 or s[:n//2]!=s[n//2:] :
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
s = input()
n = len(s)
if n%2==1 or s[:n//2]==s[n//2:]:
    print("No")
else:
    print("Yes")
return 0

Fixed submission:
n = int(input())
s = input()
if n%2==1 or s[:n//2]!=s[n//2:] :
    print("No")
else:
    print("Yes")

Buggy python submission (verdict: Runtime Error):
s = input()
if len(s)%2==1 or s[:len(s)//2]==s[len(s)//2:]:
    print("No")
else:
    print("Yes")
return 0

Fixed submission:
n = int(input())
s = input()
if n%2==1 or s[:n//2]!=s[n//2:] :
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
m = n-1
for i in range(1,1+math.isqrt(n-1)):
  if n%i==0:
    m = min(m,i+n/i-2)
print(m)

Fixed submission:
import math
n = int(input())
m = n-1
for i in range(1,int(math.sqrt(n))+1):
  if n%i==0:
    m = min(m,i+n//i-2)
print(m)
Buggy python submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())
ans = 0
if (a*a*b)/2>=x :
    t = x*2/b/a/b
    ans = 90-math.degrees(math.atan(t))
else if (a*a*b)==x:
    ans = 0.0
else :
    x = (a*a*b) - x
    t = x*2/a/a
    ans = 90-math.degrees(math.atan(a/t))
print(ans)

Fixed submission:
import math
a,b,x = map(int,input().split())
ans = 0
if (a*a*b)/2>=x :
    t = x*2/b/a/b
    ans = 90-math.degrees(math.atan(t))
elif (a*a*b)==x:
    ans = 0.0
else :
    x = (a*a*b) - x
    t = x*2/a/a
    ans = 90-math.degrees(math.atan(a/t))
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())
if (a*a*b)/2>=x :
    t = x*2/b/a/b
    ans = 90-math.degrees(math.atan(t))
else if (a*a*b)==x:
  ans = 0.0
else :
    x = (a*a*b) - x
    t = x*2/a/a
    ans = 90-math.degrees(math.atan(a/t))
print(ans)

Fixed submission:
import math
a,b,x = map(int,input().split())
ans = 0
if (a*a*b)/2>=x :
    t = x*2/b/a/b
    ans = 90-math.degrees(math.atan(t))
elif (a*a*b)==x:
    ans = 0.0
else :
    x = (a*a*b) - x
    t = x*2/a/a
    ans = 90-math.degrees(math.atan(a/t))
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
a,b,x = map(int,input().split())
if (a*a*b)/2>=x :
    t = x*2/b/a/b
    ans = 90-math.degrees(math.atan(t))
else :
    x = (a*a*b) - x
    t = x*2/a/a
    ans = 90-math.degrees(math.atan(a/t))
print(ans)

Fixed submission:
import math
a,b,x = map(int,input().split())
ans = 0
if (a*a*b)/2>=x :
    t = x*2/b/a/b
    ans = 90-math.degrees(math.atan(t))
elif (a*a*b)==x:
    ans = 0.0
else :
    x = (a*a*b) - x
    t = x*2/a/a
    ans = 90-math.degrees(math.atan(a/t))
print(ans)
Buggy python submission (verdict: Runtime Error):
s=input()
t=''
a=1
for i in len(s)-1:
  if s[i]!=s[i+1]:
    a+=1
print(a)

Fixed submission:
_=input()
s=input()
t=''
a=1
for i in range(len(s)-1):
  if s[i]!=s[i+1]:
    a+=1
print(a)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = [int(i) for i in input().split()]
ans = sum(a)
b = [0 for i in range(18)]
for j in range(18):
    for i in range(len(a)):
        if a[i]%2==1 : b[j]+=1
        a[i]//=2
c = 18
if k==0 : c = -1
else :
    while 2**(c)>k : c-=1
print(b)
while c>=0:
    if 2**(c)>k :
        c-=1
        continue;
    if b[c] < n-b[c]:
        k-=2**c
        ans -=b[c]*2**c
        ans += (n-b[c])*2**c
    c-=1
print(ans)


Fixed submission:
n,k = map(int,input().split())
a = [int(i) for i in input().split()]
ans = sum(a)
b = [0 for i in range(41)]
for j in range(41):
    for i in range(len(a)):
        if a[i]%2==1 : b[j]+=1
        a[i]//=2
c = 40
if k==0 : c = -1
while c>=0:
    if 2**(c)>k :
        c-=1
        continue;
    if b[c] < n-b[c]:
        k-=2**c
        ans -=b[c]*2**c
        ans += (n-b[c])*2**c
    c-=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
h = [int(i) for i in input().split()]
dp = [1000000000 for i in range(n)]
dp[0] = 0
for i in range(n):
    for j in range(1,k+1):
        if i-j < 0 : break
        dp[i] = min(dp[i],dp[i-j]+abs(h[i-j]-h[i]))
print(dp[n-1])


Fixed submission:
n,k = map(int,input().split())
h = [int(i) for i in input().split()]
dp = [1000000000 for i in range(n)]
dp[0] = 0
for i in range(n):
    for j in range(1,k+1):
        if i-j < 0 : break
        dp[i] = min(dp[i],dp[i-j]+abs(h[i-j]-h[i]))
print(dp[n-1])
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if(a<=8 and b<=8):
    print("Yay!")
else:
    print(":(")


Fixed submission:
a,b = map(int,input().split())
if(a<=8 and b<=8):
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = map(int,input().split())
l.sort(reverse=True)
print(sum(l[0:k]))

Fixed submission:
n,k = map(int,input().split())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
print(sum(l[0:k]))

Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
l = map(int,input().split())
l = l.sort(reverse=True)
print(sum(l[0:k]))

Fixed submission:
n,k = map(int,input().split())
l = [int(i) for i in input().split()]
l.sort(reverse=True)
print(sum(l[0:k]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(4800//400)]
for i in a:
    b[i//400] += 1;
t = 0
ans = 0
for i in range(4800//400):
    if b[i] > 0:
        if i < 3200//400:
            ans+=1
        else:
            t+=b[i]
if ans > 0:
    print(ans,t+ans)
else:
    print(1,t)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(4800//400 + 1)]
for i in a:
    b[i//400] += 1;
t = 0
ans = 0
for i in range(4800//400 + 1):
    if b[i] > 0:
        if i < 3200//400:
            ans+=1
        else:
            t+=b[i]
if ans > 0:
    print(ans,t+ans)
else:
    print(1,t)
Buggy python submission (verdict: Runtime Error):
n = str(input())
sum = 0
for i in range(0, len(str(input()))): sum += int(n[i])
if int(n) % sum == 0: print("Yes")
else: print("No")

Fixed submission:
n = str(input())
sum = 0
for i in range(0, len(n)):
  sum += int(n[i])
n = int(n)
if n % sum == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = str(readline().rstrip().decode('utf-8'))
    r = s.count("R")
    g = s.count("G")
    b = s.count("B")
    cnt = r *      if s[i] != s[j] and s[j] != s[k] and s[i] != s[k]:
                    cnt -= 1
    print(cnt)


if __name__ == '__main__':
    solve()


Fixed submission:
import sys
import collections
import copy


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    s = str(readline().rstrip().decode('utf-8'))
    c = collections.Counter(list(s))
    left = collections.defaultdict(int)
    cnt = 0
    for i in range(n - 2):
        left[s[i]] += 1
        mid = copy.deepcopy(left)
        for j in range(i + 1, n - 1):
            mid[s[j]] += 1
            if s[i] != s[j]:
                if [s[i], s[j]].count("R") == 0:
                    cnt += c["R"] - mid["R"]
                    if j + j - i < n:
                        if s[j+j-i] == "R":
                            cnt -= 1
                elif [s[i], s[j]].count("G") == 0:
                    cnt += c["G"] - mid["G"]
                    if j + j - i < n:
                        if s[j+j-i] == "G":
                            cnt -= 1
                elif [s[i], s[j]].count("B") == 0:
                    cnt += c["B"] - mid["B"]
                    if j + j - i < n:
                        if s[j+j-i] == "B":
                            cnt -= 1
    print(cnt)


if __name__ == '__main__':
    solve()
Buggy python submission (verdict: Runtime Error):
import sys


def alg_combination_mod(n, r, mod):
    r = min(n - r, r)
    if r == 0:
        return 1
    else:
        denominator = 1
        for i in range(n, n - r, -1):
            denominator = (denominator * i) % mod
        molecule = 1
        for i in range(1, r + 1):
            molecule = (molecule * i) % mod
        return denominator * pow(molecule, mod - 2, mod) % mod


def solve():
    input = sys.stdin.readline
    mod = 10 ** 
if __name__ == '__main__':
    solve()


Fixed submission:
import sys


def alg_combination_mod(n, r, mod):
    r = min(n - r, r)
    if r == 0:
        return 1
    else:
        denominator = 1
        for i in range(n, n - r, -1):
            denominator = (denominator * i) % mod
        molecule = 1
        for i in range(1, r + 1):
            molecule = (molecule * i) % mod
        return denominator * pow(molecule, mod - 2, mod) % mod


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, a, b = list(map(int, input().rstrip('\n').split()))
    all_cnt = pow(2, n, mod) + mod
    a_cnt = alg_combination_mod(n, a, mod)
    b_cnt = alg_combination_mod(n, b, mod)
    print((all_cnt - a_cnt - b_cnt - 1) % mod)


if __name__ == '__main__':
    solve()