TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N=input()
print(N.count("ABC"))

N=int(input())
S=input()
print(S.count("ABC"))

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
moji = str(input())
print(moji.count("ABC"))

N = int(input())
moji = str(input())
print(moji.count("ABC"))

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = int(input())
s = input()
ans = 0


for i in range(n-2):
    if s[i:i+3] == "ABC":
        res += 1

print(ans)

n = int(input())
s = input()
ans = 0


for i in range(n-2):
    if s[i:i+2] == 'ABC':
        res += 1

print(ans)

n = int(input())
 s = input()
 ans = 0
 for i in range(n - 2):
     if s[i:i+3] == 'ABC':
         ans += 1 
 print(ans) 

n = int(input())
s = input()
ans = 0


for i in range(n-2):
    if s[i:i+3] == "ABC":
        res += 1

print(ans)

n = int(input())
s = input()
ans = 0


for i in range(n):
    if s[i:i+3] == 'ABC':
        res += 1

print(ans)

n = int(input())
s = input()

print(s.count('ABC'))


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
txt = input().split("A")
n = 0
for cnt in txt:
  if cnt == "ABC":
    n += 1
print(n)

N = int(input())
txt = input().split("ABC")
print(str(N - len(txt) /3))

N = int(input())
txt = input().split("ABC")
print(N - len(txt) /3)

N = int(input())
txt = input().split("ABC")
print("(N - len(txt)) /3")

N = int(input())
S = lst(input())

cnt = 0

for i in range(0,4):
  if S[i] == "A" and S[i+1] == "C" and S[i+2] == "C":
    cnt += 1
    
print(cnt)

N = int(input())
S = list(input())

cnt = 0

for i in range(0,N-2):
  if S[i] == "A" and S[i+1] == "B" and S[i+2] == "C":
    cnt += 1
    
print(cnt)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
for i in range(0,n-2):
    if s[i] == 'A':
        if s[i+1] == 'B':
            if s[i+2] == 'C':
                c += 1
        
print(c)

n = int(input())
s = input()

c = 0

for i in range(0,n-2):
    if s[i] == 'A':
        if s[i+1] == 'B':
            if s[i+2] == 'C':
                c += 1
        
print(c)

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N = input() # Do Not use
S = input()
print(S.find("ABC"))

N = input() # Do Not use
S = input()
print(S.count("ABC"))

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = int(input())
s = input()
print(s.count("abc"))

n = int(input())
s = input()
print(s.count("ABC"))

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
input()
s = input()
i = s.find('ABC')
n = 0
while i != -1:
  i = s.find('ABC')
  s = s[i + 3:]
print(n)


input()
s = input()
i = s.find('ABC')
n = 0
while i != -1:
  i = s.find('ABC'[i+3:])
print(n)


input()
s = input()
n = 0
i = 0
while i != -1:
  i = s.find('ABC')
  s = s[i+3:]
  n += 1
print(n-1)


Verdicts: Wrong Answer

Time Limit Exceeded

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
# -*- coding: utf-8 -*-
cnt = int(input())
str = input()
print(srt.count('ABC'))

cnt = int(input())
s = input()
print(s.count('ABC'))

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
A=int(input())
B=input().split()
print(B.count("ABC"))


A=int(input())
B=input()
print(B.count("ABC"))


Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = int(input())
s = input()
ans = 0
for i in range(n-2):
  if s[i:i+3] == "ABC":
    ans += 1
print(ans

n = int(input())
s = input()
ans = 0
for i in range(n-2):
  if s[i:i+3] == "ABC":
    ans += 1
print(ans)

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline().strip()
i = 0
cnt = 0
while i <= n -3:
  if s[i:i+3] == 'ABC':
    cnt += 1
print(cnt)

import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline().strip()
print(s.count('ABC'))

Verdicts: Time Limit Exceeded

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = int(input())
s = input()
cnt = 0
for i in range(0, n-2):
    if s[i:i+3] == "ABC":
        cnt += 1
    print(i)
print(cnt)

n = int(input())
s = input()
cnt = 0
for i in range(0, n-2):
    if s[i:i+3] == "ABC":
        cnt += 1
print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
S=input()
print(S.count('ABC'))

N=int(input())
S=input()
print(S.count('ABC'))

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
l = int(input())
 
word = input()
 
counter = 0
for i in range(len(word)):
  if len(word[i:]) >= 3:
    print(word[i:i+3])
    if word[i:i+3] == 'abc':
      counter += 1
      
print(counter)

l = int(input())
 
word = input()
 
counter = 0
for i in range(len(word)):
  if len(word[i:]) >= 3:
    if word[i:i+3] == 'abc':
      counter += 1
      
print(counter)

l = int(input())

word = input()

counter = 0
for i in range(len(word)):
  if len(word[i:]) >= 3:
    if word[i:i+2] == 'abc':
      counter += 1
      
return counter

l = int(input())
 
word = input()
 
counter = 0
for i in range(len(word)-2):
  if word[i:i+3] == 'ABC':
    counter += 1
      
print(counter)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
print(input().count('ABC'))

n=input()
print(input().count('ABC'))

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N = int(input())
S = input()
c = 0
for i in range(N-2):
  S[i] + S[i+1] + S[i+2] == 'ABC'
  c += 1
print(c)


N = int(input())
S = input()
c = 0
for i in range(N-2):
  if (S[i] + S[i+1] + S[i+2]) == 'ABC':
    c += 1
print(c)

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
S = input()
print(S.count('ABC'))

N = int(input())
S = input()
print(S.count('ABC'))

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
k, x = input().split()
k = int(k) * 500
if (k >= int(x)):
    print("Yes")
else:
    print("No")

n = input()
s = input()
if (len(s) == int(n)):
    print(s.count("ABC"))

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
a = input()
print(a.count('ABC'))

a = input()
b = input()
print(b.count('ABC'))


Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
_ = input()
S = input()
newS = S.replace("ABC", "")
print(S, newS)
print((len(S) - len(newS)) // 3)

_ = input()
S = input()
newS = S.replace("ABC", "")
print((len(S) - len(newS)) // 3)

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N = list(int(input())
S = list(input())
S.count('ABC')

N = int(input())
S = input()
S.count('ABC')

S = input()
S.count('ABC')

n = int(input())
s = input()
print (s.count('ABC'))

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

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

count=0
for i in range ((len(s1))-2):
    if(s1[i]=='A' and s1[i+1]=='B' and s1[i+2]=='C'):
        count=count+1
    
print(count)


n=input()
s1= input()

count=0
for i in range(len(s1)-2):
    if(s1[i]=='A' and  s1[i+1]=='B' and s1[i+2]=='C'):
        count=count+1

print(count)

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N = int(input())
S = input()
ctr = 0
for i in range (N):
  if S(i) == 'A' and S(i+1) == 'B' and S(i+2) == 'C':
    ctr += 1
print(ctr)

N = int(input())
S = input()
print(S.count('ABC'))

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N = int(input())
S = input()

count = 0
for i in range(n-2):
  if S[k:k+3] == "ABC":
    count +=1
print("%d"%(count))    

N = int(input())
S = str(input())

count = 0
for i in range(N):
  if i == "ABC":
    count += 1
print("%d"%(count)    

N = int(input())
S = input()
ans = 0
for i in range(N-2):
  if s[i:i+3] == 'ABC':
    ans += 1
print(ans)

n = int(input())
s = input()
ans = 0
for i in range(n-2):
  if s[i:i+3] == 'ABC':
    ans += 1
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n=map(int,input())
s=str(input())

count=0
for i in range(n-2):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                count+=1

print(count)

n=map(int,input())
s=list(map(str,input()))

count=0
for i in range(n-2):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                count+=1

print(count)

n=int(input())
s=str(input())

count=0
for i in range(n-2):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                count+=1

print(count)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N = int(input)
S = input()
count = 0
if N >= 3 and N <= 50:
	for i in range(1,N-1):
  		if S[i-1] + S[i] + s[i+1] == "ABC":
    	count = count + 1
print (count)

S = input()
N = int(input())
count = 0
S = S.split('ABC')
for i in S:
    if i == '':
        count += 1
    else: continue
print (count)

S = input()
N = int(input())
count = 0
S = S.split('ABC')
for i in S:
    if i == '':
        count += 1
    else: continue
print (count)

N = int(input())
S = input()
count = 0
for i in range(1,N-1):
  if S[i-1] + S[i] + s[i+1] == "ABC":
    count = count + 1
print (count)

N = int(input)
S = input()
count = 0
for i in range(1,N-1):
  if S[i-1] + S[i] + s[i+1] == "ABC":
    count += 1
	print (count)

S = input()
N = int(input())
count = 0
a = S.split('ABC')
for i in a:
    if i == '':
        count += 1
    else: continue
print (count)

N = int(input)
S = input()
count = 0
for i in range(1,N-1):
  if S[i-1] + S[i] + s[i+1] == "ABC":
    count = count + 1
print (count)

S = input()
N = int(input())
count = 0
d = ''
for j in S:
    d += j
    if len(d) == N:break
a = d.split('ABC')
for i in a:
    if i == '':
        count += 1
    else: continue
print (count)


N = int(input())
S = input()
count = 0
for i in range(1, N - 1):
  if S[i-1] + S[i] + S[i + 1] = 'ABC':
    count += 1
print (count)

S = input()
N = int(input())
count = 0
if N >= 3 and N <= 50:
	d = ''
	for j in S:
    	d += j
    	if len(d) == N:break
	a = d.split('ABC')
	for i in a:
    	if i == '':
        	count += 1
    	else: continue
print (count)

N = int(input())
S = input()
print(S.count("ABC"))

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

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

if int(n) >= 3 and int(n) =< 50:
    print(s.count('ABC'))

n = int(input())
s = input()

print(s.count('ABC'))

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
s = input().split()[1]
print(s.count("ABC"))

s = input().split()[1]
s.count("ABC")

s = input()
s = input()
print(s.count("ABC"))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
s=input()
print(s.count("ABC"))


n=int(input())
s=input()
ans=0
for i in range(n-2):
  if s[i]=="A" and s[i+1]=="B" and s[i+2]=="C":
    ans+=1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N=int(input())
S=input()
ans=0
for i in range(n-2):
	if S[i]+S[i+1]+S[i+2]=='ABC':
		ans+=1
print(ans)

n=int(input())
s=input()
ans=0
for i in range(n-2):
	if s[i]+s[i+1]+s[i+2]=="ABC":
		ans += 1
print(ans)

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
S = input()
ans = 0

for i in range(2, len(S)):
  if S[i-2] == 'A' and S[i-1] == 'B' and S[i] == 'C':
    ans += 1
print(ans)

S = input()
ans = 0

for i in range(2, len(S) + 1):
  if S[i-2] == 'A' and S[i-1] == 'B' and S[i] == 'C':
    ans += 1
print(ans)


N = input()
S = input()
print(S.count("ABC"))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

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

print(s.count('abc'))

N = int(input())
S = input()
 
print(S.count('ABC'))

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

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

query = 'ABC'
ans = 0
i = 0 
while i<n:
  i = s.find(query,i)
  print(i)
  if i>=0:
    ans +=1
    i+=1
  else:
    break    

print(ans)    

n = int(input())
s = input()

query = 'ABC'
ans = 0
i = 0 
while i<n:
  i = s.find(query,i)  
  if i>=0:
    ans +=1
    i+=1
  else:
    break    

print(ans)    

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = int(input())
s = input()
c=0
for i in range(n - 2):
    print(s[i:i + 3])
    if s[i:i + 3] == 'ABC':
        c += 1
print(c)

n = int(input())
s = input()
c=0
for i in range(n - 2):
    print(s[i:i + 3])
    if s[i:i + 3] == 'ABC':
        c += 1
print(c)

n = int(input())
s = input()
c=0
for i in range(n - 2):
    if s[i:i + 3] == 'ABC':
        c += 1
print(c)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
import re

n = int(input())
s = input()

abc = re.compile('ABC')

count = abc.findall(s)
print(count)

import re
 
n = int(input())
s = input()
 
abc = re.compile('ABC')
 
count = len(abc.findall(s))
print(count)

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = int(input())
s = input()
count = 0
for i in range(n-2):
  print(s[i:i+3])
  if s[i:i+3] == "ABC":
    count += 1
print(count)


n = int(input())
s = input()
count = 0
for i in range(n-2):
  if s[i:i+3] == "ABC":
    count += 1
print(count)


Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = int(input())
s = input()
x = list(s)
y = 0
a = 0
while y <= n - 3:
  z = x[y] + x[y + 1] + x[y + 2]
  if z == "abc":
    a += 1
    y += 1
  else:
    a += 0
    y += 1

print(a)


n = int(input())
s = input()
x = list(s)
y = 0
a = 0
while y <= n - 3:
  z = x[y] + x[y + 1] + x[y + 2]
  if z == "ABC":
    a += 1
    y += 1
  else:
    a += 0
    y += 1
print(a)

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = input()
s = input()
x = 0
for i in range(n - 2)
	if s[i:3] == "ABC"
  		x += 1

n = int(input())
s = input()
x = 0

for i in range(n-2):
    if s[i:i+3] == "ABC":
        x += 1

print(x)

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N=int(input())
S=input()

S=S.replace("ABC","")
print((N-len(S))/3)


N=int(input())
S=input()

count=0
for i in range(N-2):
    if S[i:i+3]=="ABC":
        count+=1

print(count)


Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N = int(input())
S = input()
list = [str(x) for x in S]
index = 0
abc = 0
for alphabet in list:
  if alphabet == "A" and list[index + 1] == "B" and list[index + 2] == "C":
    abc += 1
  index += 1
if index != N - 1:
  break
print(abc)

n = int(input())
s = input()
print(count("ABC"))

n = int(input())
s = input()
print(s.count("ABC"))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
string = input()
print(string.count("ABC")) 

n = int(input())
s = str(input().upper())
print(s.count("ABC"))

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N = int(input())
S = input()
length = len(S)
num = 0
print(length)
for i in range(length-2) :
  if S[i:i+3] == "ABC" :
    num += 1
print(num)

N = int(input())
S = input()
length = len(S)
num = 0
for i in range(length-2) :
  if S[i:i+3] == "ABC" :
    num += 1
print(num)

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = int(input())
s = input()
print(s.find('ABC'))

n = int(input())
s = input()
print(s.count("ABC"))


Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = int(input())
S = input()
A = 0
for i in range(n-3):
  clipped_S = S[i:i+2]
  if clipped_S == "ABC"
    A += 1
print(A)

n = int(input())
S = input()
A = 0
for i in range(n-2):
  clipped_S = S[i:i+3]
  if clipped_S == "ABC":
    A += 1
print(A)

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
s=input()
a=0
a=s.count('ABC')
print(a)

n=int(input())
s=input()
a=s.count('ABC')
print(a)

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n=int(input())
s=int(input())
print(s.count("ABC"))

n=int(input())
s=input()
print(s.count("ABC"))

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
import re

input()
print(len(re.findall('ABC', input()))


import re

input()
print(len(re.findall(input(), 'ABC'))

import re

input()
print(len(re.findall('ABC', input())))


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
num = int(input())
word = input()
if len(word) >= num:
    print(word[0:num].count('ABC'))
print(0)      
       


num = int(input())
word = input()
if len(word) >= num:
    print(word[0:num].count('ABC'))
else:
    print(0)   

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
S = input()
print(S.count('ABC'))

n = int(input())
S = input()
print(S.count('ABC'))

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N = int(input())
s = input()
cnt = 0
for i in range(N-2):
  print(s[i:i+3])
  if s[i:i+3] =="ABC":
    cnt += 1
print(cnt)

N = int(input())
s = input()
cnt = 0
for i in range(N-2):
  if s[i:i+3] =="ABC":
    cnt += 1
print(cnt)

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
import itertools
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
L = list(map(list,list(itertools.permutations(list(i for i in range(1,N+1)),N))))
a = L.index(P)
b = L.index(Q)
print(abs(a-b))

import itertools
import math
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
L = list(map(list,list(itertools.permutations(list(i for i in range(1,N+1)),N))))
a = L.index(P)
b = L.index(Q)
print(abs(a-b))

N = int(input())
S = str(input())
print(S.count("ABC"))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
print(input().count('ABC'))

input(); print(input().count("ABC"))

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N=int(input())
S=input()
result=0
for i in range(N):
  if [i:i+3]=='ABC':
    result+=!
print(result)


N=int(input())
S=input()
result=0
for i in range(N):
  if [i:i+3]=='ABC':
    result+=1
print(result)


N=int(input())
S=input()
count=0
for i in range(N):
  if S[i:i+3]=='ABC':
    count+=1
print(count)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str[i+2] == "C"):
        ans += 1

print(ans)

N, S = map(str, input().split())
N = int(N)

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str[i+2] == "C"):
        ans += 1

print(ans)

N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    pass
    if(str_list[i+1] == "B"):
      pass
      if(str[i+2] == "C"):
        ans += 1

print(ans)

N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    ans = ans
    if(str_list[i+1] == "B"):
      ans = ans
      if(str[i+2] == "C"):
        ans += 1

print(ans)


N, S = map(str, input().split())
N = int(N)

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == A):
    if(str_list[i+1] == B):
      if(str[i+2] == C):
        ans += 1

print(ans)

N = int(input())
S = input()

ans = 0
str_list = list(S)

for i in range (len(str_list)-2):
  if(str_list[i] == "A"):
    if(str_list[i+1] == "B"):
      if(str_list[i+2] == "C"):
        ans += 1

print(ans)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

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

i = -1
c = 0

while True:
	i = s.find('ABC', i + 1)
	if i == -1:
		break
	c++
print(c)

n = int(input())
s = input()

i = -1
c = 0

while True:
	i = s.find('ABC', i + 1)
	if i == -1:
		break
	c += 1
print(c)

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = int(input())
s = input()
ls = s.replace("ABC","")
print(ls)
print((n-len(ls))//3)

n = int(input())
s = input()
ls = s.replace("ABC","")
print((n-len(ls))//3)

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
C010_scrambled

N = int(input())
S = input().strip()
ans = 0
for i in range(N-2):
    if S[i:i+3] == 'ABC':
        ans += 1
print(ans)


Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
a = input()
b = a.count('ABC')
print(b)

c=input()
a = input()
b = a.count('ABC')
print(b)


Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = int(input())
s = str(inout())

ans = 0

for i in range(n-2):
    if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
        ans += 1
    else:
        continue
      
print(ans)


n = inr(input())
s = str(inout())

ans = 0

for i in range(n):
	if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
      ans += 1
    else:
      continue
      
print(ans)

n = int(input())
s = str(input())
 
ans = 0
 
for i in range(n-2):
    if s[i] == "A" and s[i+1] == "B" and s[i+2] == "C":
        ans += 1
    else:
        continue
      
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):

n = input()
s = input()

results = re.findall(r"ABC", s)

print(len(results))

import re


n = input()
s = input()

results = re.findall(r"ABC", s)

print(len(results))

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = int(input())
s = input()
pat = "ABC"

ans =0
i=0
while i < n:
  if pat = s[i:len(pat)]:
    ans+=1

print(ans)

n = int(input())
s = input()
pat = "ABC"

ans = 0
i = 0
while i < n:
    if pat == s[i : i + len(pat)]:
        ans += 1
    i += 1

print(ans)


Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N = int(input())
S = int(input())
print(S.count('ABC'))

N = int(input())
S = input()
print(S.count('ABC'))

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N = int(input())
S = input()
ans = 0
if N > 3:
  for i in range(N-3):
  	if S[i:i+3] == "ABC":
    	ans += 1
else:
  ans = 1 if S == "ABC" else 0
print(ans)

N = int(input())
S = input()
ans = 0
if N > 3:
  for i in range(N-2):
    if S[i:i+3] == "ABC":
      ans += 1
else:
  ans = 1 if S == "ABC" else 0
print(ans)

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
n = int(input())
S = list(input())
print(n,S)

# coding: utf-8
# Your code here!
n = int(input())
S = list(input())
#print(len(S))
count = 0
count_total = 0
for moji in S:
    if moji == 'A':
        count = 'A'
    elif count == 'A' and moji == 'B':
        count = 'B'
    elif count == 'B' and moji == 'C':
        count = 0
        count_total += 1
    else:
        count = 0
    
print(count_total)

Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
N = int(input())
S = input()

new_S = S.replace("ABC", "@")

print(new_S)
print(new_S.count("@"))


N = int(input())
S = input()

new_S = S.replace("ABC", "@")

print(new_S.count("@"))


Verdicts: Wrong Answer

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
b, c = map(str, input().split())
print(c.count('ABC'))

a = input()
b = input()
print(b.count('ABC'))

Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
def abc151_b():
    N, K, M = map(int, input().split())
    A = sum(list(map(int, input().split())))
    need = max(0, N * M - A)
    ans = need if need <= K else - 1
    print(ans)

abc151_b()

N = int(input())
s = input()

ans = 0
for x, y, z in zip(s[:-2], s[1:-1], s[2:]):
    if x + y + z == "ABC":
        ans += 1
print(ans)


Verdicts: Runtime Error

Accepted
Problem: We have a string S of length N consisting of uppercase English letters.  How many times does `ABC` occur in S as contiguous subsequences (see Sample Inputs and Outputs)?

Submission attempts (in order):
print(input().count("ABC"))

print(input().count("ABC"))

input()
print(input().count("ABC"))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.  Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N):    * There exists a non-negative integer p such that X= a_k \times (p+0.5).  Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).

Submission attempts (in order):
# from math import sqrt
# from heapq import heappush, heappop
# from collections import deque
from functools import reduce

# a, b = [int(v) for v in input().split()]


def main():
    N, M = [int(v) for v in input().split()]
    A = list(set([int(v) // 2 for v in input().split()]))

    def gcd(v1, v2):
        while v1 % v2 != 0:
            tmp = v2
            v2 = v1 % v2
            v1 = tmp
        return v2

    def lcm(v1, v2):
        return v1 * v2 // gcd(v1, v2)

    alcm = 1
    for a in A:
        d = gcd(alcm, a)
        lcm = lcm * a // d
        if alcm > M:
            print(0)
            exit()

    

    if a_lcm > M:
        print(0)
    else:
        print((M // a_lcm + 1) // 2)


main()


# from math import sqrt
# from heapq import heappush, heappop
# from collections import deque
from functools import reduce

# a, b = [int(v) for v in input().split()]


def main():
    N, M = map(int, input().split())
    A = [int(v) // 2 for v in input().split()]

    def gcd(v1, v2):
        v = v1 % v2
        if v == 0:
            return v2
        return gcd(v2, v)

    def lcm(v1, v2):
        return v1 * v2 // gcd(v1, v2)

    lcma = reduce(lcm, A)

    if next(filter(lambda v: (lcma // v) % 2 == 0, A), None) is not None:
        print(0)
        exit()

    print((M + lcma) // (2 * lcma))


main()


Verdicts: Runtime Error

Accepted
Problem: Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.  Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N):    * There exists a non-negative integer p such that X= a_k \times (p+0.5).  Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).

Submission attempts (in order):
from functools import reduce
def f(n):
    res = 0
    while(n%2 == 0):
        res += 1
        n //= 2
    return res

def gcd(a, b):
    return a if b == 0 else gcd(b, a%b)

def lcm(a, b):
    return a // gcd(a, b) * b

n, m = map(int, input().split())
A = list(map(lambda x: int(x) // 2, input().split()))

F = set()
for a in A:
    F.add(f(a))
if(len(F) != 1):
    print(0)
    exit()

l = reduce(lcm, A, 1)
for a in A:
    if((l // a) % 2 == 0):
        print(0)
        exit()

ans = (m // 2 +1) // l
print(ans)

from functools import reduce
def f(n):
    res = 0
    while(n%2 == 0):
        res += 1
        n //= 2
    return res

def gcd(a, b):
    return a if b == 0 else gcd(b, a%b)

def lcm(a, b):
    return a // gcd(a, b) * b

n, m = map(int, input().split())
A = list(map(lambda x: int(x) // 2, input().split()))

l = reduce(lcm, A, 1)
for a in A:
    if((l // a) % 2 == 0):
        print(0)
        break

else:
    ans = (m // l +1) // 2
    print(ans)

Verdicts: Wrong Answer

Accepted
Problem: Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.  Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N):    * There exists a non-negative integer p such that X= a_k \times (p+0.5).  Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).

Submission attempts (in order):
from math import gcd, ceil
from functools import reduce
import sys

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N, M = map(int, input().split())
a = [int(i)//2 for i in input().split()]

if N == 1:
    print((M//a[0]+1)//2)
    sys.exit()

A = []
s = set()
for x in a:
    cur = 0
    y = x
    while y%2 == 0:
        cur += 1
        y //= 2
    s.add(cur)
    if len(s) >= 2:
        print(0)
        sys.exit()
lcm = lcm_list(A)
print((M//lcm+1)//2)

from math import gcd, ceil
from functools import reduce
import sys

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

N, M = map(int, input().split())
a = [int(i)//2 for i in input().split()]

s = set()
for x in a:
    cur = 0
    y = x
    while y%2 == 0:
        cur += 1
        y //= 2
    s.add(cur)
    if len(s) >= 2:
        print(0)
        sys.exit()
lcm = lcm_list(a)
print((M//lcm+1)//2)

Verdicts: Wrong Answer

Accepted
Problem: Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.  Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N):    * There exists a non-negative integer p such that X= a_k \times (p+0.5).  Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).

Submission attempts (in order):
def prime_factor(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr


try:
    from math import gcd
except ImportError:
    from fractions import gcd

n, m = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]

n = 1
for a in A:
    n = (n*a)//gcd(n, a)
if n > m*2:
    ans = 0
else:
    ans = 2*m//n+1


print(ans)


def prime_factor(n):
    arr = []
    temp = n
    for i in range(2, 3):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr


try:
    from math import gcd
except ImportError:
    from fractions import gcd

n, m = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]

n = 1
c = prime_factor(A[0])[0][1]
for a in A:
    if c != prime_factor(a)[0][1]:
        print(0)
        exit()
    n = (n*a)//gcd(n, a)

n //= 2

if n > m:
    ans = 0
else:
    ans = m//n
    ans = (ans+1)//2

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.  Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N):    * There exists a non-negative integer p such that X= a_k \times (p+0.5).  Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).

Submission attempts (in order):
N, M = list(map(int, input().split(" ")))
list_a = list(map(int, input().split(" ")))


def check_exist(l) :
  if(len(l) == 1) :
    return True
  while(True) :
    flag = l[0] % 2
    for x in l[1:] :
      if(x % 2 != flag) :
        return False
    if(flag == 0) :
      l = list(map(lambda x: int(x/2), l))
    else :
      return True
    



def gcd(a, b) :
  print(a)
  if(b==0) :
    return a
  else :
    return gcd(b, a%b)
   

def lcm(a, b) :
  cd = gcd(a, b)
  return a * b / cd
  

def lcm_multi(l) :
  if(len(l) < 2) :
    return l[0]
  cm = lcm(l[0], l[1])
  for i in range(2, N) :
    cm = lcm(l[i], cm)
    if(cm > M) :
      print(0)
      exit()
    
  return cm

if(not(check_exist(list_a))) :
  print(0)
  exit()

lcm_m = lcm_multi(list_a)
if(M-lcm_m/2 < 0) :
  print(0)
else :
  print(int((M-lcm_m/2) / lcm_m) + 1)



N, M = list(map(int, input().split(" ")))
list_a = list(map(int, input().split(" ")))



def gcd(a, b) :
  if(b==0) :
    return a
  else :
    t = a - b
    if(m > t) :
      return gcd(m, t)
    else :
      return(b, a%b)
   

def lcm(a, b) :
  return a * b / gcd(a, b)
  

def lcm_multi(l) :
  if(len(l) < 2) :
    return l[0]
  res = lcm(l[0], l[1])
  for i in range(2, N) :
    res = lcm(l[i], res)
    
  return res

ans = 0
lcm_m = lcm_multi(list_a)

if(M-lcm_m/2 < 0) :
  print(0)
else :
  print(int((M-lcm_m/2) / lcm_m) + 1)


N, M = list(map(int, input().split(" ")))
list_a = list(map(int, input().split(" ")))



def gcd(a, b) :
  if(b==0) :
    return a
  else :
    return(b, a%b)
   

def lcm(a, b) :
  return a * b / gcd(a, b)
  

def lcm_multi(l) :
  if(len(l) < 2) :
    return l[0]
  res = lcm(l[0], l[1])
  for i in range(2, N) :
    res = lcm(l[i], res)
    
  return res

ans = 0
lcm_m = lcm_multi(list_a)

if(M-lcm_m/2 < 0) :
  print(0)
else :
  print(int((M-lcm_m/2) / lcm_m) + 1)


N, M = list(map(int, input().split(" ")))
list_a = list(map(int, input().split(" ")))


def check_exist(l) :
  if(len(l) == 1) :
    return True
  while(True) :
    flag = l[0] % 2
    for x in l[1:] :
      if(x % 2 != flag) :
        return False
    if(flag == 0) :
      l = list(map(lambda x: int(x/2), l))
    else :
      return True
    



def gcd(a, b) :
  if(b==0) :
    return a
  else :
    return gcd(b, a%b)
   

def lcm(a, b) :
  cd = gcd(a, b)
  return (a / cd) * b
  

def lcm_multi(l) :
  cm = 1
  for x in l :
    cm = lcm(x, cm)
    if(cm > 4 * M) :
      print(0)
      exit()
    
  return cm

if(not(check_exist(list_a))) :
  print(0)
  exit()


lcm_m = lcm_multi(list(map(lambda x: int(x/2), list_a)))

if(M-lcm_m < 0) :
  print(0)
else :
  print(int((M-lcm_m) / (2*lcm_m)) + 1)



Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.  Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N):    * There exists a non-negative integer p such that X= a_k \times (p+0.5).  Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).

Submission attempts (in order):
def gcd(n, m):
    if m == 0: return n
    return gcd(m , n%m)

def lcm(n, m): 
    g = gcd(n, m)
    return n * m // g

N, M = map(int, input().split())
A = list(map(int, input().split()))
res = 1
for i in range(0, N):
    res = lcm(res, A[i])

if res // 2 > M: print(0)
else: print((M + res//2 + res - 1) // res)



def gcd(n, m):
    if m == 0: return n
    return gcd(m , n%m)

def lcm(n, m): 
    g = gcd(n, m)
    return n * m // g

N, M = map(int, input().split())
A = list(map(int, input().split()))
res = 1
for a in A:
    res = lcm(res, a)

cnt = 0
while A[0] % 2 == 0:
    A[0] //= 2;
    cnt += 1

ok = True
for i in range(1, N):
    c = 0
    while A[i] % 2 == 0:
        A[i] //= 2;
        c+= 1
    if cnt != c :ok = False
    
if res // 2 > M or ok == False: print(0)
else: print((M + res//2 ) // res)



Verdicts: Wrong Answer

Accepted
Problem: Given are a sequence A= {a_1,a_2,......a_N} of N positive even numbers, and an integer M.  Let a _semi-common multiple_ of A be a positive integer X that satisfies the following condition for every k (1 \leq k \leq N):    * There exists a non-negative integer p such that X= a_k \times (p+0.5).  Find the number of semi-common multiples of A among the integers between 1 and M (inclusive).

Submission attempts (in order):
import math
from functools import reduce

n,m = map(int, input().split())
A = list(map(int, input().split()))

def lcm_base(x,y):
  return x*y//math.gcd(x,y)

def lcm(target_list):
  return reduce(lcm_base, target_list)

if reduce(math.gcd, A)%2:
  min_x = int(lcm(A)*0.5)
  ans = m//min_x - m//(2*min_x)
  print(ans)
else:
  print(0)

import math
from functools import reduce

n,m = map(int, input().split())
A = list(map(int, input().split()))

def lcm_base(x,y):
  return x*y//math.gcd(x,y)

def lcm(target_list):
  return reduce(lcm_base, target_list)

A_gcd = reduce(math.gcd, A)
flg = True

for a in A:
  if a//A_gcd%2==0:
    flg = False
    break
    
if flg:
  min_x = int(lcm(A))//2
  ans = m//min_x - m//(2*min_x)
  print(ans)
else:
  print(0)

Verdicts: Wrong Answer

Accepted