Problem p03404 (python)

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

grid=[["#"]*n for _ in range(n//2)]+[["."]*n for _ in range(n//2)]

k=0
cnt=0
for i in range(a-1):
    grid[k][2*i-cnt]="."
    if (2*i)%100==n-2:
        k+=2
        cnt+=n

k=n//2+1
cnt=0
for i in range(b-1):
    grid[k][2*i-cnt]="#"
    if (2*i)%100==n-2:
        k+=2
        cnt+=n
print(100,100)
for i in grid:
    print("".join(i))

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

grid=[["#"]*n for _ in range(n//2)]+[["."]*n for _ in range(n//2)]

k=0
cnt=0
for i in range(a-1):
    grid[k][2*i-cnt]="."
    if 2*i==n-2:
        k+=2
        cnt+=n

k=n//2+1
cnt=0
for i in range(b-1):
    grid[k][2*i-cnt]="#"
    if 2*i==n-2:
        k+=2
        cnt+=n
print(100,100)
for i in grid:
    print("".join(i))

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

grid=[["#"]*n for _ in range(n//2)]+[["."]*n for _ in range(n//2)]

k=0
cnt=0
for i in range(a-1):
    grid[k][2*i-cnt]="."
    if 2*i==n-2:
        k+=2
        cnt+=n

k=n//2+1
cnt=0
for i in range(b-1):
    grid[k][2*i-cnt]="#"
    if 2*i==n-2:
        k+=2
        cnt+=n
for i in grid:
    print("".join(i))

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

grid=[["#"]*n for _ in range(n//2)]+[["."]*n for _ in range(n//2)]

k=0
cnt=0
for i in range(a-1):
    grid[k][2*i-cnt]="."
    if 2*i==n-2:
        k+=2
        cnt+=n

k=n//2+1
cnt=0
for i in range(b-1):
    grid[k][2*i-cnt]="#"
    if 2*i==n-2:
        k+=2
        cnt+=n
for i in grid:
    print(i)

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

n=100
if a<=b:
    grid=[["."]*n for _ in range(n)]
    s=b-a+1
    for i in range(s):
        grid[0][2*i]="#"
    k=1
    t=1
    for i in range(1,a):
        if t==n//4+1:
            t=1
            k+=1
        grid[4*k-2][4*(t-1)]=grid[4*k-2][4*(t-1)+1]=grid[4*k-2][4*(t-1)+2]="#"
        grid[4*k-1][4*(t-1)]=grid[4*k-1][4*(t-1)+2]="#"
        grid[4*k][4*(t-1)]=grid[4*k][4*(t-1)+1]=grid[4*k][4*(t-1)+2]="#"
        t+=1
else:
    grid=[["#"]*n for _ in range(n+1)]
    s=a-b+1
    for i in range(s):
        grid[0][2*i]="."
    k=1
    t=1
    for i in range(1,b):
        if t==n//4+1:
            t=1
            k+=1
        grid[4*k-2][4*(t-1)]=grid[4*k-2][4*(t-1)+1]=grid[4*k-2][4*(t-1)+2]="."
        grid[4*k-1][4*(t-1)]=grid[4*k-1][4*(t-1)+2]="."
        grid[4*k][4*(t-1)]=grid[4*k][4*(t-1)+1]=grid[4*k][4*(t-1)+2]="."
        t+=1
print(n,n)
for i in grid:
    print("".join(i))

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

n=4
if a<=b:
    grid=[["."]*n for _ in range(n+1)]
    s=b-a+1
    for i in range(s):
        grid[0][i*2]="#"
    k=1
    t=1
    for i in range(1,a):
        if t==251:
            t=1
            k+=1
        grid[4*k-2][4*(t-1)]=grid[4*k-2][4*(t-1)+1]=grid[4*k-2][4*(t-1)+2]="#"
        grid[4*k-1][4*(t-1)]=grid[4*k-1][4*(t-1)+2]="#"
        grid[4*k][4*(t-1)]=grid[4*k][4*(t-1)+1]=grid[4*k][4*(t-1)+2]="#"
        t+=1
else:
    grid=[["#"]*n for _ in range(n+1)]
    s=a-b+1
    for i in range(s):
        grid[0][2*i]="."
    k=1
    t=1
    for i in range(1,b):
        if t==n//4+1:
            t=1
            k+=1
        grid[4*k-2][4*(t-1)]=grid[4*k-2][4*(t-1)+1]=grid[4*k-2][4*(t-1)+2]="."
        grid[4*k-1][4*(t-1)]=grid[4*k-1][4*(t-1)+2]="."
        grid[4*k][4*(t-1)]=grid[4*k][4*(t-1)+1]=grid[4*k][4*(t-1)+2]="."
        t+=1
print(n,n+1)
for i in grid:
    print("".join(i))

Buggy submission (verdict: Runtime Error):
n=10**3
if a<=b:
    grid=[["."]*n for _ in range(n)]
    s=b-a+1
    for i in range(s):
        grid[0][i*2]="#"
    k=1
    t=1
    for i in range(1,a):
        if t==251:
            t=1
            k+=1
        grid[4*k-2][4*(t-1)]=grid[4*k-2][4*(t-1)+1]=grid[4*k-2][4*(t-1)+2]="#"
        grid[4*k-1][4*(t-1)]=grid[4*k-1][4*(t-1)+2]="#"
        grid[4*k][4*(t-1)]=grid[4*k][4*(t-1)+1]=grid[4*k][4*(t-1)+2]="#"
        t+=1
else:
    grid=[["#"]*n for _ in range(n)]
    s=b-a+1
    for i in range(s):
        grid[0][i*2]="."
    k=1
    t=1
    for i in range(1,a):
        if t==251:
            t=1
            k+=1
        grid[4*k-2][4*(t-1)]=grid[4*k-2][4*(t-1)+1]=grid[4*k-2][4*(t-1)+2]="."
        grid[4*k-1][4*(t-1)]=grid[4*k-1][4*(t-1)+2]="."
        grid[4*k][4*(t-1)]=grid[4*k][4*(t-1)+1]=grid[4*k][4*(t-1)+2]="."
        t+=1
for i in grid:
    print(" ".join(i))