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

Fixed submission:
import bisect
N = int(input())
A = [int(i) for i in input().split()]
A.sort()
idx = bisect.bisect_left(A,0)
ans = 0
if idx%2 == 0:
  ans += abs(sum(A[0:idx]))
  if N > idx:
    ans += sum(A[idx:])
else:
  ans += abs(sum(A[0:idx-1]))
  if idx < N:
    ans += abs(A[idx-1]+A[idx])
  elif idx == N:
    ans += A[idx-1]
  if idx + 1 < N:
    ans += sum(A[idx+1:])
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
A = [int(i) for i in input().split()]
A.sort()
idx = bisect.bisect_left(A,0)
if idx%2 == 0:
  ans = abs(sum(A[0:idx])) + sum(A[idx:])
else:
  ans = abs(sum(A[0:idx-1])) + abs(A[idx-1]+A[idx]) + sum(A[idx+1:])
print(ans)

Buggy submission (verdict: Runtime Error):
import copy

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

plus = [i for i in A if i >= 0]
minus = [i for i in A if i < 0]

M = len(minus)


if M % 2 == 0:
  ans = sum(A) + abs(sum(minus))*2
elif M % 2 == 1:
  minus2 = copy.copy(minus)
  minus2.pop(-1)
  tmp = sum(A) + abs(sum(minus2))*2
  tmp2 = sum(A) + abs(sum(minus))*2 - min(plus) * 2
  ans = max(tmp, tmp2)
print(ans)

Buggy submission (verdict: Runtime Error):
import copy

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

plus = [i for i in A if i >= 0]
minus = [i for i in A if i < 0]

M = len(minus)


if M % 2 == 0:
  ans = sum(A) + abs(sum(minus))*2
else:
  minus2 = copy.copy(minus)
  minus2.pop(-1)
  tmp = sum(A) + abs(sum(minus2))*2
  tmp2 = sum(A) + abs(sum(minus))*2 - min(plus) * 2
  ans = max(tmp, tmp2)
print(ans)
Problem p03074 (python)

Fixed submission:
N, K = map(int, input().split())
S = list(map(int,list(input())))
A = []
B = []
if S[0] == 1:
  A.append(0)
  B.append(1)
else:
  A.extend([0,1])
  B.extend([0,0])
  
for i in range(1,N):
  if S[i] == S[i-1]:
    if S[i] == 0:
      A[-1] += 1
    else:
      B[-1] += 1
  else:
    if S[i] == 0:
      A.append(1)
      B.append(0)
    else:
      A.append(0)
      B.append(1)
if B[-1] == 0:
  A.append(0)
  B.append(0)

M = len(A)
tmp = sum(A[0:2*K+1]) + sum(B[0:2*K+1])
ans = tmp
for i in range(2,M-2*K,2):
  tmp -= A[i-1] + B[i-2]
  tmp += A[i+2*K-1] + B[i+2*K]
  ans = max(ans,tmp)
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
width,l,r = [],[],[]

for i in range(K):
  if "0" not in S:
    break
  for j in range(N-1):
    if j == 0:
      sw = 1
      l.append(0)
      for k in range(j,N-1-j):
        if S[k] == "0" and S[k+1] == "1":
          r.append(k+1) #r自体は1
          sw = 2
        if sw == 2 and S[k] == "1" and S[k+1] == "0":
          width.append(k-j)
          break
    if S[j] == "0" and S[j+1] == "1":
      sw = 1
      for k in range(j+1,N-1-j):
        if S[k] == "1" and S[k+1] == "0":
          l.append(k+1)
        if S[k] == "0" and S[k+1] == "1":
          r.append(k+1) #r自体は1
          sw = 2
        if sw == 2 and S[k] == "1" and S[k+1] == "0":
          width.append(k-j)
          break
  idx = width.index(max(width))
  ans = max(width)
  S = S[:l[idx]] + "1"*(r[idx]-l[idx]) + S[r[idx]:]
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
width,l,r = [],[],[]

for i in range(K):
  if "0" not in S:
    break()
  for j in range(N-1):
    if j == 0:
      sw = 1
      l.append(0)
      for k in range(j,N-1-j):
        if S[k] == "0" and S[k+1] == "1":
          r.append(k+1) #r自体は1
          sw = 2
        if sw == 2 and S[k] == "1" and S[k+1] == "0":
          width.append(k-j)
          break
    if S[j] == "0" and S[j+1] == "1":
      sw = 1
      for k in range(j+1,N-1-j):
        if S[k] == "1" and S[k+1] == "0":
          l.append(k+1)
        if S[k] == "0" and S[k+1] == "1":
          r.append(k+1) #r自体は1
          sw = 2
        if sw == 2 and S[k] == "1" and S[k+1] == "0":
          width.append(k-j)
          break
  idx = width.index(max(width))
  ans = max(width)
  S = S[:l[idx]] + "1"*(r[idx]-l[idx]) + S[r[idx]:]
print(ans)
Problem p03078 (python)

Fixed submission:
from heapq import heappop, heappush,heapify
X,Y,Z,K = map(int, input().split())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
H = []
heappush(H,[-1*(A[0]+B[0]+C[0]),0,0,0])
count = 1
memo = []
while H and count <= K:
  tmp,i,j,k = heappop(H)
  print(-1*tmp)
  count += 1
  if i+1 < X and ((i+1,j,k) not in memo):
    heappush(H,[-1*(A[i+1]+B[j]+C[k]),i+1,j,k])
    memo.append((i+1,j,k))
  if j+1 < Y and ((i,j+1,k) not in memo):
    heappush(H,[-1*(A[i]+B[j+1]+C[k]),i,j+1,k])
    memo.append((i,j+1,k))
  if k+1 < Z and ((i,j,k+1) not in memo):
    heappush(H,[-1*(A[i]+B[j]+C[k+1]),i,j,k+1])
    memo.append((i,j,k+1))

Buggy submission (verdict: Runtime Error):
X,Y,Z,K = map(int, input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
C.sort()
C.reverse()


array = []
tmp = []

for a in A:
  for b in B:
    tmp.append(a+b)
tmp.sort()
tmp.reverse()

for i in range(K):
  for c in C:
    array.append(tmp[i]+c)

array.sort()
array.reverse()

for i in range(K):
  print(array[i])

Buggy submission (verdict: Runtime Error):
X,Y,Z,K = map(int, input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
A.reverse()
B.sort()
B.reverse()
C.sort()
C.reverse()


array = []
tmp = []

for a in A:
  for b in B:
    tmp.append(a+b)
tmp.sort()
tmp.reverse()

for i in range(K):
  for c in C:
    array.append(tmp[i]+c)

array.sort()
array.reverse()

for i in range(K):
  print(array[i])
Problem p03105 (python)

Fixed submission:
A, B, C = map(int, input().split())

answer = 0

if B//A < C:
  answer = B//A
else:
  answer = C

print(answer)

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

def divlist(x):
  numbers = []
  divX = []
  try:
    for i in range(1,x+1):
      numbers.append(i)
      if x % i == 0:
        divX.append(i)
    divX = set(divX)
    return divX
  except ZeroDivisionError:
      print("ZeroDivisionError!!")

divA = divlist(A)
divB = divlist(B)
common = sorted(list(divA & divB))

#print("divA:", divA)
#print("divB:", divB)
#print("divC:", common)
print(common[K-1])
Problem p03165 (python)

Fixed submission:
s = input()
t = input()
N = len(s)
M = len(t)

dp = [[0]*(N+1) for i in range(M+1)]

for i in range(1,M+1):
  for j in range(1,N+1):
    if s[j-1] == t[i-1]:
      dp[i][j] = dp[i-1][j-1]+1
    else:
      dp[i][j] = max(dp[i-1][j],dp[i][j-1])
L = dp[-1][-1]
i = M
j = N
ans = [""]*L
cur = L-1
while i>=0 and j>=0:
  if dp[i][j] != dp[i-1][j] and dp[i][j] != dp[i][j-1]:
    ans[cur] = s[j-1]
    i -= 1
    j -= 1
    cur -= 1
  elif dp[i][j] == dp[i-1][j]:
    i -= 1
  else:
    j -= 1
print("".join(ans))

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

ls = len(s)
lt = len(t)
ans = ""
dp = [[0]*(ls+1) for i in range(lt+1)]
memo = [[""]*(ls+1) for i in range(lt+1)]

for i in range(1,lt+1):
    for j in range(1,ls+1):
        dp[i][j] = max(dp[i-1][j],dp[i][j-1])
        memo[i][j] = memo[i-1][j-1]
        if s[j-1] == t[i-1]:
            dp[i][j] = dp[i-1][j-1]+1
            memo[i][j] = memo[i-1][j-1]+s[j-1]

i = lt
j = ls
while i-1>=0 and j-1>=0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
        continue
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
        continue
    else:

    i -= 1
    j -= 1
    ans = s[j] + ans

print(ans)
Problem p03244 (python)

Fixed submission:
import collections

n = int(input())
v = list(map(int, input().split()))
odd, even = [], []

for i in range(n):
  if i % 2 == 0:
    even.append(v[i])
  else:
    odd.append(v[i])

    
codd = collections.Counter(odd)
ceven = collections.Counter(even)
mostodd = codd.most_common()[0]
mosteven = ceven.most_common()[0]

if mostodd[0] != mosteven[0]:
  ans = n - mostodd[1] - mosteven[1]
else:
  if len(ceven.most_common()) > 1:
    even2nd = ceven.most_common()[1][1]
  else:
    even2nd = 0
  ans1 = n - mostodd[1] - even2nd
  if len(codd.most_common()) > 1:
    odd2nd = codd.most_common()[1][1]
  else:
    odd2nd = 0
  ans2 = n - odd2nd - mosteven[1] 
  ans = min(ans1, ans2)
print(ans)

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
v = list(map(int, input().split()))
odd, even = [], []

for i in range(n):
  if i % 2 == 0:
    even.append(v[i])
  else:
    odd.append(v[i])

    
codd = collections.Counter(odd)
ceven = collections.Counter(even)
mostodd = codd.most_common()[0]
mosteven = ceven.most_common()[0]

if mostodd[0] != mosteven[0]:
  ans = n - mostodd[1] - mosteven[1]
else:
  if mostodd[1] >= mosteven[1]:
    if len(ceven.most_common()) > 1:
      even2nd = ceven.most_common()[1] 
    else:
      even2nd = 0
    ans = n - mostodd[1] - even2nd
  else:
    if len(codd.most_common()) > 1:
      odd2nd = codd.most_common()[1] 
    else:
      odd2nd = 0
    ans = n - odd2nd - mosteven[1] 
print(ans)
Problem p03262 (python)

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

xdef = [abs(x[i]-X) for i in range(N)]
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

if N == 1:
  print(xdef[0])
else:
  tmp = gcd(xdef[0], xdef[1])
  for i in range(1,N):
    tmp = gcd(tmp,xdef[i])
  print(tmp)

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

xdef = [abs(x[i]-X) for i in range(N)]
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

if N == 1:
  print(xdef[0])
else:
  tmp = gcd(xdef[0], xdef[1])
  for i in range(1,N):
    gcd = gcd(tmp,xdef[i])
  print(gcd)

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

xdef = [abs(x[i]-X) for i in range(N)]
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z
    
tmp = gcd(xdef[0], xdef[1])
for i in range(2,N):
  gcd = gcd(tmp,xdef[i])
print(gcd)
Problem p03263 (python)

Fixed submission:
H, W = map(int, input().split())
a = [list(map(int, input().split())) for i in range(H)]
N = 0
ans = []
for x in range(W):
  for y in range(H-1):
    if a[y][x]%2 == 1:
      a[y][x] -= 1
      a[y+1][x] += 1
      ans.append([y+1,x+1,y+2,x+1])
      N += 1
for x in range(W-1):
  if a[H-1][x]%2 == 1:
    a[H-1][x] -= 1
    a[H-1][x+1] += 1
    ans.append([H,x+1,H,x+2])
    N += 1
print(N)
for i in ans:
  print(" ".join(map(str,i)))

Buggy submission (verdict: Runtime Error):
H, W = map(int,input().split())
A = [list(map(int,input().split())) for i in range(H)]
n = 0
memo = []

for x in range(W):
  for y in range(H-1):
    if A[y][x]%2 == 1:
      A[y][x] -= 1
      A[y+1][x] += 1
      n += 1
      memo.append([y+1,x+1,y+2,x+1])
for x in range(W):
  if A[H-1][x]%2 == 1:
    A[H-1][x] -= 1
    A[H-1][x+1] += 1
    memo.append([H,x+1,H,x+2])
    n += 1
print(n)
for i in range(n):
  print(" ".join(map(str,memo[i])))
Problem p03274 (python)

Fixed submission:
import bisect

N, K = map(int, input().split())
x = list(map(int, input().split()))
ans, tmp = 10**9, 10**9

#print(bisect.bisect(x, 0))

for i in range(len(x) - K + 1):
  if x[i] <= 0 and x[i+K-1] >= 0:
    tmp = abs(x[i]) + x[i+K-1] + min(abs(x[i]), x[i+K-1])
  elif x[i] < 0 and x[i+K-1] <= 0:
    tmp = abs(x[i])
  elif x[i] >= 0 and x[i+K-1] > 0:
    tmp = x[i+K-1]
#  elif i == bisect.bisect(x, 0)-1:
#    tmp = x[i+K-1]
#  elif i+K-1 == bisect.bisect(x, 0)-1:
#    tmp = abs[x[i]]
#  print("i:{}, i+K-1:{}, tmp:{}".format(i, i+K-1, tmp))
  ans = min(tmp, ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

N, K = map(int, input().split())
x = list(map(int, input().split()))
ans = 10**9
#print(bisect.bisect(x, 0))

for i in range(len(x) - K + 1):
  if x[i] <= 0 and x[i+K-1] >= 0:
    tmp = abs(x[i]) + x[i+K-1] + min(abs(x[i]), x[i+K-1])
  elif i == bisect.bisect(x, 0):
    tmp = x[i+K-1]
  elif i+K-1 == bisect.bisect(x, 0):
    tmp = abs[x[i]]
#  print("i:{}, i+K-1:{}, tmp:{}".format(i, i+K-1, tmp))
  ans = min(tmp, ans)
print(ans)
Problem p03361 (python)

Fixed submission:
H, W = map(int, input().split())
s = [list(input()) for i in range(H)]
check = [[False]*W]*H
dx = -1,0,1,0
dy = 0,-1,0,1

for h in range(H):
  for w in range(W):
    bcount = 0 #隣接する黒ますの個数
    if s[h][w] == "#":
      for i in range(4):
        if 0 <= h+dx[i] <= H-1 and 0 <= w+dy[i] <= W-1 and s[h+dx[i]][w+dy[i]] == "#":
            bcount += 1
      if bcount == 0:
        print("No")
        exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
sw = [list(str(input())) for i in range(H)]
dx = [1,0,-1,0]
dy = [0,1,0,-1]

for i in range(H):
  for j in range(W):
    if sw[i][j] == "#":
      counter = 0
      for k in range(4):
        if i+dx[k] < 0 or i+dx[k] >= H or j+dy[k] < 0 or j+dy[k] >= H:
          counter += 1
        elif sw[i+dx[k]][j+dy[k]] == ".":
          counter += 1
      if counter == 4:
        print("No")
        exit()
print("Yes")
Problem p03409 (python)

Fixed submission:
import sys
input = sys.stdin.readline
N = int(input())
R = []
B = []
ans = 0
for i in range(N):
  a,b = map(int,input().split())
  R.append((a,b))
for i in range(N):
  c,d = map(int,input().split())
  B.append((c,d))
R.sort(key=lambda x:x[0])
B.sort(key=lambda x:x[0])
H = []
l = 0
for i in range(N):
  for j in range(l,N):
    if R[j][0] > B[i][0]:
      l = j
      break
    H.append(R[j])
  H.sort(key=lambda x:x[1], reverse=True)
  for k in range(len(H)):
    if H[k][1] < B[i][1]:
      H.pop(k)
      ans += 1
      break
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
red = []
blue = []
chosen = [0]*N
ans = 0
for i in range(N):
  a,b = map(int, input().split())
  red.append((a,b))
for i in range(N):
  c,d = map(int, input().split())
  blue.append((c,d))
  
red.sort(key=lambda x:x[1])
blue.sort(key=lambda x:x[0])

for i in range(N):
  for j in range(N):
    if blue[i][0] >= red[j][0] and blue[i][1] >= red[j][1] and chosen[j] == 0
      chosen[j] = 1
      ans += 1
      break
      
print(ans)
Problem p03479 (python)

Fixed submission:
X, Y = map(int, input().split())
A = X
count = 0

while A <= Y:
  count += 1
  A = A * 2
  
print(count)

Buggy submission (verdict: Runtime Error):
import math
X,Y = map(int,input().split())
print(int(math.floor(Y/X,2)+1))
Problem p03545 (python)

Fixed submission:
S = [int(i) for i in input()]
#array = []
#for i in S:
#  array.append(int(i))

N = len(S) #+,-の入りうる場所はN-1か所 

for i in range(2**(N-1)):
  ans = S[0]
  plmi=["-"]*(N-1)
  for j in range(N-1):
    if (i >> j) & 1:
      ans -= S[j+1]
    else:
      ans += S[j+1]
      plmi[j] = "+"
      
  if ans == 7:
    print(S[0],plmi[0],S[1],plmi[1],S[2],plmi[2],S[3],"=7", sep="")
    break

Buggy submission (verdict: Runtime Error):
S = input()
l = len(S)
ans = 0

for i in range(2**(l-1)):
    T = S[0]
    for j in range(l-1):
        if i>>j & 1:
            T = T + ""
        else:
            T = T + "+"
        T = T+S[j+1]
    if eval(T) == 7:
        print(T+"=7")
Problem p03565 (python)

Fixed submission:
S2 = input()
T = input()
N = len(S2)

Tplace = {i:False for i in range(N)}
#print(Tplace)

for i in range(N-len(T)+1):
  counter = 0
  for j in range(len(T)):
    if S2[i+j] == T[j] or S2[i+j] == "?":     
      counter += 1
#      print(S2[i+j],T[j],counter)
      continue
    else:
#      print(2,i,j,S2[i+j])
      break
#  print(3)
  if counter == len(T):
    Tplace[i] = True
#print(Tplace)

ans = []

for key, value in Tplace.items():
  if value:
    tmp = S2[:key] + T + S2[key+len(T):] 
    tmp2 = tmp.replace('?', 'a')
    ans.append(tmp2)
ans.sort()
print(ans[0] if len(ans) > 0 else "UNRESTORABLE")

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

ls = len(S)
lt = len(T)

for i in range(ls-lt+1):
    for j in range(lt):
        if S[i] != "?" and S[i] != T[j]:
            break
    else:
       left = i

ans = S[:i]+T+S[i+lt:]
print(ans.replace("?","a"))
Problem p03599 (python)

Fixed submission:
A, B, C, D, E, F = map(int, input().split())
ans = 0
W = set()
S = set()

for i in range(F):
  x1 = 100 * A * i
  if x1 > F:
    break
  for j in range(F):
    x2 = x1 + 100 * B * j
    if x2 > F or x2 == 0:
      break
    W.add(x2)
for i in range(F):
  y1 = C * i
  if y1 > F:
    break
  for j in range(F):
    y2 = y1 + D * j
    if y2 > F:
      break
    S.add(y2)

W = list(set(W))
S = list(set(S))

for i in range(len(W)):
  for j in range(len(S)):
    tmp = S[j]/W[i]
    tmp1 = S[j] + W[i]
    if tmp1 <= F and ans <= tmp <= E/100:
      ans = tmp
      ans1 = tmp1
      ans2 = S[j]
print(ans1, ans2)

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())
M = 0
Concmax = 0

for i in range(F//100//A+1):
  WA = i*100*A
  for k in range((F-WA)//100//B+1):
    WB = k*100*B
    W = WA+WB
    if W <= F:
      for j in range((F-W)//C+1):
        SC = j*C
        for l in range((F-W-C)//D+1):
          SD = l*D
          S = SC+SD
          if 0 < W+S <= F and S <= W*E/100:
            Conc = S/(S+W)
            if Conc > Concmax:
              Concmax= Conc
              Sans = S
              M = S+W
#              print(WA,WB,SC,SD,Conc)
print(M,Sans)

Buggy submission (verdict: Runtime Error):
A, B, C, D, E, F = map(int, input().split())
ans = 0
W = set()
S = set()

for i in range(F):
  x1 = 100 * A * i
  if x1 > F:
    break
  for j in range(F):
    x2 = x1 + 100 * B * j
    if x2 > F or x2 == 0:
      break
    W.add(x2)
for i in range(F):
  y1 = C * i
  if y1 > F:
    break
  for j in range(F):
    y2 = y1 + D * j
    if y2 > F:
      break
    S.add(y2)

W = list(set(W))
S = list(set(S))

for i in range(len(W)):
  for j in range(len(S)):
    tmp = S[j]/W[i]
    tmp1 = S[j] + W[i]
    if tmp1 <= F and ans < tmp <= E/100:
      ans = tmp
      ans1 = tmp1
      ans2 = S[j]
print(ans1, ans2)
Problem p03607 (python)

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
array = []
ans = 0
A.sort()
count = 0

for i in range(N):
  count += 1
  if i == N-1:
    if count%2 == 1:
      ans += 1
#    print(A[i], count, ans)
    
#  elif A[i] == A[i+1]:
#    print(A[i], count, ans)
    
  elif A[i] != A[i+1]:
    if count % 2 == 1:
      ans += 1
#    print(A[i], count, ans)
    count = 0

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for i in range(N)]
array = []
ans = 0

for i in range(N):
  if A[i] not in array:
    array.append(A[i])
    if A.count(A[i]) % 2 == 1:
      ans += 1
  print(i, array, ans)
Problem p03625 (python)

Fixed submission:
import collections 
N = int(input())
A = [int(i) for i in input().split()]
A = collections.Counter(A)
A = sorted(A.items(), key=lambda x:x[0],reverse = True)
e = []

for k,v in A:
  if v >= 4:
    e.append(k)
    e.append(k)
  elif v >= 2:
    e.append(k)
  if len(e) >= 2:
    break
if len(e) < 2:
  ans = 0
else:
  ans = e[0]*e[1]
print(ans)

Buggy submission (verdict: Runtime Error):
import collections 
N = int(input())
A = [int(i) for i in input().split()]
A = collections.Counter(A)
A = sorted(A.items(), key=lambda x:x[0],reverse = True)
e = []

for k,v in A:
  if v >= 4:
    e.append([k]*2)
  elif v >= 2:
    e.append(k)
  if len(e) >= 2:
    break
if len(e) < 2:
  ans = 0
else:
  ans = e[0]*e[1]
print(ans)
Problem p03633 (python)

Fixed submission:
N = int(input())
T = [int(input()) for i in range(N)]

def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

def lcm(m,n):
  return int(m * n // gcd(m,n))

ans = 1
for i in range(N):
    ans = lcm(T[i], ans)

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
T = [int(input()) for i in range(N)]

dvs = []
dvs_all = []

def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

def lcm(m,n):
  return int(m * n / gcd(m,n))

ans = 1
for i in range(N):
    ans = lcm(T[i], ans)

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
T = [int(input()) for i in range(N)]

dvs = []
dvs_all = []

def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

def lcm(m,n):
  return int(m * n / gcd(m,n))

if N == 1:
  ans = T[0]
else:
  for i in range(N - 1):
    T[i+1] = lcm(T[i], T[i+1])
    ans = T[i+1]

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
T = [int(input()) for i in range(N)]

dvs = []
dvs_all = []

def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

def lcm(m,n):
  return int(m * n / gcd(m,n))

if N = 1:
  ans = T[0]
else:
  for i in range(N - 1):
    ans = lcm(T[i], T[i+1])
    T[i+1] = ans

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
T = [int(input()) for i in range(N)]

dvs = []
dvs_all = []

def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

def lcm(m,n):
  return int(m * n / gcd(m,n))

for i in range(N - 1):
  ans = lcm(T[i], T[i+1])
  T[i+1] = ans

print(ans)
Problem p04000 (python)

Fixed submission:
H,W,N = map(int,input().split())
count = []
L = 0
for i in range(N):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    for i in range(max(0,a-2),min(a+1,H-2)):
        for j in range(max(0,b-2),min(b+1,W-2)):
            count.append((i,j))
            L += 1
count.sort()
ans = [0]*10
tmp = 1
for i in range(L-1):
    if count[i] == count[i+1]:
        tmp += 1
    else:
        ans[tmp] += 1
        tmp = 1
if L>=1:
  ans[tmp] += 1
ans[0] = (H-2)*(W-2)-sum(ans)
for i in range(10):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
H,W,N = map(int,input().split())
count = [[0]*(W-2) for i in range(H-2)]
for i in range(N):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    for i in range(max(0,a-2),min(a+1,H-2)):
        for j in range(max(0,b-2),min(b+1,W-2)):
            count[i][j] += 1
ans = [0]*10
for i in range(H-2):
    for j in range(W-2):
        ans[count[i][j]] += 1
for i in range(10):
    print(ans[i])