text:
Draw the Swiss Flag
Task: Output the Swiss flag.
Happy Swiss National Day / Schweizer Bundesfeiertag / Fête nationale suisse  / Festa nazionale svizzera / Fiasta naziunala svizra!
Details:
The flag consists of a white (#FFFFFF) cross on a red (#FF0000) background. The cross consists of a 6x6 square with arms of size 6x7 glued to each side. The cross is in the center of the 32x32 square background having a distance of 6 units to each side. (Source)
The output size can be chosen by the participant, but the image must exactly match these proportions, this means its size must be a multiple of 32.

A minimal version would look like so:

In some versions of the flag challenges, colored ASCII output was allowed, but you have not included [tag:ascii-art]. Just to confirm, ASCII output is not allowed?

Right, only the widely known image formats are allowed as well as output on the screen.

echo  - I assume this is not allowed

I see a blue CH, I don't see why this should be allowed.

How widely-known do you mean? Does something like pbm qualify?

@Tutleman I think it does

Are the usage of library allowed ? Low level languages does not provide graphic tools in their standard library

@Hatsu this is always allowed if you specify the ones you use

Can the white portion of the flag be transparent?

No it should be white.

Holy shit, I was browsing pastebin yesterday (don't ask) and I found a paste of someone making the flag of switzerland. Is this you? https://pastebin.com/v8pVcQpD

@HatsuPointerKun Any language that can save/output a text file can output net ppm format

@trichoplax Interesting. I didn't know about that file format...

does there need to be a border of non-red pixels?

No, is there anything that would suggest that?

Many of the answers seem to assume that there needs to be a border. I imagine that setting the background color to red might be shorter than drawing a 32x32 pixel red square.

Well the image needs to satisfy those criteria, if the background is larger or smaller than the given dimensions it is not valid.

Oh, so I can't just say "the flag is drawn in front of a red background but you can't see the edge because they're the same color"?

SVG (HTML5), 94 83 82 64 bytes

<svg><path d=M0,0V32H32V0M6,13h7V6h6v7h7v6H19v6H13V19H6 fill=red

Saved 2 bytes thanks to @ThePirateBay. Saved 1 byte thanks to @ATaco. Saved 18 bytes thanks to @CraigAyre pointing out that a 32×32 image was acceptable. As pointed out by @Shaggy, this assumes your default background is white; add 22 bytes for a flag that works on any background:

<svg><path d=M0,0V32H32V0 fill=red /><path d=M6,13h7V6h6v7h7v6H19v6H13V19H6 fill=#FFF

No need to close the path. You can save 4 bytes by leaving the path open.

As ThePirateBay said, the right > in your path tag is optional.

@ATaco. I was actually thinking about Z command which is used to close path, but there are only two lines so no need to close the path. But you are right, > can be removed too, I forgot about it.

SVG has its own "golfing language"? O.o

Being used to writing XML syntax, this code makes my eyes bleed

Can you remove viewBox for the minimal version? <svg><path d=M0,0V32H32V0M6,13h7V6h6v7h7v6H19v6H13V19H6 fill=red

@ETHproductions I think this is mostly only allowed because the challenge explicitly allows well-known image formats.

@pipe I was referring to the M0,0V32H32V0M6,13h7V6h6v7h7v6H19v6H13V19H6 part

You should probably mention that this is reliant on the SVGs parent element having a white background.

Shouldn't be too hard to write a golfing language that outputs HTML5 SVG, right?

x86-16 Machine Code for DOS, 43 bytes
               ; Draw 32x32 red square
B8 0C 28          mov  ax, 0x0C28   ; AL == color red, AH == set pixel function
B9 00 1F          mov  cx, 31
               DrawBox:
BA 00 1F          mov  dx, 31
               DrawRow:
CD 10             int  0x10
4A                dec  dx
75 FB             jnz  DrawRow
E2 F6             loop DrawBox

               ; Draw the interior white cross
B0 0F             mov  al, 0x0F    ; high byte already set
B1 06             mov  cl, 6       ; high byte already 0
               DrawCross:
B2 0D             mov  dl, 13      ; high byte already 0
               DrawCrossInner:
CD 10             int  0x10        ; plot CX, DX
87 D1             xchg dx, cx
CD 10             int  0x10        ; plot DX, CX
87 D1             xchg dx, cx
42                inc  dx
80 FA 12          cmp  dl, 13+6
75 F2             jne  DrawCrossInner
41                inc  cx
80 F9 19          cmp  cl, 6+(32-6-6)
75 EA             jne  DrawCross

C3                ret

The above code is designed to be assembled as a COM file and then run under DOS. It invokes the ROM BIOS video services to plot the individual pixels of the flag, forming a 32×32 representation of the Swiss flag in the upper-left corner of the screen.
The code assumes that the video mode is already set to mode 0x13, which also means that it requires a VGA display. Other video modes could be used, but requiring VGA gives you two things: (1) square pixels, and (2) a default palette that includes a true 100% red (0xFF0000) (meaning you don't have to waste bytes changing the palette colors). Before running this program, you will therefore need to switch your display to mode 0x13; the following code is all you need to do that:
mov  ax, 0x13
int  0x10

The code makes no other assumptions, and should run on any x86-compatible hardware under a DOS-compatible operating system.
However, the program terminates immediately after drawing the flag, so the DOS prompt will normally be re-printed at the top-left corner of the screen, covering up the top few lines of the flag. Therefore, if you want to marvel at the true output, you need to hang/pause the system before it RETurns. Here's a screenshot of what that looks like, running in a FreeDOS virtual machine:

It might be possible to golf this down further by writing pixel data directly to the video buffer, especially since I'm already assuming mode 0x13. I haven't tried that yet. INT 0x10 is already a pretty short instruction, but if I can use the one-byte string instructions to write pixel data directly to memory, then that could result in a significant code savings.

Impressive! I don't see asm a lot but when I do it's always very interesting

Nice to see fans of ASM.

You could do it with three 32 pixel wide tiles iterating over all the rows. It uses more data, but saves in the number of operations. Alternatively, you could use three 16 pixel wide tiles for the left side and perform a symetrical operation by reversing the left side.

MATL, 29 bytes
2Y66t&Y"OJQht3$)6thYaQK7hBoYG

Try it at MATL Online!
Explanation
2Y6     % Push predefined literal: 3×3 matrix [0 1 0; 1 1 1; 0 1 0]
6t&Y"   % Repeat each entry 6 times in the two dimensions. Gives an 18×18 matrix
OJQh    % Push [0 1j+1]. Used as an index, this means [0 1 ... end+1]. Indexing
        % is 1-based and modular, so 0 is the same as end
t3$)    % Apply that index in the two dimensions. This extends by 1 entry in
        % each dimension, so that the arms have length 7. Gives a 20×20 matrix
6thYa   % Pad with 6 zeros in the two dimensions. Gives a 32×32 matrix
Q       % Add 1. The matrix now contains values 1 (will become red) and 2 (white)
K7hBo   % Convert array [4 7] to binary. Gives [1 0 0; 1 1 1], to be used as
        % colormap. First row is red, second is white
YG      % Show image using colormap

Java 8, 246 + 42 = 288 bytes
Thanks to @Aaron for -64 bytes.
-4 bytes by outputting to file a without extension.
import java.awt.*;import java.awt.image.*;
x->{BufferedImage i=new BufferedImage(32,32,1);Graphics g=i.getGraphics();g.setColor(Color.RED);g.fillRect(0,0,32,32);g.setColor(Color.WHITE);g.fillRect(13,6,6,20);g.fillRect(6,13,20,6);javax.imageio.ImageIO.write(i,"png",new java.io.File("a"));}

A lamba expression that can be assigned to a functional interface method that throws an exception. Creates an image file named a (an image file) in the directory running this file.
Surrounding code used to run it: Try it online!
Ungolfed
x->{
    BufferedImage i=new BufferedImage(32,32,1);
    Graphics g=i.getGraphics();
    g.setColor(Color.RED);
    g.fillRect(0,0,32,32);
    g.setColor(Color.WHITE);
    g.fillRect(13,6,6,20);
    g.fillRect(6,13,20,6);
    javax.imageio.ImageIO.write(i,"png",new java.io.File("a"));
}

Result

Grid provided by the IntelliJ IDEA image preview (apparently).

You can shave quite a few bytes by changing your fillPolygon call into two fillRect calls. I'm not sure I respected the dimensions but I came up with g.fillRect(7,13,18,6);g.fillRect(13,7,6,18) which is shorter by 64 bytes

@Aaron Good call, for some reason I thought that'd be longer... Thanks!

You could name the file .png instead of a.png and save a byte.

@user2428118 Nice, would it be allowed to take it further and just name it a, without an extension? It can still be opened, just needs to be told to open in a photo viewer.

I don't know. The meta post regarding acceptable output formats for graphical output doesn't seem to rule it out, but I don't recall seeing it it being done in practice either. (I haven't been very active on PPCG lately though.)

@JustinMariner Yes, you may. Also, since you create a file image, wouldn't it be shorter to output svg directly? java.nio.file.Files.write(java.nio.file.Paths.get("a");"<svg...>".getBytes())

@OlivierGrégoire I feel that's too far from the idea of my solution, but you're welcome to post that as your own

216 + 18 bytes, using AWT: import java.awt.*;()->{new Frame(){{setSize(32,32);add(new Panel(){public void paint(Graphics g){g.setColor(Color.RED);g.fillRect(0,0,32,32);g.setColor(Color.WHITE);g.fillRect(13,6,6,20);g.fillRect(6,13,20,6);}});setVisible(true);}};} (Be aware, SE adds invisible splitting characters, so this answer is actually of the size I mentioned.)

Hmmm... Use setSize(99,99) instead of setSize(32,32). Somehow it doesn't show up properly on Windows.

Java can do method references, right? Would you be able to use them to save on typing setColor and fillRect?

@OlivierGrégoire I'm just gonna stick to image file output. @n0rd That would require creating Consumer<Color>c=g::setColor;, which adds too many bytes. And for fillRect: there's no builtin object (afaik) that accepts 4 args. Great idea, though; I've never considered used method refs in that way.

Excel VBA, 86 85 79 Bytes
Code
Anonymous VBE immediate window function that takes no input and outputs the Swiss flag onto the range [A1:F32] of the ActiveSheet object. This works by first making the cells square, then drawing the red region and finally drawing in the white cross.
Cells.RowHeight=48:[A1:AF32].Interior.Color=255:[G14:Z19,N7:S26].Interior.Color=-1

Note that arrangements which that remove the step of coloring the "cross" of the Swiss flag after putting in the red background are actually longer than the above configuration, as they require at least 16 cell addresses,
 which coordinate to the 8 distinct regions of the flag
-1 Byte thanks to @Greedo's for RowHeight=48 over ColumnWidth=2
-6 Bytes thanks to @Greedo's for -1 instead rgbWhite
Output

Fantastic; but you can still save 6 bytes with Interior.Color=-1 instead of Interior.Color=rgbWhite

@Greedo, huh, what do you know - that's fantastic. I had used rgbWhite over its decimal value of 16777215 for clarity, I had no idea that -1 would have the same effect. Thanks!

according to this link: (https://www.reddit.com/r/compsci/comments/62x9g9/powerpoint_is_turing_complete/) PowerPoint is Turing complete so I wonder how could this be ported to PowerPoint

C++, SFML, 406 399 394 bytes
-2 bytes thanks to pdpi
-10 bytes thanks to Zacharý
SFML ( Simple and Fast Multimedia Library ) is a C++ library written to ease the developpement of video games and multimedia programs
The code :
#include<SFML\Graphics.hpp>
using namespace sf;int main(){for(RenderWindow t(VideoMode(128,128),"");t.isOpen();){t.clear();RectangleShape r({128.f,128.f});r.setFillColor(Color::Red);t.draw(r);r.setFillColor(Color::White);r.setPosition({24.f,52.f});r.setSize({80.f,24.f});t.draw(r);r.rotate(90);r.setPosition({76.f,24.f});t.draw(r);t.display();for(Event e;t.pollEvent(e);)if(!e.type)t.close();}}

The flag get displayed in a 128x128 window. Your OS have to be able to display a 128x128 window ( my Win8.1 can't display with smaller width )
WARNING : you may want to add these 2 lines of code : t.setFramerateLimit(60);t.setVerticalSyncEnabled(true);, so your CPU won't heat when you run the code. I did not put them in the original code for golfing reasons.

You can shrink this a bit by replacing your whiles with fors, and initialising t and e in there:
int main(){for(sf::RenderWindow t(sf::VideoMode(128,128),"");t.isOpen();){t.clear();sf::RectangleShape r({128.f,128.f});r.setFillColor(sf::Color::Red);t.draw(r);r.setFillColor(sf::Color::White);r.setPosition({24.f,52.f});r.setSize({80.f,24.f});t.draw(r);r.rotate(90);r.setPosition({76.f,24.f });t.draw(r);t.display();for(sf::Event e;t.pollEvent(e);)if(e.type == 0)t.close();}}

Also, you can save two bytes by removing spaces: e.type == 0 => e.type==0, maybe even !e.type (don't remember the precedence). 24.f  } => 24.f}

Oh, and is using namespace sf; possible?

Braindraw, 227 bytes (Non-competing) (Updated to actually work)
Ungolfed version (241 bytes)
r<<^++++++++[-^++++v]^[->>[>]>++++++++[-<++++>]<[<]<]>>[[-vv[v]-[^]^]>]vv<[<]>>>>>>>>>>>>>>vvvvvvg<<^^++++++[->>[>]>+++++[-<++++>]<[<]<]>>[[-vv[v]b-g-[^]^]>]<vv[<]><<<<<<<vvvvvvv<<^^++++++[-vv[v]++++++++++++++[^]^]vv[[->>[>]b[+]-g[+]-[<]<]v]

Lightly golfed version (227 bytes)
r<<^++++++++[-^++++v]^[->>[>]>++++++++[-<++++>]<[<]<]>>[[-vv[v]-[^]^]>]vv<[<]g>>>>>>>>>>>>vvvv++++++[->>[>]>+++++[-<++++>]<[<]<]>>[[-vv[v]b-g-[^]^]>]<vv[<]<<<<<<vvvvv<<++++++[-vv[v]++++++++++++++[^]^]vv[[->>[>]b[+]-g[+]-[<]<]v]

Braindraw is a programming language of my own design. As of 3:08 pm today, I do have a working interpreter and have checked that the program runs properly. However, the interpreter did not exist before this competition began, so I am not competing.
Braindraw is the same as Brainf***, except that it operates on three two-dimensional arrays, rather than one one-dimensional array. These arrays are called r, g, and b, and act as the red green and blue color channels. The operator r moves the pointer to the red channel, etc etc. Up is ^, down is v.

Looking forward to seeing an interpreter for this, could be fun to try out

It certainly a fun idea, I'm looking forward to an interpreter too! (Technically we only allow languages that have been implemented, and we consider the interpreter as their definition.)

Is it correct that you do not explicitly output anything, but just output the whole "canvas" in the end? Do you assume the canvas is infinite?

In re: no interpreter, I guess that means my entry is non-competing. Oh well. But yes, this program has no output per se, the computing space is displayed while and after the program is run. The canvas is theoretically infinite, but in implementation, I will probably just make it some large-ish fixed width like maybe 512x512

This language seems capable of kolmogorov complexity image challenges. And are you currently working on an interpreter?

https://esolangs.org/wiki/Graphical_Brainfuck appears to be basically the same, though it laks an interpreter too.

@Zacharý I am working on an interpreter, but it's not going to be very good :P

@benzene I made a fist draft of an interpreter, but it doesn't work for your program. Do you have the specs written down somewhere or do you see some points I did not interpret correctly?

@flawr It looks like you're using integers for the cell values, where I was envisioning bytes that wrap around, so the program r- should draw one pixel with the color #FF0000

@ flawr Actually, it looks like something is not working with either the - operator or the brackets, since when I run the program +++++[->+++++<], the output should only have one non-black pixel, but when I run it on your interpreter I see two.

@flawr So I finished my (shabby) interpreter, and the Braindraw program did have several bugs, but it should work now.

Does this apply?

@TehPers, yes,  but as @benzene already stated in the body of their answer, their answer is non-competing. That said, they should include (Non-Competing) in the header of their answer

I made one

@Benzene Several things: (1) Does the interpreter start by pointing to a specific channel such as red? (2) What is the output region? Do you treat a specific corner as (0,0) and ignore pixels with negative row/column index? (3) Would you add more language features e.g. dot "." for input, and "a" for pointing to alpha channel? (4) Can a command line argument be passed so that the output is automatically filled with a "background colour"? It would be very interesting if this language can be used in other challenges ;)

tony200910041 (1) In my interpreter, red is default, but Braindraw style says to always specify channel. (2) All pixels are displayed after runtime, but Braindraw also retains "." and "," from Brainf***. I treat the upper right corner as (0, 0), and treat the edges of the canvas as hard walls, but I could make the canvas expand with the pointer or wrap around etc. (3) I might, but I think features like "a" and would make the language more pragmatic than I want. (4) No, you have to do that manually. I'm planning to use Braindraw for other challenges, but haven't gotten around to it yet.

I wrote an interpreter in Python (https://jonathanfrech.wordpress.com/2017/08/26/brainfuck-x/), which allows for a dynamically growing tape. Although I implemented calling the color planes by their names rgb, I thought it was too readable, which lead me to implement one character * to cycle through the color planes, starting with the red one.

Mathematica, 83 bytes
R=Rectangle;Graphics[{Red,{0,0}~R~{32,32},White,{6,13}~R~{26,19},{13,6}~R~{19,26}}]

next one is from @ASCII-only (I thought it was a joke but it works!)
Mathematica, 23 bytes
"CH"~CountryData~"Flag"

-10 bytes from @Jonathan Frech

Mathematica doesn't have a built-in for the Swiss flag?

my bad..I thought built-ins were not allowed!

CountryData["Switzerland","Flag"] but it might not have the right proportions

looks perfect!!!!

Mathematica has a built-in for everything, but this?

"Switzerland"~CountryData~"Flag" saves you some more

"CH"~CountryData~"Flag" only takes 23 bytes.

@JonathanFrech cool!

TI-BASIC (TI-84 Plus C(S)E only), 58 bytes
:For(A,0,31
:For(B,0,31
:Pxl-On(A,B,RED
:End
:End
:For(A,6,25
:For(B,13,18
:Pxl-Off(A,B
:Pxl-Off(B,A
:End
:End

This is an awesome answer.  I just made an account to upvote it.  TI-BASIC is great

Oh what a deluxe third parameter Pxl-On has now... it makes me cry only having had monochrome :(

HTML + CSS, 15 + 117 bytes = 132 bytes
Using a flexbox wrapper with an inset box-shadow.

b{display:flex;box-shadow:red 0 0 0 6px inset;padding:2px;width:28px;flex-wrap:wrap}a{border:solid red 4px;margin:3px

HTML + CSS, 18 + 139 137 122 bytes = 140 bytes
Previous answer using border and an intermediate flexbox wrapper with negative margin.

i,b,a{display:inline-flex}i{border:solid red 6px}b{margin:-4px;width:28px;flex-wrap:wrap}a{border:solid red 4px;margin:3px

JavaScript + HTML, 99 + 13 = 112 bytes
Saved 2 bytes thanks to user2428118
Saved 2 bytes thanks to Matheus Avellar
JSFiddle

with(c.getContext`2d`)fillStyle='red',fillRect(0,0,32,32),clearRect(6,13,20,6),clearRect(13,6,6,20)
<canvas id=c>

Pure JavaScript, 194 129 bytes
JSFiddle

with(document.write`<canvas id=c>`,c.getContext`2d`)fillStyle='red',fillRect(0,0,32,32),clearRect(6,13,20,6),clearRect(13,6,6,20)

I believe you have to do this from scratch.

@StepHen. Ok, I added it too.

... You need to include it in the bytecount

@ASCII-only. Included.

For future reference, whenever you need a <canvas> you can include the HTML directly in your answer. See https://codegolf.stackexchange.com/a/136972/47097

You can change c.getContext('2d') to c.getContext`2d`

@user2428118. Oh, of course, thanks. I somehow forget that getContext is a native function.

Sorry if I wasn't clear - you'll have to include the HTML as part of the byte count as well.

@darrylyeo. I left my pure JavaScript answer (but included document.write part), but I also added JavaScript + HTML answer. However, I still feel uncomfortable with PPCG snippets because if someone want to try to improve the code, they need to copy it to some testing environment which discourages lazy people. JSFiddle links are much better, because everyone can easily edit it and test other approaches.

You know Stack Snippets exist right? Then people can copy with one button

@ASCII-only. Well, if code snippets are so favorized here, no problem. I just included it, hope it is better now :)

@ThePirateBay Thanks a lot!

It is techincally valid HTML5 to omit the quotation marks on element attributes, so you could cut off 2 bytes by doing <canvas id=c>, both on the JS + HTML answers as well as on the JS-only one

GraphicsMagick (?), 96 bytes
gm convert -size 32x32 xc:red -fill #fff -draw "rectangle 13,6 18,25 rectangle 6,13 25,18" 1.bmp

Not sure how to golf with GM (should this be considered as a language?). Also not sure how to count bytes here...
With GM installed, type the given code in windows cmd, you will get an image with name 1.bmp. You may want change double quote to single quote if you are using bash (it should work, but i had not tested this).
Thanks to Digital Trauma. use only one -draw save 8 bytes

Not sure if its the same in GraphicsMagick, but with ImageMagick you can put both rectangles in the same -draw string: convert -size 32x32 xc:red -fill white -draw "rectangle 13,6 18,25 rectangle 6,13 25,18" i.png

@DigitalTrauma it is same. edited.

GFA BASIC (Atari ST),  62  55 bytes
A manually edited listing in .LST format. All lines end with CR, including the last one.
DEFF 2
PB 0,0,31,31
DEFF 0
PB 13,6,18,25
PB 6,13,25,18

Expanded and commented:
DEFFILL 2         ! set fill color: default system color #2 is red (&H700)
PBOX 0,0,31,31    ! draw the red square
DEFFILL 0         ! set fill color: default system color #0 is white (&H777)
PBOX 13,6,18,25   ! draw a vertical white rectangle
PBOX 6,13,25,18   ! draw a horizontal white rectangle

###Output
The output is 32x32.

NB: This is indeed using the 'white' color, although it's gray-looking on the emulator (and on the real thing as well, unless you turn the brightness quite high).

JavaScript (ES6) in HTML4(?), 178 176 bytes

document.write('
'+[...Array(32)].map((_,y,p)=>p.map((_,x)=>`<td bgcolor=${x>5&&x<26&&y>12&&y<19||y>5&&y<26&&x>12&&x<19?'#fff':'red'}>`).join``).join`<tr>`)

Yes! We do not need <canvas> nor <svg> or even !
Thanks to Justin Mariner, save 2 bytes.

Löve2D, 139 138 Bytes
l=love g=l.graphics c=g.setColor r=g.rectangle f="fill"w=255 l.draw=loadstring"c(w,0,0)r(f,0,0,32,32)c(w,w,w)r(f,13,6,6,20)r(f,6,13,20,6)"

Saved one byte thanks to ThePirateBay
Ungolfed
function love.draw()
    love.graphics.setColor(255,0,0)
    love.graphics.rectangle("fill",0,0,32,32)
    love.graphics.setColor(255,255,255)
    love.graphics.rectangle("fill",13,6,6,20)
    love.graphics.rectangle("fill",6,13,20,6)
end

R, 171 140 bytes.
x = rep(c(6,13,19,26,19,13),e=2)
l=c(0,32)
par(bg="red",mar=0*1:4)
plot(0,0,'n',l,l,xaxs="i",yaxs="i")
polygon(x,c(x,x)[4:15],c="white",b=0)

(somewhat) ungolfed:
x <- rep(c(6,13,19,26,19,13),each=2)
y <- c(x,x)[4:15] # index by 3 positions
par(bg="red",mar=c(0,0,0,0)) # prepare the plot space
plot(0,type='n', xaxs="i",yaxs="i",xlim=c(0,32),ylim=c(0,32))
polygon(x,y,col="white",border=0)

Thanks to @gregor for saving some bytes
Run it!

Welcome to the site! :)

Nice! You can save quite a few bytes with partial matching of argument names: e=2 instead of each=2, t instead of type, c for col, b for border. And 0*1:4 is shorter than c(0,0,0,0).

Actually you can get away with positional matching on plot: plot(0,0,'n',l,l,xaxs="i",yaxs="i") (assigning m="i" actually costs you one byte). With all of that it gets down to 141 bytes.

I forgot entirely about partial matching. Thanks!

Couple more bytes off: l and the xlim/ylim aren't needed, just plot(0:32,0:32,...). I also adapted your approach and got it down to 117 here, using rect instead of polygon.

2 can replace "red" in bg. If the exact RGB of the white wasn't specified you could have saved an extra byte with the visually indistinct "snow" (255,250,250).

GIF, 97 Bytes
GIF87a    ð  ÿ  ÿÿÿ,         @„©Ëí£œ´Ú;ƒÞXmÞ!ŸŠcyŒj¨,àZê<Cô
:8nïtï‹é‚BJ1tì$1ËKSvb=_ÔªõŠe  ;

Cheap and byte-heavy, but worth it.
EDIT: Some characters aren't in the code above, here's a pastebin for  the GIF's hexdump.
EDIT: compressed down to 97 bytes with online tool.

It seems that some unprintable characters were removed from your code snippet. Maybe try posting a hex dump.

How do you pronounce the language?

@Oliver ZHAIF

Gimp produces a GIF file that looks identical in only 95 bytes (less than many other solutions).  Here's a hex dump of it.

Funny. I used Pelles-C, which is probably suboptimal.

Since when is GIF a programming language?

Please everyone note that we allow non-programming-language submissions as per this consensus, so this submission is perfectly fine. (And IMO a nice benchmark to have.)

Octave, 105 bytes 73 bytes
Note: line feeds added for clarity, not included in byte count
x(32,32,3)=0;
x(:,:,1)=1;
x(7:26,14:19,:)=1;
x(14:19,7:26,:)=1;
imshow(x*255)

EDIT: thanks to flawr for saving quite a lot of bytes!
Here is the result on octave-online.net, thanks to sanchises

I'm not sure about Octave, but in MATLAB following should work: x(32,32,3)=0; x(:,:,1)=1; x(7:26,14:19,:)=1; x(14:19,7:26,:)=1; imshow(x*255)

BTW: Welcome to PPCG!!!

Octave-online.net does show pictures.

You can save 4 bytes, multiplying by 255 is redundant, since you're using double type arrays, not uint8, so
x(32,32,3)=0; x(:,:,1)=1; x(7:26,14:19,:)=1; x(14:19,7:26,:)=1; imshow(x)
does exactly the same thing.
(for doubles and floats imshow treats everything >= 1 as white/full color, everything <= 0 as black/no color and (0:1) are inbetweens)

Python 3, 190 bytes
Save output as image.xpm and open with your favorite text editor.
r=range;print('! XPM2\n32 32 2 1\nr c #FF0000\nw c #FFFFFF\n');d=[bytearray(b'r'*32)for _ in r(32)]
for i in r(20):
 for j in r(6):d[i+6][j+13]=d[j+13][i+6]=119
print(b'\n'.join(d).decode())

Try it online!
Output:
! XPM2
32 32 2 1
r c #FF0000
w c #FFFFFF

rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrwwwwwwwwwwwwwwwwwwwwrrrrrr
rrrrrrwwwwwwwwwwwwwwwwwwwwrrrrrr
rrrrrrwwwwwwwwwwwwwwwwwwwwrrrrrr
rrrrrrwwwwwwwwwwwwwwwwwwwwrrrrrr
rrrrrrwwwwwwwwwwwwwwwwwwwwrrrrrr
rrrrrrwwwwwwwwwwwwwwwwwwwwrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrrrrrrrrwwwwwwrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr

I had to remove the empty 5th line to open it with gimp on linux.

Perl 5 + -p0513, 80 bytes
print"P6 32 32 1",$_=($}="A..")x192,$\=($}x13 .1x18 .$}x13)x7,($}x6,1x60,$}x6)x6
Try it online!
Outputs a PBM file.

Perl 5 + -p0513 -M5.10.0, 82 bytes
say"P6 32 32 1",map{($|--||"A..")x$_}205,@a=((18,26)x6,18),20,(54,14)x6,0,6,@a,205
Try it online!
Also outputs a PBM file. This is a slightly more interesting approach, but I can't get it to beat the above.

Perl 5 + -Mutf8 -p0513 -M5.10.0, 149 bytes
say"",$\=($l=$"x32 ."
")x3,$_=(($s=$"x13).($}='█')x6 ."$s
")x3,$l=($"x=6).($a='▄'x7).$}x6 .$a.$",("
",$",$}x20,$")x2,"
",$l=~y;▄;▀;r

Try it online!
Output is to the terminal via ANSI escape codes and looks like this:

Proportions should be to scale based on one character space being two vertical 'pixels'.
You can preview the output by copying from TIO and pasting in here (this shows the control characters when hovered over the element).

R, 112 bytes
par(bg=2,mar=0*1:4)
plot(0:32,0:32,'n',xaxs="i",yaxs="i")
rect(c(6,13),c(13,6),c(26,19),c(19,26),c="white",b=NA)

Though, to guarantee the aspect ratio, we need 5 more bytes for a total of 117:
par(bg=2,mar=0*1:4)
plot(0:32,0:32,'n',xaxs="i",yaxs="i",as=1)
rect(c(6,13),c(13,6),c(26,19),c(19,26),c="white",b=NA)

With lots of inspiration from Alex Axthelm's answer, and thanks to Rift for saving a few more bytes.

you could save 4 bytes changing bg="red" to bg=2 which is the same in the default palette

R, 109 bytes
par(mar=0*1:4,bg=2,xaxs="i",yaxs="i")
frame()
rect(a<-c(6,13)/32,rev(a),b<-c(26,19)/32,rev(b),c="white",b=NA)

Uses frame to avoid presetting a plot, but default plotting region is on interval [0,1] instead of [0,32]. Also uses the fact that rect is vectorized. The default size of the plotting window is 7in x 7in. It outputs the following:

R, 125 bytes
png()
par(mar=0*1:4,bg=2,xaxs="i",yaxs="i")
frame()
rect(a<-c(6,13)/32,rev(a),b<-c(26,19)/32,rev(b),c="white",b=NA)
dev.off()

Default for png is a square of 480x480 pixels. Output is the following png file:

HTML + JavaScript (ES6), 13 + 112 = 125 bytes

C=c.getContext`2d`
C[s='fillStyle']='red'
C[r='fillRect'](0,0,32,32)
C[s]='#fff'
C[r](6,13,20,6)
C[r](13,6,6,20)
<canvas id=c>

HTML + JavaScript (ES6), 13 + 114 = 127 bytes

with(c.getContext`2d`)fillStyle='red',fillRect(0,0,32,32),fillStyle='#fff',fillRect(6,13,20,6),fillRect(13,6,6,20)
<canvas id=c>

I've stolen your rectangle approach and improved it to 117 bytes using clearRect, I hope you're ok with that?

That's clever, but unfortunately the OP says transparent pixels aren't allowed. https://codegolf.stackexchange.com/questions/136927/draw-the-swiss-flag/136972?noredirect=1#comment335362_136927

Actually, it is white. By default, all webpages have white background and the flag is transparent itself, but it is just an internal definition of transparency. External definition of transparency would be if pixels in that region (white plus) may change its color in some conditions (or may be set randomly). However, because I'm using both HTML and JavaScript, the whole output is the red flag with white cross. You cannot consider the canvas and background separately. How canvas is displayed on the background is well defined and the result always contains white cross by spec definitions.

I hope its a bit more clear now, I mean you may disagree, but if you really think about it I am sure you'll find my answer fully consistent with OP's requirements.

@ThePirateBay Fair enough.

Postscript, 301 286 187 bytes
/m{moveto}def
/s{setrgbcolor}def
/r{rlineto}def
/c{closepath fill}def
1 0 0 s
0 0 m
0 320 r
320 0 r
0 -320 r
c
1 1 1 s
130 60 m
60 0 r
0 200 r
-60 0 r
c
60 130 m
0 60 r
200 0 r
0 -60 r c

Thanks to the anonymous editor who suggested a 99 byte reduction!

Just to let you know: somebody submitted a golfing edit to this post. Per our policy, it was rejected, but you may want to consider implementing some of the changes.

C# 265/266 209 bytes
 using System;using c=System.Console;class P{static void Main(){for(int i=0,j;i<32;i++){for(j=0;j<32;j++){if((6<i&&i<26&&j>13&&j<19)||(6<j&&j<26&&i>13&&i<19))c.BackgroundColor=ConsoleColor.White;else c.BackgroundColor=ConsoleColor.Red;c.Write(" ");}c.WriteLine();}}}

I wrote "space" characters into console while changing Background Color. But if you think it is too tall and you count single character as 8 x 16 pixels, you simply double values near "j" like this (+ 1 byte and + c.ReadKey(); so it stops):
  using System;using c=System.Console;class P{static void Main(){for(int i=0,j;i<32;i++){for(j=0;j<64;j++){if((6<i&&i<26&&j>26&&j<38)||(12<j&&j<52&&i>13&&i<19))c.BackgroundColor=ConsoleColor.White;else c.BackgroundColor=ConsoleColor.Red;c.Write(" ");}c.WriteLine();} c.ReadKey(); }}

56 bytes saved thanks to TheLethalCoder
 namespace System{using static Console;class P{static void Main(){for(int i=0,j;i<32;i++,WriteLine())for(j=0;j<32;Write(""))BackgroundColor=(ConsoleColor)((6<i&i<26&j>13&j<19)|(j++<26&i>13&i<19&6<j)?15:12);}}}

209 bytes namespace System{using static Console;class P{static void Main(){for(int i=0,j;i<32;i++,WriteLine())for(j=0;j<32;Write(" "))BackgroundColor=(ConsoleColor)((6<i&i<26&j>13&j<19)|(6<j&j++<26&i>13&i<19)?15:12);}}}

Tikz, 145 143 bytes
\documentclass[tikz]{standalone}\begin{document}\tikz{\def~{)rectangle(}\fill[red](,~33,33);\fill[white](7,14~27,20)(14,7~20,27)}\end{document}

Here it is "ungolfed"
\documentclass[tikz]{standalone}
\begin{document}
\tikz{
\def~{)rectangle(}
  \fill[red](,~33,33);
  \fill[white](7,14~27,20)(14,7~20,27)
}\end{document}

Here it is ungolfed a little more
\documentclass[tikz]{standalone}
\begin{document}
\tikz{
  \fill[red](1,1)rectangle(33,33);
  \fill[white](7,14)rectangle(27,20)(14,7)rectangle(20,27)
}\end{document}

This makes 3 rectangles a big red one and two smaller white ones for the plus.
Here's what it looks like.  It doesn't really look any different than the others.

I put a golfing documentclass on github a few weeks ago. and there doesn't seem to be any window background requirement.  With that \documentclass{g}\input tikz should work to save 5B.  You can probably save more by working in plain TeX, even with TikZ

Python 2, 92 91 89 bytes
r,w=' \0\0',' '*3
A,B=192*r,(13*r+6*w+13*r)*7
print"P6 "+"32 "*3+A+B+(6*r+20*w+6*r)*6+B+A

Output as binary ppm, usage:
python golf_swiss.py > swiss.ppm

Increasing the color depth allowed me to use space for maximum value

Bitmap, 160 bytes
Here's a bitmap with 1-bit colour depth, using a 24-bit colour definition.  The last six bytes of the second line is the palette and following that is the pixel array.  Every four bytes contains a whole row of pixels.
42 4D A0 00 00 00 00 00 00 00 20 00 00 00 0C 00
00 00 20 00 20 00 01 00 01 00 00 00 FF FF FF FF
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 07 E0 00 00 07 E0 00
00 07 E0 00 00 07 E0 00 00 07 E0 00 00 07 E0 00
00 07 E0 00 03 FF FF C0 03 FF FF C0 03 FF FF C0
03 FF FF C0 03 FF FF C0 03 FF FF C0 00 07 E0 00
00 07 E0 00 00 07 E0 00 00 07 E0 00 00 07 E0 00
00 07 E0 00 00 07 E0 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

I tried to truncate the trailing zeroes, but image viewers require there are enough pixels defined for the entire canvas.

"Any suggestions where I can save arbitrary files permanently?" - on GitHub.

Can you use RLE encoding?

Haha, you've 1up'd my GIF example.

Maybe just convert it to base64 and show it with an HTML snippet?

I think this is not a valid programming language. IFAICT, BMP can neither check primeness, nor add numbers.

I checked and RLE encoding doesn't help for a file this small; if the image was twice as big you'd start seeing savings though.

@Adám, thanks!  After posting this, I actually wondered what constituted a valid language.  I figured this was code that is compiled into pixels.  But something closer to Turing-complete makes more sense.  Either way, even if it's non-competing, I still wanted to try this method.

Please everyone note that we allow non-programming-language submissions as per this consensus, so this submission is perfectly fine. (And IMO a nice benchmark to have.)

Tcl/Tk, 94
If it runs on the interactive shell, one can abbreviate canvas to can and grid to gri
gri [can .c -bg red -w 32 -he 32]
lmap R {{8 15 28 21} {15 8 21 28}} {.c cr r $R -f #FFF -w 0}

Tcl/Tk, 98
If it runs on the interactive shell, one can abbreviate canvas to can
grid [can .c -bg red -w 32 -he 32]
.c cr r 8 15 28 21 -f #FFF -w 0
.c cr r 15 8 21 28 -f #FFF -w 0

Tcl/Tk, 101
pack [canvas .c -bg red -w 32 -he 32]
.c cr r 8 15 28 21 -f #FFF -w 0
.c cr r 15 8 21 28 -f #FFF -w 0

Red, 79 Bytes
Code:
view[base 32x32 red draw[fill-pen white pen off box 6x13 26x19 box 13x6 19x26]]

Result:

Explanation:
view [              ; activate view engine
base 32x32 red      ; draw a 32 by 32 red box as base
 draw [             ; draw on top of the base
  fill-pen white    ; fill color is white
  pen off           ; turn off outline, alternatively could use white
  box 6x13 26x19    ; draw a horizontal rectangle, specified as 2 corners XxY
  box 13x6 19x26    ; draw vertical rectangle
]]

Ruby + ruby2d, 106+8 = 114 bytes
Uses the -rruby2d flag.
[[32,32],[6,20,13,6],[20,6,6,13]].map{|w,h,x,y|Rectangle.new width:w,height:h,x:x,y:y}[0].color='red'
show

Image output:

C#, 195 bytes
Try it online(Rextester)!
Hi, this is my first code golf and I'm a C# programmer, so I thought I might submit this entry that I quickly made. It correctly outputs a 32 x 32 bitmap image called "s" in the directory of the executable.
var b=new Bitmap(32,32);var g=Graphics.FromImage(b);g.Clear(Color.Red);g.FillRectangle(Brushes.White,new Rectangle(13,0,6,32));g.FillRectangle(Brushes.White,new Rectangle(0,13,32,6));b.Save("s");

Explanation:
C# offers an extensive GDI+ image manipulation APIs built into the default .NET framework. The System.Drawing namespace contains two such very powerful wrapper classes: Bitmap and Graphics. I merely used those two classes to generate a Swiss flag bitmap.
Ungolfed:
// Creates a new 32 x 32 bitmap object.
var b = new Bitmap(32, 32);
// Creates a new graphics object from the bitmap image.
var g = Graphics.FromImage(b);
// Clears the bitmap with a red(ARGB: FFFF0000) fill color.
g.Clear(Color.Red);
// Draws the vertical rectangle with a white(ARGB: FFFFFFFF) color.
g.FillRectangle(Brushes.White, new Rectangle(13, 0, 6, 32));
// Draws the horizontal rectangle with a white(ARGB: FFFFFFFF) color.
g.FillRectangle(Brushes.White, new Rectangle(0, 13, 32, 6));
// Save the bitmap to a file named: "s."
b.Save("s");

Welcome to PPCG!

Excel VBA, 315 313 bytes
2 bytes saved thanks to Taylor Scott!
Golfed
Sub m
Set r=[A1:AF32]
r.RowHeight=48
r.NumberFormat=";"
Set p=r.FormatConditions.AddColorScale(2).ColorScaleCriteria
s 1,255,p
s 2,-1,p
r.Formula=Replace("=IFS(OR(ROW()<6,ROW()>26,|<6,|>26),0,OR(AND(ROW()>13,ROW()<19),AND(|>13,|<19)),1,1,0)", "|", "COLUMN()")
End Sub
Sub s(n,v,p)
p(n).FormatColor.Color=v
End Sub

And commented
Sub m
Set r=[A1:AF32]          'Evaluates range reference to return 32 square range object
r.RowHeight=48           'set row height to make grid cells square - assumes default font
r.NumberFormat=";"       'make text in cells invisible
Set p=r.FormatConditions.AddColorScale(2).ColorScaleCriteria
                         'add 2-colour scale conditional formatting
s 1,255,p                'where lowest value is red
s 2,-1,p                 'highest is white
r.Formula=Replace("=IFS(OR(ROW()<6,ROW()>26,|<6,|>26),0,OR(AND(ROW()>13,ROW()<19),AND(|>13,|<19)),1,1,0)", "|", "COLUMN()") ''#apply grid of 1s and 0s is flag shape
End Sub
Sub s(n,v,p)             'exploits ByRef default (thanks Gaffi)
p(n).FormatColor.Color=v 'set colour for 2-colour scale conditional formatting
End Sub

I wanted to do something that didn't involve looping
Assumes font is the default Calibri size 11

My preliminary measurements suggest that you would be better off using a row height of 48 rather than 42 as this (so far as I can see) makes the individual cells square - aside from that, you ought to remove the () in m() as it is not necessary; You ought to put in an uncommented version of your code as well, so that others may easily verify the functionality and length of your code - Cheers

You can make some small optimizations to this for -6 bytes : ... Set c=Cells c.RowHeight=48 c.NumberFormat=";" Set p=c.FormatConditions..... ...[A1:AF32]=Replace(...

Now there is also the LET(...) excel command - with it you can remove the replace command, and simplify all of the row commands and get you code down to 289 bytes

Processing, 85 bytes
size(32,32);background(#FF0000);fill(255);noStroke();rect(6,13,20,6);rect(13,6,6,20);

A very straightforward implementation.  Open the window to the minimum size, draw a red background, set the fill to white and shapes to not have borders, and draw two rectangles.

Haskell, 112 bytes
import Graphics.Gloss
(#)=rectangleSolid
main=display(InWindow""(32,32)(0,0))red$color white$pictures[6#20,20#6]

A full program that uses the Gloss library and opens a window of size 32x32 with red background and two white rectangles (size 6x20 and size 20x6) placed at the center of the window.

HTML + CSS 215+80 bytes
Try Online
CSS
table{ all:unset } th{ background:red }
   #a{ height: 6 } #b{ height: 7 }
   #c{  width: 6 } #d{  width: 7 }

HTML

Inaccurate Version 223+40 179+40 139+40 bytes

saved 44 bytes, thanks to @manatwork
saved 40 bytes, thanks to @SteveBennett

Try Online
CSS
table{ all:unset } th{ background:red }

HTML

Use shorthand properties where possible: backgroud-color → background; merge cells:  → ; write crappy HTML (most of the world does it anyway and they are not even codegolfing): class → id. http://liveweave.com/oVLiqH

@manatwork note taken

Save a lot of characters by using th for the red cells, instead of r class:

 http://liveweave.com/0WQ3Vm
@SteveBennett note taken

Also I have to point out that it sadly doesn't technically meet the requirements, because the ratios aren't exactly right. The arms of the cross need to be slightly longer (7/6th) than their widths.

LibreLogo, 58 bytes
Code:
pc [3]fc [5]square 25 fc [3]rectangle[4,15]rectangle[15,4]

Result:

Explanation:
pc [3]                   ; Pen Color  = #FFFFFF
fc [5]                   ; Fill Color = #FF0000
square 25                ; Square     = 25 pt
fc [3]                   ; Fill Color = #FFFFFF
rectangle [4, 15]        ; Rectangle  = 4 x 15 pt
rectangle [15, 4]        ; Rectangle  = 15 x 4 pt

C++ with OpenGL, 373 Bytes.
This is my first time really working with C++ and OpenGL on a challenge, so let me know what I can improve.
#include<GL/glut.h>
#define v glVertex2d
#define r(w,x,y,z) v(w,x);v(w,z);v(y,z);v(y,x);
void d(){glScaled(1/16.0f,1/16.0f,1);glBegin(GL_QUADS);glColor3f(1,0,0);r(-16,-16,16,16)glColor3f(1,1,1);r(-3,-10,3,10)r(-10,-3,10,3)glEnd();glFlush();}int main(int c,char**a){glutInit(&c,a);glutInitWindowSize(320,320);glutCreateWindow("");glutDisplayFunc(d);glutMainLoop();return 0;}

Compiled with the MinGW version of g++ on Windows with FreeGlut.
Creates a 320 x 320 screen displaying the Flag.

Whenever a redraw happens, it spawns a smaller flag inside itself. This is because I never clear the screen, nor reset the matrix.

However, a redraw does not happen automatically.
Ungolfed Code
#include <GL/glut.h>
#define rect(w,x,y,z) glVertex2d(w,x);glVertex2d(w,z);glVertex2d(y,z);glVertex2d(y,x);
void display(){
    glClear();
    glScaled(1/16.0f,1/16.0f,1);
    glBegin(GL_QUADS);
        glColor3f(1,0,0);
        rect(-16,-16,16,16)
        glColor3f(1,1,1);
        rect(-3,-10,3,10)
        rect(-10,-3,10,3)
    glEnd();
    glFlush();
}

int main(int argc, char **argv){
    glutInit(&argc, argv);
    glutInitWindowSize(320,320);
    glutCreateWindow("Swiss Flag");
    glutDisplayFunc(display);
    glutMainLoop();
    return 0;
}

Link to the Compiled Executable

You can remove the space between the r macro and the definition. Also, r's definition can be changed to v(-w,-x);v(-w,z);v(y,z);v(y,-x); if you remove all -s in the calls to r.

GW-Basic, 68 bytes (tokenised)
0 SCREEN 9:PALETTE 9,36:FOR I=0 TO 3:LINE(X,Y)-(31-X,31-Y),Y+9,BF
  ↪ :Y=I*7 MOD 14+6:SWAP X,Y:NEXT:LOCATE 4

To get it down to 68 bytes you have to manually edit the file GW-Basic saves to remove all spaces and the trailing end of file and null characters. The PALETTE statement is necessary because GW-Basic has no VGA support and the reds in the default EGA palette are too dark (4) and too washed out (12). The final LOCATE statement ensures that GW-Basic's Ok isn't printed on top of the flag.

PostScript, 85 80 bytes
Code:
1 0 0 setrgbcolor
0 0 32 32 rectfill
1 setgray
[13 6 6 20 6 13 20 6] rectfill

Result:

Welcome to the site! :)

Processing, 74 bytes
size(32,32);background(-65536);noStroke();rect(13,6,6,20);rect(6,13,20,6);

I have honestly no idea if that's legal here but here it is.
Outputs:

Explanation:
size(32,32);            //Set the window size to 32x32
background(-65536);     //Draw the background as red. This is a hack that works because the color datatype uses an int but does not use it as a number. The int equivalent to #FF0000 is -65536 apparently. and it saves me a byte.
noStroke();             //Disable the stroke when drawing shapes like rect
rect(13,6,6,20);        //Draws a rectangle of size 6x20, starting the top-left corner at position (13, 6)
rect(6,13,20,6);        //Draws a rectangle of size 20x6, starting the top-left corner at position (6, 13)

Note that I could have gotten -65536 by using a bitshift operator, -1<<16, though that gives us the same amount of bytes. I'm just leaving this here to lead someone to a better solution.

BBC BASIC, 70 bytes
V.19;16,255|25,97,64;64;25,4,12;26;25,99,40;12;25,4,26;12;25,99,12;40;

Download interpreter at http://www.bbcbasic.co.uk/bbcwin/download.html
Program runs in default mode for this interpreter (white background, black foreground.) 2x2 units = 1 pixel. Flag is 64x64 units = 32 x 32 pixels.
The VDU or V. command sends characters to the screen controller. These include a number of machine specific control characters for graphics. Number followed by , sends 1 byte, by ; sends 2 bytes. Number followed by | sends "sufficient" bytes to finish a multibyte command.
Ungolfed
  VDU 19,0,16,255|   :REM Reprogram colour 0 (foreground) to #0000FF red (BBC BASIC is little endian.)
  VDU 25,97,64;64;   :REM Cursor is already at 0,0. Move to 64,64 and draw a rectangle in foreground colour (red.)
  VDU 25,4,12;26;    :REM Move to 12,26
  VDU 25,99,40;12;   :REM and draw a rectangle in backgorund colour (white) 40 units wide x 12 units high,
  VDU 25,4,26;12;    :REM Then move to 26,12
  VDU 25,99,12;40;   :REM and draw a vertical rectangle of simiar dimensions.

R , 75 bytes
x=matrix(2,32,32);x[7:26,14:19]=NA;x[14:19,7:26]=NA;image(x,c=2,ax=F,as=1)

Results in:

With aspect ratio 1:1 and no axes are drawn.

Welcome on the site!

@Dada Thank you. Seems like fun here :-)

SmileBASIC, 42 bytes
GCLS #RED
GFILL 6,13,25,18GFILL 13,6,18,25

Alternatively -1<<16 or -8<<16 can be used instead of #RED for the same length.

The output isn't correct. The cross is too small and not centred in the red field, which itself is rectangular (5:3) and not square like it should be.

PowerShell, 108 bytes
$1=($r='2 0 0 ')*192
$2=($r*13+($w='2 '*3)*6+$r*13)*7
$3=($r*6+$w*20+$r*6)*6
"P3 32 32 2 $1$2$3$2$1"|sc .ppm

Outputs a PPM file called .ppm (checked with IrfanView). It sets '2' as the maximum value for each channel, so $r is 2 0 0 for red, $w is 2 2 2 for white, and the rest is string multiplication and a file header; $1 is a horizontal red line for the very top and bottom of the flag, $2 is wide red, narrow white, wide red for the top and bottom parts of the cross, 3 is the centre narrow red, wide white, narrow red. sc is set-content and used because > makes a 2-byte+BOM Unicode file which doesn't work.

APL (dzaima/APL), 83 bytes
P5.size←2⌿32
g←P5.G
a←13 6 19 26
P5.draw←{r←g.rect
g.bg'f00'
g.stroke←⍬
r a
r 2⌽⌽a}

32x32 canvas:

Desmos, 90 69 bytes
c=hsv(0,[1,0,0],1)
[0,6,13]<=x<=[32,26,19]\{[0,13,6]<=y<=[32,19,26]\}

Try it on Desmos!
-21 bytes thanks to Aiden Chow

Applesoft BASIC, 144 bytes
0GR
1COLOR=1
2X=0
3VLIN0,31ATX
4X=X+1
5IFX<32GOTO3
6COLOR=15
7X=12
8VLIN6,25ATX
9X=X+1
10IFX<19GOTO8
11Y=12
12HLIN6,25ATY
13Y=Y+1
14IFY<19GOTO12

Batch File, 584 497 bytes
EDIT: -87 bytes! Replaced rem with hh as it is a no-op when no arguments are passed, removed a bunch of quotation marks and some other stuff.
I'm sure this can be compressed some more, but for the moment it's the best I got.
@!! 2>nul||cmd/q/v/c%0&&exit/b
for /f "tokens=1,2delims=#" %%a in ('"prompt #$H#&for %%b in (1)do hh"')do set K=%%a
set s=aaaaaa
set g=%s%%s%b
:d
set/ai+=1
set t=%i%
if %t%==5 set t=1
if %t%==4 set t=2
if %t%==1 for /l %%a in (1,1,6)do call:c 44 %g%%g%%s%&echo(
if %t%==2 for /l %%a in (1,1,7)do call:c 44 %g%&call:c ff %s%&call:c 44 %g%&echo(
if %t%==3 for /l %%a in (1,1,6)do call:c 44 %s%&call:c ff %g%%s%c&call:c 44 %s%&echo(
if %t%==6 exit
goto d
:c
<nul set/p.=%K%>%~2&findstr/a:%1 . %~2 nul

This code produces the following output (tested on Windows version 10.0.15063):

As a negative side-effect, it creates 4 different files on the same directory with some weird names and gibberish in them. You're free to delete them.
Also, in order for this to look right, CMD's properties must be changed (if not already set correctly):

This code requires that the font chosen has a 1:1 width to height ratio.

Bash + core utils, 147 bytes
echo H4sICBkuh1kAA2ZsYWcueHBtAFNUiAjwNeIyNlIAIiMFQ64ihWQFZTc3AyDgKoewQYCLq4gAGIIKysFg+CooxwKGngI6BNQgUoAFDA0FXABVWXDvSwQAAA|base64 -d|gunzip>1.xpm

Decodes base64-encoded GZipped image data, unGZips it and writes into 1.xpm.

Python 2, 170 bytes
Uses Pillow 2.8.0 with PIL 1.1.7 for the old (and deprecated) offset method.
from PIL.ImageDraw import*
i=Image.new('RGB',(20,20),-1)
Draw(i).rectangle((3,3,18,18),'red',-1)
k=Image.new('RGB',(32,32),'red')
k.paste(i.offset(9),(6,6))
k.show()

C (GCC), 133 130 125 bytes
#define a(x)labs(i x 32-15.5)<
i;main(c){for(puts("P6 32 32 1");i<1024;++i)printf("\1%c%c",c=a(%)10&a(/)10&(a(%)3|a(/)3),c);}

Attempt This Online!
Outputs a PPM image.

Pure bash with utf-8, 262
printf -vv %32s;w=${v:19} d=${w:6} e=${d:1} r=$'\e[31;47m' m=$'\e[0m\n' c=${e:3}
c=${c// /${r} $m} b=${c:14} g=${c// /${v// /█}} h=${c// /${w// /█}$e${w// /█}}
i=$r${e// /█}${d// /▀}$e${d// /▀}${e// /█}$m
echo "$g$h$i${b// /${e// /█}$w$d${e// /█}}${i//▀/▄}$h$g"

Pure bash, without utf-8, 283
printf -vf %14s;f=("$f" "${f:2}") w=$'\e[47m' r=${w/7/1}
for v in 6:rrr 7:rwr 6:www 7:rwr 6:rrr;do l=$r$f c=r s=${v%:*} m=${v#*:}
for((h=0;h<3;h++)){ [ $c != ${m:h:1} ]&&c=${m:h:1}&&l+=${!c};l+=${f[h&1]};}
[ $c = r ]||l+=$r;l+=$f;printf -vo %${s}s;printf "${o// /$l$'\e[0m\n'}";done

Will render:

PNG - 101 bytes :p
âPNG

IHDR  I¥Ë∑PLTEˇˇˇˇA4IDAT◊c`¿ÿ"òˇˇ?Äõ ¬º)’   «√IENDÆB`Ç

Explanation :
Ctrl+C -> Ctrl+V

"PNG" or "keyboard" are not programming languages, as they cannot add two inputs or check the primality of an input.

According to meta consensus on Do submissions have to be answered with a programming language? there is no longer a requirement that answers be in a programming language.

Clearly PNG isn't a programming language, but –at the risk of stating the obvious– this isn't "drawing" anything, it's just the pre-drawn output file handed out on a platter. That makes a profoundly un-interesting submission. Whereas most submissions could be tweaked for different parameters, this would just have to be redrawn and and the output re-pasted into the answer.

Why is PNG unacceptable while GIF is not?

Both are, see the comment above.

Actually, I think it's kind of interesting that a generic commonly used image format like PNG can come close in size to the solutions using code tailor-made to this particular image. Also, people regularly submit Bubblegum solutions, which is designed to be used without input (and as a commentary on Stephen's criteria).


text:
Range, Reverse, Sum!
Given a positive integer n as input, output the reversed range sum of n.
A reversed range sum is created by making an inclusive range up to n, starting with 1 and including n, reversing each of the numbers inside, and summing it.
Example:
Here is what would happen for an input of 10:
Range: [1,2,3,4,5,6,7,8,9,10]
Reverse: [1,2,3,4,5,6,7,8,9,01] (1-char numbers reversed are themselves, 10 reversed is 01 or 1)
Sum: 46
Numbers with 3+ digits are reversed the same way numbers with 2 digits are. For example, 1234 would become 4321.
Test cases:
Input -> Output

10 -> 46
5 -> 15
21 -> 519
58 -> 2350
75 -> 3147
999 -> 454545

Complete text cases to input of 999 can be found here, thanks very much to @fireflame241.

More test case results (not numbered, sorry, but you can parse through and get their line number if you want): Try it online!

@StepHen >:D Charcoal is faster

Numbered

Relevant

OEIS A062918

-1 because this is uninteresting. It seems like most, if not all, of the submissions are using the same approach. This challenge seems like a bunch of problems that have already been asked, just piped together with no obvious shortcuts.

05AB1E, 3 bytes
Code
LíO

Uses the 05AB1E encoding. Try it online!
Explanation
L       # Range
 í      # Reverse
  O     # Sum

dat explanation tho

@ETHproductions well Reverse should be Reverse each actually...

@EriktheOutgolfer It's not vectorized?

@ASCII-only 05AB1E vectorization is really 1 level deep, not ∞. Also just "reverse" is R, while í is "reverse each".

Bash + GNU utils, 24
seq $1|rev|paste -sd+|bc

Try it online.
Explanation
seq $1                    # range
      |rev                # reverse (each line)
          |paste -sd+|bc  # sum

Read from stdin for -3 bytes: seq|rev|paste -sd+|bc

Perl 6, 20 bytes
{(1..$_)».flip.sum}

Test it
Expanded:
{
   ( 1 .. $_ )\  # Range
   ».flip        # flip each value in the Range (possibly in parallel)
   .sum          # sum up the list
}

Is the 'possibly in parallel' required? Seems like you could get rid of a byte or two by omitting it.

@QPaysTaxes No. The ».flip calls the .flip method on each of the values in the Range. The next shortest way to do this is .map(*.flip) which is 5 bytes more.

Oh, so the key part is "each", not "(possibly in parallel)". Might be worth splitting them out, then.

@QPaysTaxes I'm not sure I know what you mean ».flip is a hyper method call. While I can split up the » and .flip by using an unspace \  like I did before it; that would make it harder to understand, as it would look like the end of a qqww/ / construct (« a b "c d" »).

JavaScript (ES6), 42 bytes
f=n=>n&&+[...n+""].reverse().join``+f(n-1)

My favorite doubly-recursive solution is unfortunately 3 bytes longer:
f=n=>n&&+(g=x=>x?x%10+g(x/10|0):"")(n)+f(n-1)

Retina, 41 36 35 bytes
.+
$*
1
1$`¶
1+
$.&
%O^$`.

.+
$*
1

Try it online! Link includes test cases. Edit: Saved 5 bytes thanks to @FryAmTheEggman. Saved 1 byte thanks to @PunPun1000. Explanation:
.+
$*

Convert to unary.
1
1$`¶

Create a range from 1 to n.
1+
$.&

Convert back to decimal.
%O^$`.

Reverse each number.
.+
$*

Convert back to unary.
1

Sum and convert back to decimal.

@FryAmTheEggman Bah, I keep forgetting about that.

You don't need the ¶ in the .+¶  The match will match across lines

@PunPun1000 I did need it before FryAmTheEggman's fix!

I notice that O^$s`. to reverse the whole string also works.

C (gcc), 63 bytes
f(n){int t=0,c=n;for(;c;c/=10)t=t*10+c%10;return n?t+f(n-1):0;}

Try it online!

Python 2, 38 bytes
Can't compute higher terms than the recursion limit:
f=lambda x:x and int(`x`[::-1])+f(x-1)

Try it online!

You can use import sys and sys.setrecursionlimit() if you want to handle larger numbers, in the tio header.

Jelly, 4 bytes
Ṛ€ḌS

Try it online!
How?
Ṛ€ḌS - Link: n
Ṛ€   - reverse for €ach (in implicit range)
  Ḍ  - convert from decimal list (vectorises)
   S - sum

I KNEW there had to be a way to use Range implicitly, +1

Haskell, 34 bytes
\n->sum$read.reverse.show<$>[1..n]

Simple and straightforward.

Python 2, 50 47 bytes
 -3 bytes thanks to officialaimm!
lambda n:sum(int(`i+1`[::-1])for i in range(n))

Try it online!

since it's python 2, `` instead of str saves 3 bytes.

cQuents, 4 bytes
;\r$

Try it online!
Explanation
       Implicit input n.
;      Series mode. Outputs the sum of the sequence from 1 to n.
 \r$   Each item in the sequence equals:
 \r    String reverse of
   $                     current index (1-based)

Röda, 56 41 36 bytes
15 bytes saved thanks to @fergusq
{seq 1,_|parseInteger`$_`[::-1]|sum}

Try it online!
This is an anonymous function that takes an integer from the input stream and outputs an integer to the output stream.
Explanation
{seq 1,_|parseInteger`$_`[::-1]|sum} Anonymous function
 seq 1,_                             Create a sequence 1 2 3 .. input and push each value to the stream
        |                            For each value in the stream:
                     `$_`             Cast it into a string
                         [::-1]       And reverse it
         parseInteger                 And parse the resulting string as an integer, while pushing the value to the stream
                               |sum  Sum all the values in the stream

You can save a lot of bytes by using [::-1] instead of reverse. Also  $_  is shorter than _.."" and parentheses after parseInteger are not needed.

@fergusq Thanks for the tips, my Röda has gone a bit rusty :)

Brachylog, 4 bytes
⟦↔ᵐ+

Try it online!
Explanation
⟦↔ᵐ+
⟦        range from 0 to input
 ↔ᵐ      map reverse
   +     sum

C# (.NET Core), 103 97 bytes
using System.Linq;r=>new int[r+1].Select((_,n)=>int.Parse(string.Concat((n+"").Reverse()))).Sum()

Try it online!
TIO link outputs all the results from 1 to 999, so feel free to check my work.
I expected this to be a bit shorter, but it turns out Reverse() returns an IEnumerable<char> instead of another string so I had to add some extra to turn it back into a string so I could parse it to an int. Maybe there's a shorter way to go from IEnumerable<char> to int correctly.
Of minor note, this also uses the functions Range() Reverse() and Sum() all in order.
-6 bytes thanks to TheLethalCoder

You don't need the trailing semi colon. I think using new int[r] and .Select((_,n)=>...) will save you bytes.

@TheLethalCoder It takes new int[r+1] to get the right output since the index starts at 0, but it does still save a few bytes. RIP Range() though

APL (Dyalog), 10 7 bytes
3 bytes golfed thanks to @Adám by converting to a tradfn from a train
+/⍎⌽⍕⍳⎕

Try it online!
⎕          Input (example input: 10)
⍳          Range; 1 2 3 4 5 6 7 8 9 10
⍕          Stringify; '1 2 3 4 5 6 7 8 9 10'
⌽          Reverse; '01 9 8 7 6 5 4 3 2 1'
⍎          Evaluate; 1 9 8 7 6 5 4 3 2 1
+/         Sum; 46

To @Uriel & Cows quack about the chat question: Well, I did the Mathematics portion, in addition to that, I've been suspended from chat, hence my not responding in there.

7 bytes: +/⍎⌽⍕⍳⎕

@Adám Thanks for the tip. Removing the ¨ was clever :)

Ruby, 56, 52, 41, 39 bytes
->n{(1..n).sum{|i|i.to_s.reverse.to_i}}

Ruby, 34 bytes (if lambda param is a string)
->n{(1..n).sum{|i|i.reverse.to_i}}

Thanks to @Unihedron for the second solution.

->n{ works as well.

I have crafted a shorter program in the same tool (Ruby) that is different enough (it deals with input and output) to be its own submission, you can find it here: https://codegolf.stackexchange.com/a/150636/21830

@Unihedron, haha, I didn't know Ruby is so crazy to allow string ranges. Thanks.

Yes, ruby also has nifty features like ?a..?z and ?a1..?h8 (although you better be careful with the 2nd format :D)

Ranges has to either 1. (for start value) implement succ and 2. (if either start or end value does not implement succ) be numeric, so int..string will get rejected as "Bad value for range". The inverse is true (but alas there's no downto range), or (?1..n) can be used instead

Vim, 39 37 28 bytes
D@"O<C-V><C-A>0<ESC>V{g<C-A>:%!rev
v}gJS0<ESC>@"

Try it online!
Tons of bytes saved thanks to some great advice by user41805
Explanation
Step 1: build the range (with summing commands included)
D@"O<C-V><C-A>0<ESC>V{g<C-A>
D                               Delete the input number
 @"            <ESC>            Do that many times:
   O                              Insert a new line above
    <C-V><C-A>                    Write a <C-A> byte (\x01)
              0                   Followed by a 0
                    V{          Select all the lines just written
                      g<C-A>    Turn the numbers into an increasing range

Step 2: reverse each number
:%!rev (that's it)
This will produce a sequence of lines with the reversed number followed by <C-A>, which is the command to increase a value by the reversed number. Leading 0s actually move the pointer to the beginning of the line, so they are effectively ignored.
Step 3: sum them all up
v}gJS0<ESC>@"
v}               Select all the lines to the end of the file
  gJ             Join them
    S            Replace this line
     0<ESC>         with a 0
           @"    Execute the replaced line as commands

Mathematica, 47 bytes
Tr[FromDigits@*Reverse/@IntegerDigits@Range@#]&

Try it online!  (in order to work on mathics we need to replace "Tr" with "Total")

Tr@*IntegerReverse@*Range

Japt, 7 5 bytes
-2 bytes thanks to @Shaggy.
õs xw

Try it online!
Explanation
õs xw  Implicit input of integer U
õs     Create range [1,U] and map to strings
    w  Reverse each string
   x   Sum the array, implicitly converting to numbers.

Old solution, 7 bytes
Keeping this since it's a really cool use of z2.
õs z2 x

Try it online!
Explanation
õs z2 x  Implicit input of integer U
õs       Create range [1,U] and map to strings
   z2    Rotate the array 180°, reversing strings
      x  Sum the array, implicitly converting back to integers

You know z2 on a flat array is the same as w, righ... uhm... excuse my inadequacy at Japt...

6 bytes: õ_swÃx thanks to the new addition of N.s(f).

Or even just õs xw for 5 bytes.

@Shaggy I can't believe nobody mentioned that 5-byte solution until now... will edit in a bit. As for the 6-byte one, if that was added after this challenge was posted, I think that'd be non-competing.

@JustinMariner, neither can I! :D Although, it seems a shame to ditch that z2 trick; that was pretty damn genius. Note that non-competing is no longer a thing.

Charcoal, 14 13 bytes
-1 byte thanks to Carlos Alejo
Ｉ∕…·⁰Ｎ«⁺ιＩ⮌Ｉκ

Try it online! Link is to verbose version.
Explanation
Ｉ                  Cast
  ∕     «           Reduce
   …·⁰Ｎ            Inclusive range from 0 to input as number
         ⁺          Plus
          ι         i
           Ｉ⮌Ｉκ   Cast(Reverse(Cast(k)))

You can save a byte by dropping the last ». By the way, where in the Charcoal wiki is the Reduce operator documented?

Nowhere, it's an overload of the division one :| I can give you edit access if you want (sorry I'm too lazy to do it myself)

Also yeah I forgot why leaving out ending braces works lol

I would really like the Charcoal wiki to be a bit more documented, as there are still some working but hidden features. If you grant me edit access I'll do my best to document them. Example: how can the Modulo operator be used to format strings in Charcoal?

So why do you need the «? You don't need it for Map...

@Neil Because otherwise it's treated as normal divide since it's then a valid expression. Should I have another custom operator instead (btw this is the same for any (⊙) and all (⬤) even though they're not overloads :| sorry i'll change them if you think it's going to have a big effect)

@CarlosAlejo I've had a bit of free time so I've started documenting stuff, hope you like it!

@CarlosAlejo it's python style modulo so the format is exactly the same as with Python, also sent invite to what I think it's your GitHub

@ASCII-only Wait until I start reporting bugs...

Well that's good as well isn't it, it means Charcoal will be less buggy

@CarlosAlejo pls accept github invite tyvm

@ASCII-only I didn't receive any invitation. My Github account is charliealejo.

@CarlosAlejo done (also i invited "Carlos Alejo" who joined 13 days ago, I thought it was you)

C++, 146 bytes
#include<string>
using namespace std;int r(int i){int v=0,j=0;for(;j<=i;++j){auto t=to_string(j);reverse(t.begin(),t.end());v+=stoi(t);}return v;}

Good job! You can spare some bytes by removing the header and putting "using namespace std" (check here https://tio.run/#cpp-gcc). I also think you could replace "auto t" with just "t" (?)

Yeah, koita_pisw_sou is right about the first part. But you need the auto.

@koita_pisw_sou Do you mean that i can exclude the header directive from the byte count ? Same for the namespace ? auto keyword is needed

Yes, check the link I sent

(Whoops, I am not sure about the removing the header!) But I was referring to using namespace std; saving bytes.

You can use #import<string> to save a byte, but the bytes for the header still count.

@KarlNapf From what i read, the import statement is non standard and doesn't work the same way between GCC and VC++

Regarding code golfing, you're free to chose a specific compiler/interpreter and/or a specific implementation of a given language. Writing standard code shouldn't be a concern, only the bytecount should. :-)

Husk, 7 6 3 bytes
ṁ↔ḣ

Try it online!
Ungolfed/Explanation
  ḣ  -- With the list [1..N] ..
ṁ    -- .. do the following with each element and sum the values:
 ↔   --    reverse it

Java 8, 97 bytes
IntStream.range(1,n+1).map(i->Integer.valueOf(new StringBuffer(""+i).reverse().toString())).sum()

EDIT
As per the comment of Kevin Cruijssen, I would like to improve my answer.
Java 8, 103 bytes
n->java.util.stream.LongStream.range(1,n+1).map(i->new Long(new StringBuffer(""+i).reverse()+"")).sum()

Integer.valueOf can be golfed to new Integer, and .reverse().toString() can be golfed to .reverse()+"". Also, you must include the required imports and lambda parameters, like java.util.stream.IntStream and n-> before it. And you can also golf IntStream & Integer to LongStream and Long. The final answer will be n->java.util.stream.LongStream.range(1,n+1).map(i->new Long(new StringBuffer(""+i).reverse()+"")).sum() (103 bytes - Your current answer with added import and lambda parameter would be 117 bytes.) Still +1, nice answer!

@KevinCruijssen Thank you for your valuable inputs. I'll update my answer. Thanks. :)

Perl 5, 29 27 22 + 1 (-p) = 23 bytes
map$\+=reverse,1..$_}{

Try it online!

26 bytes: map$r+=reverse,1..<>;say$r.

Got it down even further using -p

Magneson, 102 bytes

That's not very visible, so here's a scaled up version (Note: Won't actually run, and still isn't very pretty)

(source: googleapis.com)
Magneson operates by parsing an image and evaluating commands from the colours of the pixels it reads. So stepping through the image for this challenge, we have:

R: 0, G: 1, B: 1 is an integer assignment command, which takes a string for the variable name and the value to assign. We'll use this to store the sum total.
R: 0, G: 1, B: 0 is a prebuilt string with the value VAR_1 (Note: This is only while we're asking for a string; the colour code has a separate function when used elsewhere).
R: 3, G: 0, B: 0 is a raw number. Magneson handles standard numbers by requiring the Red component to be exactly 3, and then forms a number by using the blue value directly plus the green value multiplied by 256. In this case, we're just getting the number 0.
R: 0, G: 1, B: 1 is another integer assignment command. This time, we're storing an iteration variable, to keep track of which number we're on
R: 0, G: 1, B: 1 is a prebuilt string with the value VAR_2 (Once more, only when we need a string)
R: 3, G: 0, B: 0 is the number 0, once more. Onto the interesting bits now.
R: 1, G: 0, B: 0 indicates the start of a loop. This takes a number and loops the following snippet of code that many times.
R: 2, G: 0, B: 0 is the STDIN function, or at least it is when we need a number. This reads a line of input from the console and turns it into a number, since we asked for a number.
R: 0, G: 8, B: 0 starts off our looping code, and it is an additive command. This adds a number to an integer variable, and so takes a string for the variable name, and the number to add.
R: 0, G: 1, B: 1 is the prebuilt string for VAR_2, which is our iteration variable.
R: 3, G: 0, B: 1 is a raw number, but this time it's the number 1.
R: 0, G: 8, B: 0 is another addition command.
R: 0, G: 1, B: 0 is the string for VAR_1, which is our sum total.
R: 0, G: 3, B: 0 is a function that reverses a string. In the context of asking for a number, it then converts the reversed string to a number.
R: 0, G: 2, B: 1 is an integer retrieval command, and will retrieve the number stored in a provided variable. In the context of asking for a string (such as from the reverse command), it converts the number to a string.
R: 0, G: 1, B: 1 is the name VAR_2; our iteration variable.
R: 1, G: 0, B: 1 is the marker to end the loop, and go back to the start of the loop if the criteria isn't met (so if we need to keep looping). Otherwise, proceed onwards.
R: 0, G: 0, B: 1 is a very simple println command, and takes a string.
R: 0, G: 2, B: 1 retrieves an integer from a variable
R: 0, G: 1, B: 0 is the name of our sum total variable, VAR_1

All in all, the program:

Assigns the value 0 to VAR_1 and VAR_2
Loops from 0 to a number provided in STDIN

Adds one to VAR_2
Adds the integer value of reversing VAR_2 to VAR_1

Prints the contents of VAR_1

CJam, 12 bytes
ri){sW%i}%:+

Try it online!
-1 thanks to Business Cat.
Explanation:
ri){sW%i}%:+
r            Get token
 i           To integer
  )          Increment
   {sW%i}    Push {sW%i}
    s         To string
     W        Push -1
      %       Step
       i      To integer
         %   Map
          :+ Map/reduce by Add

Could you add an explanation? I don't understand CJam (nor GolfScript). But MY beat two (albeit ancient in terms of golf-langs) golfing languages!

@Zacharý done...

You don't need the ,

@BusinessCat Ohhh used too much to GolfScript apparently...

Gol><>, 26 bytes
&IFLPWaSD$|~rlMFa*+|&+&|&h

Try it online!
Explanation
&I                      &h < register init, read "n"; print register (h = n;)
  FLP                  |   < For loop, do "n" times for each x in [1] to [n]
     WaSD$|                < modpow "x" to digits: [123] [3 12] [3 2 1] [3 2 1 0]
           ~rlMFa*+|       < Ditch zero, reverse stack, build the number back
                    &+&    < register += final x

Vyxal, s, 2 bytes
ƛṘ

Try it Online!

Here's a test suite if you're interested.

As impressive as this is, I think flags should be included in the bytecount, as the program would not have worked this way if it wasn't for the flag

@Dion it was decided that flags don't have to be byte count over on meta. If I didn't have that policy backing me up, vyxal wouldn't have flags at all.

new codepage version

Idea: allow usage of older versions on the webpage and add that as a link parameter

vim, 49 46 bytes
A@q<ESC>0"bDa1<ESC>qqYp<C-a>q@bdk:%s/$/+
:%!rev
xVGJ:%!bc

<ESC> is 0x1b,
<C-a> is 0x01,
<NL> is 0x0a.
Annotated
A@q<ESC>0"bD  # put {N}@q (run macro q N times) in register b
a1<ESC>       # buffer now contains "1"
qqYp<C-a>q    # store macro that copies and increments the last line in register q
@bd1k         # run {N} times, then delete the extra lines
              # (can't just run {N-1} times, or it won't handle N=1 correctly)
:%s/$/+<NL>   # append + to each line
:%!rev<NL>    # reverse each line
x             # delete leading +
VGJ           # join lines
:%!bc<NL>     # sum

Try it online!

Excel, 59 bytes
=LET(y,COLUMN(A:O),SUM((0&MID(SEQUENCE(A1),y,1))*10^(y-1)))

Explanation
=LET(
y,COLUMN(A:O)                           'y = [1..15] horz.; Excel is accurate to 15 places
SUM((0&MID(SEQUENCE(A1),y,1))*10^(y-1)) 'final result
           SEQUENCE(A1)                 '[1..A1] vertical
    (0&MID(            ,y,1))           'array of individual digits; 0& is to avoid errors on blank cells
                             *10^(y-1)  'multiply 2nd column by 10, 3rd 100, etc.
SUM(                                  ) 'sum the array

Just an FYI, your answers are popping up in the Low Quality Posts review queue as their length catches the system filter. I'd suggest adding in a brief explanation in order to avoid this :)

Thank you for letting me know.  I will start adding some explanations.

RProgN 2, 8 bytes
{Ø.in}S+

Explained
{Ø.in}S+
{    }S # Create a stack in range 0 through the implicit input, using the function defined
 Ø.     # Append nothing, stringifying the number
   i    # Reverse the string
    n   # Convert back to a number
       +# Get the sum of the stack, and output implicitly.

Try it online!

Pyth, 8 6 bytes
 -2 bytes thanks to FryAmTheEggman!
sms_`h

Try it online!

1 byte longer version, sms_`dS, that does not abuse implicit U at the end.

TXR Lisp: 62 56 bytes:
(opip(range 1)(mapcar[chain tostring reverse toint])sum)

Interactive:
1> (opip(range 1)(mapcar[chain tostring reverse toint])sum)
#<intrinsic fun: 0 param + variadic>
2> [*1 10]
46
3> [*1 999]
454545

The following 44 byte expression, inspired by the Pari/GP solution, is possible; however, it requires the sum macro to be defined:
1> (defmacro sum (var from to expr)
      (with-gensyms (accum)
        ^(for ((,var ,from) (,accum 0))
              ((<= ,var ,to) ,accum)
              ((inc ,accum ,expr) (inc ,var)))))
sum
2> (do sum x 1 @1 (toint(reverse(tostring x))))
#<interpreted fun: lambda (#:arg-01-0171 . #:rest-0170)>
3> [*2 10]
46
4> [*2 999]
454545

Python 3, 50 bytes
lambda n:sum(int(str(n)[::-1])for n in range(n))

Quite close to idiomatic Python code, and honestly I don't really see much room for improvement.

Use n surrounded by backticks instead of str(n) for a nice save

Backticksyntax is Python 2 only.
Plus, the answer is off by 1.. it should be range(n+1)

Tcl, 66 bytes
time {incr s [regsub ^0+ [string rev $n] ""];incr n -1} $n
puts $s

Try it online!

Neim, 4 bytes
Δ)

Try it online!
Explanation
Δ )              for each element 1 to n (outputs list)
                reverse
                sum

Alternative solution: Ψ (create inclusive range, reverse each element, sum)

@Okx didn't know that the Ψ token existed! would have definitely used that in hindsight. real nice

Excel VBA, 80 78 49 Bytes
Anonymous VBE Immediate Window function that takes input expected type Integer from range [A1] determines all of the values that fall within the range 1:[A1], and outputs the sum of the reversed values to the VBE immediate window
For i=1To[A1]:s=s+Val(StrReverse(Str(i))):Next:?s

C (gcc), 71 bytes
q(n,x,p){p=n?q(n/10,x*10+n%10):x;}f(w,a,e){for(a=0;w;)a+=q(w--,0);e=a;}

Try it online!

Wait... what? How f() returns its result without any return statement? Does the e=a instruction manipulates the registers in such a way that the result is stored in the same register than the one used by returned values?

Ruby, 38 35 bytes
Similar to the previous Ruby solution,
 but a full program and also shorter (for less than an hour)!
p (?1..gets).sum{|x|x.reverse.to_i}

Shortened by 3 bytes thanks to user akostadinov
Try it online!
Explanation
p             # Inspect and print. Written as infix notation to avoid using ()
(?1..gets)    # All strings from "1" to "input", based on successive string format
  .sum{|x|    # Enumerable -> Map to value -> Sum by value
      x.reverse.to_i
  }

you can do (?1..gets).sum{...})

Gaia, 7 bytes
@…)¦v¦Σ

Try it online!
Range, Reverse, and sum!
@             # push an input. stack: n
 …            # generate range. stack: [0...n-1]
  )¦          # map over the list with increment. stack: [1...n]
    v¦        # map over the list with reverse. stack: [1...n], but all digitally reversed
      Σ       # sum the list; output TOS.

Python 3, 52 bytes
lambda n:sum(int(str(n+1)[::-1])for n in range(n))
lambda n:sum(int(f'{n+1}'[::-1])for n in range(n))

The second is equivalent to the first.

Pyke, 7 bytes
SF`_b)s

Try it online!
S       -   range(1, input)
 F   )  -  for i in ^:
  `     -     str(i)
   _    -    reversed(^)
    b   -   int(^)
     s  - sum(^)

MATL, 5 bytes
:VPUs

Try it online!

R, 89 75 bytes
sum(scan(t=sapply(1:scan(),function(x)intToUtf8(rev(utf8ToInt(c(x,'')))))))

Try it online!
Thanks to JayCe and Dominic van Essen for the golfs.

I know it's an old one but what about this for 82 bytes?

or even this for 75 bytes?

@DominicvanEssen thanks!

@JayCe Doesn't seem like you're active any longer, but thank you for the golf, and apologies I didn't respond sooner!

Pyth - 7 bytes
sms_`dS

Explanation
sms_`dSQ  Q added implicitly
s         Sum of
 m        map
  s_`d    integer representation of reversal of string representation
          to
      SQ  Range from 1 to input

Pyt, 3 bytes
ř₫Ʃ

Try it online!
The characters perform the following operations: range, reverse, sum.

Dammit. You beat me to it. +1

@mudkip201 Yeah I feel like its almost a race to see who can get the most trivial arithmetic challenges answered

Canvas, 7 bytes
Ｒ｛ŗ±┤］∑

Try it here!

Lua (59 bytes)
function r(u)return u<1 and 0 or(u..""):reverse()+r(u-1)end

PowerShell, 43 bytes
1.."$args"-join'+'|% t*y|%{$s=$_+$s}
$s|iex

Try it online!
This script converts a range [1,2,3,4,5,6,7,8,9,10] to the reversed string 01+9+8+7+6+5+4+3+2+1 and evaluates the string

Python 3, 127 bytes
def f(n):
 s=0
 for i in range(1,n+1):
  r=""
  k=str(i)
  for j in range(0,len(k)):
   r=r+k[len(k)-1-j]
  s+=int(r)
 return s

Java (OpenJDK 8), 81 bytes
long g(int n){return n<1?0:new Long(""+new StringBuffer(""+n).reverse())+g(n-1);}

Try it online!

Arn -x, 4 bytes
P▀g³

Try it!
Explained
Unpacked: ~)@.<
    ~    One-range to
      _  Input; implied
  )
@        Map with
  .<     Reverse fix
      Implicit sum

Desmos, 72 70 bytes
l=floor(logx)
f(y)=∑_{x=1}^y∑_{n=0}^lmod(floor(x/10^n),10)10^{l-n}

Try it on Desmos!
-2 bytes thanks to Aiden Chow

Factor + math.unicode, 39 bytes
[ [1..b] [ >dec reverse dec> ] map Σ ]

Using build 2166 for the somewhat recent addition of >dec.

Burlesque, 7 bytes
ro)<-++

Try it online!
ro  # Range
)<- # Reverse
++  # Sum

K (ngn/k), 15 14 13 bytes
{+/.'|'$1+!x}

Try it online!
-1 byte thanks to coltim

You could use .' instead of \I$ to save a byte. A couple more could be saved by making this tacit, i.e. [+/.'|'$1+!:`](https://ngn.bitbucket.io/k/#eJxLs9LW11OvUVcx1Fa04uJKUzA0UFDQV9C1UzAxA/JMFaA8Q1Mgz8gQyjM1tARJWkC5RsamBkC+uSmUb2xoYg7kW1paQo0yBUEAI7kTlA==)

Julia 1.0, 38 bytes
!x=sum(Meta.parse∘join∘digits,1:x)

Try it online!
this works because digits returns an array with the digits starting with the least significants first (digits(123) == [3, 2, 1])
alternative, also 38 bytes (but more chars and not as nice)
!x=sum(@.parse(Int,join(digits(1:x))))

Try it online!

J-uby, 16 bytes
:+|:sum+(S|:~|Z)

Attempt This Online!
Explanation
Same idea as the Ruby answers but J-uby helps us out with some handy shortcuts.
:+ | :sum + (S | :~ | Z)

:+ |                      # Make range 1..n, then
     :sum + (          )  # Sum of items...
             S |          #   Converted to string, then
                 :~ |     #   Reversed, then
                      Z   #   Converted to int

><>, 68 bytes
1:{:})?^:9)?v:1+!
a:v?(1:[2$0:<.17-%1:,a}+*a{%
0.>~]$d
=?n+a3.>~{~l1

Try it online!

Japt -x, 4 bytes
õÈìÔ

Try it
õÈìÔ     :Implicit input of integer
õ        :Range [1,input]
 È       :Map
  ì      :  Convert to digit array
   Ô     :  Reverse and implicitly convert back
         :Implicit output of sum of resulting array

Thunno +, \$4\log_{256}(96)\approx\$ 3.29 bytes
R.rS

Attempt This Online!
Explanation
R.rS  # Implicit input
      # + flag adds one
R     # Range
 .r   # Reverse each
   S  # Sum
      # Implicit output

Jelly, 5 bytes
RDUḌS

Try it online!
R      ' [R]ange
 D     ' Integer -> [D]ecimal
  U    ' [U]pend (vectorized reverse?)
   Ḍ   ' [Ḍ]ecimal -> Integer
    S  ' [S]um

Shouldn't you make it [U]pend for completion's sake?

You right, all better.  Thanks!

MY, 11 bytes
iC4ǵ'ƒ⇹(Σ↵

Try it online!
How?

 input as integer
i [1 ... pop()] inclusive
C4ǵ' push the string '\x4C' (The reverse command (⌽), which works on numbers)
ƒ as a function
⇹ mapped over the argument (pushes a function)
( apply the function
Σ sum
↵ output with a new line

MY is capable of something, woohoo!

_> unimplemented codepage

...I just have to ask, why did you rearrange ASCII for your codepage? :P

I started with the functions, rather than the codepage, and I want the cp to be organized as heck (Nilads, Monads, Dyads, Triads). The unimplemented codepage is there so even readable at all.

Also, what do you expect from a language that has 12- result in 1 rather than -1?

MY's codepage is now implemented, and MY is finally on TIO!

Ly, 31 bytes
ns[l1-s]pr[s>lSrJs>l<p<p]>>r&+u

Try it online!

Javascript,89 77 72 bytes
saved 12 bytes thanks to @Justin Mariner
saved 5 bytes thanks to @Neil
n=>-eval(`-'${[...[...Array(n+1).keys()].join`'-'`].reverse().join``}'`)

Explanation:
[...Array(n+1).keys()] creates an array from 0 to n.
.reverse().join``  reverses every value.
.join`'-'` and eval(`-'{stuff}'`) subtracts the values in order, producing the negative of the answer.
- negates the negative to a positive.

You can use [...Array(n)] to avoid fill() and can combine both maps: n=>eval([...Array(n)].map((_,a)=>+(++a+"").split``.reverse().join``).join`+`). Be careful coping that since SE adds unprintable chars to break code lines.

It's quicker to join the array first, then reverse it, as that saves you from converting the numbers to strings: n=>eval([...[...Array(n+1).keys()].join`+`].reverse().join``).

@Neil doesn't work for 999(produces 4153), probably because of octal literals getting added

Bah, stupid octal literals. Best I can do in that case is n=>-eval(`-'${[...[...Array(n+1).keys()].join`'-'`].reverse().join``}'`).

REXX, 46 bytes
arg n
s=0
do i=1 to n
  s=s+reverse(i)
  end
say s

Swift 3, 83 68 characters

    let f={n in Array(1...n).reduce(0){$0+Int(String("($1)".characters.reversed()))!}}

{(1...$0).reduce(0){$0+Int(String("\($1)".characters.reversed()))!}}

This would probably be shortened by Swift 4's new String and Character handling.

You do not need to include let f= in the byte count. That saves 6 bytes.

You also do not need Array(1...n). It can be n in(1...n).reduce...

So an anonymous function is good enough for golf?

Of course. The same applies to a lambda in Python, and that's because it's valid even without the declaration, since you can call it like ({n in Array(1...n).reduce(0){$0+Int(String("\($1)".characters.reversed()))!}})(someValue) anyway

PHP, 39+1 bytes
while($i++<$argn)$s+=strrev($i);echo$s;

Run as pipe with -nR.

Rust, 110 bytes
|x:i64|(1..x+1).map(|v|format!("{}",v).chars().rev().collect::<String>().parse::<i64>().unwrap()).sum::<i64>()

Try it online!
I like Rust, but it is not a very efficient language for golfing!

Common Lisp, 62 bytes
(loop as i to(read)sum(parse-integer(reverse(format()"~d"i))))

Try it online!

k, 13 bytes
+/.:'|:'$1+!:

Try it online!
         1+!: /create list 1 2 3 ... x
        $     /turn each number into a string
     |:'      /reverse each string
  .:'         /eval each string
+/            /sum

Pari/GP, 43 bytes
n->sum(i=1,n,fromdigits(Vecrev(digits(i))))

Try it online!

QBIC, 19 bytes
[:|_F!a$|p=p+!A!}?p

Explanation
[:|     FOR a = 1 to n (read from cmd line)
_F   |      FLIP and assign to A$
  !a$        a string cast of our loop counter
p=p+!A!    increment p with A$ cast back to number
}           NEXT
?p         Print the result

Swift 4, 63 61 bytes
{v in(1...v).reduce(0,{$0+Int(String("\($1)".reversed()))!})}

Try it online!

Explanation

{v in} - Creates an anonymous (lambda-like) function with a parameter v.

(1...v) - Inclusive range from 1 to v (although it kind of breaks the rules of logic).

Int(String("\($1)".reversed())) - Reverses the Number by converting it to a String, returning ReverseCollection<String>. That cannot be casted directly to an integer (Swift borked types!), so we have to cast it to String again, before making the conversion to an Integer.

reduce(0,{$0+...}) - Sums the mapped range.

LOGO, 33 bytes
[reduce "+ map "reverse iseq 1 ?]

There is no "Try it online!" link because all online LOGO interpreter does not support template-list.
That is a template-list (equivalent of lambda function in other languages).
Usage:
pr invoke [reduce[?+reverse ?2]iseq 1 ?] 10

(invoke calls the function, pr prints the result)
prints 46.
Explanation:
LOGO stores numbers as words, therefore apply reverse on a number reverse the digits in that number.
reduce "f [a b c d e] (where [a b c d e] is a list) will calculate f(a, f(b, f(c, f(d, e)))). So reduce "+ list will calculate sum of values of list.

Swift 3, 98 bytes
func f(a:Int)->Int{return (0...a).map{Int(String(String($0).characters.reversed()))!}.reduce(0,+)}

77 bytes: {a in(1...a).map{Int(String(String($0).characters.reversed()))!}.reduce(0,+)}.

Also String($0) can be "\($0)" to save a couple of bytes too.

PowerShell, 53 bytes
(1.."$args"|%{-join"$_"["$_".length..0]})-join'+'|iex

Try it online!
Literal translation of the specification. Creates a range with .., reverses each by using string manipulation and -joining them back into a single number, then -joins each number together with a + and piping that to iex (short for Invoke-Expression and similar to eval).

GolfScript, 15 bytes
~),{`-1%~}%{+}*

Try it online!
Explanation:
~),{`-1%~}%{+}* Input all at once
~               Eval
 )              Increment
  ,             Exclusive range
   {     }      Push block
    `            Repr
     -1          -1
       %         Every xth element
        ~        Eval
          %     Map
           { }  Push block
            +    Add
              * Reduce

Java 8, 84 bytes
Lambda from int to long (e.g. IntToLongFunction). Adaptation of coder-croc's solution.
n->{long s=0;while(n>0)s+=new Long(new StringBuffer(""+n--).reverse()+"");return s;}

Try It Online

Recursiva, 10 bytes
smBa"I_Va"

Try it online!

J, 18 Bytes
+/(".@|.@":)"0>:i.

Explanation:
+/                 | Sum of
  (".@|.@":)       | Reverse
            "0     | Each member of
              >:i. | Integers from 1 to n inclusive

PowerShell, 89 bytes
param($n)function q($x){(($a=$x|% t*y)|%{$a[--$i]})-join''}1..$n|%{$s+=[int](q("$_"))};$s

Try it online!

x86, 27 bytes
f:	xor esi, esi	; Input ecx
	push 10
	pop ebx
.p:	mov eax, ecx
	xor edi, edi
.q:	xor edx, edx
	div ebx
	imul edi, 10
	add edi, edx
	test eax, eax
	jnz .q
	add esi, edi
	loop .p
	ret		; Output esi

Try it online!
Seem not answered

Arturo, 52 bytes
$[n][sum map 1..n=>[to :integer reverse to :string]]

Try it

GolfScript, 12 bytes
,{)`-1%~+}*)

Try it online!
Explanation
code         # explanation           | stack
,{)`-1%~+}*) # function with input n | n
,            # range                 | [0..n)
 {       }*  # fold this block over  | [0..n)
  )          # increment             | [1..n]
   `         # stringify             | ["1"..str(n)]
    -1%      # map by -1 (reverse)   | [rev("1")..rev(str(n)]
       ~     # eval                  | [rev(1)..rev(n)]
        +    # add (effectively sum) | sum([rev(1)..rev(n)])
           ) # increment             | sum([rev(1)..rev(n)])+1

Thunno 2 S, 3 bytes
RṃN

Attempt This Online!
Explanation
RṃN  # Implicit input        -> 10
R    # Push [1..input]       -> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
 ṃ   # Reverse each          -> [1, 2, 3, 4, 5, 6, 7, 8, 9, '01']
  N  # Cast each to int      -> [1, 2, 3, 4, 5, 6, 7, 8, 9, 1]
     # S flag sums the list  -> 46
     # Implicit output

Excel VBA, 40 bytes
Anonymous Immediate window function that takes input from cell [A1] of the activesheet object and outputs to the Immediate Window console.
For i=1To[A1]:u=u--StrReverse(i):Next:?u

source: Stack Exchange

license: 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/

sort: votes