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

Fixed submission:
n = int(input())
from collections import Counter
li = []
for i in range (n):
    li.append(sorted(input()))
li.sort()
for i in range(n):
    li[i]="".join(li[i])

d = Counter(li)
L = list(d.values())

cnt = 0
for i in range(len(L)):
    cnt += L[i]*(L[i]-1)//2
print(cnt)

Buggy submission (verdict: Runtime Error):
import itertools
li = []
for i in range (n):
    li.append(sorted(list(input())))
li.sort()

def comb(x,y):
    d = itertools.combinations(x,y)
    return len(list(d))

cnt = 0
a = []
for i in range(n-1):
    if li[i] == li[i+1]:
        a.append(i+1)
        if i == n-2:
            a.append("1")
            cnt += comb(a,2)
        
    else: 
        a.append("1")
        cnt += comb(a,2)
        a = []
print(cnt)

Buggy submission (verdict: Runtime Error):
    n = int(input())
    li = [sorted(list(input())) for i in range(n)]
     
    li2 = []
    for i in range(len(li)):
        li2.append(li.count(li[i]))
     
    li3 = list(set(li2))
        
    num = 0   
    if len(li3) <=1:
      print(0)
    for i in range(len(li3)):
        if li3[i] >= 2:
            num += li3[i]*(li3[i]-1)//2        
     
    print(num)
Problem p02953 (python)

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
h = li[0]
for i in range(n):
    if li[i] > h:
        h = li[i]
    elif li[i] < h:
        if li[i]+1 < h:
            print("No")
            exit()
        #elif li[i]+1 == h:
            #h = li[i]+1
print("Yes")

Buggy submission (verdict: Runtime Error):
    n=int(input())
    li=list(map(int,input().split()))
    max1 = li[0]
    ans = ""
    if n == 1:
        print("Yes")
    for i in range(n-1):
        if li[i]<=li[i+1]:
            max1 = li[i+1]
            ans = "Yes"
            
        elif li[i]>li[i+1]:
            max1 = li[i]
            if max1-1>li[i+1]:
                ans ="No"
                break
            else:
                continue
        else:
            break
     
    print(ans)
Problem p02983 (python)

Fixed submission:
l,r = map(int,input().split())
ans = 10**20
if r-l>=2019:
    print(0)
    exit()
elif r-l<2019:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans = min(ans,i*j%2019)
            if i*j%2019 == 0:
                break
print(ans)

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split())
li = []
if r-l>=2019:
    print(0)
elif r-l<2019:
    for i in range(l,r):
        for j in range(i+1,r+1):
            li.append(i*j%2019)
            if i*j%2019 == 0:
                break
        if i*j%2019 == 0:
            break
                
print(min(li))

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split())
li = []
if r-l>=2019:
    print(0)
elif r-l<2019:
    for i in range(l,r):
        for j in range(i+1,r+1):
            li.append(i*j%2019)
            if i*j$2019 == 0:
                break
        if i*j$2019 == 0:
            break
                
print(min(li))

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split())
li = []
if r-l>=2019:
    print(0)
elif r-l<2019:
    for i in range(l,r):
        for j in range(i+1,r+1):
            li.append(i*j%2019)
                
print(min(li))
Problem p03035 (python)

Fixed submission:
a,b = map(int,input().split())
print(b if a>=13 else b//2 if 6<=a<=12 else 0)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(b if a>=13 else b//2 if 6<=a<=12 else 0 if a<=5)
Problem p03043 (python)

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

for i in range(1,n+1):
    a=0
    while i*(2**a)<k:
        a+=1
    li.append((1/n)*(1/2**a))
    
print(sum(li))

Buggy submission (verdict: Runtime Error):
li = []

for i in range(1,n+1):
    a=0
    while i*(2**a)<k:
        a+=1
    li.append((1/n)*(1/2**a))
    
print(sum(li))
Problem p03048 (python)

Fixed submission:
R,G,B,N = map(int,input().split())
cnt = 0
for r in range(N+1):
    for g in range(N+1):
        if  (N - r*R - g*G) >= 0 and  (N - r*R - g*G)%B == 0 :
            cnt +=1
            #print(r,g,(N - r*R - g*G)//B)
print(cnt)

Buggy submission (verdict: Runtime Error):
cnt = 0
for r in range(N//R+1):
    for g in range(N//G+1):
        if  (N - r*R - g*G) < 0:
            break
        if  (N - r*R - g*G)%B == 0 :
            cnt +=1
            #print(r,g,(N - r*R - g*G)//B)
print(cnt)
Problem p03062 (python)

Fixed submission:
n = int(input())
L = list(map(int,input().split()))
L1 = len([x for x in L if x < 0])
L.sort()
for i in range(n):
  if L[i] < 0:
    L[i] = -L[i]
#print(L)
if L1%2 == 0:
  print(sum(L))
else:
  print(sum(L)-2*min(L))

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

def sel2(a,b,c):
    if a <= 0 and b <= 0 and c >= 0:
        return (-a,-b,c)
    elif a >= 0 and b <= 0 and c <= 0:
        return (a,-b,-c)
    elif a <= 0 and b >= 0 and c <= 0:
        return (-a,b,-c)
def sel1(a,b,c):
    if a <= 0 and b >= 0 and c >= 0:
        if abs(a) >= abs(b):
            return (-a,-b,c)
        else:
            return (a,b,c)
    elif a >= 0 and b <= 0 and c >= 0:
        if abs(b) == min(abs(a),abs(b),abs(c)):
            return (a,b,c)
        elif abs(a) > abs(c):
            return (a,-b,-c)
        elif abs(a) < abs(b):
            return (-a,-b,c)
    elif a >= 0 and b >= 0 and c <= 0:
        if abs(b) >= abs(c):
            return (a,-b,-c)
        else:
            return (a,b,c)
def selend(a,b):
    if a < 0 and b < 0:
        return (-a,-b)
    elif a < 0 and b > 0:
        if abs(a) > abs(b):
            return (-a,-b)
        elif abs(a) < abs(b):
            return (a,b)
    elif a > 0 and b < 0:
        if abs(a) > abs(b):
            return (a,b)
        elif abs(a) < abs(b):
            return (-a,-b)
for i in range(0,n//3+1,3):
    (p,q,r) = sel2(L[i],L[i+1],L[i+2])
    L[i] = p
    L[i+1] = q
    L[i+2] = r
#print(L)
(s,t) = selend(L[-2],L[-1])
L[-2] = s
L[-1] = t
#print(L)
print(sum(L))
Problem p03074 (python)

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

L = []
from itertools import groupby
for key ,value in groupby(s):
    L.append((key,len(list(value))))
#print(L)
c = []
for i in range(len(L)):
    c.append(L[i][1])
c = [0] + c

for i in range(1,len(c)):
    c[i] +=c[i-1]
#print(c)
l = 0 
r = 2*k

ans = 0
while True:
    if L[l][0] == "1":
        if l + r +1 < len(L):
            ans = max(ans,c[l+r+1] - c[l])#add 5
        else:
            ans = max(ans,c[len(L)] - c[l])
    elif L[l][0] == "0":
        if l + r < len(L):
            ans = max(ans,c[l+r] - c[l])#add 4
        else:
            ans = max(ans,c[len(L)] - c[l])
    if l == len(L)-1:
        break
    l +=1
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = input()
zero,one = [],[]
cnt = 0
if s[0] == "0":
    flag = True
else:
    flag = False
for i in range(n-1):
    if s[i] == "0" and flag == True:
        cnt +=1
        if s[i] == "0" and s[i+1] =="1":
            zero.append(cnt)
            flag = False
            cnt = 0
    elif s[i] == "1" and flag == False:
        cnt +=1
        if s[i+1] =="0":
            one.append(cnt)
            flag = True
            cnt = 0
    else:
        cnt +=1
        
    if i == n-2:
        if s[i+1] == "0":
            cnt +=1
            zero.append(cnt)
        elif s[i+1] == "1":
            cnt +=1
            one.append(cnt)
            
sum1 = sum(zero[:k]) + sum(one[:k+1])
ans = sum1
#print(sum1,ans,len(zero),zero,one)
if k >= len(zero):
    print(n)
    exit()
else:
    if s[0] == "1":
        for i in range(1,len(zero)-k):
            #print(sum1)
            sum1 -=(zero[i] + one[i])
            sum1 +=(zero[i+k] + one[i+k+1])
            ans = max(ans,sum1)
            #print(sum1,ans)
    elif s[0] =="0":
        print(sum1,ans)
        for i in range(1,len(zero)-k):
            sum1 -=(zero[i] + one[i])
            
            sum1 +=(zero[i+k] + one[i+k])
            ans = max(ans,sum1)
            
print(ans)
Problem p03076 (python)

Fixed submission:
L = []
for i in range(5):
    L.append(int(input()))

L1 = [x for x in L if x%10 == 0]
L2 = [x for x in L if x%10 != 0]
L3 = [(x%10,x//10) for x in L2]

ans = sum(L1)
if len(L3)>0:
  L3.sort(reverse = True)
  for i in range(len(L3)-1):
    ans += (L3[i][1]+1)*10
  ans += L3[-1][1]*10+L3[-1][0]
print(ans)

Buggy submission (verdict: Runtime Error):
L = [int(input()) for i in range(5)]
L1 = [x for x in L if x%10 ==0 ]
L2 = [x for x in L if x%10 !=0 ]
L3 = [x%10 for x in L2 ]

idx = L3.index(min(L3))
for i in range(len(L2)):
    if i != idx:
        L2[i] = (L2[i]//10+1)*10
if L1:
    a = sum(L1)
else:
    a =0
if L2:
    b = sum(L2)
else:
    b = 0
print(a+b)

Buggy submission (verdict: Runtime Error):
L = [int(input()) for i in range(5)]
L1 = [x for x in L if x%10 ==0 ]
L2 = [x for x in L if x%10 !=0 ]
L3 = [x%10 for x in L2 ]

idx = L3.index(min(L3))
for i in range(len(L2)):
    if i != idx:
        L2[i] = (L2[i]//10+1)*10

print(sum(L1)+sum(L2))

Buggy submission (verdict: Runtime Error):
L = []
for i in range(5):
    L.append(int(input()))

L1 = [x for x in L if x%10 == 0]
L2 = [x for x in L if x%10 != 0]
L3 = [(x%10,x//10) for x in L2]

ans = sum(L1)
if len(L3)>0:
	L3.sort(reverse = True)
	for i in range(len(L3)-1):
    	ans += (L3[i][1]+1)*10
	ans += L3[-1][1]*10+L3[-1][0]
print(ans)

Buggy submission (verdict: Runtime Error):
L = []
for i in range(5):
    L.append(int(input()))

L1 = [x for x in L if x%10 == 0]
L2 = [x for x in L if x%10 != 0]
L3 = [(x%10,x//10) for x in L2]

ans = sum(L1)
L3.sort(reverse = True)

for i in range(len(L3)-1):
    ans += (L3[i][1]+1)*10
ans += L3[-1][1]*10+L3[-1][0]
print(ans)
Problem p03086 (python)

Fixed submission:
s = list(input())
i=0
li = [0]
num = 0
while i<=len(s)-1:
    
    s1 = ["A","C","G","T"]
    
    if s[i] in s1 :
        num += 1
        i += 1
        li.append(num)
    elif s[i] not in s1 :
        num = 0
        i += 1
        
print(max(li))

Buggy submission (verdict: Runtime Error):
s = list(input())
i=0
li = []
num = 0
while i<=len(s)-1:
    
    s1 = ["A","C","G","T"]
    
    if s[i] in s1 :
        num += 1
        i += 1
        li.append(num)
    elif s[i] not in s1 :
        num = 0
        i += 1
        
print(max(li))
Problem p03087 (python)

Fixed submission:
from itertools import accumulate
n,q = map(int,input().split())
s = input()
L = [0]*n

for i in range(n-1):
    if s[i] == "A" and s[i+1] == "C":
        L[i] = 0
        L[i+1] = 1

LL = list(accumulate(L))
for i in range(q):
    l,r = map(int,input().split())
    print(LL[r-1]-LL[l-1])

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
s = list(input())
li = [0]*(a+1)
for i in range(a):
    if s[i] == "A":
        if s[i+1] == "C":
            li[i+1]  = 1

li2 = [0]*(a+1)
li2[0] = li[0]
for i in range(1,len(li)):
    li2[i] = li2[i-1]+li[i]

for i in range(b):
    l,r = map(int,input().split())
    #print(l,r)
    print(li2[r-1]-li2[l-1])
Problem p03105 (python)

Fixed submission:
a,b,c = map(int,input().split())
if b>=a*c:
  print(c)
else:
  print(b//a)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
def w(a,b):
    li=[]
    d = max(a,b)
    for i in range(1,d//2+1):
        if a%(i) == 0 and b%(i)==0:
            li.append(i)
    #print(li)
    print(li[-c])
w(a,b)
Problem p03106 (python)

Fixed submission:
a,b,k = map(int,input().split())
c = []
for i in range(min(a,b)+1):
  if a%(i+1) == 0 and b%(i+1) == 0:
    c.append(i+1)
c.sort(reverse = True)
print(c[k-1])

Buggy submission (verdict: Runtime Error):
a,b ,k = map(int,input().split())
cnt = 0
for i in range(1,min(a,b)+1):
  if a%i == 0 and b%i == 0:
    cnt +=1
 	if cnt == k:
      print(i)
      exit()

Buggy submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
c = []
for i in range(max(a,b)//2):
  if a%(i+1) == 0 and b%(i+1) == 0:
    c.append(i+1)
c.sort(reverse = True)
print(c[k-1])

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
def w(a,b):
    li=[]
    d = max(a,b)
    for i in range(d//2):
        if a%(i+1) == 0 and b%(i+1)==0:
            li.append(i+1)
    #print(li)
    print(li[c-1])
w(a,b)
Problem p03109 (python)

Fixed submission:
n = input()
n1 = int(n[0:4]+n[5:7]+n[8:10])
if n1 > 20190430:
    print("TBD")
else:
    print("Heisei")

Buggy submission (verdict: Runtime Error):
s = list(input())
if s[7] <= 3 or (s[7] == 4 and s[8] <=3):
  print("Heisei")
else:
  print("TBD")
Problem p03140 (python)

Fixed submission:
n = int(input())
L = []
for i in range(3):
    L.append(input())

cnt = 0
for i in range(n):
    s = set((L[0][i],L[1][i],L[2][i]))
    cnt += len(s)-1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
L = []
for i in range(n):
    L.append(input())

def num(a,b,c):
    s = {a,b,c}
    return len(s)-1
cnt = 0
for i in range(n):
    cnt += num(L[0][i],L[1][i],L[2][i])
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
L = []
for i in range(n):
    L.append(input())

def num(a,b,c):
    s = {a,b,c}
    return len(s)-1
cnt = 0
for i in range(n):
    cnt += num(L[0][i],L[1][i],L[2][i])
print(cnt)
Problem p03161 (python)

Fixed submission:
n,k = map(int,input().split())
L = list(map(int,input().split()))
dp = [float("inf")]*(n)
dp[0] = 0

for i in range(1,n):
    for j in range(max(0,i-k),i):
        dp[i] = min(dp[i],dp[j]+abs(L[i]-L[j]))
        
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
L = list(map(int,input().split()))
dp = [float("inf")]*(n-1)
dp[0] = 0

for i in range(1,n):
    for j in range(max(0,i-k),i):
        dp[i] = min(dp[i],dp[j]+abs(L[i]-L[j]))
        
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
L = list(map(int,input().split()))
dp = [float("inf")]*(100)
dp[0] = 0

for i in range(1,n):
    for j in range(max(0,i-k),i):
        dp[i] = min(dp[i],dp[j]+abs(L[i]-L[j]))
        
print(dp[n-1])
Problem p03164 (python)

Fixed submission:
N,W = map(int,input().split())
w,v = [],[]
for i in range(N):
    a,b = map(int,input().split())
    w.append(a)
    v.append(b)
m = sum(v)
dp=[[float("inf")]*(m+1) for i in range(N+1)]
dp[0][0] = 0

for i in range(N):
    for j in range(m+1):
        if j-v[i] >=0:
            dp[i+1][j] = min(dp[i][j-v[i]] + w[i],dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]
ans = 0
for j in range(m+1):
        if dp[N][j] <= W:
            ans = max(ans,j)
print(ans)

Buggy submission (verdict: Runtime Error):
N,W = map(int,input().split())
w,v = [],[]
for i in range(N):
    a,b = map(int,input().split())
    w.append(a)
    v.append(b)
m = sum(v)
dp = [[0]*(m+1) for i in range(N+1)]

for i in range(N):
    for j in range(m+1):
        if j-v[i] >=0:
            dp[i+1][j] = max(dp[i][j-v[i]] + w[i],dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]

for j in range(m+1):
        if dp[N][j] <= W:
            ans = max(ans,j)
print(ans)
Problem p03196 (python)

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

div = 2
L = []
i = 1
while div <= int(m**0.5)+1:
    while m%div == 0:
        m //=div
        L.append(div)
    div +=1
if m!= 1:
    L.append(m)
#L.append(1)

from collections import Counter
L = Counter(L)

cnt = 1
for k,v in L.items():
    cnt *=k**(v//n)
print(cnt)

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

if n == 1:
    print(m)
    exit()
    
if n >= len(L):
    print(1)
    exit()
    
div = 2
L = []
i = 1
while div <= int(m**0.5)+1:
    while m%div == 0:
        m //=div
        L.append(div)
    div +=1
L.append(m)
#print(L)

from collections import Counter
L = Counter(L)

cnt = 1
for k,v in L.items():
    if v >= n:
        cnt *=k
print(cnt)
Problem p03206 (python)

Fixed submission:
n = int(input())
if n == 25:
    print("Christmas") 
elif n == 24:
    print("Christmas Eve")
elif n == 23:
    print("Christmas Eve Eve")
elif n == 22:
    print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
li = list(int(input()) for i in range(n))

li.sort()
num = 0
li2 = []
for i in range(len(li)-k+1):
    li2.append( max(li[i:i+k]) - min(li[i:i+k]))

print(min(li2))
Problem p03229 (python)

Fixed submission:
from collections import deque
from copy import deepcopy

n,*a = map(int,open(0).read().split())
acopy = deepcopy(a)
a.sort()
acopy.sort(reverse = True)

L = deque([])
a = deque(a)
acopy = deque(acopy)
Lcopy = deepcopy(L)

max_ = a.pop()
L.append(max_)
min_ = acopy.pop()
Lcopy.append(min_)

while a:
    if a:
        b = a.popleft()
        L.append(b)
    if a:
        c = a.popleft()
        L.appendleft(c)
    if a:
        d = a.pop()
        L.append(d)
    if a:
        e = a.pop()
        L.appendleft(e)

while acopy:
    if acopy:
        b = acopy.popleft()
        Lcopy.append(b)
    if acopy:
        c = acopy.popleft()
        Lcopy.appendleft(c)
    if acopy:
        d = acopy.pop()
        Lcopy.append(d)
    if acopy:
        e = acopy.pop()
        Lcopy.appendleft(e)
ans1,ans2 = 0,0
#print(L,Lcopy)
for i in range(len(L)-1):
    ans1 +=abs(L[i+1] - L[i])
for i in range(len(Lcopy)-1):
    ans2 +=abs(Lcopy[i+1] - Lcopy[i])
print(max(ans1,ans2))

Buggy submission (verdict: Runtime Error):
from copy import deepcopy

n,*a = map(int,open(0).read().split())
acopy = deepcopy(a)
a.sort()
acopy.sort(reverse = True)

L = deque([])
a = deque(a)
acopy = deque(acopy)
Lcopy = deepcopy(L)

max_ = a.pop()
L.append(max_)
min_ = acopy.pop()
Lcopy.append(min_)

while a:
    if a:
        b = a.popleft()
        L.append(b)
    if a:
        c = a.popleft()
        L.appendleft(c)
    if a:
        d = a.pop()
        L.append(d)
    if a:
        e = a.pop()
        L.appendleft(e)

while acopy:
    if acopy:
        b = acopy.popleft()
        Lcopy.append(b)
    if acopy:
        c = acopy.popleft()
        Lcopy.appendleft(c)
    if acopy:
        d = acopy.pop()
        Lcopy.append(d)
    if acopy:
        e = acopy.pop()
        Lcopy.appendleft(e)
ans1,ans2 = 0,0
#print(L,Lcopy)
for i in range(len(L)-1):
    ans1 +=abs(L[i+1] - L[i])
for i in range(len(Lcopy)-1):
    ans2 +=abs(Lcopy[i+1] - Lcopy[i])
print(max(ans1,ans2))
Problem p03243 (python)

Fixed submission:
n = input()
s = n[0]*len(n)
if int(n) <= int(s):
    print(s)
else:
    print(str(int(n[0])+1)*len(n))

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

while True:
  for i in range(len(str(n))-1):
    if str(n)[i] == str(n)[i+1]:
      flag = True
    else:
      break
  if flag:
    print(n)
    break
  n +=1
Problem p03262 (python)

Fixed submission:
n, x = map(int,input().split())
li = list(input().split())
li = [abs(int(a)-x) for a in li]

def gcd(a,b):
    while a%b!=0:
        a,b = b,a%b
    return b
    
if n == 1:
    print(abs(li[0]))
    
elif n == 2:
    print(gcd(li[0],li[1]))
    
elif n >= 3:

    c = gcd(li[0],li[1])
    #print(c)
    for i in range(2,len(li)-1):
        c = gcd(c,li[i])
    print(c)

Buggy submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
a,b = map(int,input().split())
li = list(map(int,input().split()))
li = [abs(x-int(b)) for x in li]
print(reduce(gcd,li))

Buggy submission (verdict: Runtime Error):
from functools import reduce
from math import gcd
a,b = map(int,input().split())
li = list(map(int,input().split()))
li = [abs(x-b) for x in li]
print(reduce(gcd,li))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
li = list(map(int,input().split()))
li = [abs(x-b) for x in li]
from functools import reduce
from math import gcd
print(reduce(gcd,li))

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
li = list(map(int,input().split()))
li = [abs(x-b) for x in li]
#print(li)
import functools
import math
li2 = []
for i in range(len(li)-1):
    c = (math.gcd(li[i],li[i+1]))
    li2.append(c)
print(min(li2))

Buggy submission (verdict: Runtime Error):
import math
N,X = map(int,input().split())
l = []
x = tuple(map(int,input().split()))

for i in range(N):
    l.append(abs(x[i]-X))
#print(l)
a = 10**9
for i in range(N-1):
    if a >= math.gcd(l[i],l[i+1]):
        a = math.gcd(l[i],l[i+1])
if N == 1:
    print(x[0]-X)
else:
    print(a)
Problem p03273 (python)

Fixed submission:
h,w = map(int,input().split())
li,li2 = [],[]
for i in range(h):
    a = list(input())
    if "#" in a:
        li.append(a)
for i in range(len(li)):
    for j in range(w):
        if li[i][j] == ".":
            li[i][j] = 0
        elif li[i][j] == "#":
            li[i][j] = 1

li = list(zip(*li))
for i in range(len(li)):
    if 1 in li[i]:
        li2.append(li[i])
li2 = list(zip(*li2))
for i in range(len(li2)):
    li2[i] = list(li2[i])
for i in range(len(li2)):
    for j in range(len(li2[i])):
        if li2[i][j] == 0:
            li2[i][j] = "."
        elif li2[i][j] == 1:
            li2[i][j] = "#"
for i in range(len(li2)):
    print("".join(li2[i]))

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
li,li2,li3 = [],[],[]
for i in range(h):
    li.append(list(input()))
li = [x for x in li if "#"  in x]

for i in range(w):
    li2.append([])
    for j in range(len(li)):
        li2[-1].append(li[j][i])
li2 = [x for x in li2 if "#"  in x]
for i in range(len(li2)):
    li3.append([])
    for j in range(len(li2[i])):
        li3[-1].append(li2[j][i])
for i in range(len(li3)):
    print("".join(li3[i]))
Problem p03281 (python)

Fixed submission:
n = int(input())
def yakusu(a):
    b = 1
    num = 0
    if a == 1:
        return 1
    while b<=a:
        if a%b == 0 and b%2 ==1:
            num += 1
        b += 1
    return num
    
li = []
for i in range(1,n+1):
    li.append(yakusu(i))

print(li.count(8))

Buggy submission (verdict: Runtime Error):
n = int(input())
num = 0
for i in range(1,n+1):
  cnt = 0
  for j in range(1,i+1) and i%2 == 1:
    if i%j == 0:
      cnt += 1
  if cnt == 8:
    num +=1
print(num)
Problem p03282 (python)

Fixed submission:
from itertools import groupby
n = list(input())
k = int(input())
if n == 1:
    print(1)
    exit()
li = []
for key,v in groupby(n):
    li.append(list(v))

if li[0][0] == "1":
    if len(li[0])>= k:
        print(1)
        exit()

for i in range(len(n)):
    if n[i] != "1":
        print(n[i])
        break

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

if "1" in n:
    one = n.rfind("1")-n.find("1")+1
    #print(n.rfind("1")+1)
    if one < k:
        print(n[n.rfind("1")+1])
    elif one >= k:
        print(1)
elif "1" not in n:
    print(n[0])