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

Fixed submission:
a, b, c = input().split()
if a == c : print(b)
elif a == b : print(c)
else : print(a)

Buggy submission (verdict: Runtime Error):
a, b, c = int(input().split)
if a == c : print(b)
elif a == b : print(c)
else : print(a)
Problem p03597 (python)

Fixed submission:
print(int(input())**2-int(input()))

Buggy submission (verdict: Runtime Error):
n, k = int(input()), int(input())
a = map(int, input().split())
sum = 0
for x in a :
  sum += min(x, abs(k-x)) * 2
print(sum)
Problem p03598 (python)

Fixed submission:
n, k = int(input()), int(input())
a = map(int, input().split())
sum = 0
for x in a :
  sum += min(x, abs(k-x)) * 2
print(sum)

Buggy submission (verdict: Runtime Error):
n, k = int(input()), int(input())
a = map(int, input().split())
sum = 0
for x in a :
  sum += min(a, abs(k-a)) * 2
print(sum)
Problem p03632 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
row = [0 for i in range(101)]
for i in range(a, b+1) : row[i] += 1
for i in range(c, d+1) : row[i] += 1
if row.count(2) == 0 : print(0)
else : print(row.count(2)-1)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
row = [0 for i in range(101)]
for i in range(a, b+1) : row[i] += 1
for i in range(c, d+1) : row[i] += 1
if row.count(2) == 0 : print(0)
else : print(raw.count(2)-1)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
row = [i for i in range(101)]
row[a-1:b] += 1
row[c-1:d] += 1
print(row.count(0))
Problem p03636 (python)

Fixed submission:
s = input()
print(s[0], end='')
print(len(s)-2, end='')
print(s[-1])

Buggy submission (verdict: Runtime Error):
s = input()
print(f'{s[0]}{s.len()-2}{s[-1]}')
Problem p03658 (python)

Fixed submission:
n, k = map(int, input().split())
l = sorted(list(map(int, input().split())), reverse=True)
print(sum(l[:k]))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
l = sort(list(map(int, input().split())), reverse=True)
print(sum(l[:k]))
Problem p03679 (python)

Fixed submission:
x, a, b = map(int, input().split())
if (b <= a) : print('delicious')
elif (x >= b-a) : print('safe')
else : print('dangerous')

Buggy submission (verdict: Runtime Error):
x, a, b = map(int. input().split())
if (b <= a) : print('delicious')
elif (x >= b-a) : print('safe')
else : print('dangerous')
Problem p03962 (python)

Fixed submission:
a = set(list(map(int, input().split())))
print(len(a))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
print(n*((n-1)**(k-1)))
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split())
a = [input() for _ in range(n)]
a = sorted(a)
ans = ""
for s in a:
  ans += s
print(ans)

Buggy submission (verdict: Runtime Error):
l, n = map(int, input().split())
a = [input() for _ in range(n)]
a = sorted(a)
ans = ""
for s in a:
  ans += s
print(ans)
Problem p02574 (python)

Fixed submission:
def main():
    import math
    n = int(input())
    a = sorted(list(map(int,input().split())))
    g=a[0]
    for i in range(1,n):
        g = math.gcd(g,a[i])
    if g > 1:
        print('not coprime')
        return
    d = [1 for i in range(a[-1])]
    for i in range(2,a[-1]+1):
        if d[i-1] == 1:
            for j in range(1,a[-1]//i+1):
                if d[i*j-1] == 1:
                    d[i*j-1] = i
    prm = {}
    for i in range(n):
        p = []
        while a[i] != 1:
            p.append(d[a[i]-1])
            a[i] = a[i] // d[a[i]-1]
        p = set(p)
        for p_ in p:
            if prm.get(p_)==None:
                prm[p_] = 1
            else:
                print('setwise coprime')
                return
    print('pairwise coprime')

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import math
    n = int(input())
    a = sorted(list(map(int,input().split())))
    d = [-1 for i in range(a[-1])]
    d[0] = 1
    for i in range(2,a[-1]):
        for j in range(1,a[-1]//i+1):
            if d[i*j-1] == -1:
                d[i*j-1] = i
    Dic = [0 for i in range(a[-1])]
    flg = 0
    for i in range(n):
        if Dic[d[a[i]-1]] != 0:
            flg = 1
            break
        else:
            Dic[d[a[i]-1]] += 1
    g=a[0]
    for i in range(1,n):
        g = math.gcd(g,a[i])
    if g > 1:
        print('not coprime')
        return
    if flg == 1:
        print('setwise coprime')
        return
    print('pairwise coprime')

if __name__ == "__main__":
    main()
Problem p02696 (python)

Fixed submission:
def main():
    a,b,n = map(int,input().split())
    if b>n:
        print(int(a*(n/b-n//b)))
    else:
        print(int(a*((b-1)/b)))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a,b,n = map(int,input().split())
    if b>n:
        print(int(a*(n/b-n//b)))
    else:
        print(int(a*((b-1)/b))


if __name__ == "__main__":
    main()
Problem p02719 (python)

Fixed submission:
n,k = map(int,input().split())
def main():
    m = n%k
    print(min(m,k-m))

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n,m = map(int,input().split())
    a = sorted(list(map(int,input().split())),reverse=True)     
    s = sum(a)
    thresh = s/4/m
    if a[m-1]>=thresh:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
def main():
  s = sum(a)
  thresh = s/4/m
  if a[m-1]>=thresh:
    print('Yes')
  else:
    print('No')

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
def main():
    s = sum(a)
    thresh = s/4/m
    if a[m-1]<thresh:
        print('No')
    else:
        print('Yes')

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
def main():
    s = sum(a)
    thresh = s/4/m
    if a[m-1]<thresh:
        print('No')
    else:
        print('Yes')

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
def main():
    s = sum(a)
    thresh = s/4/m
    if a[m-1]>=thresh:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
def main():
    s = sum(a)
    thresh = s/4/m
    if a[m-1]>=thresh:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()
Problem p02727 (python)

Fixed submission:
def main():
    import bisect
    x,y,a,b,c = map(int,input().split())
    p = sorted(list(map(int,input().split())))
    q = sorted(list(map(int,input().split())))
    r = list(map(int,input().split()))
    ans = 0
    if x<=a:
        p = p[a-x:a]
    if y<=b:
        q = q[b-y:b]
    ans = sorted(p+q+r,reverse=True)
    print(sum(ans[0:x+y]))
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import bisect
    x,y,a,b,c = map(int,input().split())
    p = sorted(list(map(int,input().split())))
    q = sorted(list(map(int,input().split())))
    r = sorted(list(map(int,input().split())),reverse=True)
    ans = 0
    if x<=a:
        p = p[a-x:a]
    if y<=b:
        q = q[b-y:b]
    while True:
        if len(r)==0:
            break
        if p[0]>q[0]:
            if q[0]<r[0]:
                bisect.insort_right(q,r.pop(0))
                q.pop(0)
            else:
                break
        else:
            if p[0]<r[0]:
                bisect.insort_right(p,r.pop(0))
                q.pop(0)
            else:
                break
    print(sum(p)+sum(q))
if __name__ == "__main__":
    main()
Problem p02780 (python)

Fixed submission:
def main():
    n,k = map(int,input().split())
    p = list(map(int,input().split()))

    for i in range(n):
        p[i]=(p[i]+1)/2
    s = [0]
    for i in range(n):
        s.append(s[i]+p[i])
    m = 0
    for i in range(n-k+1):
        if m<s[i+k]-s[i]:
            m = s[i+k]-s[i]
    print(m)

if __name__ == "__main__":
    main()

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

def su(n):
  return n*(n+1)/2

maxind=0
for i in range(n-k):
  if p[i+k] > p[i]:
    maxind = i
s = 0
for i in range(k):
  s += su(p[maxind+1+i])/p[maxind+1+i]
print(s)
Problem p02854 (python)

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

if N == 2:
  print(abs(a[0]-a[1]))
else:
  s = sum(a)
  i = 0
  b = 0
  for i in range(N):
    if b<s/2:
      b += a[i]
    else:
      b = b-a[i-1]
      c = a[i-1]
      break
  h = s-b-c
  if h>b:
    print(b+c-h)
  elif b>h:
    print(h+c-b)
  else:
    if N%2==0:
      print(0)
    else:
      print(c)

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

s = sum(a)
i = 0
b = 0
for i in range(N):
  if b<s/2:
    b += a[i]
  else:
    b = b-a[i-1]
    c = a[i-1]
    break
h = s-b-c
print(b,h,c)
if h>b:
  print(b+c-h)
elif b>h:
  print(h+c-b)
else:
  print(0)

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

s = sum(a)
i = 0
b = 0
for i in range(N):
  if b<s/2:
    b += a[i]
  else:
    b = b-a[i-1]
    c = a[i-1]
    break
h = s-b-c
if h>b:
  print(abs(b+c)-h)
elif b>h:
  print(abs(h+c)-h)
else:
  print(0)
Problem p02882 (python)

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

import math
if 2*x > b * a**2:
  tan = 2*(b*a**2-x)/a**3
  t = math.atan(tan)
else:
  tan = (a * b**2)/x/2
  t = math.atan(tan)
  
print(math.degrees(t))

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

import math
if x > a**2 * b/2:
  tan = a/(2*b-2*x/a**2)
  t = math.atan(tan)
else:
  tan = 2 * x/(a * b**2)
  t = math.atan(tan)
  
print(90 - math.degrees(t))
Problem p03044 (python)

Fixed submission:
def main():
    n = int(input())
    ki = {}
    for i in range(1,n+1):
        ki[i] = []
    for i in range(n-1):
        u,v,w = map(int,input().split())
        ki[u] += [[v,w%2]]
        ki[v] += [[u,w%2]]
    cl = [-1 for i in range(n)]
    cl[0] = 0
    que = [0]
    while len(que)>0:
        q = que.pop(0)
        for v in ki[q+1]:
            if cl[v[0]-1] != -1:
                continue
            if v[1]==1:
                cl[v[0]-1] = (cl[q]+1)%2
                que.append(v[0]-1)
            else:
                cl[v[0]-1] = cl[q]
                que.append(v[0]-1)
    for i in range(n):
        print(cl[i])

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import numpy as np
    n = int(input())
    graph = np.ones((n,n))*-1
    come = np.ones(n)*-1
    for i in range(n-1):
        u,v,w = map(int,input().split())
        graph[u-1][v-1] = graph[v-1][u-1] = w%2
    que = [0]
    come[0] = 0
    while len(que)>0:
        s = que.pop(0)
        for i,nv in enumerate(graph[s]):
            if nv!=-1:
                if come[i]!=-1:
                    continue
                if nv==0:
                    come[i]=come[s]
                else:
                    come[i]=(come[s]+1)%2
                que.append(i)
    for i in range(n):
        print(str(int(come[i])))
            
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import numpy as np
    n = int(input())
    graph = np.zeros((n,n))
    come = np.ones(n)*-1
    for i in range(n-1):
        u,v,w = map(int,input().split())
        graph[u-1][v-1] = graph[v-1][u-1] = w
    que = [0]
    come[0] = 0
    while len(que)>0:
        s = que.pop(0)
        for i,nv in enumerate(graph[s]):
            if nv!=0:
                if come[i]!=-1:
                    continue
                if nv%2==0:
                    come[i]=come[s]
                else:
                    come[i]=(come[s]+1)%2
                que.append(i)
    for i in range(n):
        print(int(come[i]))
            
if __name__ == "__main__":
    main()
Problem p03347 (python)

Fixed submission:
def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))
    x = a[-1]
    ans = a[-1]
    for i in range(1,n):
        if x==0:
            x = a[-1-i]
        e = x-1
        if e>a[-1-i]:
            print(-1)
            return
        elif e<a[-1-i]:
            x = a[-1-i]
            ans += a[-1-i]
        else:
            x -= 1
    if x==0:
        print(ans)
    else:
        print(-1) 

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n = int(input())
    a = []
    for _ in range(n):
        a.append(int(input()))
    x = [i for i in range(a[-1])]
    ans = a[-1]
    for i in range(1,n):
        if len(x)==0:
            x = [i for i in range(a[-1-i])]
        e = x.pop(-1)
        if e>a[-1-i]:
            print(-1)
            return
        elif e<a[-1-i]:
            x = [i for i in range(a[-1-i])]
            ans += a[-1-i]
    if len(x)==0:
        print(ans) 
    else:
        print(-1) 

if __name__ == "__main__":
    main()
Problem p03599 (python)

Fixed submission:
def main():
    a,b,c,d,e,f = map(int,input().split())
    ans = []
    for i in range(f//a//100+1):
        for j in range((f-100*a*i)//b//100+1):
            if a*i*100+b*j*100 < f:
                ans.append([i,j])
    ans = ans[1:]
    D = 0
    A = [0,0]
    for an in ans:
        m = a*100*an[0] + b*100*an[1]
        slv = e*m//100
        M = 0
        for i in range(min(f-m,slv)//c+1):
            for j in range((min(f-m,slv)-c*i)//d+1):
                if i*c+d*j <= min(slv,f-m):
                    if M < i*c+d*j:
                        M = i*c+d*j
        den = M/(m+M)
        if den>=D:
            D = den
            A = [m+M,M]
    print(' '.join([str(a) for a in A]))

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    a,b,c,d,e,f = map(int,input().split())
    ans = []
    for i in range(f//a//100+1):
        for j in range((f-100*a*i)//b//100+1):
            if a*i*100+b*j*100 < f:
                ans.append([i,j])
    ans = ans[1:]
    D = 0
    for an in ans:
        m = a*100*an[0] + b*100*an[1]
        slv = e*m//100
        M = 0
        for i in range(min(f-m,slv)//c+1):
            for j in range((min(f-m,slv)-c*i)//d+1):
                if i*c+d*j <= min(slv,f-m):
                    if M < i*c+d*j:
                        M = i*c+d*j
        den = M/(m+M)
        if den>D:
            D = den
            A = [m+M,M]
    print(' '.join([str(a) for a in A]))

if __name__ == "__main__":
    main()
Problem p03633 (python)

Fixed submission:
from fractions import gcd
def main():
    n = int(input())
    m = int(input())
    for _ in range(n-1):
        t = int(input())
        m = m*t//gcd(m,t)

    print(m)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
n = int(input())
import math
def main():
    m = int(input())
    for _ in range(n-1):
        t = int(input())
        m = m*t//math.gcd(m,t)

    print(m)

if __name__ == "__main__":
    main()
Problem p02644 (python)

Fixed submission:
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque

h,w,k= map(int, input().split())
sx,sy,gx,gy= map(int, input().split())
maze= [list(input()) for i in range(h)]


# 迷路　BFS
def clear_maze(sx, sy, gx, gy):

    INF=10**9
    distance = [[INF for i in range(w)] for j in range(h)]
    #    distance = [[None]*field_x_length]*field_y_length
    def bfs():
        # きた点と方向を格納
        d=deque()
        d.append((sx, sy))
        distance[sx][sy] =0

        while len(d):
            x, y = d.popleft()

            for i in range(0, 4):
                for j in range(1,k+1):
                    nx, ny = x + [j, 0, -j, 0][i], y + [0, j, 0, -j][i]
                    if not (0 <= nx < h and 0 <= ny < w):
                        break

                    elif maze[nx][ny] == '@' or distance[nx][ny]<=distance[x][y]:
                        break

                    elif distance[nx][ny] == INF:
                        d.append((nx, ny))
                        distance[nx][ny] = distance[x][y] + 1


        return distance[gx][gy]

    return bfs()

ans=clear_maze(sx-1,sy-1,gx-1,gy-1)

if  ans==10**9:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque

h,w,k= map(int, input().split())
sx,sy,gx,gy= map(int, input().split())
maze= [list(input()) for i in range(h)]


# 迷路　BFS
def clear_maze(sx, sy, gx, gy):

    INF=-10**9
    distance = [[INF for i in range(w)] for j in range(h)]
    #    distance = [[None]*field_x_length]*field_y_length
    def bfs():
        # きた点と方向を格納
        d=deque
        d.append((sx, sy))
        distance[sx][sy] =0

        while len(d):
            x, y = d.popleft()

            for i in range(0, 4):
                for j in range(1,k+1):
                    nx, ny = x + [j, 0, -j, 0][i], y + [0, j, 0, -j][i]
                    if 0 <= nx < h and 0 <= ny < w:
                        if maze[nx][ny] != '@' and distance[nx][ny] == INF:
                            d.append((nx, ny))
                            distance[nx][ny] = distance[x][y] + 1

                        else:
                            break
                    else:
                        break
                        
        return distance[gx][gy]

    return bfs()

ans=clear_maze(sx-1,sy-1,gx-1,gy-1)

if  ans==-10**9:
    print(-1)
else:
    print(ans)
Problem p02670 (python)

Fixed submission:
import sys
input = sys.stdin.readline

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

distance = [[min(i, j, n - i - 1, n - j - 1) for i in range(n)] for j in range(n)]
check = [[1] * n for i in range(n)]
p = [((i - 1) // n, (i - 1) % n) for i in p]

def move(x,y,nx,ny):
    if distance[nx][ny] > distance[x][y] + check[x][y]:
        distance[nx][ny] = distance[x][y] + check[x][y]
        d.append((nx,ny))

ans = 0
for i, j in p:
    ans += distance[j][i]
    d=[]
    d.append((j,i))
    check[j][i] = 0
    while len(d):
        x, y = d.pop()
        if x!=0:
            move(x,y,x-1,y)
        if x!=n-1:
            move(x,y,x+1,y)
        if y!=0:
            move(x,y,x,y-1)
        if y!=n-1:
            move(x,y,x,y+1)

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from collections import deque

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

distance = [[min(i, j, n - i - 1, n - j - 1) for i in range(n)] for j in range(n)]
check = [[1] * n for i in range(n)]
p = [((i - 1) // n, (i - 1) % n) for i in p]
ans = 0
for i, j in p:
    ans += distance[j][i]
    d = deque((j ,i ,distance[j][i]))
    check[j][i] = 0
    while len(d):
        x, y, dis = d.popleft()
        for i in range(0, 4):
            nx, ny = x + [1, 0, -1, 0][i], y + [0, 1, 0, -1][i]

            if 0 <= nx < n and 0 <= ny < n:
                # 更新できるマスは更新
                if distance[nx][ny] > dis:
                    distance[nx][ny] = dis
                    d.append((nx, ny, dis + check[nx][ny]))

print(ans)
Problem p02703 (python)

Fixed submission:
# ABC 164 E 草案
import sys
sys.setrecursionlimit(10**6)

n,m,s= map(int, input().split())
g= [list(map(int, input().split())) for i in range(m)]
# 両替所
c= [list(map(int, input().split())) for i in range(n)]

x=2501
# 作るグラフ (辺*所有銀貨,必要時間)
gg=[[] for i in range(n*x)]
for i in range(n):
    for j in range(x-1):
        # 金貨を銀貨に交換
        y=j+c[i][0]
        if y>=x-1:
            y=x-1
        gg[i*x+j].append((i*x+y,c[i][1]))


for i in range(1,x):
    for u,v,a,b in g:
        u-=1
        v-=1
        # 銀貨足りる時移動できる
        if i-a>=0:
            gg[v*x+i].append((u*x+i-a,b))
            gg[u*x+i].append((v*x+i-a,b))




#ダイクストラ法
from heapq import heappush, heappop

def dijkstra(edges, size, source):
    # edge=探索するグラフ
    # size=グラフの点の数
    # source=スタート点
    distance = [float('inf')] * size
    distance[source] = 0
    visited = [False] * size
    pq = []
    heappush(pq, (0, source))
    while pq:
        dist_v, v = heappop(pq)
        visited[v] = True
        for u, weight in edges[v]:
            if not visited[u]:
                new_dist = dist_v + weight
                if distance[u] > new_dist:
                    distance[u] = new_dist
                    heappush(pq, (new_dist, u))
    return distance
s=min(s,2500)
ans=dijkstra(gg,n*x,s)

for i in range(1, n):
    print(min(ans[x * i:x * (i + 1)]))

Buggy submission (verdict: Runtime Error):
# ABC 164 E 草案
import sys
sys.setrecursionlimit(10**6)

n,m,s= map(int, input().split())
g= [list(map(int, input().split())) for i in range(m)]
# 両替所
c= [list(map(int, input().split())) for i in range(n)]

x=2501
# 作るグラフ (点,所有銀貨,必要時間)
gg=[[]*x for i in range(n)]
for i in range(n):
    for j in range(x-1):
        # 金貨を銀貨に交換
        y=j+c[i][0]
        if y>=x-1:
            y=x-1
        gg[i][j].append((i,y,c[i][1]))


for i in range(1,x):
    for u,v,a,b in g:
        u-=1
        v-=1
        # 銀貨足りる時移動できる
        if i-a>=0:
            gg[v][i].append((u,i-a,b))
            gg[u][i].append((v,i-a,b))





#ダイクストラ法
from heapq import heappush, heappop

def dijkstra(edges, size, source,gold):
    # edge=探索するグラフ
    # size=グラフの点の数
    # source=スタート点
    distance = [[float('inf')]*x for i in range(n)]
    distance[source][gold] = 0
    visited = [[False]*x for i in range(n)]
    pq = []
    heappush(pq, (0, source,gold))
    while pq:
        dist_v, u,v = heappop(pq)
        visited[u][v] = True
        for u,v, weight in edges[u][v]:
            if not visited[u][v]:
                new_dist = dist_v + weight
                if distance[u][v] > new_dist:
                    distance[u][v] = new_dist
                    heappush(pq, (new_dist, u,v))
    return distance
s=min(2500,s)
ans=dijkstra(gg,n,0,s)

for i in range(1,n):
    print(min(ans[i]))