Problem:


Score : 100 points

Problem Statement

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.

Constraints

Each character of S is A or B.

|S| = 3

Input

Input is given from Standard Input in the following format:

S

Output

If there is a pair of stations that will be connected by a bus service, print Yes; otherwise, print No.

Sample Input 1

ABA

Sample Output 1

Yes

Company A operates Station 1 and 3, while Company B operates Station 2.

There will be a bus service between Station 1 and 2, and between Station 2 and 3, so print Yes.

Sample Input 2

BBA

Sample Output 2

Yes

Company B operates Station 1 and 2, while Company A operates Station 3.

There will be a bus service between Station 1 and 3, and between Station 2 and 3, so print Yes.

Sample Input 3

BBB

Sample Output 3

No

Company B operates all the stations. Thus, there will be no bus service, so print No.



Sample input:
ABA


Sample output:
Yes

Submission status: Runtime Error

Solution code:
s = str(input())
Q = int(input())
front = 1
for i in range(Q):
    q = list(map(str, input().split()))
    if q[0] == "1":
        front *= -1
    else:
        if q[1] == "1":
            if front == 1:
                s = q[2] + s
            else:
                s = s + q[2]             
        else:
            if front == 1:
                s = s + q[2]
            else:
                s = q[2] + s

if front == -1:
    s = s[::-1]
print(s)

Submission status: Runtime Error

Solution code:
S = input().split()

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

Submission status: Runtime Error

Solution code:
S = list(input())
if S[0］== S[1] == S[2]:
     print("No")
else:
     print("Yes")

Submission status: Runtime Error

Solution code:
n=input()
if  all(n=='A' or n=='B'):
  print('No')
else :
  print('Yes')

Submission status: Runtime Error

Solution code:
s = input()

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# ABC158 B - Count Balls

M,A,B = map(int,input().split())
import math
C = math.floor(M/(A+B))
N = M%(A+B)
E = C*A

if N >= A:
    E+=A
else:
    E+=N
print(E)

Submission status: Runtime Error

Solution code:
import sys
S = input()

if not ( len(S) == 3 and ( "A" in S or "B" in S)): sys.exit()

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

Submission status: Runtime Error

Solution code:
from collections import deque

s = deque(list(input()))

q = int(input())

reverse = 0

for i in range(q):
  query = list(input().split())
  if query[0] == '1':
    reverse ^= 1
    continue
  else:
    if query[1] == '1':
      if reverse:
        s.append(query[2])
      else:
        s.appendleft(query[2])
    else:
      if reverse:
        s.appendleft(query[2])
      else:
        s.append(query[2])
if reverse:
  print(''.join(s)[::-1])
else:
  print(''.join(s))

Submission status: Runtime Error

Solution code:
s = input()
sgn = 1
Q = int(input())
ans = []
for _ in range(Q):
  i = input()
  if i[0] == '1':
    sgn*=-1
  else:
    if i[2] == '1':
      ans.append([i[4], -sgn])
    else:
      ans.append([i[4], sgn])

if sgn == -1:
  s = s[::-1]
  for k in range(len(ans)):
    if ans[k][1] == -1:
      s = s + ans[k][0]
    else:
      s = ans[k][0] + s
else:
  for k in range(len(ans)):
    if ans[k][1] == 1:
      s = s + ans[k][0]
    else:
      s = ans[k][0] + s

print(s)

Submission status: Runtime Error

Solution code:
word = input()
a,b = 0

for i in word:
    if i == "A":
        a=a+1
    elif i == "B":
        b=b+1

if a==0 or b==0:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = inpit()

ans = 'Yes'

if (S == 'AAA') or (S=='BBB'):
  ans = 'No'
  
print(ans)

Submission status: Runtime Error

Solution code:
flg = len(set(input())) == 1:
print('Yes' if flg else 'No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,a,b=map(int,input().split())
lis=""
ans=0
for i in range(n):
 for b in range(a):
  ans+=1
print(ans)

Submission status: Runtime Error

Solution code:
s = input()

if s[1]==s[2]==s[3]:
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
print('Yes' if S != 'AAA' and S != 'BBB' else 'No')

Submission status: Runtime Error

Solution code:
S = input()

if "A" in S and "B" in S:
  prnt("Yes")
else:
  ptint("No")

Submission status: Runtime Error

Solution code:
s=input()
if s[1]==s[2] and s[2]==s[3]:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
am=a*(100/8)

bm=b*(100/10)

x=[]
for i in range(101):
    if am<=i and bm<=i:
        x.append(i)
    else:
        pass
if len(x)==0:
    print('-1')
else:
    print(x[0])

Submission status: Runtime Error

Solution code:
s = input()
q = int(input())
query = [list(input().replace(' ','')) for _ in range(q)]

r = False
for i in range(q):
    if r:
        if len(query[i]) == 1:
            r = False
        elif query[i][1] == '1':
            s = s + query[i][2]
        else:
            s = query[i][2] + s
    else:
        if len(query[i]) == 1:
            r = True
        elif query[i][1] == '1':
            s = query[i][2] + s
        else:
            s = s + query[i][2]

if r:
    print(s[::-1])
else:
    print(s)

Submission status: Runtime Error

Solution code:
s = input()
ans = 'Yes'

if(s == 'AAA' || s == 'BBB'):
    ans = 'No'

print(ans)

Submission status: Runtime Error

Solution code:
N,A,B=map(int,input().split())

cnt_blue = 0
total = 0

while(True):
    cnt_blue += A
    total += A
    if N <= total:
        cnt_blue = cnt_blue - (total - N)
        break 
    total += B
    if N <= total: break
print(cnt_blue)

Submission status: Runtime Error

Solution code:
N,A,B=map(int,input().split())

cnt_blue = 0
# cnt_red = 0
total = 0

while(True):
    cnt_blue += A
    total += A
    if N <= total:
        cnt_blue = cnt_blue - (total - N)
        break 
#     cnt_red += B
    total += B
    if N <= total:
#         cnt_red = cnt_red - (total - N)
        break
print(cnt_blue)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
x=10*b

import math
for i in range(10):
    if math.floor((x+i)*0.08)==a:
        print(x+i)
        exit(0)

print(-1)

Submission status: Runtime Error

Solution code:
a,b,c = input().split()

if a == b and a == c:
  print('No')
else:
  print('Yes)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()
s.sort()
if s[0] != s[1] or s[1] != s[2]:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()

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

Submission status: Runtime Error

Solution code:
n,a,b = map(int,input().split())
box = ''
for i in range(n//(a+b)+1):
  box += ('b' * a)
  box += ('r' * b)
print(len([i for i in box[0:n] if i == 'b']))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <stdio.h>

int main() {
    S = input()
    if S[0] == S[1] and S[1] == S[2]:
    print('No')
    else:
    print('Yes')
    
    
    
    
	return 0;
}

Submission status: Runtime Error

Solution code:
s=set(input().split(''))
if len(s)==2:print('Yes')
else:print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

n, a, b = map(int, input().split())

num1 = n // (a + b) * a
num2 = n % (a + b)

if num2 < a:
    print(num1 + num2)
else:
    print(num1)

Submission status: Runtime Error

Solution code:
a, b, c = input().split()

if a == b and b== c and a==c:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())

C = A / 0.08
D = B / 0.1

if int(C * 0.1) == B:
    if int(D * 0.08) == A:
        print(min(int(C),int(D)))
    else:
        print(int(C))
elif int(D * 0.08) == A:
    print(int(D))
else:
    print(-1)

Submission status: Runtime Error

Solution code:
S = input()
sort(S)
a = 'Yes'
if S[0] == S[-1]:
  a = 'No'
print(a)

Submission status: Runtime Error

Solution code:
string = list(input())
inp = string
n = int(input())
flag = 1
for i in range(n):
    j = input().split()
    if len(j) == 3 and j[1] == "1" and flag == 1:
        inp.insert(0,j[2])
    elif len(j) == 3 and j[1] == "2" and flag == 1:
        inp.append(j[2])
    elif len(j) == 3 and j[1] == "2" and flag == -1:
        inp.insert(0,j[2])
    elif len(j) == 3 and j[1] == "1" and flag == -1:
        inp.append(j[2])
    else:
        flag *= -1
if flag == -1:
    inp = inp[::-1]
s = ""
for j in inp:
    s = s + j
print(s)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S=list(input())
#print(S)
q=int(input())
x=0
appends=[[] for i in range(2)]
for i in range(q):
    s=list(input().split())
    if int(s[0])==1:
        x+=1
    else:
        appends[(x+int(s[1])+1)%2].append(s[2])
        #print(appends)
if  x%2==1:
    S=S[::-1]
S=appends[x%2][::-1]+S+appends[(x+1)%2]
#print(S)
for k in S:
    print(k,end='')

Submission status: Runtime Error

Solution code:
N = input()
if N in A and N in B:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
s = input()
print('Yes' if len(set(s)==2 else 'No')

Submission status: Runtime Error

Solution code:
S = input()
ans = 'Yes'
if S = 'AAA' or S = 'BBB':
  ans = 'No'
print(ans)

Submission status: Runtime Error

Solution code:
s = int(input())

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

Submission status: Runtime Error

Solution code:
s = input()
q = int(input())
for i in range(q):
    query = list(map(str, input().split()))
    if len(query) == 1:
        s = s[::-1]
    else:
        if int(query[1]) == 1:
            s = query[2] + s
        else:
            s = s + query[2]
print(s)

Submission status: Runtime Error

Solution code:
def actual(n, a, b):
    n_op_least = n // (a + b)

    n_blue_least = a * n_op_least
    adjustment = min(n % (a + b), a)

    return n_blue_least + adjustment

n, a, b = map(int, input().split())
print(actual(n, a, b))

Submission status: Runtime Error

Solution code:
import math


def actual(n, a, b):
    _少なくとも必要な操作回数_もしかすると1回足りない = n // (a + b)
    _少なくとも存在する青ボールの数 = a * _少なくとも必要な操作回数_もしかすると1回足りない

    # 操作回数が足りている == 余り0 => 0 だし
    # 操作回数が不足している => 1回だけ追加で操作をすれば良いので、 a追加

    _端数 = min(n % (a + b), a)

    return _少なくとも存在する青ボールの数 + _端数

n, a, b = map(int, input().split())
print(actual(n, a, b))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from collections import defaultdict
N, P = map(int,input().split())
S = input()

if P==5:
    ans = 0
    for i,m in enumerate(S):
        if m == '5' or m == '0':
            ans += i+1
elif P==2:
    ans = 0
    for i,m in enumerate(S):
        if int(m) % 2 ==0:
            ans += i+1
else:
    #primdic = defaultdict(int)
    primdic = [0]*N
    for i in range(N):
        # i~右端までの数字のmodP
        primdic[int(S[i:])%P] += 1
    primdic[0] += 1
    ans = 0
    #for value in primdic.values():
    #    ans += value*(value-1)//2
    for value in primdic:
        ans += value*(value-1)//2
print(ans)

Submission status: Runtime Error

Solution code:
a,b=list(map(float,input().split()))
import sys
for i in range(100000):
  if int(i*8/100)==a and int(i*10/100)==b:
    print(i)
    sys.exit()
print(-1)

Submission status: Runtime Error

Solution code:
s=list(input())
if (A not in s) or (B not in s):
  print("No")
else:
  print("Yse")

Submission status: Runtime Error

Solution code:
s = input()
if s[0] == s[1] and a[1] == a[2]:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
S = input()
print('Yes' len(set(S)) == 2 else 'No')

Submission status: Runtime Error

Solution code:
a,b =map(int,input().split())
for i in range(1,1002):
    if a == int(i*0.08) and b == int(i*0.1):
        print(i)
        break
else:
    print(-1)

Submission status: Runtime Error

Solution code:
S=input()

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

Submission status: Runtime Error

Solution code:
s = input()
if s == 'AAA' and S == 'BBB':
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
s = input()
if s[1]!=s[2] and s[2]!=s[3]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
s = input()
if not s[1]==s[2]==s[3]:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
s = input()
if not s[1]==s[2] and s[2]==s[3]:
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
s = input()
if not s[1]==s[2]==s[3]:
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,a,b=map(int,input().split())
w='z'*a+'x'*b
f=''
for i in range(1000):
    f+=w
    d=f[:n]
print(d.count('z'))

Submission status: Runtime Error

Solution code:
n = str(input())

c = 0
d = 0
for i in n:
  if i == A:
    c = c + 1
  if i == B:
    d = d + 1

if c == 3:
  print("No")
else:
  print("Yes")

if d == 3:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
ans = -1

for i in range(1,10**4+1):
    if int(i * 0.08) == A and int(i * 0.10) == B:
        ans = i
        break
print(ans)

Submission status: Runtime Error

Solution code:
s = input()

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

Submission status: Runtime Error

Solution code:
a = input()
if a = 'AAA' or b = 'BBB':
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
a = list(map(int,input().split()))
N = a[0]
blue = a[1]
red = a[2]
ans = 0
A = blue + red
X = N // A
Y = N % A
if Y <= blue:
    ans = blue * X + Y
else:
    ans = blue * X + blue
print(ans)

Submission status: Runtime Error

Solution code:
N,A,B = map(int, input().split())
ans = 0
S = A+B
T = N//S
U = N%S


if(A == 0):
    ans = 0
else :
    if(0< U < A):
        ans = A*T+U
    elif(U == 0):
        ans = A*T
    elif(U >= A):
        ans = A*T+A
    
print(ans)

Submission status: Runtime Error

Solution code:
s=input()
q=int(input()) 

cnt = [0]*(q+5)
arr=[]
l=0
r=0

for i in range(q):
    t=input().split()
    if t[0]=='1':
        r+=1
        cnt[0]+=1 
        cnt[l]-=1 
    else:
        arr.append([t[2],int(t[1])])
        l+=1 
if r%2==1:
    s=s[::-1]
sm=0
for i in range(len(arr)):
    sm+=cnt[i]
    if sm%2==1:
        if arr[i][1]==1:arr[i][1]=2
        elif arr[i][1]==2:arr[i][1]=1 
ans1=""
ans2=""
for i in range(len(arr)):
    if arr[i][1]==1:
        ans1+=arr[i][0]

    else:ans2+=arr[i][0]
print("%s%s%s"%(ans1[::-1],s,ans2))

Submission status: Runtime Error

Solution code:
H, W = map(int, input().split())
h, w = map(int, input().split())
print((H-h)*(W-w))

Submission status: Runtime Error

Solution code:
n=input()
if A in n and B in n:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
print "Yes" if len(set(list(raw_input())) ==2  else "No"

Submission status: Runtime Error

Solution code:

S = input()

pritn("Yes" if S.count("A")==2 and S.count("B")==2 else "No")

Submission status: Runtime Error

Solution code:

S = input()

pritn("Yes" if S.count(A)==2 and S.count(B)==2 else "No")

Submission status: Runtime Error

Solution code:
s=input()
q=int(input())
dir=True
ans=s
query=[]
for i in range(q):
  temp=input()
  if temp[0] == "1":
    dir = dir ^ True
  if temp[0] == "2":
    t,f,c = temp.split()

    if (f == "1" and dir) or (f=="2" and not dir):
      ans=c+ans
    else:
      ans=ans+c
def reverse(s):
  t=""
  for i in range(len(s)-1,-1,-1):
    t+=s[i]
  return t

if dir:
  print(ans)
else:
  print(reverse(ans))

Submission status: Runtime Error

Solution code:
S_1,S_2,S_3 = input().split()
if S_1 == S_2 && S_2 == S_3:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
s=input()
if s==AAA,s==BBB:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
S_1,S_2,S_3 = input().split()
if s_1 == s_2 && s_2 == s_3:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
s_1,s_2,s_3 = input().split()
if s_1 == s_2 && s_2 == s_3:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
s_1,s_2,s_3 = input().split()
if s_1 == s_2 == s_3:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
s=input().split()
if s[0] != s[1] or s[1] != s[2]:
    print("Yes)
else:
    print("No)

Submission status: Runtime Error

Solution code:
s=list(input())
if s[0] != s[1] or s[1] != s[2]:
  print("Yes)
else:
        print("No)

Submission status: Runtime Error

Solution code:
s, _, q = open(0)
g = ""
for q in q:
  p, f, c = q.split()
  if p == "1":
    g, s = s, g
  else:
    if f == "1":
      g += c
    else:
      s += c
print(g[::-1] + s)

Submission status: Runtime Error

Solution code:
import sys
import math
input = sys.stdin.readline


def main():
    A, B = map(int, input().split())
    assert A <= 100
    assert B <= 100
    for i in range(1000):
        if math.floor((i+1) * 0.08) == A and math.floor((i+1) * 0.1) == B:
            print(i+1)
            exit()
    print("-1")


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys
import math
input = sys.stdin.readline


def main():
    A, B = map(int, input().split())
    for i in range(10000):
        if math.floor((i+1) * 0.08) == A and math.floor((i+1) * 0.1) == B:
            print(i+1)
            exit()
    print("-1")


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n, a, b = map(int, input().split())

NumberOfRotations = int(n/(a+b))
surplus = n%(a+b)

ans = 0

if NumberOfRotations == 0:
    if a > n:
        print(surplus)
        exit
    else:
        print(a)
        exit

ans = a*NumberOfRotations
if a > n - ((a+b)*NumberOfRotations):
    print(ans+surplus)
else:
    print(ans+a)

Submission status: Runtime Error

Solution code:
n, a, b = map(int, input().split())

NumberOfRotations = int(n/(a+b))
surplus = n%(a+b)

ans = 0

if NumberOfRotations == 0:
    if a > n:
        print(surplus)
    else:
        print(a)
else:
    ans = a*NumberOfRotations
    if a > n - ((a+b)*NumberOfRotations):
        print(ans+surplus)
    else:
        print(ans+a)

Submission status: Runtime Error

Solution code:
s = input()

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

Submission status: Runtime Error

Solution code:
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s = input()

if("A" not in s):
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s = input()

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

Submission status: Runtime Error

Solution code:
s=input()
if s="AAA"or s="AAB"or s="ABA"or s="ABB"or s="BBA"or s="BAB"or s="BBA":
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s=input()
if s="AAA","AAB","ABA","ABB","BBA","BAB","BBA":
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
a = float(a)
b = float(b)
for i in range(-7000, 7000):
	if float(i) * 0.08 == a and float(i) * 0.1 == b:
		print(i)
		exit(0)
print(-1)

Submission status: Runtime Error

Solution code:
s = input()
q = int(input())

rev = 0
head = []
tail = []

for i in range(q):
    t = input().split()
    if t[0] == "1":
        rev ^= 1
    else:
        if (int(t[1])-1)^rev == 0:
            head.append(t[2])
        else:
            tail.append(t[2])

h = "".join(head)
t = "".join(tail)

if rev == 0:
    s = s[::-1]
    print(h[::-1] + s + t)
else:
    print(t[::-1] + s + h)

Submission status: Runtime Error

Solution code:
s=input()

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

Submission status: Runtime Error

Solution code:
n, a, b = map(int, input().split())

ans = n // (a + b)
ans *= a

if n % (a + b) != 0:
    ans += min(a, n % (a + b))

print(ans)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3

def main():
    A, B = map(int, open(0).read().split())

    ans_A = []
    for i in range(int(12.5 * A), int(12.5 * A + 12.5 + 1)):
        ans_A.append(i)
    ans_B = []
    for i in range(int(10*B), int(10*B + 10 + 1)):
        ans_B.append(i)
    ans = set(ans_A) & set(ans_B)
    if len(ans) == 0:
        print(-1)
    else:
        print(min(list(ans)))


main()

Submission status: Runtime Error

Solution code:
S = input()
i = 0
for i in range(len(S))
    if S[i] != S[i+1]:
      print('Yes)
    else:
      print('No')

Submission status: Runtime Error

Solution code:
s = map(int, input().sprit)

for i in range(len(s)):
    if s[i] in s:
        print('Yes')
        break
    else: 
        print('No')

Submission status: Runtime Error

Solution code:
from collections import deque

s = list(input())
q = int(input())

count = 0
l = []
for i in range(q):
	tmp = list(map(str,input().split()))
	if len(tmp) == 1:
		count += 1
		for j in range(len(l)):
			l[j][0] += 1
	elif tmp[1] == '1':
		l.append([1, tmp[2]])
	elif tmp[1] == '2':
		l.append([2, tmp[2]])

for i in range(len(l)):
	l[i][0] %= 2

if count % 2 == 1:
	s = s[::-1]
s = deque(s)

for i in range(len(l)):
	if l[i][0] == 0:
		s.append(l[i][1])
	else:
		s.appendleft(l[i][1])
print("".join(s))

Submission status: Runtime Error

Solution code:
n,a,b = map(int, input().split())

if n == 0:
    print(0)
elif a == 0:
    print(0)
elif b == 0:
    print(n)
elif a >= n:
    print(n)
elif a+b > n > a:
    print(a)
else:
    q,mod = divmod(n, a+b)
    print(q*a + mod)

Submission status: Runtime Error

Solution code:
N, P = map(int, input().split())
S = input()

l = len(S)
if P == 2:
    ans = 0
    for i in range(l):
        if int(S[i])%2 == 0:
            ans += i+1
elif P == 5:
    ans = 0
    for i in range(l):
        if int(S[i])%5 == 0:
            ans += i+1
else:
    data = [0]*P
    temp = 0
    for i in range(l-1, -1, -1):
        temp += int(S[i])*10**i
        temp %= P
        data[temp] += 1
    ans = data[0]
    for item in data:
        if item > 1:
            ans += item*(item-1)//2

print(ans)

Submission status: Runtime Error

Solution code:
print('Yes' if "A" in input() and "B" in input() else "No")

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
flag = 0
for i in range(2000):
    x = (i * 8) // 100
    y = (i*10)//100
    if(x == A & y == B):
        print(i)
        flag = 1
        break
if(flag == 0):
    print('-1')

Submission status: Runtime Error

Solution code:
print(["Yes","No"][input()=="BBB"or"AAA"])

Submission status: Runtime Error

Solution code:
N, A, B = map(int, input().split())
ans = n // (A + B) * A
#余り
r = n % (A+B)
ans += min(A, r)
print(ans)

Submission status: Runtime Error

Solution code:
n, A, B = map(int, input().split())
ans = n // (A + B) * A
r = n % (A+B)
ans += min(A,r)
print(ans)

Submission status: Runtime Error

Solution code:
n, A, B = map(int, input().split())
ans = n // (A + B) * A
#余り
r = n % (A + B)
ans += min(A, r)
print(ans)

Submission status: Runtime Error

Solution code:
n, A, B = map(int, input().split())
ans = n // (A + B) * A
#余り
r = n % (A + B)
ans += min(ans, r)
print(ans)

Submission status: Runtime Error

Solution code:
s = input()

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

Submission status: Runtime Error

Solution code:
S = input()
Q = int(input())

reverse = False
cnt = 0
for i in range(Q):
    inp = input().split()
    if len(inp) == 1:
        cnt += 1
        reverse = (cnt % 2 != 0)
        #S = S[::-1]
    else:
        f, c = inp[1:]
        if int(f) == 1:
            if reverse:
                S = S + c
            else:
                S = c + S
        else:
            if reverse:
                S = c + S
            else:
                S = S + c
print(S[::-1] if reverse else S)

Submission status: Runtime Error

Solution code:
S = input()
Q = int(input())
for i in range(Q):
    inp = input().split()
    if len(inp) == 1:
        S = S[::-1]
    else:
        f, c = inp[1:]
        if int(f) == 1:
            S = c + S
        else:
            S = S + c
print(S)

Submission status: Runtime Error

Solution code:
s = str(input())
if s="AAA" or s="BBB":
  print("No")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import sys
n, a, b = map(int, sys.stdin.readline().split())
balls = n // (a+b) * a
if n % (a+b) <= a:
  balls += n % (a+b)
else:
  balls += a
print(balls)

Submission status: Runtime Error

Solution code:
A,B = map(int,input().split())
import math
q = 0
for i in range(math.ceil(12.5*A),int(12.5*(A+1))):
    if 10*B <= i < 10*(B+1):
        q = i
        break
if q != 0:
    print(i)
else:
    print(-1)

Submission status: Runtime Error

Solution code:
S = input()
pritn("Yes" if "AB" in S or "BA" in S else "No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, a, b = map(int,input().split())
print((n//(a+b))*a+min([a,n%(a+b)]))

Submission status: Runtime Error

Solution code:

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

Submission status: Runtime Error

Solution code:
import sys
s = sys.stdin.readline()
if s = 'AAA' or 'BBB':
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3

N, A, B = map(int, input().split())

print((N//(A+B))*A + min(A, (N%(A+B))))

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3

N, A, B = map(int, input().split())

if N%(A+B) <= A:
    print((N//(A+B))*A + (N%(A+B)))
else:
    print((N//(A+B))*A + A)

Submission status: Runtime Error

Solution code:
S=input()
if s[0] == s[1] and s[1] == s[2]:
    print('No')
else:
    print('yes')

Submission status: Runtime Error

Solution code:
s = input()

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

def main():
    A, B = [int(i) for i in input().split()]
    A_o = int(A*100/8)
    B_o = B*10

    if A_o == B_o:
        print(B*10)
    elif A_o > B_o:
        for i in range(B_o,(B+1)*10):
            if int(i * 0.08) == A:
                print(i)
                return
        else:
            print(-1)
    elif A_o < B_o:
        for i in range(A_o,int((A+1)*100/8)):
            if (i * 0.1) == B:
                print(i)
                return
        else:
            print(-1)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
s = input()
if s == 'AAA':
	print('Yes')
if s == 'BBB'
	print('Yes')
else:
	print('No')

Submission status: Runtime Error

Solution code:
import numpy as np
S=str(input())
Q=int(input())
A=np.array([])
m=0
T=""
for j in range(Q):
  L=list(map(str,input().split()))
  if L[0]=="1":
    A=np.array(A*(-1))
  else:
    S=S+L[2]
    if L[1]==1:
      A=np.append(A,-1)
    else:
      A=np.append(A,1)
for i in range(len(T)):
  if A[i]==-1:
    S=T[i]+S
  else:
    S=S+T[i]
print(S)

Submission status: Runtime Error

Solution code:
a = input()
if a = 'AAA' or 'BBB':
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
S = input()
print("Yes" len(set(S)) ==2 else "No")

Submission status: Runtime Error

Solution code:
S = list(input())
Q = int(input())
for i in range(Q):
    query = input().split()
    if int(query[0]) == 1:
        S.reverse()
    else:
        if int(query[1]) == 1:
            S.insert(0, query[2])
        else:
            S.append(query[2])
print("".join(S))