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

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
x, a, b = MAP()
if abs(a-x) > abs(b-x):
	print("B")
else:
	print("A")

Buggy submission (verdict: Runtime Error):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

N = INT()
S1 = input()
S2 = input()

if 1 < N and S1[0] == S1[1]:
	ans = 6
	tmp = 2
	flg = 1
else:
	ans = 3
	tmp = 1
	flg = 0


while tmp < N:
	if tmp < N-1 and S1[tmp] == S1[tmp+1]:
		if flg:
			ans *= 3
		else:
			ans *= 2
		flg = 1
		tmp += 2

	else:
		if flg:
			ans *= 1
		else:
			ans *= 2
		flg = 0
		tmp += 1
	ans %= mod


print(ans)
Problem p03672 (python)

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
S = input()

for i in range(1, len(S)//2):
	c = len(S) - 2*i
	ss = S[:c]
	if ss[:c//2] == ss[c//2:]:
		print(c)
		exit()
else:
	print(0)

Buggy submission (verdict: Runtime Error):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
S = input()

for i in range(1, len(S)):
	T = S[:-2*i]
	if T[:len(T)//2] == T[len(T//2:)]:
		print(len(T))
		break
Problem p03681 (python)

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *
		
#階乗#
lim = 10**5+1  #必要そうな階乗の限界を入力
fact = [1] * (lim+1)
for n in range(1, lim+1):
	fact[n] = n * fact[n-1] % mod

N, M = MAP()

if 1 < abs(N-M):
	print(0)
	exit()

ans = (fact[N]*fact[M])%mod

if N == M:
	ans = 2*ans%mod

print(ans)

Buggy submission (verdict: Runtime Error):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees#, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
#from decimal import *
		
#階乗#
lim = 10**5+1  #必要そうな階乗の限界を入力
fact = [1] * (lim+1)
for n in range(1, lim+1):
	fact[n] = n * fact[n-1] % mod

N, M = MAP()

if 1 < abs(N-M):
	print(0)
	exit()

zans = (fact[N]*fact[M])%mod

if N == M:
	ans = 2*ans%mod

print(ans)
Problem p04043 (python)

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
A = LIST()
 
if all(x in A for x in [5,7]) and sum(A) == 17:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
 

Copy
Copy
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
A = LIST()
if A.sort() == [5, 5, 7]:
	print("YES")
else:
	print("NO")
Problem p04045 (python)

Fixed submission:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
import numpy as np
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

"""
lim = 2*10**5   #必要そうな階乗の限界を入力

#階乗#
fact = [1] * (lim+1)
for n in range(1, lim+1):
	fact[n] = n * fact[n-1] % mod

#階乗の逆元#
fact_inv = [1]*(lim+1)
fact_inv[lim] = pow(fact[lim], mod-2, mod)
for n in range(lim, 0, -1):
	fact_inv[n-1] = n*fact_inv[n]%mod

def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod

"""

N, K = MAP()
D = LIST()

while 1:
	if set(list(str(N))) & set(D) == set():
		print(N)
		break
	N += 1

Buggy submission (verdict: Runtime Error):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
import numpy as np
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

"""
lim = 2*10**5   #必要そうな階乗の限界を入力

#階乗#
fact = [1] * (lim+1)
for n in range(1, lim+1):
	fact[n] = n * fact[n-1] % mod

#階乗の逆元#
fact_inv = [1]*(lim+1)
fact_inv[lim] = pow(fact[lim], mod-2, mod)
for n in range(lim, 0, -1):
	fact_inv[n-1] = n*fact_inv[n]%mod

def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod

"""

N, K = MAP()
D = LIST()

while 1:
	if set(list(str(N))) & set(D) == set():
		print(N)
		break
	N += 1
Problem p02573 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 9)

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

root = [-1]*n

def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 
    root[x] += root[y]
    root[y] = x

def size(x):
    x = find(x)
    return -root[x]

for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    unite(a,b)

ans = 0
for i in range(n):
    ans = max(ans, size(i))

print(ans)

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

root = [-1]*n

def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]

def unite(x,y):
    x = find(x)
    y = find(y)
    if x == y:
        return 
    root[x] += root[y]
    root[y] = x

def size(x):
    x = find(x)
    return -root[x]

for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    unite(a,b)

ans = 0
for i in range(n):
    ans = max(ans, size(i))

print(ans)
Problem p02608 (python)

Fixed submission:
n = int(input())

lis = [0] * (n+1)


for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            t = i**2 + j**2 + k**2 + i*j + j*k + i*k
            tmp = [i,j,k]
            
            if t <= n:
                lis[t] += 1

for i in range(1,n+1):
    print(lis[i])

Buggy submission (verdict: Runtime Error):
n = int(input())

lis = [0] * (10000+1)

s  = n**0.5

for i in range(1, s):
    for j in range(1, s):
        for k in range(1, s):
            t = i**2 + j**2 + k**2 + i*j + j*k + i*k
            tmp = [i,j,k]
            
            if t <= 10001:
                if len(set(tmp)) == 1:
                    lis[t-1] = 1
                elif len(set(tmp)) == 2:
                    lis[t-1] = 3
                else:
                    lis[t-1] = 6

for i in range(n):
    print(lis[i])
Problem p02630 (python)

Fixed submission:
n = int(input())
lis = list(map(int,input().split()))
q = int(input())
total = sum(lis)

nlis = [0] * 100002

for i in lis:
    nlis[i-1] += 1

for i in range(q):
    b, c = map(int,input().split())
    total = total -(b*nlis[b-1]) + (c*nlis[b-1])
    nlis[c-1] += nlis[b-1]
    nlis[b-1] = 0
    print(total)

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
lis = list(map(int,input().split()))
q = int(input())
total = sum(lis)

nlis = [0] * 10001

for i in lis:
    nlis[i-1] += 1

for i in range(q):
    b, c = map(int,input().split())
    total = total -(b*nlis[b-1]) + (c*nlis[b-1])
    nlis[c-1] += nlis[b-1]
    nlis[b-1] = 0
    print(total)
Problem p02645 (python)

Fixed submission:
s = input()

print(s[:3])

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

kyo = abs(b - a)
ti = v - w

if w >= v:
    print("NO")
    exit()


if round(kyo / ti) <= t:
    print("YES")
else:
    print("NO")
Problem p02646 (python)

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

kyo = abs(b - a)
ti = v - w

if w >= v:
    print("NO")
    exit()


if kyo / ti <= t:
    print("YES")
else:
    print("NO")

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

kyo = abs(b - a)
ti = abs(v -w)

if kyo == 0:
    print("YES")
    exit()

if w > v or kyo % ti != 0:
    print("NO")
    exit()


if kyo / ti <= t:
    print("YES")
    exit()

print("NO")
Problem p02657 (python)

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

print(a*b)

Buggy submission (verdict: Runtime Error):
from operator import mul
from functools import reduce
 
n = int(input())
lis = list(map(int, input().split()))
 
ans = reduce(mul, lis)
 
if ans > 10**18:
    print("-1")
else:
    print(ans)
Problem p02765 (python)

Fixed submission:
N, R = map(int, input().split())
 
if N > 10:
  print(R)
else:
  ans = R + (100*(10-N))
  print(ans)

Buggy submission (verdict: Runtime Error):
スコード 

Copy
Copy
N, R = map(int, input().split())
 
if N > 10:
  print(R)
else:
  ans = R - (100*(10-R))
  print(ans)
Problem p02784 (python)

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

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

for i in sa:
  H = H - i

if H <= 0:
  print("Yes")
else:
  print("No")

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

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

counter = 0

while H > 0:
  for i in sa:
    H = H - sa
    counter += 1

if counter >= len(sa):
  print("YES")
else:
  print("NO")
Problem p02843 (python)

Fixed submission:
x = int(input())

flag = 0
if x >= 2000:
    print(1)
    exit()
else:
    for i in range(20):
        for j in range(20):
            for k in range(20):
                for l in range(20):
                    for m in range(20):
                        for n in range(20):
                            if i*100+j*101+k*102+l*103+m*104+n*105 == x:
                                flag = 1
                                print(1)
                                exit()
if flag != 1:
    print(0)

Buggy submission (verdict: Runtime Error):
x = int(input())

lis = [100, 101, 102, 103, 104, 105]

if x < 100:
    print(0)
else:
    c = x//100
    for i in range(1<<c):
        tmp = 0
        for j in range(c):
            if ((i >> j) & 1):
                tmp += lis[j]
        if tmp == x:
            print(1)
            exit()
print(0)
Problem p03076 (python)

Fixed submission:
import math

lis = []
for _ in range(5):
    lis.append(int(input()))
    
def roundup(x):
    return int(math.ceil(x/10)) * 10
    

    
minind = 9
tmp2 = 0
for i in range(5):
    tmp = str(lis[i])
    if tmp[-1] != "0":
        minind = min(minind, int(tmp[-1]))
        if minind == int(tmp[-1]):
            tmp2 = lis[i]
   
if tmp2 == 0:
    print(sum(lis))
    exit()

lis.remove(tmp2)

for j in range(4):
    lis[j] = roundup(lis[j])
        
print(sum(lis)+tmp2)

Buggy submission (verdict: Runtime Error):
import math

lis = []
for _ in range(5):
    lis.append(int(input()))
    
def roundup(x):
    return int(math.ceil(x/10)) * 10
    

    
minind = 9
tmp2 = 0
for i in range(5):
    tmp = str(lis[i])
    if tmp[-1] != "0":
        minind = min(minind, int(tmp[-1]))
        if minind == int(tmp[-1]):
            tmp2 = lis[i]
lis.remove(tmp2)

for j in range(4):
    lis[j] = roundup(lis[j])
        
print(sum(lis)+tmp2)
Problem p03106 (python)

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

c = [1]
for i in range(min(a, b), 0, -1):
    if a % i == 0 and b % i == 0:
        k -= 1
        if k == 0:
            print(i)

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

c = [1]
for i in range(2, max(a, b)):
    if a % i == 0 and b % i == 0:
        c.append(i)

c = sorted(c, reverse = True)

print(c[k-1])
Problem p03150 (python)

Fixed submission:
s = input()

k = 'keyence'

for i in range(len(s)):
    for j in range(i, len(s)):
        t = s[:i] + s[j:]
        if k == t:
            print('YES')
            exit()

print('NO')

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

for i in range(1, 8):
    a, b = i, 7-i
    l, r = k[:i], k[i:]
    
    if l in s and r in s:
        print("YES")
        exit()

print('NO')
Problem p03386 (python)

Fixed submission:
a,b,k = map(int, input().split())
if k*2+a-1<=b:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)
else:
    for i in range(a,b+1):
        print(i)

Buggy submission (verdict: Runtime Error):
a,b, k = map(int,input().split())
 
lis = list(range(a,b+1))
 


if (b-a+1)>= 2*k:
    nlis = []
    for i in range(a, min(b+1, a+k)):
        nlis.append(i)
        
    for j in range(max(a,b-k+1, a+k), b+1):
        nlis.append(j)
        
    for k in sorted(nlis):
        print(k)
else:
    for i in range(a,b+1):
        print(i)

Buggy submission (verdict: Runtime Error):
a,b, k = map(int,input().split())
 
lis = list(range(a,b+1))
 


if (b-a+1)>= 2*k:
    for i in lis:
        if (i >= a and i <a+k) or (i <=b and b-k < i):
            print(i)
else:
    for i in range(a,b+1):
        print(i)

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

lis = list(range(a,b+1))


nlis = []
for i in range(a, min(b+1, a+k)):
    nlis.append(i)
    
for j in range(max(a,b-k+1, a+k), b+1):
    nlis.append(j)
    
for k in sorted(nlis):
    print(k)

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

lis = list(range(a,b+1))


nlis = []
for i in range(a, min(b+1, a+k)):
    nlis.append(i)
    
for j in range(max(b-k+1, a+k), b+1):
    nlis.append(j)
    
for k in sorted(nlis):
    print(k)

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

lis = list(range(a,b+1))


for i in lis:
    if (i >= a and i <a+k) or (i <=b and b-k < i):
        print(i)

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

lis = list(range(a,b+1))


for i in lis:
    if (i >= a and i <a+k) or (i <=b and b-k < i):
        print(i)
Problem p03545 (python)

Fixed submission:
n = input()

op_cnt = len(n) -1
for i in range(2**op_cnt):
    op = ["-"] * op_cnt
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt -1 -j] = "+"
    
            
    formula = ""
    for p_n,p_o in zip(n, op + [""]):
        formula += (p_n + p_o)
    if eval(formula) == 7:
        s = formula+"=7"
        print(s)
        break

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

op_cnt = len(n) -1
for i in range(2**op_cnt):
    op = ["-"] * op_cnt
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt -1 -j] = "+"
    
            
    formula = ""
    for p_n,p_o in zip(n, op + [""]):
        formula += (p_n + p_o)
    if eval(formula) == 7:
        print(f'{formula}=7')
        break

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

op_cnt = len(n) -1
for i in range(2**op_cnt):
    op = ["-"] * op_cnt
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt -1 -j] = "+"
    
            
    formula = ""
    for p_n,p_o in zip(n, op + [""]):
        formula += (p_n + p_o)
    if eval(formula) == 7:
        print(f'{formula}=7')
        break
Problem p03565 (python)

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

if len(t) > len(s):
    print('UNRESTORABLE')
    exit()

s = s[::-1]
t = t[::-1]

for i in range(len(s) - len(t) + 1):
    j = 0
    while True:
        if j == len(t):
            ans = s[:i] + t + s[i+len(t):]
            print(ans[::-1].replace('?', 'a', len(ans)))
            exit()
        if t[j] == s[i+j] or s[i+j] == '?':
            j += 1
        else:
            break
print("UNRESTORABLE")

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

if len(t) > len(s):
    print('UNRESTORABLE')
    exit()

lis = []
flag = 0
for i in range(len(s)):
    if s[i] == t[0]:
        for j in range(i+1, i+len(t)-1):
            if s[j] == '?' or s[j] == t[j-i]:
                flag = 1
            else:
                flag = 0
                break
    
    if flag:
        lis.append(i)
        flag = 0

if len(lis) == 0:
    print('UNRESTORABLE')
    exit()

tmp = max(lis)
s[tmp:tmp+len(t)+1] = t

for k in range(len(s)):
    if s[k] == '?':
        s[k] = 'a'


print(''.join(s))

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

if len(t) > len(s):
    print('UNRESTORABLE')
    exit()

flag = 0
for i in range(len(s)):
    if s[i] == t[0]:
        for j in range(i+1, i+len(t)-1):
            if s[j] == '?':
                flag = 1
            else:
                flag = 0
                break
    
    if flag:
        s[i:i+len(t)+1] = t
        break

if flag == 0:
    print('UNRESTORABLE')
    exit()

for k in range(len(s)):
    if s[k] == '?':
        s[k] = 'a'


print(''.join(s))

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

flag = 0
for i in range(len(s)):
    if s[i] == t[0]:
        for j in range(i+1, i+len(t)-1):
            if s[j] == '?':
                flag = 1
            else:
                flag = 0
                break
    
    if flag:
        s[i:i+len(t)+1] = t
        break

if flag == 0:
    print('UNRESTORABLE')
    exit()

for k in range(len(s)):
    if s[k] == '?':
        s[k] = 'a'


print(''.join(s))
Problem p03625 (python)

Fixed submission:
from collections import Counter

n = int(input())

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

a = Counter(lis)

slis = sorted(set(lis))

t1 = 0
t2 = 0

for k, v in a.items():
    if v >=2 and k > t1:
        t2 = t1
        t1 = k

if a[t1] >= 4:
    print(t1*t1)
    exit()

print(t1*t2)

Buggy submission (verdict: Runtime Error):
n = int(input())

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

count = [0] * (10**5)

for i in lis:
    count[i] += 1

t1 = 0
t2 = 0
  
for i in range(len(count)):
    if count[i] >= 2 and i+1 > t1:
        t2 = t1
        t1 = i

if count[t1] >= 4:
    a1 = t1*t1
    print(a1)
    exit()

print(t1*t2)