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

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

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

res=float('inf')

for i in range(2**n):
  sc=0
  a=[0]*m
  for j in range(n):
    if ((i >> j) & 1) :
      sc+=ca[j][0]
      for k in range(m):
        a[k]+=ca[j][k+1]
  if min(a)>=x:
    res=min(sc,res)

if res == float('inf'):
    print(-1)
else:
    print(res)

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

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

res=float('inf')

for i in range(2**n):
  sc=0
  a=[0]*m
  for j in range(n):
    if ((i >> j) & 1) :
      sc=+ca[j][0]
      a+=ca[j][1:]
  if min(a)>=x:
    res=min (sc,res)

if res == INF:
    print(-1)
else:
    print(res)
Problem p02713 (python)

Fixed submission:
from math import gcd

K = int(input())
#K = 200
sum = 0

for a in range (1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      sum += gcd(gcd(a, b), c)

print(sum)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
  return reduce(math.gcd, numbers)

K = input('')
la = lb = lc = list(range(1, K+1))
sum = 0

for a in range (len(la)):
  for b in range(len(lb)):
    for c in range(len(lc)):
      sum += gcd(la[a],lb[b],lc[c])

print(sum)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
  return reduce(math.gcd, numbers)

def sumgcd(K):
for a in range (len(la)):
  for b in range(len(lb)):
    for c in range(len(lc)):
      sum += gcd(la[a],lb[b],lc[c])
Problem p02719 (python)

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

print(min(n%k,abs(k-n%k)))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
x=abs(n-k)

if x>k:
    print(x%k)
else:
    print(k%x)
Problem p02772 (python)

Fixed submission:
N=int(input())
A=input().split()
x=0
for i in range(N):
  if int(A[i])%2==0:
    if int(A[i])%5==0 or int(A[i])%3==0:
      x+=1
  else:
    x+=1
if x==N:
  print('APPROVED')
else:
  print('DENIED')

Buggy submission (verdict: Runtime Error):
n=input()
N=int(n)
A=input().split()
for i in range(N):
  if int(A[i])%2==0:
    if int(A[i])%5==0 or int(A[i])%3==0:
      x+=1
  else:
    x+=1
if x==N:
  print('APPROVED')
else:
  print('DENIED')

Buggy submission (verdict: Runtime Error):
N=int(input())
A=input().split()
for i in range(N):
  if int(A[i])%2==0:
    if int(A[i])%5==0 or int(A[i])%3==0:
      x+=1
  else:
    x+=1
if x==N:
  print('APPROVED')
else:
  print('DENIED')

Buggy submission (verdict: Runtime Error):
N=int(input())
A=input().split
for i in range(N):
  if int(A[i])%2==0:
    if int(A[i])%5==0 or int(A[i])%3==0:
      x+=1
  else:
    x+=1
if x==N:
  print('APPROVED')
else:
  print('DENIED')
Problem p02602 (python)

Fixed submission:
from sys import stdin


def readline_from_stdin() -> str:
    return stdin.readline().rstrip


if __name__ == '__main__':
    N, K, = input().split()
    A = [int(i) for i in input().split()]
    N, K = int(N), int(K)

    for i in range(N-K):
        if A[i] < A[K+i]:
            print("Yes")
        else:
            print("No")

Buggy submission (verdict: Runtime Error):
from sys import stdin


def readline_from_stdin() -> str:
    return stdin.readline().rstrip


if __name__ == '__main__':
    N, K, = input().split()
    A = [int(i) for i in input().split()]
    N, K = int(N), int(K)

    score = 1
    for i in range(K):
        score *= A[i]

    # scores = [score]
    # for i in range(N-K):
    #     print(i, N-K+i-1)
    #     score = int(score / A[i] * A[N-K+i-1])
    #     scores.append(score)
    #
    # print(scores)
    #
    # results = [False for i in range(len(scores)-1)]
    #
    # for i in range(len(scores)-1):
    #     results[i] = scores[i+1] > scores[i]
    #
    # [print("Yes") if r else print("no") for r in results]

    for i in range(N-K):
        # print(i, N-K+i-1)
        new_score = score / A[i] * A[N-K+i-1]
        if new_score > score:
            print("Yes")
        else:
            print("No")
        score = new_score
Problem p02700 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
print("Yes" if (a + d - 1) // d >= (c + b - 1) // b else "No")

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
a //= d
c //= a
print("Yes" if a >= c else "No")
Problem p02900 (python)

Fixed submission:
import math


def main():
    inputs = input().split()
    inputs = [int(i) for i in inputs]

    a = inputs[0]
    b = inputs[1]

    g = n = gcd(a, b)
    d = {}

    for i in range(2, int(math.sqrt(n)) + 1):
        if n % i:
            continue
        d[i] = i
        while n % i == 0:
            n /= i

    if n != 1:
        d[n] = n

    print(len(d) + 1)


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    inputs = input().split()
    inputs = [int(i) for i in inputs]

    a = inputs[0]
    b = inputs[1]

    NN = 10 ** 12
    max_n = max([a, b])
    f_list = [True] * max_n

    kouyaku = []

    for n in range(1, int(max_n / 2) + 1):
        if f_list[n]:
            if a % n == 0 and b % n == 0:
                kouyaku.append(n)
            else:
                for i in range(int(max_n / n)):
                    f_list[i] = False

    so = [1]
    for i in kouyaku:
        if i == 1: continue

        f = True
        for j in kouyaku:
            if j == 1 or i < j: continue
            if i != j and i % j == 0:
                f = False
                break
        if f is True:
            so.append(i)

    print(len(so))

if __name__ == "__main__":
    main()
Problem p03288 (python)

Fixed submission:
R = int(input())

if R < 1200:
    print('ABC')
elif R < 2800:
    print('ARC')
else:
    print('AGC')

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

if R < 1200:
    print('ABC')
elif R < 2800:
    print('ARC')
else
    print('AGC')
Problem p03316 (python)

Fixed submission:
N = input()
S = 0

for i in N:
    S += int(i)

if int(N) % S == 0:
    print('Yes')
else:
    print('No')

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

if N == K:
    print(1)
elif N / K == 1:
    print(2)
else:
    print(int(N / (K-1)))
Problem p02658 (python)

Fixed submission:
def main ():
  N = int(input())
  A = list(map(int,input().split()))
  prod = 1 
  A.sort()
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      return
  
  print(prod) 
 
main()

Buggy submission (verdict: Runtime Error):
def main ():
  N = int(input())
  A = list(map(int,input().split()))
  prod = 1 
  
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
    print(-1)
    return
  
  print(prod) 
 
main()

Buggy submission (verdict: Runtime Error):
def main ():
  N = int(input())
  A = list(map(int,input().split()))
  prod = 1 
  
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
    print(-1)
  
  print(prod) 
 
main()

Buggy submission (verdict: Runtime Error):
def main ():
  N = int(input())
  A = list(map(int,input().split()))
  prod = 1 
  
  for a in A:
    prod *= a
    if a
    
  if prod > 1000000000000000000:
    print(-1)
    return
  
  else:
    print(prod) 

main()

Buggy submission (verdict: Runtime Error):
def main ():
N = int(input())
A = list(map(int,input().split()))
if 0 in A: print (0)
return
prod = 1 for a in A:
prod *= a
if prod > 1000000000000000000:
print(-1) return
print(prod) main ()

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

prod = 1 
for a in A:
  prod *= a
  if prod > 1000000000000000000:
    print(-1)
  else:
    print(prod) 

main ()
Problem p02705 (python)

Fixed submission:
R = int(input())

print(2*3.141592*R)

Buggy submission (verdict: Runtime Error):
import math

R = int(input())

print(2 * math.pai * R)

Buggy submission (verdict: Runtime Error):
import math

R = int(input())

print(2 * math.pa * R)
Problem p03001 (python)

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

s = (w*h/2)

if (w/2 == x and h/2 == y):
  print(s,1)
else:
  print(s,0)

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

s = (w*h/2)

if (w/2 == x and h/2 != y)
or (w/2 != x and h/2 == y) \
or (w == x and 0 == y) \
or (0 == x and h == y) \
or (w == x and h == y) \
or (0 == x and 0 == y)):
  print(s,0)
else:
  print(s,1)
Problem p03005 (python)

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

a=0

if k != 1:
  a=n-k
 
print(a)

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

a=n-k

print(a)
Problem p02658 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = 1

if 0 in a:
    s = 0
else:
    for i in range(n):
        s = s * a[i]
        if s > 10 ** 18:
            s = -1
            break
print(s)

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

if '0' in a:
    s = 0
else:
    for i in range(n):
        s = s * a[i]
    if s > 10 ** 18:
        s = -1
        break
print(s)
Problem p02612 (python)

Fixed submission:
a = int(input(""))
if 1000 >= a:
    print(1000 - a)
elif 2000 >= a > 1000:
    print(2000 - a)
elif 3000 >= a > 2000:
    print(3000 - a)
elif 4000 >= a > 3000:
    print(4000 - a)
elif 5000 >= a > 4000:
    print(5000 - a)
elif 6000 >= a > 5000:
    print(6000 - a)
elif 7000 >= a > 6000:
    print(7000 - a)
elif 8000 >= a > 7000:
    print(8000 - a)
elif 9000 >= a > 8000:
    print(9000 - a)
else:
    print(10000 - a)

Buggy submission (verdict: Runtime Error):
N = int(input)
a = 1000 - N
print(a)
Problem p02613 (python)

Fixed submission:
N = int(input())
s = [input() for i in range(N)]
for v in ['AC', 'WA', 'TLE', 'RE']:
 print('{0} x {1}'.format(v, s.count(v)))

Buggy submission (verdict: Runtime Error):
1 N = int(input())
2 s = [input() for i in range(N)]
3 for v in ['AC', 'WA', 'TLE', 'RE']:
4 print('{0} x {1}'.format(v, s.count(v)))
Problem p02639 (python)

Fixed submission:
x = list(map(int, input().split()))
print(x.index(0)+1)

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    
    A.sort()
    A_set = set(A)
    count = 0
    last_num = 0
    flag = True
    now_num = 0
    half_num = 0
    count_flag = False
    
    if A.count(1) == 1:
        print(1)
        exit()
    for i in range(N):
        count_flag = True
        now_num = A[i]
        half_num = A[i]/2
        if now_num == last_num:
            if flag:
                count -= 1
                flag = False
        else:
            for j in range(0, i):
                if A[j] > half_num:
                    break
                if now_num % A[j] == 0:
                    count_flag = False
                    break
            if count_flag:
                if not flag:
                    flag = True
                count += 1
            last_num = A[i]
    print(count)

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

Fixed submission:
N, M, X = map(int, input().split())
CA = [list(map(int, input().split())) for i in range(N)]
min_can = set()


def cal_score(bought_books):
    global CA
    global M
    global N
    global X
    algo_Q = [0]*M
    cost = 0
    for i in range(N):
        if bought_books[i] == 1:
            for j in range(1, M+1):
                algo_Q[j-1] += CA[i][j]
            cost += CA[i][0]
    flag = True
    for i in range(M):
        if algo_Q[i] < X:
            flag = False
            break
    if flag:
        global min_can
        min_can.add(cost)
    return 0


def next_book(book_list):
    global N
    global M

    if len(book_list) == N:
       return cal_score(book_list)
    book_list.append(0)
    next_book(book_list)
    book_list.pop(-1)

    book_list.append(1)
    next_book(book_list)
    book_list.pop(-1)
    return 0


book_list = []
next_book(book_list)
if set() == min_can:
    print(-1)
else:
    print(min(min_can))

Buggy submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
CA = [list(map(int, input().split())) for i in range(N)]
min_can = set()


def cal_score(bought_books):
    global CA
    global M
    global N
    global X
    algo_Q = [0]*M
    cost = 0
    for i in range(N):
        if bought_books[i] == 1:
            for j in range(1, M+1):
                algo_Q[j-1] += CA[i][j]
            cost += CA[i][0]
    flag = True
    for i in range(M):
        if algo_Q[i] < X:
            flag = False
            break
    if flag:
        global min_can
        min_can.add(cost)
    return 0


def next_book(book_list):
    global N
    global M

    if len(book_list) == N:
       return cal_score(book_list)
    book_list.append(0)
    next_book(book_list)
    book_list.pop(-1)

    book_list.append(1)
    next_book(book_list)
    book_list.pop(-1)
    return 0


book_list = []
next_book(book_list)
print(min(min_can))
Problem p02684 (python)

Fixed submission:
N, K = map(int, input().split())
A = list(map(int, input().split()))
keiro = [1]
keiro_set = {1}
flag = True
now = 1
start = 0
loopN = 0
loop_list = []
not_loop = False
for i in range(N):
    now = A[now - 1]
    if now in keiro_set:
        start = keiro.index(now)
        loop_list = keiro[start:]
        loopN = len(loop_list)
        break
    else:
        keiro.append(now)
        keiro_set.add(now)
    if i + 2 > K:
        not_loop = True
        break
if not_loop:
    print(keiro[K])
elif K - start >= 0:
    print(loop_list[(K - start) % loopN])
else:
    print(keiro[K])

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

keiro = [1]
flag = True
now = 1
start = 0
loopN = 0
loop_list = []
not_loop = False
while flag:
    if A[now-1] in keiro:
        flag = False
        start = keiro.index(A[now-1])
        loopN = len(keiro[start:])
        loop_list = keiro[start:]
    else:
        keiro.append(A[now-1])
        now = A[now-1]
    if len(keiro) >= K:
        flag = False
        not_loop = True

if not_loop:
    print(keiro[K])
elif K - start >= 0:
    print(loop_list[(K - start) % loopN])
else:
    print(keiro[K])
Problem p02645 (python)

Fixed submission:
s = input()
print(s[:3])

Buggy submission (verdict: Runtime Error):
s = input()
print(s[3])
Problem p02784 (python)

Fixed submission:
h, n = input().split(" ")
h = int(h)
n = int(n)
a = input().split(" ")
a = [int(x) for x in a]
if sum(a) >= h:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
h, n = input().split(" ")
h = int(h)
n = int(n)
a = [int(input()) for i in range(n) ]
if sum(a) >= h:
  print('Yes')
else:
  print('No')
Problem p02789 (python)

Fixed submission:
n,m = input().split(' ')
n = int(n)
m = int(m)
if n == m:
  print('Yes')
else:
 print('No')

Buggy submission (verdict: Runtime Error):
n,m = inout().split(' ')
n = int(n)
m = int(m)
if n == m:
  print('Yes')
else:
 print('No')
Problem p02811 (python)

Fixed submission:
k,x = input().split(' ') 
k = int(k)
x = int(x)
if 500 * k >= x:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
k, x = input().split("")
k = int(k)
x = int(x)
if 500*k >= x:
  print('Yes')
else:
  print('No')
Problem p02812 (python)

Fixed submission:
n = input()
s = input()
print(s.count('ABC') )

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

b = [s + 1 for s in range(n)]
print(b)
for i in p:
  print(i)
Problem p02830 (python)

Fixed submission:
n = int(input())
s, t = input().split(' ')
l = []
m = []
r = ""
for i in s:
  l.append(i)
for i in t:
  m.append(i)
 
for i in range(n):
  r += (l[i] + m[i])
print(r)

Buggy submission (verdict: Runtime Error):
n = int(input())
s, t = input()
l = []
m = []
r = ""
for i in s:
  l.append(i)
for i in t:
  m.append(i)

for i in range(n):
  r += (l[i] + m[i])
print(r)
Problem p02841 (python)

Fixed submission:
m1, d1 = input().split()
m1, d2 = input().split()
d2 = int(d2)
result = 0

if d2 == 1:
  result = 1
print(result)

Buggy submission (verdict: Runtime Error):
m1, d1 = input().split()
m1, d2 = input().split()
d2 = int(d2)
result = 0

if d2 == 1
  result = 1
print(result)
Problem p02843 (python)

Fixed submission:
n  = int(input())
x = n // 100
result = 0
if n % 100 <= 5 * x and x <= 1000000:
  result = 1
print(result)

Buggy submission (verdict: Runtime Error):
n  = int(input())
x = n // 100
result = 0
if n % 100 < 5 * x && x < 1000000:
  result = 1
print(result)
Problem p02853 (python)

Fixed submission:
x,y = input().split()
x = int(x)
y = int(y)

sum = 0
if x ==1 and y ==1:
  sum += 400000
 
if x == 1:
  sum += 300000
elif x == 2 :
  sum += 200000
elif x == 3:
  sum += 100000
  
if y == 1:
  sum += 300000
elif y == 2 :
  sum += 200000
elif y == 3:
  sum += 100000
 
print(sum)

Buggy submission (verdict: Runtime Error):
x = int(input())
y + int(input())
sum = 0
if x ==1 and y ==1:
  sum += 400000

if x == 1:
  sum += 300000
elif x == 2 :
  sum += 200000
elif x == 3:
  sum += 100000
  
if y == 1:
  sum += 300000
elif y == 2 :
  sum += 200000
elif y == 3:
  sum += 100000

print(sum)
Problem p02865 (python)

Fixed submission:
a=int(input())

print(int((a-1)/2))

Buggy submission (verdict: Runtime Error):
a=input()
n = 0
print(int((a-1)/2))
Problem p02642 (python)

Fixed submission:
import numpy as np
 
n = int(input())
a = list(map(int, input().split()))
a.sort()
dp = [0 for _ in range(a[-1] + 1)]

for x in a:
    for j in range(x, a[-1] + 1, x):
        dp[j] += 1
ans = 0
for x in set(a):
    #print(x)
    if dp[x] == 1:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
counter = [0 for _ in range(n)]
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        else:
            if counter[i] > 0:
                continue
            else:
                if a[i] % a[j] == 0:
                    counter[i] += 1:
print(counter.count(0))
Problem p02678 (python)

Fixed submission:
N, M = map(int, input().split())
AB = []
cons = [[] for _ in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    cons[a - 1].append(b - 1)
    cons[b - 1].append(a - 1)
visited = [False for _ in range(N)]
visited[0] = True
Q = [0]
sirusi = [0 for _ in range(N)]
while Q:
    v = Q.pop(0)
    for i in cons[v]:
        if visited[i]: continue
        visited[i] = True
        sirusi[i] = v
        Q.append(i)
print("Yes")
for i in range(1, N):
    print(sirusi[i] + 1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
graph=[[] for i in range(n)]
sirusi=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    a-=1;b-=1
    graph[a].append(b)
    graph[b].append(a)
D=deque([0])
visited=[False]*n
visited[0]=True
while D:
    v=D.popleft()
    for i in graph[v]:
        if visited[i]:continue
        visited[i]=True
        sirusi[i]=v
        D.append(i)
print("Yes")
for i in range(1,n):
    print(sirusi[i]+1)
Problem p02841 (python)

Fixed submission:
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())

if m1 != m2:
    print("1")
else:
    print("0")

Buggy submission (verdict: Runtime Error):
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())

if m1 != m2:
    print("1")
    exit(1)

print("0")

Buggy submission (verdict: Runtime Error):
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())

if m1 != m2:
    print("1")
    exit(1)

print(0)
Problem p02658 (python)

Fixed submission:
n = int(input())
arr = list(map(int, input().split()))
total = 1
if 0 in arr:
    print(0)
else:
    for num in arr:
        if total > 10**18:
            break
        total *= num
    if total > 10**18:
        print(-1)
    else:
        print(total)

Buggy submission (verdict: Runtime Error):
n = input()
s = list(map(int, input().split()))
ans = 1
if 0 in ans:
  print(0)
else:
  for i in s:
    if ans > 10**18:
      break
    ans *= int(i)
  if ans > 10**18:
    print(-1)
  else:
    print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
s = input().split(" ")
ans = 1
for i in s:
  ans *= i
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
s = input()
s = s.split()
ans = 1
for i in range(n):
  ans *= int(i)
if ans >= 1000000000000000000:
  print(-1)
else:
 	print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
s = s.split()
ans = 1
for i in s:
  ans *= int(i)
  
 print(ans)
Problem p02609 (python)

Fixed submission:
from collections import Counter
N=int(input())
X=input()

value = int(X,2)
#print(value)
TFlist =[]
for i in range(N):
  if X[i] == '0':
  	TFlist.append(False)
  else:
    TFlist.append(True)
#print(TFlist)
p = sum(TFlist)


def count_ones_by_bin(num):
    bin_num = bin(num)[2:]
    count = 0
    for i in bin_num:
            count += int(i)
    return count
  
def popcount(n):
 # print("popcount",n)
  return (n  % count_ones_by_bin(n))

for i in range(N):
#  print("N", N)
  cnt = 0
  tmp = 0
  if p != 1 or (not TFlist[i]):
    if TFlist[i]: tmp = (value % (p-1) - (pow(2,(N-i-1), (p-1)))) % (p-1)
    else: tmp = (value % (p+1) + (pow(2,(N-i-1) , (p+1) ) ) ) % (p+1)    
    cnt += 1
  while tmp != 0:
    cnt+= 1
    tmp = popcount(tmp)
  print(cnt)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
X=input()
value = int(X,2)
#print(value)
TFlist =[]
for i in range(N):
  if X[i] == '0':
  	TFlist.append(False)
  else:
    TFlist.append(True)
#print(TFlist)
p = sum(TFlist)


def count_ones_by_bin(num):
    bin_num = bin(num)[2:]
    count = 0
    for i in bin_num:
            count += int(i)
    return count
  
def popcount(n):
 # print("popcount",n)
  return (n  % count_ones_by_bin(n))

for i in range(N):
#  print("N", N)
  cnt = 0
  if TFlist[i]: tmp = (value % (p-1) - (pow(2,(N-i-1), (p-1)))) % (p-1)
  else: tmp = (value % (p+1) + ( pow(2,(N-i-1), (p+1) ) ) ) % (p+1)
 # print(tmp)
  cnt += 1
  while tmp != 0:
    cnt+= 1
    tmp = popcount(tmp)
  print(cnt)
Problem p02718 (python)

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

if sorted(hoge)[-M] >= sum(hoge)/(4*M):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N,M-map(int,input().split())
hoge=list(ap,int,input.split())
total_vote=sum(hoge)
if sorted(hoge)[-M]>total_vote/(4*M):
  print('Yes')
else:
  print('No')
Problem p02780 (python)

Fixed submission:
N,K=map(int,input().split())
A=list(map(int,input().split()))
summation=[0,A[0]]
for i in range(1,N):
  summation.append(summation[i]+A[i])

maxvalue=summation[K]
for i in range(1,1+N-K):
  maxvalue=max(maxvalue,summation[i+K]-summation[i])
print((maxvalue+K)/2)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=map(int,input().split())
maxvalue=0
for i in range(N-K):
  maxvalue=max(maxvalue,sum(A[K:N+K]))
print(maxvalue)
Problem p02802 (python)

Fixed submission:
N,M=map(int,input().split())
A=[0]*N
B=[0]*N
pen=0
for i in range(M):
  p,S=input().split()
  if S=="AC":
    A[int(p)-1]=1
  elif S=="WA" and A[int(p)-1]==0:
    B[int(p)-1] += 1
penalty=[A[i]*B[i] for i in range(N)]
print(sum(A),sum(penalty))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=[0]*M
pen=0
for i in range(M):
  p,S=input().split()
  if S=="AC":
    A[int(p)-1]=1
  elif S=="WA" and A[int(p)-1]==0:
    pen += 1
print(sum(A),pen)