buggy_code
stringlengths
11
625k
fixed_code
stringlengths
17
625k
bug_type
stringlengths
2
4.45k
language
int64
0
8
token_count
int64
5
200k
change_count
int64
0
100
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int x) { top++; S[top] = x; } int pop() { top--; return S[top + 1]; } int main() { char s[100]; int a, b, top; while (scanf("%s", s) != -1) { if (s[0] == '+') { a = pop(); b = pop(); push(a +...
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int x) { top++; S[top] = x; } int pop() { top--; return S[top + 1]; } int main() { char s[100]; int a, b, top = 0; while (scanf("%s", s) != -1) { if (s[0] == '+') { a = pop(); b = pop(); pu...
[["+", 0, 14, 8, 9, 0, 43, 49, 50, 0, 32], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 51, 13], ["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
0
203
4
#include <stdio.h> #include <stdlib.h> #include <string.h> int isEmpty(int); int isFull(int); void push(int); int pop(void); int top; int stack[100]; int main() { int x; char s[100]; int d1, d2; // initialize top = 0; while (scanf("%s", s) != EOF) { if (s[0] == '+') { d1 = pop(); d2 = p...
#include <stdio.h> #include <stdlib.h> #include <string.h> int isEmpty(int); int isFull(int); void push(int); int pop(void); int top; int stack[100]; int main() { int x; char s[100]; int d1, d2; // initialize top = 0; while (scanf("%s", s) != EOF) { if (s[0] == '+') { d1 = pop(); d2 = p...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 12, 13], ["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6...
0
323
10
#include <stdio.h> #include <stdlib.h> #include <string.h> void push(int *, int); int pop(int *); int top = 0; int main() { int i, time = 0, y, x, in; int num[100]; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { y = pop(num); x = pop(num); in = x + y; push(num...
#include <stdio.h> #include <stdlib.h> #include <string.h> void push(int *, int); int pop(int *); int top = 0; int main() { int i, time = 0, y, x, in; int num[200]; char s[200]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { y = pop(num); x = pop(num); in = x + y; push(num...
[["-", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["+", 0, 14, 8, 9, 0, 43, 49, 80, 81, 13], ["-", 0, 11, 12, 2, 3, 4, 0, 69, 0, 70], ["-", 0, 11, 12, 2, 3, 4, 0, 69, 71, 13], ["-", 0, 11, 12, 2, 3, 4, 0, 69, 0, 73]]
0
276
7
#include <stdio.h> #include <stdlib.h> #include <string.h> int a(); void b(); int c[1000], top = 0; int main() { int d, e; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { d = a(); e = a(); b(d + e); } else if (s[0] == '*') { d = a(); e = a(); b(d * e...
#include <stdio.h> #include <stdlib.h> #include <string.h> int a(); void b(); int c[1000], top = 0; int main() { int d, e; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { d = a(); e = a(); b(d + e); } else if (s[0] == '*') { d = a(); e = a(); b(d * e...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
0
213
4
#include <stdio.h> #include <stdlib.h> #include <string.h> void push(); int pop(); int top, S[1000]; int main() { char s[100]; int x, y; top = 0; while (scanf("%s", s) != EOF) { if (s[0] == '+') { x = pop(); y = pop(); push(x + y); } else if (s[0] == '-') { x = pop(); ...
#include <stdio.h> #include <stdlib.h> #include <string.h> void push(); int pop(); int top, S[1000]; int main() { char s[100]; int x, y; top = 0; while (scanf("%s", s) != EOF) { if (s[0] == '+') { x = pop(); y = pop(); push(x + y); } else if (s[0] == '-') { y = pop(); ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
0
217
4
#include <stdio.h> #include <stdlib.h> #define Max 100 int top = 0, S[Max]; int main() { int x; char c[Max]; while (scanf("%s", c) != EOF) { if (c[0] == '+') { S[top - 2] = S[top - 1] + S[top - 2]; top--; } else if (c[0] == '-') { S[top - 2] = S[top - 1] - S[top - 2]; top--; }...
#include <stdio.h> #include <stdlib.h> #define Max 100 int top = 0, S[Max]; int main() { int x; char c[Max]; while (scanf("%s", c) != EOF) { if (c[0] == '+') { S[top - 2] = S[top - 1] + S[top - 2]; top--; } else if (c[0] == '-') { S[top - 2] = S[top - 2] - S[top - 1]; top--; }...
[["-", 0, 11, 12, 16, 31, 69, 71, 16, 12, 13], ["+", 0, 11, 12, 16, 31, 69, 71, 16, 12, 13], ["-", 0, 11, 12, 16, 12, 69, 71, 16, 12, 13], ["+", 0, 11, 12, 16, 12, 69, 71, 16, 12, 13]]
0
194
4
#include <stdio.h> #include <stdlib.h> #include <string.h> int Stack[1000]; int top; void push(int x) { top++; Stack[top] = x; } int pop() { top--; return Stack[top++]; } int main() { int a, b; top = 0; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); b...
#include <stdio.h> #include <stdlib.h> #include <string.h> int Stack[1000]; int top; void push(int x) { top++; Stack[top] = x; } int pop() { top--; return Stack[top + 1]; } int main() { int a, b; top = 0; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); ...
[["-", 8, 9, 0, 37, 0, 69, 71, 27, 17, 29], ["+", 8, 9, 0, 37, 0, 69, 71, 16, 17, 72], ["+", 8, 9, 0, 37, 0, 69, 71, 16, 12, 13]]
0
213
3
#include <stdio.h> #include <stdlib.h> int isEmpty(); int isFull(); void push(int x); int pop(); int top; int S[10000]; #define MAX 10000 void initialize() { top = 0; } int isEmpty() { return top == 0; } int isFull() { return top >= MAX - 1; } void push(int x) { if (isFull()) { printf("The queue is full"); } el...
#include <stdio.h> #include <stdlib.h> int isEmpty(); int isFull(); void push(int x); int pop(); int top; int S[10000]; #define MAX 10000 void initialize() { top = 0; } int isEmpty() { return top == 0; } int isFull() { return top >= MAX - 1; } void push(int x) { if (isFull()) { printf("The queue is full"); } el...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
0
306
4
#include <ctype.h> #include <stdio.h> int sp = 0; char stack[200]; void push(int a); int pop(); int main(void) { char c; int flag = 0; int x = 0, y = 0; while ((c = getchar()) != '\n') { // printf("sp = %d\n\n",sp); switch (c) { case ' ': // printf("c = \n"); if (flag) { fla...
#include <ctype.h> #include <stdio.h> int sp = 0; int stack[200]; void push(int a); int pop(); int main(void) { int c; int flag = 0; int x = 0, y = 0; while ((c = getchar()) != '\n') { // printf("\nsp = %d\n",sp); switch (c) { case ' ': // printf("c = \n"); if (flag) { flag ...
[["-", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["+", 36, 36, 36, 36, 0, 30, 0, 43, 39, 40], ["-", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["+", 0, 30, 0, 14, 8, 9, 0, 43, 39, 40], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 28, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 27, 17, 68], ["-", 0, 100, 0, 57, 64, 9, 0, 1, 0, 35]]
0
264
7
#include <stdio.h> #include <stdlib.h> #include <string.h> #define mymalloc(p, n) \ { \ p = malloc((n) * sizeof(*p)); \ if ((p) == NUL...
#include <stdio.h> #include <stdlib.h> #include <string.h> #define mymalloc(p, n) \ { \ p = malloc((n) * sizeof(*p)); \ if ((p) == NUL...
[["-", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22], ["+", 75, 76, 0, 9, 0, 1, 0, 11, 31, 22]]
0
472
4
#include <ctype.h> #include <stdio.h> #include <stdlib.h> typedef long ELEM; #define STACK_SIZE 100 ELEM stack[STACK_SIZE]; int n; void init() { n = 0; } void push(ELEM x) { stack[n++] = x; } ELEM pop() { return stack[n--]; } int empty() { return n == 0; } int main(void) { long a, b, x; long c; while ((c = ...
#include <ctype.h> #include <stdio.h> #include <stdlib.h> typedef long ELEM; #define STACK_SIZE 100 ELEM stack[STACK_SIZE]; int n; void init() { n = 0; } void push(ELEM x) { stack[n++] = x; } ELEM pop() { return stack[--n]; } int empty() { return n == 0; } int main(void) { long a, b, x; long c; while ((c = ...
[["-", 8, 9, 0, 37, 0, 69, 71, 27, 28, 22], ["+", 8, 9, 0, 37, 0, 69, 71, 27, 28, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
286
5
#include <stdio.h> #include <stdlib.h> #include <string.h> int top = 0, S[1000]; void push(int x) { S[top++] = x; } int pop() { return S[--top]; } int main(void) { int a, b; top = 0; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); b = pop(); push((a + b)); ...
#include <stdio.h> #include <stdlib.h> #include <string.h> int top = 0, S[1000]; void push(int x) { S[top++] = x; } int pop() { return S[--top]; } int main(void) { int a, b; top = 0; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); b = pop(); push((a + b)); ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
0
212
4
#include <stdio.h> int main() { int j = 0, flag = 0, Ans[100]; char fx; while (1) { scanf("%c", &fx); if (fx == '\n') break; if (fx >= '0' && fx <= '9') { if (flag) Ans[j] = Ans[j - 1] * 10 + (fx - 48); else Ans[j] = fx - 48; flag = 1; } else if (fx == '+')...
#include <stdio.h> int main() { int j = 0, flag = 0, Ans[100]; char fx; while (1) { scanf("%c", &fx); if (fx == '\n') break; if (fx >= '0' && fx <= '9') { if (flag) Ans[j] = Ans[j] * 10 + (fx - 48); else Ans[j] = fx - 48; flag = 1; } else if (fx == '+') { ...
[["-", 12, 16, 31, 16, 31, 69, 71, 16, 17, 33], ["-", 12, 16, 31, 16, 31, 69, 71, 16, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 38], ["+", 0, 30, 0, 14, 8, 9, 0, 37, 0, 13]]
0
237
5
#include <stdio.h> #include <stdlib.h> #include <string.h> int pop(void); void push(int); int isEmpty(void); // int atoi( const char *str ); int top = 0; int S[100]; int main() { int x, y; char s[199]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { x = pop(); y = pop(); push(x + y);...
#include <stdio.h> #include <stdlib.h> #include <string.h> int pop(void); void push(int); int isEmpty(void); // int atoi( const char *str ); int top = 0; int S[100]; int main() { int x, y; char s[199]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { x = pop(); y = pop(); push(x + y);...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
0
231
4
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 1000 int S[MAX]; int top; char s[MAX]; void initialize(void); int isEmpty(void); int isFull(void); void push(int); int pop(void); int main() { int a, b, x; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(...
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 1000 int S[MAX]; int top; char s[MAX]; void initialize(void); int isEmpty(void); int isFull(void); void push(int); int pop(void); int main() { int a, b, x; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
0
353
4
#include <stdio.h> #include <stdlib.h> #include <string.h> void push(int); int pop(void); void isEmpty(); void isFull(); int hantei(char *); void mozi(char *); int toridashi(char *); char S[100]; int Stack[100]; int top = 0; int main() { int a, b, c, i = 0, x; while (scanf("%s", S) != EOF) { if (S[0] == '+') ...
#include <stdio.h> #include <stdlib.h> #include <string.h> void push(int); int pop(void); void isEmpty(); void isFull(); int hantei(char *); void mozi(char *); int toridashi(char *); char S[100]; int Stack[100]; int top = 0; int main() { int a, b, c, i = 0, x; while (scanf("%s", S) != EOF) { if (S[0] == '+') ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
0
261
4
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S1[200]; void initialize() { top = 0; } /*int isEmpty(){ if(top == 0) return 1; }*/ /*void push(int y, int *S){ top++; S[top] = y; }*/ void push(int x) { S1[++top] = x; } /*int pop(int *S){ if(isEmpty) fprintf(stderr,"underflow\n"); top--;...
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S1[200]; void initialize() { top = 0; } /*int isEmpty(){ if(top == 0) return 1; }*/ /*void push(int y, int *S){ top++; S[top] = y; }*/ void push(int x) { S1[++top] = x; } /*int pop(int *S){ if(isEmpty) fprintf(stderr,"underflow\n"); top--;...
[["-", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 6]]
0
225
2
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 100 int main(void) { int i = 0, num[N], x; char str[N]; while (scanf("%s", str) != EOF) { if (str[0] == '+') { num[i - 2] += num[i - 1]; i--; } else if (str[0] == '-') { num[i - 2] -= num[i - 1]; i--; } els...
#include <stdio.h> #include <stdlib.h> #include <string.h> #define N 100 int main(void) { int i = 0, num[N], x; char str[N]; while (scanf("%s", str) != EOF) { if (str[0] == '+') { num[i - 2] += num[i - 1]; i--; } else if (str[0] == '-') { num[i - 2] -= num[i - 1]; i--; } els...
[["-", 0, 1, 0, 2, 3, 4, 0, 69, 71, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 71, 13]]
0
177
2
#include <stdio.h> #include <stdlib.h> #include <string.h> void push(int); int pop(); int sum[1000]; int top; int main() { int x; int top = 0; int po1, po2; char s[100]; while (scanf("%s", s) != '\0') { if (s[0] == '+') { po1 = pop(); po2 = pop(); push(po1 + po2); } else if (s[0]...
#include <stdio.h> #include <stdlib.h> #include <string.h> void push(int); int pop(); int sum[1000]; int top; int main() { int x; int top = 0; int po1, po2; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { po1 = pop(); po2 = pop(); push(po1 + po2); } else if (s[0] ...
[["-", 0, 52, 15, 23, 0, 16, 12, 103, 0, 104], ["-", 0, 52, 15, 23, 0, 16, 12, 103, 0, 44], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 12, 22]]
0
231
4
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int); int pop(); int isempty(void); int isfull(void); int main() { int x; int a, b; char s[100]; top = 0; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); b = pop(); push(a + b); ...
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int); int pop(); int isempty(void); int isfull(void); int main() { int x; int a, b; char s[100]; top = 0; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); b = pop(); push(a + b); ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
0
300
4
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, stack[100]; void push(int); int pop(void); int main() { int a, b, x, top = 0; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); b = pop(); push(a + b); } else if (s[0] == '-') { a = pop...
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, stack[1000]; void push(int); int pop(void); int main() { int a, b, x, top = 0; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); b = pop(); push(a + b); } else if (s[0] == '-') { a = po...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
0
227
6
#include <stdio.h> #include <stdlib.h> #define N 100 int pop(void); void push(int); int top, S[N]; int main() { int x, y; top = 0; char T[N]; while (scanf("%s", T) != EOF) { if (T[0] == '+') { x = pop(); y = pop(); push(x + y); } else if (T[0] == '-') { x = pop(); y = p...
#include <stdio.h> #include <stdlib.h> #define N 100 int pop(void); void push(int); int top, S[N]; int main() { int x, y; top = 0; char T[N]; while (scanf("%s", T) != EOF) { if (T[0] == '+') { x = pop(); y = pop(); push(x + y); } else if (T[0] == '-') { y = pop(); x = p...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
0
221
4
#include <stdio.h> #include <stdlib.h> #include <string.h> int stack_num, S[1000]; int main() { int a, b, x; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); b = pop(); push(a + b); } else if (s[0] == '-') { a = pop(); b = pop(); push(a - b...
#include <stdio.h> #include <stdlib.h> #include <string.h> int stack_num, S[1000]; int main() { int a, b, x; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); b = pop(); push(a + b); } else if (s[0] == '-') { b = pop(); a = pop(); push(a - b...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
0
209
4
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 1000 /*int initialze(void); int isEmpty(void); int isFull(void);*/ void push(int); int pop(void); int top = 0, STACK[MAX]; int main() { char stack[MAX]; int a, b; while (scanf("%s", stack) != EOF) { switch (stack[0]) { case '+': ...
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 1000 /*int initialze(void); int isEmpty(void); int isFull(void);*/ void push(int); int pop(void); int top = 0, STACK[MAX]; int main() { char stack[MAX]; int a, b; while (scanf("%s", stack) != EOF) { switch (stack[0]) { case '+': ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
0
210
4
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 100 void initialize(void); int isEmpty(void); int isFull(void); void push(int); int pop(void); int top = 0; int S[MAX]; int main() { int x, a, b; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); b...
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 1000 void initialize(void); int isEmpty(void); int isFull(void); void push(int); int pop(void); int top = 0; int S[MAX]; int main() { int x, a, b; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); ...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
0
344
6
#include <stdio.h> #include <stdlib.h> #include <string.h> int initialize(void); int isEmpty(void); int isFull(void); void push(int); int pop(void); int top = 0; int S[100]; int main() { int x; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { push(pop() + pop()); } else if (s[0] =...
#include <stdio.h> #include <stdlib.h> #include <string.h> int initialize(void); int isEmpty(void); int isFull(void); void push(int); int pop(void); int top = 0; int S[100]; int main() { int x; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { push(pop() + pop()); } else if (s[0] =...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22], ["-", 0, 14, 8, 9, 0, 37, 0, 16, 12, 13], ["+", 0, 14, 8, 9, 0, 37, 0, 16, 12, 13]]
0
285
6
#include <stdio.h> #include <stdlib.h> #include <string.h> int S[100]; int top; void initialize() { top = 0; } void push(int x) { top++; S[top] = x; } int pop() { top--; return S[top + 1]; } int main() { int x, a, b; char s[100]; initialize(); while (scanf("%s", s) != EOF) { if (s[0] == '+') ...
#include <stdio.h> #include <stdlib.h> #include <string.h> int S[100]; int top; void initialize() { top = 0; } void push(int x) { top++; S[top] = x; } int pop() { top--; return S[top + 1]; } int main() { int x, a, b; char s[100]; initialize(); while (scanf("%s", s) != EOF) { if (s[0] == '+') ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
0
230
4
#include <stdio.h> #include <stdlib.h> #include <string.h> int stack[1000]; int n; void push(int); int pop(void); int main() { int x, a, b, c; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { b = pop(); a = pop(); push(a + b); } else if (s[0] == '-') { b = pop();...
#include <stdio.h> #include <stdlib.h> #include <string.h> int stack[1000]; int n; void push(int); int pop(void); int main() { int x, a, b, c; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { b = pop(); a = pop(); push(a + b); } else if (s[0] == '-') { b = pop();...
[["-", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["+", 64, 1, 0, 2, 3, 4, 0, 5, 0, 6], ["-", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["+", 8, 9, 0, 57, 15, 23, 0, 16, 31, 22], ["-", 8, 9, 0, 57, 64, 9, 0, 1, 0, 35], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["-", 0, 57, 64, 9, 0, 1, 0, 11, ...
0
268
8
#include <stdio.h> int main() { int stack[200], i = 0, j = 0, k = 0, num[10], n = 0, max = 0, calStack; char c; for (i = 0; i < 200; i++) { stack[i] = 0; } i = 0; while (1) { c = getchar(); if (c >= '0' && c <= '9') { num[i] = c - 48; i++; // printf("%d\n",i); } else i...
#include <stdio.h> int main() { int stack[200], i = 0, j = 0, k = 0, num[10], n = 0, max = 0, calStack; char c; for (i = 0; i < 200; i++) { stack[i] = 0; } i = 0; while (1) { c = getchar(); if (c >= '0' && c <= '9') { num[i] = c - 48; i++; // printf("%d\n",i); } else i...
[["+", 75, 76, 0, 57, 15, 23, 0, 16, 17, 98], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 31, 22], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 17, 47], ["+", 0, 57, 15, 23, 0, 16, 12, 16, 12, 13]]
0
386
4
#include <stdio.h> #include <stdlib.h> typedef struct cell { int num; struct cell *next; } cell; /*-----------------push------------*/ cell *push(cell *root, int x) { cell *new; new = (cell *)malloc(sizeof(cell)); new->next = NULL; new->num = x; if (root == NULL) { root = new; } else { new->...
#include <stdio.h> #include <stdlib.h> typedef struct cell { int num; struct cell *next; } cell; /*-----------------push------------*/ cell *push(cell *root, int x) { cell *new; new = (cell *)malloc(sizeof(cell)); new->next = NULL; new->num = x; if (root == NULL) { root = new; } else { new->...
[["-", 0, 11, 12, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 11, 12, 2, 3, 4, 0, 16, 12, 22]]
0
324
4
#include <stdio.h> #include <stdlib.h> typedef struct node { int data; struct node *next; struct node *prev; } stack; stack *head = NULL; stack *last = NULL; void Push_back(int); int Pop_back(void); main() { char x[101]; scanf("%s", &x); do { if (x[0] == '+' || x[0] == '-' || x[0] == '*') { int a,...
#include <stdio.h> #include <stdlib.h> typedef struct node { int data; struct node *next; struct node *prev; } stack; stack *head = NULL; stack *last = NULL; void Push_back(int); int Pop_back(void); main() { char x[101]; scanf("%s", x); do { if (x[0] == '+' || x[0] == '-' || x[0] == '*') { int a, ...
[["-", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 16, 31, 2, 3, 4, 0, 66, 17, 67]]
0
374
6
#include <stdio.h> #include <stdlib.h> int main(void) { char c[10000]; int a[2000]; int i = 0, j = 0; while (scanf("%s", c) != EOF) { switch (c[0]) { case '%': a[i - 2] = a[i - 1] / a[i - 2]; i--; break; case '*': a[i - 2] = a[i - 1] * a[i - 2]; i--; break; ca...
#include <stdio.h> #include <stdlib.h> int main(void) { char c[10000]; int a[2000]; int i = 0, j = 0; while (scanf("%s", c) != EOF) { switch (c[0]) { case '%': a[i - 2] = a[i - 1] / a[i - 2]; i--; break; case '*': a[i - 2] = a[i - 1] * a[i - 2]; i--; break; ca...
[["-", 0, 11, 12, 16, 31, 69, 71, 16, 12, 13], ["+", 0, 11, 12, 16, 31, 69, 71, 16, 12, 13], ["-", 0, 11, 12, 16, 12, 69, 71, 16, 12, 13], ["+", 0, 11, 12, 16, 12, 69, 71, 16, 12, 13]]
0
215
4
#include <stdio.h> int count = 0; int stack[100]; void push(int x) { count++; stack[count] = x; } int pop() { count--; return stack[count + 1]; } int main() { int x; char s[100]; int a, b; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); b = pop(); push(a + b); ...
#include <stdio.h> int count = 0; int stack[100]; void push(int x) { count++; stack[count] = x; } int pop() { count--; return stack[count + 1]; } int main() { int x; char s[100]; int a, b; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); b = pop(); push(a + b); ...
[["-", 0, 1, 0, 2, 3, 4, 0, 69, 71, 13], ["+", 0, 1, 0, 2, 3, 4, 0, 69, 71, 22]]
0
212
2
#include <stdio.h> int top = 0; int stack[1000]; void push(int n) { stack[++top] = n; } int pop(void) { top--; return stack[top + 1]; } void calc(char op) { int n1 = pop(), n2 = pop(); if (op == '+') push(n1 + n2); if (op == '-') push(n2 - n1); if (op == '*') push(n2 - n1); } int main(void)...
#include <stdio.h> int top = 0; int stack[1000]; void push(int n) { stack[++top] = n; } int pop(void) { top--; return stack[top + 1]; } void calc(char op) { int n1 = pop(), n2 = pop(); if (op == '+') push(n1 + n2); if (op == '-') push(n2 - n1); if (op == '*') push(n2 * n1); } int main(void)...
[["-", 64, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 0, 16, 31, 2, 3, 4, 0, 66, 17, 67]]
0
207
3
#include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZE 200 struct stack { int top; int elem[SIZE]; }; void initstack(struct stack *p) { p->top = -1; } int stackempty(struct stack *p) { return p->top < 0; } int pop(struct stack *p) { int val; if (p->top < 0) { printf("Underflow.\n"); ...
#include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZE 200 struct stack { int top; int elem[SIZE]; }; void initstack(struct stack *p) { p->top = -1; } int stackempty(struct stack *p) { return p->top < 0; } int pop(struct stack *p) { int val; if (p->top < 0) { printf("Underflow.\n"); ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
0
364
4
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int x) { // top を加算してからその位置へ挿入 S[++top] = x; } int pop() { top--; // topが指していた要素を返す return S[top + 1]; } int main() { int a, b; top = 0; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { ...
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int x) { // top を加算してからその位置へ挿入 S[++top] = x; } int pop() { top--; // topが指していた要素を返す return S[top + 1]; } int main() { int a, b; top = 0; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
0
211
12
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int x) { // top を加算してからその位置へ挿入 S[++top] = x; } int pop() { top--; // topが指していた要素を返す return S[top + 1]; } int main() { int a, b; top = 0; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { ...
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int x) { S[++top] = x; } int pop() { top--; return S[top + 1]; } int main() { int a, b; top = 0; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { b = pop(); a = pop(); push(a + b)...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
0
211
12
#include <stdio.h> #define SIZE 100 int stack[SIZE]; int n = 0; void push(int x) { stack[n] = x; n++; } int pop() { n--; return stack[n]; } int main(void) { char c[1000000]; int x, a, b; while (scanf("%c", c) != EOF) { if (isdigit(c[0])) { x = atoi(c); push(x); } else if (c[0] == '+...
#include <stdio.h> #define SIZE 100 int stack[SIZE]; int n = 0; void push(int x) { stack[n] = x; n++; } int pop() { n--; return stack[n]; } int main(void) { char c[1000000]; int x, a, b; while (scanf("%s", c) != EOF) { if (isdigit(c[0])) { x = atoi(c); push(x); } else if (c[0] == '+...
[["-", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 0, 16, 31, 2, 3, 4, 0, 5, 0, 6]]
0
206
2
#include <stdio.h> #include <stdlib.h> int top, S[1000]; void init_stack() { top = -1; } void push(int v) { S[++top] = v; } int pop() { return S[top--]; } int do_op(int a, int b, char op) { int r = 0; switch (op) { case '+': r = a + b; break; case '-': r = a - b; break; case '*': r =...
#include <stdio.h> #include <stdlib.h> int top, S[1000]; void init_stack() { top = -1; } void push(int v) { S[++top] = v; } int pop() { return S[top--]; } int do_op(int a, int b, char op) { int r = 0; switch (op) { case '+': r = a + b; break; case '-': r = a - b; break; case '*': r =...
[["-", 0, 2, 3, 4, 0, 16, 31, 66, 17, 48], ["+", 0, 1, 0, 2, 3, 4, 0, 2, 63, 22], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 24], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 2, 3, 4, 0, 16, 12, 103, 0, 104], ["-", 0, 2, 3, 4, 0, 16, 12, 103, 0, 125], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 25]]
0
225
8
#include <stdio.h> #include <stdlib.h> int pop(); void stack(int); int i = 0; int N[100]; int main() { int n1, n2; char s[10]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { stack(pop() + pop()); } else if (s[0] == '-') { n1 = pop(); n2 = pop(); stack(n2 - n1); } ...
#include <stdio.h> #include <stdlib.h> int pop(); void stack(int); int i = 0; int N[100]; int main() { int n1, n2; char s[10]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { stack(pop() + pop()); } else if (s[0] == '-') { n1 = pop(); n2 = pop(); stack(n2 - n1); } ...
[["-", 8, 9, 0, 37, 0, 69, 71, 27, 28, 22], ["+", 8, 9, 0, 37, 0, 69, 71, 27, 28, 22]]
0
197
2
#include <stdio.h> #include <stdlib.h> #include <string.h> void push(int); int top = 0; int S[100]; int main() { char S[100]; int top = 0; int value1, value2; while (scanf("%s", S) != EOF) { if (S[0] == '+') { value1 = pop(); value2 = pop(); push(value1 + value2); } else if (S[0] =...
#include <stdio.h> #include <stdlib.h> #include <string.h> void push(int); int top = 0; int S[1000]; int main() { char S[100]; int top = 0; int value1, value2; while (scanf("%s", S) != EOF) { if (S[0] == '+') { value1 = pop(); value2 = pop(); push(value1 + value2); } else if (S[0] ...
[["-", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["+", 36, 36, 0, 30, 0, 43, 49, 80, 81, 13], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
0
216
7
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int x) { top++; S[top] = x; } int pop() { top--; return S[top + 1]; } int main() { int catch[2], i = 0; char c[100]; top = 0; while (1) { if (scanf("%s", c) == EOF) break; if (c[0] == '+') { catch[...
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int x) { top++; S[top] = x; } int pop() { top--; return S[top + 1]; } int main() { int catch[2], i = 0; char c[100]; top = 0; while (1) { if (scanf("%s", c) == EOF) break; else { if (c[0] == '+') {...
[["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["+", 8, 9, 0, 57, 75, 76, 0, 9, 0, 45], ["-", 0, 2, 3, 4, 0, 16, 31, 69, 71, 13], ["+", 0, 2, 3, 4, 0, 16, 31, 69, 71, 13], ["-", 0, 2, 3, 4, 0, 16, 12, 69, 71, 13], ["+", 0, 2, 3, 4, 0, 16, 12, 69, 71, 13], ["+", 75, 76, 0, 57, 75, 76, 0, 9, 0, 46]]
0
253
7
#include <stdio.h> #include <stdlib.h> #include <string.h> int top; int array[1001]; // atoi 文字 から number void push(int x) { array[++top] = x; } int pop() { top--; return array[top + 1]; } int main() { int a, b; top = 0; char s[101]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = p...
#include <stdio.h> #include <stdlib.h> #include <string.h> int top; int array[1001]; // atoi 文字 から number void push(int x) { array[++top] = x; } int pop() { top--; return array[top + 1]; } int main() { int a, b; top = 0; char s[101]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = p...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
0
209
4
#include <stdio.h> #define N 100 int main() { char c; int i, stack[N]; for (i = 0; i < N; i++) { stack[i] = 0; } while ((c = getchar()) != '\n') { if (c >= '0' && c <= '9') { stack[i] = 10 * stack[i] + (c - '0'); } if (c == ' ') i++; if (c == '+') { i--; stack[...
#include <stdio.h> #define N 100 int main() { char c; int i, stack[N]; for (i = 0; i < N; i++) { stack[i] = 0; } i = 0; while ((c = getchar()) != '\n') { if (c >= '0' && c <= '9') { stack[i] = 10 * stack[i] + (c - '0'); } if (c == ' ') i++; if (c == '+') { i--; ...
[["+", 0, 14, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35]]
0
228
4
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int top = 0, s[100]; char str[100]; while ((scanf("%s", str)) != EOF) { if (str[0] == '+') { s[top - 2] = s[top - 2] + s[top - 1]; top--; } else if (str[0] == '-') { s[top - 2] = s[top - 2] - s[top - 1]; top--...
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int top = 0, s[100]; char str[100]; while ((scanf("%s", str)) != EOF) { if (str[0] == '+') { s[top - 2] = s[top - 2] + s[top - 1]; top--; } else if (str[0] == '-') { s[top - 2] = s[top - 2] - s[top - 1]; top--...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 48]]
0
192
2
#include <stdio.h> #include <stdlib.h> #define N 100 void push(int); int pop(void); int c[N]; int num = 0; int main() { char s[N]; int op; while (scanf("%s", s) != '\0') { switch (s[0]) { case '+': push(pop() + pop()); break; case '-': op = pop(); push(pop() - op); break...
#include <stdio.h> #include <stdlib.h> #define N 200 void push(int); int pop(void); int c[N]; int num = 0; int main() { char s[N]; int op; while (scanf("%s", s) != EOF) { switch (s[0]) { case '+': push(pop() + pop()); break; case '-': op = pop(); push(pop() - op); break;...
[["-", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["+", 36, 36, 36, 36, 0, 30, 0, 58, 51, 59], ["-", 0, 52, 15, 23, 0, 16, 12, 103, 0, 104], ["-", 0, 52, 15, 23, 0, 16, 12, 103, 0, 44], ["+", 8, 9, 0, 52, 15, 23, 0, 16, 12, 22]]
0
192
6
#include <stdio.h> void calc(char); void push(int); int pop(void); int stack[1000]; int stackUsed[1000]; main() { int i, END_OF_INPUT; char str[9]; // INITIALIZE for (i = 0; i < 100; i++) { stack[i] = 0; stackUsed[i] = 0; } while (1) { END_OF_INPUT = 0; i = 0; while (1) { sc...
#include <stdio.h> void calc(char); void push(int); int pop(void); int stack[1000]; int stackUsed[1000]; main() { int i, END_OF_INPUT; char str[9]; // INITIALIZE for (i = 0; i < 100; i++) { stack[i] = 0; stackUsed[i] = 0; } while (1) { END_OF_INPUT = 0; i = 0; while (1) { sc...
[["-", 0, 57, 15, 23, 0, 16, 31, 16, 17, 18], ["+", 0, 57, 15, 23, 0, 16, 31, 16, 17, 19]]
0
408
2
#include <stdio.h> #include <stdlib.h> #include <string.h> int pop(void); void push(int); int main() { int x, y, top, n[101]; char s[100]; top = 1; while (scanf("%s", s) != EOF) { if (s[0] == '+') { x = n[top]; y = n[top - 1]; top--; n[top] = x + y; } else if (s[0] == '-') { ...
#include <stdio.h> #include <stdlib.h> #include <string.h> int pop(void); void push(int); int main() { int x, y, top, n[101]; char s[100]; top = 0; while (scanf("%s", s) != EOF) { if (s[0] == '+') { x = n[top]; y = n[top - 1]; top--; n[top] = x + y; } else if (s[0] == '-') { ...
[["-", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["+", 0, 14, 8, 9, 0, 1, 0, 11, 12, 13], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
0
218
6
#include <deque> #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string> using namespace std; int main(int argc, char *argv[]) { ios_base::sync_with_stdio(false); cin.tie(NULL); deque<int> d; char temp_char[10]; while (scanf("%s", &temp_char) != -1) { if (temp_char[0] != '+' && te...
#include <deque> #include <iostream> #include <stdio.h> #include <stdlib.h> #include <string> using namespace std; int main(int argc, char *argv[]) { ios_base::sync_with_stdio(false); cin.tie(NULL); deque<int> d; char temp_char[10]; while (scanf("%s", &temp_char) != -1) { if (temp_char[0] != '+' && te...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 1, 0, 2, 3, 4, 0, 5, 0, 44]]
1
218
5
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <vector> #define rep(index, num) for (int index = 0; index < num; index++) #define scan(argument) cin >> argument #define prin(argument) cout << argument << endl #define kaigyo cout << endl #define eps 1e-15 typed...
#include <algorithm> #include <iostream> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <vector> #define rep(index, num) for (int index = 0; index < num; index++) #define scan(argument) cin >> argument #define prin(argument) cout << argument << endl #define kaigyo cout << endl #define eps 1e-15 typed...
[["-", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40], ["+", 0, 43, 39, 344, 3, 347, 0, 77, 39, 40]]
1
232
2
// // Created by yoshihito.hotta on 2018/06/17. // #include <iostream> #include <stdio.h> #include <stdlib.h> /* atoi */ // // Created by yoshihito.hotta on 2018/06/17. // #include <iostream> using namespace std; char a[100]; int stack[100]; int top = 0; int pop() { top--; return a[top + 1]; } void push(int d) ...
// // Created by yoshihito.hotta on 2018/06/17. // #include <iostream> #include <stdio.h> #include <stdlib.h> /* atoi */ // // Created by yoshihito.hotta on 2018/06/17. // #include <iostream> using namespace std; char a[100]; int stack[100]; int top = 0; int pop() { top--; return stack[top + 1]; } void push(int...
[["-", 0, 14, 8, 9, 0, 37, 0, 69, 28, 22], ["+", 0, 14, 8, 9, 0, 37, 0, 69, 28, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
218
6
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int x) { S[++top] = x; } int pop() { return S[top--]; } int main() { int a, b; top = 0; char s[100]; while (scanf("%s", s) != EOF) { // Ctr + D if (s[0] == '+') { a = pop(); b = pop(); push(a + b); ...
#include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int x) { S[++top] = x; } int pop() { return S[top--]; } int main() { int a, b; top = 0; char s[100]; while (scanf("%s", s) != EOF) { // Ctr + D if (s[0] == '+') { a = pop(); b = pop(); push(a + b); ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
1
204
4
#include <cstdlib> #include <iostream> #include <stack> #include <string> int main(int argc, char const *argv[]) { std::stack<int> S; int a, b, x; std::string s; while (std::cin >> s) { if (s[0] == '+') { a = S.top(); S.pop(); b = S.top(); S.pop(); S.push(a + b); } else...
#include <cstdlib> #include <iostream> #include <stack> #include <string> int main(int argc, char const *argv[]) { std::stack<int> S; int a, b, x; std::string s; while (std::cin >> s) { if (s[0] == '+') { a = S.top(); S.pop(); b = S.top(); S.pop(); S.push(a + b); } else...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
239
4
#include <stdio.h> #include <stdlib.h> #include <string.h> void add(int num[], int *pa) { *pa = (*pa) - 1; num[(*pa) - 1] += num[*pa]; num[*pa] = 0; } void minus(int num[], int *pa) { *pa = (*pa) - 1; num[(*pa) - 1] -= num[*pa]; num[*pa] = 0; } void multiply(int num[], int *pa) { *pa = (*pa) - 1; num...
#include <stdio.h> #include <stdlib.h> #include <string.h> void add(int num[], int *pa) { *pa = (*pa) - 1; num[(*pa) - 1] += num[*pa]; num[*pa] = 0; } void minus(int num[], int *pa) { *pa = (*pa) - 1; num[(*pa) - 1] -= num[*pa]; num[*pa] = 0; } void multiply(int num[], int *pa) { *pa = (*pa) - 1; num...
[["+", 0, 1, 0, 2, 3, 4, 0, 66, 17, 67]]
1
294
1
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPB(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORB(i, m, n) for (int i = m; i >= m; i--) #define ll long long #define pb push_back #define popb pop_back using namespace std; int top, S[100...
#include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define REPB(i, n) for (int i = n; i >= 0; i--) #define FOR(i, m, n) for (int i = m; i < n; i++) #define FORB(i, m, n) for (int i = m; i >= m; i--) #define ll long long #define pb push_back #define popb pop_back using namespace std; int top, S[100...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 33], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32]]
1
256
6
#include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <stack> #include <string> #include <vector> using namespace std; int main() { stack<int> s; int a, b; string str; while (cin >> str) { if (str == "+") { a = s.top(); s.pop(); b = s.top(); s.pop(); ...
#include <cmath> #include <cstdlib> #include <iomanip> #include <iostream> #include <stack> #include <string> #include <vector> using namespace std; int main() { stack<int> s; int a, b; string str; while (cin >> str) { if (str == "+") { a = s.top(); s.pop(); b = s.top(); s.pop(); ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
214
4
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <stack> #include <vector> using namespace std; int main() { stack<int> a; char b[100]; while (cin >> b) { if (b[0] == '+') { int x = a.top(); a.pop(); int y = a.top(); a.pop(); int z = x + y; ...
#include <cstdio> #include <cstdlib> #include <cstring> #include <iostream> #include <stack> #include <vector> using namespace std; int main() { stack<int> a; char b[100]; while (cin >> b) { if (b[0] == '+') { int x = a.top(); a.pop(); int y = a.top(); a.pop(); int z = x + y; ...
[["-", 64, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["-", 64, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
250
4
#include <algorithm> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> #define FOR(i, a, b) for (int i = a; i < b; i++) #define REP(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int a, b; stack<int> st; string s; while (cin >> s) { if (s == "+")...
#include <algorithm> #include <iostream> #include <queue> #include <stack> #include <string> #include <vector> #define FOR(i, a, b) for (int i = a; i < b; i++) #define REP(i, n) for (int i = 0; i < n; i++) using namespace std; int main() { int a, b; stack<int> st; string s; while (cin >> s) { if (s == "+")...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
230
4
#include "bits/stdc++.h" using namespace std; void push(int A); int pop(void); int S[1000]; int Top = 0; int main(void) { char str[100]; int a, b; Top = 0; while (scanf("%s", str) != EOF) { cin >> str; if (str[0] == '+') { a = pop(); b = pop(); push(a + b); } else if (str[0] =...
#include "bits/stdc++.h" using namespace std; void push(int A); int pop(void); int S[1000]; int Top = 0; int main(void) { char str[100]; int a, b; Top = 0; while (scanf("%s", str) != EOF) { if (str[0] == '+') { a = pop(); b = pop(); push(a + b); } else if (str[0] == '-') { b...
[["-", 0, 52, 8, 9, 0, 1, 0, 16, 31, 22], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 17, 152], ["-", 0, 52, 8, 9, 0, 1, 0, 16, 12, 22], ["-", 8, 9, 0, 52, 8, 9, 0, 1, 0, 35]]
1
231
4
#include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { string s; stack<int> St; int l, r; while (cin >> s) { switch (s[0]) { case '+': l = St.top(); St.pop(); r = St.top(); St.pop(); St.push(l + r); break; cas...
#include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { string s; stack<int> St; int l, r; while (cin >> s) { switch (s[0]) { case '+': l = St.top(); St.pop(); r = St.top(); St.pop(); St.push(l + r); break; cas...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
212
41
// Reverse Polish Notation // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_A&lang=jp // 所要時間 20分 {中央}×{中央} // Stack #include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { string word; stack<int> S; while (cin >> word) { if (word == "*...
// Reverse Polish Notation // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_A&lang=jp // 所要時間 20分 {中央}×{中央} // Stack #include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { string word; stack<int> S; while (cin >> word) { if (word == "*...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 110], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
211
4
#include <cstdlib> #include <iostream> using namespace std; int top, S[1000]; void push(int x); int pop(); int main() { int a, b; top = 0; char s[100]; int t = 0; while (cin >> s) { if (s[0] == '+') { a = pop(); b = pop(); push(a + b); } else if (s[0] == '-') { a = pop(); ...
#include <cstdlib> #include <iostream> using namespace std; int top, S[1000]; void push(int x); int pop(); int main() { int a, b; top = 0; char s[100]; int t = 0; while (cin >> s) { if (s[0] == '+') { a = pop(); b = pop(); push(a + b); } else if (s[0] == '-') { b = pop(); ...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
1
215
4
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } typedef long long int ll; #define EPS (1e-7) #define INF ...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } typedef long long int ll; #define EPS (1e-7) #define INF ...
[["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
1
334
6
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string> //#include <bits/stdc++.h>で全部入る。 using namespace std; template <class T> class Stack { //メンバ関数 public: struct Node { Node *prev; //前のノードへのポインタ Node *next; //後のノードへのポインタ T value; //このノードに格納されているデータ }; private: Node *to...
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string> //#include <bits/stdc++.h>で全部入る。 using namespace std; template <class T> class Stack { //メンバ関数 public: struct Node { Node *prev; //前のノードへのポインタ Node *next; //後のノードへのポインタ T value; //このノードに格納されているデータ }; private: Node *to...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48]]
1
567
12
#include <algorithm> #include <iostream> #include <stack> #include <string> #include <vector> using namespace std; int main() { stack<int> st; vector<string> vec; string s; while (cin >> s) { vec.push_back(s); } for (int i = 0; i < (int)vec.size(); i++) { if (vec[i] == "+") { int a = st.t...
#include <algorithm> #include <iostream> #include <stack> #include <string> #include <vector> using namespace std; int main() { stack<int> st; vector<string> vec; string s; while (cin >> s) { vec.push_back(s); } for (int i = 0; i < (int)vec.size(); i++) { if (vec[i] == "+") { int a = st.t...
[["-", 64, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["-", 64, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
285
4
#include <iostream> #include <stack> #include <string> using namespace std; int main() { string str; stack<int> S; while (cin >> str) { if (str[0] == '+') { int a = S.top(); S.pop(); int b = S.top(); S.pop(); S.push(a + b); } else if (str[0] == '-') { int a = S.top()...
#include <iostream> #include <stack> #include <string> using namespace std; int main() { string str; stack<int> S; while (cin >> str) { if (str[0] == '+') { int a = S.top(); S.pop(); int b = S.top(); S.pop(); S.push(a + b); } else if (str[0] == '-') { int b = S.top()...
[["-", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 57, 64, 9, 0, 43, 49, 50, 49, 22]]
1
222
4
#include <iostream> #include <sstream> #include <stack> #include <string> using namespace std; int main() { string t; int tmp, ans = 0, t1, t2; stack<int> sta; while (cin >> t) { if (t[0] == '-' || t[0] == '+' || t[0] == '*') { t2 = sta.top(); sta.pop(); t1 = sta.top(); sta.top(); ...
#include <iostream> #include <sstream> #include <stack> #include <string> using namespace std; int main() { string t; int tmp, ans = 0, t1, t2; stack<int> sta; while (cin >> t) { if (t[0] == '-' || t[0] == '+' || t[0] == '*') { t2 = sta.top(); sta.pop(); t1 = sta.top(); sta.pop();...
[["-", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120], ["+", 64, 9, 0, 1, 0, 2, 63, 118, 119, 120]]
1
204
2
#include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { string word; stack<int> S; int a, b; while (cin >> word) { if (word == "+") { a = S.top(); S.pop(); b = S.top(); S.pop(); S.push(a + b); } else if (word == "-") { ...
#include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { string word; stack<int> S; int a, b; while (cin >> word) { if (word == "+") { a = S.top(); S.pop(); b = S.top(); S.pop(); S.push(a + b); } else if (word == "-") { ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
210
4
#include <cstdlib> #include <iostream> #include <stack> #include <string> #include <vector> using namespace std; int main() { stack<int> s; string word; while (cin >> word) { if (word == "+") { int x1 = s.top(); s.pop(); int x2 = s.top(); s.pop(); s.push(x1 + x2); } else if ...
#include <cstdlib> #include <iostream> #include <stack> #include <string> #include <vector> using namespace std; int main() { stack<int> s; string word; while (cin >> word) { if (word == "+") { int x1 = s.top(); s.pop(); int x2 = s.top(); s.pop(); s.push(x1 + x2); } else if ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
213
4
#include <cstdlib> #include <iostream> #include <queue> #include <stack> using namespace std; int main() { string word; stack<int> s; while (cin >> word) { if (word == "+") { int x = s.top(); s.pop(); int y = s.top(); s.pop(); int z = x + y; s.push(z); } else if (word =...
#include <cstdlib> #include <iostream> #include <queue> #include <stack> using namespace std; int main() { string word; stack<int> s; while (cin >> word) { if (word == "+") { int x = s.top(); s.pop(); int y = s.top(); s.pop(); int z = x + y; s.push(z); } else if (word =...
[["-", 64, 9, 0, 43, 49, 50, 51, 16, 31, 22], ["-", 64, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 17, 33], ["+", 64, 9, 0, 43, 49, 50, 51, 16, 12, 22]]
1
236
4
#include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { string word; stack<int> S; while (cin >> word) { int a, b; if (word == "+") { a = S.top(); S.pop(); b = S.top(); S.pop(); S.push(a + b); } if (word == "-") { ...
#include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { string word; stack<int> S; while (cin >> word) { int a, b; if (word == "+") { a = S.top(); S.pop(); b = S.top(); S.pop(); S.push(a + b); // cout << "+" << a+b; ...
[["+", 0, 52, 8, 9, 0, 57, 75, 76, 0, 95], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22], ["+", 0, 57, 75, 76, 0, 57, 75, 76, 0, 95]]
1
211
6
#include <cstdio> #include <cstdlib> #include <iostream> #include <sstream> #include <stack> using namespace std; int main() { string str; stack<int> st; getline(cin, str); stringstream ss(str); while (ss >> str) { if (isdigit(str[0])) { int x = atoi(str.c_str()); st.push(x); } else { ...
#include <cstdio> #include <cstdlib> #include <iostream> #include <sstream> #include <stack> using namespace std; int main() { string str; stack<int> st; getline(cin, str); stringstream ss(str); while (ss >> str) { if (isdigit(str[0])) { int x = atoi(str.c_str()); st.push(x); } else { ...
[["-", 75, 76, 0, 9, 0, 43, 49, 50, 49, 22], ["+", 75, 76, 0, 9, 0, 43, 49, 50, 49, 22]]
1
184
4
input = gets.split p input stack = [] input.each do |inp| if ["+", "-", "*"].include?(inp) val1 = stack.pop.to_i val2 = stack.pop.to_i val3 = val2.send(inp, val1) stack.push(val3) else stack.push(inp.to_i) end end puts stack.pop
input = gets.split stack = [] input.each do |inp| if ["+", "-", "*"].include?(inp) val1 = stack.pop.to_i val2 = stack.pop.to_i val3 = val2.send(inp, val1) stack.push(val3) else stack.push(inp.to_i) end end puts stack.pop
[["-", 36, 36, 36, 36, 0, 493, 0, 652, 735, 22], ["-", 36, 36, 0, 493, 0, 652, 3, 4, 0, 22]]
4
82
2
elements = gets.chomp.split(" ") stack = [] elements.each do |e| case e when "+" a, b = stack.shift(2) stack.unshift(a + b) when "*" a, b = stack.shift(2) stack.unshift(a * b) when "-" a, b = stack.shift(2) stack.unshift(a - b) else stack.push(e.to_i) end en...
elements = gets.chomp.split(" ") stack = [] elements.each do |e| case e when "+" a, b = stack.pop(2) stack.push(a + b) when "*" a, b = stack.pop(2) stack.push(a * b) when "-" a, b = stack.pop(2) stack.push(a - b) else stack.push(e.to_i) end end puts stack
[["-", 0, 763, 8, 749, 0, 662, 12, 652, 735, 22], ["+", 0, 763, 8, 749, 0, 662, 12, 652, 735, 22], ["-", 0, 173, 0, 763, 8, 749, 0, 652, 735, 22], ["+", 0, 173, 0, 763, 8, 749, 0, 652, 735, 22]]
4
104
12
MODE = "stdio" #require 'matrix' #include Math line = Array.new if(defined? MODE) line = STDIN.read.split("\n") else tmp = '1 2 +'.split("\n") tmp.each{|s| line << s.strip } end arr = line[0].split(" ") stack = [] arr.each do |i| case i when "+" stack.push(stack.pop+stack.pop) when "-" sta...
MODE = "stdio" #require 'matrix' #include Math line = Array.new if(defined? MODE) line = STDIN.read.split("\n") else tmp = '1 1 +'.split("\n") tmp.each{|s| line << s.strip } end arr = line[0].split(" ") stack = [] arr.each do |i| case i when "+" stack.push(stack.pop+stack.pop) when "-" stac...
[["-", 75, 95, 0, 662, 12, 652, 486, 557, 0, 6], ["+", 75, 95, 0, 662, 12, 652, 486, 557, 0, 6], ["+", 0, 652, 3, 4, 0, 738, 31, 748, 17, 33], ["-", 8, 749, 0, 652, 3, 4, 0, 738, 17, 33], ["+", 8, 749, 0, 652, 3, 4, 0, 738, 17, 72]]
4
145
5
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int x) { S[++top] = x; } int pop() { top--; return S[top + 1]; } int main() { int a, b; top = 0; char s[100]; while (scanf("%s,s") != EOF) { if (s[0] == '+') { a = pop(); ...
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> int top, S[1000]; void push(int x) { S[++top] = x; } int pop() { top--; return S[top + 1]; } int main() { int a, b; top = 0; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { a = pop(); ...
[["-", 51, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 51, 16, 31, 2, 3, 4, 0, 5, 0, 6], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 21], ["+", 15, 339, 51, 16, 31, 2, 3, 4, 0, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 30, 0, 14, 8, 9, 0, 1, 0, 35], ["+", 0, 30, 0, 14, 8, 9, 0...
1
204
11
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <set> #include <sstream> #include <s...
#include <algorithm> #include <bitset> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <set> #include <sstream> #include <s...
[["-", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22], ["+", 0, 14, 8, 9, 0, 43, 49, 50, 49, 22]]
1
721
4
#include <iostream> #include <string> using namespace std; int top, Stack[1000]; void push(int x) { top++; Stack[top] = x; } int pop() { top--; return Stack[top + 1]; } int main() { int a, b; top = 0; string s; while (cin >> s) { if (s == "+") { a = pop(); b = pop(); push(a +...
#include <iostream> #include <string> using namespace std; int top, Stack[1000]; void push(int x) { top++; Stack[top] = x; } int pop() { top--; return Stack[top + 1]; } int main() { int a, b; top = 0; string s; while (cin >> s) { if (s == "+") { a = pop(); b = pop(); push(a +...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22]]
1
185
4
#include <algorithm> #include <cstdlib> #include <iostream> #include <stack> #include <string> #include <utility> using namespace std; int a, b; int main() { string word; stack<int> S; while (cin >> word) { if (word == "+") { int sum; a = S.top(); S.pop(); b = S.top(); S.pop(...
#include <algorithm> #include <cstdlib> #include <iostream> #include <stack> #include <string> #include <utility> using namespace std; int a, b; int main() { string word; stack<int> S; while (cin >> word) { if (word == "+") { int sum; a = S.top(); S.pop(); b = S.top(); S.pop(...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
250
4
#include <cstdlib> #include <iostream> using namespace std; int top, S[1000]; void push(int x) { top++; S[top] = x; } int pop() { top--; return S[top + 1]; } int main() { int a, b; top = 0; char s[100]; while (cin >> s) { if (s[0] == '+') { a = pop(); b = pop(); push(a + b); ...
#include <cstdlib> #include <iostream> using namespace std; int top, S[1000]; void push(int x) { top++; S[top] = x; } int pop() { top--; return S[top + 1]; } int main() { int a, b; top = 0; char s[100]; while (cin >> s) { if (s[0] == '+') { a = pop(); b = pop(); push(a + b); ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
200
4
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <set> #include <sstream> #include <string> #include ...
#define _CRT_SECURE_NO_WARNINGS #include <algorithm> #include <cmath> #include <cstdio> #include <cstring> #include <deque> #include <forward_list> #include <functional> #include <iostream> #include <limits> #include <list> #include <map> #include <numeric> #include <set> #include <sstream> #include <string> #include ...
[["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22], ["-", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 21], ["+", 0, 2, 3, 4, 0, 2, 3, 4, 0, 22]]
1
219
4
#include <cstdio> #include <cstdlib> #include <iostream> #include <stack> #include <string> #define REP(i, n) for (int(i) = 0; i < (n); i++) using namespace std; int main() { stack<int> is; int a, b, x; string s; while (cin >> s) { if (s[0] == '+') { a = is.top(); is.pop(); b = is.top()...
#include <cstdio> #include <cstdlib> #include <iostream> #include <stack> #include <string> #define REP(i, n) for (int(i) = 0; i < (n); i++) using namespace std; int main() { stack<int> is; int a, b, x; string s; while (cin >> s) { if (s[0] == '+') { a = is.top(); is.pop(); b = is.top()...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
238
4
#include <iostream> #include <stack> #include <string> using namespace std; int main() { stack<string> st; string str; while (cin >> str) { if (str == "+") { int a = stoi(st.top()); st.pop(); int b = stoi(st.top()); st.pop(); st.push(to_string(a + b)); } else if (str == "...
#include <iostream> #include <stack> #include <string> using namespace std; int main() { stack<string> st; string str; while (cin >> str) { if (str == "+") { int a = stoi(st.top()); st.pop(); int b = stoi(st.top()); st.pop(); st.push(to_string(a + b)); } else if (str == "...
[["-", 3, 4, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 3, 4, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 3, 4, 0, 2, 3, 4, 0, 16, 12, 22]]
1
288
4
#include <iostream> #include <stack> #include <string> int eval(std::stack<std::string> &stc) { int a, b; if (stc.top() == "+") { stc.pop(); a = std::stoi(stc.top()); stc.pop(); b = std::stoi(stc.top()); stc.pop(); return a + b; } else if (stc.top() == "-") { stc.pop(); a = std::s...
#include <iostream> #include <stack> #include <string> int eval(std::stack<std::string> &stc) { int a, b; if (stc.top() == "+") { stc.pop(); a = std::stoi(stc.top()); stc.pop(); b = std::stoi(stc.top()); stc.pop(); return a + b; } else if (stc.top() == "-") { stc.pop(); a = std::s...
[["-", 0, 57, 64, 9, 0, 37, 0, 16, 31, 22], ["-", 0, 57, 64, 9, 0, 37, 0, 16, 17, 33], ["+", 0, 57, 64, 9, 0, 37, 0, 16, 17, 33], ["+", 0, 57, 64, 9, 0, 37, 0, 16, 12, 22]]
1
349
4
#include <bits/stdc++.h> #define SIZE 100005 using namespace std; typedef long long ll; typedef pair<int, int> P; struct Stack { ll table[1000]; ll top; void init() { top = 0; } bool empty() { return top == 0; } void push(ll x) { table[top] = x; top++; } ll pop() { if (empty()) return 0...
#include <bits/stdc++.h> #define SIZE 100005 using namespace std; typedef long long ll; typedef pair<int, int> P; struct Stack { ll table[1000]; ll top; void init() { top = 0; } bool empty() { return top == 0; } void push(ll x) { table[top] = x; top++; } ll pop() { if (empty()) return 0...
[["-", 15, 339, 51, 16, 12, 16, 12, 5, 0, 6], ["+", 15, 339, 51, 16, 12, 16, 12, 5, 0, 6]]
1
301
2
#include <cstdlib> #include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; int main() { int st[150]; int si = 0; string t; int x, y; while (cin >> t) { if (t == "+") { si--; x = st[si]; ...
#include <cstdlib> #include <iomanip> #include <iostream> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string> #include <vector> using namespace std; int main() { int st[150]; int si = 0; string t; int x, y; while (cin >> t) { if (t == "+") { si--; x = st[si]; ...
[["-", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22], ["-", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 17, 33], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 12, 22]]
1
222
4
#include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { stack<int> s; string x; int a, b; while (cin >> x) { if (x[0] == '+') { a = s.top(); s.pop(); b = s.top(); s.pop(); s.push(a + b); ...
#include <cmath> #include <cstdio> #include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { stack<int> s; string x; int a, b; while (cin >> x) { if (x[0] == '+') { a = s.top(); s.pop(); b = s.top(); s.pop(); s.push(a + b); ...
[["+", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46], ["-", 0, 14, 8, 9, 0, 52, 8, 9, 0, 46]]
1
226
2
#include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; stack<int> s; /* <stack>で使うもの empty() → コンテナが空かどうかチェック pop()  → 要素を末尾から削除 push()  → 要素を末尾に追加 top()  → 末尾の要素を取得 size()  → 要素数を取得 */ int calc(string str) { int x = s.top(); s.pop(); int y = s.top(); s.pop(); swi...
#include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; stack<int> s; /* <stack>で使うもの empty() → コンテナが空かどうかチェック pop()  → 要素を末尾から削除 push()  → 要素を末尾に追加 top()  → 末尾の要素を取得 size()  → 要素数を取得 */ int calc(string str) { int x = s.top(); s.pop(); int y = s.top(); s.pop(); swi...
[["-", 8, 9, 0, 100, 0, 37, 0, 16, 31, 22], ["-", 8, 9, 0, 100, 0, 37, 0, 16, 17, 33], ["+", 8, 9, 0, 100, 0, 37, 0, 16, 17, 33], ["+", 8, 9, 0, 100, 0, 37, 0, 16, 12, 22]]
1
197
4
#include <bits/stdc++.h> #define FOR(i, a, b) for (long long int i = (a); i <= (b); i++) #define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--) #define MOD 1000000007 #define INF 1000000000 // 2000000000 #define LLINF 1000000000000000000 // 9000000000000000000 #define PI 3.14159265358979 using na...
#include <bits/stdc++.h> #define FOR(i, a, b) for (long long int i = (a); i <= (b); i++) #define RFOR(i, a, b) for (long long int i = (a); i >= (b); i--) #define MOD 1000000007 #define INF 1000000000 // 2000000000 #define LLINF 1000000000000000000 // 9000000000000000000 #define PI 3.14159265358979 using na...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 72], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 48]]
1
258
2
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, 1, 0, -1}; #define INF 99999999 typedef std::pair<int, int> pii;...
#include <algorithm> #include <array> #include <cmath> #include <complex> #include <iostream> #include <map> #include <queue> #include <set> #include <stack> #include <string> #include <utility> #include <vector> int dx[4] = {-1, 0, 1, 0}; int dy[4] = {0, 1, 0, -1}; #define INF 99999999 typedef std::pair<int, int> pii;...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
240
4
/* * ALDS1_3_A.cpp * * Created on: Apr 25, 2018 * Author: 13743 */ #include <cstdio> #include <cstdlib> #include <stack> using namespace std; int main() { stack<int> st; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { int a = st.top(); st.pop(); int b = st.top()...
/* * ALDS1_3_A.cpp * * Created on: Apr 25, 2018 * Author: 13743 */ #include <cstdio> #include <cstdlib> #include <stack> using namespace std; int main() { stack<int> st; char s[100]; while (scanf("%s", s) != EOF) { if (s[0] == '+') { int a = st.top(); st.pop(); int b = st.top()...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
229
4
#include <iostream> #include <stack> #include <string> using namespace std; int main() { stack<int> st; int r, l, k, num; string str; while (cin >> str) { if ('0' <= str[0] && str[0] <= '9') { k = 1, num = 0; for (int i = str.size() - 1; i >= 0; --i) { num += k * str[i] - '0'; k ...
#include <iostream> #include <stack> #include <string> using namespace std; int main() { stack<int> st; int r, l, k, num; string str; while (cin >> str) { if ('0' <= str[0] && str[0] <= '9') { k = 1, num = 0; for (int i = str.size() - 1; i >= 0; --i) { num += k * (str[i] - '0'); ...
[["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 24], ["+", 0, 1, 0, 11, 12, 16, 12, 23, 0, 25]]
1
224
2
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <unordered_map> #include <vector> using namespace std; //--------------------...
#include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <unordered_map> #include <vector> using namespace std; //--------------------...
[["-", 0, 57, 64, 9, 0, 1, 0, 11, 31, 22], ["-", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32], ["+", 64, 9, 0, 1, 0, 11, 12, 16, 31, 22]]
1
853
4
#include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { stack<int> st; string str; int a, b; while (getline(cin, str)) { if (str == "+") { a = st.top(); st.pop(); b = st.top(); st.pop(); st.push(a + b); } else if (str ==...
#include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { stack<int> st; string str; int a, b; while (cin >> str) { if (str == "+") { a = st.top(); st.pop(); b = st.top(); st.pop(); st.push(a + b); } else if (str == "-") {...
[["-", 8, 9, 0, 52, 15, 339, 51, 2, 63, 22], ["-", 0, 52, 15, 339, 51, 2, 3, 4, 0, 24], ["-", 0, 52, 15, 339, 51, 2, 3, 4, 0, 21], ["+", 8, 9, 0, 52, 15, 339, 51, 16, 17, 152], ["-", 0, 52, 15, 339, 51, 2, 3, 4, 0, 25]]
1
216
22
#include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { stack<int> st; string str; int a, b; while (cin >> str) { if (str == "+") { a = st.top(); st.pop(); b = st.top(); st.pop(); st.push(a + b); } else if (str == "-") { ...
#include <cstdlib> #include <iostream> #include <stack> #include <string> using namespace std; int main() { stack<int> st; string str; int a, b; while (cin >> str) { if (str == "+") { a = st.top(); st.pop(); b = st.top(); st.pop(); st.push(a + b); } else if (str == "-") { ...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
213
4
#include <algorithm> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) using namespace std; typedef long long ll; const int MAXN = 200; int top = 0; int S[MAXN]; void initialize() { top = 0; } bool isE...
#include <algorithm> #include <iostream> #include <string> #include <vector> #define rep(i, n) for (int(i) = 0; (i) < (n); (i)++) #define rep1(i, n) for (int i = 1; i <= (int)(n); i++) using namespace std; typedef long long ll; const int MAXN = 200; int top = 0; int S[MAXN]; void initialize() { top = 0; } bool isE...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
263
4
#include <algorithm> #include <cstdlib> #include <iostream> #include <math.h> #include <stack> #include <stdio.h> #include <string> using namespace std; int main() { string s; stack<int> a; while (cin >> s) { if (s == "+" || s == "-" || s == "*") { int b, c; b = a.top(); a.pop(); c =...
#include <algorithm> #include <cstdlib> #include <iostream> #include <math.h> #include <stack> #include <stdio.h> #include <string> using namespace std; int main() { string s; stack<int> a; while (cin >> s) { if (s == "+" || s == "-" || s == "*") { int b, c; b = a.top(); a.pop(); c =...
[["-", 64, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 64, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 64, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
177
4
#include <cstdlib> #include <iostream> #include <sstream> #include <stack> using namespace std; int main() { int a, b; stack<int> st; string s; getline(cin, s); stringstream ss; ss << s; while (ss >> s) { // 1 2 - if (s == "+") { a = st.top(); st.pop(); b = st.top(); st.pop();...
#include <cstdlib> #include <iostream> #include <sstream> #include <stack> using namespace std; int main() { int a, b; stack<int> st; string s; getline(cin, s); stringstream ss; ss << s; while (ss >> s) { // 1 2 - if (s == "+") { a = st.top(); st.pop(); b = st.top(); st.pop();...
[["-", 0, 57, 64, 9, 0, 1, 0, 16, 17, 33], ["+", 0, 57, 64, 9, 0, 1, 0, 11, 17, 32]]
1
232
2
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <set> #include <stack> #include <string> #include <vector> #define _USE_MATH_DEFINES using namespace std; typedef long long ll; double pi = 3.141592653589793; ll mod = 1000000007; int main() { stack<int> st; string word; while (ci...
#include <algorithm> #include <iostream> #include <map> #include <math.h> #include <set> #include <stack> #include <string> #include <vector> #define _USE_MATH_DEFINES using namespace std; typedef long long ll; double pi = 3.141592653589793; ll mod = 1000000007; int main() { stack<int> st; string word; while (ci...
[["-", 0, 1, 0, 2, 3, 4, 0, 16, 31, 22], ["-", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 17, 33], ["+", 0, 1, 0, 2, 3, 4, 0, 16, 12, 22]]
1
242
4
#define pb push_back #define vi vector<int> #include <bits/stdc++.h> using namespace std; const int N = 300000; int pro[300000], n; string v1[N], v2[N], v3[N]; map<int, vector<char>> mp1, mp2, mp3; int cv(string s) { int val = 0, i = 0, sign = 1; if (s[0] == '-') sign = -1, i++; for (; i < s.size(); i++) { ...
#define pb push_back #define vi vector<int> #include <bits/stdc++.h> using namespace std; const int N = 300000; int pro[300000], n; string v1[N], v2[N], v3[N]; map<int, vector<char>> mp1, mp2, mp3; int cv(string s) { int val = 0, i = 0, sign = 1; if (s[0] == '-') sign = -1, i++; for (; i < s.size(); i++) { ...
[["+", 0, 7, 8, 9, 0, 1, 0, 11, 31, 22], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 17, 32], ["+", 0, 7, 8, 9, 0, 1, 0, 11, 12, 22], ["+", 8, 9, 0, 7, 8, 9, 0, 1, 0, 35]]
1
425
4