codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

238A.md (1527B)


      1 Source: https://codeforces.com/problemset/problem/238/A
      2 
      3 A. Not Wool Sequences
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 A sequence of non-negative integers *a*1, *a*2, ..., *a**n* of length *n* is called a wool sequence if and only if there exists two integers *l* and *r* (1 ≤ *l* ≤ *r* ≤ *n*) such that ![](https://espresso.codeforces.com/9219edd0b72e5f72af3aa48a488d5734a75213f9.png). In other words each wool sequence contains a subsequence of consecutive elements with xor equal to 0.
     22 
     23 The expression ![](https://espresso.codeforces.com/b364f2e04c665b78b924ec10666327a4ef4635bc.png) means applying the operation of a bitwise xor to numbers *x* and *y*. The given operation exists in all modern programming languages, for example, in languages C++ and Java it is marked as "^", in Pascal — as "xor".
     24 
     25 In this problem you are asked to compute the number of sequences made of *n* integers from 0 to 2*m* - 1 that are not a wool sequence. You should print this number modulo 1000000009 (109 + 9).
     26 
     27 Input
     28 
     29 The only line of input contains two space-separated integers *n* and *m* (1 ≤ *n*, *m* ≤ 105).
     30 
     31 Output
     32 
     33 Print the required number of sequences modulo 1000000009 (109 + 9) on the only line of output.
     34 
     35 Examples
     36 
     37 Input
     38 
     39 ```
     40 3 2
     41 ```
     42 
     43 Output
     44 
     45 ```
     46 6
     47 ```
     48 
     49 Note
     50 
     51 Sequences of length 3 made of integers 0, 1, 2 and 3 that are not a wool sequence are (1, 3, 1), (1, 2, 1), (2, 1, 2), (2, 3, 2), (3, 1, 3) and (3, 2, 3).