TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white.  The grid is said to be _good_ if and only if the following condition is satisfied:    * From (1, 1), we can reach (H, W) by moving one square **right or down** repeatedly, while always being on a white square.  Note that (1, 1) and (H, W) must be white if the grid is good.  Your task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.    * Choose four integers r_0, c_0, r_1, c_1(1 \leq r_0 \leq r_1 \leq H, 1 \leq c_0 \leq c_1 \leq W). For each pair r, c (r_0 \leq r \leq r_1, c_0 \leq c \leq c_1), invert the color of (r, c) \- that is, from white to black and vice versa.

Submission attempts (in order):
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

dp = [1000 for _ in range(W+1) for _ in range(H+1)]
dp[0][1] = 0
dp[1][0] = 0

for y in range(W):
    for x in range(H):
        dp[y+1][x+1] = min(
            dp[y][x+1] + (s[y][x] == '#' and (y == 0 or s[y-1][x] == '.')),
            dp[y+1][x] + (s[y][x] == '#' and (x == 0 or s[y][x-1] == '.'))
        )

print(dp[-1][-1])


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

dp = [[float("inf")] * W for _ in range(H)]
if s[0][0] == "#":
    dp[0][0] = 1
else:
    dp[0][0] = 0

dxdy = [(1, 0), (0, 1)]
for y in range(H):
    for x in range(W):
        for dx, dy in dxdy:
            nx = x + dx
            ny = y + dy
            if nx >= W or ny >= H: continue
            if s[ny][nx] == '#' and s[y][x] == '.':
                dp[ny][nx] = min(dp[ny][nx], dp[y][x] + 1)
            else:
                dp[ny][nx] = min(dp[ny][nx], dp[y][x])

print(dp[-1][-1])


Verdicts: Runtime Error

Accepted
Problem: Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white.  The grid is said to be _good_ if and only if the following condition is satisfied:    * From (1, 1), we can reach (H, W) by moving one square **right or down** repeatedly, while always being on a white square.  Note that (1, 1) and (H, W) must be white if the grid is good.  Your task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.    * Choose four integers r_0, c_0, r_1, c_1(1 \leq r_0 \leq r_1 \leq H, 1 \leq c_0 \leq c_1 \leq W). For each pair r, c (r_0 \leq r \leq r_1, c_0 \leq c \leq c_1), invert the color of (r, c) \- that is, from white to black and vice versa.

Submission attempts (in order):
# -*- coding: utf-8 -*-
H, W = map(int, input().split())
HW_list = []

for i in range(H):
    HW_list.append(str(input()))

dp = [[H * W] * H] * W

dp[0][0] = 0
for i in range(H):
    for j in range(W):
        if i == 0 and j == 0:
            continue
        if i == 0:
            min_num_h = H * W
        else:
            min_num_h = dp[i - 1][j] + (0 if HW_list[i][j] == HW_list[i - 1][j] else 1)
        if j == 0:
            min_num_w = H * W
        else:
            min_num_w = dp[i][j - 1] + (0 if HW_list[i][j] == HW_list[i][j - 1] else 1)
        dp[i][j] = min(min_num_h, min_num_w)

print(dp[H - 1][W - 1] // 2 + (1 if HW_list[0][0] == "#" or HW_list[H - 1][W - 1] else 0))

# -*- coding: utf-8 -*-
H, W = map(int, input().split())
HW_list = []

for i in range(H):
    HW_list.append(str(input()))

dp = [[H * W] * W] * H

dp[0][0] = 0
for i in range(H):
    for j in range(W):
        if i == 0 and j == 0:
            continue
        if i == 0:
            min_num_h = H * W
        else:
            min_num_h = dp[i - 1][j] + (0 if HW_list[i][j] == HW_list[i - 1][j] else 1)
        if j == 0:
            min_num_w = H * W
        else:
            min_num_w = dp[i][j - 1] + (0 if HW_list[i][j] == HW_list[i][j - 1] else 1)
        dp[i][j] = min(min_num_h, min_num_w)

print(dp[H - 1][W - 1] // 2 + (1 if HW_list[0][0] == "#" or HW_list[H - 1][W - 1] == "#" else 0))

Verdicts: Runtime Error

Accepted
Problem: Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white.  The grid is said to be _good_ if and only if the following condition is satisfied:    * From (1, 1), we can reach (H, W) by moving one square **right or down** repeatedly, while always being on a white square.  Note that (1, 1) and (H, W) must be white if the grid is good.  Your task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.    * Choose four integers r_0, c_0, r_1, c_1(1 \leq r_0 \leq r_1 \leq H, 1 \leq c_0 \leq c_1 \leq W). For each pair r, c (r_0 \leq r \leq r_1, c_0 \leq c \leq c_1), invert the color of (r, c) \- that is, from white to black and vice versa.

Submission attempts (in order):
h, w = map(int, input().split())
s = []
for _ in range(h):
    s.append(input())

dp = [[h*w for i in range(w+1)] for j in range(h+1)]

dp[0][1] = 0
dp[1][0] = 0

for i in range(h):
    for j in range(w):
        print("i", i, "j", j, "s[i][j]", s[i][j])
        print(s[i][j] == '#' and (i == 0 or s[i-1][j] == '.'))
        
        
        
        dp[i+1][j+1] = min(
            dp[i][j+1] + (s[i][j] == '#' and (i == 0 or s[i-1][j] == '.')),
            dp[i+1][j] + (s[i][j] == '#' and (j == 0 or s[i][j-1] == '.'))
        )

print(dp[-1][-1])


h, w = map(int, input().split())
s = []
for _ in range(h):
    s.append(input())

dp = [[h*w for i in range(w+1)] for j in range(h+1)]

dp[0][1] = 0
dp[1][0] = 0

for i in range(h):
    for j in range(w):
        # print("i", i, "j", j, "s[i][j]", s[i][j])
        # print(s[i][j] == '#' and (i == 0 or s[i-1][j] == '.'))
        
        
        
        dp[i+1][j+1] = min(
            dp[i][j+1] + (s[i][j] == '#' and (i == 0 or s[i-1][j] == '.')),
            dp[i+1][j] + (s[i][j] == '#' and (j == 0 or s[i][j-1] == '.'))
        )

print(dp[-1][-1])


Verdicts: Wrong Answer

Accepted
Problem: Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white.  The grid is said to be _good_ if and only if the following condition is satisfied:    * From (1, 1), we can reach (H, W) by moving one square **right or down** repeatedly, while always being on a white square.  Note that (1, 1) and (H, W) must be white if the grid is good.  Your task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.    * Choose four integers r_0, c_0, r_1, c_1(1 \leq r_0 \leq r_1 \leq H, 1 \leq c_0 \leq c_1 \leq W). For each pair r, c (r_0 \leq r \leq r_1, c_0 \leq c \leq c_1), invert the color of (r, c) \- that is, from white to black and vice versa.

Submission attempts (in order):
import copy
import heapq
H, W = map(int, input().split())
S = []
cnt_list = []
for _ in range(H):
    S.append(list(input()))

def move(i,j,cnt,frag):
    c_cnt = copy.deepcopy(cnt)
    c_frag = copy.deepcopy(frag)
    if frag != S[i][j]:
        c_cnt = cnt + 1
    c_frag = S[i][j]
    if i != H-1:
        move(i+1,j,c_cnt,c_frag)
    if j != W-1:
        move(i,j+1,c_cnt,c_frag)
    if i == H-1 and j == W-1:
        print(c_cnt)
        cnt_list.append(c_cnt)

if S[0][0] =='#':
    a = 1
else :
    a = 0

move(0,0,0,S[0][0])

print(cnt_list)
heapq.heapify(cnt_list)
print((heapq.heappop(cnt_list))//2 + a)

import copy
import heapq
H, W = map(int, input().split())
S = [['.'] * (W+1)]
for _ in range(H):
    s = list(input())
    s.insert(0,'.')
    S.append(s)

inf = float('inf')

dp = []
for _ in range(H+1):
    dp.append([inf] * (W+1))

if S[1][1] == '.':
    dp[1][1] = 0
else:
    dp[1][1] = 1

for i in range(1,H+1):
    for j in range(1,W+1):
        right = dp[i][j-1]
        down = dp[i-1][j]
        if S[i][j] == '#':
            if S[i-1][j] == '.':
                down += 1
            if S[i][j-1] == '.':
                right += 1

        dp[i][j] = min(dp[i][j],right,down)

print(dp[H][W])

Verdicts: Wrong Answer

Accepted
Problem: Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white.  The grid is said to be _good_ if and only if the following condition is satisfied:    * From (1, 1), we can reach (H, W) by moving one square **right or down** repeatedly, while always being on a white square.  Note that (1, 1) and (H, W) must be white if the grid is good.  Your task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.    * Choose four integers r_0, c_0, r_1, c_1(1 \leq r_0 \leq r_1 \leq H, 1 \leq c_0 \leq c_1 \leq W). For each pair r, c (r_0 \leq r \leq r_1, c_0 \leq c \leq c_1), invert the color of (r, c) \- that is, from white to black and vice versa.

Submission attempts (in order):
H, W = map(int, input().split())

S = [""] * H

for i in range(H):
    S[i] = input()

dist = [[1000000 for i in range(W)] for j in range(H)]

dist[0][0] = 0 if S[0][0] == "." else 1

for i in range(H):
    for j in range(W):
        if i > 0:
            if S[i][j] == "#":
                dist[i][j] = min(dist[i][j], dist[i - 1][j] +
                                 (1 if S[i - 1][j] == "." else 0))
            else:
                dist[i][j] = min(dist[i][j], dist[i - 1][j])
        if j > 0:
            if S[i][j] == "#":
                dist[i][j] = min(dist[i][j], dist[i][j - 1] +
                                 (1 if S[i][j - 1] == "." else 0))
            else:
                dist[i][j] = min(dist[i][j], dist[i][j - 1])

print(dist[H - 1][W - 1])
print(dist)


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

S = [""] * H

for i in range(H):
    S[i] = input()

dist = [[1000000 for i in range(W)] for j in range(H)]

dist[0][0] = 0 if S[0][0] == "." else 1

for i in range(H):
    for j in range(W):
        if i > 0:
            if S[i][j] == "#":
                dist[i][j] = min(dist[i][j], dist[i - 1][j] +
                                 (1 if S[i - 1][j] == "." else 0))
            else:
                dist[i][j] = min(dist[i][j], dist[i - 1][j])
        if j > 0:
            if S[i][j] == "#":
                dist[i][j] = min(dist[i][j], dist[i][j - 1] +
                                 (1 if S[i][j - 1] == "." else 0))
            else:
                dist[i][j] = min(dist[i][j], dist[i][j - 1])

print(dist[H - 1][W - 1])


Verdicts: Wrong Answer

Accepted
Problem: Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white.  The grid is said to be _good_ if and only if the following condition is satisfied:    * From (1, 1), we can reach (H, W) by moving one square **right or down** repeatedly, while always being on a white square.  Note that (1, 1) and (H, W) must be white if the grid is good.  Your task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.    * Choose four integers r_0, c_0, r_1, c_1(1 \leq r_0 \leq r_1 \leq H, 1 \leq c_0 \leq c_1 \leq W). For each pair r, c (r_0 \leq r \leq r_1, c_0 \leq c \leq c_1), invert the color of (r, c) \- that is, from white to black and vice versa.

Submission attempts (in order):
H,W = map(int, input().split())
g = []
for _ in range(H):
    g.append(list(input()))

dp = [[10**9 for _ in range(W)] for __ in range(H)]

#solve
def dfs(i, j, score, lc):
    if i < H and i >= 0 and j < W and j >= 0:
        if lc == '.' and g[i][j] == '#':
            score += 1
        dp[i][j] = min(dp[i][j], score)

        dfs(i+1, j, score, g[i][j])
        dfs(i, j+1, score, g[i][j])        
    
dfs(0, 0, 0, '.')
print(dp)
print(dp[H-1][W-1])

H,W = map(int, input().split())
g = []
for _ in range(H):
    g.append(list(input()))

dp = [[10**9 for _ in range(W)] for __ in range(H)]

dp[0][0] = 1 if g[0][0] == '#' else 0
d = ([0,1], [1,0])
for ix in range(H):
    for jx in range(W):
        for dx,dy in d:
            ni = ix + dx
            nj = jx + dy
            if ni >= H or nj >= W:
                continue
            add = 0
            if g[ix][jx] == '.' and g[ni][nj] == '#':
                add += 1
            dp[ni][nj] = min(dp[ni][nj], dp[ix][jx] + add)


print(dp[H-1][W-1])

Verdicts: Wrong Answer

Accepted
Problem: Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white.  The grid is said to be _good_ if and only if the following condition is satisfied:    * From (1, 1), we can reach (H, W) by moving one square **right or down** repeatedly, while always being on a white square.  Note that (1, 1) and (H, W) must be white if the grid is good.  Your task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.    * Choose four integers r_0, c_0, r_1, c_1(1 \leq r_0 \leq r_1 \leq H, 1 \leq c_0 \leq c_1 \leq W). For each pair r, c (r_0 \leq r \leq r_1, c_0 \leq c \leq c_1), invert the color of (r, c) \- that is, from white to black and vice versa.

Submission attempts (in order):
INF = 10**9
def solve(h, w, s):
    dp = [[INF] * w for r in range(h)]
    dp[0][0] = int(s[0][0] == "#")
    for r in range(h):
        for c in range(w): 
            for dr, dc in [(-1, 0), (0, -1)]:
                nr, nc = r+dr, c+dc
                if (0 <= nr < h) and (0 <= nc < w):
                    dp[r][c] = min(dp[r][c], dp[nr][nc] + (s[r][c] != s[nr][nc]))
    return dp[h-1][w-1]

h, w = map(int, input().split())
s = [input() for r in range(h)]
print(solve(h, w, s))

INF = 10**9
def solve(h, w, s):
    dp = [[INF] * w for r in range(h)]
    dp[0][0] = int(s[0][0] == "#")
    for r in range(h):
        for c in range(w):
            for dr, dc in [(-1, 0), (0, -1)]:
                nr, nc = r+dr, c+dc
                if (0 <= nr < h) and (0 <= nc < w):
                    dp[r][c] = min(dp[r][c], dp[nr][nc] + (s[r][c] != s[nr][nc]))
    return (dp[h-1][w-1] + 1) // 2

h, w = map(int, input().split())
s = [input() for r in range(h)]
print(solve(h, w, s))


Verdicts: Wrong Answer

Accepted
Problem: Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white.  The grid is said to be _good_ if and only if the following condition is satisfied:    * From (1, 1), we can reach (H, W) by moving one square **right or down** repeatedly, while always being on a white square.  Note that (1, 1) and (H, W) must be white if the grid is good.  Your task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.    * Choose four integers r_0, c_0, r_1, c_1(1 \leq r_0 \leq r_1 \leq H, 1 \leq c_0 \leq c_1 \leq W). For each pair r, c (r_0 \leq r \leq r_1, c_0 \leq c \leq c_1), invert the color of (r, c) \- that is, from white to black and vice versa.

Submission attempts (in order):
h,w=map(int,input().split())
D=[[0]*w for _ in range(h)]

S=[list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        for x,y in ((1,0),(0,1)):
            X,Y=i+x,j+y
            if 0<=X<=h and 0<=Y<=w:
                if S[i][j]=="." and S[X][Y]=="#":
                    D[X][Y]=D[i][j]+1

ans=D[h-1][w-1]
print(ans if S[0][0]!="#" else ans+1)

h,w=map(int,input().split())
D=[[0]*w for _ in range(h)]

S=[list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        for x,y in ((1,0),(0,1)):
            X,Y=i+x,j+y
            if 0<=X<=h-1 and 0<=Y<w-1:
                if S[i][j]=="." and S[X][Y]=="#":D[X][Y]=D[i][j]+1
                else:D[X][Y]=D[i][j]

ans=D[h-1][w-1]
print(ans if S[0][0]!="#" else ans+1)

h,w=map(int,input().split())
D=[[0]*w for _ in range(h)]

S=[list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        for x,y in ((1,0),(0,1)):
            X,Y=i+x,j+y
            if 0<=X<=h and 0<=Y<=w:
                if S[i][j]=="." and S[X][Y]=="#":
                    D[X][Y]=D[i][j]+1
                    
ans=D[h-1][w-1]
print(ans if S[0][0]!="#" else ans+1)

h,w=map(int,input().split())
D=[[0]*w for _ in range(h)]

S=[list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        for x,y in ((1,0),(0,1)):
            X,Y=i+x,j+y
            if 0<=X<h and 0<=Y<w:
                if S[i][j]=="." and S[X][Y]=="#":
                    D[X][Y]=D[i][j]+1

ans=D[h-1][w-1]
print(ans if S[0][0]!="#" else ans+1)

inf=float("inf")
h,w=map(int,input().split())
D=[[inf]*w for _ in range(h)]
D[0][0]=0

S=[list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        for x,y in ((1,0),(0,1)):
            X,Y=i+x,j+y
            if 0<=X<h and 0<=Y<w:
                if S[i][j]=="." and S[X][Y]=="#":D[X][Y]=min(D[i][j]+1,D[X][Y])
                else:D[X][Y]=min(D[i][j],D[X][Y])

#import numpy as np
#print(np.array(D))
ans=D[h-1][w-1]
print(ans if S[0][0]!="#" else ans+1)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: Consider a grid with H rows and W columns of squares. Let (r, c) denote the square at the r-th row from the top and the c-th column from the left. Each square is painted black or white.  The grid is said to be _good_ if and only if the following condition is satisfied:    * From (1, 1), we can reach (H, W) by moving one square **right or down** repeatedly, while always being on a white square.  Note that (1, 1) and (H, W) must be white if the grid is good.  Your task is to make the grid good by repeating the operation below. Find the minimum number of operations needed to complete the task. It can be proved that you can always complete the task in a finite number of operations.    * Choose four integers r_0, c_0, r_1, c_1(1 \leq r_0 \leq r_1 \leq H, 1 \leq c_0 \leq c_1 \leq W). For each pair r, c (r_0 \leq r \leq r_1, c_0 \leq c \leq c_1), invert the color of (r, c) \- that is, from white to black and vice versa.

Submission attempts (in order):
h, w = map(int, input().split())
S = [list(input()) for _ in range(h)]
inf = 10*3
dp = [[inf]*w for _ in range(h)]

dp[0][0] = int(S[0][0]=="#")
for i in range(1, w):
    dp[0][i] = dp[0][i-1] + (S[0][i-1]!=S[0][i])
for i in range(1, h):
    dp[i][0] = dp[i-1][0] + (S[i-1][0]!=S[i][0])
for i in range(1, h):
    for j in range(1, w):
        dp[i][j] = min(dp[i-1][j]+(S[i-1][j]!=S[i][j]), dp[i][j-1]+(S[i][j-1]!=S[i][j]))
print(dp[-1][-1])

h, w = map(int, input().split())
a = lambda x: 1 if x=="#" else 0
S = [list(map(a, list(input()))) for _ in range(h)]
inf = 10*3
dp = [[inf]*w for _ in range(h)]
dp[0][0] = S[0][0]
for i in range(1, w):
    dp[0][i] = dp[0][i-1] + S[0][i]*(S[0][i]!=S[0][i-1])
for i in range(1, h):
    dp[i][0] = dp[i-1][0] + S[i][0]*(S[i][0]!=S[i-1][0])
for i in range(1, h):
    for j in range(1, w):
        dp[i][j] = min(dp[i-1][j]+S[i][j]*(S[i-1][j]!=S[i][j]), dp[i][j-1]+S[i][j]*(S[i][j]!=S[i][j-1]))
print(dp[-1][-1])

Verdicts: Wrong Answer

Accepted
Problem: Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows:    * x_{1,j} := a_j \quad (1 \leq j \leq N)   * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i)  Find x_{N,1}.

Submission attempts (in order):
import sys
n = int(input())
a = input()
if n == 2:
  print(abs(int(a[0]-int(a[1]))))
  sys.exit()

key = [0]*(n-1)
judge = False
for i in range(n-1):
  key[i] = abs(int(a[i])-int(a[i+1]))
  if key[i] == 1:
    judge = True

comb = 1
ans = 0
for i in range(n-1):
  ans += comb*key[i]
  ans %= 2
  comb *= (n-3-i)
  comb *= pow(i+1, 7, 2)
if ans == 0 and judge == False:
  ans = 2
print(ans)

import sys
import random
input = sys.stdin.readline


def solve(n, s):
    sub = [int(s[i])-1 for i in range(n)]
    
    table = [0]*(n+1)
    p = 2
    for i in range(len(bin(n))-1):
        for j in range(p, n+1, p):
            table[j] += 1
        p *= 2
    
    for i in range(n):
        table[i+1] += table[i]
    
    ans = 0
    for i in range(n):
        if sub[i]%2:
            judge = table[n-1]-table[n-1-i]-table[i]
            if not judge:
                ans += 1
    
    
    if ans%2:
        res = 1
    else:
        if 1 in sub:
            res = 0
        else:
            res = 0
            for i in range(n):
                if sub[i]:
                    judge = table[n-1]-table[n-1-i]-table[i]
                    if not judge:
                        res += 1
            return res%2*2
    
    return res
    
    
def main():
    n = int(input())
    s = input()
    
    ans = solve(n, s)
    print(ans)
    
    
if __name__ == "__main__":
    main()


Verdicts: Runtime Error

Accepted
Problem: Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows:    * x_{1,j} := a_j \quad (1 \leq j \leq N)   * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i)  Find x_{N,1}.

Submission attempts (in order):
print(0)

print(2)

N=int(input())
slist=input()

def fact_mod2(n,r):
  if n==(r|(n-r)):
    return 1
  else:
    return 0

alist=[]
for s in slist:
  alist.append(int(s)-1)  
#print(alist)

parity=0
for i in range(N):
  parity+=fact_mod2(N-1,i)*alist[i]
#print(parity)

if parity%2==1:
  print(1)
else:
  if 1 in alist:
    print(0)
  else:
    for i in range(N):
      alist[i]//=2
    
    parity=0
    for i in range(N):
      parity+=fact_mod2(N-1,i)*alist[i]
    if parity%2==1:
      print(2)
    else:
      print(0)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows:    * x_{1,j} := a_j \quad (1 \leq j \leq N)   * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i)  Find x_{N,1}.

Submission attempts (in order):
n = int(input())
b = input()
two = True
if "2" in b:
	two = False
ans = 0
a = ""
for i in range(n):
	if b[i] != "1":
		ans ^= ((n-1) == ( i | (n-1 - i)))
if ans:
	if two:
		print(2)
	else:
		print(1)
else:
	print(0)


n = int(input())
a = input()

if "2" in a:
	ans = 0
	for i in range(n):
		if a[i] == "2":
			ans ^= ((n-1) == ( i | (n-1 - i)))
	if ans:
		print(1)
	else:
		print(0)

else:
	ans = 0
	for i in range(n):
		if a[i] == "3":
			ans ^= ((n-1) == ( i | (n-1 - i)))
	if ans:
		print(2)
	else:
		print(0)

Verdicts: Wrong Answer

Accepted
Problem: Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows:    * x_{1,j} := a_j \quad (1 \leq j \leq N)   * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i)  Find x_{N,1}.

Submission attempts (in order):
n=int(input())
s=input()
if set(list(s))=={"1","3"}:print(2)

n=int(input())
s=input()
if set(list(s))=={"1","3"}:print(0)


from random import randint
n=int(input())
s=input()
if set(list(s))=={"1","3"}:print(randint(0,1)*2)
else:print(randint(0,1))

from random import randint
print(randint(0,2))

print(2)

print(0)

n=int(input())
def f(n,r):
    return n==r|(n-r)
s=list(map(int,list(input())))
b=[]
for i in range(n-1):b.append(abs(s[i]-s[i+1]))
if (0 in b and len(set(b))==2) or len(set(b))==1:
    ans=0
    anss=0
    for i in range(n-1):
        if b[i]:
            anss=b[i]
            ans+=f(n-2,i)
    if ans%2==0:
        print(0)
    else:
        print(anss)
    quit()
ans=0
for i in range(n-1):
    if b[i]%2==1:
        anss=b[i]
        ans+=f(n-2,i)
if ans%2==0:
    print(0)
else:
    print(1)
    

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows:    * x_{1,j} := a_j \quad (1 \leq j \leq N)   * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i)  Find x_{N,1}.

Submission attempts (in order):
N = int(input())
a = list(map(int,list(input())))
a = list(map(lambda x:x-1,a))
x = 0
num_mod = [0]*N
for i in range(1,N):
  tmp = 0
  while i%2==0:
    i//=2
    tmp+=1
  num_mod[i] = num_mod[i-1]+tmp
  

for i,n in enumerate(a):
  if n%2==0:
    continue
  else:
    if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i]):
      x+=1

if x%2!=0:
  print(1)
  
elif 1 in a:
  print(0)

else:
  a = [x//2 for x in a]
  x = 0
  for i,n in enumerate(a):
    if n%2==0:
      continue
    else:
      if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i]):
        x+=1
  if x%2!=0:
    print(2)
  else:
    print(0)


N = int(input())
a = list(map(int,list(input())))
a = list(map(lambda x:x-1,a))
x = 0
num_mod = [0]*N
for i in range(1,N):
  x = 0
  while i%2==0:
    i//=2
    x+=1
  num_mod[i] = num_mod[i-1]+x
  

for i,n in enumerate(a):
  if n%2==0:
    continue
  else:
    if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i]):
      x+=1

if x%2!=0:
  print(1)
  
elif 1 in a:
  print(0)

else:
  a = [x//2 for x in a]
  x = 0
  for i,n in enumerate(a):
    if n%2==0:
      continue
    else:
      if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i]):
        x+=1
  if x%2!=0:
    print(2)
  else:
    print(0)


N = int(input())
a = list(map(int,list(input())))
a = list(map(lambda x:x-1,a))
x = 0
for i,n in enumerate(a):
  if n%2==0:
    continue
  else:
    if ((N-1)^i)&i==0:
      x+=1

if x%2!=0:
  print(1)
  
if 1 in a:
  print(0)

N = int(input())
a = list(map(int,list(input())))
a = list(map(lambda x:x-1,a))
x = 0
num_mod = [0]*N
for i in range(1,N):
  tmp = 0
  t = i
  while t%2==0:
    t//=2
    tmp+=1
  num_mod[i] = num_mod[i-1]+tmp
  
for i,n in enumerate(a):
  if n%2==0:
    continue
  else:
    if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i]):
      x+=1

if x%2!=0:
  print(1)
  
elif 1 in a:
  print(0)

else:
  a = [x//2 for x in a]
  x = 0
  for i,n in enumerate(a):
    if n%2==0:
      continue
    else:
      if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i]):
        x+=1
  if x%2!=0:
    print(2)
  else:
    print(0)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows:    * x_{1,j} := a_j \quad (1 \leq j \leq N)   * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i)  Find x_{N,1}.

Submission attempts (in order):
n = int(input())
a = input()
x = []
x.extend([int(i) for i in a])

if len(x) > 1:
    x = [abs(x[i] - x[i + 1]) for i in range(len(x) - 1)]





if 1 in x:
    flag = True
    x = [1 if i == 1 else 0 for i in x]
else:
    flag = False
    x = [1 if i == 2 else 0 for i in x]
c=0
n=len(x)
n_b=bin(n)
if x[0]==1:
    c+=1
for i in range(1,n):
    tmp_nck = int(n_b == (bin(r) or bin(n-r)))
    if x[i] == 1:
        c+=tmp_nck
if flag:
    print(c%2)
else:
    if c%2 == 1:
        print(2)
    else:
        print(0)

n = int(input())
a = input()
x = []
x.extend([int(i) for i in a])





if 2 in x:
    flag = True
    x = [1 if i == 2 else 0 for i in x]
else:
    flag = False
    x = [1 if i == 3 else 0 for i in x]
c=0
n=len(x)
n_b=bin(n-1)
if x[0]==1:
    c+=1
for i in range(1,n-1):
    tmp_nck = int((n-1) == (i | (n-1-i)))
    if x[i] == 1:
        c+=tmp_nck
if x[n-1]==1:
    c+=1
if flag:
    print(c%2)
else:
    if c%2 == 1:
        print(2)
    else:
        print(0)



Verdicts: Runtime Error

Accepted
Problem: Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows:    * x_{1,j} := a_j \quad (1 \leq j \leq N)   * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i)  Find x_{N,1}.

Submission attempts (in order):
import random
print(random.randint() % 2)

import random
print(random.randint() % 2)

N = int(input())
A = list(map(int, input()))
A = [abs(A[i] - A[i + 1]) % 2 for i in range(len(A) - 1)]

cnt = 0
for i in range(len(A)):
    if A[i: i + 3] == [0, 1, 0]:
        cnt += 1

print(cnt % 2)

import random
print(random.randint(0, 1) % 2)

N = int(input())
A = list(map(int, input()))
A = [abs(A[i] - A[i + 1]) % 2 for i in range(len(A) - 1)]

cnt = 0
for i in range(len(A)):
    if A[i: i + 4] == [0, 1, 0]:
        cnt += 1

print(cnt % 2)

N = int(input())
A = list(map(int, input()))
A = [abs(A[i] - A[i + 1]) % 2 for i in range(len(A) - 1)]

print(sum(A) % 2)


N = int(input())
A = list(map(int, input()))
A = [abs(A[i] - A[i + 1]) % 2 for i in range(len(A) - 1)]

print((sum(A) + len(A) + 1) % 2)

N = int(input())
A = list(map(int, input()))
A = [abs(A[i] - A[i + 1]) % 2 for i in range(len(A) - 1)]

print(1 if len(A) >= 10000 else 0)


print(0)

N = int(input())
A = list(map(int, input()))
A = [abs(A[i] - A[i + 1]) % 2 for i in range(len(A) - 1)]

print((A.count(1) - A.count(0) + 1) % 2)

N = int(input())
A = list(map(lambda a: int(a) - 1, input()))

prd = 1
if all(a % 2 == 0 for a in A):
    prd = 2
    A = [a // 2 for a in A]

ans = 0
for i in range(N):
    if (N - 1) & i == i:
        ans ^= A[i] % 2

print(prd * ans)


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows:    * x_{1,j} := a_j \quad (1 \leq j \leq N)   * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i)  Find x_{N,1}.

Submission attempts (in order):



import numpy as np
n=int(input())
a_ = list(map(int, list(input())))
a = np.array(a_)-1
div2=[0]
cnt=0
ex1 = False

if 1 in a:
    ex1 = True
else:
    a//=2
tst=1
tsts=[1]
for i in range(n-1):
    p=int(((n-1)&i)==i)
    div2.append(p)
div2=np.array(div2)
dv2=1-(div2>0)
tmp= (a*dv2).sum()%2
if tmp:
    if ex1:
        print(1)
    else:
        print(2)

else:
    print(0)





import numpy as np
import sys
input = sys.stdin.readline
n=int(input())
a_ = list(map(int, list(input())))
a = np.array(a_)
div2=[1]
cnt=0
ex1 = False

if 1 in a:
    ex1 = True
else:
    a//=2
for i in range(1,n):
    cnt += bin(n-i)[::-1].find('1')
    cnt -= bin(i)[::-1].find('1')
    div2.append(cnt)

div2=np.array(div2)

tmp= (a*div2%2).sum()%2
if tmp:
    if ex1:
        print(1)
    else:
        print(2)

else:
    print(0)





import numpy as np
n=int(input())
a_ = list(map(int, list(input())))
a = np.array(a_)-1
div2=[1]
cnt=0
ex1 = False

if 1 in a:
    ex1 = True
else:
    a//=2
for i in range(n-1):
    p=int(((n-1)&i)==i)
    div2.append(p)
div2=np.array(div2)
print(div2)
tmp= (a*div2).sum()%2
if tmp:
    if ex1:
        print(1)
    else:
        print(2)

else:
    print(0)





import numpy as np
n=int(input())
a_ = list(map(int, list(input())))
a = np.array(a_)-1###
div2=[0]
cnt=0
ex1 = False

if 1 in a:
    ex1 = True
else:
    a//=2
tst=1
tsts=[1]
for i in range(n-1):
    cnt += bin(n-i-1)[::-1].find('1')
    cnt -= bin(i+1)[::-1].find('1')
    
    
    div2.append(cnt)
    tsts.append(tst)

div2=np.array(div2)
dv2=1-(div2>0)
#print(a)

#print(dv2)
tmp= (a*dv2).sum()%2
if tmp:
    if ex1:
        print(1)
    else:
        print(2)

else:
    print(0)


Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows:    * x_{1,j} := a_j \quad (1 \leq j \leq N)   * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i)  Find x_{N,1}.

Submission attempts (in order):
import sys
INF = 10 ** 9
MOD = 10 ** 9 + 7
from collections import deque
sys.setrecursionlimit(100000000)

def main():
    n = int(input())
    a = list(input())
    print(0)
if __name__=='__main__':
    main()



import sys
INF = 10 ** 9
MOD = 10 ** 9 + 7
from collections import deque
sys.setrecursionlimit(100000000)


def nxor(x,n,k):
    if (n&k) == k:
        return x
    else:
        return 0


def main():
    n = int(input())
    a = [int(i) - 1 for i in list(input())]
    
    cumxor = 0
    amod = [i%2 for i in a]
    for i in range(n):
        cumxor ^= nxor(amod[i],n - 1,i)
    
    if cumxor == 1:
        ans = 1
    else:
        if 1 in a:
            ans = 0
        else:
            cumxor = 0
            adiv = [i//2 for i in a]
            for i in range(n):
                cumxor ^= nxor(adiv[i],n - 1,i)
            if cumxor == 0:
                ans = 0
            else:
                ans = 2
    
    print(ans)

if __name__=='__main__':
    main()

Verdicts: Wrong Answer

Accepted
Problem: Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows:    * x_{1,j} := a_j \quad (1 \leq j \leq N)   * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i)  Find x_{N,1}.

Submission attempts (in order):
N=int(input())
A=[int(a)-1 for a in input()]
r=1-(1 in A)
print(sum([A[i]&r and (N-1&i)==i for i in range(N)])%2*r)

N=int(input())
A=[int(a)-1 for a in input()]
r=2-(1 in A)
print(sum([A[i]&r and (N-1&i)==i for i in range(N)])%2*r)

Verdicts: Wrong Answer

Accepted
Problem: Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows:    * x_{1,j} := a_j \quad (1 \leq j \leq N)   * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i)  Find x_{N,1}.

Submission attempts (in order):
n = int(input())
a = list(map(int,input().split()))

while n != 0:
	x = 1
	while x < n // 2:
		x *= 2
	b = []
	for i in range(x, n):
		b.append(abs(a[i - x] - a[i]))
	a = b
	n -= digit
	if len(b) == 1:
		break
print(a[0])


N = int(input())
a = list(map(int, list(input())))
 
while N != 0:
	digit = 1
	while digit < N // 2:
		digit *= 2
 
	x = []
	for i in range(digit, N):
		x.append(abs(a[i - digit] - a[i]))
 
	a = x
	N -= digit
	if len(x) == 1:
		break
 
print(a[0])

Verdicts: Runtime Error

Accepted
Problem: Given is a sequence of N digits a_1a_2\ldots a_N, where each element is 1, 2, or 3. Let x_{i,j} defined as follows:    * x_{1,j} := a_j \quad (1 \leq j \leq N)   * x_{i,j} := | x_{i-1,j} - x_{i-1,j+1} | \quad (2 \leq i \leq N and 1 \leq j \leq N+1-i)  Find x_{N,1}.

Submission attempts (in order):
import sys

N = int(input()) - 1
two = False
S = 0
for i, a in zip(range(N+1), sys.stdin):
  a = int(a)
  if not two:
    two = a == 2
  if i & N == i:
    S ^= a-1

if two:
  S &= ~2

print(S)


import sys

N = int(input()) - 1
two = False
S = 0
for i in range(N+1):
  a = int(sys.stdin.read(1))
  if not two:
    two = a == 2
  if i & N == i:
    S ^= a-1

if two:
  S &= ~2

print(S)


Verdicts: Wrong Answer

Accepted
Problem: Given is a positive integer N. Find the number of permutations (P_1,P_2,\cdots,P_{3N}) of (1,2,\cdots,3N) that can be generated through the procedure below. This number can be enormous, so print it modulo a prime number M.    * Make N sequences A_1,A_2,\cdots,A_N of length 3 each, using each of the integers 1 through 3N exactly once.   * Let P be an empty sequence, and do the following operation 3N times.     * Among the elements that are at the beginning of one of the sequences A_i that is non-empty, let the smallest be x.     * Remove x from the sequence, and add x at the end of P.

Submission attempts (in order):
from numpy import*
n,M=map(int,input().split())
l=n*3+1
d=zeros((l,n*5))
d[0][0]=1
for i in range(1,l):j,k=i-1,i-2;d[i]=(d[i-3]*k*j+roll(d[k],-1)*j+roll(d[j],1))%M
print(sum(d[-1][:l])%M)


import numpy as p
n,M=map(int,input().split())
l=n*3+1
d=p.zeros((l,n*5),p.int64)
d[0][0]=d[1][1]=d[2][2]=d[2][-1]=1
for i in range(3,l):
  d[i]=(d[i-3]*(i-2)*(i-1)+p.roll(p[i-2],-1)*(i-1)+p.roll(d[i-1],1))%M
print(d[-1][:l].sum()%M)

import numpy as p
n,M=map(int,input().split())
l=n*3+1
r=p.roll
d=p.zeros((l,n*5),p.int64)
d[0][0]=1
for i in range(l):j,k=i-1,i-2;d[i]=(d[i-3]*k*j+r(d[k],-1)*j+r(d[j],1))%M
print(d[-1][:l].sum()%M)


from numpy import*
n,M=map(int,input().split())
l=n*3+1
d=zeros(l,n*5)
d[0][0]=1
for i in range(1,l):j,k=i-1,i-2;d[i]=(d[i-3]*k*j+roll(d[k],-1)*j+roll(d[j],1))%M
print(sum(d[-1][:l])%M)


import numpy as p
n,M=map(int,input().split())
l=n*3+1
d=p.zeros((l,n*5),p.int64)
d[0][0]=d[1][1]=d[2][2]=d[2][-1]=1
for i in range(3,l):j,k=i-1,j-1;d[i]=(d[i-3]*(k)*(j)+p.roll(d[k],-1)*(i-1)+p.roll(d[j],1))%M
print(d[-1][:l].sum()%M)

from numpy import*
n,M=map(int,input().split())
l=n*3+1
d=zeros((l,n*5),int64)
d[0][0]=1
for i in range(1,l):j,k=i-1,i-2;d[i]=((d[i-3]*k+roll(d[k],-1))*j+roll(d[j],1))%M
print(sum(d[-1][:l])%M)

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: Given is a positive integer N. Find the number of permutations (P_1,P_2,\cdots,P_{3N}) of (1,2,\cdots,3N) that can be generated through the procedure below. This number can be enormous, so print it modulo a prime number M.    * Make N sequences A_1,A_2,\cdots,A_N of length 3 each, using each of the integers 1 through 3N exactly once.   * Let P be an empty sequence, and do the following operation 3N times.     * Among the elements that are at the beginning of one of the sequences A_i that is non-empty, let the smallest be x.     * Remove x from the sequence, and add x at the end of P.

Submission attempts (in order):
　from functools import lru_cache, reduce
from itertools import accumulate

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

@lru_cache(maxsize=None)
def mod_inv(x):
  x1, y1, z1 = 1, 0, x
  x2, y2, z2 = 0, 1, M
  while z1 != 1:
    d, m = divmod(z2, z1)
    x1, x2 = x2-d*x1, x1
    y1, y2 = y2-d*y1, y1
    z1, z2 = m, z1
  return x1%M

def gen_Y(i, A):
  yield A
  # sC2/1, (s-2)C2/2, (s-4)C2/3  ...
  s = 3*(N-i)
  r = s*(s-1)>>1
  d_r = (s<<1)-3
  for j in range(1, N-i+1):
    yield r * mod_inv(j)
    r -= d_r
    d_r -= 4

def gen_X():
  # sC3*2/1, (s-3)C3*2/2, (s-6)C3*2/3  ...
  yield 1
  a = N
  b = 3*N - 1
  for i in range(1, N+1):
    yield a * b * (b-1) * mod_inv(i)
    a -= 1
    b -= 3

def mul_mod(x, y):
  return x * y % M

def acc_mod(it):
  return accumulate(it, mul_mod)

ans = sum(sum(acc_mod(gen_Y(i, A))) for i, A in enumerate(acc_mod(gen_X())))%M

print(ans)

from functools import lru_cache

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

@lru_cache(maxsize=None)
def mod_inv(x):
  x1, y1, z1 = 1, 0, x
  x2, y2, z2 = 0, 1, M
  while z1 != 1:
    d, m = divmod(z2, z1)
    x1, x2 = x2-d*x1, x1
    y1, y2 = y2-d*y1, y1
    z1, z2 = m, z1
  return x1%M

def gen_Y(i):
  # sC2/1, (s-2)C2/2, (s-4)C2/3  ...
  s = 3*(N-i)
  r = s*(s-1)>>1
  d_r = (s<<1)-3
  for j in range(1, N-i+1):
    yield r * mod_inv(j)
    r -= d_r
    d_r -= 4

def gen_X():
  # sC3*2/1, (s-3)C3*2/2, (s-6)C3*2/3  ...
  a = N
  b = 3*N - 1
  for i in range(1, N+1):
    yield a * b * (b-1) * mod_inv(i)
    a -= 1
    b -= 3

def acc_mulmod(it, init=1):
  x = init
  yield x
  for y in it:
    x = x*y % M
    yield x

ans = sum(sum(acc_mulmod(gen_Y(i), A)) for i, A in enumerate(acc_mulmod(gen_X())))%M

print(ans)


Verdicts: Runtime Error

Accepted
Problem: In AtCoder City, there are three stations numbered 1, 2, and 3.  Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i.  To improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.  Determine if there is a pair of stations that will be connected by a bus service.

Submission attempts (in order):
s = input()
if s[0] == s[1] and s[1] == s[2]:
  print('Yes')
else :
  print('No')

s = input()
if s[0] == s[1] and s[1] == s[2]:
  print('No')
else :
  print('Yes')

Verdicts: Wrong Answer

Accepted
Problem: In AtCoder City, there are three stations numbered 1, 2, and 3.  Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i.  To improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.  Determine if there is a pair of stations that will be connected by a bus service.

Submission attempts (in order):
S = list(input())
if S[0］== S[1] == S[2]:
     print("No")
else:
     print("Yes")

s = list(input())
if s[0] == s[1] == s[2]:
    print('No')
else:
    print('Yes')

Verdicts: Runtime Error

Accepted
Problem: In AtCoder City, there are three stations numbered 1, 2, and 3.  Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i.  To improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.  Determine if there is a pair of stations that will be connected by a bus service.

Submission attempts (in order):

import collections


class Solution:
    def solve(self, string):
        counts = collections.Counter(string)
        return counts["A"] > 0 and counts["B"] > 0


sol = Solution()

string = input().strip()

print(sol.solve(string))



import collections


class Solution:
    def solve(self, string):
        counts = collections.Counter(string)

        return counts["A"] and counts["B"]


sol = Solution()

string = input().strip()

print("Yes" if sol.solve(string) else "No")


Verdicts: Wrong Answer

Accepted
Problem: In AtCoder City, there are three stations numbered 1, 2, and 3.  Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i.  To improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.  Determine if there is a pair of stations that will be connected by a bus service.

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

if s == 'AAA' or 'BBB':
    print('No')
else:
    print('Yes')

s = input()

if s == 'AAA' or 'BBB':
    print('No')
else:
    print('Yes')

s = input()

if s = 'AAA' or 'BBB':
    print('No')
else:
    print('Yes')

s = input()

if s == 'AAA' or s == 'BBB':
    print('No')
else:
    print('Yes')

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: In AtCoder City, there are three stations numbered 1, 2, and 3.  Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i.  To improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.  Determine if there is a pair of stations that will be connected by a bus service.

Submission attempts (in order):
S = input()
if S == "AAA" or S == "BBB":
  print("Yes")
else:
  print('No')

S=input()
if S[0] in S[1] in S[2]:
  print('Yes')
else:
  print('No')

S=input()
if S[0] == S[1] == S[2]:
  print('Yes')
else:
  print('No')

S=input()
if S[0] in S[1] in S[2]:
  print('Yes')
else:
  print('No')

s = input()
 
if s=="AAA" or s=="BBB":
    print("No")
else:
    print("Yes")

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: In AtCoder City, there are three stations numbered 1, 2, and 3.  Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i.  To improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.  Determine if there is a pair of stations that will be connected by a bus service.

Submission attempts (in order):
s = input()
if 'A' in s and 'B' in s:
    print("YES")
else:
    print("NO")


s = input()
if 'A' in s and 'B' in s:
    print("Yes")
else:
    print("No")


Verdicts: Wrong Answer

Accepted
Problem: In AtCoder City, there are three stations numbered 1, 2, and 3.  Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i.  To improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.  Determine if there is a pair of stations that will be connected by a bus service.

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

if n="AAA" or n="BBB":
  print("No")
else:
  print("Yes")

S=input()
if S=="AAA" or S=="BBB":
    print("No")
else:
    print("No")

n=input()

if n=="AAA" or n=="BBB":
  print("Yes")
else:
  print("No")

S=input()
if S=="AAA" or S=="BBB":
    print("No")
else:
    print("Yes")

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: In AtCoder City, there are three stations numbered 1, 2, and 3.  Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i.  To improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.  Determine if there is a pair of stations that will be connected by a bus service.

Submission attempts (in order):
s=input()
print("YNeos"[s != len(s) * s[0]::2])

s=input()
print("YNeos"[s == len(s) * s[0]::2])

Verdicts: Wrong Answer

Accepted
Problem: In AtCoder City, there are three stations numbered 1, 2, and 3.  Each of these stations is operated by one of the two railway companies, A and B. A string S of length 3 represents which company operates each station. If S_i is `A`, Company A operates Station i; if S_i is `B`, Company B operates Station i.  To improve the transportation condition, for each pair of a station operated by Company A and one operated by Company B, there will be a bus service connecting them.  Determine if there is a pair of stations that will be connected by a bus service.

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

if s[0] == s[1] == s[2]:
    print("Yes")
else:
    print("No")


s = input()

if s[0] == s[1] == s[2]:
    print("No")
else:
    print("Yes")


Verdicts: Wrong Answer

Accepted