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

Fixed submission:
n=input()
p=list(map(int,input().split()))
def func(i,j):
    if i == len(p) :
        return "YES"
    elif p[i]==i+1 :
        return func(i+1,j)
    elif p[p[i]-1]==i+1 and j<2 :
        j+=1
        return func(i+1,j)
    else :
        return "NO"
print(func(0,0))

Buggy submission (verdict: Runtime Error):
n=input()
p=list(map(int,input().split()))
m=0
for i in range(n):
    print(p[p[i]-1])
    if p[i]==i+1 :
        continue
    elif p[p[i]-1]==i+1 and m<2 :
        m+=1
        continue
    else :
        print ("NO")
        exit()
print("YES")
Problem p02584 (python)

Fixed submission:
list = list(map(int, input().split())) 
hajime=list[0]
kaisuu=list[1]
hohaba=list[2]
if hajime>=0:
  ayumi=hajime//hohaba
  nokori=kaisuu-ayumi
  kouho_1=hajime-hohaba*kaisuu
  kouho_2=hajime-hohaba*ayumi
  kouho_3=hajime-hohaba*(ayumi+1)
 
  
  
  if kaisuu <= ayumi:
    print(kouho_1)
  else:
    if nokori%2==0:
      print(kouho_2)
    else:
      print(-kouho_3)
      
if hajime<0:  
  ayumi=-hajime//hohaba
  nokori=kaisuu-ayumi
  kouho_1=hajime+hohaba*kaisuu
  kouho_2=hajime+hohaba*ayumi
  kouho_3=hajime+hohaba*(ayumi+1)
  if kaisuu<=ayumi:
    
    print(-kouho_1)  
  else:
    if nokori%2==0:
      print(-kouho_2)
    else:
      print(kouho_3)

Buggy submission (verdict: Runtime Error):
list = list(map(int, input().split())) 
hajime=list[0]
kaisuu=list[1]
hohaba=list[2]
if hajime>=0:
  ayumi=hajime//hohaba
  nokori=kaisuu-ayumi
  kouho_1=hajime-hohaba*kaisuu
  kouho_2=hajime-hohaba*ayumi
  kouho_3=-hajime+hohaba*(ayumi+1)
  if kaisuu=<ayumi:
    print(kouho_1)
  else:
    if nokori%2==0:
      print(kouho_2)
    else:
      print(kouho_3)
      
if hajime<0:  
  ayumi=-hajime//hohaba
  nokori=kaisuu-ayumi
  kouho_1=hajime+hohaba*kaisuu
  kouho_2=hajime+hohaba*ayumi
  kouho_3=-hajime-hohaba*(ayumi+1)
  if kaisuu=<hohaba:
    
    print(kouho_1)  else:
    if nokori%2==0:
      print(kouho_2)
    else:
      print(-kouho_3)
Problem p02681 (python)

Fixed submission:
list = [input() for i in range(2)]

s = list[0]
t = list[1]
lens = len(s)
lent = len(t)
if t.startswith(s)==True and lent-lens==1 and 1<=lens<=10:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
list = input().split()
s = list[0]
t = list[1]
lens = len(s)
lent = len(t)
if s in t and lent-lens==1 and lens<=10:
  print("Yes")
else:
  print("No")
Problem p02705 (python)

Fixed submission:
r = int(input())
print(2*r*3.1415926535)

Buggy submission (verdict: Runtime Error):
print(R*3.1415926535)
Problem p02639 (python)

Fixed submission:
a = 1
b = 2
c = 3
d = 4
e = 5
a,b,c,d,e = map(int,input().split())

if a != 1:
    print("1")

if b != 2:
    print("2")

if c != 3:
    print("3")

if d != 4:
    print("4")

if e != 5:
    print("5")

Buggy submission (verdict: Runtime Error):
a = 1
b = 2
c = 3
d = 4
e = 5
a,b,c,d,e = map(int,input().split())
if a != 1:
print("1")

if b != 2:
print("2")

if c != 3:
print("3")

if d != 4:
print("4")

if e != 5:
print("5")

Buggy submission (verdict: Runtime Error):
a = 1
b = 2
c = 3
d = 4
e = 5
a,b,c,d,e = map(int,input().split())
if a != 1:
print(1)

if b != 2:
print(2)

if c != 3:
print(3)

if d != 4:
print(4)

if e != 5:
print(5)

Buggy submission (verdict: Runtime Error):
a = 1
b = 2
c = 3
d = 4
e = 5
a,b,c,d,e = map(int,input().split())
if a != 1
print(1)

if b != 2
print(2)

if c != 3
print(3)

if d != 4
print(4)

if e != 5
print(5)
Problem p02683 (python)

Fixed submission:
import numpy as np
n,m,x=map(int,input().split())
text=[]
cost=[]
for i in range(n):
    text.append(list(map(int,input().split())))
text=np.array(text)

#ビット全探索。bin(i)の各桁を要素に対応させる。
for i in range(2**n):
    flag=0
    bought_text=np.array([0 for j in range(m+1)])
    for j in range(n):
        #0bxxx1と0b0001の比較(＆は論理積)
        if((i>>j)&1):
            bought_text+=text[j]
    for k in range(m):
        if bought_text[k+1]<x:
            flag=1
            break
    if flag==0:
        cost.append(bought_text[0])
print(min(cost) if cost else "-1")

Buggy submission (verdict: Runtime Error):
import numpy as np
n,m,x=map(int,input().split())
text=[]
cost=[]
for i in range(n):
    text.append(list(map(int,input().split())))
text=np.array(text)

#ビット全探索。bin(i)の各桁を要素に対応させる。
for i in range(2**n):
    flag=0
    bought_text=np.array([0 for j in range(m+1)])
    for j in range(n):
        #0bxxx1と0b0001の比較(＆は論理積)
        if((i>>j)&1):
            bought_text+=text[j]
    for k in range(m):
        if bought_text[k+1]<x:
            flag=1
            break
    if flag==0:
        cost.append(bought_text[0])
print(min(cost) if cost else "-1")

Buggy submission (verdict: Runtime Error):
import itertools
n,m,x=map(int,input().split())
lists=[]
array=[0,0,0,0]
ans=[]
for i in range(n):
    lists.append(list(map(int,input().split())))
for i in range(n):
    for pair in itertools.combinations(lists,i+1):
        for j in range(len(pair)):
            array=list(map(lambda x,y: x+y,array,list(pair[j])))
        for k in range(m):
            if array[k+1]<x:
                break
            else:
                ans.append(array[0])
        array=[0,0,0,0]
print(min(ans) if ans else "-1")
Problem p02687 (python)

Fixed submission:
s=input()
if s=="ARC":
    print("ABC")
else:
    print("ARC")

Buggy submission (verdict: Runtime Error):
s=input()
if s=="ARC":
:
    print("ABC")
else:
    print("ARC")
Problem p02741 (python)

Fixed submission:
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n=int(input())
print(a[n-1])

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
n=c-a-b
if n**2 > 4*a*b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
n=c-a-b
if　n**2 > 4*a*b:
    print("Yes")
else:
    print("No")

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

Buggy submission (verdict: Runtime Error):
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n=int(input())
print(a[n+1])
Problem p03547 (python)

Fixed submission:
a,b=map(str,input().split())
l=["A","B","C","D","E","F"]
if l.index(a)<l.index(b):
    print("<")
elif l.index(a)==l.index(b):
    print("=")
else:
    print(">")

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
l=tuple("A","B","C","D","E","F")
if l.index(a)<l.index(b):
    print("<")
elif l.index(a)==l.index(b):
    print("=")
else:
    print(">")

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
l=["A","B","C","D","E","F"]
l=list(map(str,s))
if l.index(a)<l.index(b):
    print("<")
elif l.index(a)==l.index(b):
    print("=")
else:
    print(">")

Buggy submission (verdict: Runtime Error):
a,b=map(str,input())
l=["A","B","C","D","E"",F"]
if l.index(a)<l.index(b):
    print("<")
elif l.index(a)==l.index(b):
    print("=")
else:
    print(">")
Problem p02717 (python)

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

print("{} {} {}".format(c,a,b))

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


queueList = []
oldList = []
for i in range(1,10):
	queueList.append(i)
# print(queueList)
if n < len(queueList):
	print(queueList[n-1])
	exit()
while(True):
	headElement = queueList[0]
	queueList.pop(0)
	oldList.append(headElement)
	for i in range(-1,2):
		newElement = headElement % 10 + i
		if newElement < 0 or 9 < newElement:
			continue
		if not (headElement*10 + newElement in oldList or headElement*10 + newElement in queueList):
			queueList.append(headElement*10 + newElement)
	if len(oldList) == n:
		break
print(oldList[-1])
# print(queueList[0])
Problem p02718 (python)

Fixed submission:
n, m = map(int, input().split())
aList = list(map(int, input().split()))
aList.sort(reverse=True)



total = sum(aList)

if aList[m-1] >= total/(4*m):
    print("Yes")
else:
    print("No")
flag = "Yes"

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
aList = list(map(int, input().split()))
aList.sort(reverse=True)



total = sum(aList)
flag = "Yes"
for i in range(m):
    if aList[m] <= total/(4*m):
        flag = "No"
print(flag)
Problem p02696 (python)

Fixed submission:
a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))

Buggy submission (verdict: Runtime Error):
a,b,n = map(int, input().split())
x = (b-1,n)
print(int(a*x/b))

Buggy submission (verdict: Runtime Error):
,b,n=map(int, input().split())
list =[]
for x in range(n+1) :
    list.append(int(a*x/b) - a* int(x/b))
print(max(list))
Problem p02705 (python)

Fixed submission:
import math
R = int(input())
print(2*R*math.pi)

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
a =list( map(int,input().split()) )
if N-sum(a) >=0:
    print(N-sum(a))
else :
    print('-1')

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
a =list( map(int,input().split()) )
if N-sum(a) >=0:
    print(N-sum(a))
else :
    print(-1)

Buggy submission (verdict: Runtime Error):
N,M =map(int,input().split())
a =list( map(int,input().split()) )
if N-sum(a) >=0:
    print(N-sum(a))
else :
    print('-1')
Problem p02714 (python)

Fixed submission:
N = int(input())
S = list(input())
ans = S.count('R')*S.count('G')*S.count('B') 
for i in range(N): 
   if S[i]=='R':
       S[i] =1
   elif S[i]=='G':
       S[i] =2
   elif S[i]=='B':
       S[i] =4
for i in range(N): 
   for j in range(i+1,N):
     k=2*j-i
     if k>=N : 
       continue  
     if S[i]+S[j]+S[k]==7 : 
         ans-=1 
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
ans = S.count('R')*S.count('G')*S.count('B') 
for i in range(N): 
    if S[i]=='R':
       S[i] =1
    elif S[i]=='G':
       S[i] =2
    elif S[i]=='B':
       S[i] =4
    for j in range(i+1,N):
        k=2*j-i
        if k>=N : 
           continue  
        if S[i]+S[j]+S[k]==7 : 
           ans-=1 
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
ans = S.count('R')*S.count('G')*S.count('B') 
for i in range(N): 
   if S[i]=='R':
       S[i]=1
   elif S[i]=='G':
       S[i]
   elif S[i]=='B':
       S[i]=4
for i in range(N): 
   for j in range(i+1,N):
     k=2*j-i
     if k>=N : 
       continue  
     if S[i]+S[j]+S[k]==7 : 
         ans-=1   
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
ans = S.count('R')*S.count('G')*S.count('B') 
for i in range(N): 
   if S[i]=='R':
       S[i]=1
   elif S[i]=='G':
       S[i]
   elif S[i]=='B':
       S[i]=4
for i in range(N): 
   for j in range(i+1,N):
     k=2*j-i
     if k>N : 
       continue  
     if S[i]+S[j]+S[k]==7 : 
         ans-=1   
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
ans = S.count('R')*S.count('G')*S.count('B') 
 #1番目の条件を満たすものの総数は(Rの個数)*(Gの個数)*(Bの個数)
for i in range(N): #判定を簡単にするためR:=1,G:=2,B:=4と置き換える
   if S[i]=='R':
       S[i]=1
   elif S[i]=='G':
       S[i]
   elif S[i]=='B':
       S[i]=4
for i in range(N): 
 #すべての(i,j)について(i,j,2*j-i)が1番目の条件を満たし、かつ2番目の条件を満たさないかを判定する
   for j in range(i+1,N):
     k=2*j-i
     if k>N : 
       continue  #考えなくて良いものはスキップ
     if S[i]+S[j]+S[k]==7 : 
         ans-=1   #1番目の条件を満たし、かつ2番目の条件を満たさないので、1を引く
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
ans = S.count('R')*S.count('G')*S.count('B') 
 #1番目の条件を満たすものの総数は(Rの個数)*(Gの個数)*(Bの個数)
for i in range(N): #判定を簡単にするためR:=1,G:=2,B:=4と置き換える
   if S[i]=='R':
       S[i]=1
   elif S[i]=='G':
       S[i]
   elif S[i]=='B':
       S[i]=4
for i in range(N): 
 #すべての(i,j)について(i,j,2*j-i)が1番目の条件を満たし、かつ2番目の条件を満たさないかを判定する
   for j in range(i+1,N):
     k=2*j-i
     if k>N : 
       continue  #考えなくて良いものはスキップ
     if S[i]+S[j]+S[k]==7 : 
         ans-=1   #1番目の条件を満たし、かつ2番目の条件を満たさないので、1を引く
print(ans)
Problem p02678 (python)

Fixed submission:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

for _ in range(M):
    A, B = map(int, input().split())
    # print(A, B)
    graph[A-1].append(B-1)
    graph[B-1].append(A-1)

from collections import deque
def bfs(start):
    dist = [INF] * N
    dist[start] = 0
    seen = [0] * N
    shirube = [None] * N
    shirube[0] = 'Yes'
    q = deque([start])
    while q:
        v = q.popleft()
        dv = dist[v]
        for next_room in graph[v]:
            if seen[next_room]:
                continue
            if dv + 1 < dist[next_room]:
                dist[next_room] = dv + 1
                shirube[next_room] = v + 1
            seen[next_room] = 1
            q.append(next_room)
    if all(shirube):
        for x in shirube:
            print(x)
    else:
        # print(shirube)
        print('No')
bfs(0)

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

for _ in range(M):
    A, B = map(int, input().split())
    graph[A-1].append(B-1)
    graph[B-1].append(A-1)

from collections import deque
def bfs(start):
    dist = [INF] * N
    dist[start] = 0
    seen = [0] * N
    shirube = [None] * N
    shirube[0] = 'Yes'
    q = deque([start])
    while q:
        v = q.popleft()
        dv = dist[v]
        for next_room in graph[v]:
            if seen[next_room]:
                continue
            if dv + 1 < dist[next_room]:
                dist[next_room] = dv + 1
                shirube[next_room] = v + 1
            seen[next_room] = 1
            q.append(next_room)
    if all(shirube):
        for x in shirube:
            print(x)
    else:
        # print(shirube)
        print('No')
bfs(0)
Problem p02909 (python)

Fixed submission:
from sys import stdin
s = stdin.readline().rstrip()

if s == "Sunny":
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
elif s == "Rainy":
  print("Sunny")

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdln.readline
s = input()

if s == "Sunny":
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
elif s == "Rainy":
  print("Sunny")
Problem p02936 (python)

Fixed submission:
import collections

n,q=map(int, input().split())
cnt=[0]*(n+1) # 添字で指定しやすいように一つ多い １以降を使用する
g=[[] for _ in range(n+1)]
for _ in range(n-1):
  a,b=map(int, input().split())
  g[a].append(b)
  g[b].append(a)
for _ in range(q):
  v,val=map(int, input().split())
  cnt[v]+=val
q=collections.deque()
q.append(1)
checked_=[0]*(n+1)
while q:
  v=q.pop()
  checked_[v]=1
  for u in g[v]:
    if checked_[u]==1:
      continue
    cnt[u]+=cnt[v]
    q.append(u)
print(*cnt[1:])

Buggy submission (verdict: Runtime Error):
class Node():
  def __init__(self, num):
    self.num = num
    self.count = 0
    self.childs = []
  def add_child(self, node):
    self.childs.append(node)
  def counter(self, n):
    self.count += n
    for node in self.childs:
      node.counter(n)
  def __repr__(self):
    return str(self.num)
  def __str__(self):
    return str(self.num)

N, Q = list(map(int, input().split()))
node_list = [Node(i) for i in range(1, N+1)]
for i in range(0, N-1):
  a, b = list(map(int, input().split()))
  node_list[a-1].add_child(node_list[b-1])
for i in range(0, Q):
  p, x = list(map(int, input().split()))
  node_list[p-1].counter(x)
res=""
for node in node_list:
  res += "{} ".format(node.count)
print(res)
Problem p02953 (python)

Fixed submission:
input()
hl=list(map(int, input().split()))
hl.reverse()
prev=10**9
for h in hl:
  if h <= prev:
    prev = h
    continue
  if h == prev + 1:
    prev = (h - 1)
    continue
  print("No")
  quit()
print("Yes")

Buggy submission (verdict: Runtime Error):
input()
hl=map(int, input().split())
hl.reverse()
prev=-1
for h in hl:
  if prev == -1:
    prev == h
    continue
  if h <= prev - 1:
    prev == h
    continue
  if h == prev + 1:
    prev = (h - 1)
    continue
  print("No")
  quit()
print("Yes")
Problem p02971 (python)

Fixed submission:
N = int(input())
al = [int(input()) for _ in range(0, N)]

max_a = max(al)  
tmp_al = al[:]
tmp_al.remove(max_a)
snd_a = max(tmp_al)
  
for a in al:
  if a == max_a:
    print(snd_a)
  else:
    print(max_a)

Buggy submission (verdict: Runtime Error):
N = int(input())
al = [int(input()) for _ in range(0, N)]
for a in al:
  el = filter(lambda x: x != a, al)
  if len(list(el)):
    print(max(el))
  else:
    print(a)
Problem p03161 (python)

Fixed submission:
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N, K = map(int, readline().split())
H = list(map(int, readline().split()))

dp = [INF] * N
dp[0] = 0

# 配るDP
for i in range(N):
    for j in range(1, K+1):
        if i+j < N:
            dp[i+j] = min(dp[i+j], dp[i]+abs(H[i] - H[i+j]))
    
ans = dp[-1]
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

import numpy as np

N, K = map(int, readline().split())
H = np.array(readline().split(), dtype=np.int64)

dp = [INF] * N
dp[0] = 0

# 配るDP
for i in range(N):
    for j in range(1, K+1):
        if i+j < N:
            dp[i+j] = min(dp[i+j], dp[i]+abs(H[i] - H[i+j]))
    
ans = dp[-1]
print(ans)
Problem p03386 (python)

Fixed submission:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

a,b,k=map(int,input().split())
ans=[]
for i in range(a,min(a+k,b+1)):
  ans.append(i)
for i in range(max(b-k+1,a),b+1):
  ans.append(i)
ans = sorted(list(set(ans)))
for i in ans:
  print(i)

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

A, B, K = map(int, input().split())
l = list(range(A, B+1))
# if K >= len(l):
#     print(*l, sep="\n")
#     quit()
# ans = list(set(l[:K] + l[-K:]))
# ans.sort()
# 
# print(*ans, sep="\n")

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

A, B, K = map(int, input().split())
l = list(range(A, B+1))
if K >= len(l):
    print(*l, sep="\n")
    quit()
# ans = list(set(l[:K] + l[-K:]))
# ans.sort()
# 
# print(*ans, sep="\n")

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

A, B, K = map(int, input().split())
l = list(range(A, B+1))
if K >= len(l):
    print(*l, sep="\n")
    quit()
ans = list(set(l[:K] + l[-K:]))
ans.sort()

print(*ans, sep="\n")

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

A, B, K = map(int, input().split())
l = list(range(A, B+1))
ans = list(set(l[:K] + l[-K:]))
ans.sort()

print(*ans, sep="\n")
Problem p03494 (python)

Fixed submission:
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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


ans = INF
for a in A:
    cnt = 0
    while True:
        q, mod = divmod(a, 2)
        if mod != 0:
            break
        cnt += 1
        a = q
    ans = min(ans, cnt)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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


ans = INF
for a in A:
    cnt = 0
    while True:
        q, mod = divmod(a, 2)
        if mod != 0:
            break
        cnt += 1
        a = q
    ans = min(ans, cnt)
print(ants)
Problem p04001 (python)

Fixed submission:
# arc 061 Many Formulas
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

S = read().rstrip().decode('utf-8')

def F(S):
    total = 0
    for i in range(2 ** (len(S) - 1)):
        operator_list = format(i, 'b').zfill(len(S)) # 最大桁は必ず0
        sum_ = 0
        num = 0
        for j, operator in zip(S, operator_list):
            if operator == "0":
                num = num * 10 + int(j)
            else:
                sum_ += num
                num = int(j)
        sum_ += num

        total += sum_
    return total

ans = F(S)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

S_int = int(readline())
S_str = str(S_int)

pattern = []
fmt = '0' + str(len(S_str)-1) + 'b'
for i in range(2**(len(S_str)-1)):
    pattern.append(format(i, fmt))

answer = 0
for plus_flags in pattern:
    tmp = []
    tmp_str = S_str[0]
    for i, is_plus in enumerate(plus_flags, start=1):
        if is_plus == "1":
            tmp.append(int(tmp_str))
            tmp_str = ""
        tmp_str += S_str[i]
    if tmp_str:
        tmp.append(int(tmp_str))
    answer += sum(tmp)
print(answer)
Problem p02642 (python)

Fixed submission:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

from collections import Counter

n = ii()
A = iil()
di = Counter(A)
A.sort()

ans = 0
l = set()
for item in A:
    if di[item] > 1:
        if item not in l:
            for i in range(1,1000000//item+1):
                l.add(item*i)
        continue
    if item not in l:
        for i in range(1,1000000//item+1):
            l.add(item*i)
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))

from collections import Counter

n = ii()
A = iil()

di = Counter(A)
A.sort()

ans = 0
l = []
for item in A:
    if di[item] > 1:
        if l[-1] != item:
            l.append(item)
        continue
    flag = True
    for i in l:
        if item%i == 0:
            flag = False
            break
    if flag:
        l.append(item)
        ans += 1
print(ans)