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

Fixed submission:
n=int(input())
v=list(map(int, input().split()))
dp=[[-1] * n for i in range(n)]
def f(a, b):
    if a > b:
        return 0
    elif a == b:
        return v[a]
    elif dp[a][b] == -1:
        c1 = v[a] + min(f(a + 2, b), f(a + 1, b - 1))
        c2 = v[b] + min(f(a, b - 2), f(a + 1, b - 1))
        dp[a][b] = max(c1, c2)
    return dp[a][b]

print(2*f(0, n-1) - sum(v))

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int, input().split()))
dp=[[-1] * n for i in range(n)]
def f(a, b):
    if a > b:
        return 0
    elif a == b:
        return v[a]
    elif dp[a][b] == -1:
        c1 = v[a] + min(f(a + 2, b), f(a + 1, b - 1))
        c2 = v[b] + min(f(a, b - 2), f(a + 1, b - 1))
        dp[a][b] = max(c1, c2)
    return dp[a][b]

print(2*f(0, n-1) - sum(v))
Problem p02969 (python)

Fixed submission:
x = int(input())
print(3 * x ** 2)

Buggy submission (verdict: Runtime Error):
x = input()
print(3 * x ** 2)
Problem p03000 (python)

Fixed submission:
N,X=map(int,input().split())
L=[0]+list(map(int,input().split()))
ans=0
tmp=0
for i in range(N+1):
    tmp+=L[i]
    if tmp>X:
        break
    else:
        ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):
N,X=map(int,input().split())
L=list(map(int,input().split()))
ans=0
tmp=0
for i in range(N+1):
    if tmp>X:
        break
    tmp+=L[i]
    ans+=1
print(ans)
Problem p03006 (python)

Fixed submission:
import collections 
N=int(input())
T=[list(map(int,input().split())) for _ in range(N)]
T.sort(reverse=True)
TMP=[]
if N==1:
    print(1)
else:
    for i in range(N-1):
        for b in range(i,N-1):
            TMP.append((T[i][0]-T[b+1][0],T[i][1]-T[b+1][1]))
    c=collections.Counter(TMP)
    print(N-c.most_common(n=1)[0][1])

Buggy submission (verdict: Runtime Error):
import collections 
N=int(input())
T=[list(map(int,input().split())) for _ in range(N)]
T.sort(reverse=True)
TMP=[]
if N==1:
    print(1)
else:
    for i in range(N-1):
        for b in range(i,N-1):
            TMP.append((T[i][0]-T[b+1][0],T[i][1]-T[b+1][1]))
c=collections.Counter(TMP)
print(N-c.most_common(n=1)[0][1])
Problem p03059 (python)

Fixed submission:
A,B,T=map(int,input().split())
print(int((T+0.5)//A*B))

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
ans=0
c=0
tmp=10**9
for a in A:
    if a<0:
        c+=1
    ans+=abs(a)
    tmp=min(tmp,abs(a))
if c%2==0:
    print(ans)
else:
    print(ans-tmp*2)
Problem p03063 (python)

Fixed submission:
N=int(input())
S=input()
num=S.count(".")
ans=num
for i in S:
    if i=="#":
        num+=1
    else:
        num-=1
    ans=min(ans,num)
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
i=S.index(".")
if i==0:
    print(0)
else:
    print(S.count("."))
Problem p03206 (python)

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

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split(" "))
H=[int(input()) for _ in range(N)]
H.sort()
tmax=10**9
for a in range(N-K+1):
    h1,h2=H[a],H[a+K]
    tmax=min(tmax,abs(h1-h2))
    if(tmax==0):
        break
print(tmax)
Problem p03284 (python)

Fixed submission:
N,K=map(int,input().split())
if(N%K==0):
  print(0)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
if(N%K==0):
  print(0)
 else:
  print(1)
Problem p03846 (python)

Fixed submission:
from collections import Counter
N=int(input())
A=list(map(int,input().split()))
ans=0
if N%2!=0:
    c=list(Counter(A).items())
    c.sort(reverse=True)
    for a,b in c:
        if a!=0 and b==2:
            ans+=1
        elif a==0 and b==1:
            print(2**ans%(10**9+7))
        else:
            print(0)
            break
else:
    if A.count(0)>0:
        print(0)
    else:
        c=list(Counter(A).items())
        c.sort(reverse=True)
        for a,b in c:
            if a!=1 and b==2:
                ans+=1
            elif a==1 and b==2:
                ans+=1
                print(2**ans%(10**9+7))
            else:
                print(0)
                break

Buggy submission (verdict: Runtime Error):
from collections import Counter
N=int(input())
A=list(map(int,input().split()))
ans=0
if N%2!=0:
    c=list(Counter(A).items())
    c.sort(reverse=True)
    for a,b in c:
        if a!=0 and b==2:
            ans+=1
        elif a==0 and b==1:
            print(2**ans/(10**9+7))
        else:
            print(0)
            break
else:
    if A.count(0)>0:
        print(0)
    else:
        c=list(Counter(A).items())
        c.sort(reverse=True)
        for a,b in c:
            if a!=1 and b==2:
                ans+=1
            elif a==1 and b==2:
                ans+=1
                print(2**ans/(10**9+7))
            else:
                print(0)
                break
Problem p02909 (python)

Fixed submission:
s = input()

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

Buggy submission (verdict: Runtime Error):
ss = input().split()
N = int(ss[0])
K = int(ss[1])
Q = int(ss[2])
As = []

SCORE = [0] * N

for i in range(Q):
  SCORE[int(input())-1] += 1
for i in range(N):
  if(SCORE[i]<= Q-K):
    print("No")
  else:
    print("Yes")
Problem p03029 (python)

Fixed submission:
A, P = input().strip().split()

ans = int((int(A) * 3  + int(P))/2)


print(ans)

Buggy submission (verdict: Runtime Error):
A = input()
P = input()
ans = int((int(A) * 3  + int(P))/2)


print(ans)

Buggy submission (verdict: Runtime Error):
apple = input()
kakera = input()
ans = int((int(apple) * 3  + int(kakera))/2)


print(ans)
Problem p02900 (python)

Fixed submission:
import math as m
import fractions

A, B = list(map(int, input().split()))
#A , B = 12, 18

def sieve_of_eratosthenes(n):
    candidate = [1 for i in range(n+1)]
    candidate[0] = 0
    candidate[1] = 0
    for i in range(len(candidate)):
        if (candidate[i] == 0):
            continue
        j = 2
        while j * i < len(candidate):
            candidate[i * j] = 0
            j = j + 1
    primes = [i for i in range(n) if candidate[i] == 1]
    return primes

def prime_factorize(A):
    p = sieve_of_eratosthenes(m.floor(A**0.5))
    a = [0 for i in p]
    for i in range(len(p)):
        if A % p[i] != 0:
            a[i] = 0
        else:
            temp = A
            while temp % p[i] == 0:
                temp = temp / p[i]
                a[i] = a[i] + 1
    return a

#pf = prime_factorize(fractions.gcd(A, B))
# num = 1

# for x in pf:
#     if x >= 1:
#         num = num + 1



# print(num)

g = fractions.gcd(A,B)
primes = []
num = 1

if True:
    i = 2
    while i * i <= g:
        if (g % i == 0):
            cnt = 0
            while g % i == 0:
                cnt = cnt + 1
                g = g // i
            primes.append([i, cnt])
        i = i + 1
    if (g != 1):
        primes.append([g, 1])
print(len(primes)+1)

Buggy submission (verdict: Runtime Error):
import math as m

A, B = list(map(int, input().split()))
#A , B = 12, 18
def lcm(a, b):
    return (A * B) // m.gcd(A, B)

def sieve_of_eratosthenes(n): # n以下の素因数を求める
    candidate = [1 for i in range(n+1)]
    candidate[0:2] = [0 , 0]
    for i in range(len(candidate)):
        if (candidate[i] == 0):
            continue
        j = 2
        while j * i < len(candidate):
            candidate[i * j] = 0
            j = j + 1
    primes = [i for i in range(n) if candidate[i] == 1]
    return primes

def prime_factorize(A):
    p = sieve_of_eratosthenes(A)
    a = [0 for i in p]
    for i in range(len(p)):
        if A % p[i] != 0:
            a[i] = 0
        else:
            temp = A
            while temp % p[i] == 0:
                temp = temp / p[i]
                a[i] = a[i] + 1
    return a

pf = prime_factorize(m.gcd(A, B))
num = 1

for x in pf:
    if x >= 1:
        num = num + 1

print(num)
Problem p03030 (python)

Fixed submission:
n = int(input())
list = []
for xi in range(n):
    add1, add2 = input().split()
    add = [int(add2), add1, xi+1]
    list.append(add)
list.sort(key=lambda list2: list2[1])


name = list[0][1]
list2 = [list[0]]
count = 1
for xi in range(1,n):
    if name == list[xi][1]:
        list2.append(list[xi])
        count += 1
    else:
        list2.sort()
        for yi in range(count-1,-1,-1):
            print(list2[yi][2])
        name = list[xi][1]
        list2 = [list[xi]]
        count = 1

if len(list2)<n:
    list2.sort()
for yi in range(count-1,-1,-1):
    print(list2[yi][2])
name = list[xi][1]
list2 = [list[xi]]
count = 1

Buggy submission (verdict: Runtime Error):
n = int(input())
list = []
for xi in range(n):
    add1, add2 = input().split()
    add = [add2, add1, xi+1]
    list.append(add)
list.sort(key=lambda list2: list2[1])


name = list[0][1]
list2 = [list[0]]
count = 1
for xi in range(1,n):
    if name == list[xi][1]:
        list2.append(list[xi])
        count += 1
    else:
        list2.sort(key=int, reverse=True)
        for yi in range(count-1,-1,-1):
            print(list2[yi][2])
        name = list[xi][1]
        list2 = [list[xi]]
        count = 1

if len(list2)<n:
    list2.sort(key=int, reverse=True)
for yi in range(count-1,-1,-1):
    print(list2[yi][2])
name = list[xi][1]
list2 = [list[xi]]
count = 1

Buggy submission (verdict: Runtime Error):
n = int(input())
list = []
for xi in range(n):
    add1, add2 = input().split()
    add = [add2, add1, xi+1]
    list.append(add)
list.sort(key=lambda list2: list2[1])

print(list)

name = list[0][1]
list2 = [list[0]]
count = 1
for xi in range(1,n):
    if name == list[xi][1]:
        list2.append(list[xi])
        count += 1
    else:
        list2.sort(key=int, reverse=True)
        for yi in range(count-1,-1,-1):
            print(list2[yi][2])
        name = list[xi][1]
        list2 = [list[xi]]
        count = 1

if len(list2)<n:
    list2.sort(key=int, reverse=True)
for yi in range(count-1,-1,-1):
    print(list2[yi][2])
name = list[xi][1]
list2 = [list[xi]]
count = 1
Problem p02996 (python)

Fixed submission:
n=int(input())
l=[]
for i in range(n):
    x,y=map(int,input().split())
    l.append([x,y])

l=sorted(l,key=lambda x:x[1])
t=0
ans='Yes'
for i in range(n):
    if t+l[i][0]<=l[i][1]:
        t+=l[i][0]
    else:
        ans='No'
print(ans)

Buggy submission (verdict: Runtime Error):
for i in range(n):
    x,y=map(int,input().split())
    l.append([x,y])

l=sorted(l,key=lambda x:x[1])
t=0
ans='Yes'
for i in range(n):
    if t+l[i][0]<=l[i][1]:
        t+=l[i][0]
    else:
        ans='No'
print(ans)
Problem p03006 (python)

Fixed submission:
from itertools import combinations as c
from collections import Counter

n=int(input())
l=[]
for i in range(n):
    x,y=map(int,input().split())
    l.append([x,y])

if n==1:
    print(1)
else:
    l.sort()
    m=c(l,2)
    ans=[]
    for v in m:
        ans.append(str([v[1][0]-v[0][0],v[1][1]-v[0][1]]))
    a=Counter(ans).most_common()[0][1]
    print(n-a)

Buggy submission (verdict: Runtime Error):
from itertools import combinations as c
from collections import Counter

n=int(input())
l=[]
for i in range(n):
    x,y=map(int,input().split())
    l.append([x,y])

l.sort()
m=c(l,2)
ans=[]
for v in m:
    ans.append(str([v[1][0]-v[0][0],v[1][1]-v[0][1]]))
a=Counter(ans).most_common()[0][1]
print(n-a)
Problem p03078 (python)

Fixed submission:
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(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

l=[]
for s in range(x):
    for t in range(y):
        for u in range(z):
            if (s+1)*(t+1)*(u+1)<= k:
                l.append(a[s]+b[t]+c[u])
            else:
                break
l.sort(reverse=True)
for i in range(k):
    print(l[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(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

l=[]
for s in range(a):
    for t in range(b):
        for u in range(c):
            if (s+1)*(t+1)*(u+1)<= k:
                l.append(a[s]+b[t]+c[u])
            else:
                break
l.sort(reverse=True)
for i in range(k):
    print(l[i])
Problem p03212 (python)

Fixed submission:
n=int(input())
def dfs(s):
  if int(s) > n:
    return 0
  if all(s.count(c) > 0 for c in '753'):
    ret=1
  else:
    ret=0 # s 自体が七五三数なら +1 
  for c in '753':
    ret += dfs(s + c)
  return ret
print(dfs('0'))

Buggy submission (verdict: Runtime Error):
n=int(input())
def dfs(s):
  if int(s) > N:
    return 0
  if all(s.count(c) > 0 for c in '753'):
    ret=1
  else:
    ret=0 # s 自体が七五三数なら +1 
  for c in '753':
    ret += dfs(s + c)
  return ret
print(dfs('0'))

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0
if n<10**8:
  if n%2==0:
    for i in range(1,n-1,2):
      sum3=0
      sum5=0
      sum7=0
      x=str(i)
      l=len(x)
      for j in range(l):
        if x[j]=='3':
          sum3 += 1
        elif x[j]=='5':
          sum5 += 1
        elif x[j]=='7':
          sum7 += 1
        if (sum3 + sum5 + sum7 == l) and (sum3>0) and(sum5>0) and (sum7>0):
          ans+=1
  else:
    for i in range(1,n,2):
      sum3=0
      sum5=0
      sum7=0
      x=str(i)
      l=len(x)
      for j in range(l):
        if x[j]=='3':
          sum3 += 1
        elif x[j]=='5':
          sum5 += 1
        elif x[j]=='7':
          sum7 += 1
        if (sum3+sum5+sum7==l) and (sum3>0) and(sum5>0) and (sum7>0):
          ans+=1
print(ans)
else:
print(0)
Problem p03231 (python)

Fixed submission:
from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
x=gcd(n,m)
l=n*m//gcd(n,m)
for i in range(x):
    if s[i*(n//x)]!=t[i*(m//x)]:
        print(-1)
        exit()
print(l)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
l=n*m//gcd(n,m)
x=['']*l
ans=l
for i in range(n):
    x[i*(l//n)]=s[i]
for j in range(m):
    if x[j*(l//m)]!='':
        if x[j*(l//m)]!=t[j]:
            ans=-1
            break
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
l=n*m//gcd(n,m)
x=[0]*l
ans=l
for i in range(n):
    x[i*(l//n)]=s[i]
for j in range(m):
    if x[j*(l//m)]!=0:
        if x[j*(l//m)]!=t[j]:
            ans=-1
            break
    else:
        pass
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
l=n*m//gcd(n,m)
x=[0]*l
ans=l
for i in range(n):
    x[i*(l//n)]=s[i]
for j in range(m):
    if x[j*(l//m)]!=0:
        if x[j*(l//m)]!=t[j]:
            ans=-1
            break
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd

n,m=map(int,input().split())
s=input()
t=input()
l=n*m//gcd(n,m)
x=[0]*(l)
for i in range(n):
    x[i*(l//n)]=s[i]
for j in range(m):
    if x[j*(l//m)]!=0:
        if x[j*(l//m)]!=t[j]:
            print(-1)
            exit()
print(l)
Problem p03238 (python)

Fixed submission:
n=int(input())
if (n==1):
  print('Hello World')
else:
  a=int(input())
  b=int(input())
  print(a+b)

Buggy submission (verdict: Runtime Error):
n,t=map(int, input().split())
l=[input().split() for i in range(n)]

k=[]

for x in range(n):
  if (int(l[x][1])<=t):
    k.append(l[x][0])
  
if (k==[]):
  print('TLE')
else:  
  print(min(k))
Problem p03239 (python)

Fixed submission:
n,t=map(int, input().split())
l=[input().split() for i in range(n)]

k=[]

for x in range(n):
  if (int(l[x][1]) <= t):
    k.append(int(l[x][0]))
  
if (k==[]):
  print('TLE')
else:  
  print(min(k))

Buggy submission (verdict: Runtime Error):
n,t=map(int, input().split())
l=[input().split() for i in range(n)]

k=[]

for x in range(n):
  if (int(l[x][1])<t):
    k.append(l[x][0])
    
print(min(k))
Problem p03241 (python)

Fixed submission:
import math

n,m=map(int,input().split())
if n==1:
        print(m)
else:
        l=[]
        for i in range(1,math.floor(m**0.5)+1):
           if m%i==0 and i<=m//n:
                l.append(i)
                if m//i<=m//n:
                        l.append(m//i)
        l.sort()
        print(l[-1])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
if n==1:
        print(m)
else:
        max=1
        for i in range(1,m//n+1):
        if m%i==0:
                max=i
        print(max)

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

k=[]

for i in range(m):
  if (m%i==0) and (m//i <= n):
    k.append(i)
    
print(max(k))

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

k=[]

for i in range(m):
  if (m%i==0) and (m//i <= n):
    k.append(i)
    
print(max(k))
Problem p03251 (python)

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

ans = 'No War' if max([X] + x) < min([Y] + y) else 'War'
print(ans)

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

def war():
 if max([X]+x) < min([Y]+y):
    print('No War')
else:
  print('War')

war()
Problem p03254 (python)

Fixed submission:
n,x = map(int, input().split())
A = list(map(int, input().split()))

A.sort()

ans = 0

for i in range(n):
  x -= A[i]
  if x >= 0:
    ans += 1
  else:
    break
    
if x > 0:
  print(ans-1)
else:
  print(ans)

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

A.sort()

ans = 0

for i in range(N):
  x -= A[i]
  if x >= 0:
    ans += 1
  else:
    break
    
if x > 0:
  print(ans-1)
else:
  print(ans)
Problem p03260 (python)

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

if (a*b)%2 == 1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())

if (a*b)%2 = 1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())

if (a*b=1) or (a*b=3):
  print("Yes")
else:
  print("No")
Problem p03296 (python)

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

i=1
count=0

while i<n:
  if a[i]==a[i-1]:
    count+=1
    i+=2
  else:
    i+=1

print(count)

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

i=1
count=0

while i<n:
  if a[i]=a[i-1]:
    count+=1
    i+=2
  else:
    i+=1

print(count)

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

i = 1
count = 0

while i < n:
  if a[i] = a[i-1]:
    count += 1
    i += 2
    else:
      i += 1

print(count)
Problem p03302 (python)

Fixed submission:
A, B = map(int, input().split())
if(A+B==15):
    print("+")
elif(A*B==15):
    print("*")
else:
    print("x")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())

if (a+b==15):
  print("+")
elseif (a*b==15):
  print("*")
else:
  print("×")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())

if a+b=15:
  print("+")
elseif a*b=15:
  print("*")
else:
  print("×")
Problem p03425 (python)

Fixed submission:
n=int(input())
l=[0]*10
for i in range(n):
  x=input()
  y=x[0]
  if y=='M':
    l[0]+=1
  elif y=='A':
    l[1]+=1
  elif y=='R':
    l[2]+=1
  elif y=='C':
    l[3]+=1
  elif y=='H':
    l[4]+=1
ans=0
for i in range(3):
  for j in range(i+1,i+4):
    for k in range(j+1,j+4):
      ans+=l[i]*l[j]*l[k]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[0]*10
for i in range(n):
  x=input()
  y=x[0]
  if y=='M':
    l[0]+=1
  elif y=='A':
    l[1]+=1
  elif y=='R':
    l[2]+=1
  elif y=='C':
    l[3]+=1
  elif y=='H':
    l[4]+=1
ans=0
for i in range(3):
  for j in range(i+1,i+4):
    for k in range(j+1,j+4):
      sum+=l[i]*l[j]*l[k]
print(sum)
Problem p03549 (python)

Fixed submission:
n,m=map(int,input().split())
print((1800*m+100*n)*2**m)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
print(1800*m+100*n)*2**m
Problem p03587 (python)

Fixed submission:
s=input()
count=0
for i in range(len(s)):
  if int(s[i])==1:
    count+=1
 
print(count)

Buggy submission (verdict: Runtime Error):
s=input()
count=0
for i in range(s.length):
  if s[i]==1:
    count+=1

print(count)
Problem p03625 (python)

Fixed submission:
from collections import Counter

n=int(input())
a=list(map(int,input().split()))

c=Counter(a)
l=c.most_common()
rectangle=[]
square=[]
x=len(l)
for i in range(x):
    if l[i][1]>=2:
        rectangle.append(l[i][0])
    if l[i][1]>=4:
        square.append(l[i][0])
rectangle.sort()
square.sort()
if len(rectangle)<2 and len(square)<1:
    print(0)
elif len(rectangle)>=2 and len(square)<1:
    print(rectangle[-1]*rectangle[-2])
elif len(rectangle)<2 and len(square)>=1:
    print(square[-1]**2)
else:
    ans1=rectangle[-1]*rectangle[-2]
    ans2=square[-1]**2
    if ans1<ans2:
        print(ans2)
    else:
        print(ans1)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n=int(input())
a=list(map(int,input().split()))

c=Counter(a)
l=c.most_common()
rectangle=[]
square=[]
x=len(l)
for i in range(x):
    if l[i][1]>=2:
        rectangle.append(l[i][0])
    if l[i][1]>=4:
        square.append(l[i][0])
rectangle.sort()
square.sort()
ans1=rectangle[-1]*rectangle[-2]
ans2=square[-1]**2
if ans1<ans2:
    print(ans2)
else:
    print(ans1)
Problem p03651 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

if n==1:
  x=a[0]
else:
  x=gcd(a[0],a[1])
  for i in range(2,n):
    x=gcd(x,a[i])

if max(a)>=k and k%x==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)

if n==1:
  x=a[0]
else:
  x=gcd(a[0],a[1])
  for i in range(2,n):
    x=gcd(x,a[i])

if max(a)>=k and k%g==0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Problem p03807 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
odd=0
for x in a:
    if x%2==1:
        odd+=1
if odd%2==1:
    print('NO')
else:
    print('YES')

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
odd=0
for x in a:
    if a%2==1:
        odd+=1
if odd%2==1:
    print('NO')
else:
    print('YES')
Problem p04047 (python)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
 
l.sort()
k=l[::2]
sum=0
for i in range(n):
  sum += k[i]
  
print(sum)

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

l.sort()
k=l[::2]

print(k.sum())