Buggy python submission (verdict: Time Limit Exceeded):
import sys

H, W, d = map(int, input().split())

color = 'RGBY'
ret = [['' for _ in range(W)] for _ in range(H)]
flag = [[0b1111 for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        for k in range(4):
            if flag[i][j] & 2 ** k:
                flag[i][j] &= ~(2 ** k)
                ret[i][j] = color[k]

                for p in range(d + 1):
                    q = d - p

                    if i - p >= 0 and j - q >= 0: flag[i - p][j - q] &= ~(2 ** k)
                    if i + p < H and j - q >= 0: flag[i + p][j - q] &= ~(2 ** k)
                    if i - p >= i and j + q < W: flag[i - p][j + q] &= ~(2 ** k)
                    if i + p < H and j + q < W: flag[i + p][j + q] &= ~(2 ** k)
                break

for a in ret:
    print(''.join(a))


Fixed submission:

H, W, d = map(int, input().split())

ret = [['RGBY'[(i + j) // d % 2 + (i - j) // d % 2 * 2] for j in range(W)] for i in range(H)]

for a in ret:
    print(''.join(a))

Buggy python submission (verdict: Runtime Error):
import sys

H, W, d = map(int, input().split())

color = 'RGBY'
ret = [['' for _ in range(W)] for _ in range(H)]
flag = [[0b1111 for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        for k in range(4):
            if flag[i][j] & 2 ** k:
                flag[i][j] &= ~(2 ** k)
                ret[i][j] = color[k]

                for p in range(d + 1):
                    q = d - p

                    if i - p >= 0 and j - q >= 0: flag[i - p][j - q] &= ~(2 ** k)
                    if i + p < H and j + q < W: flag[i + p][j - q] &= ~(2 ** k)
                    if i - p >= i and j - q >= 0: flag[i - p][j + q] &= ~(2 ** k)
                    if i + p < H and j + q < W: flag[i + p][j + q] &= ~(2 ** k)
                break

for a in ret:
    print(''.join(a))


Fixed submission:

H, W, d = map(int, input().split())

ret = [['RGBY'[(i + j) // d % 2 + (i - j) // d % 2 * 2] for j in range(W)] for i in range(H)]

for a in ret:
    print(''.join(a))

Buggy python submission (verdict: Runtime Error):
import sys

H, W, d = map(int, input().split())

color = 'RGBY'
ret = [['' for _ in range(W)] for _ in range(H)]
flag = [[0b1111 for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        for k in range(4):
            if flag[i][j] & 2 ** k:
                flag[i][j] &= ~(2 ** k)
                ret[i][j] = color[k]

                for p in range(d + 1):
                    q = d - p

                    if p >= i and q >= j: flag[i - p][j - q] &= ~(2 ** k)
                    if p < H - i and q >= j: flag[i + p][j - q] &= ~(2 ** k)
                    if p >= i and q < W - j: flag[i - p][j + q] &= ~(2 ** k)
                    if p < H - i and q < W - j: flag[i + p][j + q] &= ~(2 ** k)
                break

        # なにも入らなかった
        if ret[i][j] is '':
            print('hoge')

for a in ret:
    print(''.join(a))


Fixed submission:

H, W, d = map(int, input().split())

ret = [['RGBY'[(i + j) // d % 2 + (i - j) // d % 2 * 2] for j in range(W)] for i in range(H)]

for a in ret:
    print(''.join(a))

Buggy python submission (verdict: Runtime Error):
import sys

H, W, d = map(int, input().split())

color = 'RGBY'
ret = [['' for _ in range(W)] for _ in range(H)]
flag = [[[True, True, True, True] for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        for k in range(4):
            if flag[i][j][k]:
                ret[i][j] = color[k]

                for p in range(d + 1):
                    q = d - p

                    if p >= i and q >= j: flag[i - p][j - q][k] = False
                    if p < H - i and q >= j: flag[i + p][j - q][k] = False
                    if p >= i and q < W - j: flag[i - p][j + q][k] = False
                    if p < H - i and q < W - j: flag[i + p][j + q][k] = False
                break

        # なにも入らなかった
        if ret[i][j] is '':
            print('hoge')

print(ret, file=sys.stderr)

for a in ret:
    print(''.join(a))


Fixed submission:

H, W, d = map(int, input().split())

ret = [['RGBY'[(i + j) // d % 2 + (i - j) // d % 2 * 2] for j in range(W)] for i in range(H)]

for a in ret:
    print(''.join(a))