Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
s = input()

if n %2 == 0:
    print('No')
else:
    flag = True
    for i in range(n):
        if s[i] != s[n//2 + i]:
            flag = False
    if flag:
        print('Yes')
    else:
        print('No')


Fixed submission:
import sys
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
s = input()

if n%2 == 1:
    print('No')
else:
    flag = True
    for i in range(n//2):
        if s[i] != s[n//2 + i]:
            flag = False
    if flag:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Runtime Error):
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
s = input()

if n %2 == 0:
    print('No')
else:
    flag = True
    for i in range(n):
        if s[i] != s[n//2 + i]:
            flag = False
    if flag:
        print('Yes')
    else:
        print('No')

Fixed submission:
import sys
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
s = input()

if n%2 == 1:
    print('No')
else:
    flag = True
    for i in range(n//2):
        if s[i] != s[n//2 + i]:
            flag = False
    if flag:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
n = INT()
if n%2 == 0:
    print((n-2)//2)
else:
    print((n-1)//2)

Fixed submission:
n = int(input())
if n%2 == 0:
    print((n-2)//2)
else:
    print((n-1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import Counter, deque, defaultdict
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))


MOD = 998244353
n = INT()
d = LIST()
if d[0] != 0:
    print(0)
    sys.exit()
d = d[1:]
ma = max(d)
mi = min(d)
res = 1
for i in range(1, ma+1):
    if d.count(i) == 0:
        print(0)
        sys.exit()
    if i == 1:
        temp = d.count(1)
    else:
        temp2 = d.count(i)
        res *= temp**temp2
        temp = temp2

print(res%MOD)

Fixed submission:
import sys
from collections import Counter, deque, defaultdict, OrderedDict
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))


MOD = 998244353
n = INT()
d = LIST()
if d[0] != 0:
    print(0)
    sys.exit()
d = d[1:]
c = dict(Counter(d))
c =  OrderedDict(sorted(c.items()))
c = list(c.values())
if len(c) != max(d):
    print(0)
    sys.exit()
res = 1
for i in range(1, len(c)):
    res *= c[i-1]**c[i]

print(res%MOD)
Buggy python submission (verdict: Runtime Error):
a,b = int(input())
if a >= 10 or b >= 10:
  print(-1)
else:
  print(a*b)

Fixed submission:
import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a, b= MAP()

if a >= 10 or b >= 10:
    print(-1)
else:
    print(a*b)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import Counter, deque, defaultdict
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, k = MAP()
a = LIST()
f = LIST()
a = sorted(a, reverse = True)
f = sorted(f)
heap = []
heapq.heapify(heap)
for i in range(n):
    heapq.heappush(heap, (-1*f[i]*a[i], f[i]))

for i in range(k):
    if len(heap) > 0:
        dot, ff = heapq.heappop(heap)
        dot += ff
        if dot != 0:
            heapq.heappush(heap, (dot, ff))

if len(heap) > 0:
    print(heapq.heappop(heap)[0] * -1)
else:
    print(0)

Fixed submission:
import sys
from collections import Counter, deque, defaultdict
from math import factorial
from fractions import Fraction
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, k = MAP()
a = LIST()
f = LIST()
a = sorted(a, reverse = True)
f = sorted(f)

def ok(x):
    res = 0
    for i in range(n):
        res += max(a[i] - x//f[i], 0)
    return res <= k

l = -1
r = INF
while l+1 < r:
    mid = (l+r)//2
    if ok(mid):
        r = mid
    else:
        l = mid
print(r)
Buggy python submission (verdict: Runtime Error):
import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, k = INT()
h = LIST()
count = 0
for i in h:
    if i >= k:
        count += 1
print(count)


Fixed submission:
import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, k = MAP()
h = LIST()
count = 0
for i in h:
    if i >= k:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a, b = MAP()
gcd = math.gcd(a,b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

prime = prime_factorize(gcd)
print(len(set(prime))+1)

Fixed submission:
import sys
import fractions
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a, b = MAP()
gcd = fractions.gcd(a,b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

prime = prime_factorize(gcd)
print(len(set(prime))+1)
Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
n = INT()
A = LIST()
B = LIST()
C = LIST()
ans = 0
for i in range(n):
  if A[i]+1 == A[i+1]:
    ans += C[i]
print(ans + sum(B))

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
n = INT()
A = LIST()
B = LIST()
C = LIST()
ans = 0
for i in range(n-1):
  if A[i]+1 == A[i+1]:
    ans += C[A[i]-1]
print(ans + sum(B))
Buggy python submission (verdict: Runtime Error):
n = int(input())
print((n(n-1))//2)

Fixed submission:
n = int(input())
print((n*(n-1))//2)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N = INT()
ans=0
for i in range(N):
    ans +=i

print(ans)


Fixed submission:
n = int(input())
print((n*(n-1))//2)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N = INT()
print(sum(range(N)))



Fixed submission:
n = int(input())
print((n*(n-1))//2)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

N = INT()
print(sum([i for i in range(N)]))


Fixed submission:
n = int(input())
print((n*(n-1))//2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [0]*n
for i in range(n):
  a[i] = int(input())

def cal(a):
  return 1/a

aa = cal(a)
aa_sum = sum(aa)

print(cal(aa_sum))

Fixed submission:
from fractions import Fraction
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
  a[i] = Fraction(1, a[i])

print(float(Fraction(1,sum(a))))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
strings = [[]*10 for i in range(n)]
for i in range(n):
    strings[i] = sorted(list(input()))

counter = 0
for i in range(n-1):
    for j in range(i+1,n):
        if strings[i] == strings[j]:
            counter +=1
print(counter)
        

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n = INT()
strings = [[]*10 for i in range(n)]
for i in range(n):
    strings[i] = sorted(list(input()))

strings = sorted(strings)

succession = [0]*n
counter = 0
for i in range(1,n):
    if strings[i] == strings[i-1]:
        succession[i] = succession[i-1]+1
    if strings[i] != strings[i-1] and succession[i-1]>0:
        counter += (succession[i-1]+1)*succession[i-1]//2
    if i == n-1 and succession[i] >0:
        counter += (succession[i]+1)*succession[i]//2

print(counter)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [0]*n
for i in range(n):
  h[i] = int(input())
count = True
for i in range(n-1):
  if h[i+1]-h[i] < -1:
    count = False
    break
  elif h[i+1]-h[i] = -1:
    h[i+1] += 1
if count == True:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
count = True
for i in range(n-1):
  if h[i+1]-h[i] < -1:
    count = False
    break
  elif h[i+1]-h[i] == -1:
    h[i+1] += 1
if count == True:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0

def f(i,j):
    if i == 0 and j == 0:
        return min(a[0], b[0])
    elif i == j:
        return min(a[i] - f(i-1,i), b[i])
    else:
        return min(a[i+1], b[i] - f(i,i))
        
for i in range(n):
    ans += f(i, i)
    ans += f(i, i+1)

print(ans)

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

def f(n):
    nn = min(a[n], b[n])
    nnn = min(a[n+1], b[n] - nn)
    a[n+1] -= nnn
    return nn + nnn

for i in range(n):
    ans += f(i)

print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n,d= int(input())

print(int(np.ceil(n/(2*d+1))))


Fixed submission:
import numpy as np

n, d = map(int, input().split())

print(int(np.ceil(n/(2*d+1))))
Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())
b = a
max1 = max(a)

for i in range(n):
    if a[i] == max1:
        a[i] = 0
        max2 = max(a)
        print(max2)
        a[i] = max1
        
    else:
        print(max1)

Fixed submission:
import numpy as np
n= int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())
    
b = np.array(a)
b = np.sort(b)[::-1]

ans = [0]*n

for i in range(n):
    if a[i] == b[0]:
        ans[i] = b[1]
    else:
        ans[i] = b[0]
        
for i in range(n):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
n= int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())
b = a
max = max(a)
for i in range(n):
    if a[i] == max:
        a[i] = 0
        print(max(a))
        a[i] = max
        
    else:
        print(max)

Fixed submission:
import numpy as np
n= int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())
    
b = np.array(a)
b = np.sort(b)[::-1]

ans = [0]*n

for i in range(n):
    if a[i] == b[0]:
        ans[i] = b[1]
    else:
        ans[i] = b[0]
        
for i in range(n):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

#n, d = map(int, input().split())
n= int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())

for i in range(n):
    ii = a[i]
    a[i]= 0
    m = max(a)
    a[i] = ii
    print(m)




Fixed submission:
import numpy as np
n= int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())
    
b = np.array(a)
b = np.sort(b)[::-1]

ans = [0]*n

for i in range(n):
    if a[i] == b[0]:
        ans[i] = b[1]
    else:
        ans[i] = b[0]
        
for i in range(n):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

#n, d = map(int, input().split())
n= int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())

for i in range(n):
    ii = a[i]
    a[i]= 0
    m = max(a)
    a[i] = ii
    print(m)


def max(mat):
    max = 0
    for i in range(len(mat)):
        if mat[i] > max:
            max = mat[i]

    return max

Fixed submission:
import numpy as np
n= int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())
    
b = np.array(a)
b = np.sort(b)[::-1]

ans = [0]*n

for i in range(n):
    if a[i] == b[0]:
        ans[i] = b[1]
    else:
        ans[i] = b[0]
        
for i in range(n):
  print(ans[i])
Buggy python submission (verdict: Runtime Error):
a,b,c = int(input())
print(min(a*b,c))

Fixed submission:
import sys
import fractions
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a,b,c = MAP()
print(min(a*b,c))

Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())
import numpy as np
LL = L%2019
RR = R%2019
min = 2019


for i in range(LL, RR+1):
    for j in range(i+1, RR+1):
        if (i*j)%2019 < min:
            min= (i*j)%2019

        if (i*j)%2019 == 0:
            min = 0
            break
    else:
        continue
    break
        

print(min)

Fixed submission:
import sys
import fractions
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a,b,c = MAP()
print(min(a*b,c))

Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())
import numpy as np
LL = L%2019
RR = R%2019
min = 2019


for i in range(LL, RR+1):
  for j in range(i+1, RR+1):
    if (i*j)%2019 == 0:
      min = 0
      break
    elif (i*j)%2019 < min:
      min= (i*j)%2019


print(min)


Fixed submission:
import sys
import fractions
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a,b,c = MAP()
print(min(a*b,c))

Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())
import numpy as np
min = 2019
for i in range(L, R+1):
    for j in range(i+1, R+1):
        if (i*j)%2019 < min:
            min = (i*j)%2019

print(min)


Fixed submission:
import sys
import fractions
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a,b,c = MAP()
print(min(a*b,c))
Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())
import numpy as np
LL = L%2019
RR = R%2019
min = 2019


for i in range(LL, RR+1):
	for j in range(i+1, RR+1):
    	if (i*j)%2019 == 0:
        	min = 0
        	break
        elif (i*j)%2019 < min:
            min= (i*j)%2019


print(min)


Fixed submission:
L, R = map(int, input().split())
import numpy as np
LL = L%2019
RR = R%2019

min = 2019
if LL >= RR:
    min = 0
elif R-L >= 2018:
    min = 0
else:
    for i in range(LL, RR+1):
        for j in range(i+1, RR+1):
            if (i*j)%2019 < min:
                min = (i*j)%2019
            if (i*j)%2019 == 0:
                min = 0
                break
        else:
            continue
        break


print(min)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())
import numpy as np
min = 2019
for i in range(L, R+1):
    for j in range(i+1, R+1):
        if (i*j)%2019 < min:
            min = (i*j)%2019

print(min)

Fixed submission:
L, R = map(int, input().split())
import numpy as np
LL = L%2019
RR = R%2019

min = 2019
if LL >= RR:
    min = 0
elif R-L >= 2018:
    min = 0
else:
    for i in range(LL, RR+1):
        for j in range(i+1, RR+1):
            if (i*j)%2019 < min:
                min = (i*j)%2019
            if (i*j)%2019 == 0:
                min = 0
                break
        else:
            continue
        break


print(min)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, e, s, t = MAP()
s-= 1
t-= 1    
G1 = [[]for i in range(n)]
G2 = [[]for i in range(n)]       

for i in range(e):
    fr, to, w1, w2 = MAP()
    G1[fr-1].append((w1, to -1))
    G1[to-1].append((w1, fr -1))
    G2[fr-1].append((w2, to -1))
    G2[to-1].append((w2, fr -1))


def djkstra(s,G):
    n = len(G)
    visited = [False]*n     
    d = [INF]*n
    que = []
    heapq.heapify(que)
    d[s] = 0
    visited[s] = True
    heapq.heappush(que, (0,s))

    while(len(que)>0):
        vs = heapq.heappop(que)
        distance = vs[0]
        vertex = vs[1]
        d[vertex] = min(d[vertex],distance)
        visited[vertex] = True
        for Gs in G[vertex]:
            if not visited[Gs[1]]:
                heapq.heappush(que,(d[vertex]+Gs[0], Gs[1]))
    return d

d_yen = djkstra(s,G1)
d_snuuk = djkstra(t,G2)

d_sum = [0]*n

for i in range(n):
    d_sum[i] = d_yen[i] + d_snuuk[i]

d_sum.reverse()
d_ans = [0]*n
d_ans[0] = d_sum[0]
for i in range(1,n):
    d_ans[i] = min(d_ans[i-1],d_sum[i])

for i in range(n-1,-1,-1):
    print(10**15 - d_ans[i])



Fixed submission:
import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, e, s, t = MAP()
s-= 1
t-= 1    
G1 = [[]for i in range(n)]
G2 = [[]for i in range(n)]       

for i in range(e):
    fr, to, w1, w2 = MAP()
    G1[fr-1].append((w1, to -1))
    G1[to-1].append((w1, fr -1))
    G2[fr-1].append((w2, to -1))
    G2[to-1].append((w2, fr -1))


def djkstra(s,G):
    visited = [False]*n     #その頂点を確定したかどうか
    d = [INF]*n
    que = []
    heapq.heapify(que)
    heapq.heappush(que, (0,s))

    while(len(que)>0):
        vs = heapq.heappop(que)
        distance = vs[0]
        vertex = vs[1]
        if visited[vertex]:
            continue
        d[vertex] = distance
        visited[vertex] = True
        for Gs in G[vertex]:
            if d[Gs[1]] <= distance+Gs[0]:
                continue
            heapq.heappush(que,(distance+Gs[0], Gs[1]))
    
    return d

d_yen = djkstra(s,G1)
d_snuuk = djkstra(t,G2)

d_sum = [0]*n

for i in range(n):
    d_sum[i] = d_yen[i] + d_snuuk[i]

d_sum.reverse()
d_ans = [0]*n
d_ans[0] = d_sum[0]
for i in range(1,n):
    d_ans[i] = min(d_ans[i-1],d_sum[i])

for i in range(n-1,-1,-1):
    print(10**15 - d_ans[i])
Buggy python submission (verdict: Runtime Error):
ss = input()
t = insput()

def search(ss,t):
    ans = []
    if len(ss) < len(t):
        return ans
    for i in range(len(ss) - len(t), -1, -1):
        ss_cut = ss[i:len(t)+i]
        flag = True
        for j in range(len(t)):
            if ss_cut[j] != '?' and ss_cut[j] != t[j]:
                flag = False
        if flag:
            ss_ans = ss.replace(ss[i:len(t)+i], t)
            while '?' in ss_ans:
                ss_ans = ss_ans.replace('?', 'a')
            ans.append(ss_ans)
    return ans

if len(search(ss, t)) == 0:
    print('UNRESTORABLE')
else:
    ans_list = sorted(search(ss, t))
    print(ans_list)
    s = ans_list[0]
    print(s)

Fixed submission:
ss = input()
tt = input()
ans = ''
for i in range(len(ss)-len(tt)+1):
    flag = True
    for s,t in zip(ss[i:],tt):
        if s != '?' and s != t:
            flag = False
            break
    if flag:
        ans = ss[:i] + tt + ss[i+len(tt):]

if ans !='':
    print(ans.replace('?','a'))
else:
    print('UNRESTORABLE')