Problem:


Score : 100 points

Problem Statement

AtCoder Inc. holds a contest every Saturday.

There are two types of contests called ABC and ARC, and just one of them is held at a time.

The company holds these two types of contests alternately: an ARC follows an ABC and vice versa.

Given a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.

Constraints

S is ABC or ARC.

Input

Input is given from Standard Input in the following format:

S

Output

Print the string representing the type of the contest held this week.

Sample Input 1

ABC

Sample Output 1

ARC

They held an ABC last week, so they will hold an ARC this week.



Sample input:
ABC


Sample output:
ARC

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
D = []
E = []
total = A
for i in range(B):
    C = int(input())
    D = map(int, input().split())
    E.append(list(D))
for i in range(1, A+1):
  if str(i) in str(E):
    total = total - 1
print(total)

Submission status: Runtime Error

Solution code:
X = int(input())

ans = [0,0]
for i in range(-500,500):
  for j in range(-500,500):
    if i**5 - j**5 == X:
      ans[0] = i
      ans[1] = j
      break

ans = " ".join(map(str,ans))
print(ans)

Submission status: Runtime Error

Solution code:
print('A%sC'%'BR'[id('A')%3])

Submission status: Runtime Error

Solution code:
NK = list(map(int, input().split()))
ans = [0]*NK[0]

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(0,NK[0]):
    if table.count(j) == 1:
      ans[j] = 0
print(NK[1]-sum(ans))

Submission status: Runtime Error

Solution code:
NK = list(map(int, input().split()))
ans = [1]*NK[0]

for i in range(0,NK[1]):
  d = int(input())
  table  = list(map(int, input().split()))
  for j in range(0,NK[0]):
    if table.count(j) == 0:
      ans[j] = 0
print(sum(ans))

Submission status: Runtime Error

Solution code:
x = int(input())
for i in range(-118, 120):
  for j in range(-119, 119):
    if i**5 - j**5 = x:
      print(i, j)
      exit(0)

Submission status: Runtime Error

Solution code:
## import

## function definition 

## main process
if __name__ == '__main__':
    
    ## input
    N, M = map(int,input().split())
    HEIGHT_LIST = list(map(int,input().split())) 
    ROAD_LIST = []
    for j in range(M): 
        ROAD_LIST.append(
            set(map(int,input().split()))
        )
    
    ## business logic
    COUNT = 0
    
    for i in list(range(1, N+1)):
        unioned_i = set([])
        for k in ROAD_LIST:
            if i in k:
                unioned_i = unioned_i | k
        if len(unioned_i) == 0:
            COUNT = COUNT + 1
            continue
        HIGHT_i = HEIGHT_LIST[i-1]
        if HIGHT_i >= max(
            [ HEIGHT_LIST[l-1] for l in list(unioned_i) ]
        ):
            COUNT = COUNT + 1
    
    ## output
    print(COUNT)

Submission status: Runtime Error

Solution code:
if gets()=="ABC"
  puts "ARC"
else
  puts "ABC"
end

Submission status: Runtime Error

Solution code:
n=input()
l=list(map(int,input().split()))
x=0
c=list()
for i in range(1,n+1):
  a=i+l[i-1]
  c.append(a)
  b=i-l[i-1]
  if b in c:
    x=x+c.count(b)
print(x)

Submission status: Runtime Error

Solution code:
N, K = input().split(' ')

sunukekuns = [i for i in range(N)]

for k in range(K):
  _ = input()
  sunukekun = input().split(' ')
  for (kun in sunukekun):
    if kun in sunukekuns:
      sunukekuns.remove(kun)

print(len(sunukekuns))

Submission status: Runtime Error

Solution code:
n=input()
l=list(map(int,input().split()))
x=0
c=list()
for i in range(1,len(l)+1):
  a=i+l[i-1]
  c.append(a)
  b=i-l[i-1]
  if b in c:
    x=x+c.count(b)
print(x)

Submission status: Runtime Error

Solution code:
import numpy as np
N,M =map(int,input().split())
h_lis=np.array(list(map(int,input().split())))
way_lis=[list(map(int,input().split())) for _ in range(M)]

tes=0
for i in range(N):
    nears=[]
    for way in way_lis:
        if i+1 in way:
            nears.extend(way)
    for j,ne in enumerate(nears):
        if j==0:
            h=max(h_lis[ne[0]-1],h_lis[ne[1]-1])
            z=h
        else:
            k=z
            h=max(h_lis[ne[0]-1],h_lis[ne[1]-1])
            z=max(k,h)
    if z==h_lis[i]:
        tes+=1
print(tes)

Submission status: Runtime Error

Solution code:
n, m = list(map(int, input().split()))

height = [int(i) for i in input().split()]

tele = {}
for num, h in enumerate(height, 1):
    tele[num] = [h, "G"]

for roads in range(m):
    a, b = list(map(int, input().split()))
    if (tele[a][0] > tele[b][0]):
        tele[b][1] = "N"
    elif (tele[a][0] < tele[b][0]):
        tele[a][1] = "N"
    elif (tele[a][0] == tele[b][0]):
        tele[a][1] = "N"
        tele[b][1] = "N"

ans_list = tele.values()
ans = 0
for a in ans_list:
    if (a[1] == "G"):
        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
lis = [0]*b
for i in range(a):
  c = int(input())
  d = input().split()
  
  for l in range(c):
    lis[int(d[l])-1] += 1
    
count = 0
for i in range(b):
  if(lis[i] == 0):
    count += 1

print(count)

Submission status: Runtime Error

Solution code:
n,m = map(int, input().split())
H = list(map(int, input().split()))
s = [[0]]*m
 
for _  in range(m):
    a, b = map(int, input().split())
    s[a-1].append(H[b-1])
    s[b-1].append(H[a-1])
 
c = 0
for j in range(n):
    if H[j] > max(s[j]):
        c+= 1
 
print(c)

Submission status: Runtime Error

Solution code:
X = int(input())
C= [i**5 for i in range(119)]

a = 0
b = 0

for a in range(len(C)):
    for b in range(len(C)):
        if C[a] + C[b] == X:
            print(a, -b)
            exit(0)
        elif C[a] - C[b] == X:
            print(a, b)
            exit(0)

Submission status: Runtime Error

Solution code:
X = int(input())
for A in range(-150, 150):
    for B in range(-150, 150):
        if A**5 - B**5 == X:
            print(A, B)
            break
    else:
        continue
    break

Submission status: Runtime Error

Solution code:
S = int(input())
if S == ABC:
  print("ARC")
elif S == ARC:
  print("ABC")

Submission status: Runtime Error

Solution code:
X=int(input())
for i in range(-150,151):
    for j in range(-150,151):
        if i**5-j**5==X:
            print(i,j)
            exit()

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
H = []
H = list(map(int,input().split()))
route = []
h_max = 0
count = 0
h_max_list = []
for i in range(M):
    route.append(list(map(int,input().split())))

for i in range(1,N+1):
    for j in range(M):
        if i in route[j]:
            h_max = max(H[route[j][0]-1],H[route[j][1]-1])
            if H.index(h_max)+1 == i:
                h_max_list.append(H.index(h_max)+1)

print(len(set(h_max_list)))

Submission status: Runtime Error

Solution code:
s = int(input())
if s =='ABC':
    print('ARC')
else:
    print('ABC')

Submission status: Runtime Error

Solution code:
x = int(input())
for a in range(-200,201):
	for b in range(-200,201):
    	if a**5 - b**5 == x:
        	print(a,b,sep= ' ')
          	exit()

Submission status: Runtime Error

Solution code:
X = int(input())
flag = False
for a in range(-1000,1000):
    for b in range(-1000,1000):
        if a**5 - b**5 == X:
            print("{0} {1}".format(a,b))
            flag = True
            break
    if flag:
        break

Submission status: Runtime Error

Solution code:
X = int(input())
c = 0
for a in range(-118, 119):
  for b in range(-118, 119):
    Y = a ** 5 - b ** 5
    if Y == X:
      A = a
      B = b
      print(A, B)
      c = 1
      break
    if c ==1:
      break

Submission status: Runtime Error

Solution code:
N=int(input())
for A in range(-118,120):
  for B in range(-119,119):
    if A**5-B**5==N:
      print(A,B)
      exit()

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
N_list = list()

for i in range(1,N+1):
	N_list.append(i)

for i in range(K):
	d = int(input())
	a_list = map(int,input().split())
	for n in N_list:
		for a in a_list:
			if n == a:
				N_list.remove(n)

print(N_list[0])

Submission status: Runtime Error

Solution code:
list=["ABC","ARC]
a=input()
if a==list[0]:
      print(list[1])
else:
      print(list[0])

Submission status: Runtime Error

Solution code:
import sys
import itertools
X = int(input())
N = 120
ABs = []
for i in range(N):
    ABs.append(i**5)
    
for i in range(N):
    for j in range(N):
        if ABs[i]-ABs[j] == X:
            print(i,j)
            sys.exit()
        elif ABs[i]+ABs[j] == X:
            print(i,-j)
            sys.exit()

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
H=list(map(int,input().split()))
tunagari=[[] for i in range(N)]
for i in range(M):
  A,B=map(int,input().split())
  tunagari[A-1]+=[B-1]
  tunagari[B-1]+=[A-1]

nums=[0 for i in range(N)]
t=0
for i in range(N):
  tmpl=tunagari[i]
  mini=min(tmpl)
  if mini<i:
    nums[i]=nums[mini]
    continue
  nums[i]=t
  t+=1
maxn=max(nums)
groups=[[] for i in range(maxn+1)]
print(maxn+1)
for i in range(N):
  groups[nums[i]]+=[i]
ans=0

for i in range(maxn):
  tmpl=groups[i]
  tmpl2=[]
  for i in tmpl:
    tmpl2+=[H[i]]
  n=len(tmpl)
  if n==1:
    ans+=1
  else:
    tmpl2.sort()
    if tmpl2[-1]!=tmpl2[-2]:
      ans+=1

Submission status: Runtime Error

Solution code:
x=int(input())
a=0
b=0
for i in range(-500,500):
  for j in range(-500,500):
    if i**5-j**5==x:
      a=i
      b=j
      break
  else:
    continue
  break
print(a,b)

Submission status: Runtime Error

Solution code:
x = int(input())

for i in range(-200,200):
    for j in range(-200,200):
        if i ** 5 - j ** 5 == x:
            print(i,j)
            quit()

Submission status: Runtime Error

Solution code:
S = input()

if S == str(ABC):
  print("ARC")
else:
  print("ABC")

Submission status: Runtime Error

Solution code:
x = int(input())

for i in range(1000):
    #for j in range(10)
    #print(i ** 5)
    for j in range(1000):
        #print(i ** 5 - j ** 5)
        if i ** 5 - j ** 5 == x:
            print(i, j)
            quit()
        elif i ** 5 - (-j) ** 5 == x:
            print(i, -j)
            quit()
        elif (-i) ** 5 - j ** 5 == x:
            print(-i, j)
            quit()
        elif (-i) ** 5 - (-j) ** 5 == x:
            print(-i, -j)
            quit()

Submission status: Runtime Error

Solution code:
S = input()

if S == ABC:
  print("ARC")
else:
  print("ABC")

Submission status: Runtime Error

Solution code:
x=int(input())
a=0
b=0
for i in range(500):
  for j in range(-1000,1000):
    if i**5-j**5==x:
       a=i
       b=j
       break
print(a,b)

Submission status: Runtime Error

Solution code:
import sys

def debug(*args):
    print(*args, file=sys.stderr)


x_diff_of_5th_factor = int(input())


for a in range(-118, 119):
    for b in range(-119, 118):
        if a ** 5 - b ** 5 == x_diff_of_5th_factor:
            print('{} {}'.format(a, b))
            sys.exit(0)

sys.exit(1)

Submission status: Runtime Error

Solution code:
import sys

sys.setrecursionlimit(2000)

n,k = map(int,input().split())
lisN = list(range(1,n+1))
lis = set([])

for i in range(k):
    a =int(input())
    for j in range(a):
        lis.add(int(input()))
        

    
print(len(set(lisN) ^ set(lis)))

Submission status: Runtime Error

Solution code:
s=input()
if s=='ARC':
  print('ABC')

elif s='ABC':
  print("ARC")

Submission status: Runtime Error

Solution code:
import sys

def debug(*args):
    print(*args, file=sys.stderr)


x_diff_of_5th_factor = int(input())


for a in range(-119, 118):
    for a in range(-118, 119):
        if a ** 5 - b ** 5 == x_diff_of_5th_factor:
            print('{} {}'.format(a, b))
            sys.exit(0)

sys.exit(1)

Submission status: Runtime Error

Solution code:
S == input()
if S == "ABC":
	print("ARC")
else:
  	print("ABC")

Submission status: Runtime Error

Solution code:
import math
from sys import stdin,stdout
#% 998244353
from heapq import heapify,heappop,heappush

import collections
# T = int(stdin.readline())
# for i in range(T):
    #N=int(stdin.readline())
N,M=list(map(int,stdin.readline().split()))
hill=list(map(int,stdin.readline().split()))

dc=collections.defaultdict(list)
#vis=set()
for m in range(M):
    A,B=list(map(int,stdin.readline().split()))
    dc[A].append(B)
    dc[B].append(A)

ans=0
for k,ls in dc.items():

    f=0
    z=0
    for h in ls:

        if hill[k-1]<=hill[h-1]:
            f=1
            break

    if not f:
      #  print(k)
        ans+=1  
#print(ans)
#ans+=(N-len(dc.keys()))
print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import math
def main():
# 整数の入力
    x = int(input())
    a = 0
    b = 0
    while True:
        y = 0
        y5_x = math.pow(b, 5)
        y = math.pow(y5_x - x, -5)
        
        y = int(y)
        if math.pow(y, 5) + x == y5_x:
            a = y
            break
        else:
            b += 1

    print(f"{b} {a}")

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
x = int(input())
for a in range(-10000, 10000):
    for b in range(-1000, 1000):
        if a**5 - b**5 == x:
            print(a, b)
            quit()

Submission status: Runtime Error

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

H = input().split()
    
t_1 = [int(h) for h in H]

t_2 = []
    
for m in range(M):
      
    g = 0
    
    A, B = map(int, input().split())
    
    if t_1[A-1] > t_1[B-1]:
        
        g = t_1[A-1]
        f = t_1[B-1]
        
    
    else:
        
        g = t_1[B-1]
        f = t_1[A-1]
        
    if f in t_2:    
        t_2.remove(f)
            
    t_2.append(g)
    
print(len(set(t_2)))

Submission status: Runtime Error

Solution code:
S = std("ABC") or std("ARC")

if S = std("ABC")
print(std("ARC"))
else
print(std("ARC"))
end if

Submission status: Runtime Error

Solution code:
x=int(input())

for i in range (200):
  for j in range (-200,200):
    if i**5-j**5==x:
      print(i,j)
      exit()

Submission status: Runtime Error

Solution code:
x = int(input())
for a in range(-1000, 1000):
    for b in range(-1000, 1000):
        if a**5 - b**5 == x:
            print(a, b)
            quit()

Submission status: Runtime Error

Solution code:
x = int(input())
if x == 1:
  print(0,-1)
  exit()
  
def divisorize(fct):
    b, e = fct.pop()  # base, exponent
    pre_div = divisorize(fct) if fct else [[]]
    suf_div = [[(b, k)] for k in range(e + 1)]
    return [pre + suf for pre in pre_div for suf in suf_div]


def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct


def num(fct):
    a = 1
    for base, exponent in fct:
        a = a * base**exponent
    return a

c = []
fct = factorize(x)
for div in divisorize(fct):
    c.append(num(div))
    
chk = False
for s in c:
  if chk:
    break
  for i in range(1000):
    if (i+s)**5-i**5 > x:
      break
    if (i+s)**5-i**5 == x:
      ans = (i+s,i)
      chk = True
      break
  if s <1000:    
    for p in range(s,1000):
      j = -1*p
      #print(s,(j+s)**5-j**5)
      if (j+s)**5-j**5 > x:
        break 
      if (j+s)**5-j**5 == x:
        ans = (j+s,j)
        chk = True
        break 
  for ww in range(1,(s+1)//2):
    jj = -1*ww
    if (jj+s)**5-jj**5 > x:
      break    
    if (jj+s)**5-jj**5 == x:
      ans = (jj+s,jj)
      chk = True
      break 
print(*ans)

Submission status: Runtime Error

Solution code:
import collections


x = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

prime = prime_factorize(x)[0]

a,b = 0,-prime
while True:
    if x == a**5 - (b)**5:
        print(a,b)
        break
    else:
        a += 1
        b += 1

Submission status: Runtime Error

Solution code:
# coding: utf-8

X = int(input())
flg = 0
for A in range(-100, 100):
    for B in range(-80, 80):
        if A ** 5 - B ** 5 == X:
            print(f"{A} {B}")
            flg = 1
            break
    if flg:
        break

Submission status: Runtime Error

Solution code:
S=int(input())
if (S="ABC"):
  print("ARC")
else:
  print("ABC")

Submission status: Runtime Error

Solution code:
C =input()

if C = "ABC":
   print("ARC")
elif C = "ARC":
   print("ABC")

Submission status: Runtime Error

Solution code:
import itertools

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

h = [int(i) for i in input().split()]

List = [list(map(int, input().split())) for i in range(M)]
f_list=list(itertools.chain.from_iterable(List))

cnt=0


for i in range(1,N+1):
  if f_list.count(i)==0:
    cnt+=1


ToF = [0] * N


for i in range(0, M):
    tmp1 = List[i][1] - 1
    tmp2 = List[i][0] - 1
    diff = h[tmp1] - h[tmp2]
    if diff > 0:
        ToF[List[i][1] - 1] = 1

print(ToF.count(1)+cnt)

Submission status: Runtime Error

Solution code:
x=int(input())
for i in range(100):
    k=x-i**5
    a=k**0.2
    if type(a)==complex:
        continue
    if a.is_integer():
        break
print(-i,int(a))

Submission status: Runtime Error

Solution code:
import itertools


X = int(input())
ans_A = 0
ans_B = 0
for i, j in itertools.combinations(range(0, 1000), 2):
    j *= -1
    if i**5 - j**5 == X:
        ans_A = i
        ans_B = j
        break
if ans_A == 0 and ans_B == 0:
    for i, j in itertools.combinations(range(0, 1000), 2):
        if i**5 - j**5 == X:
            ans_A = i
            ans_B = j
            break
print(ans_A, ans_B)

Submission status: Runtime Error

Solution code:
def factorization(num):
  if num == 1:
    return [1]
  factor = []
  while num > 1:
    for i in range(num - 1):
      k = i + 2
      if num % k == 0:
        factor.append(k)
        num = int(num / k)
        break
  return factor
  
x=int(input())
a=0
b=0
a_b=0
y=factorization(x)
len_y=len(y)
z=set(y)


z=list(z)
#print(z)
for j in range(len(z)):
  a_b=z[j]
  for k in range(a_b):
    a=a_b+k
    b=k
    if a**5-b**5== x:
      print("%d %d" % (a,b))
      exit()
    a=a_b-k
    b=0-k
    if a**5-b**5== x:
      print("%d %d" % (a,b))
      exit()
      
if len_y > 2:
  z=set([])
  for l in range(0,len_y-1):
    for m in range(l,len_y):
      z=z|set([y[l]*y[m]])
  z=list(z)
  for j in range(len(z)):
    a_b=z[j]
    for k in range(a_b):
      a=a_b+k
      b=k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
      a=a_b-k
      b=0-k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
    
if len_y > 3:
  z=set([])
  for l in range(0,len_y-2):
    for m in range(l,len_y-1):
      for n in range(m,len_y):
        z=z|set([y[l]*y[m]*y[n]])
  z=list(z)
  for j in range(len(z)):
    a_b=z[j]
    for k in range(a_b):
      a=a_b+k
      b=k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
      a=a_b-k
      b=0-k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()

if len_y > 4:
  z=set([])
  for l in range(0,len_y-3):
    for m in range(l,len_y-2):
      for n in range(m,len_y-1):
        for p in range(n,len_y):
          z=z|set([y[l]*y[m]*y[p]])
  z=list(z)
  for j in range(len(z)):
    a_b=z[j]
    for k in range(a_b):
      a=a_b+k
      b=k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
      a=a_b-k
      b=0-k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()

if len_y > 5:
  z=set([])
  for l in range(0,len_y-4):
    for m in range(l,len_y-3):
      for n in range(m,len_y-2):
        for p in range(n,len_y-1):
          for q in range(p,len_y):
            z=z|set([y[l]*y[m]*y[p]*y[q]])
  z=list(z)
  for j in range(len(z)):
    a_b=z[j]
    for k in range(a_b):
      a=a_b+k
      b=k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()
      a=a_b-k
      b=0-k
      if a**5-b**5== x:
        print("%d %d" % (a,b))
        exit()

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
h_list = [int(i) for i in input().split()]
data = [list(map(int, input().split())) for _ in range(m)]

ten_set =set(np.array(range(1,n+1)))
ans_set =set([])
exist_set = set(np.array(range(1,n+1)))
for i in range(m):
    if h_list[data[i][0]-1] < h_list[data[i][1]-1]:
        ans_set.add(data[i][1])
        if data[i][0] in ans_set:
            ans_set.remove(data[i][0])
    elif h_list[data[i][0]-1] > h_list[data[i][1]-1]:
        
        ans_set.add(data[i][0])
        if data[i][1] in ans_set:
            ans_set.remove(data[i][1])
    elif h_list[data[i][0]-1] == h_list[data[i][1]-1]:
        if data[i][0] in ans_set:
            ans_set.remove(data[i][1])
        if data[i][1] in ans_set:
            ans_set.remove(data[i][1])
    exist_set.add(data[i][0])
    exist_set.add(data[i][1])

sa_set = ten_set − exist_set
ans_set = ans_set.union(sa_set)
print(len(ans_set))

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())  # 文字列または整数(一変数)
    A = list(map(int, input().split()))  # 整数のリスト

    answer = 0

    for i in range(1, N+1):
        for j in range(i+1, N+1):
            if A[j-1] + A[i-1] == abs(j - i):
                answer += 1

    print(answer)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N, A, B, C = map(int, input().split(" "))
commands = []
data = {
    'A': A,
    'B': B,
    'C': C
}
ans = [] 

if A >=1 and B >= 1 and C >= 1 :
    print("Yes")
    for _ in range(N) :
        command = input()
        if data[command[0]] > data[command[1]] :
            data[command[0]] -= 1
            data[command[1]] += 1
            print(command[1])
        else :
            data[command[0]] += 1
            data[command[1]] -= 1
            print(command[0]) 
else :
    safe = []
    commands = []
    for _ in range(N) :
        commands.append(input())

    fail = False
    i = 0 
    ans = []
    
    while i < N : 
        if data[commands[i][0]] == 0 and data[commands[i][1]] == 0 :
            if safe == [] :
                fail = True
                break
            else : 
                data, i, _ans = safe.pop()
                ans = ans[:i+1]
                ans.append(_ans)
                
        elif data[commands[i][0]] == 1 and data[commands[i][1]] == 1 :
            _data = { 'A' :data['A'], 'B' :data['B'], 'C' :data['C'] }
            _i = i
            
            _data[commands[i][1]] += 1
            _data[commands[i][0]] -= 1
            _ans = commands[i][1] 
            safe.append( [_data, _i, _ans] )  

            data[commands[i][0]] += 1
            data[commands[i][1]] -= 1
            ans.append( commands[i][0] )
        else :
            if data[commands[i][0]] > data[commands[i][1]] :
                x = commands[i][0] 
                y = commands[i][1] 
            else :
                x = commands[i][1] 
                y = commands[i][0]

            data[x] -= 1 
            data[y] += 1
            ans.append(y)

        i += 1

    if fail :
        print("No")
    else :
        print("Yes")
        for c in ans :
            print(c)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = [[] for i in range(M)]
for i in range(M):
    AB[i] = list(map(int, input().split()))

cnt = 0
memo_loser = []
for bridge in AB:
    

    value = min(H[bridge[0]-1], H[bridge[1]-1])
    if value == H[bridge[0]-1] and not bridge[0] in memo_loser:
        memo_loser.append(bridge[0])
    if value == H[bridge[1] - 1] and not bridge[1] in memo_loser:
        memo_loser.append(bridge[1])
print(N - len(memo_loser))

Submission status: Runtime Error

Solution code:
X = int(input())

AA = 0
BB = 0

for A in range(200):
    for B in range(200):
        if X == (A ** 5) - (B ** 5):
            AA = A
            BB = B

if AA == 0 and BB == 0:
    for A in range(200):
        if X == (A ** 5) + 1:
            AA = A
            BB = -1

print(AA,BB)

Submission status: Runtime Error

Solution code:
C = (input())

if C='ARC':
 print('ABC')
elif C='ABC':
 print('ARC')

Submission status: Runtime Error

Solution code:
n,a,b,c = list(map(int,input().split()))
an=0;d={};l=[];x=y=z=0
for i in range(n):
  s=input();l.append(s)
  x+=int(s[0]=='A')
  z+=int(s[-1]=='C')
  y+=int(s[-1]=='B')+int(s[0]=='B')
x=a-x;y=b-y;z=c-z
if (x<0)+(y<0)+(z<0)>=2:
  print("No");exit()
a=[]
for i in range(n):
  if l[i]=='AC':
    if x>=0:
      z+=1;a.append('C')
    else:
      x+=1;a.append('A')
  if l[i]=='AB':
    if x>=0:
      y+=1;a.append('B')
    else:
      x+=1;a.append('A')
  if l[i]=='BC':
    if y>=0:
      z+=1;a.append('C')
    else:
      y+=1;a.append('B')
print("Yes")
for i in a:
  print(i)

Submission status: Runtime Error

Solution code:
x = int(input())

root = int(x**(0.2))

flag = 0
for i in range(root - 400, root + 400):
    for j in range(-100, root + 400):
        if i!=j:
            if x%(i-j) == 0:
                if i**5-j**5 == x:
                    print(i, j)
                    flag = 1
                    break
    if flag:
        break

Submission status: Runtime Error

Solution code:
n = int(input())
nn = int(pow(n,1/5)) + 1
p = sorted(range(nn),reverse = True)
for i in p:
    b = pow(n - i, 1/5)
    if float.is_integer(b):
        break

print(i,int(-b))

Submission status: Runtime Error

Solution code:
import random

x=int(input())

while True:
    a=random.randint(-1000000000,1000000000)
    b=random.randint(-1000000000,1000000000)
    if x == a*a*a*a*a-b*b*b*b*b:
        print(a,b)
        break

Submission status: Runtime Error

Solution code:
s=input()
if x=="ABC":
    print("ARC")
else:
    print("ABC")

Submission status: Runtime Error

Solution code:
import itertools
X=int(input())
li=[i**5 for i in range(128)]#
for v in itertools.permutations(li, 2):
    v=list(v)
    v.sort()
    if v[1]-v[0]==X:#両方プラスの時
        A=v[0]**0.2
        B=v[1]**0.2
        print(str(int(A))+" "+str(int(B)))
        break
    elif v[0]+v[1]==X:#v[1]がマイナスの時
        A=v[0]**0.2
        B=-1*((v[1])**0.2)
        print(str(int(A))+" "+str(int(B)))
        break
#ans=(i-j)*(i**4+(i**3)*j+(i**2)*(j**2)+i*(j**3)+j**4)
#(ａ－ｂ)(ａ⁴＋ａ³ｂ＋ａ²ｂ²＋ａｂ³＋小さい

Submission status: Runtime Error

Solution code:
S == input()
if S == "ABC" 
	print("ARC")
else:
  	print("ABC")

Submission status: Runtime Error

Solution code:
x = int(input())

root = int(x**(0.2))

flag = 0
for i in range(root - 100, root + 100):
    for j in range(-40, root):
        if i!=j:
            if x%(i-j) == 0:
                if i**5-j**5 == x:
                    print(i, j)
                    flag = 1
                    break
    if flag:
        break

Submission status: Runtime Error

Solution code:
X=int(input())
Y=int(X**(0.2))
for i in range(Y,-Y,-1):
    for t in (-Y//2,Y,1):
        if i**5-t**5==X:
            S=i
            Z=t
            break
print(S,Z)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))
import math

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return sorted(divisors)



X = ii()
'''
a = make_divisors(X)
ind = bisect.bisect_left(a, X**0.2)

for num in a[:ind+1]:
    for i in range(num):
        j = num - i
        if i**5 + j**5 == X:
            print(i, (-1)*j)
            exit()
'''
num = int(X**0.2)+1
for i in range(num):
    #tmp = i**5
    b = (X - i**5)**0.2
    if math.floor(b) == b:
        print(i, (-1)*int(b))
        exit()

Submission status: Runtime Error

Solution code:
X=int(input())
Y=int(X**(0.2))
for i in range(Y,-Y,-1):
    for t in (-Y//2,Y,1):
        if i**5-t**5==X:
            S=i
            Z=t
            break
        else:
            continue
print(S,Z)

Submission status: Runtime Error

Solution code:
x = int(input())

import math
def trial_division(n):
    #素因数を格納するリスト
    num_list = []
    factor = set(num_list)
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.add(num)
    #リストが空ならそれは素数
    if not factor:
        return [1]
    else:
        factor.add(n)
        return factor


for number in trial_division(x):
  for a in range(round(x**(1/5))):
    b = a - number
    if a**5 - b**5 == x:
      print(a,b)
      break
    elif a**5 - (-b)**5==x:
      print(a,-b)
      break

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
H = list(map(int,input().split()))
A = [0]*M
B = [0]*M
for i in range(M):
  A[i],B[i]=map(int,input().split())
c = 0
p=[0]*N
for i in range(1,N+1):
  if i not in A and i not in B:
    c = c+1
  else:
    for j in range(1,M+1):
      if i == A[j-1]:
        if H[A[j-1]-1] > H[B[j-1]-1]:
          p[i-1] = p[i-1]+1
      if i == B[j-1]:
        if H[B[j-1]-1] > H[A[j-1]-1]:
          p[i-1] = p[i-1]+1
    if p[i-1] == A.count(i)+B.count(i):
      c =c+1
print(c)

Submission status: Runtime Error

Solution code:
n = list(map(int,input().split()))
m = list(map(int,input().split()))

a = []
kaku = []
for x in range(n[1]) :
    a.append(list(map(int, input().split())))

kaku = [0]* len(m)
cou = 0

for x in range(n[1]):
    if m[a[x][0] -1 ] > m[a[x][1] -1 ]:
        kaku[a[x][0] -1 ] += 1
    else:
        kaku[a[x][0] - 1] -= 1000000

    if m[a[x][1] -1 ] > m[a[x][0] -1 ]:
        kaku[a[x][1] -1 ] += 1
    else:
        kaku[a[x][1] - 1] -= 1000000

for x in range(len(m)):
    if kaku[x] >= 0 :
        cou += 1

print(cou)

Submission status: Runtime Error

Solution code:
print('ABC' if s[1] == 'R' else 'ARC')

Submission status: Runtime Error

Solution code:
A, B = map(int, input().split())
D = []
E = []
total = A
for i in range(B):
    C = int(input())
    D = map(int, input().split())
    E.append(list(D))
for i in range(A):
  if str(i+1) in str(E):
    total = total - 1
print(total)

Submission status: Runtime Error

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

h=list(map(int,input().split()))
low=[]
high=[]

for i in range(m):

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

    if h[a-1]>h[b-1]:

        low.append(b)
        high.append(a)

    elif h[a-1]==h[b-1]:


        low.extend([a,b])

    elif h[a-1]<h[b-1]:

        low.append(a)
        high.append(b)

common=list(set(low)&set(high))

for k in range(len(common)):

    high.remove(common[k])

lh_or=list(set(low) ^ set(high))

g=n-len(lh_or)
high=list(set(high))

print(len(high)+g)

Submission status: Runtime Error

Solution code:
print("ABC" if s[1] == "R" else "ARC")