Problem p03952 (python)

Fixed submission:
import sys,bisect as bs,collections as cl,heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n,m = m()

if m == 1 or 2*n-1 == m:
    print("No")
else:
    print("Yes")
    if n == 2:
        ans = [1,2,3]
        print(jo(ans))
    else:
        if m == 2:
            a = [3,2,1,4]
            ans = [i + 5 for i in range(n-2)] + a + [i + n+3 for i in range(n-3)]
        else:
            a = [m-1,m,m+1,m-2]
            i = 0
            ans = []
            for j in range(2*n-4):
                i += 1
                if j == n-2:
                    ans += a
                    i -= 1
                else:
                    if i == m-2:
                        i += 4
                    ans.append(i)
        print(jo(ans))

Buggy submission (verdict: Runtime Error):
import sys,bisect as bs,collections as cl,heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n,m = m()

if m == 1 or 2*n-1 == m:
    print("No")
else:
    print("Yes")
    if n == 2:
        ans = [1,2,3]
        print(jo(ans))
    else:
        if m == 2:
            a = [3,2,1,4]
            ans = [i + 5 for i in range(n-2)] + a + [i + n+3 for i in range(n-3)]
        else:
            a = [m-1,m,m+1,m-2]
            i = 0
            ans = []
            for j in range(2*n-4):
                i += 1
                if j == n-1:
                    ans += a
                    i -= 1
                else:
                    if i == m-2:
                        i += 4
                    ans.append(i)
        for i in range(2*n-1):
            print(ans[i])

Buggy submission (verdict: Runtime Error):
import sys,bisect as bs,collections as cl,heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n,m = m()

if m == 1 or 2*n-1 == m:
    print("No")
else:
    print("Yes")
    if n == 2:
        ans = [1,2,3]
        print(jo(ans))
    else:
        if m == 2:
            a = [3,2,1,4]
            ans = [i + 5 for i in range(n-2)] + a + [i + n+3 for i in range(n-3)]
        else:
            a = [m-1,m,m+1,m-2]
            i = 0
            ans = []
            for j in range(2*n-4):
                i += 1
                if j == n-1:
                    ans += a
                    i -= 1
                 else:
                    if i == m-2:
                        i += 4
                    ans.append(i)
        print(jo(ans))

Buggy submission (verdict: Runtime Error):
import sys,bisect as bs,collections as cl,heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n,m = m()

if m == 1 or 2*n-1 == m:
    print("No")
else:
    print("Yes")
    if n == 2:
        for i in range(3):
            print(i+1)
    else:
        if m == 2:
            a = [3,2,1,4]
            ans = [i + 5 for i in range(n-2)] + a + [i + n+3 for i in range(n-3)]
        else:
            a = [m-1,m,m+1,m-2]
            i = 0
            ans = []
            for j in range(2*n-4):
                i += 1
                if i == m-2:
                    i += 4
                if j == n-1:
                    ans += a
                    i -= 1
                    if i == m + 1:
                        i += 1
                else:
                    ans.append(i)
        for i in range(2*n-1):
            print(ans[i])

Buggy submission (verdict: Runtime Error):
import sys,bisect as bs,collections as cl,heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n,m = m()

if m == 1 or 2*n-1 == m:
    print("No")
else:
    print("Yes")
    if n == 2:
        for i in range(3):
            print(i+1)
    else:
        if m == 2:
            a = [3,2,1,4]
            ans = [i + 5 for i in range(n-2)] + a + [i + n+3 for i in range(n-3)]
        else:
            a = [m-1,m,m+1,m-2]
            i = 0
            ans = []
            for j in range(2*n-4):
                i += 1
                if i == m-2:
                    i += 4
                if j == n-1:
                    ans += a
                    i -= 1
                else:
                    ans.append(i)
        for i in range(2*n-1):
            print(ans[i])

Buggy submission (verdict: Runtime Error):
import sys,bisect as bs,collections as cl,heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n,m = m()

if m == 1 or 2*n-1 == m:
    print("No")
else:
    print("Yes")
    if n == 2:
        for i in range(3):
            print(i+1)
    else:
        if m == 2:
            a = [3,2,1,4]
            ans = [i + 5 for i in range(n-2)] + a + [i + n+3 for i in range(n-3)]
        else:
            a = [m-1,m,m+1,m-2]
            i = 0
            ans = []
            for j in range(2*n-4):
                i += 1
                if i == m-2:
                    i += 4
                if j == n-1:
                    ans += a
                    i -= 1
                else:
                    ans.append(i)
        print(len(ans))
        for i in range(2*n-1):
            print(ans[i])

Buggy submission (verdict: Runtime Error):
import sys,bisect as bs,collections as cl,heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n,m = m()

if m == 1 or 2*n-1 == m:
    print("No")
else:
    print("Yes")
    if n == 2:
        print("1 2 3")
    else:
        if m == 2:
            a = [3,2,1,4]
            ans = [i + 5 for i in range(n-2)] + a + [i + n+3 for i in range(n-3)]
        else:
            a = [m-1,m,m+1,m-2]
            i = 0
            ans = []
            for j in range(2*n-4):
                i += 1
                if i == m-2:
                    i += 4
                if j == n-1:
                    ans += a
                    i -= 1
                else:
                    ans.append(i)

        for i in range(2*n-1):
            print(ans[i])