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

Fixed submission:
import bisect
N =int(input())
lisA =list(map(int,input().split()))
lisB = list(map(int,input().split()))
lisC = list(map(int,input().split()))

lisA.sort()
lisB.sort()
lisC.sort()
cnt = 0

for b in lisB:
    cnt += bisect.bisect_left(lisA,b)*(N-bisect.bisect_right(lisC,b))

print(cnt)

Buggy submission (verdict: Runtime Error):
N =int(input())
lisA =list(map(int,input().split()))
lisB = list(map(int,input().split()))
lisC = list(map(int,input().split()))

lisA.sort()
lisB.sort()
lisC.sort()
cnt = 0

for b in lisB:
    cnt+= bisect.bisect_left(lisA,b)*(N-bisect.bisect_right(lisC,b))

print(cnt)

Buggy submission (verdict: Runtime Error):
N =int(input())
lisA =list(map(int,input().split()))
lisB = list(map(int,input().split()))
lisC = list(map(int,input().split()))

lisA.sort()
lisB.sort()
lisC.sort()
cnt = 0

for b in lisB:
    cnt+= bisect.bisect_left(lisA,b)*(N-bisect.bisect_right(lisC,b))

print(cnt)

Buggy submission (verdict: Runtime Error):
N =int(input())
lisA =sorted(list(map(int,input().split())))
lisB = sorted(list(map(int,input().split())))
lisC = sorted(list(map(int,input().split())))



print(sum(bisect.bisect_left(lisA,b)*(N-bisect.bisect_right(lisC,b))for b in  lisB))

Buggy submission (verdict: Runtime Error):
N =int(input())
lisA =sorted(list(map(int,input().split())))
lisB = sorted(list(map(int,input().split())))
lisC = sorted(list(map(int,input().split())))



print(sum(bisect.bisect_left(lisA,b)*(N-bisect.bisect_right(lisC,b))for b in  lisB))

Buggy submission (verdict: Runtime Error):
N =int(input())
lisA = list(map(int,input().split()))
lisB = list(map(int,input().split()))
lisC = list(map(int,input().split()))



print(sum(bisect.bisect_left(lisA,b)*(N-bisect.bisect_right(lisC,b))for b in  lisB))
Problem p03644 (python)

Fixed submission:
n = input()
for i in range(7):
    if 2**i <= int(n) and 2**(i+1) > int(n):
        print(2**i)

Buggy submission (verdict: Runtime Error):
n = input()
for i in range(6):
  if 2**i <= n and 2**(i+1) > n:
    print(2**i)
Problem p02573 (python)

Fixed submission:
#!/usr/bin/env python

import queue

def dfs(node, edge, vis):
    vis[node] = True
    count = 1
    vq = []
    vq.append(node)
    vq = queue.LifoQueue()
    vq.put(node)
    while not vq.empty():
        fnode = vq.get()
        for b in edge[fnode]:
            if not vis[b]:
                count += 1
                vq.put(b)
                vis[b] = True
    return count

n, m = [int(i) for i in input().split(' ')]

edge = [[] for i in range(n)]

for _ in range(m):
    a, b = [int(i) for i in input().split(' ')]
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

vis = [False]*n

count = 0

for i in range(n):
    if not vis[i]:
        count = max(count, dfs(i, edge, vis))

print(count)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python

def dfs(node, edge, vis):
    if vis[node]:
        return 0
    vis[node] = True
    count = 1
    for b in edge[node]:
        if not vis[b]:
            count += dfs(b, edge, vis)
    return count

n, m = [int(i) for i in input().split(' ')]

edge = [[] for i in range(n)]

for _ in range(m):
    a, b = [int(i) for i in input().split(' ')]
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

vis = [False]*n

count = 0

for i in range(n):
    if not vis[i]:
        count = max(count, dfs(i, edge, vis))

print(count)
Problem p02621 (python)

Fixed submission:
a = int(input())

print( a*(1+a*(1+a)) )

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

print(a*(1+a(1+a)))
Problem p02717 (python)

Fixed submission:
i = list(map(int, input().split())) 
X = i[0]
Y = i[1]
Z = i[2]

print(Z, X, Y)

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

K = int(input()) 
a = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])

for i in range(K-1):
    j = a.popleft()
    if j%10 != 0:
        a.append((10*j) + ((j%10) -1))
        
    a.append((10*j)+j%10)
    
    if j%10 != 9:
        a.append((10*j) +((j%10)+1))
    
a.popleft()

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

K = int(input()) 
a = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])

for i in range(K):
    j = a.popleft()
    print(j)
    if j%10 != 0:
        a.append((10*j) + ((j%10) -1))
        
    a.append((10*j)+j%10)
    
    if j%10 != 9:
        a.append((10*j) +((j%10)+1))
Problem p02720 (python)

Fixed submission:
from collections import deque

K = int(input()) 
a = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])

for i in range(K-1):
    j = a.popleft()
    if j%10 != 0:
        a.append((10*j) + ((j%10) -1))
        
    a.append((10*j)+j%10)
    
    if j%10 != 9:
        a.append((10*j) +((j%10)+1))
    
print(a.popleft())

Buggy submission (verdict: Runtime Error):
K = input()
from collections import deque

a = deque()

for i in range(1,10):
    a.append(i)
    
for i in range(K):
    j = a.popleft()
    if j%10 != 0:
        a.append((10*j) + ((j%10) -1))
        
    a.append((10*j)+j%10)
    
    if j%10 != 9:
        a.append((10*j) +((j%10)+1))
        
a.popleft()
Problem p02732 (python)

Fixed submission:
import collections

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

c = collections.Counter(A)
keys = c.keys()
comb = 0
for i in keys:
    comb += (c[i] * (c[i]-1)) //2

for i in A:
    ans = comb - (c[i]-1)
    print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
import collections
from scipy.special import comb

N = int(input())
A = list(map(int, input().split()))
d2 = deque()
d = deque(A)
ans = 0

for i in range(N):
    d2.append(d.popleft())
    if i > 0:
        d.append(d2.popleft())
    c = collections.Counter(d)
    for i in c.keys():
        if c[i] >= 2:
            ans += comb(c[i], 2)
    print(int(ans))
    ans =0
Problem p02761 (python)

Fixed submission:
n = []

N, M = list(map(int, input().split()))
for i in range(N):
    n.append('W')

for i in range(M):
    s, c = list(map(int, input().split()))
    s -= 1
    if n[s] == "W":
        n[s] = c
    elif n[s] == c:
        pass
    else:
        print(-1)
        exit()
        
if N != 1:
    if n[0] == 0:
        print(-1)
        exit()
    
    if n[0] == "W":
        n[0] = 1
        
    for i in range(N):
        if n[i] =="W":
            n[i] = 0

else:
    if n[0] == "W":
        n[0] = 0
        
print(''.join(map(str,n)))

Buggy submission (verdict: Runtime Error):
n = []
j = True

N, M = list(map(int, input().split()))
for i in range(N):
    n.append('W')

for i in range(M):
    s, c = list(map(int, input().split()))
    if n[s-1] == "W":
        n[s-1] = c
    elif n[s-1] >= c:
        n[s-1] = c
    elif  n[s-1] <= c:
        pass
    else:
        print(-1)
        j = False
        
if j == True:
    for i in range(3):
        if n[i] =="W":
            n[i] = 0
    if n[0] == 0:
        print(-1)
    else:
        print(''.join(map(str,n)))

Buggy submission (verdict: Runtime Error):
n = []
j = True

N, M = list(map(int, input().split()))
for i in range(N):
    n.append('W')

for i in range(M):
    s, c = list(map(int, input().split()))
    if n[s-1] == "W":
        n[s-1] = c
    elif n[s-1] == c:
        pass
    else:
        print(-1)
        j = False
        
if j == True:
    for i in range(3):
        if n[i] =="W":
            n[i] = 0
    if n[0] == 0:
        print(-1)
    else:
        print(''.join(map(str,n)))

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
N = a[0]
M = a[1]

Array = [list(map(int, input().split())) for _ in range(M)]

i = 0
hya = 0
jyu = 0
ich = 0
while i < 3:
    if Array[i][0] == 1:
        hya = Array[i][1]
    elif Array[i][0] == 2:
        jyu = Array[i][1]
    elif Array[i][0] == 3:
        ich = Array[i][1]
    i += 1

for i in range(M):
    for j in range(i+1, M):
        if Array[i][0] == Array[j][0]:
            if Array[i][1] != Array[j][1]:
                print(-1)
            else:
                print(hya, jyu, ich, sep="")
Problem p02772 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
 
j = True
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] %3 == 0 or A[i] % 5 ==0:
            pass
        else:
            j = False
            
if j == True:
    print("APPROVED")
else:
    print("DENIED")

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

j = True
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] %3 == 0 or A[i] % 5 ==0:
            pass
        else:
            j = False
            exit()
            
if j == Ture:
    print("APPROVED")
else:
    print("DENIED")
Problem p02802 (python)

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

WA_count = 0
AC_count = 0
Penal = 0
d = {}
d_W = {}

for i in range(1, M+1):
    p, S = list(map(str, input().split()))
    if S == "WA":
        if p not in d_W.keys():
            d_W[p] = 1
        else:
            d_W[p] += 1
    else:
        if p not in d_W.keys():
            d[p] = 0
        elif p not in d.keys():
            d[p] = d_W[p]

    # if S == "WA":
    #     WA_count += 1
    # else:
    #     if p not in d.keys():
    #         d[p] = WA_count
    #         WA_count = 0
    #     else:
    #         WA_count = 0
        # cor.append(p)
        # if AC_count != set(cor):
        #     AC_count = set(cor)
        #     Penal += WA_count
        #     WA_count = 0
        # else:
        #     WA_count = 0

print(len(d), sum(d.values()))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

WA_count = 0
AC_count = 0
Penal = 0
d = {}
d_W = {}

for i in range(1, M+1):
    p, S = list(map(str, input().split()))
    if S == "WA":
        if p not in d_W.keys():
            d_W[p] = 1
        else:
            d_W[p] += 1
    else:
        if p not in d.keys():
            d[p] = d_W[p]

    # if S == "WA":
    #     WA_count += 1
    # else:
    #     if p not in d.keys():
    #         d[p] = WA_count
    #         WA_count = 0
    #     else:
    #         WA_count = 0
        # cor.append(p)
        # if AC_count != set(cor):
        #     AC_count = set(cor)
        #     Penal += WA_count
        #     WA_count = 0
        # else:
        #     WA_count = 0

print(len(d), sum(d.values()))
Problem p02812 (python)

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

count = 0

for i in range(1, N-1):
    if S[i-1] == 'A' and S[i] =='B' and S[i+1] == 'C':
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = str(input())

count = 0

for i in range(1, N):
    if S[i-1] == 'A' and S[i] =='B' and S[i+1] == 'C':
        count += 1

print(count)
Problem p02817 (python)

Fixed submission:

S, T = map(str,input().split())
print(T, S, sep='')

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

S = str(input())
T = str(input())

print(T, S, sep='')
Problem p02953 (python)

Fixed submission:
from collections import deque

N = int(input())
H = deque(map(float, input().split()))

ato = H.pop()

if N == 1:
    print('Yes')
    exit()

for i in range(N-1, 0, -1):
    mae = H.pop()
    if ato - mae < -1:
        print('No')
        exit()
    elif ato - mae == -1:
        ato = mae - 1
    else:
        ato = mae

print('Yes')

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

N = int(input())
H = deque(map(float, input().split()))

prev = H.popleft()

for i in range(N-2):
    cor = H.popleft()
    if prev - cor < -1:
        print('No')
        exit()
    prev = cor

cor = H.popleft()

if cor - prev < 0:
    print('No')
    exit()
    
print('Yes')
Problem p02958 (python)

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

count = 0
for i, m in enumerate(M, 1):
    if i != m:
        count += 1

if count > 2:
    print('NO')
else:
    print('YES')

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

count = 0
for i, m enumerate(M, 1):
    if i != m:
        count += 1

if count > 2:
    print('NO')
else:
    print('YES')
Problem p02573 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n, m = map(int, input().split())
uf = UnionFind(n)
for i in range(m):
    a, b = map(int, input().split())
    uf.union(a-1, b-1)
answer = []
for i in range(n):
    answer.append(uf.size(i))
print(max(answer))

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

n, m = map(int, input().split())
friend_list = []
friend_list2 = []
for i in range(m):
  a, b = map(int, input().split())
  friend_list.append([a, b])
while friend_list:
  friend = friend_list.pop()
  if not friend_list2:
    friend_list2.append(friend)
  else:
    temp_list = friend_list2.copy()
    for i in temp_list:
      if friend[0] in i and friend[1] not in i:
        i.append(friend[1])
        break
      elif friend[1] in i and friend[0] not in i:
        i.append(friend[0])
        break
      elif friend[0] in i and friend[1] in i:
        break
      else:
        friend_list2.append(friend)

print(max(map(len, friend_list2)))

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

n, m = map(int, input().split())
friend_list = []
friend_list2 = []
for i in range(m):
  a, b = map(int, input().split())
  friend_list.append([a, b])
while friend_list:
  friend = friend_list.pop()
  if not friend_list2:
    friend_list2.append(friend)
  else:
    temp_list = friend_list2.copy()
    for i in temp_list:
      if friend[0] in i:
        i.append(friend[1])
        break
      elif friend[1] in i:
        i.append(friend[0])
        break
      else:
        friend_list2.append(friend)
friend_list3 = []
for i in friend_list2:
  friend_list3.append(set(i))
friend_list2 = []
for i in friend_list3:
  friend_list2.append(len(i))
print(max(friend_list2))
Problem p02784 (python)

Fixed submission:
h, n = map(int, input().split())
a = list(map(int, input().split()))
 
sum = 0
for i in range(n):
  sum += a[i]
 
if h <= sum:
  print('Yes')
else:
  print('No')

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

sum = 0
for i int range(n):
  sum += a[i]

if h <= sum:
  print('YES')
else:
  print('NO')
Problem p02923 (python)

Fixed submission:
N = int(input())
H = [int(x) for x in input().split()]
 
ans = 0
current = 0
for i in range(N):
    if(i == N-1):
        if(current > ans):
            ans = current
        break
    if(H[i] >= H[i+1]):
        current += 1
    else:
        if(ans < current):
            ans = current
        current = 0
 
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
H = [int(x) for x in input().split()]
print(H)
ans = 0
for i in range(N):
    current = 0
    if(N-i < ans):
        break
    
    while(True):
        if(i==N-1):
            break
            \
        elif(H[i] >= H[i+1]):
                current += 1
                i += 1
        else:
            break

    if(current > ans):
        ans = current

print(ans)
Problem p03000 (python)

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

L = input().split()
pos = 0
ans = 1
for i in range(N):
  pos += int(L[i])
  if(pos <= X):
    ans +=1
  else:
    break
  
print(ans)

Buggy submission (verdict: Runtime Error):
N, X = map(int,input().split())

L = input().split()
pos = 0
ans = 1
for i in range(N+1):
  pos += int(L[i])
  if(pos <= X):
    ans +=1
  else:
    break
  
print(ans)

Buggy submission (verdict: Runtime Error):
N, X = map(int,input().split())

L = input().split()
pos = 0
for i in range(N+1):
  pos += int(L[i])
  if(pos > X):
    break
  
print(i+1)

Buggy submission (verdict: Runtime Error):
N, X = map(int,input().split())

L = input().split()
cnt = 0
pos = 0
for i in range(N+1):
        if(pos <= X):
                pos += int(L[i])
                cnt += 1
        else:
                break
print(cnt)
Problem p03029 (python)

Fixed submission:
A, P =map(int,input().split())
 
print(int((A*3+P)/2))

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

print(int((A*3+p)/2))
Problem p03049 (python)

Fixed submission:
N = int(input())
inside_str = 0
tail_a = 0
head_b = 0
 
doubleAB = 0
 
for i in range(N):
  str = input()
  inside_str = inside_str + str.count('AB')
  
  if(str[-1] == 'A' and str[0] == 'B'):
  	doubleAB = doubleAB + 1
  elif (str[-1] == 'A'):
    tail_a = tail_a + 1
  elif (str[0] == 'B'):
    head_b = head_b + 1
 
if(tail_a == 0 and head_b == 0):
  if(doubleAB == 0):
    total_cand = inside_str
  else:
    total_cand = inside_str + doubleAB - 1
else:
  total_cand = inside_str + doubleAB + min(tail_a, head_b)

print(total_cand)

Buggy submission (verdict: Runtime Error):
N = int(input())
inside_str = 0
tail_a = 0
head_b = 0
 
doubleAB = 0
 
for i in range(N):
  str = input()
  inside_str = inside_str + str.count('AB')
  
  if(str[-1] == 'A' and str[0] == 'B'):
  	doubleAB = doubleAB + 1
  elif (str[-1] == 'A'):
    tail_a = tail_a + 1
  elif (str[0] == 'B'):
    head_b = head_b + 1
 
if(tail == 0 and head_b == 0):
  total_cand = inside_str + doubleAB - 1
else:
  total_cand = inside_str + doubleAB + min(tail_a, head_b)

Buggy submission (verdict: Runtime Error):
N = int(input())
inside_str = 0
tail_a = 0
head_b = 0
except_Dcount = 0

for i in range(N):
  str = input()
  ab_inside_str = str.count('AB')

  inside_str = inside_str + ab_inside_str
  if (str[-1] == 'A'):
    tail_a = tail_a + 1
  if (str[0] == 'B'):
    head_b = head_b + 1
  if(str[-1] == 'A' && str[0] == 'B'):
    except_Dcount = except_Dcount + 1

total_cand = inside_str + min(tail_a, head_b) - except_Dcount
print(total_cand)
Problem p03997 (python)

Fixed submission:
a = int(input())
b = int(input())
h = int(input())
s = (a+b)*h/2
print(int(s))

Buggy submission (verdict: Runtime Error):
(a,b,c) = (int(input()),int(input()),int(input()))
s = (a+b)*h/2
print(s)
Problem p03597 (python)

Fixed submission:
N=int(input())
A=int(input())
print(N**2-A)

Buggy submission (verdict: Runtime Error):
N=input[]
A=input[]
print(N**2-A)
Problem p02995 (python)

Fixed submission:
import fractions

a, b, c, d = map(int, input().split())
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


a_c = (a-1)//c
b_c = b//c
a_d = (a-1)//d
b_d = b//d
a_cd = (a-1)//lcm(c, d)
b_cd = b//lcm(c, d)

ans = (b - a + 1) - (b_c - a_c) - (b_d - a_d) + (b_cd - a_cd)

print(ans)

Buggy submission (verdict: Runtime Error):
import math

a, b, c, d = map(int, input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)


a_c = (a-1)//c
b_c = b//c
a_d = (a-1)//d
b_d = b//d
a_cd = (a-1)//lcm(c, d)
b_cd = b//lcm(c, d)

ans = (b - a + 1) - (b_c - a_c) - (b_d - a_d) + (b_cd - a_cd)

print(ans)
Problem p03014 (python)

Fixed submission:
h, w = map(int, input().split())

sq = [input() for _ in range(h)]
up = [[0] * (w + 2) for _ in range(h + 2)]
down = [[0] * (w + 2) for _ in range(h + 2)]
left = [[0] * (w + 2) for _ in range(h + 2)]
right = [[0] * (w + 2) for _ in range(h + 2)]

ans = 0

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if sq[i - 1][j - 1] == '#':
            left[i][j] = 0
            up[i][j] = 0
        else:
            left[i][j] = left[i][j - 1] + 1
            up[i][j] = up[i - 1][j] + 1
for _i in range(h, 0, -1):
    for _j in range(w, 0, -1):
        if sq[_i - 1][_j - 1] == '#':
            right[_i][_j] = 0
            down[_i][_j] = 0
        else:
            right[_i][_j] = right[_i][_j + 1] + 1
            down[_i][_j] = down[_i + 1][_j] + 1

            temp = up[_i][_j] + down[_i][_j] + left[_i][_j] + right[_i][_j] 
            if temp > ans:
                ans = temp

print(ans - 3)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())

sq = [input() for _ in range(h)]
up = [[0] * (w + 2) for _ in range(h + 2)]
down = [[0] * (w + 2) for _ in range(h + 2)]
left = [[0] * (w + 2) for _ in range(h + 2)]
right = [[0] * (w + 2) for _ in range(h + 2)]

ans = 0

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if sq[i][j] == '#':
            left[i][j] = 0
            up[i][j] = 0
        else:
            left[i][j] = left[i][j - 1] + 1
            up[i][j] = up[i - 1][j] + 1
for _i in range(h - 1, 0, -1):
    for _j in range(w - 1, 0, -1):
        if sq[_i][_j] == '#':
            right[_i][_j] = 0
            down[_i][_j] = 0
        else:
            right[_i][_j] = right[_i][_j + 1] + 1
            down[_i][_j] = down[_i + 1][_j] + 1

            temp = up[_i][_j] + down[_i][_j] + left[_i][_j] + right[_i][_j] 
            if temp > ans:
                ans = temp

print(ans - 3)
Problem p03043 (python)

Fixed submission:
import math
n, k = map(int, input().split())

m = math.ceil(math.log2(k) - math.log2(1))

ans = 0
ans_ = 0
for i in range(1, n+1):
    if i >= k:
        ans_ += 1
    else:
        x = math.ceil(math.log2(k) - math.log2(i))
        ans += 2 ** (m - x)

a = (ans/(2**m)+ans_)/n
print(a)

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

m = math.ceil(math.log2(k) - math.log2(1))

ans = 0
ans_ = 0
for i in range(1, n+1):
    if i >= k:
        ans_ += 1
    else:
        x = math.ceil(math.log2(k) - math.log2(i))
        ans += 2 ** (m - x)

a = (ans/(2**m)+ans_)/n
print(a)

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

m = math.ceil(math.log2(k) - math.log2(1))

ans = 0
ans_ = 0
for i in range(1, n+1):
    if i >= k:
        ans_ += 1
    else:
        x = math.ceil(math.log2(k) - math.log2(i))
        ans += 2 ** (m - x)

a = (ans/(2**m)+ans_)/n
print(a)
Problem p03086 (python)

Fixed submission:
s = input()

count = 0
ans = [0]
for i in range(len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        count += 1
        if i == (len(s)-1):
            ans.append(count)
        
    else:
        ans.append(count)
        count = 0
print(max(ans))

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

count = 0
ans = []
for i in range(len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        count += 1
    else:
        ans.append(count)
        count = 0
print(max(ans))
Problem p03102 (python)

Fixed submission:
import numpy as np

n, m, c = map(int, input().split())
b = np.array(list(map(int, input().split())))


ans = 0
for i in range(n):
    a = np.array(list(map(int, input().split())))
    if np.dot(a, b) + c > 0:
        ans += 1
    
print(ans)

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

n, m, c = map(int, input().split())
b = np.array(list(map(int, input().split())))


ans = 0
for i in range(n):
    a = np.array(list(map(int, input().split())))
    if np.dot(a, b) + c > 0:
        ans += 1
    
print(ans)