text:
Silly Stock Market
Given a string with a multiple people's investment data, find out how much profit/loss they recorded.
The string only contains capital and lowercase letters, like this:
AABaBbba

Each letter represents a person - a capital letter means buy, a lowercase letter means sell. The price of the stock they are investing in (CGLF) starts at $50. After someone buys, the price goes up 5%. After someone sells the price goes down 5%. You need to figure out how much money each person who participated made/lost.
Notes:

The string will always be valid, no selling without first buying. Also, everyone who buys a stock will sell it eventually.
Your calculations should be accurate to at least 6 decimal places. However, final answers should be rounded to two decimals.

Test Cases:
Input: AABaBbba

A: Buy - $50
A: Buy - $52.50
B: Buy - $55.125
a: Sell - $57.88125
B: Buy - $54.9871875
b: Sell - $57.736546875
b: Sell - $54.8497195313
a: Sell - $52.1072335547

Person A profit: 57.88125+52.1072335547-50-52.50=7.4884835547
Person B profit: 57.736546875+54.8497195313-55.125-54.9871875=2.4740789063

Output: A:7.49,B:2.47 (order doesn't matter, separators not required)

Input: DGdg

D: Buy - $50
G: Buy - $52.50
d: Sell - $55.125
g: Sell - $52.36875

Person D profit: 55.125-50=5.125
Person G profit: 52.36875-52.50=-0.13125

Output: D:5.13,G:-.13

Input: ADJdja

A: Buy - $50
D: Buy - $52.50
J: Buy - $55.125
d: Sell - $57.88125
j: Sell - $54.9871875
a: Sell - $52.237828125

Person A profit: 52.237828125-50=2.237828125
Person D profit: 57.88125-52.50=5.38125
Person J profit: 54.9871875-55.125=-0.1378125

Output: A:2.24,D:5.38,J:-.14

@ETHproductions When you print output, it doesn't really matter what the datatype is, it just needs to convey the right information.

Can the final result be truncated instead of rounded?

@Mwr Sorry, you have to round.

Do we have to output the people in alphabetical order?

Also, Python rounds stuff weirdly; 5.125 rounds to 5.12 by default. Is this accepted?

@Pietu1998 No, as I said, they don't have to be in order. And using Python's rounding is O.K.

Japt, 91 84 bytes
A=[]J=50¡AhD=Xc %H(X<'_?[AgD ª0 -JJ*=1.05]:[AgD +JJ*=.95] g};A£X©[Y+I d X*L r /L]} f

Based on my JS answer. Try it online!

APL (Dyalog Extended), 34 32 bytes
⌊{⍺,2⍕+/-⍵}⌸××50×¯1×\⍤↓1,1+.05××

Monadic × in Dyalog extended for letters corresponds to the casing
¯1 1 ≡ ×'aA'

1+.05×× - 1 + 0.05 times the sign (either 1.05 or 0.95)
1,      - concat 1 to the front
¯1×\⍤↓  - cumulative product and drop the last element
50×     - multiply by 50
××50... - the sign times that
⌊{⍺,2⍕+/-⍵}⌸ - group (dyadic ⌸) by the lowercased input (⌊)
 {⍺,2⍕+/-⍵}  - return the left item (the person) concat their rounded total

-2 thanks to Adám
Try it online!

¯1 1 ≡ ×'aA' and being able to floor letters makes dyalog much more elegant than J in this case.

@Jonah only dyalog extended, it wouldn't be as nice in regular dyalog

×∘(×\)¯1↓ → ×¯1×\⍤↓

Java, 277 bytes
class c{public static void main(String[]a){double[]m=new double[26];double s=50;for(byte b:a[0].getBytes()){if(b>=97){m[b-97]+=s;s*=.95;}else{m[b-65]-=s;s*=1.05;}}char g=65;for(double k:m){if(k!=0){System.out.println(g+String.format(java.util.Locale.ENGLISH,"%.2f",k));}g++;}}}

Ungolfed:
class c {
    public static void main(String[]a) {
        double[] m = new double[26];
        double s = 50;
        for(byte b : a[0].getBytes()) {
            if(b>=97) {
                m[b-97]+=s;
                s*=.95;
            } else {
                m[b-65]-=s;
                s*=1.05;
            }
        }
        char g=65;
        for(double k:m) {
            if(k!=0) {
                System.out.println(g+String.format(java.util.Locale.ENGLISH,"%.2f",k));
            }
            g++;
        }
    }
}

A lot of the formatting is unnecessary. Having a 0 before the decimal point is o.k., commas and colons are not necessary.

great this reduces my byte count significantly

The class doesn't need to be public.

Is specifying the Locale necessary? I don't mind if it shows up as "3,54".

Store your money in a float, this saves bytes and might get you some extra profit ;)

Also, you can replace the >=97 with >96

And maybe you can also use System.out.printf("%s %.2f%n", g, k);

You can also move char g=65; up and re-use it in the line m[b-65], saves a byte again.

JavaScript (ES7), 145 142 bytes
I can't find a shorter way to round out the results...
x=>[for(c of(i=50,a={},x))(a[d=c.toUpperCase()]=a[d]||0,c<"["?(a[d]-=i,i*=1.05):(a[d]+=i,i*=.95))]&&Object.keys(a).map(k=>[k,a[k].toFixed(2)])

Fun fact: this would only be 101 bytes if not for the rounding requirement:
x=>[for(c of(i=50,a={},x))(a[d=c.toUpperCase()]=a[d]||0,c<"["?(a[d]-=i,i*=1.05):(a[d]+=i,i*=.95))]&&a

43 bytes seems to much..I'm sure you can find a better way!

Python 3, 116 bytes
P=50
M={}
for c in input():C=c.upper();u=c>C;u+=~-u;M[C]=M.get(C,0)+P*u;P*=1-u*.05
for k in M:print(k,round(M[k],2))

Ungolfed
price = 50
profits = {}
for char in input():
    upper = char.upper()
    direction = 2 * (char > upper) - 1
    profits[upper] = profits.get(upper, 0) + price * direction
    price *= 1 - direction * .05
for key in profits:
    print(key, round(profits[key], 2))

It seems shorter to just do u=2*(c>C)-1 directly.

at the end of line 3, /20 would save one byte over *.05

ARM Thumb-2 (VFP + printf, softfp ABI), 109 104 bytes
Uses the softfp ABI (default on Android). It won't work on armhf Linux. f7ff fffe is a 4 byte linker placeholder for printf.
Both of these examples must be placed at an address that is not a multiple of 4 (but even), and must be in a W+X section because we modify an inline printf string in place.
b5f8 2100 2234 3a01 b402 d8fc f2c4 0249
ec42 1b10 ed9f 1b11 f810 2b01 b192 3a61
bf48 3220 eb0d 02c2 ed92 5b00 bf47 ee35
5b40 ee00 0b01 ee35 5b00 ee00 0b41 ed82
5b00 e7e9 2641 bc0c b11b a005 7006 f7ff
fffe 3601 2e5a ddf6 bdf8 999a 9999 9999
3fa9 2558 322e 0066

Assembly:
        .syntax unified
        .arch armv6t2
        // We need VFPv2 for this.
        .fpu vfpv2
        // We modify an inline string in place, so we need W+X.
        .section ".writeable_text","awx",%progbits
        .thumb
        .globl silly_stocks
        .thumb_func
        // Must NOT be 4 byte aligned.
        // .align 4
        // nop

        // void silly_stocks(const char *input);
        // Follows AAPCS convention.
        // input is a null-terminated string in r0.
silly_stocks:
        push          {r3-r7, lr}
        // double buf[26] = {0}
        movs          r1, #0
        movs          r2, #26*2
.Lclear_loop:
        subs          r2, #1
        push          {r1}
        bhi           .Lclear_loop
.Lclear_loop_end:
        // note: r1 and r2 are zero at this point
        // r1:r2 = 0x4049000000000000 = 50.0 double
        movt           r2, #0x4049
        vmov           d0, r1, r2
        vldr           d1, .Lfloat_pool
.Lprocess_loop:
        // Loop until the null terminator.
        // while (r2 = *input++)
        ldrb          r2, [r0], #1
        cbz           r2, .Lprocess_loop_end
        // tolower(r2) - 'a'
        //
        // Specifically, we subtract 'a', and if the char was uppercase,
        // it would be negative, triggering the N flag, which is why we
        // check the mi condition in the following IT blocks.
        subs          r2, #'a'
        it            mi
        // if (isupper(r2))
          addmi       r2, #'a' - 'A'

        // Yucky. We can't use proper offsetting with VFP and we need to
        // keep the flags for the IT block.
        add.w         r2, sp, r2, lsl #3
        // Behold, the beautiful syntax of VFP/NEON.
        // Combine it with a an IT block and you get a 10 letter mnemonic. OwO
        vldr.64       d5, [r2]
        ittee         mi
        // if (isupper(r2)) {    // Buy
          vsubmi.f64  d5, d5, d0 //   profit[i]   -= d0
          vmlami.f64  d0, d0, d1 //   stock_price += stock_price * 0.05
        // } else {              // Sell
          vaddpl.f64  d5, d5, d0 //   profit[i]   += stock_price
          vmlspl.f64  d0, d0, d1 //   stock_price -= stock_price * 0.05
        // } endif
        vstr.64       d5, [r2]
        b             .Lprocess_loop
.Lprocess_loop_end:

        movs          r6, #'A'
.Lprint_loop:
        // Pop the double into r2 and r3. We are using the softfp abi, so
        // doubles are passed in integer registers.
        pop           {r2, r3}
        // Only check if the most signicant half of the double is zero.
        // Any non-zero double that is 0x00000000xxxxxxxx is denormal.
        cbz           r3, .Lprint_loop_skip
        // Set up an AEABI call to printf.
        adr           r0, .Lprintf_str
        // Instead of %c, store the char directly (that's why we need W+X)
        strb          r6, [r0]
        bl            printf
.Lprint_loop_skip:
        // Loop from A-Z.
        adds          r6, #1
        cmp           r6, #'Z'
        ble           .Lprint_loop
        pop           {r3-r7, pc}
        // At least for the softfp ABI, doubles are smaller than floats.
        // This is because printf takes doubles, not floats, and we need
        // to pass them in a register pair.
        // So we would need something like this, which is 12 bytes.
        //  vpop         {d0}
        //  vcvt.f64.f32 d0, s0
        //  vmov         r2, r3, d0
        .align 2
.Lfloat_pool:
        .double       0.05
.Lprintf_str:
        // Our printf string. We modify X directly.
        .asciz        "X%.2f"

        .section ".testsuite_unscored","ax",%progbits
.macro $TEST str
        adr           r0, 1f
        bl            puts
        adr           r0, 1f
        bl            silly_stocks
        movs          r0, #'\n'
        bl            putchar
        b             2f
        .align 2
1:
        .asciz        "\str"
.align 2
2:
.endm

        .align 2
        .globl main
        .thumb_func
main:
        push          {r4, lr}
        $TEST         "AABaBbba"
        $TEST         "DGdg"
        $TEST         "ADJdja"
        pop           {r4, pc}

Decided to take a shot at VFP code in ARM assembly instead of doing something easy (and basically identical to the Java entry) like C or C++.
One of the things I realized the hard way was that ARM actually needs the stack to be 8 byte aligned, or else subtle bugs will occur. Two hours of debugging I am NEVER getting back.
Oddly enough, using doubles is smaller than floats, despite the larger literal pool. This is because the C calling convention mandates that floats be promoted to double in variadic functions, so we would have to convert to double anyways, and that is larger than the 8 bytes for the larger pool.
Output isn't pretty. But the question says "separators not required" so I took that in the most literal sense.
AABaBbba
A7.49B2.47
DGdg
D5.12G-0.13
ADJdja
A2.24D5.38J-0.14

But aside from the 5.12 which is the same rounding error that was mentioned in Python, the results are correct.
ARM Thumb-2 (VFP + printf, softfp ABI, very imprecise), 99 96 bytes
This version uses 32-bit x 16-bit fixed point arithmetic.
It lacks the required 6 digits of precision, but for the test cases it products the same results. Interpret it as you wish.
Must be loaded at an address that is not a multiple of 4 for constant pool alignment.
Machine code:
b5f8 2100 2534 3d01 b402 d8fc f2c0 0132
4d11 f810 2b01 b172 3a61 bf48 3220 f85d
3032 fb51 f605 bf47 1a5b 4431 440b 1b89
f84d 3032 e7ed 2641 ecbd 0b02 eeba 0bc8
ec53 2b10 b11b a004 7006 f7ff fffe 3601
2e5a ddf1 bdf8 cccc 0ccc 2558 322e 0066

Assembly:
        .syntax unified
        .arch armv6t2
        // We need VFPv2 for this.
        .fpu vfpv2
        // We modify an inline string in place, so we need W+X.
        .section ".writeable_text_fixed","awx",%progbits
        .thumb
        .globl silly_stocks_fixed
        .thumb_func

        // Must not be 4 byte aligned.
        // .align 4
        // nop
        // void silly_stocks_fixed(const char *input);
        // Follows AAPCS convention.
        // input is a null-terminated string in r0.
silly_stocks_fixed:
        push          {r3-r7, lr}
        // We use double the width because we need to keep alignment.
        // int64_t buf[26] = {0}
        movs          r1, #0
        movs          r5, #26*2
.Lclear_loop_fixed:
        subs          r5, #1
        push          {r1}
        bhi           .Lclear_loop_fixed
.Lclear_loop_end_fixed:
        // Load our float constants from the pool.
        movt          r1, #0x32       // 0x00320000 = 50.0 in 16-bit fixed point
        ldr           r5, .L.05.fix32 // 0x0ccccccc = 0.05 in 32-bit fixed point
.Lprocess_loop_fixed:
        // Loop until the null terminator.
        // while (r2 = *input++)
        ldrb          r2, [r0], #1
        cbz           r2, .Lprocess_loop_end_fixed
        // tolower(r2) - 'a'
        //
        // Specifically, we subtract 'a', and if the char was uppercase,
        // it would be negative, triggering the N flag, which is why we
        // check the mi condition in the following IT blocks.
        subs          r2, #'a'
        it            mi
        // if (isupper(r2))
          addmi       r2, #'a' - 'A'

        ldr           r3, [sp, r2, lsl #3]
        // fixed point multiply:
        // x<fixA> = (y<fixB> * z<fixC>) >> (B + C - A)
        // tmp<fix16> = (stock_price<fix16> * 0.05<fix32>) >> 32
        smmul         r6, r1, r5  // r6 = stock_price * 0.05
        ittee         mi
        // if (isupper(r2)) {     // Buy
          submi       r3, r1      //   profit[i]   -= stock_price
          addmi       r1, r6      //   stock_price += stock_price * 0.05
        // } else {               // Sell
          addpl       r3, r1      //   profit[i]   += stock_price
          subpl       r1, r6      //   stock_price -= stock_price * 0.05
        // } endif
        str           r3, [sp, r2, lsl #3]
        b             .Lprocess_loop_fixed
.Lprocess_loop_end_fixed:
        movs          r6, #'A'
.Lprint_loop_fixed:
        // Pop the result into d0 (also cleaning the stack)
        vpop          {d0}
        // Convert from fix16 to double
        vcvt.f64.s32  d0, d0, #16
        // Move the double result into r2 and r3. This is for the softfp ABI
        // which passes floating point values in registers.
        vmov          r2, r3, d0
        // Only check if the most signicant half of the double is zero.
        // Any non-zero double that is 0x00000000xxxxxxxx is denormal.
        cbz           r3, .Lprint_loop_skip_fixed
        // Set up an AEABI call to printf.
        adr           r0, .Lprintf_str_fixed
        // Instead of %c, store the char directly (that's why we need W+X)
        strb          r6, [r0]
        bl            printf
.Lprint_loop_skip_fixed:
        // Loop from A-Z.
        adds          r6, #1
        cmp           r6, #'Z'
        ble           .Lprint_loop_fixed
        pop           {r3-r7, pc}
        // 0.05 in fix32.
.L.05.fix32:
        .word         0x0ccccccc
        // Our printf string. We replace the X when we use it.
.Lprintf_str_fixed:
        .asciz        "X%.2f"

        .section ".testsuite_unscored","ax",%progbits
.macro $TEST str
        adr           r0, 1f
        bl            puts
        adr           r0, 1f
        bl            silly_stocks_fixed
        movs          r0, #'\n'
        bl            putchar
        b             2f
        .align 2
1:
        .asciz        "\str"
.align 2
2:
.endm

        .align 2
        .globl main
        .thumb_func
main:
        push          {r4, lr}
        $TEST         "AABaBbba"
        $TEST         "DGdg"
        $TEST         "ADJdja"
        pop           {r4, pc}

For the reference, here is the results for float vs fixed point at 6 digits of precision.
AABaBbba
float: A:7.488484,B:2.474079,
fixed: A:7.488434,B:2.474060,
DGdg
float: D:5.125000,G:-0.131250,
fixed: D:5.124969,G:-0.131256,
ADJdja
float: A:2.237828,D:5.381250,J:-0.137812,
fixed: A:2.237808,D:5.381226,J:-0.137817,

Perl 5 -MList::Util=pairmap -F, 80 bytes
$p=50;map{$k{uc$_}+=$q=95>ord?-$p:$p;$p-=$q/20}@F;pairmap{printf"$a:%.2f ",$b}%k

Try it online!

Javascript (ES6, Node.js), 136 bytes
Source
s=>(m=50,a={},[...s].map(p=>(u=p.toUpperCase(),n=p==u?1:-1,a[u]=(a[u]||0)-m*n,m*=1+n/20)),Object.keys(a).map(k=>a[k]=a[k].toFixed(2)),a)

Explanation
f=s=>( // (s)tring
    m=50, // stock value (m)oney
    a={}, // (a)ll people
    [...s].map(
        p=>(
            u=p.toUpperCase(), // (u)ppercase: used to group buys and sells for each person
            n=p==u?1:-1, // sig(n): 1 for buy, -1 for sell
            a[u]=(a[u]||0)-m*n, // adjust balance with stock value and sign
            m*=1+n/20 // adjust stock value
        )
    ),
    Object.keys(a).map(k=>a[k]=a[k].toFixed(2)), // round profits
    a // return profits
)

Proof

f=s=>(m=50,a={},[...s].map(p=>(u=p.toUpperCase(),n=p==u?1:-1,a[u]=(a[u]||0)-m*n,m*=1+n/20)),Object.keys(a).map(k=>a[k]=a[k].toFixed(2)),a)
const TESTS = [
    ['AABaBbba',{A:'7.49',B:'2.47'}],
    ['DGdg',{D:'5.13',G:'-0.13'}],
    ['ADJdja',{A:'2.24',D:'5.38',J:'-0.14'}]
]

TESTS.forEach(([input,expected])=>{
    console.log(input);
    console.log(expected);
    console.log(f(input))
});

133 bytes using return method of other answer

J, 64 bytes
tolower(~.@[,.(0j2":_50*+/)/.)](]*1*/\@}:@,1+0.05*])_1+2*91>3&u:

Try it online!


text:
Plurality Voting with Cellular Automata
There's a really important problem in cellular automata called the Majority problem:

The majority problem, or density classification task is the problem of finding one-dimensional cellular automaton rules that accurately perform majority voting.
...
Given a configuration of a two-state cellular automata with i + j cells total, i of which are in the zero state and j of which are in the one state, a correct solution to the voting problem must eventually set all cells to zero if i > j and must eventually set all cells to one if i < j. The desired eventual state is unspecified if i = j.

Although it has been proven that no cellular automata can solve the majority problem in all cases, there are many rules that can can solve it in the majority of cases. The Gacs-Kurdyumov-Levin automaton has an accuracy of about 78% with random initial conditions.  The GKL rule isn't complicated:

Radius of 3, meaning that the cell's new state depends on 7 previous cells:  itself, the 3 cells to the right, and the 3 cells to the left.
If a cell is currently O, its new state is the majority of itself, the cell to its left, and the cell 3 steps to its left.
If a cell is currently 1, its new state is the majority of itself, the cell to its right, and the cell 3 steps to its right.

Here is an example:
0 1 0 1 1 1 0 1 1 0 1 0 0 1
0 1 1 1 1 1 1 1 0 0 1 1 0 0
0 1 1 1 1 1 1 1 1 0 1 0 0 0
0 1 1 1 1 1 1 1 0 1 0 1 0 0
0 1 1 1 1 1 1 0 1 0 1 0 1 0
0 1 1 1 1 1 0 1 0 1 0 1 1 1
1 1 1 1 1 0 1 0 1 1 1 1 1 1
1 1 1 1 0 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1

In this example, the cellular automaton correctly calculated that 8 > 6.  Other examples take longer periods of time, and produce some cool patterns in the meantime.  Below are two examples I randomly found.
0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 1 1 1 1 0 1 0 0 1 1 1
1 0 0 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 1 0 0 1 1

Taking it to the next level
As far as my internet research has shown, almost all academic research on the majority problem has been conducted with 2-state CAs.  In this challenge, we are going to expand the majority problem to 3-state CAs.  I will call this the plurality problem.  Plurality, or relative majority, refers to the condition in which one of the options has more votes than each of the alternatives, but not necessarily a majority of all votes.
Problem Statement

There is a 3-state 1D cellular automaton with radius 3.
There are 151 cells with a circular boundary condition.
These cells are given a random starting state, on the sole condition that 1 of the 3 states has a strict plurality.  "Random" means an independent uniform distribution for each cell.
The accuracy of a rule is the percentage of (valid) random initial conditions in which all of the cells synchronize to the correct state (the one with plurality) within 10000 generations.
The goal is to find a rule with high accuracy,

Plurality edge cases: Any configuration with 50/50/51 is a valid starting configuration (since there is a strict plurality), while any configuration with 51/51/49 is not valid (since there is not a strict plurality).
The search space is 3^3^7 (~3e1043), far outside the reach of any exhaustive search.  This means that you will need to make use of other techniques, like genetic algorithms, in order to solve this problem.  It will also take some human engineering.
The 10000 generation rule is subject to change, depending on the runtimes/accuracy of the rules people find.  If it is too low to allow reasonable rates of convergence, then I can raise it.  Alternatively, I can lower it to serve as a tie-breaker.
Winning
The winner is the person who submits the radius-3 CA rule with the highest accuracy out of all of the contestants.
Your submission should include...

A description of the rule (using Wolfram code if necessary)
The accuracy rate and sample size
A reasonably-sized explanation of how you discovered the rule, including programs you wrote to solve it, or any "manual" engineering.  (This being the most interesting part, since everything else is just raw numbers.)

Prior Work

A paper by Juille and Pollack, describing how they evolved a 2-state rule with 86% accuracy.
This paper used r=3, 149-cell, 2-state CAs.  It did not attempt to the solve the majority problem, however, but instead to find rules that quickly resulting in an alternating all-1-all-0 pattern. Despite these differences, I suspect many techniques will be similar.
A  (not very helpful because it's behind a paywall) paper by Wolz and de Oliviera which currently hold the 2-state record

I was very disappointed / surprised to find this has nothing to do with Plurality Voting.

@cat I actually feel like it does.  Each cell's state could represent its "vote" (choice of 1 of 3 candidates), and the goal is to determine the winner of the election.

This is an interesting code challenge.  I'm not a golfer, so its always a pleasure to see these sorts of puzzles.

Sort of GKL plus hill climbing, 61.498%

If a cell is a 0, look at the cells 3 to the left, 1 to the left and at itself. Set value to majority. If it's a tie, stay the way you are.

If a cell is a 1, look at the cells 3 to the right, 1 to the right and at itself. Set value to majority. If it's a tie, stay the way you are.

If a cell is a 2, look at the cells 2 to the left, 2 to the right and 3 to the right. Set value to majority. If it's a tie, stay the way you are.

I got 59453 right out of 100000 total, 59.453%
Some mutating and hill-climbing resulted in 61498/100000 = 61.498%.
I'll probably test a bit more and will post some more information later.

You should probably include the actual 61.498% rule so people can verify it.

You should probably do the tests you (will) do.

"Just toss out the 2s and do GKL" -- 55.7%
It's not so easy to guess what a good rule would be, so I tried to at least come up with something that would score above 1/3. The strategy is to try to get the right answer when the majority state is 0 or 1, and accept the loss if it's 2. It scored 56.5% over 100,000 trials, which is somehow slightly better than what would be expected from multiplying 78% (score of GKL) * 2/3 (fraction of the time when answer is 0 or 1) = 52%.
More concretely, the strategy is as follows:

If the cell is 0 or 1, take the majority of the 3 cells as in the GKL strategy, but ignoring any neighbors that are 2. If it's a tie, leave the cell unchanged.
If the cell is 2, choose whichever is more numerous  of 0 or 1 in the entire neighborhood. If it's a tie, choose the leftmost value that is 0 or 1. If all the neighbors are 2, stay 2.

I used this code to test:
#include <iostream>
#include <algorithm>
#include <string.h>
#include <random>
#include <cassert>

#define W 151
#define S 3
#define R 3

typedef int state;

struct tape {
    state s[R+W+R];
    state& operator[](int i) {
        return s[i + R];
    }
    template<typename Rule> void step(Rule r) {
        for(int i = 0; i < R; i++) s[i] = s[W + i];
        for(int i = 0; i < R; i++) s[R + W + i] = s[R + i];
        for(int i = 0; i < W; i++) {
            s[i] = r(s + R + i);
        }
        memmove(s + R, s, W * sizeof(*s));
    }

    state unanimous() {
        state st = (*this)[0];
        for(int i = 1; i < W; i++) {
            if((*this)[i] != st)
                return -1;
        }
        return st;
    }
};

std::ostream& operator<<(std::ostream& s, tape& t) {
    for (int i = 0; i < W; i++)
        s << t[i];
    return s;
}

state randomize(tape& t) {
    static std::mt19937 rg(390332);
    begin:
    int c[S]{};
    for(int i = 0; i < W; i++) {
        state s = rg() % S;
        c[s]++;
        t[i] = s;
    }
    state* smax = std::max_element(c, c + R);
    int nmaj = 0;
    for (int n : c) nmaj += n == *smax;
    if (nmaj > 1) goto begin;
    return smax - c;
}

template<bool PrintSteps, typename Rule> int simulate(Rule r, int trials, int giveup) {
    int successes = 0;
    for(state s = 0; s < S; s++) {
        state t[2 * R + 1];
        for(int i = 0; i <= 2 * R; i++) t[i] = s;
        assert(r(t + R) == s);
    }
    while(trials--) {
        tape tp;
        state desired = randomize(tp);
        int steps = giveup;
        while(steps--) {
            tp.step(r);
            state u = tp.unanimous();
            if(~u) {
                bool correct = u == desired;
                if(PrintSteps) {
                    std::cout << correct << ' ' << giveup - steps << '\n';
                }
                successes += correct;
                break;
            }
        }
    }
    return successes;
}

struct ixList {
    int n;
    int i[2 * R + 1];
};

state rule_justTossOutThe2sAndDoGKL(const state* t) {
    const ixList ixl[] = {
        { 3,{ -3, -1, 0 } },
        { 3,{ 0, 1, 3 } },
        { 6,{ -3, -2, -1, 1, 2, 3 } }
    };
    int c[S]{};
    for (int i = 0; i < ixl[*t].n; i++)
        c[t[ixl[*t].i[i]]]++;
    if (c[0] > c[1]) return 0;
    if (c[1] > c[0]) return 1;
    if (*t < 2) return *t;
    for (int i = -R; i <= R; i++)
        if (t[i] < 2) return t[i];
    return 2;
}

int main()
{
    int nt = 100000;
    int ns = simulate<false>(rule_justTossOutThe2sAndDoGKL, nt, 10000);

    std::cout << (double)ns / nt << '\n';
    return 0;
}

The score is higher than you might expect because it increases with the generation limit.  The 78% score of GKL is actually for a very small limit of a couple hundred gens or so.  In contrast, 10,000 gens would give GKL a higher accuracy rate, probably in line with the results you are getting.

"Just steal whatever's best and evolve it", bleh
Edit: in its current state this answer, rather than finding better patterns, finds a better random sample.
This answer encodes/decodes solutions by enumerating all states as ternary numbers (least-significant digit first). The solution for 59.2%:
000000000010010010000000000000000000000000000000000000000000010000010000110000000
000000000010010010000000000111111101111111111111111111000011000010011011000011010
000000000012010011001000000021111111111120111211111111000000000000011010000010000
000011000010022110000000202000000002000000000020000000001010000000011011000011010
020000000010010010001000000111101111111111111111111111010011000011111111010011010
000000000010010010000000000111111111101111111111112111000011010110111011010011011
000000000010010010000000000010000000000000000100002011000000000100011010020010000
000020020010010010000200000111102111111111111111111101000011010010111011000011011
000100000010010010000000000121111111111111111111111111000210000012011011002011010
000000000010010110000000000111112112111111111001111111000010000010011011000011010
000000000010010120000200000111211111111111111111110111110011010011100111010011011
000000000010010010000000000011111111111111111111111111000011010010111211210012020
010000000010010010020100020111110111111111111111111110010111010011011111010111011
002000000010010010000000000111110111111111211111111111001111111111111111111111111
000000000110010010000000000111111111111111211111111111010111011111111111011111011
001000000010010010000000000011111101111111111111110111000011010010111011010011010
001000000010010110000000000111111111111111102111110111010111011111111111011111101
000000000210010010000000000111111111111111111111011111010011010011111111010111011
000000000010010010000000000112111111111111111111101011000000000000011010000010000
000000000010010010000000000111111111111111111111111111000011010010111011010011011
000200000012010010000000000111111111111112111111111111000010000210011211001011010
000000000010010211000002000111111111111111111111111111000001010010111011010011010
000021200010210010000101100111111111111211111110110211010111021111111101010111111
000000000010010010000000000111111111111101111111111111010011010111111111010110021
000200000010010010000000010111111111101111111121112111000210001010011011000011010
000000000010010010000000000111111111111111111111111111210011010021111111010111011
000020000010010010000000000111111111111111111111111111000011010010121011010011012

This answer was evolved from feersum's 55.7%, using the following code. This code requires libop, which is my personal C++ header-only library. It's very easy to install, just do git clone https://github.com/orlp/libop in the same directory as where you've saved the program. I suggest compiling with g++ -O2 -m64 -march=native -std=c++11 -g. For speedy development I also suggest precompiling libop by running the above command on libop/op.h.
#include <cstdint>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <random>

#include "libop/op.h"

constexpr int MAX_GENERATIONS = 500;
constexpr int NUM_CELLS = 151;

std::mt19937_64 rng;

double worst_best_fitness;

// We use a system with okay-ish memory density. We represent the ternary as a
// 2-bit integer. This means we have 32 ternaries in a uint64_t.
//
// There are 3^7 possible states, requiring 4374 bits. We store this using 69
// uint64_ts, or little over half a kilobyte.

// Turn 7 cells into a state index, by encoding as ternary.
int state_index(const int* cells) {
    int idx = 0;
    for (int i = 0; i < 7; ++i) {
        idx *= 3;
        idx += cells[6-i];
    }
    return idx;
}

// Get/set a ternary by index from a 2-bit-per-ternary encoded uint64_t array.
int get_ternary(const uint64_t* a, size_t idx) {
    return (a[idx/32] >> (2*(idx % 32))) & 0x3;
}

void set_ternary(uint64_t* a, size_t idx, int val) {
    assert(val < 3);
    int shift = 2*(idx % 32);
    uint64_t shifted_val = uint64_t(val) << shift;
    uint64_t shifted_mask = ~(uint64_t(0x3) << shift);
    a[idx/32] = (a[idx/32] & shifted_mask) | shifted_val;
}

struct Rule {
    uint64_t data[69];
    double cached_fitness;

    Rule(const char* init) {
        cached_fitness = -1;
        for (auto i : op::range(69)) data[i] = 0;
        for (auto i : op::range(2187)) set_ternary(data, i, init[i] - '0');
    }

    double fitness(int num_tests = 1000);

    Rule* random_mutation(int num_mutate) const {
        auto new_rule = new Rule(*this);

        auto r = op::range(2187);
        std::vector<int> indices;
        op::random_sample(r.begin(), r.end(),
                          std::back_inserter(indices), num_mutate, rng);

        for (auto idx : indices) {
            set_ternary(new_rule->data, idx, op::randint(0, 2, rng));
        }

        new_rule->cached_fitness = -1;
        return new_rule;
    }

    int new_state(const int* cells) const {
        return get_ternary(data, state_index(cells));
    }

    void print_rule() const {
        for (auto i : op::range(2187)) {
            std::cout << get_ternary(data, i);
            if (i % 81 == 80) std::cout << "\n";
        }
    }
};

struct Automaton {
    uint64_t state[5];
    int plurality, generation;

    Automaton() : generation(0) {
        for (auto i : op::range(5)) state[i] = 0;

        int strict = 0;
        while (strict != 1) {
            int votes[3] = {};
            for (auto i : op::range(NUM_CELLS)) {
                int vote = op::randint(0, 2, rng);
                set_ternary(state, i, vote);
                votes[vote]++;
            }

            // Ensure strict plurality.
            plurality = std::max_element(votes, votes + 3) - votes;
            strict = 0;
            for (auto i : op::range(3)) strict += (votes[i] == votes[plurality]);
        }
    }

    void print_state() {
        for (int i = 0; i < 151; ++i) std::cout << get_ternary(state, i);
        std::cout << "\n";
    }

    bool concensus_reached() {
        int target = get_ternary(state, 0);
        for (auto i : op::range(NUM_CELLS)) {
            if (get_ternary(state, i) != target) return false;
        }

        return true;
    }

    void next_state(const Rule& rule) {
        uint64_t new_state[5] = {};

        std::vector<int> cells;
        for (auto r : op::range(-3, 4)) {
            cells.push_back(get_ternary(state, (r + NUM_CELLS) % NUM_CELLS));
        }

        for (auto i : op::range(NUM_CELLS)) {
            set_ternary(new_state, i, rule.new_state(cells.data()));
            cells.erase(cells.begin());
            cells.push_back(get_ternary(state, (i + 4) % NUM_CELLS));
        }

        for (auto i : op::range(5)) state[i] = new_state[i];
        generation++;
    }
};

double Rule::fitness(int num_tests) {
    if (cached_fitness == -1) {
        cached_fitness = 0;
        int num_two = 0;
        for (auto test : op::range(num_tests)) {
            Automaton a;
            while (a.generation < MAX_GENERATIONS && !a.concensus_reached()) {
                a.next_state(*this);
            }

            if (a.generation < MAX_GENERATIONS &&
                get_ternary(a.state, 0) == a.plurality &&
                a.plurality == 2) num_two++;

            cached_fitness += (a.generation < MAX_GENERATIONS &&
                               get_ternary(a.state, 0) == a.plurality);

            if (cached_fitness + (num_tests - test) < worst_best_fitness) break;
        }

        if (num_two) std::cout << cached_fitness << " " << num_two << "\n";

        cached_fitness;
    }

    return cached_fitness;
}

int main(int argc, char** argv) {
    std::random_device rd;
    rng.seed(42); // Seed with rd for non-determinism.

    const char* base =
        "000000000010010010000000000000000000000000000000000000000000000000010000000000000"
        "000000000010010010000000000111111111111111111111111111000010000010011011000011010"
        "000000000010010010000000000111111111111111111111111111000000000000011010000010000"
        "000000000010010010000000000000000000000000000000000000000010000010011011000011010"
        "000000000010010010000000000111111111111111111111111111010011010011111111010111011"
        "000000000010010010000000000111111111111111111111111111000011010010111011010011011"
        "000000000010010010000000000000000000000000000000000000000000000000011010000010000"
        "000000000010010010000000000111111111111111111111111111000011010010111011010011011"
        "000000000010010010000000000111111111111111111111111111000010000010011011000011010"
        "000000000010010010000000000111111111111111111111111111000010000010011011000011010"
        "000000000010010010000000000111111111111111111111111111010011010011111111010111011"
        "000000000010010010000000000111111111111111111111111111000011010010111011010011010"
        "000000000010010010000000000111111111111111111111111111010011010011111111010111011"
        "000000000010010010000000000111111111111111111111111111011111111111111111111111111"
        "000000000010010010000000000111111111111111111111111111010111011111111111011111111"
        "000000000010010010000000000111111111111111111111111111000011010010111011010011010"
        "000000000010010010000000000111111111111111111111111111010111011111111111011111111"
        "000000000010010010000000000111111111111111111111111111010011010011111111010111011"
        "000000000010010010000000000111111111111111111111111111000000000000011010000010000"
        "000000000010010010000000000111111111111111111111111111000011010010111011010011011"
        "000000000010010010000000000111111111111111111111111111000010000010011011000011010"
        "000000000010010010000000000111111111111111111111111111000011010010111011010011010"
        "000000000010010010000000000111111111111111111111111111010111011111111111011111111"
        "000000000010010010000000000111111111111111111111111111010011010011111111010111011"
        "000000000010010010000000000111111111111111111111111111000010000010011011000011010"
        "000000000010010010000000000111111111111111111111111111010011010011111111010111011"
        "000000000010010010000000000111111111111111111111111111000011010010111011010011012"
    ;

    // Simple best-only.
    std::vector<std::unique_ptr<Rule>> best_rules;
    best_rules.emplace_back(new Rule(base));
    worst_best_fitness = best_rules.back()->fitness();
    while (true) {
        const auto& base = *op::random_choice(best_rules.begin(), best_rules.end(), rng);
        std::unique_ptr<Rule> contender(base->random_mutation(op::randint(0, 100, rng)));

        // Sort most fit ones to the beginning.
        auto most_fit = [](const std::unique_ptr<Rule>& a, const std::unique_ptr<Rule>& b) {
            return a->fitness() > b->fitness();
        };

        if (contender->fitness() >= best_rules.back()->fitness()) {
            std::cout << contender->fitness();
            double contender_fitness = contender->fitness();
            best_rules.emplace_back(std::move(contender));
            std::sort(best_rules.begin(), best_rules.end(), most_fit);
            if (best_rules.size() > 5) best_rules.pop_back();
            std::cout << " / " << best_rules[0]->fitness() << "\n";
            worst_best_fitness = best_rules.back()->fitness();

            if (contender_fitness == best_rules.front()->fitness()) {
                best_rules.front()->print_rule();
            }
        }
    }

    return 0;
}

Hand Coded, 57.541%
This actually only looks at the 5 cells above it. It could probably be improved by increasing the range it looks at. Ran with 100,000 test cases.
Algorithm:
If above == 0:
   if to the left there are only 2s or there is a 1 separated by 2s
       next state = 2
   else
       next state = 0
If above == 1:
   if to the right there are only 2s or there is a 0 separated by 2s
       next state = 2
   else
       next state = 1
If above == 2:
   ignore 0s to the left if the 0 is left of a 1 on the left
   ignore 1s to the right if the 1 is right of a 0 on the right
   if the closest 0 on the left is closer than the closest 1 on the right
       next state = 0
   else if the closest 1 on the right is closer than the closest 0 on the left
       next state = 1
   else
       next state = 2

Gene:
000000000222222222000222222222222222222222222222222222000000000222222222000222222
000000000222222222000222222111111111111111111111111111000222222111111111111111111
000000000222222222000222222222222222222222222222222222000000000222222222000222222
000000000222222222000222222222222222222222222222222222000000000222222222222222222
000000000222222222000222222111111111111111111111111111222111111111111111111111111
000000000222222222000222222111111111111111111111111111000000000111111111222111111
000000000222222222000222222222222222222222222222222222000000000222222222000222222
000000000222222222000222222111111111111111111111111111000222222111111111111111111
000000000222222222000222222222222222222222222222222222000000000222222222000222222
000000000222222222000222222222222222222222222222222222000000000222222222000222222
000000000222222222000222222111111111111111111111111111000222222111111111111111111
000000000222222222000222222222222222222222222222222222000000000222222222000222222
000000000222222222000222222222222222222222222222222222000000000222222222222222222
000000000222222222000222222111111111111111111111111111222111111111111111111111111
000000000222222222000222222111111111111111111111111111000000000111111111222111111
000000000222222222000222222222222222222222222222222222000000000222222222000222222
000000000222222222000222222111111111111111111111111111000222222111111111111111111
000000000222222222000222222222222222222222222222222222000000000222222222000222222
000000000222222222000222222222222222222222222222222222000000000222222222000222222
000000000222222222000222222111111111111111111111111111000222222111111111111111111
000000000222222222000222222222222222222222222222222222000000000222222222000222222
000000000222222222000222222222222222222222222222222222000000000222222222222222222
000000000222222222000222222111111111111111111111111111222111111111111111111111111
000000000222222222000222222111111111111111111111111111000000000111111111222111111
000000000222222222000222222222222222222222222222222222000000000222222222000222222
000000000222222222000222222111111111111111111111111111000222222111111111111111111
000000000222222222000222222222222222222222222222222222000000000222222222000222222

Testing code:
import java.lang.Math.*
import java.util.*

const val RADIUS = 3;
const val STATES = 3;
const val DIAMETER = 2 * RADIUS + 1
const val TAPE_LENGTH = 151

val CODE_SIZE = pow(STATES.toDouble(), DIAMETER.toDouble()).toInt()

const val GRADE_RUNS = 100000
const val GRADE_MAX_TIME = 10000

operator fun IntArray.inc() : IntArray {
    val next = this.clone()
    var i = 0
    while (i < size) {
        if (this[i] == STATES - 1) {
            next[i] = 0
        } else {
            next[i]++
            break
        }
        i++
    }
    return next
}
val IntArray.index : Int
    get() {
        var total = 0
        for (i in (size - 1) downTo 0) {
            total *= STATES
            total += this[i]
        }
        return total
    }

interface IRule {
    operator fun get(states : IntArray) : Int
}

fun IntArray.equalsArray(other: IntArray) = Arrays.equals(this, other)

class Rule : IRule {

    constructor(rule : IRule) {
        val start = IntArray(DIAMETER)
        var current = start.clone()

        code = IntArray(CODE_SIZE)
        try {
            do {
                code[current.index] = rule[current]
                current++
            } while (!current.equalsArray(start));
        } catch (e : Throwable) {
            println(Arrays.toString(code))
            println(Arrays.toString(current))
            throw e
        }
    }
    constructor(code : IntArray) {
        this.code = IntArray(CODE_SIZE) { if (it < code.size) code[it] else 0 }
    }

    val code : IntArray

    override fun get(states: IntArray) : Int {
        return code[states.index]
    }

    override fun toString() : String {
        val b = StringBuilder()
        for (i in 0 until CODE_SIZE) {
            if (i > 0 && i % pow(STATES.toDouble(), RADIUS.toDouble() + 1).toInt() == 0) {
                b.append('\n')
            }
            b.append(code[i])
        }
        return b.toString()
    }

    fun grade() : Double {
        var succeeded = 0
        for (i in 0 until GRADE_RUNS) {
            if (i % (GRADE_RUNS / 100) == 0) {
                println("${i/(GRADE_RUNS / 100)}% done grading.")
            }
            var tape : Tape
            do {
                tape = Tape()
            } while (tape.majority() == -1);
            val majority = tape.majority()
            val beginning = tape
            var j = 0
            while (j < GRADE_MAX_TIME && !tape.allTheSame()) {
                tape = tape.step(this)
                j++
            }
            if (tape.stabilized(this) && tape.majority() == majority) {
                succeeded++
            }/* else if (beginning.majority() != 2) {
                println(beginning.majority())
                tape = beginning
                for (j in 1..100) {
                    println(tape)
                    tape = tape.step(this)
                }
                println(tape)
            }*/
        }
        return succeeded.toDouble() / GRADE_RUNS
    }

}

fun getRandomState() : Int {
    return (random() * STATES).toInt()
}

class Tape(val tape : IntArray) {

    constructor() : this(IntArray(TAPE_LENGTH) { getRandomState() } )

    fun majority() : Int {
        val totals = IntArray(STATES)

        for (cell in tape) {
            totals[cell]++
        }

        var best = -1
        var bestScore = -1

        for (i in 0 until STATES) {
            if (totals[i] > bestScore) {
                best = i
                bestScore = totals[i]
            } else if (totals[i] == bestScore) {
                best = -1
            }
        }

        return best
    }

    fun allTheSame() : Boolean {
        for (i in 1 until TAPE_LENGTH) {
            if (this[i] != this[0]) {
                return false
            }
        }
        return true
    }

    operator fun get(index: Int) = tape[((index % TAPE_LENGTH) + TAPE_LENGTH) % TAPE_LENGTH]

    fun step(rule : IRule) : Tape {
        val nextTape = IntArray ( TAPE_LENGTH )

        for (i in 0 until TAPE_LENGTH) {
            nextTape[i] = rule[IntArray(DIAMETER) { this[i + it - RADIUS] }]
        }

        return Tape(nextTape)
    }

    fun stabilized(rule : IRule) = allTheSame() && majority() == step(rule).majority()

    override fun toString() : String {
        val b = StringBuilder()
        for (cell in tape) {
            b.append(cell)
        }
        return b.toString()
    }

}

fun main(args : Array<String>) {
    val myRule = Rule(object : IRule {
        override fun get(states: IntArray): Int {
            if (states[3] == 0) {
                if (states[2] == 1) {
                    return 2
                } else if (states[2] == 0) {
                    return 0
                } else if (states[1] == 1) {
                    return 2
                } else if (states[1] == 0) {
                    return 0
                } else {
                    return 2
                }
            } else if (states[3] == 1) {
                if (states[4] == 0) {
                    return 2
                } else if (states[4] == 1) {
                    return 1
                } else if (states[5] == 0) {
                    return 2
                } else if (states[5] == 1) {
                    return 1
                } else {
                    return 2
                }
            } else {
                if (states[2] == 0) {
                    if (states[4] != 1) {
                        return 0
                    }
                } else if (states[4] == 1) {
                    return 1
                }
                if (states[1] == 0 && states[2] != 1) {
                    if (states[5] != 1) {
                        return 0
                    }
                } else if (states[5] == 1 && states[4] != 0) {
                    return 1
                }
                return 2
            }
        }

    })
    var tape = Tape()
    println(myRule.grade())
}

Example

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
Remove digits, retaining greater number
Introduction
This challenge consists in finding the greatest number removing y digits from the original number n which has x digits.
Assuming y=2 n=5263 x=4, the possible numbers removing y=2 digits are:
[52, 56, 53, 26, 23, 63]

So, the greatest number is 63 which must be the output for this example.

Another logic would be: for each y, search from left to right the digit which right next digit is greater, then remove it, else when no match, remove the last y-digits.
Using y=3 n=76751432 x=8 to explain:
y=3
76751432
-^------ remove 6 because right next 7 is greater

y=2
7751432
---^--- remove 1 because right next 4 is greater

y=1
775432
-----^ the search failed, then remove last y digits

result = 77543

Both methods explained above works.. of course, you can use another method too :)
Challenge
The number n won't have more than 8 digits, and y will always be greater than zero and lower than x.
To avoid strict input format, you can use the values: y n x the way you prefer: as parameters in function, raw input, or any other valid way. Just don't forget to say how you did that in your answer.
The output should be the result number.
This is code-golf, the shortest answer in bytes wins.
Example Input and Output
Again: you do not need to be too strict :)
4 1789823 7 -> 983
1 54132 5   -> 5432
3 69314 5   -> 94
2 51794 5   -> 794

Edit
I changed the input order to reflect the fact that some of you may not need the x value to solve the problem. x is now an optional value.

Please allow more general input and output, requiring a specific string format is usually a bad idea.

@xnor But some answers have already been posted...?

That's tricky, edits after answers are usually frowned upon. Here, though, I think the input processing is separate enough that answers could change it easily.

@LuisMendo I wouldn't mind editing the I/O in mine. ¯\(ツ)/¯

Ok, I too will change my answer (tomorrow) if input format is made more flexible. I suggest that at least the current format should continue to be allowed

Just to check, in other words, the problem is to find the size (x-y) substring of n with the greatest numeric value?

-1 because of the strict I/O requirements, +1 for an interesting challenge. Overall, a solid sidevote.

The input format is too strict as others have said, especially considering that x is kind of a useless information.

Sorry me for that, I didn't know it would impact so much on the answers... I've updated my question

@Fatalize Actually, I think that depending on the approach you take, having x as input can shorten the code. (Case in point: my Julia answer.)

@WashingtonGuedes No problem. It's your first question and I think overall you've done a splendid job. :)

A-Ray, 9 7 bytes
My new language! According to meta, this is allowed, but if this is not accepted, then I will remove it.
pM:i-II

Explanation:
  :i-II       Gets all permutations possible for the given number converted to an array,
                      with the length of y-x, which is the -II part
 M            Gets the maximum of the result above
p             Prints the resulting array above, with no separators

Example input (number, x, y):
1736413 7 4

Output:
764

You can test this with the .jar file given in the github link.

MATL, 10 bytes
-jowXncUX>

This uses version (9.2.1) of the language/compiler, which is earlier than this challenge.
It takes three inputs from stdin in this order: string length, number of removed characters, string.
Example
>> matl
 > -jowXncUX>
 >
> 7
> 4
> 1789823
983

EDIT: Try it online! (the code in the link has XN instead of Xn to conform to changes in the language after this challenge; also, o is not needed anymore)
Explanation
(This still costs 2 bytes more than it should due to Octave's and Matlab's nchoosek function behaving differently. Fixed in the next release of the compiler.)
-        % implicitly input two numbers, and subtract them
jo       % input string, and convert to ASCII codes
wXn      % swap inputs. Generate all combinations, each in a row
c        % convert to char array
U        % convert each row to a number
X>       % get maximum. Implicitly display

Answer to original challenge (stricter input requirements): 16 bytes
jYbZ)b-wowXncUX>

Uses current version (9.2.1) of the language/compiler.
Example
>> matl jYbZ)b-wowXncUX>
> 4 1789823 7
983

Explanation
(This should have been 4 bytes less, but I need that wow...c because Octave's nchoosek function, unlike Matlab's, doesn't work with character input. Will be fixed for next release of the compiler.)
j              % input string
YbZ)           % split at spaces into strings
b-             % subtract first and third (1-digit) strings
wow            % convert middle string into ASCII codes
Xn             % get all combinations, each in a row
c              % convert to char array
U              % convert each row to a number
X>             % get maximum. Implicitly display

wow Your code is amazed at its own shortness ;)

@ETHproductions Haha. Well, with the new input requirements it lost 6 bytes and got... speechless

Pyth - 11 9 8 bytes
eS.cz-QE

Test Suite.

Nice golf, but doesn't adhere to the input formatting?

@Lui oh, didn't see that it was that strict, fixing.

Fair enough, it looks like there is some discussions about it in the comments on the question itself, but it isn't resolved.

@L fixed. SPACE FILLER.

Looks better, but I think the input also has x on the same line, where x is the number of digits in the main integer? ie: 2 5263 4.

@Lui OP edited to say it was optional.

Ah, okay, I didn't see that sorry. Nice work!

The OP was edited. Strict formatting is not needed now, so you can probably just do eS.cQ-lQE and take the input like n\ny.

Julia, 128 95 bytes
f(y,n,x)=maximum(i->parse(join(i)),filter(k->endof(k)==x-y,reduce(vcat,partitions(["$n"...]))))

This is a function that accepts the three values as parameters and returns an integer.
Ungolfed:
function f{T<:Integer}(y::T, n::T, x::T)
    # Get all ordered partitions of the digits of n
    p = reduce(vcat, partitions(["$n"...]))

    # Filter to groups of size x-y
    g = filter(k -> endof(k) == x - y, p)

    # Get the maximum resulting number
    return maximum(i -> parse(join(i)), g)
end

Japt, 19 bytes
Vs ¬àW-U m¬mn n!- g

Try it online!
How it works
        // Implicit: U = y, V = n, W = x
Vs ¬    // Convert V into a string, then split into an array of chars.
àW-U    // Generate all combinations of length W-U.
m¬mn    // Join each pair back into a string, then convert each string to a number.
n!-     // Sort by backwards subtraction (b-a instead of a-b; highest move to the front).
g       // Get the first item in this list.
        // Implicit: output last expression

Brachylog, 30 bytes
,{,[N:Y].hs?lL,Nl-Y=L}?:1forh.

Since OP has relaxed the constraints on IO, this expects [Number, NumberOfDigitsRemoved] as input and returns the answer as output, e.g. brachylog_main([1789823,4], Z)..
Explanation
,{                   }?:1f     § Declare sub-predicate 1 and find all inputs which satisfy
                               § this sub-predicate with output = Input of the main predicate
                               § (i.e. [Number, Number of digits to remove])

                               § -- Sub-predicate 1 --
  ,[N:Y].                      § Output = [N, Y]
         hs?                   § Input = a subset of N
            lL,Nl-Y=L          § Length of Input = Length of N - Y

                          orh. § Order the list of answers, reverse it an return the first
                               § element (i.e. the biggest number of the list)

Python 3, 69 bytes
This defines an anonymous function accepting all three arguments. Taking full advantage of the rule that "you can use the values: y n x the way you prefer", I have chosen to accept y and x as integers and n as a string. The return value is a string.
from itertools import*
lambda y,n,x:''.join(max(combinations(n,x-y)))

Just in case anyone feels that this is stretching the rules too far, this version takes all inputs as integers and is 74 bytes.
from itertools import*
lambda y,n,x:''.join(max(combinations(str(n),x-y)))

And just for kicks, I also wrote a two-argument version, taking y and n from the command line and printing the result to STDOUT. It's 92 bytes.
import sys,itertools as i
_,y,n=sys.argv
print(*max(i.combinations(n,len(n)-int(y))),sep='')

ES6, 70 bytes
r=(y,n)=>y?r(y-1,Math.max(...`${n}`.replace(/./g," $`$'").split` `)):n

Returns a numeric result unless y is falsy and n is a string. I've convinced myself that doing the recursion the wrong way around still works (my solution isn't applicable to doing the correct recursion).
Also my first code golf where I use all three quote signs (although not all as quotes), which prevented me from trivially calculating the length.

Haskell, 64 bytes
import Data.List
y#x=maximum.filter((==x-y).length).subsequences

Usage example: (4#7)"1789823" -> "983".
The original number n is takes as a string. (Not sure if I'm overstressing the "no strict input format" rule, but string input was required(!) in the first version).
How it works: make a list of all subsequences of n, keep those with length x-y and pick the maximum.

Ruby, 40 bytes
->y,n,x{n.chars.combination(x-y).max*''}

This is an anonymous function that takes y and x as integers and n as a string, and returns a string. You may call it for instance like this
->y,n,x{n.chars.combination(x-y).max*''}[2,"5263",4]

and it will return "63".

MATLAB 40 bytes
@(n,y)max(str2num(nchoosek(n,nnz(n)-y)))

Test:
ans('76751432',3)
ans = 77543

Pyth, 45 bytes
=cz)Fk.P@z1-l@z1v@z0I:@z1j".*"k1I>vkZ=Zvk)))Z

try it here

JavaScript (ES6), 78
A recursive function with 2 arguments y and d. y can be numeric or string, d must be a string.
r=(y,d)=>y?Math.max(...[...d].map((x,i)=>r(y-1,d.slice(0,i)+d.slice(i+1)))):+d

Before the challenge changed it was 107 - ... with all input/output oddities ...
x=>(r=(n,d)=>n?Math.max(...[...d].map((x,i)=> r(n-1,d.slice(0,i)+d.slice(i+1)))):+d)(...x.match(/\d+/g))+'\n'

Test

r=(y,d)=>y?Math.max(...[...d].map((x,i)=>r(y-1,d.slice(0,i)+d.slice(i+1)))):+d

function test() {
  [a,b]=I.value.match(/\d+/g)
  O.textContent=r(a,b)
}

test()
y,n: <input id=I value='4 1789823' oninput="test()">

Typo: n-1 should be y-1.

Japt -h, 6 bytes
àVnW)ñ

Try it
àVnW)ñ     :Implicit input of string U=n and integers V=y & W=x
à          :Combinations of U of length
 VnW       :  V subtracted from W
    )      :End combinations
     ñ     :Sort
           :Implicit output of last element

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Find the capacity of 2D printed objects
In a fictional 2D world, a set of 2D printing instructions for an object can be represented by a list of integers as follows:
1 4 2 1 1 2 5 3 4

Each number represents the height of the object at that particular point. The above list translates to the following object when printed:
      #
 #    # #
 #    ###
 ##  ####
#########

We then fill it with as much water as we can, resulting in this:
      #
 #~~~~#~#
 #~~~~###
 ##~~####
#########

We define the capacity of the object to be the  units of water the object can hold when completely full; in this case, 11.
Strictly speaking, a unit of water (~) can exist at a location if and only if it is surrounded by two solid blocks (#) in the same row.
Challenge
Take a list of positive integers as input (in any format), and output the capacity of the object printed when the list is used as instructions.
You can assume the list contains at least one element and all elements are between 1 and 255.
Test Cases
+-----------------+--------+
|      Input      | Output |
+-----------------+--------+
| 1               |      0 |
| 1 3 255 1       |      0 |
| 6 2 1 1 2 6     |     18 |
| 2 1 3 1 5 1 7 1 |      7 |
| 2 1 3 1 7 1 7 1 |      9 |
| 5 2 1 3 1 2 5   |     16 |
| 80 80 67 71     |      4 |
+-----------------+--------+

Conceptually related

Haskell, 53 bytes
f l=sum(zipWith min(scanl1 max l)$scanr1 max l)-sum l

Thanks to Wheat Wizard for saving 1 byte. See also their shorter 48-byte solution.
The expressions scanl1 max l and scanr1 max l compute the running maximum of the list reading forwards and backwards, i.e. the profile of the water plus land if water would go flow one direction.
Orig:
      #
 #    # #
 #    ###
 ##  ####
#########

Left:
      #~~
 #~~~~#~#
 #~~~~###
 ##~~####
#########

Right:
~~~~~~#
~#~~~~#~#
~#~~~~###
~##~~####
#########

Then, the profile of the overall picture is the minimum of these, which corresponds to where the water does not leak either direction.
Minimum:
      #
 #~~~~#~#
 #~~~~###
 ##~~####
#########

Finally, the amount of water is the sum of this list, which contains both water and land, minus the sum of the original list, which contains only land.

Jelly, 10 bytes
U»\U«»\S_S

While APL requires multiple parentheses, and J two-character symbols, the algorithm is beautiful in Jelly.
     »\          Scan maximums left to right
U»\U             Scan maximums right to left
    «            Vectorized minimum
       S_S       Sum, subtract sum of input.

Try it here.

MATL, 14
My Matlab answer translated to MATL. xnor's algorithm.
Y>GPY>P2$X<G-s

Explanation
Y>: cummax() (input is implicitly pushed on the stack)
G: push input (again)
P: flip()
Y>: cummax()
P: flip()
2$X<: min([],[]) (two-argument minimum)
G: push input (again)
-: -
s: sum()

Is MATL a substitution language of Matlab? Can you provide a link in the header?

@FlagAsSpam I think it's a bit more than that: https://esolangs.org/wiki/MATL

@MartinBüttner Would the pseudocode for this be identical to the Matlab pseudocode? I'm wondering if it's a direct translation thing, rather than a based on thing.

@FlagAsSpam MATL is stack-based, so it's definitely not a plain substitution.

Yes, it's a direct translation. MATL is stack based (reverse polish notation) with one to three character shorthands for MATLAB operators and functions. See [https://github.com/lmendo/MATL/blob/master/doc/MATL_spec.pdf].

@RainerP. Yes, I've seen that - it's just that direct translations (like using shorthands for stuff) are typically frowned upon, but since the languages differ in type, it's not really a direct translation. So it's all good with me, +1.

Haskell, 48 bytes
q!u@(x:t)=q-x+maximum u`min`max q x!t
q!_=q

(0!)

Attempt This Online!

Dyalog APL, 17 bytes
+/⊢-⍨⌈\⌊⌽∘(⌈\⌽)

This is a monadic train that takes the input array on the right.
The algorithm is pretty much the same as xnor's, although I found it independently. It scans for the maximum in both directions (backwards by reversing the array, scanning, and reversing again), and finds the vectorized minimum of those. Then it subtracts the original array and sums.
The other way to do this would be to split the array at each location, but that's longer.
Try it here.

Exactly the same I came here to write. :-) When we get the dual (a.k.a under) operator, you can save 3 bytes with +/⊢-⍨⌈\⌊⌈\⍢⌽.

Matlab, 47
Also using xnor's algorithm.
@(x)sum(min(cummax(x),flip(cummax(flip(x))))-x)

MATLAB, 116 113 109 106 Bytes
n=input('');s=0;v=0;l=nnz(n);for i=1:l-1;a=n(i);w=min([s max(n(i+1:l))]);if a<w;v=v+w-a;else s=a;end;end;v

This works by storing the high point on the left, and while iterating through each next point, finds the highest point to the right. If the current point is less than both the high points, then it adds the minimum difference to the cumulative volume.
Ungolfed code:
inputArray = input('');
leftHighPoint = inputArray(1);
volume = 0;
numPoints = nnz(inputArray);

for i = 1:numPoints-1
    currentPoint = inputArray(i); % Current value
    lowestHigh = min([max(inputArray(i+1:numPoints)) leftHighPoint]);

    if currentPoint < lowestHigh
        volume = volume + lowestHigh - currentPoint;
    else
        leftHighPoint = currentPoint;
    end
end
volume

First time I've tried to golf anything, MATLAB doesn't seem the best to do it in....

Python 2, 68 bytes
lambda l:sum(min(max(l[:i+1]),max(l[i:]))-v for i,v in enumerate(l))

Try it online!

Pip -l, 19 bytes
$+J(ST0XgZD1`0.*0`)

Takes input numbers as command-line arguments. Or, add the -r flag to take them as lines of stdin: Try it online!
Explanation
Unlike all the other answers, in Pip it was actually shorter to construct (a modified version of) the ASCII-art and count the water units.
We start with g, the list of arguments.
[1 4 2 1 5 2 3]

0Xg produces a list of strings of n zeros for each n in g.
[0 0000 00 0 00000 00 000]

ZD1 then zips these strings together, using 1 to fill in any gaps in the resulting rectangular nested list:
[[0 0 0 0 0 0 0] [1 0 0 1 0 0 0] [1 0 1 1 0 1 0] [1 0 1 1 0 1 1] [1 1 1 1 0 1 1]]

ST converts this list to a string. The -l flag specifies that lists are formatted as follows: every nested list is joined together without a separator, and at the top level the separator is newline. So we get this multiline string--essentially, the diagram of the object, but upside down:
0000000
1001000
1011010
1011011
1111011

We then find all matches of the regex `0.*0`. This matches the two outermost walls and everything between them on each line.
[0000000 001000 011010 0110]

J joins these strings together into one big string, and $+ sums it, giving the number of 1s--which is equal to the amount of water the object can hold.
6

Rust, 112 bytes
|l:&[u8]|{(0..).zip(l).scan(0,|a,(b,c)|{*a=(*a).max(*c);Some((*a).min(*l[b..].iter().max()?)-c)}).sum::<u8>()};

Playground Link
Basically min(max(..index),max(index..)-value

ES6, 101 bytes
a=>(b=[],a.reduceRight((m,x,i)=>b[i]=m>x?m:x,0),r=m=0,a.map((x,i)=>r+=((m=x>m?x:m)<b[i]?m:b[i])-x),r)

Another port of @xnor's alghorithm.

Vyxal, 11 bytes
Ṙɖ∴Ṙ?ɖ∴Þ∵ε∑

Try it Online!


text:
Mathematical substitution
Sometimes it is useful to run a math problem with multiple inputs. The goal of this challenge is to make a program that eases this task.
Number-generating expressions
You must support 3 types of expression:

Single number generator: Very simple, just a literal number
Multi-number generator: A tad more complicated. Thees are surrounded by square brackets ([]). Numbers are comma (,) separated in the expression. Example [-1,2,3.26].
Range generator: This one is surrounded by curly braces ({}). It will have 3 numbers separated by a comma. The format of this expression is {start,stop,step}. start and stop are inclusive.

Rules for evaluation

You must support the order of operations. (https://en.wikipedia.org/wiki/Order_of_operations#Definition)
You don't need to support parenthesis.
Any number of spaces may occur in the expression.
You must support floating point numbers (whatever precision your language defaults to is fine).
Division by 0 results in NaN (not a number).

Your program must support multiplication (*), division (/), addition (+) and subtraction (-).
Output
Each line of output is one of the combinations of the generators. The format is the expression (with the real numbers substituted into it) followed by a equals sign (=) and the result of evaluation. All combinations of the generators must be represented in the output.
Examples
(>>> denotes input)
>>>3 * [3,2]
3 * 3 = 9
3 * 2 = 6

>>>{1,2,3}
1 = 1 <-- this is because 1 + 3 > the end

>>>{0,2,1} + {0,1,1}
0 + 0 = 0
1 + 0 = 1
2 + 0 = 2
0 + 1 = 1
1 + 1 = 2
2 + 1 = 3

>>>6/[2,3]
6/2 = 3
6/3 = 2

>>>{1.5,2.5,0.5}
1.5 = 1.5
2 = 2
2.5 = 2.5

>>>3-{6,5,-1}
3-6 = -3
3-5 = -2

>>>5/{-1,1,1}
5/-1 = -5
5/0 = NaN
5/1 = 5

>>>4.4 / [1,2.2] + {0,2,1}
4.4 / 1 + 0 = 4.4
4.4 / 1 + 1 = 5.4
4.4 / 1 + 2 = 6.4
4.4 / 2.2 + 0 = 2
4.4 / 2.2 + 1 = 3
4.4 / 2.2 + 2 = 4

>>> [1,2] / 0 + 5
1 / 0 + 5 = NaN
2 / 0 + 5 = NaN

The program needs to be short so I can memorizes it and use it anywhere.
Thanks to @PeterTaylor and @geokavel for helping me with this post in the sandbox

You must support floating point numbers (whatever precision your language defaults to is fine). What if my language only supports integer arithmetic?  Can I claim that I have zero-decimal place precision FP?

Can the input mix ranges and multi-numbers?

@DigitalTrauma I didn't think of those languages.... I would say no.

also, does x/0 result in instant evaluation to NaN, or do I have to treat NaN as a value?

@Maltysen Yep, should I include a example?

@JAtkin probably.

@Maltysen Either one should get the result I'm looking for. I'll go ahead and add a example. (for both)

May I substitute × for * and ÷ for /?

My language does not support - as part of floating point numbers, however, it does support ¯ to indicate negative numbers. Is this substitution ok?

If you make the change in your program, that's fine - just as long as all the current test cases work without change.

Is the order of the output expressions important?

No, just as long as you output all possible combinations of the generators.

JavaScript (ES6), 213 211 bytes
f=x=>(a=0,x=x.replace(/\[.+?]|{.+?}/,r=>([i,l,n]=a=r.slice(1,-1).split`,`,r[0]>"]"&&eval(`for(a=[];n>0?i<=+l:i>=+l;i-=-n)a.push(i)`),"x")),a?a.map(n=>f(x.replace("x",n))).join``:x+` = ${r=eval(x),r<1/0?r:NaN}
`)

Explanation
A recursive function that executes the expression if it does not contain any multi-number or range generators, or if it does contain one of these generators, calls itself with the generator replaced with each number produced by it.
Dividing by 0 in JavaScript produces Infinity, so Infinity can simply be replaced with NaN.
Using this method the multi-generators are parsed from back-to-front instead of front-to-back like in the test cases. This just means the order of the output expressions is different sometimes.
f=x=>(
  a=0,                                           // initialise a to false
  x=x.replace(/\[.+?]|{.+?}/,r=>(                // find the first multi-generator
    [i,l,n]=                                     // i = start, l = stop, n = step
      a=r.slice(1,-1).split`,`,                  // a = each number of generator
    r[0]>"]"&&                                   // if a range generator was found
      eval(`                                     // use eval to enable for loop here
        for(a=[];n>0?i<=+l:i>=+l;i-=-n)a.push(i) // add each number of the range to a
      `),
    "x"                                          // replace the generator with "x"
  )),
  a?                                             // if a multi-generator was found
    a.map(n=>                                    // for each number n in a
      f(x.replace("x",n))                        // call itself with n inserted
    )
    .join``                                      // combine the output of each result
  :x+` = ${r=eval(x),                            // evaluate the expression
    r<1/0?r:NaN}
`                                                // replace Infinity with NaN
)

Test
Test does not use destructuring assignments for browser compatibility.

f=x=>(a=0,x=x.replace(/\[.+?]|{.+?}/,r=>(a=r.slice(1,-1).split`,`,r[0]>"]"&&eval(`i=a[0],l=a[1],n=a[2];for(a=[];n>0?i<=+l:i>=+l;i-=-n)a.push(i)`),"x")),a?a.map(n=>f(x.replace("x",n))).join``:x+` = ${r=eval(x),r<1/0?r:NaN}
`)
<input type="text" id="input" value="4.4 / [1,2.2] + {0,2,1}" />
<button onclick="result.textContent=f(input.value)">Go</button>

This is actually very close to my envisioned answer.

Haskell, 474 362 bytes
The function f takes a string as input and prints the results
g '+'=(+);g '-'=(-);g '*'=(*);g '/'=(\a b->a*b/b/b)
p[]=[]
p(o:x:y)=[(flip(g o)$n,' ':o:' ':show n)|n<-v]:p r where
    [f,e,s]=z;(z,h)=reads('[':y)!!0;(w,m)=reads(x:y)!!0;(v,r)|x=='['=(z,h)|x=='{'=([f,f+s..e],h)|True=([w],m)
h '}'=']';h x=x
d(a,b)=putStrLn.drop 3$foldl(++)""b++" = "++show(foldl(flip($))0a)
f t=mapM_(d.unzip)$sequence$p(filter(/=' ')$'+':map h t)

tests :
main=do
    f "4.4 / [1,2.2] + {0,2,1}"
    putStrLn""
    f "[1,2] / 0 + 5"
    putStrLn""
    f "{0,2,1} + {0,1,1}"

output:
4.4 / 1.0 + 0.0 = 4.4
4.4 / 1.0 + 1.0 = 5.4
4.4 / 1.0 + 2.0 = 6.4
4.4 / 2.2 + 0.0 = 2.0
4.4 / 2.2 + 1.0 = 3.0
4.4 / 2.2 + 2.0 = 4.0

1.0 / 0.0 + 5.0 = NaN
2.0 / 0.0 + 5.0 = NaN

0.0 + 0.0 = 0.0
0.0 + 1.0 = 1.0
1.0 + 0.0 = 1.0
1.0 + 1.0 = 2.0
2.0 + 0.0 = 2.0
2.0 + 1.0 = 3.0

Python 3, 387 Bytes
def a(q,d=-1,f='',g=float,h=print):
 if any((c in q)for c in'[]{}'):
  for i,b in enumerate(q):
   if d!=-1:
    if b in'}]':
     e=f.split(",")
     if b=='}':
      r=g(e[0]);s=[]
      while r<=g(e[1]):s.append(str(r));r+=g(e[2])
      e[:]=s[:]
     [a(q[:d]+n+q[i+1:])for n in e];return
    f+=b
   if b in'[{':d=i
 else:
  h(q+" = ",end='')
  try:h(str(eval(q)))
  except:h("NaN")

You can test it with the following code:
tests=['3 * [3,2]', '{1,2,3}', '{0,2,1} + {0,1,1}',
       '6/[2,3]', '{1.5,2.5,0.5}', '3-{6,5,-1}',
       '5/{-1,1,1}', '4.4 / [1,2.2] + {0,2,1}',
       '[1,2] / 0 + 5']

for n in tests:
    print(n)
    a(n)
    print()

Here is the code ungolfed:
def eval_statement(query):
    left_bracket_index = -1
    inside_bracket_content = ''
    if any((bracket in query) for bracket in '[]{}'):
        for i, character in enumerate(query):
            if left_bracket_index != -1:
                if character in '}]':
                    params = inside_bracket_content.split(",")
                    if character == '}':
                        value = float(params[0])
                        values = []
                        while value <= float(params[1]):
                            values.append(str(value))
                            value += float(params[2])
                        params[:] = values[:]
                    for param in params:
                        new_query = query[:left_bracket_index] + param + query[i + 1:]
                        eval_statement(new_query)
                    return
                inside_bracket_content += character
            if character in '[{':
                left_bracket_index = i
    else:
        print(query + " = ", end='')
        try:
            print(str(eval(query)))
        except:
            print("NaN")

It works by finding the first set of brackets of any type, and then looping through all the values inside it, by replacing the brackets and its contents with the value and running the method recursively. It uses eval once there are no brackets in the line. It returns NaN if there is an exception running eval.

(a bit late) Welcome to Programming Puzzles & Code Golf!

Why do you need e[:]=s[:]? Wouldn't e[:]=s do the same?

Dyalog APL, 164 bytes
This answer does not follow the updated requirements, and is therefore non-competing:
{n←⊂'NaN'
R←{+\b,s/⍨⌊((2⊃⍵)-b←⊃⍵)÷s←⊃⌽⍵}
D←{0::n⋄⍺×÷⍵}
↑(∊¨(,⍎'[-+×D]'⎕R','⊢e),¨¨⊂('[-+×÷]'⎕S'\0'⊢⍵),⊂'='),¨,⍎e←'{' '}' '\[' ']' '÷' '[-+×]'⎕R'(R ' ')' '(' ')' '∘.D ' '∘.{0::n⋄⍺\0⍵}'⊢⍵}

It uses regexes to change the given expression into the corresponding APL (and all operators are modified to implement NaN) and to extract the operators. It substitutes all operators with catenation and executes the expression to obtain the final input numbers. It then weaves it all together to get the final output.
Preserves the order of evaluation of APL (strict right-to-left).
Handles parentheses correctly.
Test cases (with added parentheses to force math-like order of execution):
      f '3 × [3,2]'
3 × 3 = 9
3 × 2 = 6
      f '{1,2,3}'
1 = 1
      f '{0,2,1} + {0,1,1}'
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 2
2 + 0 = 2
2 + 1 = 3
      f '6÷[2,3]'
6 ÷ 2 = 3
6 ÷ 3 = 2
      f '{1.5,2.5,0.5}'
1.5 = 1.5
2   = 2
2.5 = 2.5
      f '3-{6,5,¯1}'
3 - 6 = ¯3
3 - 5 = ¯2
      f '5÷{¯1,1,1}'
5 ÷ ¯1 =  ¯5
5 ÷  0 = NaN
5 ÷  1 =   5
      f '(4.4 ÷ [1,2.2]) + {0,2,1}'
4.4 ÷ 1   + 0 = 4.4
4.4 ÷ 1   + 1 = 5.4
4.4 ÷ 1   + 2 = 6.4
4.4 ÷ 2.2 + 0 = 2
4.4 ÷ 2.2 + 1 = 3
4.4 ÷ 2.2 + 2 = 4
      f '([1,2] ÷ 0) + 5'
1 ÷ 0 + 5 = NaN
2 ÷ 0 + 5 = NaN

Does it pass the (unmodified) test cases? If so then it is just fine.

@JAtkin Have a look now.

No, as best as I understand this still doesn't support the order of operations.

@JAtkin "You must support the order of operations." You never specified which order. This does support the order of the language used. Every language (high-school math included) has an arbitrary (but unfortunately sometimes even ambiguous) precedence ruleset. APL's ruleset is unambiguous.

The standard for math is what I was implying: https://en.wikipedia.org/wiki/Order_of_operations#Definition. I will add that to the post now

@JAtkin Fair enough. However, I will not attempt to change the code, as the other two answers (so far) rely on the language conforming to the now required ruleset.

Java, 874 bytes
void E(String s)throws Exception{int i=0;String t;List<String[]>z=new ArrayList<>();List<String>x=new ArrayList<>(),y=new ArrayList<>();for(String k:s.split(" "))t+=" "+(k.matches("[0-9]+")?"["+k+"]":k);for(String k:t.split(" "))s+=" "+(k.matches("\\{[^\\}]+\\}")?"["+R(k)+"]":k);for(String k:s.split(" "))t+=" "+(k.matches("\\[[^\\]]+\\]")?"$"+(i+=z.add(k.replaceAll("[\\[\\]]","").split(","))):k);x.add(t.substring(1));while (i-->0){y.clear();for(String e:x)for(String l:z.get(i))y.add(e.replace("$"+i,l));x.clear();x.addAll(y);}for(String e:x)System.out.println(e+"="+new javax.script.ScriptEngineManager().getEngineByName("JavaScript").eval(e).replace("Infinity","NaN"));}
String R(String t){String y="",[]s=t.replaceAll("[\\{\\}]","").split(",");int i=I(s[0]);y+="["+i;while ((i+=I(s[2]))<=I(s[1]))y+=","+i;y+="]";return y;}
int I(String t){return Integer.parseInt(t);}

Detailed Try Here
import java.util.*;
import java.lang.*;
import java.io.*;

import javax.script.ScriptEngineManager;
import javax.script.ScriptEngine;

class Ideone
{
    // single : x -> [x]
    public static String expandSingle (String input)
    {
        String out = "";
        for (String str : input.split(" "))
        {
            out += " ";
            if(str.matches("[0-9]+"))
            {
                out += "["+str+"]";
            }
            else
            {
                out += str;
            }
        }
        return out.substring(1);
    }

    // range : {start,end,step} -> [x,..,y]
    public static String expandRange (String input)
    {
        String out = "";
        int a,b,c;
        int i=0;
        for (String str : input.split(" "))
        {
            out += " ";
            if(str.matches("\\{[0-9]+,[0-9]+,[0-9]+\\}"))
            {
                str = str.replaceAll("[\\{\\}]","");
                a = Integer.parseInt(str.split(",")[0]);
                b = Integer.parseInt(str.split(",")[1]);
                c = Integer.parseInt(str.split(",")[2]);

                out += "["+a;
                while ((a+=c) <= b) out += ","+a;
                out += "]";
            }
            else
            {
                out += str;
            }
        }
        return out.substring(1);
    }

    public static void main (String[] args) throws java.lang.Exception
    {
        String input = "3 * [3,2] + {0,2,1}";
        System.out.println(" input = "+input);
        input = expandSingle(input);
        input = expandRange(input);
        System.out.println(" expand = "+input);
        evaluate(input);
    }

    public static void evaluate (String input) throws java.lang.Exception
    {
        int i = 0;
        String t = "";
        ArrayList<String[]> set = new ArrayList<String[]>();
        ArrayList<String> in = new ArrayList<String>();
        ArrayList<String> out = new ArrayList<String>();

        // map sets
        for (String str : input.split(" "))
        {
            t += " ";
            if(str.matches("\\[.+\\]"))
            {
                str = str.replaceAll("[\\[\\]]","");
                set.add(str.split(","));
                t+= "$"+i;
                i++;
            }
            else t+=str;
        }
        in.add(t.substring(1));

        // generate expressions
        while (i-->0)
        {
            out.clear();
            for (String exp : in)
            {
                for (String sub : set.get(i))
                {
                    out.add(exp.replace("$"+i,sub));
                }
            }
            in.clear();
            in.addAll(out);
        }

        ScriptEngineManager mgr = new ScriptEngineManager();
        ScriptEngine engine = mgr.getEngineByName("JavaScript");

        // print expressions
        for (String exp : in)
        {
            System.out.println(" "+exp+" = "+engine.eval(exp).replace("Infinity","NaN"));
        }
    }
}


text:
Unique multiplication by ten

People, it's a popularity contest, you have to do somthing cool here.
  Think about cool ways of breaking the code in most languages, not about validating for everyting!

Initially this challenge is NOT for esoteric languages. But I didn't disabled them as I expect voters to be fair enough to downvote answers based only on esoteric language syntax uniqueness.

It's not too broad. I thought about code golf tag, but desided that it will be unnessesary limitation for the answers. I expect anwsers to be short and exploiting some language feature.

By the way, I have an interesting solution for VB.NET and it is shorter than 8 chars :)

Write a statement that multiplies the (integer) variable by 10 and assigns result to the same variable. If your language has no integer type, you may assume that the value is an integer not greater then some limit (you can specify this limit yourself, but it defenitly have to be adequate).
The initial and resulting values have to be number. Using string as one of them (or both) is forbidden.
But you don't want the code to be protable, so you are going to write it in such way, that the code is valid for as few programming languages as possible. Ideally in the only language.
Example:

You have variable
int x = 77;

and the answer is
x *= 10;

Declaration is not the part of the answer, only x *= 10; is.
So this code is valid for C, C++, C#, Java, Javascript and probably some other languages.
It's defenity a bad answer in this challenge.
Just drop a semicolon to cut off C, C++, C# and Java, but VB.NET appears in this case.
Scoring system: it's a popularity contest. For now I'll define the answer score as number of votes, but I'll keep a right to change scoring system by including number of languages into it.
So you have to provide a statement and list of languages (ideally one language) it is valid in.

And some people just want to watch the world burn. I'd try to come up with a less subjective marking system, though.

I don't think it's possible to find all languages a program is valid in.

@Lui, it's [tag:popularity-contest] ;) If you are ready to provide better scoring system, I'm ready to consider your proposal.

I'm downvoting because this essentially requires an answer to search through every programming language ever to see whether/how many others have the same behavior. Here's a partial list, for reference.

Define "variable"; can I just change the value of an item in a stack?

@isaacg, it's popularity contest. You have not search for all programming languages in the world. Just do something cool to break the code correctness for the most typical things.

@FlagAsSpam, no objections.

Related: http://codegolf.stackexchange.com/q/54807/25180

@isaacg, initially this challenge is not for esoteric languages. But I didn't disabled them as I expect voters to be fair enough to downvote answers based only on language syntax uniqueness.

@isaacg, see an addition to the question.

Also, your x *= 10 case also works for Mathematica.

The anti-polyglot idea may work as cops and robbers (polyglots are cracked), but there still is the problem that some languages (esoteric or not) will have a very easy time here. I expect voters to be fair enough to downvote answers based only on esoteric language syntax uniqueness. I don't understand that reasoning at all. The whole point of this challenge is exploiting syntax uniqueness.

@Dennis, the idea is simple. You have to do smth youself. Not find a language where plus sign by some reason means multiplication, and write x+=10. In fact I was to agressive with downvote, maybe just ignore. But definetly not upvote. You should do smth with typical solution in the language you chosen to prevent it correctness in other languages. I upvoted Perl answer as it replaces multiplication by concatenation and uses the other feature - you can't programmly detect if the value is string or number - it's a rare feature. It's a good way.

@Dennis, so you should find syntax or logical monents that will allow you to solve the challenge. It's not a collection like "how to multiply number by ten in different languases" where the language just provides you the unique way without any effort from your side. In fact, if you were making this task in normal life in the same language, I expect you to use the other solution. If they are the same - it's boring and shouldn't be upvoted.

In Perl you can do:
$var .= 0;

because it is not typed.
or
$var =~ s/$/0/;

Regex that adds a zero at the end of line.

Does this code assigns a number to the variable? I trust that you can concatenate numbers, but what the result is? I expect it to be a string, then it's not ok. In this case you need some code to convert it back to number.

There are no type in Perl, integer and string are stored in same variables. The result for each is 770

Vitsy, 2 bytes
a*
Call this method through any normal means (00k or 0m). The top item of the stack will be multiplied by 10 (a in hexadecimal). This is very anti-polyglot because most stack based languages don't have methodology.


text:
Surrounded Countries
Countries own a series of territories on a 1D world. Each country is uniquely identified by a number. Ownership of the territories can be represented by a list as follows:
1 1 2 2 1 3 3 2 4

We define a country's edgemost territories as the two territories closest to either edge. If the above list was zero indexed, country 1's edgemost territories occur at position 0 and 4.
A country surrounds another if the sublist between its two edgemost territories contains all the territories of another country. In the above example, the sublist between country 2's edgemost territories is:
2 2 1 3 3 2

And we see that all the territories of country 3 are between the edgemost territories of country 2, so country 2 surrounds country 3.
A country with only one element will never surround another.
Challenge
Take a list of integers as input (in any format) and output a truthy value if any country is surrounded by another, and a falsy value otherwise.
You can assume that the input list is nonempty, only contains positive integers, and does not 'skip' any numbers: for example, 1 2 1 5 would be invalid input.
Test Cases
+----------------------+--------+
|        Input         | Output |
+----------------------+--------+
| 1                    | False  |
| 2 1 3 2              | True   |
| 2 1 2 1 2            | True   |
| 1 2 3 1 2 3          | False  |
| 1 3 1 2 2 3 2 3      | True   |
| 1 2 2 1 3 2 3 3 4    | False  |
| 1 2 3 4 5 6 7 8 9 10 | False  |
+----------------------+--------+

Welcome to PPCG! Congratulations on your first question; this one looks really good!

And how many armies do I get on my next turn for surrounding a country?

Pyth, 7 bytes
n{Q_{_Q

Run the code on test cases.
n      Check whether the following are not equal:
 {Q     The unique elements in order of first appearance
 _{_Q   The unique elements in order of last appearance
         (done by reversing, taking unique elts, then reversing again)

The only way to avoid surrounding is for the countries' leftmost territories to be sorted in the same order as their rightmost territories. If two countries are swapped in this order, one has a territory both further left and further right than the other, and so surrounds it.
To obtain the unique countries in order of leftmost territory, we simply deduplicate, which preserves this order. The same is done for the rightmost territory by reversing, deduplicating, then reversing again. If these give different results, then a country is surrounded.

Retina, 61 60 bytes
Much longer than I would like...
(\b(\d+)\b.* (?!\2 )(\d+) .*\b\2\b)(?!.* \3\b)(?<!\b\3 .*\1)

Prints the number of countries that surround at least one other country.
Try it online.
It's a very straightforward implementation of the spec: we look for the pattern A...B...A such that B appears neither before or after the match.

Python, 64 bytes
lambda l,S=sorted:S(l,key=l.index)!=S(l,key=l[::-1].index)[::-1]

The only way to avoid surrounding is for the countries' leftmost territories to be sorted in the same order as their rightmost territories. If two countries are swapped in this order, one has a territory both further left and further right than the other, and so surrounds it.
The function checks that sorting the territories by leftmost appearance and rightmost appearance gives the same results. Unfortunately, Python lists don't have rindex analogous to rfind, so we reverse the list, then reverse the sorted output.
Same length (64) with an auxiliary function:
g=lambda l:sorted(l,key=l.index)
lambda l:g(l)[::-1]!=g(l[::-1])

C#, 113 bytes
public bool V(int[] n){var u1=n.Distinct();var u2=n.Reverse().Distinct().Reverse();return !u1.SequenceEqual(u2);}

Ungolfed:
public bool ContainsSurroundedCountry(int[] numbers)
{
    int[] uniqueLeftmost = numbers.Distinct().ToArray();
    int[] uniqueRightmost = numbers.Reverse().Distinct().Reverse().ToArray();

    return !uniqueLeftmost.SequenceEqual(uniqueRightmost);
}

Using a concise LINQ approach.

Welcome to PPCG. This is a very good ungolfed solution; I often have to inform new users that people often like to see ungolfed (readable, commented) versions of their code. However, you have forgotten to include a golfed version! There are several tricks you could use, including 1char variable names, removing whitespace and the "variables assumed to be int unless you say otherwise" quirk. +1 for the algorithm and implementation.

Ahhhh, I see. Yup, I'm new to this. Will trim a bit of fat and try again. Thanks for the advice.

You can save two bytes by using one-character variable names—actually, you can save more by not using variables at all and simply making it a single expression.

I suspect you could omit .ToArray().

I know it's been almost 2.5 years, but you can golf it down to 82 bytes: using System.Linq; + n=>!n.Distinct().SequenceEqual(n.Reverse().Distinct().Reverse()) (the Linq import is unfortunately mandatory). Try it online. Nice answer, +1 from me!

CJam (14 13 bytes)
{__&\W%_&W%#}

Online demo
Thanks to Martin Büttner for a one-char saving.

ES6, 76 75 65 64 bytes
 a=>(f=r=>a.filter((x,i)=>a.indexOf(x,r&&i+1)==(r|i))+a)()!=f(-1)

Straightforward port of @xnor's answers.
Edit: Saved 1 byte by replacing a.lastIndexOf(x)==i with a.indexOf(x,i+1)<0.
Edit: Saved 10 bytes thanks to @user81655.
Edit: Saved 1 byte by replacing r||i with r|i.

65 bytes using a function: a=>(f=r=>a.filter((x,i)=>a.indexOf(x,r&&i+1)==(r||i))+a)()!=f(-1)

use ~ instead of <0.

@ՊՓԼՃՐՊՃՈԲՍԼ No, I want it to be -1. ~ is the same as >=0.

Oh wait nevermind :P

@user81655 Sorry I didn't notice your comment before for some reason. Tricksy, but I like it!

Japt, 12 bytes
Uâ ¬¦Uw â ¬w

Try it online!
Thanks to @xnor for figuring out the algorithm. Input array is automatically stored in U, â is uniqify, w is reverse, and ¦ is !=. ¬ joins with the empty string ([1,2,3] => "123"); this is necessary because JavaScript's comparsion counts two arrays as not equal unless they are the same object. For example (JS code, not Japt):
var a = [1], b = [1]; alert(a==b); // false
var a = [1], b = a;   alert(a==b); // true

If this was not the case, we could remove two bytes by simply not joining each array:
Uâ ¦Uw â w

Sounds like Japt might want to implement value equality.

05AB1E, 4 bytes
ÙIÚÊ

Try it online or verify all test cases.
Port of @xnor's Pyth answer.
Explanation:
Ù       # Uniquified
 IÚ     # Reversed uniquified on the input again
   Ê    # Check if the two lists are not equal

Java, 281 Characters
class K{public static void main(String[]a){System.out.println(!k(a[0]).equals(new StringBuffer(k(new StringBuffer(a[0]).reverse().toString())).reverse().toString()));}static String k(String k){for(char i=49;i<58;i++){k=k.replaceFirst(""+i,""+(i-9)).replaceAll(""+i,"");}return k;}}

Python 3, 90 bytes
This function that takes the input as a Python list. Sadly, Python lists don't directly support searching from the end like strings do with rindex(), but oh well.
def t(c):i,I=c.index,c[::-1].index;return any(i(n)<i(m)and I(n)<I(m)for m in c for n in c)

Jelly, 5 bytes
UQU⁻Q

Try it online!
Just another port of xnor's answer, so go upvote that.
How it works
UQU⁻Q - Main link. Takes a list l on the left
U     - rev(l)
 Q    - unique(rev(l))
  U   - rev(unique(rev(l)))
    Q - unique(l)
   ⁻  - rev(unique(rev(l)) ≠ unique(l)