ZhenlongDai/ACPR huggingface dataset:
Problem: p03475
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import math

n = int(input())
cL = []
sL = []
fL = []
for i in range(n - 1):
    c, s, f = map(int, input().split(" "))
    cL.append(c)
    sL.append(s)
    fL.append(f)

ans = 0
for i in range(n - 1):
    sm = 0
    for j in range(i, n - 1):
        c = cL[j]
        s = sL[j]
        f = fL[j]
        if sm < s:
            sm = s
        sm += c + (f - ((sm - s) % f) % f)
    print(sm)
print(0)

Failing test case input:
3
6 33 1
2 10 1

Expected output:
41
12
0


Actual output:
43
13
0


Fixed submission (verdict: Accepted):
import math

n = int(input())
cL = []
sL = []
fL = []
for i in range(n - 1):
    c, s, f = map(int, input().split(" "))
    cL.append(c)
    sL.append(s)
    fL.append(f)

ans = 0
for i in range(n - 1):
    sm = 0
    for j in range(i, n - 1):
        c = cL[j]
        s = sL[j]
        f = fL[j]
        if sm < s:
            sm = s + c
            continue
        df = f - (sm - s) % f
        if df == f:
            df = 0
        sm += c + df
    print(sm)
print(0)

Problem: p03475
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


n = int(readline())
csf = [tuple(map(int, readline().split())) for _ in range(n-1)]

for i in range(n):
    now = 0
    for c, s, f in csf[i::]:
        if now <= s:
            now += s - now + c
        else:
            now += (now-s) % f + c
    print(now)


Failing test case input:
4
11 24 6
52 8 4
99 2 2

Expected output:
187
159
101
0


Actual output:
189
159
101
0


Fixed submission (verdict: Accepted):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


n = int(readline())
csf = [tuple(map(int, readline().split())) for _ in range(n-1)]

for i in range(n):
    now = 0
    for c, s, f in csf[i::]:
        if now <= s:
            now = s
        else:
            if now % f == 0:
                pass
            else:
                now = (now 
        now += c
    print(now)
Problem: p03475
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
C, S, F = [], [], []
for _ in range(n-1):
    c, s, f = map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)
    
for i in range(n-1):
    t = S[i]
    while i != (n-1):
        if t < S[i]:  
            wait = (S[i] - t)
        else:
            wait = (t - S[i])%F[i]
        t += wait
        move = C[i]
        t += move
        i += 1
    print(t)
print(0)  

Failing test case input:
4
11 24 6
52 16 4
99 2 2

Expected output:
187
167
101
0


Actual output:
189
167
101
0


Fixed submission (verdict: Accepted):
n = int(input())
C, S, F = [], [], []
for _ in range(n-1):
    c, s, f = map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)

for i in range(n-1):
    t = S[i]
    while i != (n-1):
        if t < S[i]:  
            wait = (S[i] - t)
        else:
            r = (t - S[i])%F[i]
            if r == 0:
                wait = 0 
            else:
                wait = F[i] - r
        t += wait
        t += C[i]  
        i += 1
    print(t)
print(0)

Problem: p03475
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
stack = [0]
queue = []
for i in range(n-1):
  c,s,f = (int(i) for i in input().split())
  queue.append((c,s,f))
for i in range(n):
 ans = 0
 for j in range(n-i-1):
   c,s,f = queue[i+j]
   
   if s >= ans:
    ans = s+c
   else:
     if ans%f == 0:
      ans +=c
     elif ans%f != 0:
      ans += ans%f+c
 if n-i-1 == 0:
  ans = 0
 print(ans)


Failing test case input:
4
17 24 6
16 16 4
99 2 2

Expected output:
159
131
101
0


Actual output:
157
131
101
0


Fixed submission (verdict: Accepted):
def solve():
  n = int(input())
  query = []
  for i in range(n-1):
    c,s,f = (int(i) for i in input().split())
    query.append((c,s,f))

  ans = []
  for i in range(n-1):
    time = 0
    for j in range(i,n-1):
      c,s,f = query[j]
      time = max(s,time)
      if not time%f == 0:
        time += f-time%f
      time += c
    ans.append(time)
  for i in ans:
    print(i)
  print(0)
solve()

Problem: p03475
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys,math
input = sys.stdin.readline

N = int(input())
CSF = [[0,0,0]]
for i in range(1,N):
    CSF.append(list(map(int,input().split())))
for i in range(1,N+1):
    nowtime = 0
    for j in range(i,N):
        if nowtime <=CSF[j][1]:
            depT =CSF[j][1]
        else:
            depT =CSF[j][1] + math.ceil((nowtime-CSF[j][1])/CSF[j][2])*CSF[j][2]

        nowtime = depT+CSF[j][0]
        print(nowtime,depT)
    print(nowtime)


Failing test case input:
3
11 1 1
2 3 1

Expected output:
14
5
0


Actual output:
12 1
14 12
14
5 3
5
0


Fixed submission (verdict: Accepted):
import sys,math
input = sys.stdin.readline

N = int(input())
CSF = [[0,0,0]]
for i in range(1,N):
    CSF.append(list(map(int,input().split())))
for i in range(1,N+1):
    nowtime = 0
    for j in range(i,N):
        if nowtime <=CSF[j][1]:
            depT =CSF[j][1]
        else:
            depT =CSF[j][1] + math.ceil((nowtime-CSF[j][1])/CSF[j][2])*CSF[j][2]

        nowtime = depT+CSF[j][0]
        
    print(nowtime)
Problem: p03475
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
CSF = [list(map(int, input().split())) for i in range(N-1)]
for i in range(N-1):
    ans = 0
    for j in range(i, N-1):
        C, S, F = CSF[j]
        if ans <= S:
            ans = S
        else:
            diff = ans - S
            if diff % F != 0:
                ans += F - diff
        ans += C
    print(ans)
print(0)

Failing test case input:
4
4 5 6
130 5 2
99 2 2

Expected output:
239
235
101
0


Actual output:
103
103
101
0


Fixed submission (verdict: Accepted):
N = int(input())
CSF = [list(map(int, input().split())) for i in range(N-1)]
for i in range(N-1):
    ans = 0
    for j in range(i, N-1):
        C, S, F = CSF[j]
        if ans < S:
            ans = S
        else:
            if ans % F != 0:
                ans += F - (ans % F)
        ans += C
    print(ans)
print(0)

Problem: p03475
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
L = [list(map(int, input().split())) for i in range(N-1)]
ans = []

for i in range(N-1):
    time = L[i][1]
    for j in range(i, N-1):
        c, s, f = L[j]
        if time >= s:
            time += f - (time % f) 
        else:
            time += s - time
        time += c
    ans.append(time)

ans.append(0)
print(*ans, sep="\n")

Failing test case input:
3
2 0 1
1 0 1

Expected output:
3
1
0


Actual output:
5
2
0


Fixed submission (verdict: Accepted):
N = int(input())
L = [list(map(int, input().split())) for i in range(N-1)]
ans = []

for i in range(N-1):
    time = L[i][1]
    for j in range(i, N-1):
        c, s, f = L[j]
        if time < s:
            time = s
        elif time % f == 0:
            pass
        else:
            time += f - time % f
        time += c
    ans.append(time)

ans.append(0)
print(*ans, sep="\n")

Problem: p03475
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
c = [list(map(int, input().split())) for _ in range(N - 1)]
anslst = [0] * N
for i in range(N - 1):
    ans = c[i][1] + c[i][0]
    for j in range(i + 1, N - 1):
        if ans <= c[j][1]:
            ans = c[j][1] + c[j][0]
        else:
            tmp = ans - c[j][1]
            amari = tmp % c[j][2]
            if amari == 0:
                ans += c[j][0]
            else:
                ans += c[j][0] + amari

    anslst[i] = ans

for i in anslst:
    print(i)

Failing test case input:
4
11 24 6
52 16 4
99 2 2

Expected output:
187
167
101
0


Actual output:
189
167
101
0


Fixed submission (verdict: Accepted):
N = int(input())
c = [list(map(int, input().split())) for _ in range(N - 1)]
anslst = [0] * N
for i in range(N - 1):
    ans = c[i][1] + c[i][0]
    for j in range(i + 1, N - 1):
        if ans <= c[j][1]:
            ans += (c[j][1] - ans) + c[j][0]
        else:
            sho, amari = divmod(ans, c[j][2])
            if amari == 0:
                ans += c[j][0]
            else:
                ans += c[j][0] + (((sho + 1) * c[j][2]) - ans)

    anslst[i] = ans

for i in anslst:
    print(i)
Problem: p03475
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
CSF = [list(map(int,input().split())) for i in range(N-1)]
CSF.append([0,0,1])
ans=[0]*N 
for i in range(N-1):
    for j in range(i,N-1):
        if j == i:
            ans[i]+=CSF[j][0]+CSF[j][1]
        else:
            if ans[i]<=CSF[j][1]:
                ans[i]=CSF[j][0]+CSF[j][1]
            else:
                ans[i]+=(ans[i]-CSF[j][1])%CSF[j][2]+CSF[j][0] 
for i in range(N):
    print(ans[i])

Failing test case input:
4
17 24 6
16 16 4
99 2 2

Expected output:
159
131
101
0


Actual output:
157
131
101
0


Fixed submission (verdict: Accepted):
N = int(input())
CSF = [list(map(int,input().split())) for i in range(N-1)]
CSF.append([0,0,1])
ans=[0]*N 
for i in range(N-1):
    for j in range(i,N-1):
        if j == i:
            ans[i]+=CSF[j][0]+CSF[j][1]
        else:
            if ans[i]<=CSF[j][1]:
                ans[i]=CSF[j][0]+CSF[j][1]
            elif (ans[i]-CSF[j][1])%CSF[j][2]==0:
                ans[i]+=CSF[j][0]
            else:
                ans[i]+=(CSF[j][2]-(ans[i]-CSF[j][1])%CSF[j][2])+CSF[j][0] 
for i in range(N):
    print(ans[i])

Problem: p03475
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
lines = []

for i in range(N-1):
    lines.append(input())

C = []
S = []
F = []

for line in lines:
	c, s, f = line.split()
	C.append(int(c))
	S.append(int(s))
	F.append(int(f))

A = []

for i in range(N-1):
	a = C[i] + S[i]
	for j in range(i + 1, N - 1):
		
		n = S[j] - a if a <= S[j] else F[j] - (a % F[j])
		a = a + C[j] + n
	A.append(a)

for a in A:
	print(a)
print(0)


Failing test case input:
4
1 0 7
52 8 4
99 4 2

Expected output:
159
159
103
0


Actual output:
161
161
103
0


Fixed submission (verdict: Accepted):
N = int(input())
lines = []

for i in range(N-1):
    lines.append(input())

C = []
S = []
F = []

for line in lines:
	c, s, f = line.split()
	C.append(int(c))
	S.append(int(s))
	F.append(int(f))

A = []

for i in range(N-1):
	a = C[i] + S[i]
	for j in range(i + 1, N - 1):
		n = S[j] - a if a <= S[j] else (a - S[j]) % F[j]
		n = F[j] - n if a > S[j] and n != 0 else n
		
		a = a + C[j] + n
	A.append(a)

for a in A:
	print(a)
print(0)
Problem: p03475
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
csf = []
for i in range(n - 1):
    csf.append(list(map(int, input().split())))

for i in range(n):
    AnsSec = 0
    Now_Station = i
    while Now_Station < n - 1:
        if AnsSec > csf[Now_Station][1]:
            if csf[Now_Station][2] % AnsSec != 0:
                AnsSec += csf[Now_Station][2] - (AnsSec % csf[Now_Station][2] )
        else:
            AnsSec += csf[Now_Station][1] - AnsSec
        AnsSec += csf[Now_Station][0]
        Now_Station += 1
    print(AnsSec)


Failing test case input:
4
17 24 6
16 16 4
99 2 2

Expected output:
159
131
101
0


Actual output:
161
133
101
0


Fixed submission (verdict: Accepted):
n = int(input())
csf = []
for i in range(n - 1):
    csf.append(list(map(int, input().split())))

for i in range(n):
    AnsSec = 0
    Now_Station = i
    while Now_Station < n - 1:
        if AnsSec > csf[Now_Station][1]:
            if AnsSec % csf[Now_Station][2] != 0:
                AnsSec += csf[Now_Station][2] - (AnsSec % csf[Now_Station][2])
        else:
            AnsSec += csf[Now_Station][1] - AnsSec
        AnsSec += csf[Now_Station][0]
        Now_Station += 1
    print(AnsSec)

Problem: p03475
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
sys.setrecursionlimit(100000)

n = int(input())
lst = []
for _ in range(n - 1):
  lst.append([int(i) for i in input().split()])


time_list = []

def time_cost(i, now, lst):
  if i == n - 1:
    return now
  if now >= lst[i][1]:
    now += now % lst[i][2] + lst[i][0]
  else:
    now = lst[i][1] + lst[i][0]
  return time_cost(i+1, now, lst)

for i in range(n):
  print(time_cost(i, 0, lst))


Failing test case input:
4
15 24 6
52 16 4
99 2 2

Expected output:
191
167
101
0


Actual output:
193
167
101
0


Fixed submission (verdict: Accepted):
import sys
sys.setrecursionlimit(2000)

n = int(input())
lst = []
for _ in range(n - 1):
  lst.append([int(i) for i in input().split()])

def time_cost(i, now, lst):
  if i == n - 1:
    return now
  if now >= lst[i][1]:
    if now % lst[i][2] == 0:
      now += lst[i][0]
    else:
      now += lst[i][0] + lst[i][2] - now % lst[i][2]
  else:
    now = lst[i][1] + lst[i][0]
  return time_cost(i+1, now, lst)

for i in range(n):
  print(time_cost(i, 0, lst))
Problem: p03475
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N = int(input())
C = []
S = []
F = []
for i in range(N-1):
    Ci, Si, Fi = list(map(int, input().split((" "))))
    C.append(Ci)
    S.append(Si)
    F.append(Fi)

ans = []
for i in range(N):
    t = 0
    for j in range(i, N-1):
        if t < S[j]:
            t = S[j]
        elif t % F[j] == 0:
            pass
        else:
            t += t + F[j] - (t % F[j])
        t += C[j]
    print(t)



Failing test case input:
4
26 5 6
102 5 2
99 2 2

Expected output:
233
207
101
0


Actual output:
430
314
101
0


Fixed submission (verdict: Accepted):

N = int(input())
C = []
S = []
F = []
for i in range(N-1):
    Ci, Si, Fi = list(map(int, input().split((" "))))
    C.append(Ci)
    S.append(Si)
    F.append(Fi)

ans = []
for i in range(N):
    t = 0
    for j in range(i, N-1):
        if t < S[j]:
            t = S[j]
        elif t % F[j] == 0:
            pass
        else:
            t = t + F[j] - (t % F[j])
        t += C[j]
    print(t)

Problem: p03475
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
def gcd(a, b):
  while b:
    a,b = b,a%b
  return a
def lcm(a, b):
   return a*b
CSF = []
for i in range(n-1):
  CSF.append(list(map(int, input().split())))
for i in range(n-1):
  s = CSF[i][1]
  for j in range(i,n-1):
    s += CSF[j][0]
    if j < n-2:
      if s < CSF[j+1][1]:
        s = CSF[j+1][1]
      if s%CSF[j+1][2] != 0:
        s = lcm(s, CSF[j+1][2])
  print(s)
print(0)


Failing test case input:
4
12 24 3
5 16 4
121 0 2

Expected output:
163
143
121
0


Actual output:
203
163
121
0


Fixed submission (verdict: Accepted):
n = int(input())
CSF = []
for i in range(n-1):
  CSF.append(list(map(int, input().split())))
for i in range(n-1):
  s = CSF[i][1]
  for j in range(i,n-1):
    s += CSF[j][0]
    if j < n-2:
      if s < CSF[j+1][1]:
        s = CSF[j+1][1]
      if s%CSF[j+1][2] != 0:
        s = (s
  print(s)
print(0)

Problem: p03475
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
l = [list(map(int, input().split())) for j in range(N-1)]

t = []
for i in range(N-1):
    t.append(l[i][0]+l[i][1])
    for j in range(1, N-i-1):
        if t[i] < l[i+j][1]:
            t[i] = l[i+j][1] + l[i+j][0]
           
        else: 
            t[i] += -(t[i]%(l[i+j][2])) + l[i+j][2] + l[i+j][0] 

t.append(0)
for i in range(N):
    print(t[i])



Failing test case input:
3
6 5 1
3 10 1

Expected output:
14
13
0


Actual output:
15
13
0


Fixed submission (verdict: Accepted):
N = int(input())
l = [list(map(int, input().split())) for j in range(N-1)]

t = []
for i in range(N):
    t = 0
    for j in range(i, N-1):
        if t < l[j][1]:
            t = l[j][1] 
           
        elif 0 == (t%(l[j][2])): 
            pass
        
        else:
            t += -(t%(l[j][2])) + l[j][2] 
        
        t += l[j][0] 

    print(t)
Problem: p03475
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
n=int(input())
c=[]
s=[]
f=[]
if n==1:
    print(0)
    sys.exit()
for i in range(n-1):
    C,S,F=map(int,input().split())
    c.append(C)
    s.append(S)
    f.append(F)
for i in range(n-1):
    tmp=0
    while i<n-1:
        if tmp<=s[i]:
            a=s[i]
        elif tmp%f[i]==0:
            a=s[i]+f[i]
        elif tmp>s[i]:
            b=(tmp-s[i])%f[i]
            a=tmp+b
        tmp=a+c[i]
        i+=1
    print(tmp)
print(0)

Failing test case input:
3
9 4 1
1 10 1

Expected output:
14
11
0


Actual output:
12
11
0


Fixed submission (verdict: Accepted):
import sys
n=int(input())
c=[]
s=[]
f=[]
if n==1:
    print(0)
    sys.exit()
for i in range(n-1):
    C,S,F=map(int,input().split())
    c.append(C)
    s.append(S)
    f.append(F)
for i in range(n-1):
    tmp=0
    while i<n-1:
        if tmp<=s[i]:
            a=s[i]
        elif (tmp-s[i])%f[i]==0:
            a=tmp
        elif tmp>s[i]:
            b=f[i]-(tmp-s[i])%f[i]
            a=tmp+b
        tmp=a+c[i]
        i+=1
    print(tmp)
print(0)

Problem: p03475
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())-1
timeLine = [[0 for x in range(3)] for y in range(N)]
for i in range(N):
    tmp = input().split()
    timeLine[i][0],timeLine[i][1],timeLine[i][2] = int(tmp[0]),int(tmp[1]),int(tmp[2])
for j in range(N):
    total = timeLine[j][0] + timeLine[j][1]
    now = j+1
    while now <= (N-1):
        if timeLine[now][1] >= total:
            total = timeLine[now][1] + timeLine[now][0]
        else:
            wait = int((total - timeLine[now][1]) % timeLine[now][2])
            total += (wait + timeLine[now][0])
        now +=1
    print(total)
print(0)

Failing test case input:
4
19 24 3
32 16 4
99 2 2

Expected output:
175
147
101
0


Actual output:
177
147
101
0


Fixed submission (verdict: Accepted):
N = int(input())-1
timeLine = [[0 for x in range(3)] for y in range(N)]
for i in range(N):
    tmp = input().split()
    timeLine[i][0],timeLine[i][1],timeLine[i][2] = int(tmp[0]),int(tmp[1]),int(tmp[2])
for j in range(N):
    total = timeLine[j][0] + timeLine[j][1]
    now = j+1
    while now <= (N-1):
        if timeLine[now][1] >= total:
            total = timeLine[now][1] + timeLine[now][0]
        else:
            if timeLine[now][1] + timeLine[now][2] >= total:
                total = timeLine[now][0] + timeLine[now][1] + timeLine[now][2]
            else:
                n = int((total-timeLine[now][1])/timeLine[now][2])
                if (total-timeLine[now][1]) % timeLine[now][2] > 0:
                    n += 1
                total = timeLine[now][0] + timeLine[now][1] + timeLine[now][2] * n
        now +=1
    print(total)
print(0)
Problem: p03626
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
s1 = input()
s2 = input()

MOD = int(1e9) + 7

tate = "tate"
yoko = "yoko"

i = 0
ans = 0
pre = ""
if s1[i] == s2[i]:
    ans = 3
    i += 1
    pre = tate
else:
    ans = 6
    i += 2
    pre = yoko

while i < N:
    if s1[i] == s2[i]:
        if pre == tate:
            ans *= 2
            ans %= MOD
            i += 1
        else:
            ans *= 1
            ans %= MOD
            i += 2
        pre = tate
    else:
        if pre == tate:
            ans *= 2
            ans %= MOD
            i += 1
        else:
            ans *= 2
            ans %= MOD
            i += 2
        pre = yoko
print(ans)


Failing test case input:
52
RvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn
RLLwwdWIxxNNQUUXXUVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn

Expected output:
958681902


Actual output:
402653184


Fixed submission (verdict: Accepted):
N = int(input())
s1 = input()
s2 = input()

MOD = int(1e9) + 7

tate = "tate"
yoko = "yoko"

i = 0
ans = 0
pre = ""
if s1[i] == s2[i]:
    ans = 3
    i += 1
    pre = tate
else:
    ans = 6
    i += 2
    pre = yoko

while i < N:
    if s1[i] == s2[i]:
        if pre == tate:
            ans *= 2
        elif pre == yoko:
            ans *= 1
        i += 1
        pre = tate
    else:
        if pre == tate:
            ans *= 2
        elif pre == yoko:
            ans *= 3
        i += 2
        pre = yoko
    ans %= MOD
print(ans)

Problem: p03626
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
    N = int(input())
    S1 = input()
    S2 = input()
    ans = 3
    i = 0
    while N - 1 > i:
        print(S1[i], S2[i])
        if S1[i] == S2[i]:
            if S1[i + 1] == S2[i + 1]:
                ans *= 2
            i += 1
        else:
            if N > i + 2 and S1[i + 2] != S2[i + 2]:
                ans *= 3
            else:
                ans *= 2
            i += 2
    print(ans % 1000000007)


main()


Failing test case input:
3
baa
bgb

Expected output:
6


Actual output:
b b
a g
6


Fixed submission (verdict: Accepted):
def main():
    N = int(input())
    S1 = input()
    S2 = input()
    ans = 3
    i = 0
    while N - 1 > i:
        if S1[i] == S2[i]:
            if S1[i + 1] == S2[i + 1]:
                ans *= 2
            i += 1
        else:
            if N > i + 2 and S1[i + 2] != S2[i + 2]:
                ans *= 3
            else:
                ans *= 2
            i += 2
    print(ans % 1000000007)


main()
Problem: p03626
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    A = [list(map(str, input().strip())) for _ in range(2)]
    MOD = 10**9 + 7

    D = []
    flag = False
    for i in range(N):
        if A[0][i] != A[1][i] and flag:
            D.append('h')
            flag = False
        elif A[0][i] != A[1][i]:
            flag = True
        else:
            D.append('v')

    if N == 1:
        return 3
    if N == 2:
        return 6
    if N == 3:
        return 6

    ans = 3
    for i in range(1, len(D)):
        if D[i-1] == 'v' and D[i] == 'h':
            ans *= 2
        elif D[i-1] == 'v' and D[i] == 'v':
            ans *= 2
        elif D[i-1] == 'h' and D[i] == 'h':
            ans *= 3
        else:
            ans *= 1


    return ans % MOD


if __name__ == '__main__':
    print(main())


Failing test case input:
3
bab
bab

Expected output:
12


Actual output:
6


Fixed submission (verdict: Accepted):
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    A = [list(map(str, input().strip())) for _ in range(2)]
    MOD = 10**9 + 7

    D = []
    flag = False
    for i in range(N):
        if A[0][i] != A[1][i] and flag:
            D.append('h')
            flag = False
        elif A[0][i] != A[1][i]:
            flag = True
        else:
            D.append('v')

    if D[0] == 'h':
        ans = 6
    else:
        ans = 3

    for i in range(1, len(D)):
        if D[i-1] == 'v' and D[i] == 'h':
            ans *= 2
        elif D[i-1] == 'v' and D[i] == 'v':
            ans *= 2
        elif D[i-1] == 'h' and D[i] == 'h':
            ans *= 3
        else:
            ans *= 1

    return ans % MOD


if __name__ == '__main__':
    print(main())
Problem: p03626
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S1 = input()
S2 = input()
patterns = []
flag = False
for i in range(N):
    if S1[i] == S2[i]:
        patterns.append('row')
    elif flag is False:
        patterns.append('column')
        flag = True
    else:
        flag = False

print(patterns)
if patterns[0] == 'row':
    count = 3
else:
    count = 6
for i in range(1, len(patterns)):
    prev = patterns[i-1]
    current = patterns[i]
    if prev == 'row':
        if current == 'row':
            count *= 2
        else:
            count *= 2
    else: 
        if current == 'row':
            count *= 1
        else:
            count *= 3
print(count % (10**9  + 7))

Failing test case input:
3
baa
bca

Expected output:
6


Actual output:
['row', 'column', 'row']
6


Fixed submission (verdict: Accepted):
N = int(input())
S1 = input()
S2 = input()
patterns = []
flag = False
for i in range(N):
    if S1[i] == S2[i]:
        patterns.append('row')
    elif flag is False:
        patterns.append('column')
        flag = True
    else:
        flag = False

if patterns[0] == 'row':
    count = 3
else:
    count = 6
for i in range(1, len(patterns)):
    prev = patterns[i-1]
    current = patterns[i]
    if prev == 'row':
        if current == 'row':
            count *= 2
        else:
            count *= 2
    else: 
        if current == 'row':
            count *= 1
        else:
            count *= 3
print(count % (10**9  + 7))

Problem: p03626
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s1=input()
s2=input()
x=[]
f=0
for i in range(n):
    if f==1:
        f=0
    else:
        if s1[i]==s2[i]:
            x.append(0)
        else:
            x.append(1)
            f=1
l=len(x)

if l==1:
    if x[0]==0:
        print(3)
    else:
        print(6)
else:
    if x[0]==0:
        c=3
    else:
        c=6
    for i in range(1,l):
        
        if x[i-1]==0:
            c*=2
        else:
            if x[i]==1:
                c*=3
        c%=1000000007

    if x==[0]*l or x==[1]*l:
        c+=1

    print(c%1000000007)


Failing test case input:
3
bab
bab

Expected output:
12


Actual output:
13


Fixed submission (verdict: Accepted):
n=int(input())
s1=input()
s2=input()
x=[]
f=0
for i in range(n):
    if f==1:
        f=0
    else:
        if s1[i]==s2[i]:
            x.append(0)
        else:
            x.append(1)
            f=1
l=len(x)

if l==1:
    if x[0]==0:
        print(3)
    else:
        print(6)
else:
    if x[0]==0:
        c=3
    else:
        c=6
    for i in range(1,l):
        
        if x[i-1]==0:
            c*=2
        else:
            if x[i]==1:
                c*=3
        c%=1000000007

    print(c%1000000007)
Problem: p03626
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s1=input()
s2=input()
x=[]
f=0
for i in range(n):
    if f==1:
        f=0
    else:
        if s1[i]==s2[i]:
            x.append(0)
        else:
            x.append(1)
            f=1
l=len(x)

if l==1:
    if x[0]==0:
        print(3)
    else:
        print(6)
else:
    if x[0]==0:
        c=3
    else:
        c=6
    for i in range(1,l):
        
        if x[i-1]==0:
            c*=2
        else:
            if x[i]==1:
                c*=3
        c%=1000000007
    if x==[0]*l:
        c+=3
    if x==[1]*l:
        c+=3

    print(c%1000000007)


Failing test case input:
3
bab
bab

Expected output:
12


Actual output:
15


Fixed submission (verdict: Accepted):
n=int(input())
s1=input()
s2=input()
x=[]
f=0
for i in range(n):
    if f==1:
        f=0
    else:
        if s1[i]==s2[i]:
            x.append(0)
        else:
            x.append(1)
            f=1
l=len(x)

if l==1:
    if x[0]==0:
        print(3)
    else:
        print(6)
else:
    if x[0]==0:
        c=3
    else:
        c=6
    for i in range(1,l):
        
        if x[i-1]==0:
            c*=2
        else:
            if x[i]==1:
                c*=3
        c%=1000000007

    print(c%1000000007)

Problem: p03626
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S_1 = list(input())
S_2 = list(input())



if S_1[0] == S_2[0]:
    res = 3
    flag = 0
    i = 1
else:
    res = 6
    flag = 1
    i = 2

while i != N:
    if S_1[i] == S_2[i]:
        if flag == 0:
            res *= 2 
        else:
            res *= 1
            flag = 0
        i += 1

    else:
        if flag == 0:
            res *= 2
            flag = 1
        else:
            res *= 3
        i += 2
        
ans = res%100000007

print(ans)    

Failing test case input:
52
nHHppJGGCCjlAhrYebbicqKDSSakkEEffssZZFFQPPyyIWdttvvR
nzzuuJTTOOjlAhrYemmicqKDhgaBBooMMVUXXUUQNNxxIWdwwLLR

Expected output:
958681902


Actual output:
58679949


Fixed submission (verdict: Accepted):
N = int(input())
S_1 = list(input())
S_2 = list(input())



if S_1[0] == S_2[0]:
    res = 3
    flag = 0
    i = 1
else:
    res = 6
    flag = 1
    i = 2

while i != N:
    if S_1[i] == S_2[i]:
        if flag == 0:
            res *= 2 
        else:
            res *= 1
            flag = 0
        i += 1

    else:
        if flag == 0:
            res *= 2
            flag = 1
        else:
            res *= 3
        i += 2
        
ans = res%1000000007

print(ans)
Problem: p03626
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

s1 = input()
s2 = input()

INF = 1000000009

left = None
index = 0
cnt = 0
while index < n:
    
    if s1[index] == s2[index]:
        index += 1
        if left is None:
            left = 1
            cnt = 3
        
        elif left == 1:
            cnt *= 2
        
        else:
            cnt *= 1
        left = 1

    
    else:
        index += 2
        if left is None:
            left = 2
            cnt = 6
        
        elif left == 1:
            cnt *= 2
        
        else:
            cnt *= 3
        left = 2
    cnt = cnt % INF
print(cnt)

Failing test case input:
52
RvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn
RLLwwdWIxxNNQUUXXVVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn

Expected output:
958681902

Actual output:
958681842


Fixed submission (verdict: Accepted):
n = int(input())

s1 = input()
s2 = input()

INF = 1000000007

left = None
index = 0
cnt = 0
while index < n:
    
    if s1[index] == s2[index]:
        index += 1
        if left is None:
            left = 1
            cnt = 3
        
        elif left == 1:
            cnt *= 2
        
        else:
            cnt *= 1
        left = 1

    
    else:
        index += 2
        if left is None:
            left = 2
            cnt = 6
        
        elif left == 1:
            cnt *= 2
        
        else:
            cnt *= 3
        left = 2
    cnt = cnt % INF
print(cnt)

Problem: p03626
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
S = input()
T = input()

MOD = 10 ** 9

ptn = []
i = 0
while i < N:
    if S[i] == T[i]:
        ptn.append(1)
        i += 1
    else:
        ptn.append(2)
        i += 2

if ptn[0] == 1:
    ans = 3
else:
    ans = 6

for s, t in zip(ptn[:], ptn[1:]):
    if s == 1 and t == 1:
        ans *= 2
    elif s == 1 and t == 2:
        ans *= 2
    elif s == 2 and t == 1:
        ans *= 1
    elif s == 2 and t == 2:
        ans *= 3
    ans %= MOD

print(ans)

Failing test case input:
52
RvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn
RLLwwdWIxxNNQUUXXVVMMooCBaggDKqcinmeYrhAljOOTTJuvzzn

Expected output:
958681902


Actual output:
958682112


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
T = input()

MOD = 10 ** 9 + 7

ptn = []
i = 0
while i < N:
    if S[i] == T[i]:
        ptn.append(1)
        i += 1
    else:
        ptn.append(2)
        i += 2

if ptn[0] == 1:
    ans = 3
else:
    ans = 6

for s, t in zip(ptn[:], ptn[1:]):
    if s == 1 and t == 1:
        ans *= 2
    elif s == 1 and t == 2:
        ans *= 2
    elif s == 2 and t == 1:
        ans *= 1
    elif s == 2 and t == 2:
        ans *= 3
    ans %= MOD

print(ans)
Problem: p03626
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys

import math







mod=1000000007
n=int(input())
s=[input() for _ in range(2)]
d=[]
i=0
while i<n:
    if s[0][i]==s[1][i]:
        d.append(1)
        i+=1
    else:
        d.append(2)
        i+=2
m=len(d)
ans=0
if d[0]==1:
    ans=3
if d[0]==2:
    ans=6
print(d)
for i in range(1,m):
    if d[i]==1:
        if d[i-1]==2:
            ans*=1
        else:
            ans*=2
    else:
        if d[i-1]==2:
            ans*=3
        else:
            ans*=2
    ans=ans%mod
print(ans%mod)

Failing test case input:
3
b^b
b`b

Expected output:
6


Actual output:
[1, 2]
6


Fixed submission (verdict: Accepted):
import sys

import math







mod=1000000007
n=int(input())
s=[input() for _ in range(2)]
d=[]
i=0
while i<n:
    if s[0][i]==s[1][i]:
        d.append(1)
        i+=1
    else:
        d.append(2)
        i+=2
m=len(d)
ans=0
if d[0]==1:
    ans=3
if d[0]==2:
    ans=6
for i in range(1,m):
    if d[i]==1:
        if d[i-1]==2:
            ans*=1
        else:
            ans*=2
    else:
        if d[i-1]==2:
            ans*=3
        else:
            ans*=2
    ans=ans%mod
print(ans%mod)

Problem: p03626
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
MOD = 10**9+7

n = int(input())
s1 = input()
s2 = input()
ans = 1

if s1[0] == s2[0]:
    i = 1
    pre_pat = 0
    ans = 3
else:
    i = 2
    pre_pat = 1
    ans = 6

t = [[2, 2], [1, 3]]
while True:
    if i >= n:
        break
    if s1[i] == s2[i]:
        pat = 0
        i += 1
    else:
        pat = 1
        i += 2
    ans *= t[pre_pat][pat]
    ans %= MOD
    print(pre_pat, pat, ans, i)
    pre_pat = pat
print(ans)

Failing test case input:
3
aab
acb

Expected output:
6


Actual output:
0 1 6 3
6


Fixed submission (verdict: Accepted):
MOD = 10**9+7

n = int(input())
s1 = input()
s2 = input()
ans = 1

if s1[0] == s2[0]:
    i = 1
    pre_pat = 0
    ans = 3
else:
    i = 2
    pre_pat = 1
    ans = 6

t = [[2, 2], [1, 3]]
while True:
    if i >= n:
        break
    if s1[i] == s2[i]:
        pat = 0
        i += 1
    else:
        pat = 1
        i += 2
    ans *= t[pre_pat][pat]
    ans %= MOD
    
    pre_pat = pat
print(ans)
Problem: p03626
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
s1 = input()
s2 = input()

mod = 10**9+7

if s1[0] == s2[0]:
    ans = 3
    bfr = 'T'
    idx = 1
else:
    ans = 6
    bfr = 'Y'
    idx = 2

if n == 1:
    print(ans)
    exit()

while idx <= n-1:
    if s1[idx] == s2[idx]:
        if bfr == 'T':
            ans *= 2
            ans %= mod
        idx += 1
        bfr = 'T'
    else:
        ans *= 3
        ans %= mod
        idx += 2
        bfr = 'Y'
        
print(ans%mod)

Failing test case input:
3
b`b
bcb

Expected output:
6


Actual output:
9


Fixed submission (verdict: Accepted):
n = int(input())
s1 = input()
s2 = input()

mod = 10**9+7

if s1[0] == s2[0]:
    ans = 3
    bfr = 'T'
    idx = 1
else:
    ans = 6
    bfr = 'Y'
    idx = 2

if n == 1:
    print(ans)
    exit()

while idx <= n-1:
    if s1[idx] == s2[idx]:
        if bfr == 'T':
            ans *= 2
            ans %= mod
        idx += 1
        bfr = 'T'
    else:
        if bfr == 'T':
            ans *= 2
            ans %= mod
        else:
            ans *= 3
            ans %= mod
        idx += 2
        bfr = 'Y'
        
print(ans%mod)

Problem: p03626
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s1 = input()
s2 = input()
cnt = 1
i = 0
while i <= n-1:
    if i == 0:
        if s1[i] == s2[i]:
            cnt *= 3
            s = 0
        else:
            cnt *= 6
            i += 1
            s = 1
    elif s1[i] == s2[i]:
        if s == 0:
            cnt *= 2
        else:
            cnt *= 1
        s = 0
    else:
        if s == 0:
            cnt *= 2
        else:
            cnt *= 3
        s = 1
        i += 1
    i += 1
print(cnt)

Failing test case input:
52
RvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn
RLLwwdWIxxNNQUUXXUVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn

Expected output:
958681902


Actual output:
30958682112


Fixed submission (verdict: Accepted):
n = int(input())
s1 = input()
s2 = input()
cnt = 1
i = 0
while i <= n-1:
    if i == 0:
        if s1[i] == s2[i]:
            cnt *= 3
            s = 0
        else:
            cnt *= 6
            i += 1
            s = 1
    elif s1[i] == s2[i]:
        if s == 0:
            cnt *= 2
        else:
            cnt *= 1
        s = 0
    else:
        if s == 0:
            cnt *= 2
        else:
            cnt *= 3
        s = 1
        i += 1
    i += 1
print(cnt % (10**9+7))
Problem: p03626
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s1 = input()
s2 = input()
cnt = 1
i = 0
while i < n-1:
    if i == 0:
        if s1[i] == s2[i]:
            cnt *= 3
            s = 0
        else:
            cnt *= 6
            i += 1
            s = 1
    elif s1[i] == s2[i]:
        if s == 0:
            cnt *= 2
        else:
            cnt *= 1
        s = 0
    else:
        if s == 0:
            cnt *= 2
        else:
            cnt *= 3
        s = 1
        i += 1
    i += 1
print(cnt)

Failing test case input:
1
\
\

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
s1 = input()
s2 = input()
cnt = 1
i = 0
while i <= n-1:
    if i == 0:
        if s1[i] == s2[i]:
            cnt *= 3
            s = 0
        else:
            cnt *= 6
            i += 1
            s = 1
    elif s1[i] == s2[i]:
        if s == 0:
            cnt *= 2
        else:
            cnt *= 1
        s = 0
    else:
        if s == 0:
            cnt *= 2
        else:
            cnt *= 3
        s = 1
        i += 1
    i += 1
print(cnt % (10**9+7))

Problem: p03626
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s1=input()
s2=input()
if n==1:
    print(3)
    exit()
s=""
i=0
while i<n:
    if s1[i]==s2[i]:
        s+="1"
        i+=1
    else:
        s+="2"
        i+=2
ans=0
if s[0]=="1":
    ans+=3
else:
    ans+=6
before=s[0]
for j in range(1,len(s)):
    if before=="1":
        if s[j]=="1":
            ans*=2
        else:
            ans*=2
    else:
        if s[j]=="2":
            ans*=3
    before=s[j]
print(ans%(10**7+9))


Failing test case input:
52
RvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn
RLLwwdWIxxNNQUUXXUVMMooBBaggDKqcimmeYrhAljOOTTJuuzzn

Expected output:
958681902


Actual output:
8654257


Fixed submission (verdict: Accepted):
n=int(input())
s1=input()
s2=input()
if n==1:
    print(3)
    exit()
s=""
i=0
while i<n:
    if s1[i]==s2[i]:
        s+="1"
        i+=1
    else:
        s+="2"
        i+=2
ans=0
if s[0]=="1":
    ans+=3
else:
    ans+=6
before=s[0]
for j in range(1,len(s)):
    if before=="1":
        if s[j]=="1":
            ans*=2
        else:
            ans*=2
    else:
        if s[j]=="2":
            ans*=3
    before=s[j]
print(ans%(10**9+7))
Problem: p03626
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s1=input()
s2=input()
x=[]
f=0
for i in range(n):
    if f==1:
        f=0
    else:
        if s1[i]==s2[i]:
            x.append(0)
        else:
            x.append(1)
            f=1
l=len(x)

if l==1:
    if x[0]==0:
        print(3)
    else:
        print(9)
else:
    if x[0]==0:
        c=3
    else:
        c=6
    for i in range(1,l):
        
        if x[i-1]==0:
            c*=2
        else:
            if x[i]==1:
                c*=3
        c%=1000000007
    if x==[0]*l:
        c+=3
    if x==[1]*l:
        c+=3

    print(c%1000000007)


Failing test case input:
3
bab
bab

Expected output:
12


Actual output:
15


Fixed submission (verdict: Accepted):
n=int(input())
s1=input()
s2=input()
x=[]
f=0
for i in range(n):
    if f==1:
        f=0
    else:
        if s1[i]==s2[i]:
            x.append(0)
        else:
            x.append(1)
            f=1
l=len(x)

if l==1:
    if x[0]==0:
        print(3)
    else:
        print(6)
else:
    if x[0]==0:
        c=3
    else:
        c=6
    for i in range(1,l):
        
        if x[i-1]==0:
            c*=2
        else:
            if x[i]==1:
                c*=3
        c%=1000000007

    print(c%1000000007)

Problem: p03626
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
DIV=10**9+7
N=int(input())
ST=[input(), input()]
PST=[]
ptr=0
while ptr < N:
    
    if ST[0][ptr] == ST[1][ptr]:
        ptr += 1
        PST.append(0)
    
    else:
        ptr += 2
        PST.append(1)



res = 3
for i in range(len(PST)-1):
    if PST[i] == 0 and PST[i+1] == 0:
        res = (res*2)%DIV
    elif PST[i] == 0 and PST[i+1] == 1:
        res = (res*2)%DIV
    elif PST[i] == 1 and PST[i+1] == 0:
        res = res
    elif PST[i] == 1 and PST[i+1] == 1:
        res = (res*3)%DIV

print(res)


Failing test case input:
3
aab
dcb

Expected output:
6


Actual output:
3


Fixed submission (verdict: Accepted):
DIV=10**9+7
N=int(input())
ST=[input(), input()]
PST=[]
ptr=0
while ptr < N:
    
    if ST[0][ptr] == ST[1][ptr]:
        ptr += 1
        PST.append(0)
    
    else:
        ptr += 2
        PST.append(1)



res = 3 if PST[0] == 0 else 6
for i in range(len(PST)-1):
    if PST[i] == 0 and PST[i+1] == 0:
        res = (res*2)%DIV
    elif PST[i] == 0 and PST[i+1] == 1:
        res = (res*2)%DIV
    elif PST[i] == 1 and PST[i+1] == 0:
        res = res
    elif PST[i] == 1 and PST[i+1] == 1:
        res = (res*3)%DIV

print(res)
Problem: p03626
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
s1 = str(input())
s2 = str(input())
if s1[0] == s2[0]:
  c = 3
  state = True
  i = 1
else:
  c = 6
  state = False
  i = 2
while i < n:
  if s1[i] == s2[i]:
    i += 1
    if state:
      c *= 2
    else:
      state = True
  else:
    i += 2
    if state:
      c *= 2
      state = False
    else:
      c *= 3
print(c)
  
  

Failing test case input:
52
RvvttdWIyyPPQFFZZssffEEkkaSSDKqcibbeYrhAljCCGGJppHHn
RLLwwdWIxxNNQUUXXVVMLooCBaggDKqcinmeYrhAljOOTTJuuzzn

Expected output:
958681902


Actual output:
30958682112


Fixed submission (verdict: Accepted):
n = int(input())
s1 = str(input())
s2 = str(input())
mod = 10**9+7
if s1[0] == s2[0]:
  c = 3
  state = True
  i = 1
else:
  c = 6
  state = False
  i = 2
while i < n:
  if s1[i] == s2[i]:
    i += 1
    if state:
      c *= 2
    else:
      state = True
  else:
    i += 2
    if state:
      c *= 2
      state = False
    else:
      c *= 3
print(c%(mod))

Problem: p03626
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
s1 = input()
s2 = input()

MOD = int(1e9) + 7

tate = "tate"
yoko = "yoko"

i = 0
ans = 0
pre = ""
if s1[i] == s2[i]:
    ans = 3
    i += 1
    pre = tate
else:
    ans = 6
    i += 2
    pre = yoko

while i < N:
    if s1[i] == s2[i]:
        if pre == tate:
            ans *= 2
        elif pre == yoko:
            ans *= 1
        i += 1
        pre = tate
    else:
        if pre == tate:
            ans *= 2
        elif pre == yoko:
            ans *= 2
        i += 2
        pre = yoko
    ans %= MOD
print(ans)


Failing test case input:
52
nHHppJGGCCjlAhrYebbicqKDSSakkEEffssZZFFQPPyyIWdttvvR
nzzuuJTTOOjlAhrYemmicqKDggaBBooMMVVXXUUQNNxxIWdwwLLR

Expected output:
958681902


Actual output:
805306368


Fixed submission (verdict: Accepted):
N = int(input())
s1 = input()
s2 = input()

MOD = int(1e9) + 7

tate = "tate"
yoko = "yoko"

i = 0
ans = 0
pre = ""
if s1[i] == s2[i]:
    ans = 3
    i += 1
    pre = tate
else:
    ans = 6
    i += 2
    pre = yoko

while i < N:
    if s1[i] == s2[i]:
        if pre == tate:
            ans *= 2
        elif pre == yoko:
            ans *= 1
        i += 1
        pre = tate
    else:
        if pre == tate:
            ans *= 2
        elif pre == yoko:
            ans *= 3
        i += 2
        pre = yoko
    ans %= MOD
print(ans)
Problem: p03760
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import sys




read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

O, E = read().decode('utf8').split()
ans = [i+j for i, j in zip(O, E)]

print(''.join(ans))


Failing test case input:
tsgteocrennieabrmdoctf
atcoaerqeguldrcnntest

Expected output:
tastgctoeaoecrrqeengnuiledarbcrnmndtoecsttf


Actual output:
tastgctoeaoecrrqeengnuiledarbcrnmndtoecstt


Fixed submission (verdict: Accepted):


import sys




read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

O, E = read().decode('utf8').split()

ans = ''
for i, j in zip(O, E):
    ans += i + j

if len(O) > len(E):
    ans += O[-1]

print(ans)

Problem: p03760
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = input(); b = input(); "".join(map("".join, zip(a, b))) + (a[-1] if len(a) is not len(b) else "")

Failing test case input:
atcoderbeeinnercontgst
atcoaerreguldrcontest

Expected output:
aattccoodaeerrbreeegiunlnderrccoonnttegsstt


Actual output:
no output


Fixed submission (verdict: Accepted):
a = input(); b = input(); print("".join(map("".join, zip(a, b))) + (a[-1] if len(a) is not len(b) else ""))

Problem: p03760
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
O = input()
E = input()
print(*[o+e for o,e in zip(O,E)], sep="")


Failing test case input:
bsoteetrengienbrmdpcta
dsennrcatlugequcaoste

Expected output:
bdssoetnenertcraetnlguigeenqburcmadopscttea


Actual output:
bdssoetnenertcraetnlguigeenqburcmadopsctte


Fixed submission (verdict: Accepted):
O = list(input())
E = list(input())+['']
print(*[o+e for o,e in zip(O,E)], sep="")

Problem: p03760
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


o = list(input())
e = list(input())

if len(o) == len(e):
    for i in range(len(o) - 1):
        print(o[i], end = '')
        print(e[i], end = '')
    print(o[len(o) - 1], end = '')
    print(e[len(e) - 1])

for i in range(min(len(o), len(e))):
    print(o[i], end = '')
    print(e[i], end = '')
if len(e) > len(o):
    print(e[len(e) - 1])
if len(o) < len(e):
    print(o[len(o) - 1])


Failing test case input:
xyy
acd

Expected output:
xaycyd


Actual output:
xaycyd
xaycyd

Fixed submission (verdict: Accepted):

o = list(input())
e = list(input())

len_o = len(o)
len_e = len(e)

if len_o == len_e:
    for i in range(len_o - 1):
        print(o[i], end = '')
        print(e[i], end = '')
    print(o[len_o - 1], end = '')
    print(e[len_e - 1])

else:
    for i in range(min(len_o, len_e)):
        print(o[i], end = '')
        print(e[i], end = '')
    if len_e > len_o:
        print(e[len(e) - 1])
    if len_o > len_e:
        print(o[len(o) - 1])
Problem: p03760
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

O = list(input())
E = list(input())
for o, e in zip(O, E):
    sys.stdout.write(o + e)
if len(O) - len(E) == 1:
    sys.stdout.write(E[-1])
print()


Failing test case input:
bsotheureqdjenbrmdpcta
etsoacgqfuuluacrnoesd

Expected output:
bestostohaecugrqefqudujleunabcrrmndopecstda


Actual output:
bestostohaecugrqefqudujleunabcrrmndopecstdd


Fixed submission (verdict: Accepted):
import sys

O = list(input())
E = list(input())
if len(O) - len(E) == 1:
    E.append('')
for o, e in zip(O, E):
    sys.stdout.write(o + e)
print()

Problem: p03760
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
o = list(input())
e = list(input())
for (x,y) in zip(o,e) :print(x+y,end = "")

Failing test case input:
atcoderbeeinnercontgst
atcoderregularcontest

Expected output:
aattccooddeerrbreeegiunlnaerrccoonnttegsstt


Actual output:
aattccooddeerrbreeegiunlnaerrccoonnttegsst

Fixed submission (verdict: Accepted):
o = list(input())
e = list(input()) +[""] 
for x,y in zip(o,e) :print(x+y,end = "")

Problem: p03760
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
odd = input()
even =input()
odd_list = []
even_list = []

for (a,b) in zip(odd,even):
    odd_list.append(a)
    even_list.append(b)
even_list.append("")

for i in range(len(odd_list)):
    print(odd_list[i],end = "")
    print(even_list[i],end = "")


Failing test case input:
bsotheureqdjenbrmdpcta
etsoacgqfuuluacrnoesd

Expected output:
bestostohaecugrqefqudujleunabcrrmndopecstda


Actual output:
bestostohaecugrqefqudujleunabcrrmndopecstd

Fixed submission (verdict: Accepted):
odd = input()
even =input()
odd_list = []
even_list = []

for i in odd:
    odd_list.append(i)
for j in even:
    even_list.append(j)
even_list.append("")

for i in range(len(odd_list)):
    print(odd_list[i],end = "")
    print(even_list[i],end = "")

Problem: p03760
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
o = input()
e = input()
for i,a in enumerate(o):
    for j,b in enumerate(e):
        if(i == j):
            print(a + b, end = '')
    if i == len(o) - 1:
        print(a)


Failing test case input:
xx{
dac

Expected output:
xdxa{c


Actual output:
xdxa{c{


Fixed submission (verdict: Accepted):
o = input()
e = input()
for i,a in enumerate(o):
    for j,b in enumerate(e):
        if(i == j):
            print(a + b, end = '')
    if len(o) > len(e) and i == len(o) - 1:
        print(a)

Problem: p03760
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
o = input()
e = input()
print("".join([ch1 + ch2 for ch1 , ch2 in zip(o,e)]))

Failing test case input:
bsothetrepejenbrmdpcta
etsoacuqfguluacrnnesd

Expected output:
bestostohaecturqefpgeujleunabcrrmndnpecstda


Actual output:
bestostohaecturqefpgeujleunabcrrmndnpecstd


Fixed submission (verdict: Accepted):
o = input()
e = input()
if(len(o)>len(e)): e+=' '
print("".join([ch1 + ch2 for ch1 , ch2 in zip(o,e)]))