fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3. main()
  4. {int N, a, b, S, d, x=100000, y=100000;
  5. for (i=1; i<7, i++)
  6. {scanf("%d%d", &a, &b);
  7. if (a>b)
  8. S=S+a
  9. d=a-b
  10. else
  11. {S=S+b;
  12. d=b-a;}
  13. if (abs(a-b)%3==1 && d<x) x=d;
  14. if (abs(a-b)%3==2 && d<y) y=d;}
  15. if (S%3!=0) print S("%d", S);
  16. else
  17. {if (x=100000 && y=100000)
  18. prints ("0");
  19. else {if (x<y) S=S-x
  20. else S=S-y
  21. prints ("%d", S); }}}
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
1 3
5 12
6 9
5 4
33
1 1
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:5:6: error: ‘i’ was not declared in this scope
 for (i=1; i<7, i++)
      ^
prog.cpp:5:19: error: expected ‘;’ before ‘)’ token
 for (i=1; i<7, i++)
                   ^
prog.cpp:9:1: error: expected ‘;’ before ‘d’
 d=a-b
 ^
prog.cpp:13:13: error: invalid operands of types ‘__gnu_cxx::__enable_if<true, double>::__type {aka double}’ and ‘int’ to binary ‘operator%’
 if (abs(a-b)%3==1 && d<x) x=d;
     ~~~~~~~~^~
prog.cpp:14:13: error: invalid operands of types ‘__gnu_cxx::__enable_if<true, double>::__type {aka double}’ and ‘int’ to binary ‘operator%’
 if (abs(a-b)%3==2 && d<y) y=d;}
     ~~~~~~~~^~
prog.cpp:15:13: error: ‘print’ was not declared in this scope
 if (S%3!=0) print S("%d", S);
             ^~~~~
prog.cpp:17:20: error: lvalue required as left operand of assignment
 {if (x=100000 && y=100000)
                    ^~~~~~
prog.cpp:18:12: error: ‘prints’ was not declared in this scope
 prints ("0");
            ^
prog.cpp:20:1: error: expected ‘;’ before ‘else’
 else S=S-y
 ^~~~
stdout
Standard output is empty