Branching Computations

Submit

Your name:
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

Consider a language which consists of 5 commands. It operates on a list of integers, which is initially [0], a list containing only 0.

You will be given lines of input corresponding to separate trials, each starting with the list being [0].

Commands:

v : "branch". Replace each integer N in the list with [N-1, N+1], flattening the result
< : "trim left". Removes the leftmost element in the list.
> : "trim right". Removes the rightmost element.
^ : "sum". Replaces the list with a list containing the sum of the integers in the list.
/ : "product". Replaces the list with a list containing the product of all integers in the list.

Notes: the empty sum is 0 and the empty product is 1.

For example, the input "v" would generate [-1, 1], and the input "vv" would generate [-2, 0, 0, 2].

--conor_obrien

Options

exec is denied

rejudge feature is enabled

now post-mortem time, all source codes will be revealed

Sample input:_

v
vv
vvv
vv<
v/
vvv<<^
v>v>v>
>^
</
<

Sample output:

[-1, 1]
[-2, 0, 0, 2]
[-3, -1, -1, 1, -1, 1, 1, 3]
[0, 0, 2]
[-1]
[4]
[-3]
[0]
[1]
[]

Sample input:_

vvvvv/vv<v>^v
vvv/v<^
^v^
vv<>v<v>v>>>^
vvvvvvv
vvvvv>>>>>>>>>>>>>/vvv^

Sample output:

[7381125, 7381127]
[10]
[0]
[-1]
[-7, -5, -5, -3, -5, -3, -3, -1, -5, -3, -3, -1, -3, -1, -1, 1, -5, -3, -3, -1, -3, -1, -1, 1, -3, -1, -1, 1, -1, 1, 1, 3, -5, -3, -3, -1, -3, -1, -1, 1, -3, -1, -1, 1, -1, 1, 1, 3, -3, -1, -1, 1, -1, 1, 1, 3, -1, 1, 1, 3, 1, 3, 3, 5, -5, -3, -3, -1, -3, -1, -1, 1, -3, -1, -1, 1, -1, 1, 1, 3, -3, -1, -1, 1, -1, 1, 1, 3, -1, 1, 1, 3, 1, 3, 3, 5, -3, -1, -1, 1, -1, 1, 1, 3, -1, 1, 1, 3, 1, 3, 3, 5, -1, 1, 1, 3, 1, 3, 3, 5, 1, 3, 3, 5, 3, 5, 5, 7]
[29160]

Sample input:_

vv>vv>>>>v^v<vv>^v>v>v>vvv>/vvvv<<
v<v<v<v<v<vvv
v<v<v<v<vvv/vv^vv^v/^
v>v>v>v<v>vv<>vv<>>/vvv

Sample output:

[-827131647449, -827131647447, -827131647449, -827131647447, -827131647447, -827131647445, -827131647449, -827131647447, -827131647447, -827131647445, -827131647447, -827131647445, -827131647445, -827131647443]
[2, 4, 4, 6, 4, 6, 6, 8]
[142883999999]
[-138, -136, -136, -134, -136, -134, -134, -132]

Ranking

Ruby _

RankUserSizeTimeDateStatistics
1llhuii1080.04282018/05/29 01:25:450B / 48B / 59B
2Histocrat1110.03572018/05/26 05:54:180B / 48B / 58B
3rotary-o1130.03702018/05/18 01:38:060B / 53B / 57B
4rotary-o(llhuii,Histocrat)1070.04192018/05/30 01:52:150B / 48B / 58B

Ruby2 _

RankUserSizeTimeDateStatistics
1llhuii1050.15192018/05/29 01:26:380B / 48B / 56B
2rotary-o1080.17112018/05/21 00:21:030B / 49B / 56B
3Histocrat1080.14662018/05/26 06:30:550B / 49B / 54B
4angel_p571100.16552018/05/17 17:15:000B / ?B / ?B
5letranger1250.16852018/05/19 08:11:330B / 51B / 69B

Perl _

RankUserSizeTimeDateStatistics
1tails1120.03522018/05/15 15:48:460B / 36B / 73B
2%201250.03342018/05/23 01:10:200B / 43B / 78B

Python _

RankUserSizeTimeDateStatistics
1llhuii1470.07442018/05/19 07:47:060B / 70B / 58B
2hallvabo1470.12152018/05/20 00:16:240B / 70B / 58B
3lynn1580.07282018/05/19 04:24:050B / 83B / 70B
4dianne1600.07242018/05/18 15:40:550B / 86B / 64B
5Da1600.07742018/05/20 10:45:080B / ?B / ?B
6rolf1810.07632018/05/29 03:44:160B / 87B / 80B
7_2260.07422018/05/20 10:58:170B / ?B / ?B

Python3 _

RankUserSizeTimeDateStatistics
1llhuii1300.12082018/05/29 01:28:510B / 59B / 49B
2mypetlion1500.12522018/05/18 01:22:450B / 73B / 60B

C _

RankUserSizeTimeDateStatistics
1llhuii2110.03162018/05/27 18:05:471B / 98B / 111B
2tails2200.03152018/05/25 15:20:260B / 106B / 109B
3mitchs (llhuii)2090.03162018/05/29 15:35:250B / 96B / 112B

GolfScript _

RankUserSizeTimeDateStatistics
1tails630.08922018/05/15 14:15:050B / 7B / 54B
2mitchs (tails)610.08862018/05/29 16:16:460B / 7B / 52B

gs2 _

RankUserSizeTimeDateStatistics
1tails290.19802018/05/15 14:26:3711B / 11B / 6B
2whio290.21202018/05/16 01:26:5911B / 10B / 7B

Burlesque _

RankUserSizeTimeDateStatistics
1Hendrik650.05062018/05/17 06:49:140B / 32B / 33B

Scala _

RankUserSizeTimeDateStatistics
1rotary-o1567.72482018/05/17 01:55:290B / 94B / 57B

Language Ranking_

RankLangUserSizeScore
1gs2tails2910000
2GolfScriptmitchs (tails)614754
3BurlesqueHendrik654461
4Ruby2llhuii1052761
5Rubyrotary-o(llhuii,Histocrat)1072710
6Perltails1122589
7Python3llhuii1302230
8Pythonllhuii1471972
9Scalarotary-o1561858
10Cmitchs (llhuii)2091387

return to the top page