# Toggle Bulbs #### Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

`You are given n bulbs, numbered from 1 to n. Initially all the bulbs are turned off.You have to perform 2 types of operations:-1. Toggle all bulds numbered between A to B.Here toggle mean turn on bulbs to off and off bulbs to on.This is represented by 1 A B.2. Count how many bulbs numbered between A to B are on.This is represented by 2 A B.`
Input Format
`First line contains two integers n and q.Following q lines contains queries of format either 1 A B or 2 A B.`
Output Format
`Print count of bulbs for query type 2 A B.`
Question Video
Constraints
`1. 1 <= n <= 10^52. 1 <= q <= 10^53. 1 <= A <= B <= n`
Sample Input
`4 72 1 41 2 32 1 22 1 11 1 42 1 4 2 4 4`
Sample Output
`01021`

• Related Topics

Run

Run
Id Name