Problem:


Score : 100 points

Problem Statement

A programming competition site AtCode regularly holds programming contests.

The next contest on AtCode is called ABC, which is rated for contestants with ratings less than 1200.

The contest after the ABC is called ARC, which is rated for contestants with ratings less than 2800.

The contest after the ARC is called AGC, which is rated for all contestants.

Takahashi's rating on AtCode is R. What is the next contest rated for him?

Constraints

0 ≤ R ≤ 4208

R is an integer.

Input

Input is given from Standard Input in the following format:

R

Output

Print the name of the next contest rated for Takahashi (ABC, ARC or AGC).

Sample Input 1

1199

Sample Output 1

ABC

1199 is less than 1200, so ABC will be rated.

Sample Input 2

1200

Sample Output 2

ARC

1200 is not less than 1200 and ABC will be unrated, but it is less than 2800 and ARC will be rated.

Sample Input 3

4208

Sample Output 3

AGC



Sample input:
1199


Sample output:
ABC

Submission status: Wrong Answer

Solution code:
s = input()
A_list =["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
ans_C = 0
ans_Big = 0
if s[0] != "A":
  print("WA")
else:
  for i in range(2,(len(s)-1)):
    if s[i] == "C":
      ans_C += 1
    else:
      ans_C += 0
  for j in range(len(s)):
    if s[j] in A_list:
      ans_Big += 1
    else:
      ans_Big += 0
  if ans_C == 1 and ans_Big == 0:
    print("AC")
  else:
    print("WA")

Submission status: Wrong Answer

Solution code:
import string
S = input()
ans = [False,False,False]
if S[0] == 'A':
    ans[0] = True
if 'C' in S[2:-1]:
    ans[1] = True
if ans[0] == True and ans[1] == True and list(S).count('C') == 1:
    x = list(S)
    del x[0]
    x.remove('C')
    for i in range(len(x)):
        if x[i] not in list(string.ascii_lowercase):
            break
        if i == len(x) -1:
            ans[2] = True
if ans[0] and ans[1] and ans[2]:
    print('AC')
else:
    print('WA')

Submission status: Wrong Answer

Solution code:
import bisect
score = 1199
breakpoints=[1200,2800]
grades=['ABC', 'ARC', 'AGC']
i = bisect.bisect(breakpoints, score)
print(grades[i])

Submission status: Wrong Answer

Solution code:
S = list(input())
cnt = 0

array = S[2:-1]
if array.count("C")==1:
  array.remove("C")
  S = S[:2]+array+S[-1]
else:
  cnt += 1

if S[0]=="A":
  del S[0]
else:
  cnt += 1

s = "".join(S)
if s.islower == False:
  cnt += 1
print("AC" if cnt==0 else "WA")

Submission status: Wrong Answer

Solution code:
S = input()
dp = [[0 for i in range(4)] for i in range(len(S)+1)]
MOD = 10**9+7
dp[0][3] = 1
for i in range(len(S)):
    if S[i] == '?': k = 3
    else: k = 1
    for _ in range(k):
        dp[i+1][0] += dp[i][0] 
        dp[i+1][1] += dp[i][1] 
        dp[i+1][2] += dp[i][2] 
        dp[i+1][3] += dp[i][3] 
    if S[i] == 'A':
        dp[i+1][0] +=  dp[i][3]
    elif S[i] == 'B':
        dp[i+1][1] +=  dp[i][0]
    elif S[i] == 'C':
        dp[i+1][2] += dp[i][1]
    else:
        dp[i+1][0] += dp[i][3]
        dp[i+1][1] += dp[i][0]
        dp[i+1][2] += dp[i][1]
    for j in range(4):
        if dp[1+i][j] > MOD: dp[i+1][j] %= MOD
print(dp[len(S)][2]%MOD)

Submission status: Wrong Answer

Solution code:
x = int(input())
l0 = [1200,2800,9999]
l1 = ["ABC","ARC","AGC"]

for i in range(3):
  if x < l0[i]:
    print(l1[1])
    break

Submission status: Wrong Answer

Solution code:
mod=10**9+7
s=input()
n=len(s)
dp=[[0]*4 for i in range(n+1)] # A B C ABC
dp[0][0]=1
for i in range(1,n+1):
    if s[i-1]=="A":
        dp[i][0]=dp[i-1][0] % mod
        dp[i][1]=(dp[i-1][1] + dp[i-1][0]) % mod
        dp[i][2]=dp[i-1][2] % mod
        dp[i][3]=dp[i-1][3] % mod
    elif s[i-1]=="B":
        dp[i][0]=dp[i-1][0] % mod
        dp[i][1]=dp[i-1][1] % mod
        dp[i][2]=(dp[i-1][2] + dp[i-1][1]) % mod
        dp[i][3]=dp[i-1][3] % mod
    elif s[i-1]=="C":
        dp[i][0]=dp[i-1][0] % mod
        dp[i][1]=dp[i-1][1] % mod
        dp[i][2]=dp[i-1][2] % mod
        dp[i][3]=(dp[i-1][3] + dp[i-1][2]) % mod
    else:
        dp[i][0]=dp[i-1][0]*3 % mod
        dp[i][1]=(dp[i-1][1]*3 + dp[i-1][0]) % mod
        dp[i][2]=(dp[i-1][2]*3 + dp[i-1][1]) % mod
        dp[i][3]=(dp[i-1][3]*3 + dp[i-1][2]) % mod
print(dp[-1][-1]% mod)

Submission status: Wrong Answer

Solution code:
R = int(input())

if R < 1200:
    print('ABC')
elif R < 28000:
    print('ARC')
else:
    print('AGC')

Submission status: Wrong Answer

Solution code:
mod=10**9+7
s=input()
n=len(s)
Sum_A=[0]*(n+1)
Sum_B=[0]*(n+1)
Sum_C=[0]*(n+1)
Sum_q=[0]*(n+1)
for i in range(1, n+1):
    Sum_A[i]=Sum_A[i-1]
    Sum_C[i]=Sum_C[i-1]
    Sum_q[i]=Sum_q[i-1]
    if s[i-1]=='A':
        Sum_A[i]+=1
    elif s[i-1]=='C':
        Sum_C[i]+=1
    elif s[i-1]=='?':
        Sum_q[i]+=1
ans=0
def count(x, q):
    return int(x*pow(3, q, mod)+q*pow(3, (q-1), mod))
for i in range(n):
    if s[i]=='B' or s[i]=='?':
        ans+=count(Sum_A[i], Sum_q[i])*count(Sum_C[n]-Sum_C[i+1], Sum_q[n]-Sum_q[i+1])
        ans%=mod
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10000)
mod=10**9+7
s=input()
n=len(s)
Sum_A=[0]*(n+1)
Sum_B=[0]*(n+1)
Sum_C=[0]*(n+1)
Sum_q=[0]*(n+1)
for i in range(1, n+1):
    Sum_A[i]=Sum_A[i-1]
    Sum_C[i]=Sum_C[i-1]
    Sum_q[i]=Sum_q[i-1]
    if s[i-1]=='A':
        Sum_A[i]+=1
    elif s[i-1]=='C':
        Sum_C[i]+=1
    elif s[i-1]=='?':
        Sum_q[i]+=1
ans=0

def pow1(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1

    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2

    return K * x

def count(x, q):
    return int(x*pow1(3, q)+q*pow1(3, q-1))

for i in range(n):
    if s[i]=='B' or s[i]=='?':
        ans+=count(Sum_A[i], Sum_q[i])*count(Sum_C[n]-Sum_C[i+1], Sum_q[n]-Sum_q[i+1])
        ans%=mod
print(ans)

Submission status: Wrong Answer

Solution code:
R = int(input())
if R < 1200:
    print('ABC')
elif(1200 <= R <= 2800):
    print("ARC")
else:
    print("AGC")

Submission status: Wrong Answer

Solution code:
S = input()
if S[0] == "A":
  if S[2:-1].count("C") == 1:
    if S[1].islower() and S[3:].islower():
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")

Submission status: Wrong Answer

Solution code:
S = input()
if S[0] == "A":
  if S[2:-2].count("C") == 1:
    if S[1].islower:
      if S[3:].islower:
        print("AC")
      else:
        print("WA")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")

Submission status: Wrong Answer

Solution code:
S = input()
if S[0] == "A":
  if S[2:-2].count("C") == 1: 
    if not S[0:2].upper and S[3:].islower:
      print("AC")
    else:
      print("WA")
  else:
    print("WA")
else:
  print("WA")

Submission status: Wrong Answer

Solution code:
s=input()
a=[1,0,0,0]
for i in s:
    if i=="A": a[1]+=a[0]
    elif i=="B": a[2]+=a[1]
    elif i=="C": a[3]+=a[2]
    else: a=[ a[0]*3 ] + [ a[j+1]*3+a[j] for j in range(3) ]

    a=[a[i]%1000000007 for i in range(4)]
print(a[3])

Submission status: Wrong Answer

Solution code:
s=input()

a=[1,0,0,0]

for i in range(len(s)):
    c=s[i]
    if c=="A":
        a[1]+=a[0]
    elif c=="B":
        a[2]+=a[1]
    elif c=="C":
        a[3]+=a[2]
    else:
        a=[ a[0]*3 ] + [ a[j+1]*3+a[j] for j in range(3) ]

    a=[a[i]%1000000007 for i in range(4)]

print(a[3])

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
import sys

S=sys.stdin.readline().strip()
l=len(S)

mod=10**9+7

dp=defaultdict(lambda: 0)   #dp[ (i,j) ]	i: nan-mojime,  j=0:All mojiretsu pattern , 1:A, 2:AB, 3:ABC
dp[(0,0)]=1

n=1
for i, s in enumerate(S):
	if s in "ABC":
		dp[ (i+1,0) ]=n
	elif s=="?":
		n*=3
		dp[ (i+1,0) ]=n		

nashi=0
a=1
ab=2
abc=3

for i,s in enumerate(S):
	if s =="A":
		dp[ (i+1,a) ]+=dp[ (i,nashi) ]
		dp[ (i+1,a) ]+=dp[ (i,a) ]
		dp[ (i+1,ab) ]+=dp[ (i,ab) ]
		dp[ (i+1,abc) ]+=dp[ (i,abc) ]
	elif s=="B":
		dp[ (i+1,ab) ]+=dp[ (i,ab) ]
		dp[ (i+1,ab) ]+=dp[ (i,a) ]
		dp[ (i+1,a) ]+=dp[ (i,a) ]
		dp[ (i+1,abc) ]+=dp[ (i,abc) ]
	elif s=="C":
		dp[ (i+1,abc) ]+=dp[ (i,abc) ]
		dp[ (i+1,abc) ]+=dp[ (i,ab) ]
		dp[ (i+1,a) ]+=dp[ (i,a) ]
		dp[ (i+1,ab) ]+=dp[ (i,ab) ]
	elif s=="?":
		dp[ (i+1,a) ]+=dp[ (i,a) ]*3
		dp[ (i+1,a) ]+=dp[ (i,nashi) ]
		dp[ (i+1,a) ]%=mod

		dp[ (i+1,ab) ]+=dp[ (i,ab) ]*3
		dp[ (i+1,ab) ]+=dp[ (i,a) ]	
		dp[ (i+1,ab) ]%=mod

		dp[ (i+1,abc) ]+=dp[ (i,abc) ]*3
		dp[ (i+1,abc) ]+=dp[ (i,ab) ]
		dp[ (i+1,abc) ]%=mod


print ( dp[(l,3)]%mod )

Submission status: Wrong Answer

Solution code:
r=int(input())
if r>1200:
    print("ABC")
elif 1200<=r<2800:
    print("ARC")
else:
    print("AGC")

Submission status: Wrong Answer

Solution code:
str=list(input())
flag=True
if str[0]!='A':
    flag=False
str[0]='a'
cnt=0
for i in range(2,len(str)-1):
    if str[i]=='C':
        cnt+=1
        if cnt==1:
            str[i]='c'
if cnt!=1:
    flag=False

tmp="".join(str)
print(tmp)
if not tmp.islower():
    flag=False

if flag==True:
    print("AC")
else:
    print("WA")

Submission status: Wrong Answer

Solution code:
print("ABC")

Submission status: Wrong Answer

Solution code:
N=int(input())
if N<=1200:
  print("ABC")
elif N<=2800:
  print("ARC")
else:
  print("AGC")

Submission status: Wrong Answer

Solution code:
R = int(input())

if R <= 1200:
  print("ABC")
elif 1200 < R <= 2800:
  print("ARC")
elif R > 2800:
  print("AGC")

Submission status: Wrong Answer

Solution code:
R = int(input())

if R <= 1200:
  print("ABC")
elif 1200 < R <= 2800:
  print("ARC")
elif R >= 2800:
  print("AGC")

Submission status: Wrong Answer

Solution code:
R = int(input())

if R <= 1200:
  print("ABC")
elif R <= 2800:
  print("ARC")
else:
  print("AGC")

Submission status: Wrong Answer

Solution code:
R = int(input())

if R <= 1200:
  print("ABC")
elif 1200 < R <= 2800:
  print("ARC")
else:
  print("AGC")

Submission status: Wrong Answer

Solution code:
a=int(input())
if a>=1199:
  print('ABC')
elif a>=2799:
  print('ARC')
else:
  print('AGC')

Submission status: Wrong Answer

Solution code:
a=int(input())
if a>=1199:
  print('ABC')
elif a>=2800:
  print('ARC')
else:
  print('AGC')

Submission status: Wrong Answer

Solution code:
N = input()
if(N < "1200"):
  print("ABC")
elif(N < "2800"):
  print("ARC")
else:
  print("AGC")

Submission status: Wrong Answer

Solution code:
a=int(input())
if a<1200:
  print("ABC")
if a<2800:
  print("ARC")
if a>2799:
  print("AGC")

Submission status: Wrong Answer

Solution code:
S = input()
if S[0] == "A" and S[2:-1].count("C") == 1 and "C" in S[2:-1]:
    s = S.replace("A", "a").replace("C", "c")
    t = s.lower();
    if s == t:
        print("AC")
        exit()
print("WA")

Submission status: Wrong Answer

Solution code:
r = int(input())

if r < 1200:
    print("ABC")
elif r > 1200 or r < 2800:
    print("ARC")
else:
    print("AGC")

Submission status: Wrong Answer

Solution code:
r = int(input())

if r < 1200:
    print("ABC")
elif r > 1200 or r <= 2800:
    print("ARC")
else:
    print("AGC")

Submission status: Wrong Answer

Solution code:
r = int(input())

if r < 1200:
    print("ABC")
elif r > 1200 or r < 2800:
    print("ARC")
elif r > 2800 or r < 4208:
    print("AGC")

Submission status: Wrong Answer

Solution code:
r = int(input())

if r < 1200:
    print("ABC")
elif r < 2800:
    print("ARC")
elif r > 4208:
    print("AGC")

Submission status: Wrong Answer

Solution code:
R = int(input())
if R<1200:
    r='ABC'
if R<2800:
    r='ARC'
else:
    r='AGC'
print(r)

Submission status: Wrong Answer

Solution code:
r = int(input())
if r < 1200:
  print("ABC")
else:
  print("ARC")

Submission status: Wrong Answer

Solution code:
input()
print('AGC')

Submission status: Wrong Answer

Solution code:
r = int(input())

if r < 1200:
    print('ABC')
if 1200 < r & r < 2800:
    print('ARC')
if 2800 < r:
    print('AGC')

Submission status: Wrong Answer

Solution code:
s=input()[:2];print("AAAGRBCCC"[(s<"12")+(s<"28")::3])

Submission status: Wrong Answer

Solution code:
r = int(input())

if r < 1200:
  print("ABC")
elif 1200 <= r < 2800:
  print("ARC")
elif 2800 < r:
  print("AGC")

Submission status: Wrong Answer

Solution code:
s = list(input())
ans = "AC"
if s[0] != "A" or s.count("C") !=1 or s[2:-1].count("C") != 1 or ''.join([i for i in s if i != "A" and i != "C"]).islower != True:
    ans = "WA"
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

ans = "WA"
if s[0] == "A" and s[2:-1].count("C") == 1 and s[1] != "C" and s[-1] != "C":
    s2 = s.replace("A","a").replace("C","c")
    if s2 == s.lower():
        ans = "AC"

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
result = "WA"

if S.startswith("A"):
    if S.count("C") == 1 and 2 <= S.find("C") <= (len(S)-3):
        S = S.replace("A","").replace("C","")
        if S.islower():
            result = "AC"
    elif S.count("C") == 1 and S.find("C") == 2:
        S = S.replace("A","").replace("C","")
        if S.islower():
            result = "AC"
print(result)

Submission status: Wrong Answer

Solution code:
b= int(input().rstrip())
if b<1200:
	a="ABC"
elif b<2800 & b >1199:
	a="ARC"
else:
	a="AGC"
print(a)

Submission status: Wrong Answer

Solution code:
b= int(input().rstrip())
if b<1200:
	a="ABC"
elif b<2800 & b >1199:
	a="ARC"
else:
	a="ARC"
print(a)

Submission status: Wrong Answer

Solution code:
r = int(input())
if r<1200:
    print('ABC')
elif r <= 2800:
    print('ARC')
else:
    print('AGC')

Submission status: Wrong Answer

Solution code:
A=int(input())
if(A<1200):
  print("ABC")
if(A>=2800):
  print("AGC")
else:
  print("ARC")

Submission status: Wrong Answer

Solution code:
def main():
    R = int(input())
    if 1200 > R:
        print('ABC')
    elif 2400 > R:
        print('ARC')
    else:
        print('AGC')


main()

Submission status: Wrong Answer

Solution code:
s = input()
mod = 10**9 + 7
abc = 0
bc = 0
c = 0
q = 0
for i in s[::-1]:
  if i == "A":
    abc = (abc + bc) % mod
  if i == "B":
    bc = (bc + c) % mod
  if i == "C":
    c = (3**q+c) % mod
  if i == "?":
    abc = (abc*3 + bc) % mod
    bc = (bc*3 + c) % mod 
    c = (3**q + c*3) % mod
    q += 1
print(abc)

Submission status: Wrong Answer

Solution code:
import sys

def solve(R):
    if R < 1200 :
        return 'ABC'
    elif R < 2800 :
        return 'ARC'
    else :
        return 'AGC'

def readQuestion():
    ws = sys.stdin.readline().strip().split()
    R = int(ws[0])
    return (R,)

def main():
    solve(*readQuestion())

#Uncomment before submission
main()

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
R = int(input())
if R >=2800:
  print("AGC")
elif R >= 1200 and 2800 > R:
  print("ARC")
else:
  print("AGC")

Submission status: Wrong Answer

Solution code:
S = input()

mid = S[2:-1]
C_count = 0

for i in mid:
    if i == 'C':
        C_count += 1
        
S_lower = S.lower()
S_replace = S.replace('A', 'a').replace('C', 'c')
        
if S[0] == 'A' and C_count == 1 and S_lower == S_replace:
    print('AC')
else:
    print('WA')

Submission status: Wrong Answer

Solution code:
r = int(input())
if r < 1200:
    print("ABC")
elif r < 2400:
    print("ARC")
else:
    print("AGC")

Submission status: Wrong Answer

Solution code:
a=int(input())
if  a<1200:
   print("ABC")
elif 1200<=a<=2800:
   print("ARC")
else:
   print("AGC")

Submission status: Wrong Answer

Solution code:
r=int(input())
if r<1200:
  print("ABC")
elif r<2400:
  print("ARC")
else:
  print("AGC")

Submission status: Wrong Answer

Solution code:
r=int(input())
data=(1200,2800)
name=('ABC', 'ARC', 'AGC')
if r<data[0]:
  print(name[0])
if data[0]<=r<data[1]:
  print(name[1])
else:
  print(name[2])

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    print("AGC")

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
R = int(input())
if R < 1200:
  print("ABC")
elif R < 2800:
  print("AGC")
else:
  print("AGC")

Submission status: Wrong Answer

Solution code:
print('AGC')

Submission status: Wrong Answer

Solution code:
# AcCepted
import re
s = input()
if s[0] == 'A':
    if s[2:-2:].count('C') == 1:
        if len(re.findall('[ABCDEFGHIJKLMNOPQRSTUVWXYZ]', s)) == 2:
            print('AC')
            exit()
print('WA')

Submission status: Wrong Answer

Solution code:
def rated_for_me(rate):
    if rate < 1200:
        return "ABC"
    if rate < 4208:
        return "ARC"
    return "AGC"

rate = int(input())
print(rated_for_me(rate))

Submission status: Wrong Answer

Solution code:
S = input()
if S.startswith('A'):
    if S[2:-1].count('C') == 1:
        str = S[1] + S[2:-2].replace('C','c') + S[-1]
        if str.islower():
            print('AC')
else:
    print('WA')

Submission status: Wrong Answer

Solution code:
S = input()
if S.startswith('A'):
    if S[2:-1].count('C') == 1:
        str = S[1] + S[2:-1].replace('C','c') + S[-1]
        if str.islower():
            print('AC')
else:
    print('WA')

Submission status: Wrong Answer

Solution code:
S = input()
if S.startswith('A'):
    if S[2:-1].count('C') == 1:
        S = S[1] + S[2:-1].replace('C','c') + S[-1]
        if S.islower():
            print('AC')
else:
    print('WA')

Submission status: Wrong Answer

Solution code:
#コンテスト名称と閾値
rating = [('ABC', 1200), ('ARC', 2800), ('AGC', 4209)]

# Rを入力
try:
    r = int(input('高橋くんのレーティングを入力してください: '))
    if 0 <= r <= 4208:
        # レーティング判定
        for t in rating:
            if r < t[1]:
                print(t[0])
                break
    else:
        print('範囲外の入力値です')
except:
        print('整数値を入力してください')

Submission status: Wrong Answer

Solution code:
print('AGC')

Submission status: Wrong Answer

Solution code:
r = int(input())

if r < 1200:
    print("ABC")
elif r < 2800:
    print("ARG")
else:
    print("AGC")

Submission status: Wrong Answer

Solution code:
R = int(input())

if R < 1200:
    print('ABC')
elif 2800:
    print('ARC')
else:
    print('AGC')

Submission status: Wrong Answer

Solution code:
n = int(input())
if n < 1200:
    print("ABC")
elif n < 2800:
    print("AEC")
else:
    print("AGC")

Submission status: Wrong Answer

Solution code:
C = ["ABC", "ARC" , "AGC"]
A = int(input())
print(C[(A>1200)+(A>2800)])

Submission status: Wrong Answer

Solution code:
s = input()

dp = [[0 for _ in range(4)] for _ in range(len(s) + 1)]
dp[len(s)][3] = 1
n = 10 ** 9 + 7

for i in reversed(range((len(s)))):
    m = 1
    m1 = 1
    m2 = 0
    m3 = 0
    m4 = 0
    if s[i] == '?':
        m = 3
        m1 = 3
        m2 = 1
        m3 = 1
        m4 = 1

    if s[i] == 'C':
        m2 = 1

    if s[i] == 'B':
        m3 = 1

    if s[i] == 'A':
        m4 = 1

    dp[i][3] = (m * dp[i+1][3]) % n
    dp[i][2] = (m1 * dp[i+1][2] + m2 * dp[i+1][3]) % n
    dp[i][1] = (m1 * dp[i+1][1] + m3 * dp[i+1][2]) % n
    dp[i][0] = (m1 * dp[i+1][0] + m4 * dp[i+1][1]) % n

ans = dp[0][0]
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

dp3 = 1
dp2 = 0
dp1 = 0
dp0 = 0

for i in reversed(range((len(s)))):
    m = 1
    m1 = 1
    m2 = 0
    m3 = 0
    m4 = 0
    if s[i] == '?':
        m = 3
        m1 = 3
        m2 = 1
        m3 = 1
        m4 = 1

    if s[i] == 'C':
        m2 = 1

    if s[i] == 'B':
        m3 = 1

    if s[i] == 'A':
        m4 = 1

    t_dp3 = m * dp3
    t_dp2 = m1 * dp2 + m2 * dp3
    t_dp1 = m1 * dp1 + m3 * dp2
    t_dp0 = m1 * dp0 + m4 * dp1
    dp3 = t_dp3
    dp2 = t_dp2
    dp1 = t_dp1
    dp0 = t_dp0

n = 10 ** 9 + 7
ans = dp0 % n
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
text = s[2:-1]
r = s.replace('A', '')
r = r.replace('C', '')

if s[0] != 'A' or text.count('C') != 1 or r != r.lower():
    print('WA')
else:
	print('AC')

Submission status: Wrong Answer

Solution code:
s = input()
text = s[2:-1]
r = s.replace('A', '')
r = r.replace('C', '')

if s[0] != 'A' or text.count('C') != 1 or r != r.lower():
    print('WA')
    exit()
 
print('AC')

Submission status: Wrong Answer

Solution code:
s = input()
text = s[2:-1]
r = s.replace('A', '')
r = r.replace('C', '')

if s[0] != 'A' or text.count('C') != 1 or r != r.lower():
	print('WA')
	exit()

print('AC')

Submission status: Wrong Answer

Solution code:
r = int(input())
l = [1200,2800]
l.append(r)
l.sort()
print(['ABC','ARC','AGC'][l.index(r)])

Submission status: Wrong Answer

Solution code:
r = int(input())
if r < 1200:
    print("ABC")
    if 1200 <= r <2800:
        print("ARC")
        if 2800 <= r <= 4208:
            print("AGC")

Submission status: Wrong Answer

Solution code:
r = int(input())
if r >= 2800:
    print('AGC')
else:
    if r <= 1200:
        print('ABC')
    else:
        print('ARC')

Submission status: Wrong Answer

Solution code:
import string

S = input()

if S[0] != 'A':
    print('WA')
    exit()

if S[2:len(S) - 1].count('C') != 1:
    print('WA')
    exit()

if S[1] == 'C' or S[-1] == 'C':
    print('WA')
    exit()

for s in string.ascii_uppercase.replace('C', ''):
    if s in S[1:]:
        print('WA')
        exit()

print('AC')

Submission status: Wrong Answer

Solution code:
R = int(input())
print('ABC' if R < 1800 else 'ARC' if R < 2800 else 'AGC')

Submission status: Wrong Answer

Solution code:
R = int(input())

if R<1200:
    print("ABC")
if R<2800 and R>1200:
    print("ARC")
if R>2800:
    print("AGC")

Submission status: Wrong Answer

Solution code:
n = int(input())

if n<1200:
    print("ABC")
if n<2800 and n>1200:
    print("ARC")
if n>2800:
    print("AGC")

Submission status: Wrong Answer

Solution code:
R=int(input())
if R<=1200:
    output="ABC"
elif R<=2800:
    output="ARC"
else:
    output="AGC"
print(output)

Submission status: Wrong Answer

Solution code:
s=raw_input()
if s[0]=="A" and len(s)>=3 and s.count("C")==1 and s[-1]!="C" and s[1]!="C" and all(x not in s[1:] for x  in"ABDEFGHIJKLMNOPQRSTUVWXYZ"):print "AC"
else:print "WA"

Submission status: Wrong Answer

Solution code:
n = int(input())
if n <=1200:print("ABC")
elif n<=2800:print("ARC")
else:print("AGC")

Submission status: Wrong Answer

Solution code:
R = int(input("R: "))

if(R < 1200):
    print("ABC")
elif(R < 2800):
    print("ARC")
else:
    print("AGC")

Submission status: Wrong Answer

Solution code:
r = int(input("R: "))

if(r < 1200):
    print("ABC")
elif(r < 2800):
    print("ARC")
else:
    print("AGC")

Submission status: Wrong Answer

Solution code:
S=input()
L=len(S)

M=10**9+7

dp=[ [ 0 for i in range(4) ] for k in range(L+1) ]
all=1

abc=0
ab=0
a=0

for i in range(L):
	if S[i]=="A":
		a=( a+all ) %M
	if S[i]=="B":
		ab=( ab+a )%M
	if S[i]=="C":
		abc=( abc+ab )%M

	if S[i]=="?":
		abc=( abc*3+ab )%M
		ab=( ab*3+a)%M
		a=( a*3+all )%M
		all*=3

print (abc%M)

Submission status: Wrong Answer

Solution code:
R=input('レートを入力してください:')

R=int(R)

if 0<=R<1200 :
    print('ABC')
    
elif 1200<=R<2800 :
    print('ARC')

elif 2800<=R<=4208 :
    print('AGC')

Submission status: Wrong Answer

Solution code:
r=input('レートを入力してください:')

R=int(r)

if 0<=R<1200 :
    print('ABC')
    
elif 1200<=R<2800 :
    print('ARC')

elif 2800<=R<=4208 :
    print('AGC')

Submission status: Wrong Answer

Solution code:
r=input('レートを入力してください:')

R=int(r)

if 0<=R<1200 :
    print('ABC')
    
elif 1200<=R<2800 :
    print('ARC')

elif 2800<=R<=4208 :
    print('AGC')

else :
    print('error')

Submission status: Wrong Answer

Solution code:
R = int(input())
if R<1200:
    print("ABC")
elif R<2400:
    print("ARC")
else:
    print("AGC")

Submission status: Wrong Answer

Solution code:
R = int(input())
if R<2400:
    print("ARC")
elif R<1200:
    print("ABC")
else:
    print("AGC")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
 
rate = int(input("Enter your rate: "))
 
if rate < 1200:
    print("ABC")
elif rate >= 1200 and rate < 2800:
    print("ARC")
else:
    print("AGC")

Submission status: Wrong Answer

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

rate = int(input("Enter your rate: "))

if rate < 1200:
    print("ABC")
elif rate < 2800:
    print("ARC")
else:
    print("AGC")

Submission status: Wrong Answer

Solution code:
def solve(R): #104-A
    if 1200>R :
        return 'ABC'
    if 2800>R :
        return 'ARC'
    else:
        return 'AGC'

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S)
countc = 0
counta = 0
for m in range (3, n):
    if S[m-1] == 'C':
        countc = countc + 1
        S = S[:m-1] + 'c' + S[m:]
if S[1-1] == 'A':
    counta = 1
    S = 'a' + S[1:]
if(countc == 1 and counta == 1 and S.islower()):
    print('AC')
else:
    print('WA')

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S)
countc = 0
counta = 0
for m in range (3, n-1):
    if S[m-1] == 'C':
        countc = countc + 1
        S = S[:m-1] + 'c' + S[m:]
if S[1-1] == 'A':
    counta = 1
    S = 'a' + S[1:]
if(countc == 1 and counta == 1 and S.islower()):
    print('AC')
else:
    print('WA')

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S)
countc = 0
counta = 0
for m in range (3, n-1):
    if S[m-1] == 'C':
        countc = countc + 1
        S = S[:m-2] + 'c' + S[m:]
if S[1-1] == 'A':
    counta = 1
    S = 'a' + S[1:]
print(S)
print(counta, countc)
if(countc == 1 and counta == 1 and S.islower()):
    print('AC')
else:
    print('WA')

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S)
countc = 0
counta = 0
for m in range (3, n):
    if S[m-1] == 'C':
        countc = countc + 1
        S = S[:m-2] + 'c' + S[m:]
if S[1-1] == 'A':
    counta = 1
    S = 'a' + S[1:]
print(S)
print(counta, countc)
if(countc == 1 and counta == 1 and S.islower()):
    print('AC')
else:
    print('WA')

Submission status: Wrong Answer

Solution code:
S = input()
flag = False

if S[0] != 'A':
  flag = True

if S[2:-1].count('C') != 1:
  flag = True

if not S.replace('A', '').replace('C', '').islower():
  flag = True

if flag:
  print('WA')
else:
  print('AC')

Submission status: Wrong Answer

Solution code:

#B - AcCepted
S=str(input())
#print(S[0].isupper())
#print(S[1])
length=len(S)
cnt=0
flg=1
ans="WA"
if S[0]=='A' and S.count('C')==1:
    #S[0].replace('A','a')

    ans="AC"
    for i in range(1,length):
        if S[i].isupper() and S[i]!='C':
            ans="WA"
            break
        elif S[i]=='C':
            if i<1 or i>(length-2):
                ans="WA"
                break
print(ans)

Submission status: Wrong Answer

Solution code:
print("ABC" if int(input()) < 1200 else "ARC")

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
mod = 10 ** 9 + 7
dp = [[0] * 4 for i in range(n + 1)]
dp[0][0] = 1

for i in range(n):
    if s[i] == "A":
        dp[i + 1][1] = dp[i + 1][1] + dp[i][0]
        dp[i + 1][0] += dp[i][0]
        dp[i + 1][1] += dp[i][1]
        dp[i + 1][2] += dp[i][2]
        dp[i + 1][3] += dp[i][3]
    elif s[i] == "B":
        dp[i + 1][2] = dp[i + 1][2] + dp[i][1]
        dp[i + 1][0] += dp[i][0]
        dp[i + 1][1] += dp[i][1]
        dp[i + 1][2] += dp[i][2]
        dp[i + 1][3] += dp[i][3]
    elif s[i] == "C":
        dp[i + 1][3] = dp[i + 1][3] + dp[i][2]
        dp[i + 1][0] += dp[i][0]
        dp[i + 1][1] += dp[i][1]
        dp[i + 1][2] += dp[i][2]
        dp[i + 1][3] += dp[i][3]
    else:
        for j in range(4):
            dp[i + 1][j] += 3 * dp[i][j]
        dp[i + 1][1] += dp[i][0]
        dp[i + 1][2] += dp[i][1]
        dp[i + 1][3] += dp[i][2]
    for j in range(4):
        dp[i + 1][0] %= mod
        dp[i + 1][1] %= mod
        dp[i + 1][2] %= mod
        dp[i + 1][3] %= mod

print(dp[n][3] % mod)

Submission status: Wrong Answer

Solution code:
s = input()
l = len(s)
if s[0] !="A":
    print("WA")
else:
    s = s.replace(s[0],"a",1)
    index1 = s.find("C")
    s = s.replace(s[index1],"c",1)
    index2 = s.find("C")
    if index1==-1 or index2 != -1 or (index1 < 2 or index1 > l-3):
        print("WA")
    else:
        s_lower = s.lower()
        if s != s_lower:
            print("WA")
        else:
            print("AC")

Submission status: Wrong Answer

Solution code:
s = input()
l = len(s)
if s[0] !="A":
    print("WA")
else:
    s = s.replace(s[0],"a")
    index1 = s.find("C")
    index2 = s.find("C", 2)
    if index2 != -1 or (index1 < 2 or index1 > l-3):
        print("WA")
    else:
        s = s.replace("A","a")
        s_lower = s.lower()
        if s != s_lower:
            print("WA")
        else:
            print("AC")

Submission status: Wrong Answer

Solution code:
S = input()
L = len(S)
Q = 10**9 + 7
anum = [ 0 for _ in range(L+1)]
#bnum = [ 0 for _ in range(L+1)]
cnum = [ 0 for _ in range(L+1)]
hnum = [ 0 for _ in range(L+1)]
for i in range(1,L+1):
    if S[i-1] == 'A':
        anum[i] = anum[i-1] + 1
#        bnum[i] = bnum[i-1]
        cnum[i] = cnum[i-1]
        hnum[i] = hnum[i-1]
    elif S[i-1] == 'B':
        anum[i] = anum[i-1]
#        bnum[i] = bnum[i-1] + 1
        cnum[i] = cnum[i-1]
        hnum[i] = hnum[i-1]
    elif S[i-1] == 'C':
        anum[i] = anum[i-1]
#        bnum[i] = bnum[i-1]
        cnum[i] = cnum[i-1] + 1
        hnum[i] = hnum[i-1]
    else:
        anum[i] = anum[i-1]
#        bnum[i] = bnum[i-1]
        cnum[i] = cnum[i-1]
        hnum[i] = hnum[i-1] + 1

ans = 0
czen = cnum[L]
hzen = hnum[L] 
for i in range(1,L+1):
    if S[i-1] == 'B' or S[i-1] == '?':
        A = (anum[i-1]*(3**hnum[i-1]) + hnum[i-1]*(3**(hnum[i-1]-1)))%Q
        C = ((czen - cnum[i])*(3**(hzen - hnum[i])) + (hzen - hnum[i])*(3**(hzen - hnum[i]-1)))%Q
        K = (A*C)%Q
        ans = (ans + K)%Q
print(int(ans))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
 
modulo = 10 ** 9 + 7
 
S = input()
 
def nleft(S, c):
    """各位置について，それより左の文字列に含まれる文字 c の総数.
       左に'?'が含まれるときは，それらに文字を入れて得られるすべての
       文字列に渡って，文字 c の個数を合計する. """
 
    def _left(S, c):
        """各位置より左にある c の個数. """
        n = [0 for c in S]
        for i in range(1, len(n)):
            n[i] = n[i-1] + (1 if S[i-1] == c else 0)
        return n
 
    # c の個数, '?'の個数
    n = _left(S, c)
    q = _left(S, '?')
 
    for i in range(len(n)):
        n[i] *= (3 ** q[i]) % modulo               # ?の埋め方の数だけ増やす
        n[i] += (3 ** (q[i] - 1)) * q[i] % modulo  # ?に入る'C'の個数
        n[i] %= modulo
    return n
 
def nright(S, c):
    n = nleft(list(reversed(S)), c)
    n.reverse()
    return n
 
left  = nleft (S, 'A')
right = nright(S, 'C')
 
# 各文字が'B'のときのABC数を計算
abc = 0
for i in range(0, len(S)):
    if S[i] in 'B?':
        abc += left[i] * right[i]
 
abc = int(abc) % modulo
print(abc)

Submission status: Wrong Answer

Solution code:
import re

s = input()

if not s.startswith('A'):
    print('WA')
elif s[2:len(s) - 3].count('C') == 1:
    print('WA')
elif len(re.findall('[A-Z]', s)) != 2:
    print('WC')
else:
    print('AC')