Problem:
 Score : 900 points    Problem Statement You are developing frog-shaped robots, and decided to race them against each other.  First, you placed N robots onto a number line.
These robots are numbered 1 through N .
The current coordinate of robot i is x_i .
Here, all x_i are integers, and 0 < x_1 < x_2 < ... < x_N .  You will repeatedly perform the following operation:   Select a robot on the number line. Let the coordinate of the robot be x . Select the destination coordinate, either x-1 or x-2 , that is not occupied by another robot. The robot now jumps to the selected coordinate.   When the coordinate of a robot becomes 0 or less, the robot is considered finished and will be removed from the number line immediately.
You will repeat the operation until all the robots finish the race.  Depending on your choice in the operation, the N robots can finish the race in different orders.
In how many different orders can the N robots finish the race?
Find the answer modulo 10^9+7 .      Constraints  2 ≤ N ≤ 10^5  x_i is an integer.  0 < x_1 < x_2 < ... < x_N ≤ 10^9       Partial Score  In a test set worth 500 points, N ≤ 8 .         Input The input is given from Standard Input in the following format:  N  x_1  x_2  ...  x_N       Output Print the number of the different orders in which the N robots can finish the race, modulo 10^9+7 .        Sample Input 1 3
1 2 3      Sample Output 1 4  There are four different orders in which the three robots can finish the race:   ( Robot 1 → Robot 2 → Robot 3)  ( Robot 1 → Robot 3 → Robot 2)  ( Robot 2 → Robot 1 → Robot 3)  ( Robot 2 → Robot 3 → Robot 1)        Sample Input 2 3
2 3 4      Sample Output 2 6  There are six different orders in which the three robots can finish the race:   ( Robot 1 → Robot 2 → Robot 3)  ( Robot 1 → Robot 3 → Robot 2)  ( Robot 2 → Robot 1 → Robot 3)  ( Robot 2 → Robot 3 → Robot 1)  ( Robot 3 → Robot 1 → Robot 2)  ( Robot 3 → Robot 2 → Robot 1)   For example, the order ( Robot 3 → Robot 2 → Robot 1) can be achieved as shown in the figure below:          Sample Input 3 8
1 2 3 5 7 11 13 17      Sample Output 3 10080       Sample Input 4 13
4 6 8 9 10 12 14 15 16 18 20 21 22      Sample Output 4 311014372  Remember to print the answer modulo 10^9+7 .
This case is not included in the test set for the partial score.

Solution (Python):
n = input()
x = map(int, raw_input().split())

MOD = 10**9+7

j = 1
ans = 1
count = 0
for i in xrange(len(x)):
    if(x[i] >= 2*j-1):
        j += 1
        continue
    else:
        ans = ans*j%MOD
        count += 1

for i in xrange(len(x)-count):
    ans = ans*(i+1)%MOD

print ans

Solution (Python):
n = input()
x = map(int, raw_input().split())

MOD = 1000000007

j = 1
ans = 1
count = 0
for i in xrange(len(x)):
    if(x[i] >= 2*j-1):
        j += 1
        continue
    else:
        ans *= j
        count += 1

for i in xrange(len(x)-count):
    ans = ans*(i+1)%MOD

print ans

Solution (Python):
input()
a=b=1
for r in input().split():
    a=a*b%(10**9+7)
    if b*2<eval(r+'+2'):b+=1
print(a)

Solution (Python):
r=raw_input
r()
a=b=1
for x in r().split():
	a,b=a*b%(10**9+7),min(b+1,(int(x)+3)/2)
print a

Solution (Python):
N = int(input())
p_list = map(int, input().split())

pat = 1
sum = 0
for i, r_pos in enumerate(p_list):
    pat = (pat * (sum + 1)) % 1000000007
    if r_pos >= 2 * sum + 1: sum += 1
print(pat)

Solution (Python):
import numpy
import math
def input_parser():
    N=int(input())
    x=[int(i) for i in input().split()]
    return N, x

N, x=input_parser()
reachability_list = numpy.zeros(N)
reachable=1
threshold=0
for idx in range(0,N,1):
    if idx==0:
        reachability_list[idx]=reachable
    else:
        while True:
            if x[idx-1]>threshold:
                reachability_list[idx]=reachable
                threshold+=2
                break
            else:
                target_threshold = math.floor((x[idx-1]-1)/2)*2
                reachable+=(threshold-target_threshold)/2
                threshold=target_threshold
l=numpy.zeros(N)
order=1
for idx in range(0,N,1):
    if not reachability_list[idx]==order:
        l[order-1]=idx-order+1
        order+=1
for itr in range(order-1,N,1):
    l[itr]=N-itr
a=1
for itr in range(0,N,1):
   a=(a*l[itr])%(10**9+7)

def output_parser(output):
    print(output)

output_parser(int(a))

Solution (Python):
from itertools import permutations, combinations

M = 10**9+7


def solve(n, x):
    res = 1
    k = 0
    for i in range(n):
        k += 1
        if x[i] < 2 * k - 1:
            res *= k
            res %= M
            k -= 1
    if k > 0:
        for i in range(1, k+1):
            res *= i
            res %= M
    return res


def solve2(n, x):
    res = 0
    for p in permutations(range(n)):
        done = set()
        ok = True
        for i in range(n):
            can_win = True
            k = 1
            for j in range(p[i]):
                if j in done:
                    continue
                can_win &= x[j] >= k
                k += 2
            ok &= can_win
            done.add(p[i])
        if ok:
            res += 1
    return res


def check():
    for n in range(1, 8):
        for x in combinations(range(1, 2 * n + 1), n):
            expected = solve2(n, list(x))
            output = solve(n, list(x))
            if output != expected:
                print('x: {}'.format(x), end='\t')
                print('output: {}'.format(output), end='\t')
                print('expected: {}'.format(expected), end='\n')
                return x

if __name__ == '__main__':

    

    n = int(input())
    x = list(map(int, input().split()))
    print(solve(n, x))

Solution (Python):
input()
c=j=1
for s in input().split():
	c=c*j%(10**9+7)
	if j*2<int(s)+2:
		j+=1
print(c)

Solution (Python):
import sys
from math import factorial

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N = int(input())
    X = [int(i) for i in input().split()]
    MOD = 10**9 + 7
    ans = 1
    stack = 0

    for x in X:
        stack += 1
        if x < 2*(stack - 1) + 1:
            ans *= stack
            ans %= MOD
            stack -= 1

    ans *= (factorial(stack) % MOD)
    ans %= MOD

    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):
MOD = 10**9 + 7
N = int(input().strip())
x = [int(_) for _ in input().split()]


count = 1
mult = 1
G = 0
for i, pos in enumerate(x):
  
  count = (count * mult) % MOD
  G += 1
  if 2 * G > pos + 1:
    G -= 1
  else:
    mult += 1
print(count)

Solution (Python):
def mod_factorial(N, d):
    ans = 1
    for i in range(1,N+1):
        ans = (ans * i) % d
    return ans

d = 10**9 + 7
N = int(input())
list_co = list(map(int, input().split()))

ans = 1      
for i, x in enumerate(list_co):
    if x < 2*(i+1) -1: 
        ans *= (i+1)
        list_co.pop(i-1)
ans = (ans * mod_factorial(len(list_co),d)) % d
print(ans)

Solution (Python):
d = 10**9 + 7

N = int(input())
list_co = list(map(int, input().split()))

ans = 1
def mod_factorial(N, d):
    ans = 1
    for i in range(1,N+1):
        ans = (ans * i) % d
    return ans
        
for i, x in enumerate(list_co):
    if x < 2*(i+1) -1:
        ans *= (i+1)
        list_co.pop(i-1)
ans = (ans * mod_factorial(len(list_co),d)) % d
print(ans)

Solution (Python):
from sys import stdin
rr = lambda: stdin.readline().strip()

N = int(rr())
A = map(int, rr().split())
MOD = 10**9 + 7
ct, ans = 0, 1
for x in A:
    ct += 1
    while ct > (x + 1)/2:
        ans *= ct
        ans %= MOD
        ct -= 1
for k in xrange(1, ct+1):
    ans *= k
    ans %= MOD
print ans

Solution (Python):
N = int(input())
MOD = 10**9 + 7

cnt = 1
j = 1
runner = 0

for x in map(int, input().split()):
  cnt *= j
  cnt %= MOD
  if runner >= x:
    runner = x
  else:
    j += 1
    runner += 2

print(cnt)

Solution (Python):
N = int(input())

X = list(map(int, input().split()))

MOD = 10**9 + 7

cnt = 1
j = 1

n_to_remove = 0

runner = 1

for i,x in enumerate(X):
  j = i+1 - n_to_remove
  if runner > x:
    n_to_remove += 1
    runner = x-1
  runner += 2
  cnt = (cnt*j)%MOD

print(cnt)

Solution (Python):
n = input()
X = map(int, raw_input().split())

MOD = 10**9+7

ans = 1
res = 0
for i in xrange(n):
    while 2*res+1 > X[i]:
        ans = (ans * (res+1)) % MOD
        res -= 1
    res += 1
while res:
    ans = (ans * res) % MOD
    res -= 1
print ans

Solution (Python):
n = int(input())
count = [0]
cur = 0
data = list(map(int, input().split()))
for i,v in enumerate(data):
  count[-1] += 1
  if v < 2*(i-cur)+1:
    cur += 1
    count.append(0)
res = 1
cur = 1
for i in range(n):
  cur -= 1
  if count: cur += count.pop(0)
  res *= cur
  res %= 1000000007
print(res)