Cut

Cut is a joke language invented by User:A. Writing the shortest number in Cut is an interesting programming puzzle. The Python implementation was created by aryantech123.

Syntax

After the program is processed, the accumulator will be outputted. On the 1st instruction, the operations count by 1. On the 2nd instruction, the operations count by 2, and so on...

`+`: Count up by the current instruction number. `-`: Count down by the current instruction number.

1: +

2: +-+

3: +-+-+

4: ++-+

5: +--++

C Implementation

```#include <stdio.h>
int main(int argc, char*argv[]) {
FILE *fp=fopen(argv[1],"r");
char code[99999];
char c;
for(int i=0;(c=fgetc(fp))!=EOF;i++)
code[i]=c;
int ac=0,q=1;
for(int i=0;code[i]!='\0';i++,q++) {
if(code[i]=='+')
ac+=q;
else
ac-=q;
}
printf("%d",ac);
return 0;
}
```

Python implementation

```file = open('')

code += '~'

a=0
for i in range(0, len(code)):

sym = code[i]
val = i+1

if(sym == '~'):
break
elif(sym == '+'):
a += val
elif(sym == '-'):
a -= val
else:
continue

print(a)
```