Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))
q = []
for i in p:
    q.append((1+i) / 2)

ans = 0
for i in range(len(q)):
    ans = max(ans, sum(q[i:i+k]))
print(ans)

Fixed submission:
n, k = map(int, input().split())
p = [(1+int(x)) / 2.0 for x in input().split()]

ans = sum(p[0:k])
tmp = sum(p[0:k])

for i in range(0, n-k):
    tmp = tmp - p[i] + p[i+k]
    ans = max(ans, tmp)

print(ans)

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

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

q = np.zeros_like(p, dtype='float')
for i in range(n):
    q[i] += (1+p[i]) / 2.0

ans = 0
for i in range(n):
    ans = max(ans, sum(q[i:i+k]))
print(ans)

Fixed submission:
n, k = map(int, input().split())
p = [(1+int(x)) / 2.0 for x in input().split()]

ans = sum(p[0:k])
tmp = sum(p[0:k])

for i in range(0, n-k):
    tmp = tmp - p[i] + p[i+k]
    ans = max(ans, tmp)

print(ans)

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

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

q = np.zeros_like(p, dtype='float')
for i in range(n):
    q[i] += (1+p[i]) / 2.0

ans = 0
for i in range(n):
    ans = max(ans, sum(q[i:i+k]))
print(ans)

Fixed submission:
n, k = map(int, input().split())
p = [(1+int(x)) / 2.0 for x in input().split()]

ans = sum(p[0:k])
tmp = sum(p[0:k])

for i in range(0, n-k):
    tmp = tmp - p[i] + p[i+k]
    ans = max(ans, tmp)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int, input().split()))
q = []
for i in p:
    q.append((1+i) / 2)

ans = 0
for i in range(len(q)):
    ans = max(ans, sum(q[i:i+k]))
print(ans)

Fixed submission:
n, k = map(int, input().split())
p = [(1+int(x)) / 2.0 for x in input().split()]

ans = sum(p[0:k])
tmp = sum(p[0:k])

for i in range(0, n-k):
    tmp = tmp - p[i] + p[i+k]
    ans = max(ans, tmp)

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

def cal(n):
    return a*n + b*len(str(n))

l = 0
r = 10**9+1

while r-l > 1:
    n = (l+r) // 2
    if cal(n) >= x:
        r = n
    else:
        l = n

print(n)

Fixed submission:
s = input()
if s == "SUN":
  print(7)
elif s == "MON":
  print(6) 
elif s == "TUE":
  print(5)
elif s == "WED":
  print(4)
elif s == "THU":
  print(3)
elif s == "FRI":
  print(2)
else:
  print(1)
Buggy python submission (verdict: Time Limit Exceeded):
s = list(map(int , input()))
n = len(s)
i = 0
while True:
    try:
        if s[i] + s[i+1] == 1:
            del s[i]
            del s[i]
            i = 0
        else:
            i += 1
    except:
        break
print(n - len(s))

Fixed submission:
import numpy as np

s = np.array(list(map(int , input())))
n = np.count_nonzero(s == 0)
print(2 * min(len(s)-n, n))
Buggy python submission (verdict: Runtime Error):
#include<bits/stdc++.h>
using namespace std;

int main(){
    int X;
    cin >> X;
    if ((X == 3) || (X == 5) || (X == 7)){
        cout << "YES" << endl;
    }else {
        cout << "NO" << endl;
    }
}

Fixed submission:
x = int(input())
if (x == 7) or (x == 5) or (x == 3):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
lis = list(map(int, input().split()))
lis.sort()
print(lis[2]*10 + lis[1] + lis[0])

Fixed submission:
lis = list(map(int, input().split()))
lis.sort()
print(lis[2]*10 + lis[1] + lis[0])
Buggy python submission (verdict: Runtime Error):
N , M , X = map(int,input().split())
C = []
A = []
for _ in range(N):
    CA = list(map(int,input().split()))
    C.append(CA[0])
    A.append(CA[1:])

ans = float('inf')
for i in range(2**N):
    Level = [0]* M
    Cost = 0
    
    for j in range(N):
        if (i>>j)&1:
            Cost += C[j]
            for k in range(M):
                Level[​ Cost)

if ans != float('inf'):
    print(ans)
else:
    print('-1')

Fixed submission:
N , M , X = map(int,input().split())
C = []
A = []
for _ in range(N):
    CA = list(map(int,input().split()))
    C.append(CA[0])
    A.append(CA[1:])

ans = float('inf')
for i in range(2**N):
    Level = [0]* M
    Cost = 0
    
    for j in range(N):
        if (i>>j)&1:
            Cost += C[j]
            for k in range(M):
                Level[k] += A[j][k]
                
    if all([Level[l] >= X for l in range(M)]):
        ans = min(ans, Cost)

if ans != float('inf'):
    print(ans)
else:
    print('-1')
Buggy python submission (verdict: Runtime Error):
A , B , N = map(int, input().split())

if B > N:
    print(A*N//B)
else:
    print(A*(B-1)//B

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

if B > N:
    print(A*N//B)
else:
    print(A*(B-1)//B)

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

if B > N:
    print(A*N//B)
else:
    print(A*(B-1)//B-A*(b-1)//B)

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

if B > N:
    print(A*N//B)
else:
    print(A*(B-1)//B)

Buggy python submission (verdict: Time Limit Exceeded):
A , B , N = map(int, input().split())

if B > N:
    print(A*N//B)
else:
    L = []
    for x in range(B-1,N):
        L.append(A*x//B-A*(x//B))
    print(max(L))

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

if B > N:
    print(A*N//B)
else:
    print(A*(B-1)//B)

Buggy python submission (verdict: Time Limit Exceeded):
A , B , N = map(int, input().split())

if B > N:
    print(A*N//B)
else:
    L = []
    for x in range(N):
        L.append(A*x//B-A*(x//B))
    print(max(L))

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

if B > N:
    print(A*N//B)
else:
    print(A*(B-1)//B)
Buggy python submission (verdict: Runtime Error):
import math

A , B = map( int , input().split() )

print( A * B // math.gcd( A , B ))

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

import fractions

print( A * B // fractions.gcd( A , B ))

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

import math

print( A * B // math.gcd( A , B ))

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

import fractions

print( A * B // fractions.gcd( A , B ))
Buggy python submission (verdict: Runtime Error):
n = int(input())
min_height = int(input())

height = []
for _ in range(n):
    height.append(int(input()))
height.sort(reverse=True)

cnt = 0
for h in height:
    if h < min_height:
        break
    cnt += 1
print(cnt)


Fixed submission:
n, min_height = map(int, input().split())
height = list(map(int, input().split()))
height.sort(reverse=True)

cnt = 0
for h in height:
    if h < min_height:
        break
    cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
mod, min_value = 2019, 2019
l, r = map(int, input().split())
length = r - l
for i in range(mod):
  for j in range(mod):
    if length - j - i <= 0:
      break
    min_value = min(min_value, (l + i) * (r - j) % mod)
print(min_value)

Fixed submission:
mod, min_value = 2019, 2019
l, r = map(int, input().split())
length = r - l
for i in range(mod):
  for j in range(mod):
    if length - j - i <= 0 or min_value == 0:
      break
    min_value = min(min_value, (l + i) * (r - j) % mod)
print(min_value)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd

def ceil(a, b):
  return -(-a//b)

a, b, c, d = map(int, input().split())
if c == 1:
  print(0)
  sys.exit()
cd_lcm = c*d//gcd(c, d)
c_left, c_right = ceil(a,c), b//c
d_left, d_right = ceil(a,d), b//d
cd_left, cd_right = ceil(a,cd_lcm), b//(cd_lcm)
cv, dv, cdv = c_right - c_left + 1, d_right - d_left + 1, cd_right - cd_left + 1
print((b - a + 1) - (cv + dv - cdv))

Fixed submission:
import sys
from math import ceil
from fractions import gcd

a, b, c, d = map(int, input().split())
if c == 1:
  print(0)
  sys.exit()
cd_lcm = c*d//gcd(c, d)
c_left, c_right = ceil(a/c), b//c
d_left, d_right = ceil(a/d), b//d
cd_left, cd_right = ceil(a/cd_lcm), b//(cd_lcm)
cv, dv, cdv = c_right - c_left + 1, d_right - d_left + 1, cd_right - cd_left + 1
print((b - a + 1) - (cv + dv - cdv))
Buggy python submission (verdict: Runtime Error):
from itertools import combinations
import numpy as np
n,m,x = map(int,input().split())
a_list = []
price_list = []
for _ in range(n):
    tmp = list(map(int,input().split()))
    price_list.append(tmp.pop(0))
    a_list.append(tmp)
    
all_list = [x for x in range(len(a_list))]
prices = []
for i in range(1,len(a_list)+1):
    for y in combinations(all_list,i):
        tmp = np.zeros(3)
        price = 0
        for ch in y:
            tmp += np.array(a_list[ch])
            price += price_list[ch]
        if np.all(tmp>=x):
            prices.append(price)
if prices != []:
    print(min(prices))
else:
    print(-1)

Fixed submission:
from itertools import combinations
import numpy as np
n,m,x = map(int,input().split())
a_list = []
price_list = []
for _ in range(n):
    tmp = list(map(int,input().split()))
    price_list.append(tmp.pop(0))
    a_list.append(tmp)
    
all_list = [x for x in range(len(a_list))]
prices = []
for i in range(1,len(a_list)+1):
    for y in combinations(all_list,i):
        tmp = np.zeros(m)
        price = 0
        for ch in y:
            tmp += np.array(a_list[ch])
            price += price_list[ch]
        if np.all(tmp>=x):
            prices.append(price)
if prices != []:
    print(min(prices))
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
from itertools import combinations
import math
n = int(input()
ans = 0
for r in range(1,4): 
    if r>n:
        break
    for x  in combinations([x+1 for x in range(n)],r):
        if len(x)==1:
            ans += x[0]
        elif len(x)==2:
            ans += math.gcd(x[0],x[1])*6
        else:
            tmp = math.gcd(x[0],x[1])
            ans += math.gcd(x[2],tmp)*6
print(ans)

Fixed submission:
from itertools import combinations
import math
n = int(input())
ans = 0
for r in range(1,4): 
    if r>n:
        break
    for x  in combinations([x+1 for x in range(n)],r):
        if len(x)==1:
            ans += x[0]
        elif len(x)==2:
            ans += math.gcd(x[0],x[1])*6
        else:
            tmp = math.gcd(x[0],x[1])
            ans += math.gcd(x[2],tmp)*6
print(ans)

Buggy python submission (verdict: Runtime Error):
from itertools import combinations
import math
n = int(input()
ans = 0
for r in range(1,4): 
    
    if r>n:
        break
    for x  in combinations([x+1 for x in range(n)],r):
        print(x)
        if len(x)==1:
            ans += x[0]
        elif len(x)==2:
            ans += math.gcd(x[0],x[1])*6
        else:
            tmp = math.gcd(x[0],x[1])
            ans += math.gcd(x[2],tmp)*6
print(ans)

Fixed submission:
from itertools import combinations
import math
n = int(input())
ans = 0
for r in range(1,4): 
    if r>n:
        break
    for x  in combinations([x+1 for x in range(n)],r):
        if len(x)==1:
            ans += x[0]
        elif len(x)==2:
            ans += math.gcd(x[0],x[1])*6
        else:
            tmp = math.gcd(x[0],x[1])
            ans += math.gcd(x[2],tmp)*6
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
 
if (S == 'AAA') or (S=='BBB'):
  print 'No'
else:
  print 'Yes'


Fixed submission:
S = input()
 
if (S == 'AAA') or (S=='BBB'):
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
S = input()
 
if S == 'AAA' or 'BBB':
  print 'No'
else:
  print 'Yes'

Fixed submission:
S = input()
 
if (S == 'AAA') or (S=='BBB'):
  print('No')
else:
  print('Yes')

Buggy python submission (verdict: Runtime Error):
S = input().strip()

if S == 'AAA' or 'BBB':
  return 'No'
else:
  return 'Yes'

Fixed submission:
S = input()
 
if (S == 'AAA') or (S=='BBB'):
  print('No')
else:
  print('Yes')
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int,input().split())
re = ''
while len(re)<N:
    re+='b'*A
    re+='r'*B

print(re[:N].count('b'))

Fixed submission:
N, A, B = map(int,input().split())
a = N//(A+B)
b = N%(A+B)
if b>A:
    print(A*a+A)
else:
    print(A*a+b)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
a_interval = list(map(int,[a/0.08,(a+1)/0.08]))
b_interval = list(map(int,[b/0.1,(b+1)/0.1]))
a_interval = [x for x in range(a_interval[0],a_interval[1]+1)]
b_interval = [x for x in range(b_inaterval[0],b_interval[1]+1)]
tmp = set(a_interval) & set(b_interval)
if tmp == set():
    print(-1)
else:
    print(min(tmp))

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

import math 
a = [x for x in range(math.ceil(A*12.5),math.ceil((A+1)*12.5))]
b = [x for x in range(math.ceil(B*10),math.ceil((B+1)*10))]

c = set(a) & set(b)

if c != set():
  print(min(c))
else:
  print(-1)

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

import math 
a = [x for x in range(math.ceil(A*12.5),math.ceil((A+1)*12.5))]
b = [x for x in range(math.ceil(B*10),math.ceil((B+1)*10))]

c = set(a) & set(b)

if c != {}:
  print(min(c))
else:
  print(-1)

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

import math 
a = [x for x in range(math.ceil(A*12.5),math.ceil((A+1)*12.5))]
b = [x for x in range(math.ceil(B*10),math.ceil((B+1)*10))]

c = set(a) & set(b)

if c != set():
  print(min(c))
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
p_li = list(map(int,input().split()))
min_v = p_li[0]
ans=1
for x in p_li:
    if x == 1
    	ans+=1
        break
    if min_v>=x:
        min_v=x
    else:
        ans+=1
print(ans)

Fixed submission:
n = int(input())
p_li = list(map(int,input().split()))
min_v = p_li[0]
ans=1
for x in p_li:
    if min_v>x:
        min_v=x
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
ans_p = 0
defa = [_ for _ in range(1,n+1)]
for i,x in enumerate(p):
    
    index = defa.index(x)
    ans_p += math.factorial(n-i-1)*len(defa[:index])
    defa.remove(x)
    
ans_q = 0
defa = [_ for _ in range(1,n+1)]
for i,x in enumerate(q):
    index = defa.index(x)
    ans_q += math.factorial(n-i-1)*len(defa[:index])
    defa.remove(x)
    
print(abs(ans_p-ans_q))

Fixed submission:
n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
import math

ans_p = 0
defa = [_ for _ in range(1,n+1)]
for i,x in enumerate(p):
    index = defa.index(x)
    ans_p += math.factorial(n-i-1)*len(defa[:index])
    defa.remove(x)
    
ans_q = 0
defa = [_ for _ in range(1,n+1)]
for i,x in enumerate(q):
    index = defa.index(x)
    ans_q += math.factorial(n-i-1)*len(defa[:index])
    defa.remove(x)
    
print(abs(ans_p-ans_q))
Buggy python submission (verdict: Runtime Error):
n = int(input())
import math
start = math.floor(math.sqrt(n))
for i in reversed(range(start)):
    if n/i == int(n/i):
        break
print(i+n//i-2)

Fixed submission:
n = int(input())
import math
start = math.floor(math.sqrt(n))
for i in reversed(range(start+1)):
    if i == 0:
        i = n
    else:
        if n/i == int(n/i):
            break
print(i+n//i-2)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
from fractions import gcd
import math
ab_gcd = fractions.gcd(a,b)
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return []
    else:
        factor.append(n)
        return factor
res = trial_division(ab_gcd)
print(len(set(res+[1])))

Fixed submission:
a,b = map(int,input().split())
from fractions import gcd
import math
ab_gcd = gcd(a,b)
def trial_division(n):
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return [1,n]
    else:
        factor.append(n)
        return factor
res = trial_division(ab_gcd)
print(len(set(res+[1])))
Buggy python submission (verdict: Runtime Error):
n = int(input())
h_li = list(map(int,input().split()))
tmp = h_li[0]
move = 0
res = []
for i,x in enumerate(h_li[1::]):
    if tmp >= x:
        move += 1
        tmp = x
        if i == len(h_li)-2:
            res.append(move)
    else:
        res.append(move)
        move = 0
        tmp = x
        
print(max(res))

Fixed submission:
n = int(input())
h_li = list(map(int,input().split()))
tmp = h_li[0]
move = 0
res = [0]
for i,x in enumerate(h_li[1::]):
    if tmp >= x:
        move += 1
        tmp = x
        if i == len(h_li)-2:
            res.append(move)
    else:
        res.append(move)
        move = 0
        tmp = x
        
print(max(res))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = [x+1 for x in range(n)]
b = a[1::]+[1]
a = np.array(a)
b = np.array(b)

c = a%b
print(sum(c))

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

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
a = np.array([x+1 for x in range(n)])
b = np.array([x+1 for x in range(1,n)]+[1])

c = a%b
print(sum(c))

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

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [x+1 for x in range(n)]
b = [x+1 for x in range(1,n)]+[1]
ans = 0
for x,y in zip(a,b):
    ans += x%y
    
print(ans)

Fixed submission:
n = int(input())
print((n*(n-1)//2))
Buggy python submission (verdict: Runtime Error):
n,d = map(int,input().split())
x_list_kai = [list(map(int,input().split())) for x in range(3)]


import itertools,math
dis = []
for x in itertools.combinations(x_list_kai,2):
    distance = 0
    for dim in range(0,d):
        result  = 0
        for y in x:
            if result == 0:
                result = y[dim]
            else:
                result -= y[dim]
            
        result  = result **2
        distance += result
    dis.append(math.sqrt(distance))
    
counter = 0
for i in dis:
    if i.is_integer() == True:
        counter += 1
print(counter)

Fixed submission:
n,d = map(int,input().split())
x_list_kai = [list(map(int,input().split())) for x in range(n)]


import itertools,math
dis = []
for x in itertools.combinations(x_list_kai,2):
    distance = 0
    for dim in range(0,d):
        result  = 0
        for y in x:
            if result == 0:
                result = y[dim]
            else:
                result -= y[dim]
            
        result  = result **2
        distance += result
    dis.append(math.sqrt(distance))
    
counter = 0
for i in dis:
    if i.is_integer() == True:
        counter += 1
print(counter)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
import math
lcm = int(c*d/math.gcd(c,d))
a_1 = a-1
panish = (int(b/c)+int(b/d)-int(b/lcm))-((int(a_1/c)+int(a_1/d))-int(a_1/lcm))
print(b-a_1-panish)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
a,b,c,d = map(int,input().split())
import math
lcm = c*d//gcd(c,d)
a_1 = a-1
panish = ((b//c)+(b//d)-(b//lcm))-(((a_1//c)+(a_1//d))-(a_1//lcm))
print(b-a_1-panish)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a_b_list = [list(map(int,input().split())) for x in range(n)]
a_b_list_kai = [[int(a_b_list[x]),int(a_b_list[x+1])] for x in range(0,n*2,2)]
sorted(a_b_list_kai,key = lambda x:x[1])
limit = 0
result = 0
sum_task = 0
for x in a_b_list_kai:
    sum_task += x[0]
    limit = max(limit,x[1])
    if sum_task > limit:
        result = 1

if result == 1:
    print('No')
else:
    print('Yes')

Fixed submission:
n = int(input())
a_b_list_kai = [list(map(int,input().split())) for x in range(n)]

a_b_list_kai = sorted(a_b_list_kai,key = lambda x:x[1])
limit = 0
result = 0
sum_task = 0
for x in a_b_list_kai:
    sum_task += x[0]
    limit = max(limit,x[1])
    if sum_task > limit:
        result = 1

if result == 1:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

cont = 0
y = s[::-1]
for i,x in enumerate(y):
    print(i,y[i])
    if x == "?":
        cont += 1
        if cont == len(t):
            break
        elif (cont == len(t)-1)&(y[i+1] == t[0]):
            break
    else:
        cont = 0
            
if cont == 0:
    print("UNRESTORABLE")
else:
    print((s[:len(s)-i-1]+t+s[len(s)-i+len(t):]).replace("?","a"))

Fixed submission:
s = input()
t = input()

flg = 0
y = s[::-1]
z = t[::-1]
result = []
for j,x in enumerate(range(0,len(y))):
    result = []
    for i,k in enumerate(y[x:x+len(t)]):
        if (k == z[i])|(k=="?"):
            result.append(True)
    if all(result)&(len(result)==len(t)):
        flg = 1
        break
if flg == 1:
    print((s[:len(s)-j-len(t)]+t+s[len(s)-j:]).replace("?","a"))
else:
    print("UNRESTORABLE")

Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

y = s[::-1]
for i,x in enumerate(y):
    print(i,y[i])
    if x == "?":
        cont += 1
        if cont == len(t):
            break
        elif (cont == len(t)-1)&(y[i+1] == t[0]):
            break
    else:
        cont = 0
            
if cont == 0:
    print("UNRESTORABLE")
else:
    print((s[:len(s)-i-1]+t+s[len(s)-i+len(t):]).replace("?","a"))

Fixed submission:
s = input()
t = input()

flg = 0
y = s[::-1]
z = t[::-1]
result = []
for j,x in enumerate(range(0,len(y))):
    result = []
    for i,k in enumerate(y[x:x+len(t)]):
        if (k == z[i])|(k=="?"):
            result.append(True)
    if all(result)&(len(result)==len(t)):
        flg = 1
        break
if flg == 1:
    print((s[:len(s)-j-len(t)]+t+s[len(s)-j:]).replace("?","a"))
else:
    print("UNRESTORABLE")
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input())
path = [map(int,input()) for x in range(m)]

table = [[] for x in range(n)]
for x in path:
    table[int(x[0])-1].append(int(x[1])-1)
    table[int(x[1])-1].append(int(x[0])-1)
    
import itertools
count = 0
for z in itertools.permutations(range(0,n)):
    if z[0] == 0:
        print(z)
        for y in range(len(z)-1):
            if z[y+1] in table[z[y]]:
                continue
            else:
                count -= 1
                break
        count += 1

Fixed submission:
n,m = map(int,input().split())
path = [input().split() for x in range(m)]

table = [[] for x in range(n)]
for x in path:
    table[int(x[0])-1].append(int(x[1])-1)
    table[int(x[1])-1].append(int(x[0])-1)
    
import itertools
count = 0
for z in itertools.permutations(range(0,n)):
    if z[0] == 0:
        for y in range(len(z)-1):
            if z[y+1] in table[z[y]]:
                continue
            else:
                count -= 1
                break
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np
k = int(input())
ans = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=np.gcd(np.gcd(a,b),c)
print(ans)

Fixed submission:
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) #再帰定義
k = int(input())
ans = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=gcd(gcd(a,b),c)
print(ans)