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

Fixed submission:
N, L = map(int, input().split())
inputs = [input() for _ in range(N)]

orderd_inputs = sorted(inputs)

print(''.join(orderd_inputs))

Buggy submission (verdict: Runtime Error):
N, L = map(int, input().split())
inputs = [input() for _ in range(N)]

ans = [
    inputs[0] + inputs[1] + inputs[2],
    inputs[0] + inputs[2] + inputs[1],
    inputs[1] + inputs[0] + inputs[2],
    inputs[1] + inputs[2] + inputs[0],
    inputs[2] + inputs[0] + inputs[1],
    inputs[2] + inputs[1] + inputs[0],
]

print(min(ans))

Buggy submission (verdict: Runtime Error):
N, L = map(int, input().split())
inputs = [input() for _ in range(N)]

ans = []

for i in range(L):
    for j in range(L):
        for k in range(L):
            if i != j and j != k:
                ans.append(inputs[i] + inputs[j] + inputs[k])

print(min(ans))
Problem p02554 (python)

Fixed submission:
n = int(input())
x = 10**n%(10**9+7) + 8**n%(10**9+7) - 2 * 9**n%(10**9+7)
print(x%(10**9+7))

Buggy submission (verdict: Runtime Error):
n = int(input())
x = 10**n％(10**9+7) + 8**n％(10**9+7) - 2 * 9**n％(10**9+7)
print(x％(10**9+7))
Problem p02761 (python)

Fixed submission:
n,m = map(int,input().split())
keta = []
number = []

for i in range(m):
    b,a=input().split()
    keta.append(int(b))
    number.append(a)

ccount = 0
count = 0   
ans = 0
if n == 3:
   ans = 100
else:
   pass
if n == 2:
   ans = 10
else:
   pass
if n == 1:
   ans = 0
else:
   pass

while count == 0:
   ans = str(ans)
   for i in range(0,m):
      if ans[keta[i]-1] == number[i]:
         ccount += 1
   if ccount == m:
      count += 1
   ccount = 0
   ans = int(ans)
   ans += 1
   if n == 3 and (ans - 1) == 1000:
      ans = 0
      break
   if n == 2 and (ans - 1) == 100:
      ans = 0
      break
   if n == 1 and (ans - 1) == 10:
      ans = 0
      break
print(ans - 1)

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

for i in range(m):
    n,a=input().split()
    keta.append(int(n))
    number.append(a)

ccount = 0
count = 0   
ans = 0
if n == 3:
   ans = 100
if n == 2:
   ans = 10
if n == 1:
   ans = 0

while count == 0:
   ans = str(ans)
   for i in range(0,m):
      if ans[keta[i]-1] == number[i]:
         ccount += 1
   if ccount == m:
      count += 1
   ccount = 0
   ans = int(ans)
   ans += 1
   if n ==3 and (ans - 1) == 1000:
      ans = 0
      break
   if n == 2 and (ans - 1) == 100:
      ans = 0
      break
   if n == 1 and (ans - 1) == 10:
      ans = 0
      break
print(ans - 1)

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

for i in range(m):
    n,a=input().split()
    keta.append(int(n))
    number.append(a)

ccount = 0
count = 0   
ans = 0
if n == 3:
   ans = 100
if n == 2:
   ans = 10
if n == 1:
   ans = 0

while count == 0:
   ans = str(ans)
   for i in range(0,m):
      if ans[keta[i]-1] == number[i]:
         ccount += 1
   if ccount == m:
      count += 1
   ccount = 0
   ans = int(ans)
   ans += 1
   if n = 3 and (ans - 1) == 1000:
      ans = 0
      break
   if n = 2 and (ans - 1) == 100:
      ans = 0
      break
   if n = 1 and (ans - 1) == 10:
      ans = 0
      break
print(ans - 1)

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

for i in range(m):
    n,a=input().split()
    keta.append(int(n))
    number.append(a)

ccount = 0
count = 0   
ans = 0
if max(keta) == 3:
   ans = 100
if max(keta) == 2:
   ans = 10
if max(keta) == 1:
   ans = 0

while count == 0:
   ans = str(ans)
   for i in range(0,m):
      if ans[keta[i]-1] == number[i]:
         ccount += 1
   if ccount == m:
      count += 1
   ccount = 0
   ans = int(ans)
   ans += 1
print(ans - 1)
Problem p02802 (python)

Fixed submission:
n,m=map(int,input().split())
row=m
number=[]
judgment=[]
for p in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)

penalist = [0]*n
aclist = [0]*n
anscount=0
penacount=0

for i in range(0,m):
    if judgment[i] == 'WA':
        penalist[number[i]-1] += 1
    else:
        if aclist[number[i]-1] >= 1:
            pass
        else:
            aclist[number[i]-1] += 1
            anscount += 1
            penacount += penalist[number[i]-1]

print(anscount,penacount)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
row=m
number=[]
judgment=[]
for i in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)
 
z = 0
seitou,sippai = 0,0
kuria = [0] * (n+1)
if m > 0:
    for i in range(0,m+1):
        if kuria[number[i]] == 0 and judgment[i] == 'AC':
            seitou += 1
            kuria[number[i]] = 1
        elif kuria[number[i]] == 0 and judgment[i] == 'WA':
            sippai += 1
else:
    pass
print(seitou,sippai)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
row=m
number=[]
judgment=[]
for i in range(row):
    a,b=input().split()
    number.append(int(a))
    judgment.append(b)
 
z = 0
seitou,sippai = 0,0
kuria = [0] * m
for i in range(0,len(judgment)):
    if kuria[number[i]] == 0 and judgment[i] == 'AC':
        seitou += 1
        kuria[number[i]] = 1
    elif kuria[number[i]] == 0 and judgment[i] == 'WA':
        sippai += 1
print(seitou,sippai)
Problem p02861 (python)

Fixed submission:
n = int(input())
zahyou = []
for i in range(n):
    a = input().split()
    zahyou.append(a)
import math


def distance(x1,x2,y1,y2):
    return math.sqrt((x1-x2)**2 + (y1-y2)**2)

allen = 0
for i in zahyou:
    for j in zahyou:
        allen += distance(int(i[0]),int(j[0]),int(i[1]),int(j[1]))

ans = float(allen/n)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
zahyou = []
for i in range(n):
    a = input().split()
    zahyou.append(a)
import math
import itertools
import statistics


def distance(x1,x2,y1,y2):
    return math.sqrt((x1-x2)**2 + (y1-y2)**2)

allen = 0
for i in zahyou:
    for j in zahyou:
        allen += distance(int(i[0]),int(j[0]),int(i[1]),int(j[1]))

ans = allen/ n
print(ans)

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

import math
import itertools
import statistics

def distance(x1,x2,y1,y2):
    return math.sqrt((x1-x2)**2 + (y1-y2)**2)

def permutations_count(nnn, rrr):
    return math.factorial(nnn) // math.factorial(nnn - rrr)

nlist = list(range(0,n))
nlist = list(itertools.permutations(nlist,n))
anslist = []
ans = 0
for i in range(0,permutations_count(n,2)):
    for j in range(0,n-1):
        x1 = xlist[nlist[i][j]]
        x2 = xlist[nlist[i][j+1]]
        y1 = ylist[nlist[i][j]]
        y2 = ylist[nlist[i][j+1]]
        ans += distance(x1,x2,y1,y2)
    anslist.append(ans)
    ans = 0

print(statistics.mean(anslist))
Problem p03752 (python)

Fixed submission:
n, k = map(int, input().split())
 
a = list(map(int, input().split()))
 
min_cost = float("inf")
for i in range(2**n):
    if bin(i).count("1") != k:
        continue
 
    min_h = a[0]
    cost = 0
    for j in range(1, n):
        if i >> j & 1:
            min_h += 1
            cost += max(0, min_h-a[j])
 
        min_h = max(min_h, a[j])
 
    min_cost = min(min_cost, cost)
 
print(min_cost)

Buggy submission (verdict: Runtime Error):
import copy
n, k = map(int, input().split())
alist = list(map(int, input().split()))

ans = 10**20
count = 0
tempbin = ""
maxx = 0

for i in range(2**n):
    tempbin = format(i,'b')
    tempbin = tempbin.zfill(n)
    count = 0
    templist = alist.copy()
    if tempbin.count("1") != k:
        continue
    for j in range(1,n):
        if tempbin[j] == "1":
            maxx = max(templist[:j])
            if maxx >= templist[j]:
                count += maxx + 1 - templist[j]
                templist = maxx + 1
    ans = min(ans,count)

print(ans)
Problem p02582 (python)

Fixed submission:
days = input()



result = []

num = 0
for d in days:
  if d == 'R':
    num += 1
  else:
    result.append(num)
    num = 0
result.append(num)

print(max(result))

Buggy submission (verdict: Runtime Error):
c_place, N, distance = [ int(v) for v in input().split(" ") ]

max_distance = distance * N
candidate=[]

#for n in range(1, N):
#  candidate.append(abs(c_place - distance*n))

n = c_place // distance
candidate.append(abs(c_place - distance*n))
candidate.append(abs(c_place - distance*(n+1)))

#print(n, n+1)
#print(candidate)

if c_place > max_distance:
  print(c_place - max_distance)
else:
  if N % (n+1) == 0:
    print(candidate[1])
  else:
    print(min(candidate))
Problem p03086 (python)

Fixed submission:
S = input()

# ACGT 

num = 0
result = [0]

    
for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    num += 1
  else:
    result.append(num)
    num = 0
result.append(num)
    
#print(result)
print(max(result))

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

# ACGT 

num = 0
result = []

for c in S:
  if c == 'A' or c == 'C' or c == 'G' or c == 'T':
    num += 1
  else:
    result.append(num)
    num = 0
    
print(max(result))
Problem p03105 (python)

Fixed submission:
#!/usr/bin/python

input_data = list(map(int,input().split()))

d1 = input_data[0]
d2 = input_data[1]
d3 = input_data[2]

d4 = int(d2 / d1)
if d4 > d3:
    total = d3
else:
    total = d4

print(total)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python

input_data = input().split()

d1 = input_data[0]
d2 = input_data[1]
d3 = input_data[2]
total = 0

d4 = d2 % d1
if d4 > d3:
    total += 1

print(total)
Problem p03377 (python)

Fixed submission:
#!/usr/bin/python
 
input_data = list(map(int,input().split()))
 
neko = input_data[0]
neko_inu = input_data[1]
d = input_data[2]
 
if neko > d:
    print("NO")
elif neko+neko_inu < d:
    print("NO")
else:
    print("YES")

Buggy submission (verdict: Runtime Error):
a = [input().split() for l in range(2)]
print(a)

N = int(a[0][0]) 
M = int(a[0][1]) 
X = int(a[0][2]) # current place 

goal_len01 = N - X # end place
goal_len02 = X # start place

cost1 = 0
for i in range(goal_len01):
  if str(X+i+1) in a[1]:
    cost1 += 1

cost2 = 0
for i in range(goal_len02):
  if str(i+1) in a[1]:
    cost2 += 1

min_cost = 0
if cost1 >= cost2:
  min_cost = cost2
else:
  min_cost = cost1
  
print(min_cost)
Problem p03993 (python)

Fixed submission:
N = int(input())
rabit = input().split(" ")
skip = []
num = 0

for i in range(N):
  n = int(rabit[i])
  if n < i+1:
    continue
  if int(rabit[n-1]) == i+1:
    num += 1

print(num)

Buggy submission (verdict: Runtime Error):
N = int(input())
rabit = [ int(v) for v in input().split(" ") ]
skip = set()
num = 0
 
for i in range(N):
  n = rabit[i]
  if i in skip:
    continue
  if rabit[n-1] == i+1:
    skip.append(n-1)
    num += 1
 
print(num)
Problem p02640 (python)

Fixed submission:
x,y=map(int,input().split())
if 2*x<=y and y<=4*x and y%2==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
if 2*x<=y and y<=4*x and y&2=0:
  print("Yes")
else:
  print("No")
Problem p02553 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
print(int(max(a*c,a*d,b*c,b*d)))

Buggy submission (verdict: Runtime Error):
_,b,_,d = map(int,input().split())
print(int(b*d)
Problem p02658 (python)

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

if 0 in A:
    print(0)
    exit()

count = 1
for i in A:
    count *= i
    if 10 ** 18 < count:
        break

if 10 ** 18 < count:
    count = -1

print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
import functools
import operator

def calc(n):
    return n / 1000000

N = int(input())
A = np.asarray(list(map(calc, list(map(int, input().split())))))

#z = functools.partial(functools.reduce, operator.mul)
#count = z(A)

count = np.prod(A)

#print(count)

count = count * 1000000 ** len(A)

if 10 ** 18 < count:
    count = -1
print(count)
Problem p02642 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
num=[0]*(max(a)+1)
maxa=max(a)
cnt=1

for i in a:
  while 1:
    try:
      num[i*cnt]+=1
      cnt+=1
      
      
    except IndexError:
      break
  cnt=1      

count=0

for i in range(n):
  if num[a[i]]==1:
    count+=1
    
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
num=[]
count=0

a=sorted(a)

for i in a:
  for j in num:
    if i%j==0:
      count+=1
      break
      
  num.append(i)
  
  
if a[0]==a[1]:
  count+=1
  
print(n-count)
Problem p02554 (python)

Fixed submission:
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
import random
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()



N=int(input())
mod=10**9+7
dp=[[8,1,1,0] for i in range(N)]#1,2~8,9,both
for i in range(1,N):
    dp[i][0]=dp[i-1][0]*8
    dp[i][1]=dp[i-1][0]+dp[i-1][1]*9
    dp[i][2]=dp[i-1][0]+dp[i-1][2]*9
    dp[i][3]=dp[i-1][1]+dp[i-1][2]+dp[i-1][3]*10
    for n in range(4):
        dp[i][n]%=mod
print(dp[-1][3]%mod)

Buggy submission (verdict: Runtime Error):
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
import numpy as np
import random
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()



N=int(input())
mod=10**9+7
dp=[[8,1,1,0] for i in range(N)]#1,2~8,9,both
for i in range(1,N):
    dp[i][0]=dp[i-1][0]*8
    dp[i][1]=dp[i-1][0]+dp[i-1][1]*9
    dp[i][2]=dp[i-1][0]+dp[i-1][2]*9
    dp[i][3]=dp[i-1][1]+dp[i-1][2]+dp[i-1][3]*10
    for n in range(4):
        dp[i][n]%=mod
print(dp[-1][3]%mod)

Buggy submission (verdict: Runtime Error):
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
import numpy as np
import random
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()



N=int(input())
mod=10**9+7
dp=[[8,1,1,0] for i in range(N)]#1,2~8,9,both
for i in range(1,N):
    dp[i][0]=dp[i-1][0]*8
    dp[i][1]=dp[i-1][0]+dp[i-1][1]*9
    dp[i][2]=dp[i-1][0]+dp[i-1][2]*9
    dp[i][3]=dp[i-1][1]+dp[i-1][2]+dp[i-1][3]*10
    for n in range(4):
        dp[i][n]%=mod
print(dp[-1][3]%mod)
Problem p02574 (python)

Fixed submission:
from collections import *
def gcd(a,b):
    if a%b==0:return(b)
    else:return(gcd(b,a%b))

def soinsuu(n):
    visited=defaultdict(int)
    for i in range(2,round(n**.5)+1):
        while n%i==0:
            n//=i
            visited[i]+=1
    if n>1:
        visited[n]+=1
    return(visited)

N=int(input())
A=list(map(int,input().split()))
visited=set()
flg=False
for a in A:
    for i in soinsuu(a):
        if i in visited:
            flg=True
            break
        else:
            visited.add(i)

    if flg:
        break
else:
    print("pairwise coprime")
    exit()

n=A[0]
for a in A[1:]:
    n=gcd(n,a)



if n>1:
    print("not coprime")
else:
    print("setwise coprime")

Buggy submission (verdict: Runtime Error):
from collections import *
def gcd(a,b):
    if a%b==0:return(b)
    else:return(gcd(b,a%b))

def soinsuu(n):
    visited=defaultdict(int)
    for i in range(2,round(n**.5)+1):
        while n%i==0:
            n//=i
            visited[i]+=1
    if n>1:
        visited[n]+=1
    return(visited)

N=int(input())
A=list(map(int,input().split()))
A=[soinsuu(a) for a in A]
visited=set()
flg=False
for a in A:
    for i in a:
        if i in visited:
            flg=True
            break
        else:
            visited.add(i)

    if flg:
        break
else:
    print("pairwise coprime")
    exit()

n=a[0]
for a in A[1:]:
    n=gcd(n,a)



if n>1:
    print("not coprime")
else:
    print("setwise coprime")

Buggy submission (verdict: Runtime Error):
from collections import *
def gcd(a,b):
    if a%b==0:return(b)
    else:return(gcd(b,a%b))

def soinsuu(n):
    visited=defaultdict(int)
    for i in range(2,round(n**.5)+1):
        while n%i==0:
            n//=i
            visited[i]+=1
    if n>1:
        visited[n]+=1
    return(visited)

N=int(input())
A=list(map(int,input().split()))
A=[soinsuu(a) for a in A]
visited=set()
flg=False
for a in A:
    for i in a:
        if i in visited:
            flg=True
            break
        else:
            visited.add(i)

    if flg:
        break
else:
    print("pairwise coprime")
    exit()

visited=soinsuu(A[0])
for a in A[1:]:
    for i in a:
        visited[i]-=data[i]

if [i for i in visited if visited[i]>0]:
    print("not coprime")
else:
    print("setwise coprime")
Problem p02662 (python)

Fixed submission:
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()
N,S=map(int,input().split())
A=list(map(int,input().split()))
mod=998244353

gyaku=pow(2,mod-2,mod)
N2=pow(2,N-1,mod)
dp=[[0,0] for n in range(3001)]
for n in range(N):
    a=A[n]
    for s in range(0,S+1)[::-1]:
        if s+a<=S:
            dp[s+a][1]+=dp[s][1]*gyaku%mod
            dp[s+a][1]%=mod
    dp[a][1]+=N2

print(dp[S][1])
#print(c)

Buggy submission (verdict: Runtime Error):
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()
N,S=map(int,input().split())
A=list(map(int,input().split()))
mod=998244353
fac=[1,1]
for i in range(2,3010):
    fac.append(fac[-1]*i%mod)
ifac=[pow(i,mod-2,mod) for i in fac]

def comb(a,b):
    return(fac[a]*ifac[a-b]*ifac[b]%mod)


dp=[[] for n in range(3000)]
for n in range(N):
    a=A[n]
    for s in range(0,3000)[::-1]:
        if s+a<=3000:
            for h in dp[s]:
                dp[s+a].append(h+1)
    dp[a].append(1)
c=0
#print(dp[S])
for a in dp[S]:
    c+=comb(N,a)
    c%=mod
print(c)
Problem p02697 (python)

Fixed submission:
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()

N,M=map(int,input().split())

if N%2:
    x,y=N//2,N//2+1
    for i in range(M):
        print(x-i,y+i)

else:

    for i in range(M//2+M%2):
        print(1+i,1+M-1*(M%2==0)-i)
    for i in range(M//2):
        print(N-(M-M%2)+i,N-i)

Buggy submission (verdict: Runtime Error):
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()

N,M=map(int,input().split())

if not N%2:
    print(unko)


x,y=N//2,N//2+1
for i in range(M):
    print(x-i,y+i)

Buggy submission (verdict: Runtime Error):
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()

N,M=map(int,input().split())

if N%2:
    print(unko)


x,y=N//2,N//2+1
for i in range(M):
    print(x-i,y+i)
Problem p02709 (python)

Fixed submission:
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import time
import math
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
N=int(input())
A=list(map(int,input().split()))
A=[[A[i],i] for i in range(N)]
A.sort(reverse=True)
dp=[[0 for i in range(N+1)] for _ in range(N+1)]
for n in range(N):
    a,p=A[n]
    for x in range(1,n+2):
        y=n+1-x
        dp[x][y]=max(dp[x][y],dp[x-1][y]+round(abs(x-1 - p))*a)
    for y in range(1,n+2):
        x=n+1-y
        dp[x][y]=max(dp[x][y],dp[x][y-1]+round(abs(N-y - p))*a)
    #print(dp)
print(max([dp[x][y] for x in range(N+1) for y in range(N+1) if x+y==N]))

Buggy submission (verdict: Runtime Error):
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import time
import math
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
N=int(input())
A=list(map(int,input().split()))
A=[[A[i],i] for i in range(N)]
A.sort()
c=0
for i in range(N//2):
    a1,i1=A.pop()
    a2,i2=A.pop()
    b=(N-1-i)
    c+=max(a1*round(abs(i-i1))+a2*round(abs(b-i2)),a1*round(abs(b-i1))+a2*round(abs(i-i2)))
if N%2:
    a1,i1=A.pop()
    b=(N-1)//2
    c+=ai*round(abs(b-i1))
print(c)

Buggy submission (verdict: Runtime Error):
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import time
import math
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
N=int(input())
A=list(map(int,input().split()))
A=[[A[i],i] for i in range(N)]
A.sort()
c=0
for i in range(N//2):
    a1,i1=A.pop()
    a2,i2=A.pop()
    b=(N-1-i)
    c+=max(a1*round(abs(i-i1))+a2*round(abs(b-i2)),a1*round(abs(b-i1))+a2*round(abs(i-i2)))
if A:
    a1,i1=A.pop()
    b=(N-1)//2
    c+=ai*round(abs(b-i1))
print(c)
Problem p02743 (python)

Fixed submission:
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math
from fractions import gcd
import sys
from decimal import *
#input = sys.stdin.readline


#N=int(input())

#A=list(map(int,input().split()))
#XY=[list(map(int,input().split())) for i in range(N)]

a,b,c=map(int,input().split())
X=gcd(gcd(a,b),c)
c//=X
a//=X
b//=X
getcontext().prec = 500
c=Decimal(c).sqrt()
b=Decimal(b).sqrt()
a=Decimal(a).sqrt()

if c-a-b>0.0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math
from fractions import gcd
import sys
#input = sys.stdin.readline


#N=int(input())

#A=list(map(int,input().split()))
#XY=[list(map(int,input().split())) for i in range(N)]

a,b,c=map(int,input().split())
X=gcd(gcd(a,b),c)
c//=X
a//=X
b//=X

if math.isclose(c**.5,a**.5+b**.5):
    print("No")

elif c**.5-a**.5-b**.5>0.0:
    print("Yes")
else:
    print("No")