Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
H,W,s=list(map(int,input().split()))
l=[list(input()) for i in range(H)]
l_h=[0]*H
for i in range(H):
   if "#" in set(l[i]):
      l_h[i]=1
cnt=0
bor=sum(l_h)-1
for i in range(H):
   if l_h[i]==1:
      l_h[i]=-1
      cnt+=1
   if cnt==bor:
      break
cnt=1
import numpy as np
tmp=[]
st=0
ans=np.zeros((H,W))
for i in range(H):
   tmp.append(l[i])
   if l_h[i]==-1:
      n_tmp=np.array(tmp)
      s_count=np.count_nonzero(n_tmp=="#")-1
      for j in range(W):
         ans[st:i+1,j]=cnt
         if "#" in n_tmp[:,j] and s_count>0:
            cnt+=1
            s_count-=1
      st=i+1
      cnt+=1
      tmp=[]
n_tmp=np.array(tmp)
s_count=np.count_nonzero(n_tmp=="#")-1
for j in range(W):
   ans[st:i+1,j]=cnt
   if "#" in n_tmp[:,j] and s_count>0:
      cnt+=1
      s_count-=1
for i in ans:
   print(*list(map(int,i)))

Fixed submission:
H,W,s=list(map(int,input().split()))
l=[list(input()) for i in range(H)]
l_h=[0]*H
for i in range(H):
   if "#" in set(l[i]):
      l_h[i]=1
cnt=0
bor=sum(l_h)-1
for i in range(H):
   if cnt==bor:
      break
   if l_h[i]==1:
      l_h[i]=-1
      cnt+=1
cnt=1
import numpy as np
tmp=[]
st=0
ans=np.zeros((H,W))
for i in range(H):
   tmp.append(l[i])
   if l_h[i]==-1:
      n_tmp=np.array(tmp)
      s_count=np.count_nonzero(n_tmp=="#")-1
      for j in range(W):
         ans[st:i+1,j]=cnt
         if "#" in n_tmp[:,j] and s_count>0:
            cnt+=1
            s_count-=1
      st=i+1
      cnt+=1
      tmp=[]
n_tmp=np.array(tmp)
s_count=np.count_nonzero(n_tmp=="#")-1
for j in range(W):
   ans[st:i+1,j]=cnt
   if "#" in n_tmp[:,j] and s_count>0:
      cnt+=1
      s_count-=1
for i in ans:
   print(*list(map(int,i)))
Buggy python submission (verdict: Runtime Error):
A = input()
print(A ** 2)

Fixed submission:
A = int(input())
print(A ** 2)
Buggy python submission (verdict: Runtime Error):
mod=10**9+7
N,K=list(map(int,input().split()))
if (N+K)%3==0 and N*2>K and K*2>N:
   A=max(N,K)-min(N,K)
   low=(min(N,K)-A)//3
   all_pt=low*2+A
up,down=1,1
for i in range(low):
   up=up*(all_pt-i)%mod
   down=down*(i+1)%mod
base=pow(down,mod-2,mod)
print(up*base%mod)

Fixed submission:
mod=10**9+7
N,K=list(map(int,input().split()))
if (N+K)%3==0 and N*2>=K and K*2>=N:
   A=max(N,K)-min(N,K)
   low=(min(N,K)-A)//3
   all_pt=low*2+A
else:
   print(0)
   exit()
up,down=1,1
for i in range(low):
   up=up*(all_pt-i)%mod
   down=down*(i+1)%mod
base=pow(down,mod-2,mod)
print(up*base%mod)
Buggy python submission (verdict: Runtime Error):
A = list(map(int,input.split(" ")))
if max(A) > 9:
	print("-1")
else:
	print(str(A[0] * A[1]))

Fixed submission:
A = list(map(int,input().split(" ")))
if max(A) > 9:
	print("-1")
else:
	print(str(A[0] * A[1]))
Buggy python submission (verdict: Runtime Error):
A=list(input())
n=int(input())
tmp=0
for i in range(len(A)-1):
   if A[i] == A[i+1]:
      A[i+1]=1
      tmp+=1
if A[0] == A[-1]:
   tmp2=n-1
print(tmp*n+tmp2)

Fixed submission:
A=list(input())
n=int(input())
tmp=0
if len(set(A)) == 1:
   print(len(A)*n//2)
   exit()
sum_n=0
tmp3=0
while A[0] == A[tmp3]:
   tmp3+=1
sum_n+=tmp3
tmp3=0
while A[-1] == A[-1-tmp3]:
   tmp3+=1
sum_n+=tmp3
for i in range(len(A)-1):
   if A[i] == A[i+1]:
      A[i+1]="1"
      tmp+=1
tmp2=0
if A[0] == A[-1]:
   tmp2=n-1
   if sum_n%2 == 1:
      tmp2-=n-1
print(tmp*n+tmp2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = ""
student = list(map(int,input().split()))
for i in range(N):
    a += " " + str(student.index(i+1) + 1)
a = list(a.split(" "))
a.pop(0)
print(" ".join(a))

Fixed submission:
N = int(input())
student = list(map(int,input().split()))
A = [0] * N
for i in range(N):
    A[student[i]-1] = i+1
A = list(map(str,A))
print(" ".join(A))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
student = list(map(int,input().split()))
student_after = []
for i in range(N):
    student_after.append(student.index(i+1) + 1)
student_after = list(map(str,student_after))
print(" ".join(student_after))

Fixed submission:
N = int(input())
student = list(map(int,input().split()))
A = [0] * N
for i in range(N):
    A[student[i]-1] = i+1
A = list(map(str,A))
print(" ".join(A))
Buggy python submission (verdict: Runtime Error):
import math
from collections import deque
A,B = list(map(int,input().split()))
gcd = math.gcd(A,B)
def gcd_another(N):
    R = deque()
    for i in range(1,math.ceil(int(N**0.5))+1):
        if N % i == 0:
            R.append(i)
            if i != N // i:
                R.append(N//i)
    R = list(R)
    R.sort()
    return R
C = gcd_another(gcd)
C.pop(0)
total = 1
while C != []:
    i = C[0]
    C = [j for j in C if j % i != 0]
    total += 1
print(total)

Fixed submission:
import fractions
import math
from collections import deque
A,B = list(map(int,input().split()))
gcd = fractions.gcd(A,B)
def gcd_another(N):
    R = deque()
    for i in range(1,math.ceil(int(N**0.5))+1):
        if N % i == 0:
            R.append(i)
            if i != N // i:
                R.append(N//i)
    R = list(R)
    R.sort()
    return R
C = gcd_another(gcd)
C.pop(0)
total = 1
while C != []:
    i = C[0]
    C = [j for j in C if j % i != 0]
    total += 1
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = list(map(int,input().split()))
list_A = list(map(int,input().split()))
for i in range(M):
    A = max(list_A)
    list_A.remove(A)
    list_A.append(A // 2)
print(sum(list_A))

Fixed submission:
N,M=list(map(int,input().split()))
import sys
A= list(map(int,sys.stdin.readline().split()))
A=[i*-1 for i in A]
import heapq
heapq.heapify(A)
for i in range(M):
    X=heapq.heappop(A)
    X=abs(X)//2*-1
    heapq.heappush(A,X)
print(abs(sum(A)))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = list(map(int,input().split(" ")))
list = list(map(int,input().split(" ")))
for i in range(M):
    list.sort(reverse=True)
    list[0] = list[0] // 2
print(sum(list))

Fixed submission:
N,M=list(map(int,input().split()))
import sys
A= list(map(int,sys.stdin.readline().split()))
A=[i*-1 for i in A]
import heapq
heapq.heapify(A)
for i in range(M):
    X=heapq.heappop(A)
    X=abs(X)//2*-1
    heapq.heappush(A,X)
print(abs(sum(A)))
Buggy python submission (verdict: Runtime Error):
max_score = 0
total = int(input())
now = 0
count = 0 
i = 0
number_list = list(map(int,input().split(" ")))
while i == 0:
    if number_list[now] >= number_list[now+1] and now+1 != total-1:
        count += 1
        now += 1
    elif number_list[now] >= number_list[now+1] and now+1 == total-1:
        count += 1
        now += 1
        if max_score < count:
            max_score = count
        break
    elif number_list[now] < number_list[now+1] and now+1 == total-1:
        break
    else:
        now += 1
        if max_score < count:
            max_score = count
            count = 0
        else:
            count = 0
            continue
print(max_score)

Fixed submission:
max_score = 0
total = int(input())
now = 0
count = 0 
i = 0
if total == 1:
    print(0)
    exit()
number_list = list(map(int,input().split(" ")))
while i == 0:
    if number_list[now] >= number_list[now+1] and now+1 != total-1:
        count += 1
        now += 1
    elif number_list[now] >= number_list[now+1] and now+1 == total-1:
        count += 1
        now += 1
        if max_score < count:
            max_score = count
        break
    elif number_list[now] < number_list[now+1] and now+1 == total-1:
        break
    else:
        now += 1
        if max_score < count:
            max_score = count
            count = 0
        else:
            count = 0
            continue
print(max_score)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = list(map(int,input().split(" ")))
best_count = 0
count = 0
Y = 0
list = []
number_start = 0
number_sub = 0
for i in range(A - 1):
    count = 0
    number_start = B[i]
    number_sub = B[i + 1]
    while Y == 0:
        if number_start < number_sub:
            break
        else:
            if i +count  == A - 2:
                count += 1
                break
            else:
                count += 1
                number_start = B[i + count]
                number_sub = B[i + count + 1]  
    list.append(count)
print(max(list))

Fixed submission:
max_score = 0
total = int(input())
now = 0
count = 0 
i = 0
if total == 1:
    print(0)
    exit()
number_list = list(map(int,input().split(" ")))
while i == 0:
    if number_list[now] >= number_list[now+1] and now+1 != total-1:
        count += 1
        now += 1
    elif number_list[now] >= number_list[now+1] and now+1 == total-1:
        count += 1
        now += 1
        if max_score < count:
            max_score = count
        break
    elif number_list[now] < number_list[now+1] and now+1 == total-1:
        break
    else:
        now += 1
        if max_score < count:
            max_score = count
            count = 0
        else:
            count = 0
            continue
print(max_score)
Buggy python submission (verdict: Time Limit Exceeded):
total = 0
r = int(input())
for i in range(r):
    total += i
print(total)

Fixed submission:
r = int(input())
r = r * (r-1) // 2 
print(int(r))

Buggy python submission (verdict: Time Limit Exceeded):
A = int(input())
total = 0
for i in range(A):
    total += i
print(total)

Fixed submission:
r = int(input())
r = r * (r-1) // 2 
print(int(r))
Buggy python submission (verdict: Runtime Error):
import math
total = 0
A = int(input())
listB = list(map(int,input().split()))
if 1 < A:
    B = listB[0] * listB[1] // math.gcd(listB[0],listB[1])
    for i in range(A-2):
        B = listB[i+2] * B // math.gcd(B,listB[i+2])
else:
    B = listB[0]
for i in listB:
    total += B // i
print(B / total)

Fixed submission:
import fractions
total = 0
A = int(input())
listB = list(map(int,input().split()))
if 1 < A:
    B = listB[0] * listB[1] // fractions.gcd(listB[0],listB[1])
    for i in range(A-2):
        B = listB[i+2] * B // fractions.gcd(B,listB[i+2])
else:
    B = listB[0]
for i in listB:
    total += B // i
print(B / total)
Buggy python submission (verdict: Time Limit Exceeded):
total = 0
A = int(input())
B = []
for i in range(A):
    C = list(input())
    C.sort()
    B.append("".join(C))
for i in range(A):
    D = B[i]
    for j in range(A-i-1):
        if D == B[i+1+j]:
            total += 1
print(total)

Fixed submission:
import collections
from math import factorial
A = int(input())
listA = []
total = 0
listB = {}
for i in range(A):
    B = list(input())
    B.sort()
    listA.append("".join(B))
for i in listA:
    if i in listB:
        listB[i] += 1
        total += listB[i]-1
    else:
        listB[i] = 1
print(total)
Buggy python submission (verdict: Time Limit Exceeded):
N=list(input())
ans=[0]*len(N)
for i in range(len(N)):
   ing=N[i]
   if ing=="R":
      for j in range(i+1,len(N)):
         if N[j] == "L":
            if (j-i)%2==0:
               ans[j]+=1
               break
            else:
               ans[j-1]+=1
               break
   elif ing=="L":
      for j in reversed(range(0,i)):
         if N[j] == "R":
            if (i-j)%2==0:
               ans[j]+=1
               break
            else:
               ans[j+1]+=1
               break
ans=list(map(str,ans))
print(" ".join(ans))

Fixed submission:
l=input()
ans=[0]*len(l)
l=l.replace("RL","X")
cnt=0
now=l[0]
l2=[]
r_c=0
for i in l:
   if now != i:
      l2.append((now,cnt))
      now=i
      cnt=1
   else:
      cnt+=1
l2.append((now,cnt))
now=0
for i,j in l2:
   if i == "R":
      now+=j
      r_c=j
   elif i == "L":
      ans[now-2]+=j//2+j%2
      ans[now-1]+=j//2
      now+=j
   if i == "X":
      ans[now+1]+=r_c//2+r_c%2
      ans[now]+=r_c//2
      r_c=0
      for k in range(j):
         ans[now]+=1
         ans[now+1]+=1
         now+=2
print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
A = int(input())
r = []
for i in range(A):
    r.append(int(input()))
max_r = max(r)
for i in range(A):
    if max_r == r[i]:
        r.pop(i)
        print(max(r))
        r.insert(i,max_r)
    else:
        print(max_r)

Fixed submission:
A = int(input())
No1,No2 = 0,0
for i in range(A):
    B = int(input())
    if No2 < B:
        No2 = B
        if No1 < B:
            place = i
        No1,No2 = max(No1,No2),min(No1,No2)
if No1 == No2:
    for i in range(A):
        print(No1)
else:
    for i in range(place):
        print(No1)
    print(No2)
    for i in range(A-place-1):
        print(No1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lista = []
for i in range(N):
    lista.append(int(input()))
for i in range(N):
    save = lista[i]
    lista.pop(i)
    print(max(lista))
    lista.insert(i,save)

Fixed submission:
A = int(input())
No1,No2 = 0,0
for i in range(A):
    B = int(input())
    if No2 < B:
        No2 = B
        if No1 < B:
            place = i
        No1,No2 = max(No1,No2),min(No1,No2)
if No1 == No2:
    for i in range(A):
        print(No1)
else:
    for i in range(place):
        print(No1)
    print(No2)
    for i in range(A-place-1):
        print(No1)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
import sys
ans=[]
A=list(map(int,sys.stdin.readline().split()))
def divisor(N):
   S=[]
   for i in range(1,int(N**0.5)+1):
      if N%i==0:
         S.append(i)
         if N//i != i:
            S.append(N//i)
   return S
for i in reversed(range(1,N+1)):
   if A[i-1] == 1:
      ans.append(i)
      tmp=divisor(i)
      for j in tmp:
         A[j-1] = A[j-1] ^ 1
if ans == []:
   print(0)
   exit()
else:
   print(len(ans))
   print(*ans)

Fixed submission:
N = int(input())
l = list(map(int, input().split()))
a = [0] * (N+1)
for k in reversed(range(1, N+1)):
    num = sum([a[k*i] for i in range(1, N//k+1)])
    if num % 2 != l[k-1]:
        a[k] = 1
M = sum(a)
ans = [i for i in range(1, N+1) if a[i] > 0]
 
print(M)
print(' '.join(map(str, ans)))
Buggy python submission (verdict: Runtime Error):
from scipy.special import comb
N,K=list(map(int,input().split()))
mod=10**9+7
red=N-K
for i in range(1,K+1):
   print(int(comb(N-K+1,i)*comb(K-1,i-1)%mod))

Fixed submission:
from scipy.special import comb
N,K=list(map(int,input().split()))
mod=10**9+7
red=N-K
for i in range(1,K+1):
   tmp=comb(N-K+1,i,exact=True)*comb(K-1,i-1,exact=True)%mod
   print(tmp)

Buggy python submission (verdict: Runtime Error):
from scipy.special import comb
N,K=list(map(int,input().split()))
mod=10**9+7
red=N-K
for i in range(1,K+1):
   print(int(comb(red+1,i)*pow(i,K-i)%mod))

Fixed submission:
from scipy.special import comb
N,K=list(map(int,input().split()))
mod=10**9+7
red=N-K
for i in range(1,K+1):
   tmp=comb(N-K+1,i,exact=True)*comb(K-1,i-1,exact=True)%mod
   print(tmp)
Buggy python submission (verdict: Runtime Error):
A,B,C,D = list(map(int,input().split()))
import math
E = C * D // math.gcd(C,D)
total = B - B // C - B // D + B // E
F = A-1
total -= F - F // C - F // D + F // E
print(total)

Fixed submission:
A,B,C,D = list(map(int,input().split()))
import fractions
E = C * D // fractions.gcd(C,D)
total = B - B // C - B // D + B // E
F = A-1
total -= F - F // C - F // D + F // E
print(total)

Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = list(map(int,input().split()))
A -= 1
lcn = C * D / math.gcd(C,D) 
m_n = B - B // C - B // D + B // lcn
min_n = A - A // C - A // D + A // lcn
print(int(m_n-min_n))

Fixed submission:
A,B,C,D = list(map(int,input().split()))
import fractions
E = C * D // fractions.gcd(C,D)
total = B - B // C - B // D + B // E
F = A-1
total -= F - F // C - F // D + F // E
print(total)

Buggy python submission (verdict: Runtime Error):
import math
A,B,C,D = list(map(int,input().split()))
A -= 1
lcn = C * D / math.gcd(C,D) 
m_n = B - B // C - B // D + B // lcn
min_n = A - A // C - A // D + A // lcn
print(m_n-min_n)

Fixed submission:
A,B,C,D = list(map(int,input().split()))
import fractions
E = C * D // fractions.gcd(C,D)
total = B - B // C - B // D + B // E
F = A-1
total -= F - F // C - F // D + F // E
print(total)
Buggy python submission (verdict: Runtime Error):
N = int(input())
l=[]
for i in range(N):
   a,b=map(int,input().split())
   l.append((a,b))
l2=[]
for i in range(N):
   for j in range(N):
      if i!=j:
         l2.append((l[i][0]-l[j][0],l[i][1]-l[j][1]))
from collections import Counter
l2=max(Counter(l2).values())
print(N-l2)

Fixed submission:
N = int(input())
l=[]
if N==1:
   print(1)
   exit()
for i in range(N):
   a,b=map(int,input().split())
   l.append((a,b))
l2=[]
for i in range(N):
   for j in range(N):
      if i!=j:
         l2.append((l[i][0]-l[j][0],l[i][1]-l[j][1]))
from collections import Counter
l2=max(Counter(l2).values())
print(N-l2)

Buggy python submission (verdict: Runtime Error):
N=int(input())
l=[]
l_a=[]
for i in range(N):
   l.append(list(map(int,input().split())))
for i in range(N):
   for j in range(i+1,N):
      tmp=str(l[j][0]-l[i][0])+" "+str(l[j][1]-l[i][1])
      l_a.append(tmp)
import collections
l_a=collections.Counter(l_a).most_common()
print(N-l_a[0][1])

Fixed submission:
N = int(input())
l=[]
if N==1:
   print(1)
   exit()
for i in range(N):
   a,b=map(int,input().split())
   l.append((a,b))
l2=[]
for i in range(N):
   for j in range(N):
      if i!=j:
         l2.append((l[i][0]-l[j][0],l[i][1]-l[j][1]))
from collections import Counter
l2=max(Counter(l2).values())
print(N-l2)
Buggy python submission (verdict: Time Limit Exceeded):
H,W=list(map(int,input().split()))
l=[list(input()) for i in range(H)]
l_r=[[0]*W for i in range(H)]
l_l=[[0]*W for i in range(H)]
l_u=[[0]*W for i in range(H)]
l_d=[[0]*W for i in range(H)]
for i in range(H):
   tmp=0
   for j in range(W):
      if l[i][j] == ".":
         tmp+=1
         l_r[i][j]=tmp
      else:
         tmp=0
for i in range(H):
   tmp=0
   tmp_l=l[i]
   tmp_l=tmp_l[::-1]
   for j in range(W):
      if tmp_l[j] == ".":
         tmp+=1
         l_l[i][j]=tmp
      else:
         tmp=0
   l_l[i].reverse()
for i in range(W):
   tmp=0
   for j in range(H):
      if l[j][i]==".":
         tmp+=1
         l_d[j][i]=tmp
      else:
         tmp=0
for i in range(W):
   tmp=0
   for j in reversed(range(H)):
      if l[j][i]==".":
         tmp+=1
         l_u[j][i]=tmp
      else:
         tmp=0
ans=0
for i in range(H):
   for j in range(W):
      ans=max(ans,l_u[i][j]+l_d[i][j]+l_l[i][j]+l_r[i][j]-3)
print(ans)

Fixed submission:
H,W=list(map(int,input().split()))
import numpy as np
m=np.array([[0 if i=="#" else 1 for i in input()] for i in range(H)])
l,r,u,d=np.zeros((4,H,W))
for i in range(H):
   u[i]=(u[i-1]+1)*m[i]
   d[-i-1]=(d[-i]+1)*m[-i-1]
for i in range(W):
   r[:,i]=(r[:,i-1]+1)*m[:,i]
   l[:,-i-1]=(l[:,-i]+1)*m[:,-i-1]
print(int(np.max(u+r+l+d))-3)
Buggy python submission (verdict: Runtime Error):
N,M= list(map(int,input().split()))
end = []
start = []
for i in range(M):
    A,B = list(map(int,input().split()))
    end.append(B)
    start.append(A)
end_min = min(end)
start_max = max(start)
if start_max >= end_min:
    print(0)
else:
    print(end_min-start_end+1)

Fixed submission:
N,M= list(map(int,input().split()))
end = []
start = []
for i in range(M):
    A,B = list(map(int,input().split()))
    end.append(B)
    start.append(A)
end_min = min(end)
start_max = max(start)
if start_max > end_min:
    print(0)
else:
    print(end_min-start_max+1)

Buggy python submission (verdict: Runtime Error):
N,M= list(map(int,input().split()))
end = []
start = []
for i in range(M):
    A,B = list(map(int,input().split()))
    end.append(B)
    start.append(A)
end_min = min(end)
start_max = max(start)
if start_max => end_min:
    print(0)
else:
    print(end_min-start_end+1)

Fixed submission:
N,M= list(map(int,input().split()))
end = []
start = []
for i in range(M):
    A,B = list(map(int,input().split()))
    end.append(B)
    start.append(A)
end_min = min(end)
start_max = max(start)
if start_max > end_min:
    print(0)
else:
    print(end_min-start_max+1)

Buggy python submission (verdict: Time Limit Exceeded):
N,M= list(map(int,input().split()))
list_A = [0] * N
for i in range(M):
    A,B = list(map(int,input().split()))
    list_A[A-1:B] = map(lambda x: x+1,list_A[A-1:B])
print(list_A.count(M))


Fixed submission:
N,M= list(map(int,input().split()))
end = []
start = []
for i in range(M):
    A,B = list(map(int,input().split()))
    end.append(B)
    start.append(A)
end_min = min(end)
start_max = max(start)
if start_max > end_min:
    print(0)
else:
    print(end_min-start_max+1)
Buggy python submission (verdict: Time Limit Exceeded):
N,M= list(map(int,input().split()))
card_list = list(map(int,input().split()))
card_list.sort()
for i in range(M):
    B,C = list(map(int,input().split()))
    for j in range(B):
        if card_list[j] < C:
            card_list[j] = C
        else:
            break
    card_list.sort()
print(sum(card_list))

Fixed submission:
N,M= map(int,input().split())
l=list(map(int,input().split()))
tmp=[]
for i in l:
   tmp.append((1,i))
for i in range(M):
   A,B=list(map(int,input().split()))
   tmp.append((A,B))
from operator import itemgetter
tmp.sort(reverse=True,key=itemgetter(1))
ans,cnt=0,N
for v,s in tmp:
   nd=min(v,cnt)
   ans+=nd*s
   cnt-=nd
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,N= list(map(int,input().split()))
ans=0
for i in range(0,N//A+1):
   for j in range(0,(N-i*A)//B+1):
      if (N-i*A-j*B)%C==0 and (N-i*A-j*B)>-1:
         ans+=1
print(ans)

Fixed submission:
A,B,C,N= list(map(int,input().split()))
ans=0
for i in range(0,N//A+1):
   for j in range(0,(N-i*A)//B+1):
      if (N-i*A-j*B)%C==0:
         ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,N= list(map(int,input().split()))
ans=0
for i in range(0,N//A+1):
   for j in range(0,N//B+1):
      if (N-i*A-j*B)%C==0 and (N-i*A-j*B)>-1:
         ans+=1
print(ans)

Fixed submission:
A,B,C,N= list(map(int,input().split()))
ans=0
for i in range(0,N//A+1):
   for j in range(0,(N-i*A)//B+1):
      if (N-i*A-j*B)%C==0:
         ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import sympy
N=int(input())
S=sympy.divisors(N)
ans=0
S=S[1:]
for i in S:
   if i==0:
      continue
   if N%(i-1)==N//(i-1):
      ans+=i-1
print(ans)

Fixed submission:
N=int(input())
def div(n):
    low,high= [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            low.append(i)
            if i != n // i:
                high.append(n//i)
        i += 1
    return low+high[::-1]
S=div(N)
ans=0
S=S[1:]
for i in S:
   if i==0:
      continue
   if N%(i-1)==N//(i-1):
      ans+=i-1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
H,W= list(map(int,input().split()))
l=[list(input()) for i in range(H)]
inf=10**9
visited=[[inf]*W for i in range(H)]
from collections import deque
def ans():
   que=deque([])
   for i in range(H):
      for j in range(W):
         if l[i][j]=="#":
            que.append((i,j))
            visited[i][j]=0
   while que:
      y,x=que.popleft()
      node=visited[y][x]+1
      if y>0:
         if l[y-1][x]=="." and visited[y-1][x]==inf:
            visited[y-1][x]=min(visited[y-1][x],node)
            que.append((y-1,x))
      if x>0:
         if l[y][x-1]=="." and visited[y][x-1]==inf:
            visited[y][x-1]=min(visited[y][x-1],node)
            que.append((y,x-1))
      if H-1>y:
         if l[y+1][x]=="." and visited[y+1][x]==inf:
            visited[y+1][x]=min(visited[y+1][x],node)
            que.append((y+1,x))
      if W-1>x:
         if l[y][x+1]=="." and visited[y][x+1]==inf:
            visited[y][x+1]=min(visited[y][x+1],node)
            que.append((y,x+1))
ans()
visited=sum(visited,[])
print(max(visited))

Fixed submission:
H,W=list(map(int,input().split()))
inf=float("inf")
import numpy as np
mem=np.full((H,W),inf)
l=[list(input()) for i in range(H)]
for i in range(H):
   for j in range(W):
      if l[i][j]=="#":
         mem[i,j]=0
for i in range(W-1):
   mem[:,i+1]=np.minimum(mem[:,i]+1,mem[:,i+1])
for i in reversed(range(1,W)):
   mem[:,i-1]=np.minimum(mem[:,i-1],mem[:,i]+1)
for i in range(H-1):
   mem[i+1,:]=np.minimum(mem[i+1,:],mem[i,:]+1)
for i in reversed(range(1,H)):
   mem[i-1,:]=np.minimum(mem[i-1,:],mem[i,:]+1)
print(int(np.max(mem)))