#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int from, to;
  scanf("%d %d", &from, &to);
  if (from == to) {
    printf("0\n");
  } else if (from < to) {
    int dif1 = to - from;
    int dif2 = (360 - to) + from;
    if (dif1 <= dif2) {
      printf("%d\n", dif1);
    } else {
      printf("%d\n", -dif2);
    }
  } else {
    int dif1 = from - to;
    int dif2 = (360 - from) + to;
    if (dif1 < dif2) {
      printf("%d\n", -dif1);
    } else {
      printf("%d\n", dif2);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1162 <main+0x42>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1215 <main+0xf5>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bf <main+0x9f>
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x168,%eax
sub    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11a7 <main+0x87>
mov    -0x10(%rbp),%esi
lea    0xe6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ba <main+0x9a>
xor    %esi,%esi
sub    -0x14(%rbp),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1210 <main+0xf0>
mov    -0x8(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x168,%eax
sub    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11fa <main+0xda>
xor    %esi,%esi
sub    -0x18(%rbp),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    120b <main+0xeb>
mov    -0x1c(%rbp),%esi
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1210 <main+0xf0>
jmp    1215 <main+0xf5>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%ecx
mov    (%rsp),%eax
mov    %ecx,%esi
sub    %eax,%esi
jne    1160 <main+0x30>
lea    0xeb1(%rip),%rdi
call   1030 <puts@plt>
jmp    1194 <main+0x64>
jge    1179 <main+0x49>
sub    %ecx,%eax
add    $0x168,%esi
cmp    %esi,%eax
jle    1184 <main+0x54>
neg    %esi
lea    0xe8f(%rip),%rdi
jmp    118d <main+0x5d>
sub    %ecx,%eax
add    $0x168,%eax
cmp    %eax,%esi
jl     116e <main+0x3e>
lea    0xe7b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [3 x i8] c"0\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %57
14: ; preds = %0
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %37
18: ; preds = %14
%19 = load i32, i32* %3
%20 = load i32, i32* %2
%21 = sub nsw i32 %19, %20
store i32 %21, i32* %4
%22 = load i32, i32* %3
%23 = sub nsw i32 360, %22
%24 = load i32, i32* %2
%25 = add nsw i32 %23, %24
store i32 %25, i32* %5
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = icmp sle i32 %26, %27
br i1 %28, label %29, label %32
29: ; preds = %18
%30 = load i32, i32* %4
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %30)
br label %36
32: ; preds = %18
%33 = load i32, i32* %5
%34 = sub nsw i32 0, %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %34)
br label %36
36: ; preds = %32, %29
br label %56
37: ; preds = %14
%38 = load i32, i32* %2
%39 = load i32, i32* %3
%40 = sub nsw i32 %38, %39
store i32 %40, i32* %6
%41 = load i32, i32* %2
%42 = sub nsw i32 360, %41
%43 = load i32, i32* %3
%44 = add nsw i32 %42, %43
store i32 %44, i32* %7
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %52
48: ; preds = %37
%49 = load i32, i32* %6
%50 = sub nsw i32 0, %49
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %50)
br label %55
52: ; preds = %37
%53 = load i32, i32* %7
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %53)
br label %55
55: ; preds = %52, %48
br label %56
56: ; preds = %55, %36
br label %57
57: ; preds = %56, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [2 x i8] c"0\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = icmp eq i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %33
11: ; preds = %0
%12 = icmp slt i32 %6, %7
br i1 %12, label %13, label %23
13: ; preds = %11
%14 = sub nsw i32 %7, %6
%15 = sub nsw i32 360, %7
%16 = add nsw i32 %15, %6
%17 = icmp sgt i32 %14, %16
br i1 %17, label %20, label %18
18: ; preds = %13
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %14)
br label %33
20: ; preds = %13
%21 = sub nsw i32 0, %16
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %21)
br label %33
23: ; preds = %11
%24 = sub nsw i32 %6, %7
%25 = sub nsw i32 360, %6
%26 = add nsw i32 %25, %7
%27 = icmp slt i32 %24, %26
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = sub nsw i32 0, %24
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %29)
br label %33
31: ; preds = %23
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %26)
br label %33
33: ; preds = %28, %31, %18, %20, %9
ret i32 0
}