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

Fixed submission:
import sys

a = map(int,raw_input().strip().split(" "))

if abs(a[0] - a[1]) < abs(a[0] - a[2]):
    print 'A'
else:
    print 'B'

Buggy submission (verdict: Runtime Error):
import sys

for line in sys.stdin:
    x = int(line.split(' ')[0])
    a = int(line.split(' ')[1])
    b = int(line.split(' ')[2])

# print x, a, b

if abs(x % a) > abs(x % b):
    print 'A'
else:
    print 'B'

Buggy submission (verdict: Runtime Error):
import sys

x = int(sys.argv[1])
a = int(sys.argv[2])
b = int(sys.argv[3])

if abs(x % a) > abs(x % b):
    print 'A'
else:
    print 'B'
Problem p03606 (python)

Fixed submission:
N=int(input())
ans=0
for i in range(N):
    a,b=[int(k) for k in input().split()]
    ans+=b-a+1
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
ans=0
for i in range(N):
    a,b=[k for k in input().split()]
    ans+=b-a+1
print(ans)
Problem p03671 (python)

Fixed submission:
number = list(map(int,input().split()))

max = max(number)

number.remove(max)

print(number[0] + number[1])

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(min[a+b,a+c,b+c])

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(min[a+b,a+c,b+c])
Problem p03680 (python)

Fixed submission:
N = int(input())

a_n=[int(input()) for i in range(N)]
import sys

i=1
count=0
for k in range(N):
    if a_n[i-1]==2:
        count+=1
        print(count)
        sys.exit()
    else:
        i=a_n[i-1]
        count+=1

print(-1)

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

a_n=list(map(int,input().split()))
import sys

i=1
count=0
for k in range(N):
    if a_n[i-1]==2:
        count+=1
        print(count)
        sys.exit()
    else:
        i=a_n[i-1]
        count+=1

print(-1)
Problem p03694 (python)

Fixed submission:
N=int(input())
a_n=[int(i) for i in input().split()]

print(max(a_n)-min(a_n))

Buggy submission (verdict: Runtime Error):
N=int(input())
a_n=[int(x) for i in input().split()]

print(max(a_n)-min(a_n))
Problem p03699 (python)

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

ans=sum(s_n)
while ans%10==0:
    if s_n==[]:
        ans=0
        break
    ans-=min(s_n)
    if ans%10==0:
        ans+=min(s_n)
        s_n.remove(min(s_n))


print(ans)

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

ans=sum(s_n)
while ans%10==0:
    ans-=min(s_n)
    if ans%10==0:
        ans+=min(s_n)
        s_n.remove(min(s_n))


print(ans)
Problem p03608 (python)

Fixed submission:
import itertools, math

N, M, R = map(int, input().split())
r = list(map(int, input().split()))

adj = [[float('inf')] * (N + 1) for _ in range(N + 1)]

for m in range(M):
    A, B, C = map(int, input().split())
    adj[A][B] = min(adj[A][B], C)
    adj[B][A] = min(adj[B][A], C)

res = float('inf')

for k in range(1, N + 1):
    for i in range(1, N + 1):
        for j in range(1, N + 1):
            adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j])

for perm in itertools.permutations(r):
    best = 0
    for x, y in zip(perm, perm[1:]):
        best += adj[x][y]
    res = min(res, best)

print(res)

Buggy submission (verdict: Runtime Error):
import itertools
import math

N, M, R = map(int, input().split())
r = list(map(int, input().split()))

adj = [[math.inf]*(N+1) for _ in range(N+1)]

for _ in range(M):
    A, B, C = map(int, input().split())
    adj[A][B] = min(adj[A][B], C)
    adj[B][A] = min(adj[B][A], C)

res = math.inf

for k in range(1, N+1):
    for i in range(1, N+1):
        for j in range(1, N+1):
            adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j])

for perm in itertools.permutations(r):
    best = 0
    for x, y in zip(perm, perm[1:]):
        best += adj[x][y]
    res = min(res, best)

print(res)

Buggy submission (verdict: Runtime Error):
import itertools
import math

N, M, R = map(int, input().split())
r = list(map(int, input().split()))

adj = [[math.inf]*(N+1) for _ in range(N+1)]

for _ in range(M):
    A, B, C = map(int, input().split())
    adj[A][B] = min(adj[A][B], C)
    adj[B][A] = min(adj[B][A], C)

res = math.inf

for k in range(1, N+1):
    for i in range(1, N+1):
        for j in range(1, N+1):
            adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j])

for perm in itertools.permutations(r):
    best = 0
    for x, y in zip(perm, perm[1:]):
        best += adj[x][y]
    res = min(res, best)

print(res)
Problem p03632 (python)

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

if(B < C or D < A):
	print(0)

else:
	if(A > C):
		E = A
	else:
		E = C

	if(B > D):
		F = D
	else:
		F = B

	print(F - E)

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

if(B < C or D < A):
	print(0)

else:
	if(A > C):
		E = A
	else:
		E = C

	if(B > D):
		F = D
	else:
		F = B

print(F - E)
Problem p03648 (python)

Fixed submission:
K = int(input())

b = K % 50
a = K // 50
	
list = [0] * 50
j = 0

while (j <= 49 - b) :
	list[j] = 49 + a - b
	j += 1

while (j <= 49):
	list[j] = 2 * 50 + a - b
	j += 1

list = map(str, list)
print('50')
print(' '.join(list))

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

b = int(K % 50)
a = int((K - b) / 50)
	
list = [0] * 50
j = print(' '.join(list))0

while (j <= 49 - b) :
	list[j] = 49 + a - b
	j += 1

while (j >49 - b and j <= 49):
	list[j] = 2 * 50 + a - b
	j += 1


list = map(str, list)
print('50')

Buggy submission (verdict: Runtime Error):
K = int(input())
a = 0
b = 0

for i in range(1, 51):
	if (K - K % i) / i + i - 1 >= 1000 + 10**16:
		break

	b = int(K % i)
	a = int((K - b) / i)
	N = i
	


list = [0] * N
j = 0


print(a, b, N)


while (j <= N - b - 1) :
	list[j] = N + a - b - 1
	j += 1

while (j > N - b - 1 and j <= N - 1):
	list[j] = 2 * N - b
	j += 1


list = map(str, list)
print(' '.join(list))
Problem p03605 (python)

Fixed submission:
num = input()
num = str(num)
isthere = False
for i in range(0, 2):
	if num[i] == '9':
		isthere = True

if isthere:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
num = input()
num = str(num)
isthere = False
for i in range(0, 2):
	if num[i] == '9':
		isthere = True

if isthere:
	print('Yes')
else:
	print('No')

input()
Problem p03633 (python)

Fixed submission:
#coding=UTF-8
#import math
import fractions

N=int(input())
ans=1
for idx in range(0,N,1):
    T=int(input())
    ans=ans*T// fractions.gcd(ans,T)

print(ans)

Buggy submission (verdict: Runtime Error):
#coding=UTF-8
import math

N=int(input())
ans=1
for idx in range(0,N,1):
    T=int(input())
    ans=ans*T// math.gcd(ans,T)

print(ans)
Problem p03700 (python)

Fixed submission:
#coding=UTF-8
myon_chache={}
def turn_check(zikan,direct,around):
    nokori_naka=zikan
    for idx in range(0,N,1):
        rem_hp=kirei_HP[idx]-around*zikan
        if rem_hp > 0:
            if rem_hp in myon_chache:
                myon=myon_chache[rem_hp]
            else:
                myon= rem_hp//(direct-around) + (0 if rem_hp%(direct-around)==0 else 1)
                myon_chache[rem_hp]=myon
        
            nokori_naka=nokori_naka-myon
            if nokori_naka < 0:
                return False
        else: #以降も周辺攻撃のみで倒せる
            return True

    return True


mozir=input()
hyo=mozir.split(' ')
N=int(hyo[0])
A=int(hyo[1])
B=int(hyo[2])

HP=[]
for idx in range(0,N,1):
    HP.append(int(input()))

kirei_HP=sorted(HP,reverse=True)
dmg_mean= B
kagen=kirei_HP[0]// dmg_mean + 1
tansaku=kagen//2
ite=0
dame_jogen=0
while True:
    ite=ite+1
    if turn_check(tansaku,A,B):
        kagen=tansaku
        tansaku=(kagen+dame_jogen)//2
    else:
        if tansaku + 1 == kagen: #丁度境目を見付けたら
            break
        else:
            dame_jogen=tansaku
            tansaku=(tansaku+kagen)//2

#print(ite)
print(kagen)

Buggy submission (verdict: Runtime Error):
#coding=UTF-8
#ぎりぎり間に合わないので少しがんばってみる
def turn_check(zikan):
    nokori_naka=zikan
    for idx in range(0,N,1):
        rem_hp=kirei_HP[idx]-around*zikan
        if rem_hp > 0:
        
            nokori_naka=nokori_naka-(rem_hp//dmgsa + (0 if rem_hp%dmgsa==0 else 1))
            if nokori_naka < 0:
                return False
        else: #以降も周辺攻撃のみで倒せる
            return True

    return True


mozir=input()
hyo=mozir.split(' ')
N=int(hyo[0])
A=int(hyo[1])
B=int(hyo[2])

HP=[]
for idx in range(0,N,1):
    HP.append(int(input()))

kirei_HP=sorted(HP,reverse=True)
kagen=kirei_HP[0]// A + 1

tansaku=kagen//2
dmgsa=A-B
while True:
    if turn_check(tansaku):
        kagen=tansaku
        tansaku=kagen//2
    else:
        if tansaku + 1 == kagen: #丁度境目を見付けたら
            break
        else:
            tansaku=(tansaku+kagen)//2

print(kagen)
Problem p03722 (python)

Fixed submission:
#coding=UTF-8

#ゴールに関係無い袋小路で永パされると、探索が収束しない
#かつ答えがinfでないということで 修正

#表にあるかを尋ねるのが重いので
#データ構造を変えて回避する
mozir=input()
hyo=mozir.split(' ')

N=int(hyo[0])
M=int(hyo[1])

#idx番目の都市に繋っている道とコストのタプルを持つリスト
tuuro=[]
# [] はコピーがしんどいものだったりするので
# 参照でごまかしたりしてくる
# なので1個づつ書いている
for idx in range(0,N,1):
    tuuro.append([])


A=[]
B=[]

for idx in range(0,M,1):
    mozir=input()
    hyo=mozir.split(' ')
    tuuro[int(hyo[0])-1].append((int(hyo[1])-1,int(hyo[2])))

#print(tuuro)
#普通の経路探索のようなことをする
#永パ
tmp_score=[None]*N #マイナス点のときもある
tmp_score[0]=0
tansaku=[0]
loopconut=0
while len(tansaku) > 0:
    loopconut=loopconut+1
    next_tansaku=[]
    for mono in tansaku:
        for deru in tuuro[mono]:
            kouho_ten=tmp_score[mono]+deru[1]
            if tmp_score[deru[0]] == None or kouho_ten > tmp_score[deru[0]]:
                tmp_score[deru[0]]=kouho_ten
                next_tansaku.append(deru[0])

    tansaku=list(set(next_tansaku))
    if loopconut==N-1:
        tmp_ans=tmp_score[N-1] #cannot be None
    elif loopconut==2*N-1:
        #period must be eqal or less than N
        if tmp_score[N-1] > tmp_ans:
            print('inf')
            break
        else:
            #関係の無い無限ループ
            print(tmp_score[N-1])
            break
else:
    print(tmp_score[N-1])

Buggy submission (verdict: Runtime Error):
#coding=UTF-8


mozir=input()
hyo=mozir.split(' ')

N=int(hyo[0])
M=int(hyo[1])

A=[]
B=[]
Cost=[]
for idx in range(0,M,1):
    mozir=input()
    hyo=mozir.split(' ')
    A.append(int(hyo[0])-1)
    B.append(int(hyo[1])-1)
    Cost.append(int(hyo[2]))
    
#先ず得点が正になるループを探す
eipap=False
for idx in range(0,N,1):
    tansaku=[(idx,0)]
    while len(tansaku) > 0:
        next_tansaku=[]
        for mono in tansaku:
            for idy in range(0,M,1):
                if A[idy]==mono[0]:
                    #add only if better
                    appendp=True
                    for butu in next_tansaku:
                        if B[idy] == butu[0]:
                            #already exsists
                            appendp=False
                            if butu[1] > mono[1]+Cost[idy]:
                                butu[1]=mono[1]+Cost[idy]
                    if appendp:
                        next_tansaku.append((B[idy],mono[1]+Cost[idy]))
        #print(next_tansaku)
        
        for tenn in next_tansaku:
            if tenn[0]==idx and tenn[1]>0:
                eipap=True
                break

        if eipap:
            break
        else:
            tansaku=next_tansaku

if eipap:
    print('inf')
else:
    #無ければ、普通の経路探索のようなことをする
    tmp_score=[None]*N #マイナス点のときもある
    tmp_score[0]=0
    tansaku=[0]
    while len(tansaku) > 0:
        next_tansaku=[]
        for mono in tansaku:
            for idy in range(0,M,1):
                if A[idy]==mono:
                    kouho_ten=tmp_score[mono]+Cost[idy]
                    if tmp_score[B[idy]] == None or kouho_ten > tmp_score[B[idy]]:
                        tmp_score[B[idy]]=kouho_ten
                        next_tansaku.append(B[idy])

        tansaku=next_tansaku

    print(tmp_score[N-1])
Problem p03605 (python)

Fixed submission:
inp = input()

if '9' in inp:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
inp = input()

in1 = inp // 10
in2 = inp % 10
if in1 == 9 or in2 == 9:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
inp = input()

inp = str(in)
if '9' in inp:
  print('YES')
else:
  print('NO')
Problem p03635 (python)

Fixed submission:
n, m = map(int, input().split())
print((m - 1) * (n - 1))

Buggy submission (verdict: Runtime Error):
print( ( int(input()) - 1 ) * ( int(input()) - 1) )
Problem p03607 (python)

Fixed submission:

N = int(input())
x = [int(input()) for i in range(N)]

x.sort()
i=0
while i < N-1:
    if x[i]==x[i+1]:
        del x[i+1]
        del x[i]
        N-=2
        continue
    i+=1
print(len(x))

Buggy submission (verdict: Runtime Error):

N = int(input())
x=int(input())
y=[x]


for i in range(1,N):
    x=int(input())
    a=0
    flag=1
    while a < i:
        if y[a]==x:
            del y[a]
            flag=-1
            break
        a+=1
    if flag==1:
        y.append(x)

print(len(y))

Buggy submission (verdict: Runtime Error):

N = int(input())
x = [int(input()) for i in range(N)]

y=[0]*(100000+1)


for i in range(N):
    if y[x[i]]==0:
        y[x[i]]=1
    else:
        y[x[i]]=0

sum=0
for i in y:
    sum+=i

print(sum)
Problem p03625 (python)

Fixed submission:

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

y=sorted(x)
width=[0,0]
height=[0,0]


for i in range(0,len(y)-1):
    if (y[len(y)-1-i]==y[len(y)-2-i] and width[0]==0):
        width[0]=y[len(y)-1-i]
        width[1]=len(y)-1-i
        continue
    if (width!=0 and y[len(y)-1-i]==y[len(y)-2-i]):
        if(len(y)-1-i==width[1]-1):
            continue
        height[0]=y[len(y)-1-i]
        break



print('{0}'.format(int(width[0])*int(height[0])))



quit()

Buggy submission (verdict: Runtime Error):

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

def quicksort(x):
    if x==[]: return []

    smallerSorted = quicksort([a for a in x[1:] if a <= x[0]])
    biggerSorted = quicksort([a for a in x[1:] if a > x[0]])

    return(smallerSorted+[x[0]]+biggerSorted)


y = quicksort(x)
width=[0,0]
height=[0,0]


for i in range(0,len(y)-1):
    if (y[len(y)-1-i]==y[len(y)-2-i] and width[0]==0):
        width[0]=y[len(y)-1-i]
        width[1]=len(y)-1-i
        continue
    if (width!=0 and y[len(y)-1-i]==y[len(y)-2-i]):
        if(len(y)-1-i==width[1]-1):
            continue
        height[0]=y[len(y)-1-i]
        break



print('{0}'.format(int(width[0])*int(height[0])))



quit()
Problem p03606 (python)

Fixed submission:
def theater():
    total = 0
    try:
        N = int(input())
        l_r = (list(map(lambda x: int(x), input().split(' '))) for elem in range(N))
    except:
        return
    if not (1 <= N and N <= 1000): return
    for l, r in l_r:
        if 1 <= l and l <= 100000 or 1 <= r and r <= 100000:
            total += r - l + 1
        else:
            return
    print(total)

if __name__ == "__main__":
    theater()

Buggy submission (verdict: Runtime Error):

def theather():
  total = 0
  try:
    N = int(input())
    l_r = (list(map(lambda x: int(x), input().split(' '))) for _ in range(N))
  except:
    return
  if not (1 <= N and N <= 1000): return
  for l, r in l_r:
    if 1 <= l and l <= 100000 or 1 <= r and r <= 100000:
      total += r - l + 1
    else:
      return
  print(total)

if __name__ == "__main__":
  theater()
Problem p03611 (python)

Fixed submission:
# -*- encoding: utf-8 -*-
n = int(input().rstrip())
array = sorted(list(map(int, input().split(' '))))
count = [0] * 100002

for a in array:
    count[a - 1] += 1
    count[a    ] += 1
    count[a + 1] += 1

print(max(count))

Buggy submission (verdict: Runtime Error):
# -*- encoding: utf-8 -*-
n = int(input().rstrip())
array = list(map(int, input().rstrip().split(' ')))
count = [0] * 100000

for a in array:
    count[a - 1] += 1
    count[a    ] += 1
    count[a + 1] += 1

print(max(count))

Buggy submission (verdict: Runtime Error):
# -*- encoding: utf-8 -*-
n = int(input().rstrip())
array = sorted(list(map(int, input().rstrip().split(' '))))
count = [0] * (10 ** 5)

for a in array:
    count[a - 1] += 1
    count[a    ] += 1
    count[a + 1] += 1

print(max(count))
Problem p03609 (python)

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

print(max(x-t,0))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
cnt=0
for i in range(len(a)):
    if i < len(a):
        if a[i] == i+1:
            inter=a[i]
            a[i]=a[i+1]
            a[i+1]=inter
            cnt +=1
        continue
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
cnt=0
for i in range(len(a)):
    if i+1 < N:
        if a[i] == i+1:
            inter=a[i]
            a[i]=a[i+1]
            a[i+1]=inter
            cnt +=1
        continue
print(cnt)

Buggy submission (verdict: Runtime Error):
s=str(input())
x=list(s)
out=""
for i in range(x):
	if (i+1) % 2 ==0:
		out+=x[i]
print(out)

Buggy submission (verdict: Runtime Error):
s=str(input())
x=list(s)
out=""
for i in range(x):
	if (i+1) % 2 !=1:
		out+=x[i]
print(out)

Buggy submission (verdict: Runtime Error):
s=str(input())
x=list(s)
out=""
for  i in len(x):
 if (i+1) % 2 !=1:
  out+=x[i]
print(out)

Buggy submission (verdict: Runtime Error):
s=str(input())
x=list(s)
out=str()
for  i in len(x):
 if (i+1) % 2 !=1:
  out+=x[i]
print(out)

Buggy submission (verdict: Runtime Error):
x,t=input().split()
 
print(max(x-t,0))

Buggy submission (verdict: Runtime Error):
X,t=input().split

print(max(X-t,0))

Buggy submission (verdict: Runtime Error):
X, t=input(int, split())

print(max(X-t),0)

Buggy submission (verdict: Runtime Error):
X=input("入力1")
t=input("入力2")
 
y=X-t
 
print(max(y,0))

Buggy submission (verdict: Runtime Error):
X=input("入力1")
t=input("入力2")

y=X-t

print(y)
Problem p03610 (python)

Fixed submission:
s=input()
x=list(s)
out=""
for i in range(len(x)):
	if i % 2 ==0:
		out+=x[i]
print(out)

Buggy submission (verdict: Runtime Error):

s=str(input())
x=list(s)
if i in len(x):
Problem p03611 (python)

Fixed submission:
N=int(input())
a = list(map(int, input().split()))
cnt=[0]*100009
for t in a:
    cnt[t] += 1
    cnt[t-1] += 1
    cnt[t+1] += 1
print(max(cnt))

Buggy submission (verdict: Runtime Error):
N=int(input())
a = list(map(int, input().split()))
cnt=[0]*10009
for t in a:
    cnt[t] += 1
    cnt[t-1] += 1
    cnt[t+1] += 1
print(max(cnt))

Buggy submission (verdict: Runtime Error):
N=int(input())
a = list(map(int, input().split()))
cnt=[0]*10000
for t in a:
    cnt[t] += 1
    cnt[t-1] += 1
    cnt[t+1] += 1
print(max(cnt))

Buggy submission (verdict: Runtime Error):
N=int(input())
a = list(map(int, input().split()))
cnt=[0]*10000
for t in a:
    cnt[t] += 1
    cnt[t-1] += 1
    cnt[t+1] += 1
print(max(cnt))

Buggy submission (verdict: Runtime Error):
N=int(input())
a = list(map(int, input().split()))
cnt=[0]*10000
print(a)
for t in a:
    cnt[t] += 1
    cnt[t-1] += 1
    cnt[t+1] += 1
print(max(cnt))

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
cnt=[0]*10000
print(a)
for t in a:
    cnt[t] += 1
    cnt[t-1] += 1
    cnt[t+1] += 1
print(max(cnt))
Problem p03612 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
cnt=0
for i in range(N):
    if a[i] == i+1:
        if i+1 == N:
            inter=a[i]
            a[i]=a[i-1]
            a[i-1]=inter
        else:
            inter=a[i]
            a[i]=a[i+1]
            a[i+1]=inter
        cnt +=1
print(cnt)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
cnt=0
for i in range(len(a)):
    if i < len(a):
        if a[i] == i+1:
            inter=a[i]
            a[i]=a[i+1]
            a[i+1]=inter
            cnt +=1
        continue
print(cnt)

Buggy submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(len(a)):
    if a[i] == i+1:
        int=a[i+1]
        a[i]=a[i+1]
        a[i+1]=int
        cnt +=1
print(cnt)
Problem p03625 (python)

Fixed submission:
from collections import Counter
 
N = int(input())
A = list(map(int, input().split()))
h = w = 0
 
for i, cnt in Counter(A).items():
    if cnt >= 2 and i > w:
        if i > h:
            if cnt >= 4:
                h = i
                w = i
            else:
                w = h
                h = i
        else:
            w = i
            
print(w * h)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
a=list(map(int, input().split()))
h = w = 0
 
for i, cnt in Counter(a).items:
    if cnt >= 2 and i > w:
        if i > h:
            if cnt >= 4:
                h = i
                w = i
            else:
                w = h
                h = i
        else:
            w = i
            
print(w * h)

Buggy submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
c=[]
a=list(map(int, input().split()))
s=sorted(set(a), reverse=True)
 
for i, cnt in Counter(a).items:
    if cnt >= 2 and i > w:
        if i > h:
            if cnt >= 4:
                h = i
                w = i
            else:
                w = h
                h = i
        else:
            w = i
            
print(w * h)
Problem p03633 (python)

Fixed submission:
def gcd(a,b):
    #a=min(a,b)
    #b=max(a,b)
    while b:
        a,b= b, a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)
T=[]
N=int(input())
for i in range(N):
    T.append(int(input()))

ans=1
for t in T:
    ans=lcm(ans, t)

print(int(ans))

Buggy submission (verdict: Runtime Error):
def gcd(a,b):
    a=min(a,b)
    b=max(a,b)
    while b:
        a,b= b, a%b
    return a

def lcm(a,b):
    return a*b//gcd(a,b)

N=int(input())
for i in range(N):
    T.append(int(input()))

ans=1
for t in range(N):
    ans=lcm(ans,T[i])
            
print(ans)
Problem p03693 (python)

Fixed submission:
x = "".join(input().split())
x = int(x)
if x % 4 == 0:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
input(); print((lambda xs: max(xs) - min(xs))([int(x) for x in input().split()]))

Buggy submission (verdict: Runtime Error):
print("YES" if int("".join(input())) % 4 == 0 else "NO)
Problem p03694 (python)

Fixed submission:
n = int(input())
points = [int(x) for x in input().split()]
points.sort()
print(points[-1] - points[0])

Buggy submission (verdict: Runtime Error):
input(); print((lambda xs: max(xs) - min(xs))[int(x) for x in input().split()])
Problem p03695 (python)

Fixed submission:
# -* encode: utf-8 *-

N = int(input())
rates = [int(x) for x in input().split()]

rates.sort()
uppers = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 4800]
accum = list()
counts = list()

for upper in uppers:
    accum.append(len([x for x in rates if x <= upper]))

counts.append(accum[0])
for i in range(1, 9):
    counts.append(accum[i] - accum[i-1])

_least = sum([1 for count in counts[:-1] if count > 0])
max_scorerer = counts[-1]

if _least == 0:
    least = 1
    most = max_scorerer
else:
    least = _least
    most = least + max_scorerer

print("{} {}".format(least, most))

Buggy submission (verdict: Runtime Error):
input()
rates = sorted([int(x) for x in input().split()])
counts = []
for boundary in [399, 799, 1199, 1599, 1999, 2399, 2799, 3199]:
    counts.append(1 if rates[0] <= boundary else 0)
    rates = [rate for rate in rates if rate > boundary]
higher = len(rates)
least = sum(counts)
print("{} {}".format(1 if least == 0 else least, least+higher))

Buggy submission (verdict: Runtime Error):
boundaries = [399, 799, 1199, 1599, 1999, 2399, 2799, 3199, 4800]
input()
rates = sorted([int(x) for x in input().split()])
counts = []
for boundary in boundaries:
    tmp = 0
    while rates[0] <= boundary:
        tmp += 1
        rates.pop(0)
    counts.append(tmp)
least = sum([x > 0 for x in counts[:-1]])
print("{} {}".format(1 if least == 0 else least, counts[-1]+least))