TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
class Node:
    def __init__(self, i):
        self.num = i
        self.ken = set()
        self.kenken = set()
        self.kenkenpa = set()

N, M = map(int, input().split())
nodes = [Node(i+1) for i in range(N)]

for i in range(M):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    nodes[v].ken.add(nodes[u])

s, t = map(int, input().split())
s -= 1
t -= 1

for i in range(N):
    for pre in nodes[i].ken:
        nodes[i].kenken = nodes[i].kenken | pre.ken

for i in range(N):
    for prepre in nodes[i].kenken:
        nodes[i].kenkenpa = nodes[i].kenkenpa | prepre.ken

node = nodes[t]
step = 0
check_list = [[node, step]]
check = [False] * N
ok = False
while len(check_list) > 0:
    node, step = check_list.pop(0)
    for pre in node.kenkenpa:
        if pre == nodes[s]:
            print(step+1)
            ok = True
            break
        if not check[pre.num]:
            check[pre.num] = True
            check_list.append([pre, step+1])
    if ok:
        break
if not ok:
    print(-1)


N, M = map(int, input().split())
nodes = [[] for i in range(N)]

for i in range(M):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    nodes[u].append(v)

s, t = map(int, input().split())
s -= 1
t -= 1

num = s
step = 0
q = [[num, step]]
check = [[False for i in range(N)] for j in range(3)]
ok = False
while len(q) > 0:
    num, step = q.pop(0)
    tmp = step % 3
    if tmp == 0 and num == t:
        print(step//3)
        ok = True
        break
    for next in nodes[num]:
        if not check[tmp][next]:
            check[tmp][next] = True
            q.append([next, step+1])
if not ok:
    print(-1)


Verdicts: Runtime Error

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
import sys
import os
f = open('../../input.txt', 'r')
sys.stdin = f

n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s,t = map(int, input().split())

before_dict = {}
after_dict = {}
after_3 = {}

for i in range(1,n+1):
    before_dict[i] =[]
    after_dict[i] = []
    after_3[i] = []

for i in range(m):
    u, v = uv[i]
    before_dict[v].append(u)
    after_dict[u].append(v)

for i in range(m):
    u, v = uv[i]
    for j in before_dict[u]:
        for k in after_dict[v]:
            if( j != k):
                after_3[j].append(k)

from collections import deque
d = deque()
d.append(s)

length = [-1] * (n+1)
length[s] = 0

check = True

while(check):
    if(len(d) == 0):
        break
    num = d.popleft()
    for i in after_3[num]:
        if(length[i] == -1):
            length[i] = length[num] + 1
            d.append(i)

    if(length[t] > -1):
        break

print(length[t])


n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s, t = map(int, input().split())

next_dict = {}

for i in range(1,n*3 + 1):
    next_dict[i] = []

for i in range(m):
    u,v = uv[i]
    for j in range(3):
        next_dict[u + (j * n)].append((v + ((j+1)%3 * n )))

from collections import deque
d = deque()
d.append(s)

length = [-1] * (3*n + 1)
length[s] = 0

while(True):
    if(len(d) == 0):
        break

    num = d.popleft()
    for i in next_dict[num]:
        if( length[i] == -1 ):
            d.append(i)
            length[i] = length[num] + 1

    if(length[t] != -1):
        break

print(length[t] // 3)

Verdicts: Runtime Error

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

def main():

  n,m=map(int,input().split())
  d=[[0 for i in range(n)] for i in range(n)]
  to=[[] for i in range(n)]
  for i in range(m):
    u,v=map(lambda x:int(x)-1,input().split())
    to[u].append(v)
  s,t=map(lambda x:int(x)-1,input().split())

  #print(to)

  
  for i in range(n):
    first,second=[],[]
    for j in to[i]:
      first.append(j) 
    for j in first:
      for k in to[j]:
        second.append(k) 
    for j in second:
      for k in to[j]:
        d[i][k]=1 # pa

  
  #print(ans[t] if ans[t]>0 else -1)


if __name__=='__main__':
  main()

from collections import deque

def main():

  n,m=map(int,input().split())
  INF=10**9
  d=[[INF]*3 for i in range(n)]
  to=[[] for i in range(n)]
  for i in range(m):
    u,v=map(lambda x:int(x)-1,input().split())
    to[u].append(v)
  s,t=map(lambda x:int(x)-1,input().split())

  #print(to)
  
  d[s][0]=0
  cnt=0
  q=deque([(s,cnt)])
  while q:
    u,c=q.popleft()
    for v in to[u]:
      nc=(c+1)%3
      if d[v][nc]!=INF: continue;
      d[v][nc]=d[u][c]+1
      q.append((v,nc))
      
  #print(d)
  ans=d[t][0]
  print(ans//3 if ans!=INF else -1)

  
if __name__=='__main__':
  main()

Verdicts: Wrong Answer

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
from collections import deque

N,M = map(int, input().split())

G = [[] for i in range(3*N)]
for i in range(M):
    
    u,v = map(int,input().split())
    G[3*(u-1)].append((3*(v-1)+1))
    G[3*(u-1)+1].append((3*(v-1)+2))
    G[3*(u-1)+2].append((3*(v-1)))

S,T = map(int, input().split())


used = [-1] * (3*N)

q = deque([S-1])
while len(q) > 0:
    a = q.popleft()
    d = used[a]
    Vs = G[a]
    for u in Vs: 
        if used[u] == -1:
            q.append(u)
            used[u] = d+1
print(used[3*(T-1)]//3)


from collections import deque
n, m = map(int, input().split())
edges = [[] for i in range(3*n)]
for i in range(m):
    u,v = map(int, input().split())
    u -= 1
    v -= 1
    edges[u].append(v+n)
    edges[u+n].append(v+2*n)
    edges[u+2*n].append(v)

s,t = map(int, input().split())
s -= 1
t -= 1
INF = 1<<50
dists = [INF] * (3*n)

q = deque([])
q.append(s)
dists[s] = 0

while len(q)>0:
    v = q.popleft()
    for u in edges[v]:
        if dists[u] != INF: continue
        q.append(u)
        dists[u] = dists[v] + 1

if dists[t] == INF:
    print(-1)
else:
    print(dists[t]//3)


Verdicts: Wrong Answer

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M, *UV, S, T = map(int, read().split())

it = iter(UV)
G = [[] for _ in range(1+N+N+N)]
for x, y = in zip(it, it):
    x1 = x + N; x2 = x1 + N;
    y1 = y + N; y2 = y1 + N;
    G[x].append(y1)
    G[x1].append(y2)
    G[x2].append(y)

INF = 10 ** 15
dist = [INF] * (N + N + N + 1)
dist[S] = 0
q = [S]
while q:
    qq = []
    for x in q:
        for y in G[x]:
            if dist[y] != INF:
                continue
            qq.append(y)
            dist[y] = dist[x] + 1
            if y == T:
                break
    q = qq

d = dist[T]

answer = -1 if d == INF else d//3
print(answer)



import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M,*UV,S,T = map(int,read().split())

it = iter(UV)
G = [[] for _ in range(1+N+N+N)]
for x, y in zip(it, it):
    x1=x+N; x2=x1+N;
    y1=y+N; y2=y1+N;
    G[x].append(y1)
    G[x1].append(y2)
    G[x2].append(y)

INF = 10 ** 15
dist = [INF] * (N+N+N+1)
dist[S] = 0
q = [S]
while q:
    qq = []
    for x in q:
        for y in G[x]:
            if dist[y] != INF:
                continue
            qq.append(y)
            dist[y] = dist[x] + 1
            if y == T:
                break
    q = qq

d = dist[T]

answer = -1 if d == INF else d//3
print(answer)



Verdicts: Runtime Error

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
import sys
import numpy as np
from scipy.sparse.csgraph import dijkstra
from scipy.sparse import csr_matrix

input = sys.stdin.readline

int1 = lambda x: int(x) - 1
N, M = map(int, input().split())

if M == 0:
    print(-1)
    exit()

UV = np.array([tuple(map(int1, input().split())) for _ in range(M)])
frm = UV[:, 0].repeat(3) + np.tile(np.arange(3), M)
to = UV[:, 1].repeat(3) + np.tile((np.arange(3) + 1) % 3, M)

S, T = map(int1, input().split())
matr = csr_matrix(([1] * (3 * M), (frm, to)), shape=(3 * N, 3 * N))
way = dijkstra(matr, indices=3 * S).astype(int)

res = way[3 * T]
print(res // 3 if res >= 0 else -1)


import sys
from collections import deque

input = sys.stdin.buffer.readline
int1 = lambda x: int(x) - 1

N, M = map(int, input().split())
G = [[] for _ in range(3 * N)]
for _ in range(M):
    u, v = map(int1, input().split())
    G[u * 3].append(v * 3 + 1)
    G[u * 3 + 1].append(v * 3 + 2)
    G[u * 3 + 2].append(v * 3)

S, T = map(int1, input().split())
S *= 3
T *= 3

# bfs
d = deque([S])
distance = [0] * (3 * N)
while d:
    v = d.popleft()
    dist_v = distance[v]
    if v == T:
        print(dist_v // 3)
        exit()
    for x in G[v]:
        if not distance[x]:
            d.append(x)
            distance[x] = dist_v + 1
print(-1)


Verdicts: Wrong Answer

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
from collections import deque
n, m = map(int, input().split())

graph = [[] for _ in range(n+1)]
for _ in range(m):
    u, v = map(int, input().split())
    graph[u].append(v)

s, t = map(int, input().split())

inf = 10**10
dist = [[-3] * 3 for _ in range(n+1)]
dist[s][0] = 0

q = deque([(s, 0)])

while q:
    now, c = q.pop()
    ne = (c+1) % 3
    for node in graph[now]:
        if dist[node][ne] != -1:
            continue
        dist[node][ne] = dist[now][c] + 1
        q.append((node, ne))

print(dist[t][0] // 3)


from collections import deque
n, m = map(int, input().split())

graph = [[] for _ in range(n+1)]
for _ in range(m):
    u, v = map(int, input().split())
    graph[u].append(v)

s, t = map(int, input().split())

dist = [[-3] * 3 for _ in range(n+1)]
dist[s][0] = 0

q = deque([(s, 0)])

while q:
    now, c = q.popleft()
    ne = (c+1) % 3
    for node in graph[now]:
        if dist[node][ne] != -3:
            continue
        dist[node][ne] = dist[now][c] + 1
        q.append((node, ne))

print(dist[t][0] // 3)


Verdicts: Wrong Answer

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
from collections import deque
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix


def bfs(cnt, p, cn, row, col, data):
    cnt += 1
    if cnt < 3:
        for cg in graph[p]:
            d.appendleft([cnt, cg])
    if cnt == 3:
        for cg in graph[p]:
            if not cg in graph_k[cn]:
                graph_k[cn].append(cg)
                row = np.append(row, cn)
                col = np.append(col, cg)
                data = np.append(data, 1)
    return cnt, row, col, data

n, m = map(int,input().split())
edge = []
graph = [[] for i in range(n+1)]
for i in range(m):
    edge.append(list(map(int,input().split())))
    graph[edge[-1][0]].append(edge[-1][1])
s, g = map(int,input().split())

row = np.array([], dtype=int)
col = np.array([], dtype=int)
data = np.array([], dtype=int)

d = deque()
graph_k = [[] for i in range(n+1)]
for cn in range(1, n+1):
    for cg in graph[cn]:
        d.appendleft([1, cg])
    while d:
        cnt, p = d.pop()
        cnt, row, col, data = bfs(cnt, p, cn, row, col, data)

import copy
import sys
input = sys.stdin.readline

n, m = map(int,input().split())
graph = [[] for i in range(n+1)]
for i in range(m):
    u, v = map(int,input().split())
    graph[u].append(v)
s, g = map(int,input().split())

INF = 10**7
ans = [[INF, INF, INF] for i in range(n+1)]
q = [s]
d = 0
while q:
    nq = []
    d += 1
    p = d % 3
    for cf in q:
        for ct in graph[cf]:
            if ans[ct][p] == INF:
                ans[ct][p] = d
                nq.append(ct)
    q = nq
if ans[g][0] == INF:
    print(-1)
else:
    print(ans[g][0]//3)

Verdicts: Wrong Answer

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
def dfs():
  while len(q) > 0:
  	p = q.pop()
  	for e in g[p]:
      if d[e] < 0 or d[e] > d[p] + 1:
        d[e] = d[p] + 1
        q.append(e)
  
  
n, m = map(int, input().split())
g = [[] for i in range(3 * (n+1))]
for i in range(m):
  u, v = map(int, input().split())
  g[3*u].append(3*v+1)
  g[3*u+1].append(3*v+2)
  g[3*u+2].append(3*v)

s, t = map(int, input().split())

d = [-1] * (3 * (n+1))
d[3*s] = 0

q = [3*s]
dfs()
print(d[3*t])



from collections import deque
def bfs():
  while len(q) > 0:
    p = q.popleft()
    for e in g[p]:
      if d[e] < 0:
        q.append(e)
        d[e] = d[p] + 1
        f[e] = p
      elif d[e] > d[p] + 1:
        d[e] = d[p] + 1
        f[e] = p       

  
  
n, m = map(int, input().split())
g = [[] for i in range(3 * (n+1))]
for i in range(m):
  u, v = map(int, input().split())
  g[3*u].append(3*v+1)
  g[3*u+1].append(3*v+2)
  g[3*u+2].append(3*v)

s, t = map(int, input().split())

d = [-1] * (3 * (n+1))
f = [-1] * (3 * (n+1))
d[3*s] = 0
f[3*s] = 0
q = deque([3*s])
bfs()
c = 0
if f[3*t] == -1:
  print(-1)
  exit()

t = 3 * t
while f[t] > 0:
  c += 1
  t = f[t]
  
print(c // 3) 


Verdicts: Runtime Error

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
from collections import deque
N,M,*L,S,T = map(int,open(0).read().split())
G = [[] for _ in range(N)]
INF = float("inf")
step = [[INF]*3 for _ in range(N)]
step[S-1][0] = 0
for u,v in zip(*[iter(L)]*2):
	G[u-1].append(v-1)
q = deque([(S-1,0)])
while q:
	cur,d = q.popleft()
	for nxt in G[cur]:
		if nxt==T-1 and (d+1)%3==0:
			print((d+1)//3)
			exit()
		if step[nxt][(d+1)%3] < 0:
			step[nxt][(d+1)%3] = d+1
			q.append((nxt,d+1))
print(-1)

def main():
	from collections import deque
	N,M,*L,S,T = map(int,open(0).read().split())
	G = [[] for _ in range(N)]
	step = [False]*(3*N)
	step[(S-1)*3] = True
	for u,v in zip(*[iter(L)]*2):
		G[u-1].append(v-1)
	q = deque([(S-1,0)])
	while q:
		cur,d = q.popleft()
		for nxt in G[cur]:
			if nxt==T-1 and (d+1)%3==0:
				print((d+1)//3)
				exit()
			if not step[nxt*3+(d+1)%3]:
				step[nxt*3+(d+1)%3] = True
				q.append((nxt,d+1))
	print(-1)
	
if __name__=="__main__":main()

Verdicts: Wrong Answer

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
from collections import deque

n, m = map(int, input().split())
adj_list = [[] for _ in range(3 * n)]
for _ in range(m):
  u, v = map(int, input().split())
  adj_list[3 * u - 3].append(3 * v - 2)
  adj_list[3 * u - 2].append(3 * v - 1)
  adj_list[3 * u - 1].append(3 * v - 3)

s, t = map(int, input().split())
dist = [-1] * (3 * n)
queue = deque([3 * s - 3])
dist[3 * s - 3] = 0
while queue:
  vertex = queue.leftpop()
  for next_vertex in adj_list[vertex]:
    if dist[next_vertex] == -1:
      continue
    dist[next_vertex] = dist[vertex] + 1
    queue.append(next_vertex)
t_distance = dist[3 * t - 3]
if t_distance == -1:
  print(-1)
else:
  print(t_distance // 3)

from collections import deque

n, m = map(int, input().split())
adj_list = [[] for _ in range(3 * n)]
for _ in range(m):
  u, v = map(int, input().split())
  adj_list[3 * u - 3].append(3 * v - 2)
  adj_list[3 * u - 2].append(3 * v - 1)
  adj_list[3 * u - 1].append(3 * v - 3)

s, t = map(int, input().split())
dist = [-1] * (3 * n)
queue = deque([3 * s - 3])
dist[3 * s - 3] = 0
while queue:
  vertex = queue.popleft()
  for next_vertex in adj_list[vertex]:
    if dist[next_vertex] != -1:
      continue
    dist[next_vertex] = dist[vertex] + 1
    queue.append(next_vertex)
t_distance = dist[3 * t - 3]
if t_distance == -1:
  print(-1)
else:
  print(t_distance // 3)

Verdicts: Runtime Error

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
from heapq import heappush, heappop
N, M = map(int, input().split())  
graph = [[] for _ in range(N)]

for _ in range(M):
    u, v = map(lambda x: int(x)-1, input().split())
    graph[u].append(v)

S, T = map(lambda x: int(x)-1, input().split())

dist = [[-1]*3 for _ in range(N)]
dist[S][0] = 0
q = []
heappush(q, (0, S))
while len(q):
    count, v = heappop(q)  
    for nv in graph[v]:  
        np = (count + 1) % 3
        if dist[nv][np] == -1:  
            dist[nv][np] = dist[v][count] + 1
            heappush(q, (nv, np))
if dist[T][0] == -1:
    print(-1)
else:
    print(dist[T][0]//3)


from heapq import heappop, heappush

N, M = map(int, input().split())
graph = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(lambda x: int(x)-1, input().split())
    graph[a].append(b)

S, T = map(lambda x: int(x)-1, input().split())

ans = -1
visited = set()  
q = [(0, S)]
while q:
    c, v = heappop(q)  
    key = (c % 3, v)
    if key in visited:
        continue
    visited.add(key)  
    if v == T and c % 3 == 0:
        ans = c//3
        break
    c += 1  
    d = c % 3  
    for u in graph[v]:
        new_key = (d, u)
        if new_key in visited:
            continue
        heappush(q, (c, u))

print(ans)


Verdicts: Runtime Error

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
N, M = map(int, input().split())
a = [[] for i in range(N+1)]
for i in range(M):
  u, v = map(int, input().split())
  a[u].append(v)

S, T = map(int, input().split())
def main():
  c = [S]
  m = [[False, False, False] for i in range(N+1)]
  for count in range(1, N+1):
    vs = []
    for u in c:
      m[u][count %3] = True
      vs += a[u]
    c = []
    for v in vs:
      if (v == T and count %3 ==0):
        return count//3
      if not(m[v][(count+1) %3]):
        c.append(v)
  return -1
print(main())


N, M = map(int, input().split())
a = [[] for i in range(N+1)]
for i in range(M):
  u, v = map(int, input().split())
  a[u].append(v)
print(a)

S, T = map(int, input().split())
def main():
  c = [S]
  m = [[False, False, False] for i in range(N+1)]
  for count in range(1, N+1):
    vs = []
    for u in c:
      m[u][count %3] = True
      vs += a[u]
    c = []
    for v in vs:
      if (v == T and count %3 ==0):
        return count//3
      if not(m[v][(count+1) %3]):
        c.append(v)
  return -1
print(main())


N, M = map(int, input().split())
a = [[] for i in range(N+1)]
for i in range(M):
  u, v = map(int, input().split())
  a[u].append(v)
#print(a)
 
S, T = map(int, input().split())
def main():
  c = [S]
  m = [[False, False, False] for i in range(N+1)]
  for count in range(1, 3*N+1):
    c2 = []
    for u in c:
      for v in a[u]:
        if (v == T and count %3 ==0):
          return count//3
        if not(m[v][count %3]):
          m[v][count %3]=True
          c2.append(v)
    c = c2
  return -1
print(main())


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
N,M = map(int, input().split())

g = {}
steps = 3
for v in range(1,N*steps+1):
    g[v] = []

for _ in range(M):
    u,v = map(int, input().split())
	g[u + N*0].append(v + N*1)
    g[u + N*1].append(v + N*2)
    g[u + N*2].append(v + N*0)

S,T = map(int, input().split())

visiting = [(S,0)]
visited = {}
while visiting:
    v,d = visiting.pop(0)
    if v in visited:
        continue
    visited[v] = d
    if v == T:
        break

    for v2 in g.get(v,()):
        if v2 in visiting or v2 in visited:
            continue
        visiting.append((v2,d+1))
if T in visited:
    print(visited[T] // steps)
else:
    print(-1)


N,M = map(int, input().split())
g = {}
for v in range(1,N*3+1):
    g[v] = []

for _ in range(M):
    u,v = map(int, input().split())
    g[u + N*0].append(v + N*1)
    g[u + N*1].append(v + N*2)
    g[u + N*2].append(v + N*0)

S,T = map(int, input().split())

visiting = [S]
visited = {S:0}
while visiting:
    v = visiting.pop(0)
    if v == T:
        break

    for v2 in g[v]:
        if v2 not in visited:
            visiting.append(v2)
            visited[v2] = visited[v]+1

if T in visited:
    print(visited[T] // 3)
else:
    print(-1)


Verdicts: Runtime Error

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
N,M=map(int,input().split())
E=[[] for i in range(N)]
for i in range(M):
  u,v=map(int,input().split())
  u,v=u-1,v-1
  E[u].append(v)
S,T=map(int,input().split())
S,T=S-1,T-1

stack=[]
seen=[[False for i in range(3)] for j in range(N)]
stack.append([S,0,1])
while stack:
  node=stack.pop()
  v=node[0]
  step=node[1]
  turn=node[2]
  print(v,step,turn)
  if step==3:
    if v==T:
      print(turn)
      break
    step=0
    turn+=1
  if seen[v][step]:
    continue
  seen[v][step]=True
  children=E[v]
  for child in children:
    stack.append([child,step+1,turn])
else:
  print(-1)

N,M=map(int,input().split())
E=[[] for i in range(N)]
for i in range(M):
  u,v=map(int,input().split())
  u,v=u-1,v-1
  E[u].append(v)
S,T=map(int,input().split())
S,T=S-1,T-1

from collections import deque
q=deque()
seen=[[False for i in range(3)] for j in range(N)]
q.append([S,0,1])
while q:
  node=q.popleft()
  v=node[0]
  step=node[1]
  turn=node[2]
  if step==3:
    if v==T:
      print(turn)
      break
    step=0
    turn+=1
  if seen[v][step]:
    continue
  seen[v][step]=True
  children=E[v]
  for child in children:
    q.append([child,step+1,turn])
else:
  print(-1)


Verdicts: Wrong Answer

Accepted
Problem: Ken loves _ken-ken-pa_ (Japanese version of hopscotch). Today, he will play it on a directed graph G. G consists of N vertices numbered 1 to N, and M edges. The i-th edge points from Vertex u_i to Vertex v_i.  First, Ken stands on Vertex S. He wants to reach Vertex T by repeating ken- ken-pa. In one ken-ken-pa, he does the following exactly three times: follow an edge pointing from the vertex on which he is standing.  Determine if he can reach Vertex T by repeating ken-ken-pa. If the answer is yes, find the minimum number of ken-ken-pa needed to reach Vertex T. Note that visiting Vertex T in the middle of a ken-ken-pa does not count as reaching Vertex T by repeating ken-ken-pa.

Submission attempts (in order):
print(-1)

import sys
from collections import deque



read = sys.stdin.read
N, M, *uv, S, T = map(int, read().split())

graph = [[] for _ in range(N + 1)]
for u, v in zip(*[iter(uv)] * 2):
    graph[u].append(v)

INF = 10 ** 15

dist = [[INF] * (N + 1) for _ in range(3)]
stack = deque([(0, S)])

while stack:
    cost, v = stack.popleft()
    r = cost % 3
    if dist[r][v] != INF:
        continue
    if r == 0 and v == T:
        print(cost // 3)
        exit()

    dist[r][v] = cost
    for i in graph[v]:
        stack.append((cost + 1, i))
else:
    print(-1)


Verdicts: Wrong Answer

Accepted
Problem: Find the number of sequences of length K consisting of positive integers such that the product of any two adjacent elements is at most N, modulo 10^9+7.

Submission attempts (in order):
from itertools import accumulate as ac
N,K=map(int,input().split())
n=int(N**0.5)
mod=10**9+7
list_a=[1]*n
list_b=[N//j-N//(j+1) for j in range(1,N_s)]+[(N//n-n)]
list_p=[p for p in list_b]
list_aa=list(ac(list_a))
list_bb=list(reversed(list(ac(reversed(list_b)))))

for i in range(K-1):
    temp=sum(list_a)
    list_a=[(temp+list_bb[j])%mod for j in range(n)]
    list_b=[(list_p[j]*list_aa[j])%mod for j in range(n)]
    list_aa=list(ac(list_a))
    list_bb=list(reversed(list(ac(reversed(list_b)))))
    
print((sum(list_a+list_b))%mod)

from itertools import accumulate as ac
N,K=map(int,input().split())
n=int(N**0.5)
mod=10**9+7
list_a=[1]*N_s
list_b=[N//j-N//(j+1) for j in range(1,N_s)]+[(N//n-n)]
list_p=[p for p in list_b]
list_aa=list(ac(list_a))
list_bb=list(reversed(list(ac(reversed(list_b)))))

for i in range(K-1):
    temp=sum(list_a)
    list_a=[(temp+list_bb[j])%mod for j in range(n)]
    list_b=[(list_p[j]*list_aa[j])%mod for j in range(n)]
    list_aa=list(ac(list_a))
    list_bb=list(reversed(list(ac(reversed(list_b)))))
    
print((sum(list_a+list_b))%mod)

from itertools import accumulate as ac
N,K=map(int,input().split())
n=int(N**0.5)
mod=10**9+7
list_a=[1]*n
list_b=[N//j-N//(j+1) for j in range(1,n)]+[(N//n-n)]
list_p=[p for p in list_b]
list_aa=list(ac(list_a))
list_bb=list(reversed(list(ac(reversed(list_b)))))

for i in range(K-1):
    temp=sum(list_a)
    list_a=[(temp+list_bb[j])%mod for j in range(n)]
    list_b=[(list_p[j]*list_aa[j])%mod for j in range(n)]
    list_aa=list(ac(list_a))
    list_bb=list(reversed(list(ac(reversed(list_b)))))
    
print((sum(list_a+list_b))%mod)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
def split(word): 
    return [char for char in word]  
inp=input()
list=split(inp)
count=0
x=1
str="Good"
for i in range(len(3):
    if list[count]==list[count+1]:
        str="Bad"
    count=count+1
print(str)

def split(word): 
    return [char for char in word]  
inp=input()
list=split(inp)
count=0
x=1
str="Good"
for i in range(3):
    if list[count]==list[count+1]:
        str="Bad"
    count=count+1
print(str)

Verdicts: Runtime Error

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
S=int(input())
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
    print('Bad')
else:
    print('Good')

S=input()
for i in range(3):
  if S[i]==S[i+1]:
    print('Bad')
    exit()
print('Good')
  


Verdicts: Runtime Error

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
a,b,c,d=map(int,input().split())
if a==b or b==c or c==d:
  print("Bad")
else:
  print("Yes")


a,b,c,d=map(int,input().split())
if a==b or b==c or c==d:
  print("Bad")
else:
  print("Yes")


a,b,c,d=int(input().split())
if a==b or b==c or c==d:
  print("Bad")
else:
  print("Yes")


s=list(map(int,input().split()))
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print("Bad")
else:
  print("Yes")


s=list(input())
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print("Bad")
else:
  print("Good")

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
S = input()
bad = 0
for num in range(2):
  if int(S[num]) == int(S[num + 1]):
    print("Bad")
    break
    bad = 1
if bad == 0:
  print("Good")

S = input()
bad = 0
for num in range(2):
  if S[num] == S[num + 1]:
    print("Bad")
    break
    bad = 1
if bad == 0:
  print("Good")

N = int(input() )
for i in range(N):
  C[i] = [map(int, input().split() ) ]
 
C.sort(key= lambda s:(s[1],s[0]) )
 
judge = "Yes"
time = 0
for i in range(N):
  time += C[i][0]
  if time > C[i][1]:
    judge = "No"
    break
print(judge)

N = int(input() )
for i in range(N):
  C[i] = list(map(int, input().split() ) )

C.sort(key= lambda s:(s[1],s[0]) )


judge = "Yes"
time = 0
for i in range(N):
  time += C[i][0]
  if time > C[i][1]:
    judge = "No"
    break
print(judge)

N, L = map(int, input().split())
 
if L > -1:
  N_eat = 1
elif N+L-1 < 1:
  N_eat = N
else:
  N_eat = 1-L
pie = N*N/2 +N*(L-1) - (L + N_eat-1) 
print(pie)

S = input()
judge = "Good"
for num in range(3):
  if int(S[num]) == int(S[num + 1]):
    judge = "Bad"
    break
print(judge)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
S=int(input())
if S<100:
    print('Bad')
elif ((S-(S%100))%1100!=0 or (S-(S-(S%1000))-(S%10))%110!=0 or (S%100)%1100!=0):
    print('Good')
else:
    print('Bad')



S=int(input())
if S<100:
    print('Bad')
elif ((S-(S%100))%1100!=0 and (S-(S-(S%1000))-(S%10))%110!=0 and (S%100)%1100!=0):
    print('Good')
else:
    print('Bad')



Verdicts: Wrong Answer

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
A , B , C , D = map(int,input().split())
lst = []
list= [i for i in range(A,B) i % C != 0]
for i in list:
    if  i % D != 0:
        lst.append(i)
print(len(lst))


N = list(map(int,input()))
for i in len(N - 1):
    if N[i] == N[i+1]:
        print("Good")
    else :
        print("Bad")


N = list(map(int,input()))
for i in range(len(N) - 1):
    if N[i] != N[i+1]:
        print("Good")
    else :
        print("Bad")


N = list(map(int,input()))
bool = 0
for i in range(len(N) - 1):
    if N[i] != N[i+1]:
        bool = 1
if bool = 1:
    print("Good")
else:
    print("Bad")


N = list(map(int,input()))
bool = 0
for i in range(len(N) - 1):
    if N[i] != N[i+1]:
        bool = 1
if bool == 1:
    print("Good")
else:
    print("Bad")


N = list(map(int,input()))
bool = 0
for i in range(len(N) - 1):
    if N[i] != N[i+1]:
        bool = 1
    else:
        print("Bad")
        exit()
if bool == 1:
    print("Good")


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
s = input()
if s[1] == s[0] or s[2] == s[1] or s[3] == s[2]:
    print("Good")
else:
    print("Bad")


s = input()

if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print("Bad")
else:
    print("Good")

Verdicts: Wrong Answer

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
import io
import sys


def IN_S():
  return input()


def IN_I():
  return int(input())


def IN_L_I():
  return list(map(int, input().split()))


def IN_L_S():
  return list(map(str, input().split()))


def STR_SPLIT(s, n):
  for l in range(0, len(s), n):
    yield s[0 + l:n + l]


def T_IN():
  global test_str
  sys.stdin = io.StringIO(test_str[1:-1])


test_str = '''
1234
'''


def MAIN():
  T_IN()
  A()


def A():
  s = IN_S()

  p = ""
  for i in s:
    if len(p) != 0:
      if p == i:
        print("Bad")
        exit()
    p = i

  print("Good")


  return None
 

def B():
  return None


def C():
  return None


MAIN()


import io
import sys


def IN_S():
  return input()


def IN_I():
  return int(input())


def IN_L_I():
  return list(map(int, input().split()))


def IN_L_S():
  return list(map(str, input().split()))


def STR_SPLIT(s, n):
  for l in range(0, len(s), n):
    yield s[0 + l:n + l]


def T_IN():
  global test_str
  sys.stdin = io.StringIO(test_str[1:-1])


test_str = '''
1234
'''


def MAIN():
  # T_IN()
  A()


def A():
  s = IN_S()

  p = ""
  for i in s:
    if len(p) != 0:
      if p == i:
        print("Bad")
        exit()
    p = i

  print("Good")


  return None
 

def B():
  return None


def C():
  return None


MAIN()


Verdicts: Wrong Answer

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
s = int(input())
s_list = list(s)
ans="Good"
for i in range(len(s))
	if s_list[i]==s_list[i+1]:
		ans="Bad"
print(ans)

s = input()
ans="Good"
for i in range(len(s)):
	if s[i]==s[i+1]:
		ans="Bad"
print(ans)

s = input()
ans="Good"
for i in range(len(s))
	if s[i]==s[i+1]:
		ans="Bad"
print(ans)

s = input()
ans="Good"
for i in range(4):
	if s[i]==s[i+1]:
		ans="Bad"
print(ans)

s = input()

ans="Good"
for i in range(3):
	if s[i]==s[i+1]:
		ans="Bad"
print(ans)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

s=input()
count=0
for i in range(3):
    #print(s[i:i+1])
    if s[i:i+1]==s[i+1:i+2]:
        count+=1
if count>0:
    print("bad")
else:
    print("good")


import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

s=input()
count=0
for i in range(3):
    #print(s[i:i+1])
    if s[i:i+1]==s[i+1:i+2]:
        count+=1
if count>0:
    print("Bad")
else:
    print("Good")


Verdicts: Wrong Answer

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
import sys
S = int(input())

for i in range(3):
  if S[i] == S[i+1]:
    print("Bad")
    sys.exit()
print("Good")

import sys
S = input()

for i in range(3):
  if S[i] == S[i+1]:
    print("Bad")
    sys.exit()
print("Good")

Verdicts: Runtime Error

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
s=int(input())

if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print('Bad')
else:
  print('Good')

s=input()

if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
  print('Bad')
else:
  print('Good')

Verdicts: Runtime Error

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
s=input()
for i in range(3):
    if s[i]==s[i+1]:
        ans=1
    else:
        ans=0
print("Bad" if ans==1 else "Good")


s=input()
for i in range(3):
    if s[i]==s[i+1]:
        ans=1
        break
    else:
        ans=0
print("Bad" if ans==1 else "Good")


Verdicts: Wrong Answer

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
import sys
N = int(input())

if len(N) <= 1:
    print('Good')
    sys.exit()

for i in range(1, len(N)):
    if N[i] == N[i-1]:
        print('Bad')
        sys.exit()

print('Good')

import sys
N = input()

if len(N) <= 1:
    print('Good')
    sys.exit()

for i in range(1, len(N)):
    if N[i] == N[i-1]:
        print('Bad')
        sys.exit()

print('Good')

Verdicts: Runtime Error

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
S=input()
for i in range(len(S)):
    if S[i]==S[i+1]:
        print('Bad')
    else:
        print('Good')

S=input()
if S[0]!=S[1] and S[1]!=S[2] and S[2]!=S[3]:
    print('Good')
else:
    print('Bad')

Verdicts: Runtime Error

Accepted
Problem: The door of Snuke's laboratory is locked with a security code.  The security code is a 4-digit number. We say the security code is _hard to enter_ when it contains two consecutive digits that are the same.  You are given the current security code S. If S is hard to enter, print `Bad`; otherwise, print `Good`.

Submission attempts (in order):
S = input()

answer = "Good"
prev_s = s[0]
for s in S[1:]:
  if prev_s == s:
    answer = "Bad"
    break
  prev_s = s

print(answer)

import math

A, B, C, D = map(int, input().split())
CD = int(C * D // math.gcd(C, D))

B_in_C = int(B/C)
B_in_D = int(B/D)
B_in_CD = int(B/(CD))
B_con = B - (B_in_C + B_in_D - B_in_CD)

A = A-1 if A > 1 else A
A_in_C = int(A/C)
A_in_D = int(A/D)
A_in_CD = int(A/(CD))
A_con = A - (A_in_C + A_in_D - A_in_CD)

print(B_con - A_con)

S = input()
 
answer = "Good"
prev_s = S[0]
for s in S[1:]:
  if prev_s == s:
    answer = "Bad"
    break
  prev_s = s
 
print(answer)

Verdicts: Runtime Error

Runtime Error

Accepted