# Didactic Binary Search

## Submit

File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

## Problem

By solving this problem, you can learn (or reconfirm) how to implement binary search.

The output is self-descriptive. Please read it and consider what is going on.

In this implementation, the lower boundary of the value range is inclusive
and the upper boundary is exclusive.
The initial value of the lower boundary is zero. The upper boundary is given
in the first line of the input.

Then you must make a query whether the value is in the lower half of the range.
The answer to the query, expressed as 1 for yes or 0 for no, is given in the
next line of the input.
Repeat the above until you can determine the value which is an integer.
You must ignore the remaining input that is just a garbage.

-- tails

exec is denied

```1024
1
1
1
0
0
1
1
0
1
1
0
0
1
```

## Sample output:

```Now I know the value is not less than 0 but less than 1024.

Is the value less than 512?
Yes!
Now I know the value is not less than 0 but less than 512.

Is the value less than 256?
Yes!
Now I know the value is not less than 0 but less than 256.

Is the value less than 128?
Yes!
Now I know the value is not less than 0 but less than 128.

Is the value less than 64?
No!
Now I know the value is not less than 64 but less than 128.

Is the value less than 96?
No!
Now I know the value is not less than 96 but less than 128.

Is the value less than 112?
Yes!
Now I know the value is not less than 96 but less than 112.

Is the value less than 104?
Yes!
Now I know the value is not less than 96 but less than 104.

Is the value less than 100?
No!
Now I know the value is not less than 100 but less than 104.

Is the value less than 102?
Yes!
Now I know the value is not less than 100 but less than 102.

Is the value less than 101?
Yes!
Now I know the value is not less than 100 but less than 101.

That is, the value is 100.
```

```3456
1
0
1
0
0
1
0
0
1
0
0
0
1
0
0
0
```

## Sample output:

```Now I know the value is not less than 0 but less than 3456.

Is the value less than 1728?
Yes!
Now I know the value is not less than 0 but less than 1728.

Is the value less than 864?
No!
Now I know the value is not less than 864 but less than 1728.

Is the value less than 1296?
Yes!
Now I know the value is not less than 864 but less than 1296.

Is the value less than 1080?
No!
Now I know the value is not less than 1080 but less than 1296.

Is the value less than 1188?
No!
Now I know the value is not less than 1188 but less than 1296.

Is the value less than 1242?
Yes!
Now I know the value is not less than 1188 but less than 1242.

Is the value less than 1215?
No!
Now I know the value is not less than 1215 but less than 1242.

Is the value less than 1228?
No!
Now I know the value is not less than 1228 but less than 1242.

Is the value less than 1235?
Yes!
Now I know the value is not less than 1228 but less than 1235.

Is the value less than 1231?
No!
Now I know the value is not less than 1231 but less than 1235.

Is the value less than 1233?
No!
Now I know the value is not less than 1233 but less than 1235.

Is the value less than 1234?
No!
Now I know the value is not less than 1234 but less than 1235.

That is, the value is 1234.
```

```7777
0
1
0
0
1
0
0
1
0
0
0
1
0
1
0
0
1
0
```

## Sample output:

```Now I know the value is not less than 0 but less than 7777.

Is the value less than 3888?
No!
Now I know the value is not less than 3888 but less than 7777.

Is the value less than 5832?
Yes!
Now I know the value is not less than 3888 but less than 5832.

Is the value less than 4860?
No!
Now I know the value is not less than 4860 but less than 5832.

Is the value less than 5346?
No!
Now I know the value is not less than 5346 but less than 5832.

Is the value less than 5589?
Yes!
Now I know the value is not less than 5346 but less than 5589.

Is the value less than 5467?
No!
Now I know the value is not less than 5467 but less than 5589.

Is the value less than 5528?
No!
Now I know the value is not less than 5528 but less than 5589.

Is the value less than 5558?
Yes!
Now I know the value is not less than 5528 but less than 5558.

Is the value less than 5543?
No!
Now I know the value is not less than 5543 but less than 5558.

Is the value less than 5550?
No!
Now I know the value is not less than 5550 but less than 5558.

Is the value less than 5554?
No!
Now I know the value is not less than 5554 but less than 5558.

Is the value less than 5556?
Yes!
Now I know the value is not less than 5554 but less than 5556.

Is the value less than 5555?
No!
Now I know the value is not less than 5555 but less than 5556.

That is, the value is 5555.
```

## Ranking

### Ruby_

RankUserSizeTimeDateStatistics
1Histocrat1840.04612016/08/20 13:54:150B / 90B / 77B

### Ruby2_

RankUserSizeTimeDateStatistics
1letranger2200.15392017/09/18 14:11:300B / 104B / 93B

### Perl_

RankUserSizeTimeDateStatistics
1%201760.04062016/08/18 13:46:220B / 68B / 91B
2tails2690.03802016/08/18 11:05:050B / 150B / 78B

### Python_

RankUserSizeTimeDateStatistics
1hallvabo1840.12682017/01/08 06:11:26101B / 54B / 25B
2twobit1970.09892017/01/07 01:27:15115B / ?B / ?B
3hallvabo (nobin)2130.10892017/01/08 05:41:540B / 113B / 81B
4Sp30002160.10212016/08/29 15:19:520B / 113B / 85B
5test2560.12152017/01/07 00:31:490B / ?B / ?B
6rolf2570.09742016/08/19 03:36:440B / 151B / 75B

### Python3_

RankUserSizeTimeDateStatistics
1mypetlion2220.12642020/01/21 09:19:100B / 111B / 99B

### JavaScript_

RankUserSizeTimeDateStatistics
1ETHproductions2030.06392017/03/30 08:12:280B / 98B / 99B

### Lua_

RankUserSizeTimeDateStatistics
1tehtmi2360.03982018/08/27 14:33:511B / 131B / 81B

### C_

RankUserSizeTimeDateStatistics
1rotary-o2330.04112021/05/05 21:59:430B / 125B / 94B
2kotatsugame2470.03202017/02/01 23:17:410B / 144B / 80B
3nai2480.03552016/12/20 00:35:160B / 149B / 75B
4yangfl2600.03572016/10/27 23:37:560B / 151B / 85B
5bk1e2720.03832017/04/18 15:55:340B / 157B / 92B

### Java_

RankUserSizeTimeDateStatistics
1rotary-o2990.22542021/05/05 21:47:090B / 172B / 108B

### bc_

RankUserSizeTimeDateStatistics
1McBusLuck2380.02292020/04/20 15:28:210B / 134B / 70B

### Scala_

RankUserSizeTimeDateStatistics
1rotary-o2267.00572021/05/05 21:45:460B / 125B / 84B
2clock2326.31962020/05/08 02:25:490B / 128B / 83B

### Language Ranking_

RankLangUserSizeScore
1Perl%2017610000
2RubyHistocrat1849565
3Pythonhallvabo1849565
4JavaScriptETHproductions2038669
5Ruby2letranger2208000
6Python3mypetlion2227927
7Scalarotary-o2267787
8Crotary-o2337553
9Luatehtmi2367457
10bcMcBusLuck2387394
11Javarotary-o2995886