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

Fixed submission:
import sys
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
a = IL()
cnt = [0]*(N+1)
ans = []
M = 0
for i in range(N-1,-1,-1):
  tmp = sum(cnt[i::i+1])
  if tmp%2 != a[i]:
    ans.append(str(i+1))
    cnt[i] = 1
    M += 1

if M == 0:
  print(0)
else:
  print(M)
  print(" ".join(ans))

Buggy submission (verdict: Runtime Error):
MAX_INT = int(10e12)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

import functools
@functools.lru_cache(maxsize=None)
def make_divisors(n):
  if n == 1:
    divisors.append(1)
    return divisors
  for i in range(int(n**0.5)+1,1,-1):
    if n % i == 0:
      divisors.append(i)
      break
  return make_divisors(n//i)

N = I()
a = IL()
cnt = [0]*N

ans = ""
M = 0
for i in range(N-1,-1,-1):
  if cnt[i]%2 == 0 and a[i] == 1 or cnt[i]%2 == 1 and a[i] == 0:
    M += 1
    ans += str(i+1) + " "
  if a[i] == 1:
    divisors = []
    l = make_divisors(i+1)
    for j in l:
      cnt[j-1] += 1

if ans == "":
  print(0)
else:
  print(M)
  print(ans[:-1])
Problem p03005 (python)

Fixed submission:
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,K = IL()
if K == 1:
  print(0)
else:
  print(N-K)

Buggy submission (verdict: Runtime Error):
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,K = IL()
if K == 1:
  print(0)
else:
  print(N-K)
Problem p03006 (python)

Fixed submission:
import bisect
from operator import itemgetter
import math
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
xy = [IL() for i in range(N)]

if N == 1 or N == 2:
  print(1)
else:
  data = []
  cnt = 0
  for i in itertools.combinations(xy,2):
    rex,rey = i[0]
    x,y = i[1]
    if rex > x:
      rex,rey,x,y = x,y,rex,rey
    if rex == x:
      if rey > y:
        rex,rey,x,y = x,y,rex,rey
    data.append(str(x-rex)+str(y-rey))
  else:
    d = collections.Counter(data)
    cnt = max(cnt,d.most_common()[0][1])
  
  print(N-cnt)

Buggy submission (verdict: Runtime Error):
import bisect
from operator import itemgetter
import math
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N= I()
xy = [IL() for i in range(N)]

if N == 1:
  print(0)
elif N == 2:
  print(1)
else:
  data = []
  cnt = 0
  for i in itertools.combinations(xy,2):
    rex,rey = i[0]
    x,y = i[1]
    data.append(str(x-rex)+str(y-rey))
  else:
    d = collections.Counter(data)
    cnt = max(cnt,d.most_common()[0][1])

print(N-cnt)

Buggy submission (verdict: Runtime Error):
import bisect
from operator import itemgetter
import math
import collections
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N= I()
xy = [IL() for i in range(N)]

cnt = 0
for i in itertools.permutations(xy):
  data = []
  for j in range(N):
    if j == 0:
      rex,rey = i[j]
    else:
      x,y = i[j]
      if y-rey == 0:
        data.append(MAX_INT)
      else:
        data.append((x-rex)/(y-rey))
      rex,rey = i[j]
  else:
    d = collections.Counter(data)
    cnt = max(cnt,d.most_common()[0][1])
print(N-cnt)
Problem p03014 (python)

Fixed submission:
H,W = list(map(int,input().split()))
grid = [[i for i in input()] for i in range(H)]
cntH = [[0 for i in range(W)] for i in range(H)]
cntW = [[0 for i in range(W)] for i in range(H)]

for h in range(H):
  cnt = 0
  for w in range(W):
    if grid[h][w] == "#":
      cnt = 0
    else:
      cnt += 1
      cntW[h][w] = cnt

for h in range(H-1,-1,-1):
  cnt = 0
  for w in range(W-1,-1,-1):
    if grid[h][w] == "#":
      cnt = 0
    elif cnt == 0:
      cnt = cntW[h][w]
    else:
      cntW[h][w] = cnt

for w in range(W):
  cnt = 0
  for h in range(H):
    if grid[h][w] == "#":
      cnt = 0
    else:
      cnt += 1
      cntH[h][w] = cnt

for w in range(W-1,-1,-1):
  cnt = 0
  for h in range(H-1,-1,-1):
    if grid[h][w] == "#":
      cnt = 0
    elif cnt == 0:
      cnt = cntH[h][w]
    else:
      cntH[h][w] = cnt

ans = 0
for h in range(H):
  for w in range(W):
    ans = max(ans,cntW[h][w]+cntH[h][w])

print(ans-1)

Buggy submission (verdict: Runtime Error):
def tamiL(x,y,n):
  if (0 <= x < W) and (0 <= y < H):
    if grid[y][x] == ".":
      return tamiL(x-1,y,n+1)
    else:
      return n
  else:
    return n

def tamiR(x,y,n):
  if (0 <= x < W) and (0 <= y < H):
    if grid[y][x] == ".":
      return tamiR(x+1,y,n+1)
    else:
      return n
  else:
    return n

def tamiU(x,y,n):
  if (0 <= x < W) and (0 <= y < H):
    if grid[y][x] == ".":
      return tamiU(x,y-1,n+1)
    else:
      return n
  else:
    return n

def tamiD(x,y,n):
  if (0 <= x < W) and (0 <= y < H):
    if grid[y][x] == ".":
      return tamiD(x,y+1,n+1)
    else:
      return n
  else:
    return n

H,W = list(map(int,input().split()))
grid = [[i for i in input()] for i in range(H)]

ans = 0
for i in range(H):
  for j in range(W):
    if grid[i][j] == ".":
      cnt = 0
      cnt += tamiL(j-1,i,0)
      cnt += tamiR(j+1,i,0)
      cnt += tamiU(j,i-1,0)
      cnt += tamiD(j,i+1,0)
      ans = max(ans,cnt+1)

print(ans)
Problem p03031 (python)

Fixed submission:
import numpy as np
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,M = IL()
K = [IL()[1:] for i in range(M)]
p = np.array(IL())

switch = np.array([[0]*M for i in range(N)])
for i in range(M):
    while K[i]:
        num = K[i].pop()
        switch[num-1][i] = 1

ans = 0
for i in range(1 << N):
    cnt = np.array([0]*M)
    for j in range(N):
        if ((i >> j) & 1) == 1:
            cnt += switch[j]
    else:
        if (p == (cnt%2)).all():
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,M = IL()
K = [IL() for i in range(M)]
p = IL()

data = []
for i in range(2**M):
    d = []
    for j in range(M):
        if ((i >> j) & 1) == 1:
            d.append(K[j])
    else:
        data.append(d)

ans = 0
for s in data:
    cnt = [0]*M
    for i in s:
        for j in i[1:]:
            cnt[j-1] += 1
    else:
        for k in range(M):
            if cnt[k]%2 == p[k]:
                continue
            else:
                break
        else:
            ans += 1

print(ans)
Problem p03048 (python)

Fixed submission:
R,G,B,N = list(map(int,input().split()))

cnt = 0
num = N
for i in range(0,N+1,R):
    tmp = num - i
    for j in range(0,N+1,G):
        tmp2 = tmp - j
        if tmp2%B == 0 and tmp2 >= 0:
            cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
R,G,B,N = IL()

cnt = 0
num = N
for i in range(0,N+1,R):
    tmp = num - i
    for j in range(0,N+1,G):
        tmp2 = tmp - j
        if tmp2%B == 0 and tmp2 >= 0:
            cnt += 1

print(cnt)
Problem p03059 (python)

Fixed submission:
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

A,B,T = list(map(float,input().split()))

num = ((T+0.5)//A )*B

print(int(num))

Buggy submission (verdict: Runtime Error):
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

A,B,T = list(map(float,input().split()))

num = ((T+0.5)//A )*B

print(int(num))
Problem p03060 (python)

Fixed submission:
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
V = IL()
C = IL()

ans = 0
for i in range(N):
    v = V[i]
    c = C[i]
    if v-c > 0:
        ans += v-c

print(ans)

Buggy submission (verdict: Runtime Error):
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
V = IL()
C = IL()

ans = 0
for i in range(N):
    v = V[i]
    c = C[i]
    if v-c > 0:
        ans += v-c

print(ans)
Problem p03165 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

s = input()
t = input()

dp = [[0]*(len(t)+1) for i in range(len(s)+1)]

for i in range(1,len(s)+1):
  for j in range(1,len(t)+1):
    if s[i-1] == t[j-1]:
      dp[i][j] = max(dp[i-1][j-1]+1,dp[i-1][j],dp[i][j-1])
    else:
      dp[i][j] = max(dp[i-1][j],dp[i][j-1])

ansl = []
cnt = dp[-1][-1]
def tami(i,j):
  global cnt
  if cnt == 0:
    return
  if s[i-1] == t[j-1]:
    cnt -= 1
    ansl.append(i-1)
  if dp[i-1][j-1]==cnt:
    tami(i-1,j-1)
  elif dp[i][j-1]==cnt:
    tami(i,j-1)
  elif dp[i-1][j]==cnt:
    tami(i-1,j)

tami(len(s),len(t))

ans = ""
for i in ansl:
  ans += s[i]
print(ans[::-1])

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

dp = [[0]*(len(t)+1) for i in range(len(s)+1)]

for i in range(1,len(s)+1):
  for j in range(1,len(t)+1):
    dp[i][j] = max(dp[i-1][j-1],dp[i][j-1])
    if s[i-1] == t[j-1]:
      dp[i][j] += 1

ansl = []
cnt = dp[-1][-1]
def tami(i,j):
  global cnt
  if cnt == 0:
    return
  if s[i-1] == t[j-1]:
    cnt -= 1
    ansl.append(i-1)
  if dp[i-1][j-1]==cnt:
    tami(i-1,j-1)
  elif dp[i][j-1]==cnt:
    tami(i,j-1)

tami(len(s),len(t))

ans = ""
for i in ansl:
  ans += s[i]
print(ans[::-1])

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

dp = [[0]*(len(t)+1) for i in range(len(s)+1)]

for i in range(1,len(s)+1):
  for j in range(1,len(t)+1):
    dp[i][j] = max(dp[i-1][j-1],dp[i][j-1])
    if s[i-1] == t[j-1]:
      dp[i][j] += 1

ansl = []
cnt = dp[-1][-1]
def tami(i,j):
  global cnt
  if cnt == 0:
    return
  if s[i-1] == t[j-1]:
    cnt -= 1
    ansl.append(i-1)
  if dp[i-1][j-1]==cnt:
    tami(i-1,j-1)
  if dp[i][j-1]==cnt:
    tami(i,j-1)

tami(len(s),len(t))

ans = ""
for i in ansl:
  ans += s[i]
print(ans[::-1])
Problem p03238 (python)

Fixed submission:
N = int(input())
if N == 1:
    print("Hello World")
elif N == 2:
    A = int(input())
    B = int(input())
    print(A + B)

Buggy submission (verdict: Runtime Error):
N, T = map(int,input().split())
ans = float("inf")

for i in range(N):
    c,t = map(int,input().split())
    if t <= T:
        ans = min(ans,c)

if ans == float("inf"):
    print("TLE")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N, T = map(int,raw_input().split())
ans = float("inf")

for i in range(N):
    c,t = map(int,input(),split())
    if t <= T:
        ans = min(num,c)

if ans == float("inf"):
    print("TLE")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N, T = map(int,input().split())
ans = float("inf")

for i in range(0,N):
    c,t = map(int,input(),split())
    if t <= T:
        ans = min(num,c)

if ans == float("inf"):
    print("TLE")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
if N == 1:
    print("Hello World")
elif N == 2:
    print(A + B)

Buggy submission (verdict: Runtime Error):
if N = 1:
  print("Hello Wowld")
elif N = 2:
  print A + B
else:
  exit if
Problem p03239 (python)

Fixed submission:
N, T = map(int,input().split())
ans = float("inf")

for i in range(N):
    c,t = map(int,input().split())
    if t <= T:
        ans = min(ans,c)

if ans == float("inf"):
    print("TLE")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N, T = map(int,raw_input().split())
ans = float("inf")

for i in range(N):
    c,t = map(int,input().split())
    if t <= T:
        ans = min(ans,c)

if ans == float("inf"):
    print("TLE")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N, T = map(int,input().split())
ans = float("inf")

for i in range(N):
    c,t = map(int,input(),split())
    if t <= T:
        ans = min(ans,c)

if ans == float("inf"):
    print("TLE")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N, T = map(int,raw_input().split())
ans = float("inf")

for i in range(N):
    c,t = map(int,input(),split())
    if t <= T:
        ans = min(ans,c)

if ans == float("inf"):
    print("TLE")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N, T = map(int,input().split())
ans = float("inf")

for i in range(N):
    c,t = map(int,input(),split())
    if t <= T:
        ans = min(num,c)

if ans == float("inf"):
    print("TLE")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N, T = map(int,raw_input().split())
ans = float("inf")

for i in range(N):
    c,t = map(int,input(),split())
    if t <= T:
        ans = min(num,c)

if ans == float("inf"):
    print("TLE")
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N, T = map(int, raw_input().split())
ans = float("inf")

for i in range(0,N):
    c,t = map(int,input(),split())
    if t <= T:
        ans = min(num,c)

if ans == float("inf"):
    print("TLE")
else:
    print(ans)
Problem p03243 (python)

Fixed submission:
n = input()
for ans in range(111, 1000, 111):
    if int(n) <= ans:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
for ans in range(111, 1000, 111):
    if n <= ans:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
for ans in range(111, 999, 111):
    if n <= ans:
        break
print(ans)
Problem p03262 (python)

Fixed submission:
def gcd(a,b):
    while b % a:
        a,b = b, a % b
    return a
#(a >= b )

N ,X = list(map(int,input().strip().split()))
xlist = list(map(int,input().strip().split()))
abs_xlist = list(map(lambda x:abs(X - x), xlist))
abs_xlist.sort()
ans = abs_xlist[0]

for i in range(N):
    if abs_xlist[i] % ans != 0:
        num = gcd(abs_xlist[i],ans)
        ans = min(num,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N ,X = list(map(int,input().strip().split()))
xlist = list(map(int,input().strip().split()))
abs_xlist = list(map(lambda x:abs(X - x), xlist))
ans = abs_xlist[0]

for i in range(N):
    if abs_xlist[i] % ans != 0:
        num = math.gcd(abs_xlist[i],ans)
        ans = min(num,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N ,X = list(map(int,input().strip().split()))
xlist = list(map(int,input().strip().split()))
abs_xlist = list(map(lambda x:abs(X - x), xlist))
ans = abs_xlist[0]

for i in range(N):
    if abs_xlist[i] % ans != 0:
        num = math.gcd(xlist[i],ans)
        ans = min(num,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
N ,X = list(map(int,input().strip().split()))
xlist = list(map(int,input().strip().split()))
abs_xlist = list(map(lambda x:abs(X - x), xlist))
abs_xlist.sort()
ans = abs_xlist[0]

for i in range(N):
    if abs_xlist[i] % ans != 0:
        num = math.gcd(xlist[i],ans)
        ans = min(num,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
import functools
import math
N ,X = list(map(int,input().strip().split()))
xlist = list(map(int,input().strip().split()))
xlist.sort()
xlist_2 = list(map(lambda x:x - xlist[0], xlist))

if len(xlist) == 1:
    ans = xlist[0] - X
elif len(xlist) >= 2:
    ans = functools.reduce(math.gcd,xlist_2)

print(abs(ans))

Buggy submission (verdict: Runtime Error):
import math
N ,X = list(map(int,input().strip().split()))
xlist = list(map(int,input().strip().split()))
xlist.sort()

if len(xlist) == 1:
    ans = xlist[0] - X
elif len(xlist) >= 2:
    ans = xlist[1] - xlist[0]
    for i in range(0,N-1):
        num = xlist[i+1] - xlist[i]
        ans = math.gcd(ans,num)

print(ans)
Problem p03283 (python)

Fixed submission:
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

def imos():
  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[j][i]
      l[j][i] += cnt
      cnt += tmp

  for j in range(N+1):
    cnt = 0
    for i in range(N+1):
      tmp = l[i][j]
      l[i][j] += cnt
      cnt += tmp

N,M,Q = IL()
l = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
  a,b = IL()
  l[1][b] += 1
  if a+1 <= N:
    l[a+1][b] += -1

imos()

ans = [IL() for i in range(Q)]
for i in range(Q):
    print(l[ans[i][0]][ans[i][1]])

Buggy submission (verdict: Runtime Error):
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,M,Q = IL()
cnt = np.zeros((N+1,N+1))

for i in range(M):
    a,b = IL()
    cnt[:a+1,b:] += 1

for i in range(Q):
    c,d = IL()
    print(int(cnt[c][d]))
Problem p03293 (python)

Fixed submission:
s = [i for i in input()]
t = [i for i in input()]
flg = 0

for i in range(len(s)):
    if s != t:
        s.append(s[0])
        s.remove(s[0])
    else:
        flg = 1
        break

if flg == 0:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
s = [*input()]
t = [*input()]
flg = 0

for i in range(len(s)):
    if s != t:
        s.append(s[0])
        s.remove(s[0])
    else:
        flg = 1
        break

if flg == 0:
    print("No")
else:
    print("Yes")
Problem p03371 (python)

Fixed submission:
A,B,C,X,Y = list(map(int,input().split()))
  
if X < Y:
  if C*2 <= B:
    print(C*2*Y)
  elif C*2 <= (A+B):
    print(C*2*X + B*(Y-X))
  else:
    print(A*X + B*Y)
else:
  if C*2 <= A:
    print(C*2*X)
  elif C*2 <= (A+B):
    print(C*2*Y + A*(X-Y))
  else:
    print(A*X + B*Y)

Buggy submission (verdict: Runtime Error):
import sys
import itertools
import math
from collections import deque
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

A,B,C,X,Y = IL()

ans = 0
if C*2 < A+B:
  ans += C*2 * min(X, Y)
  if X < Y:
    num = (Y - X)*B
    num = min(num, (Y - X)*C*2)
  else:
    num += (X - Y)*A
    num = min(num, (X - Y)*C*2)
  ans += num
  print(ans)
else:
  print(A*X + B*Y)
Problem p03565 (python)

Fixed submission:
import bisect
import numpy as np
import sys

def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
t = S()

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

Buggy submission (verdict: Runtime Error):
import bisect
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
t = S()

for i in range(len(s)-len(t),-1,-1):
	cnt = 0
	for j in range(i,i+len(t)-1):
		if s[j] == t[j-i] or s[j] == "?":
			cnt += 1
			continue
		else:
			break
	if cnt == len(t)-1:
		print(s.translate(str.maketrans({'?':'a'}))[:A]+t+s.translate(str.maketrans({'?':'a'}))[A+len(t)-1:])
		exit()

print("UNRESTORABLE")

Buggy submission (verdict: Runtime Error):
import bisect
import numpy as np
import sys
input = sys.stdin.readline
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

s = S()
t = S()

for i in range(len(s)-len(t),-1,-1):
	cnt = 0
	for j in range(i,i+len(t)-1):
		if s[j] == t[j-i] or s[j] == "?":
			cnt += 1
			continue
		else:
			break
	if cnt == len(t)-1:
		print(ans[:i]+t+ans[i+len(t)-1:])
		exit()

print("UNRESTORABLE")
Problem p03601 (python)

Fixed submission:
A,B,C,D,E,F = list(map(int,input().split()))

tmp = 0
ans = [0,0]
for i in range(31):
  a = A*i
  if a*100 >= F:
    break
  for j in range(31):
    b = B*j
    if a+b == 0:
      continue
    w = (a+b)*100
    if w >= F:
      break
    for k in range(3001):
      c = C*k
      for l in range(3001):
        d = D*l
        s = c+d
        if w + s > F:
          break
        if (c+d) <= (a+b)*E:
          if (s*100)/w >= tmp:
            tmp = (s*100)/w
            ans = [s+w,s]
        else:
          break

print(" ".join(map(str,ans)))

Buggy submission (verdict: Runtime Error):
A,B,C,D,E,F = list(map(int,input().split()))

tmp = 0
for i in range(30):
  a = A*i
  if a*100 >= F:
    break
  for j in range(30):
    b = B*j
    if a+b == 0:
      continue
    w = (a+b)*100
    if w >= F:
      break
    for k in range(3000):
      c = C*k
      for l in range(3000):
        d = D*l
        s = c+d
        if w + s >= F:
          break
        if (c+d) <= (a+b)*E:
          if (s*100)/w > tmp:
            tmp = (s*100)/w
            ans = [s+w,s]
        else:
          break

print(" ".join(map(str,ans)))
Problem p03611 (python)

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

data = [0]*(100010)
for i in l:
  data[i-1] += 1
  data[i] += 1
  data[i+1] += 1

print(max(data))

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

data = [0]*(10001)
for i in l:
  data[i-1] += 1
  data[i] += 1
  data[i+1] += 1

print(max(data))