Problem:


Score : 100 points

Problem Statement

This contest is CODEFESTIVAL, which can be shortened to the string CF by deleting some characters.  

Mr. Takahashi, full of curiosity, wondered if he could obtain CF from other strings in the same way.  

You are given a string s consisting of uppercase English letters.
Determine whether the string CF can be obtained from the string s by deleting some characters.

Constraints

2 ≤ |s| ≤ 100

All characters in s are uppercase English letters (A-Z).

Input

The input is given from Standard Input in the following format:

s

Output

Print Yes if the string CF can be obtained from the string s by deleting some characters.
Otherwise print No.

Sample Input 1

CODEFESTIVAL

Sample Output 1

Yes

CF is obtained by deleting characters other than the first character C and the fifth character F.

Sample Input 2

FESTIVALCODE

Sample Output 2

No

FC can be obtained but CF cannot be obtained because you cannot change the order of the characters.

Sample Input 3

CF

Sample Output 3

Yes

It is also possible not to delete any characters.

Sample Input 4

FCF

Sample Output 4

Yes

CF is obtained by deleting the first character.



Sample input:
CODEFESTIVAL


Sample output:
Yes

Submission status: Runtime Error

Solution code:
s=input()
c=[]
f=[]
for num in range(len(s)):
    if s[num] == 'C':
        c.append(num)
    if s[num] == 'F':
        f.append(num)
print('Yes') if min(c) < max(f) else print('No')

Submission status: Runtime Error

Solution code:
import re
print(["No", "Yes"][re.Match("C.*F", input())])

Submission status: Runtime Error

Solution code:
s = input()
flag = 0
for i in len(range(s)):
  if s[i]=="C":
    flag=1
  if s[i]=="F" and flag==1:
    flag=2
if flag>1:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
s = input()
flag = 0
for i in len(range(s)):
  if s[i]=="C":
    flag=1
  if s[i]=="F" and flag=1:
    flag=2
if flag>1:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
s= input()
a=0
b=0
for i in range(len(s)):
  if s[i]=='C':
    a += i
  elif s[i]=='F':
    b += i
if a,b!=0 and a<b:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
#include<cstring>
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
    ////find函数返回类型 size_type
    string s,r;
    string::size_type position;
    //find 函数 返回jk 在s 中的下标位置
    cin>>s;
    position = s.find('C');
    if (position == s.npos)  //如果没找到，返回一个特别的标志c++中用npos表示，我这里npos取值是4294967295，
    {
        cout<<"No";
        return 0;
    }
   	position = s.find('F');
   	if (position == s.npos) {
   		cout<<"No";
   		return 0;
	   }
	cout<<"Yes";
}

Submission status: Runtime Error

Solution code:
s = input()
res = [i for i in s if i == 'C' or i == 'F']
print('Yes' if res[0] + res[1] == 'CF' or res[1] + res[2] == 'CF' else'No')

Submission status: Runtime Error

Solution code:
s = input()
flag = False
for i in range(len(s)):
    if s[i] == "C":
        flag = True
        break


if flag:
    flag = False
    for j in range(len(s)-1, -1, -1):
        if s[j] == "F":
            flag = True
            break

print("Yes" if i < j and flag else "No")

Submission status: Runtime Error

Solution code:
s = input()
flag = False
for i in range(len(s)):
    if s[i] == "C":
        flag = True
        break


if flag:
    flag = False
    for j in range(len(s)-1, 0, -1):
        if s[j] == "F":
            flag = True
            break

print("Yes" if i < j and flag else "No")

Submission status: Runtime Error

Solution code:
a=input()
c=False
f=False
for i in range(len(a)):
  if c==True:
    if a[i]=='F':
    f=True
  else:
    if a[i]=='C':
    c=True
if c==True and f==True:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a=input()
c=False
f=False
for i in range(len(a))
  if c==True:
    if a[i]=='F':
    f=True
  else:
    if a[i]=='C':
    c=True
if c==True and f==True:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a=input()
c=False
f=False
for i in range(len(a))
  if c==True:
    if a[i]=='F'
    f=True
  else:
    if a[i]=='C'
    c=True
if c==True and f==True:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a=input()
c=False
f=False
for i in range(len(a))
  if c:
    if a[i]=='F'
    f=True
  else:
    if a[i]=='C'
    c=True
if c and f:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
s = input()
a = s.find('C')

if a == -1:
    print("No")
else:
    if s[a:].find('F') == -1:
        print("No")
    else print("Yes")

Submission status: Runtime Error

Solution code:
s=input()
x=0;y=0
for i in range(len(s)):
  if s[i]=='C':
    x=i+1
    break
for j in range(len(s)):
  if s[j]=='F':
    y=j+1
if x*y!=0 and x<y:print('Yes')
else:print('No')​

Submission status: Runtime Error

Solution code:
print<>=~/C.*F/?Yes:No,$/

Submission status: Runtime Error

Solution code:
s = input()
if s.index('C') < s.rindex('F'):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
s = input()
if "F" in s[s.index("C"):]:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s = input()
list = []
for i in s:
    if i == 'C':
        list.append(i)
    elif i == 'F':
        list.append(i)
    else:
        pass

if list[0] == 'C' and list[1] == 'F':
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
int main() 
{
    char a[10010];
    bool c, f;
    fgets(a,10010,stdin);
    for(int i=1;i<=strlen(a);i++) 
    {
        if(a[i]=='C') 
        {
            for(int j=i+1;j<=strlen(a)-i;j++)
            {
                if(a[j]=='F')
                {
                    printf("Yes\n");
                    return 0;
                }
            }
        }
    }
    printf("No\n");
    return 0;
}

Submission status: Runtime Error

Solution code:
at2084
n = list(input())
c = n.count('C')
f = n.count('F')
for i in range(len(n)):
    if c >= 1 and f >= 1:
        print('Yes')
    else:
        print('No')

Submission status: Runtime Error

Solution code:
strstart = input()
wzc = 0
wzf = 0
for i in strstart:
    i2 += 1
    if i == 'C':
        wzc = i2
    if i == 'F':
        wzf = i2
if wzc < wzf:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
#AT2084
s = list(input())
a = []
for i in s:
    if i == 'C' or i == 'F':
        a.append(i)
if a[0] == 'C' and a[1] == 'F' and len(a) == 2:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
strstart = input()
wzc = 0
wzf = 0
for i in strstart:
    i2 += 1
    if i == 'c':
        wzc = i2
    if i == 'F':
        wzf = i2
        break
if wzc < wzf:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
strstart = input()
for i in strstart:
    if i == 'C':
        wzc = i
        break
for i in strstart:
    if i == 'F':
        wzf = i
        break
if wzc < wzf:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
strstart = input()
for i in strstart:
    if i == 'C':
        wzc = i
    if i == 'F':
        wzf = i
if wzc < wzf:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
def main()
    s = input()
    f = False
    if s.count('C') == 0 or s.count('F') == 0:
        print('NO')
        return
    for i in range(len(s)):
        if s[i] == 'C':
            for j in range(i, len(s)):
                if s[j] == 'F':
                    print('Yes')
                    f = True
                    break
            if f == False:
                print('No')
main()

Submission status: Runtime Error

Solution code:
import sys
S = input().strip()

for j in range(len(S)):
  for k in range(j+1,len(S)):
    if S[i] == 'C' and S[j] == 'F':
      print('Yes')
      sys.exit()
print('No')

Submission status: Runtime Error

Solution code:
puts gets.index(/.*C.*F/)?"Yes":"No"

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
int main(){
	char c[65000];
	int i,j=0,l;
	cin>>c;
	l=strlen(c);
	for(i=0;i<l;i++){
		if(c[i]=='C'){
			j=1;
		}
		if(c[i]=='F'){
			if(j==1){
				cout<<"YES";
				return 0;
			}
		} 
	}
	cout<<"NO";
	return 0;
}

Submission status: Runtime Error

Solution code:
import sys
s=input()
if("C" in s and "F" in s):
  for i in range(len(s)):
    if(s[i]=="C"):c=i
  for i in range(len(s))[::-1]:
    if(s[i]==="F"):f=i
  if(c<f):
    print("Yes")
    sys.exit()
print("No")

Submission status: Runtime Error

Solution code:
import sys
s=input()
if("C" in s and "C" in s):
  if(s.index("C")<s.index("F")):
    print("Yes")
    sys.exit()
print("No")

Submission status: Runtime Error

Solution code:
import heapq

if __name__ == "__main__":
    K,T = map(int, input().split())
    data = list(map(int, input().split()))
    data.sort()
    cake = []
    for i,x in enumerate(data):
        cake.append([x, i])
    heapq._heapify_max(cake)
    while (len(cake) > 1):
        p = heapq._heappop_max(cake)
        q = heapq._heappop_max(cake)
        p[0] -= 1
        q[0] -= 1
        if p[0] > 0:
            heapq.heappush(cake, p)
        if q[0] > 0:
            heapq.heappush(cake, q)
    result = 0
    if len(cake) > 0:
        result = cake[0][0]
    print (max(0, result - 1))

Submission status: Runtime Error

Solution code:
s=str(input())
p=list('ABDEGHIJKLMNOPQRSTUVWXYZ')
p.remove("C")
p.remove("F")
for i in p:
    s=s.replace(i,'')
 
if 'CF' in s:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
s=input()
l=["a:z"]
l.remove(c)
l.remove(f)

for i in l:
  s.replace(i, "")

if "CF" in l:
   print("yes")
else:
   print("NO")

Submission status: Runtime Error

Solution code:
s = str(input())
if('C' in a and 'F' in a):
	print('Yes')
else:
	print('No')

Submission status: Runtime Error

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

def main():
    d = 10 ** 9 + 7
    ans = 1
    N = int(input())
    T = list(map(int, input().split()))
    A = list(map(int, input().split()))
    L = len(T)
    ST = [T[0]] + [0] * (L-2) + [T[-1] if T[-1] != T[-2] else 0]
    SA = [A[0] if A[0] != A[1] else 0] + [0] * (L-2) + [A[-1]]
    for i in range(0, L-1):
        if T[i] == T[i-1] and A[i] == A[i+1]:
            ans = (ans * min(T[i], A[i])) % d
        else:
            if T[i] != T[i-1] : ST[i] = T[i]
            if A[i] != A[i+1] : SA[i] = A[i]
    mt = ma = 0
    for i in range(L):
        ma = max(ma, SA[i])
        mt = max(mt, ST[L-i-1])
        if ST[i] and SA[i] and ST[i] != SA[i]:
            ans = 0
        if (ST[i] and ST[i] < ma) or (SA[-i-1] and SA[-i-1] < mt):
            ans = 0
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
H , W = map(int,input().split())
table = [input() for _ in range(H)]
def memo_rec(a,b,i,j, memo):
    if a == H or b == H:
        return 0
    if memo[a][b] > -1:
        return memo[a][b]
    ret = 0
    tmp = 0
    memo[a][b] = min(memo_rec(a+1,b,i,j, memo= memo), memo_rec(a,b+1,i,j,memo=memo)) + cache[a][b]
#    print("(i,j) = (%d,%d) memo[%d][%d] = %d"% (i,j,a,b,memo[a][b]))
    return memo[a][b]
ans = 0
for i in range(W-1):
#    print("%d,%d"%(i,i+1))
    memo = [[-1 for _ in range(H)] for _ in range(H)]
    cache = [[-1 for _ in range(H+1)] for _ in range(H+1)]
    for a in range(H,-1,-1):
        for b in range(H,-1,-1):
            if a == H or b == H:
                cache[a][b] = 0
            elif table[H-a-1][i] == table[H-b-1][i+1]:
                cache[a][b] = cache[a+1][b+1] + 1
            else :
                cache[a][b] = cache[a+1][b+1]
    ans += (memo_rec(0,0,i,i+1,memo))
print (ans)

Submission status: Runtime Error

Solution code:
k_t = input().split()
k = int(k_t[0])
t = int(k_t [1])
t_amount = input().split(' ')
 
while True:
    if t == 1:
        max = k
        break
    max = 0
    for i in range(t-1):
        if t_amount[i+1] >= t_amount [i]:
            max = t_amount[i+1]
        elif max == 0:
            max = t_amount[0]
    t_amount.remove(max)
 
    max2 = 0
    for i in range(t-2):
        if t_amount[i+1] >= t_amount [i]:
            max2 = t_amount[i+1]
        elif max2 == 0 :
            max2 = t_amount[0]
    t_amount.remove(max2)
    if max2 == "0":
        break
    else:
        max = int(max) -1
        max2 = int(max2) -1
        t_amount.append(str(max))
        t_amount.append(str(max2))
 
if max == "0":
    print(0)
else:
    print(int(max)-1)

Submission status: Runtime Error

Solution code:
N = int(raw_input())
 
T = map(int, raw_input().split())
A = map(int, raw_input().split())
 
ans = 1
mod = 10 ** 9 + 7
 
if T[N - 1] != A[0]:
    print (0)
    exit()
 
for i in xrange(N):
    if i == 0 or i == N - 1:
        continue
    elif T[i] > T[i-1]:
        if A[i] < T[i] and A[i] == A[i + 1]:
            print (0)
            exit()
        elif A[i] != T[i] and A[i] != A[i + 1]:
            print (0)
            exit()
    else:
        if T[i] == A[i]:
            if A[i] == A[i + 1]:
                ans *= T[i]
        elif T[i] > A[i]:
            if A[i] == A[i + 1]:
                ans *= A[i]
        else:
            if A[i] == A[i + 1]:
                ans *= T[i]
            else:
                print (0)
                exit()
 
print (ans % mod)

Submission status: Runtime Error

Solution code:
def read():
	return [int(i) for i in input().split(" ")]
N = int(input())
T = read()
A = read()
L = [0] * N
unknowL = [0] * N
tempT, tempA = 0, 0
for i in range(N):
	if(T[i] > tempT):
		tempT = L[i] = T[i]
	else:
		unknowL[i] = T[i]
for i in range(N-1, -1, -1):
	if(A[i] > tempA):
		if(L[i] != 0 and L[i] != A[i]):
			print(0)
			exit()
		tempA = L[i] = A[i]
		unknowL[i] = 0
	else:
		unknowL[i] = min(unknowL[i], A[i])
P = 1 
for i in unknowL:
	if(i != 0):
		P *= i	
print(P % (10**9 +7))

Submission status: Runtime Error

Solution code:
ini=raw_input()
a=list(ini)
check=0
if "C" in list and "F" in list:
    if list.index("C")<list.index("F"):
        check=1
if check==1:
    print "Yes"
else:
    print "No"

Submission status: Runtime Error

Solution code:
def read_input():
    l_1 = input()
    day = int(l_1.split(" ")[0])

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

    return day, num_cake

def get_max_index(target_list):
    return [i for i, j in enumerate(target_list) if j == max(target_list)]


def get_second_max_index(target_list):
    return [i for i, j in enumerate(target_list) if j == list(sorted(set(target_list), reverse=True))[1]]


def mog(day, num_cake):
    """

    >>> mog(7, [3,2,2])
    0
    >>> mog(6, [1,4,1])
    1
    >>> mog(100, [100])
    99
    """
    printed = False
    previous_index = -1

    for i in range(0, day):
        # print("num_cake: ", num_cake)
        # print("previous_index: ",previous_index)
        ate_flag = False
        mog_maybe_index = get_max_index(num_cake)
        # print("mog_maybe_index: {0}".format(mog_maybe_index))
        for n in mog_maybe_index:
            if n == previous_index:
                continue
            else:
                num_cake[n] = num_cake[n] - 1
                ate_flag = True
                previous_index = n
                break
        if ate_flag is False:
            try:
                mog_ext = get_second_max_index(num_cake)
                # print("mog_ext", mog_ext)
                if num_cake[mog_ext[0]] == 0:
                    printed = True
                    print(max(num_cake))
                    break
            except IndexError:
                print(max(num_cake))
                printed = True
                break
            num_cake[mog_ext[0]] = num_cake[mog_ext[0]] - 1
            previous_index = mog_ext[0]

    if printed is False:
        print(0)



if __name__ == "__main__":
    #import doctest
    #doctest.testmod()

    day, num_cake = read_input()
    mog(day, num_cake)

Submission status: Runtime Error

Solution code:
s = input()
first_letter = 'C'
second_letter = 'F'
found = False
for l in s:
    if l == first_letter:
        for l in s:
            if l == second_letter:
                print "Yes"
                break
        if found:
            break
if not found:
    print "No"

Submission status: Runtime Error

Solution code:
def read_input():
    l_1 = input()
    day = int(l_1.split(" ")[0])

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

    return day, num_cake

def get_max_index(target_list):
    return [i for i, j in enumerate(target_list) if j == max(target_list)]


def get_second_max_index(target_list):
    return [i for i, j in enumerate(target_list) if j == list(sorted(set(target_list), reverse=True))[1]]


def mog(day, num_cake):
    """

    >>> mog(7, [3,2,2])
    0
    >>> mog(6, [1,4,1])
    1
    >>> mog(100, [100])
    99
    """
    printed = False
    previous_index = -1

    for i in range(0, day):
        # print(num_cake)
        # print(previous_index)
        ate_flag = False
        mog_maybe_index = get_max_index(num_cake)
        # print("mog_maybe_index: {0}".format(mog_maybe_index))
        for n in mog_maybe_index:
            if n == previous_index:
                continue
            else:
                num_cake[n] = num_cake[n] - 1
                ate_flag = True
                previous_index = n
                break
        if ate_flag is False:
            try:
                mog_ext = get_second_max_index(num_cake)
                # print("mog_ext", mog_ext)
            except IndexError:
                print(max(num_cake))
                printed = True
                break
            num_cake[mog_ext[0]] = num_cake[mog_ext[0]] - 1
            previous_index = mog_ext[0]

    if printed is False:
        print(0)



if __name__ == "__main__":
    import doctest
    doctest.testmod()

    mog(read_input())

Submission status: Runtime Error

Solution code:
import sys
s = sys.stdin.readline().strip()
c_find = Fasle
f_find = False
for c in s:
    if c_find:
        if c == 'F':
            print 'Yes'
            exit(0)
    else:
        if c == 'C':
            c_find = True
print 'No'

Submission status: Runtime Error

Solution code:
N = input()
T = map(int,raw_input().split(" "))
A = map(int,raw_input().split(" "))




note = [1 for i in range(N)]
fx = [0 for i in range(N)]

def solve():
    global note
    if T[-1] != A[0]:
        return 0
    
    prev = 0
    for i in range(N):
        if prev > T[i]:
            return 0
        elif prev == T[i]:
            note[i] = prev
        else:
            note[i] = 1
            prev = T[i]
            fx[i] = T[i]
    prev = 0
    for i in range(N-1,-1,-1):
        if prev > A[i]:
            return 0
        elif prev == A[i]:
            if not fx[i]:
                note[i] = min(note[i],prev)
            else:
                if fx[i] > A[i]:
                    return 0

        else:
            if fx[i] and fx[i] != A[i]:
                return 0
            note[i] = 1
            prev = A[i]

    ans = 1
    for i in range(N):
        if not fx[i]:
            ans = (ans * note[i])%(10**9+7)
    return ans



    





print solve()

Submission status: Runtime Error

Solution code:
import sys

n = int(input())
t = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

if t[n-1]!=a[0]:
    print(0)
    sys.exit()

m =[]
for i in range(n):
    mx = min(t[i],a[i])
    mn = 1
    if i == 0:
        mn = t[i]
    elif i == n-1:
        mn = a[i]
    else :
        if t[i]!=t[i-1]:
            mn=t[i]
        if a[i]!=a[i+1]:
            mn=a[i]
    m.append([mx,min(mx,mn)])

ans = 1
for i in range(n):
    ans = (ans * (m[i][0]-m[i][1]+1))%(10**9+7)
print(ans)

Submission status: Runtime Error

Solution code:

def getCakeRepeats(cakes):
    front_iter = 0
    back_iter = len(cakes) - 1

    while back_iter > front_iter:
        if cakes[back_iter] < cakes[front_iter]:
            cakes[front_iter] -= cakes[back_iter]
            cakes[back_iter] = 0
            back_iter -= 1
        elif cakes[back_iter] > cakes[front_iter]:
            cakes[back_iter] -= cakes[front_iter]
            cakes[front_iter] = 0
            front_iter += 1
        else:
            cakes[back_iter] = 0
            cakes[front_iter] = 0
            back_iter -= 1
            front_iter += 1

    return max(0, sum(cakes) - 1)

if __name__ == "__main__":
    setup = raw_input()
    cakes = list(map(int, raw_input().split()))
    print getCakeRepeats(sorted(cakes))

Submission status: Runtime Error

Solution code:
import os
import sys
teststr = sys.argv[1]

ch1 = 'C'
ch2 = 'F'
flag = 0
for c in teststr:
    print c
    if ch1 == c:
        flag = flag+1
    if ch2 == c:
        flag = flag+1
if flag >= 2:
    print 'Yes'
else:
    print 'No'

Submission status: Runtime Error

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

size = []
for n in s:
    size.append(int(n))

s2 = input().split()

ss = []
for n in s2:
    ss.append(int(n))

if size[0] % 2 == 0:
    k = size[0]/2
else:
    k = (size[0] + 1) /2

l = 0
m = 3

for i in ss:
    if i > k:
        l+=1
        while i > int((m-1) * size[0] / m) and m <= size[0]:
            m+=1
         
            l+=1

print (l)

Submission status: Runtime Error

Solution code:
import os
import sys
teststr = sys.argv[1]
ch1 = 'C'
ch2 = 'F'
flag = 0
if True:
print 'Yes'

Submission status: Runtime Error

Solution code:
import os
import sys
teststr = sys.argv[1]
ch1 = 'C'
ch2 = 'F'
flag = 0
if len(teststr):
    print 'Yes'

Submission status: Runtime Error

Solution code:
import os
import sys
teststr = sys.argv[1]
ch1 = 'C'
ch2 = 'F'
flag = 0
for c in teststr:
        if ch1 == c:
                flag = flag+1
        else:
                flag = flag+1
if flag >= 2:
        print 'Yes'
else:
        print 'No'

Submission status: Runtime Error

Solution code:
import os
import sys
teststr = sys.argv[1]
ch1 = 'C'
ch2 = 'F'
flag = 0
for c in teststr:
    if ch1 == c:
        flag = flag+1
    else:
        flag = flag+1
if flag >= 2:
    print 'Yes'
else:
    print 'No'

Submission status: Runtime Error

Solution code:
import os
import sys
teststr = sys.argv[1]
ch1 = 'C'
ch2 = 'F'
for c in teststr:
    if ch1 == c:
        flag = flag+1
    else:
        flag = flag+1
if flag >= 2:
    print 'Yes'
else:
    print 'No'

Submission status: Runtime Error

Solution code:
s = input()
if "C" in s and "F" in s:
  a = s.lindex("C")
  b = s.rindex("F")
  if a < b:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Submission status: Runtime Error

Solution code:
import sys
def range_union(al,ah,bl,bh):
    cl = max(al,bl)
    ch = min(ah,bh)
    if cl > ch:
        return 0
    else:
        return ch-cl +1

N = int(sys.stdin.readline())
T = map(int,sys.stdin.readline().strip().split())
A = map(int,sys.stdin.readline().strip().split())

p = 1
for i in xrange(1,N-1):
    if T[i-1] < T[i]:
        Tl = T[i]
        Th = T[i]
    elif T[i-1] == T[i]:
        Tl = 1
        Th = T[i]
    else:
        p = 0
        break

    if A[i] > A[i+1]:
        Al = A[i]
        Ah = A[i]
    elif A[i+1] == A[i]:
        Al = 1
        Ah = A[i]
    else:
        p = 0
        break

    r = range_union(Tl,Th,Al,Ah)
    if not r:
        p = 0
        break
    else:
        p = p*r


print p % 1000000007

Submission status: Runtime Error

Solution code:
str = raw_input()

c = False

for i in range(0, len(str)):
  if str[i] == "C":
    c = True
  if str[i] == "F" and c == True:
    print "Yes"
print "No"

Submission status: Runtime Error

Solution code:
import sys
def range_union(al,ah,bl,bh):
    cl = max(al,bl)
    ch = min(ah,bh)
    if cl > ch:
        return 0
    else:
        return ch-cl +1

N = int(sys.stdin.readline())
T = map(int,sys.stdin.readline().strip().split())
A = map(int,sys.stdin.readline().strip().split())

p = 1
for i in xrange(1,N-1):
    if T[i-1] < T[i]:
        Tl = T[i]
        Th = T[i]
    elif T[i-1] == T[i]:
        Tl = 1
        Th = T[i]
    else:
        p = 0
        break

    if A[i] > A[i+1]:
        Al = A[i]
        Ah = A[i]
    elif A[i+1] == A[i]:
        Al = 1
        Ah = A[i]
    else:
        p = 0
        break

    r = range_union(Tl,Th,Al,Ah)
    if not r:
        p = 0
        break
    else:
        p = p*r


print p % 1000000007

Submission status: Runtime Error

Solution code:
str = raw_input()
c = False

for i in range(0, len(str)):
  if str[i] == "c":
    c = True
  if str[i] == "f" and c == True:
    print "YES"
print "NO"

Submission status: Runtime Error

Solution code:
import os
import sys
def main(teststr):
    ch1 = 'C'
    ch2 = 'F'
    for c in teststr:
        if ch1 == c:
            flag = flag+1
        else:
            flag = flag+1
    if flag >= 2:
        print 'Yes'
    else:
        print 'No'
if __name__=='__main__':
    teststr = sys.argv[1]
    main(teststr)

Submission status: Runtime Error

Solution code:
str = raw_input()

c = False
f = False

for i in range(0, len(str)):
  if str[i] == "c":
    c = True
  if str[i] == "f" and c == True:
    return True
return False

Submission status: Runtime Error

Solution code:
def main(teststr):
    ch1 = 'C'
    ch2 = 'F'
    for c in teststr:
        if ch1 == c:
            flag = flag+1
        else:
            flag = flag+1
    if flag >= 2:
        print 'Yes'
    else:
        print 'No'
if __name__=='__main__':
    teststr = sys.argv[1]
    main(teststr)

Submission status: Runtime Error

Solution code:
s = input()

cl = []
fl = []

for i, c_test in zip(range(len(s)), s):
    if c_test == 'C':
        cl.append(i)

for i, f_test in zip(range(len(s)), s):
    if f_test == 'F':
        fl.append(i)    
if max(fl) > min(cl):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
str = raw_input()
c = false
f = false

for i in range(0, len(str)):
  if str[i] == "c":
    c = true
  if str[i] == "f" and c == true:
    return true
return false

Submission status: Runtime Error

Solution code:
str = raw_input()
is_c_found = false
is_f_found = false
for i in range(0, len(str)):
if str[i] == "c":
is_c_found = true
if str[i] == "f" and is_c_found:
return true

return false

Submission status: Runtime Error

Solution code:
from random import random
import math
import re
import fractions

S = raw_input()
pc = S.index("C")
pf = S.rindex("F")
if pc > -1 and pf > -1 and pc < pf:
    print "Yes"
else:
    print "No"

Submission status: Runtime Error

Solution code:
s = raw_input()
flag = 0
for i in s:
    if flag == 0 and i == 'C': flag = 1
    elif: flag == 1 and i == 'F': flag = 2

print 'Yes' if flag == 2 else 'No'

Submission status: Runtime Error

Solution code:
import sys
s=raw_input()
flag=False
for j in range(s):
    if s[j]=='C':
        flag=True
    if s[j]=='F' and flag:
        print "Yes"
        sys.exit()
print "No"