#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);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int t;
  int time[22];
  time[0] = 0;
  time[1] = 106;
  time[2] = 211;
  time[3] = 317;
  time[4] = 422;
  time[5] = 528;
  time[6] = 633;
  time[7] = 738;
  time[8] = 844;
  time[9] = 949;
  time[10] = 1055;
  int i;
  for (i = 11; i < 22; i++)
    time[i] = time[i - 11] + 1200;
  scanf("%d", &t);
  int starth, startm, endh, endm;
  int startt, endt;
  while (t--) {
    int count = 0;
    scanf("%d:%d", &starth, &startm);
    scanf("%d:%d", &endh, &endm);
    startt = starth * 100 + startm;
    endt = endh * 100 + endm;
    for (i = 0; i < 22; i++) {
      if (time[i] > startt && time[i] <= endt)
        count++;
    }
    printf("%d\n", count);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x60(%rbp)
movl   $0x6a,-0x5c(%rbp)
movl   $0xd3,-0x58(%rbp)
movl   $0x13d,-0x54(%rbp)
movl   $0x1a6,-0x50(%rbp)
movl   $0x210,-0x4c(%rbp)
movl   $0x279,-0x48(%rbp)
movl   $0x2e2,-0x44(%rbp)
movl   $0x34c,-0x40(%rbp)
movl   $0x3b5,-0x3c(%rbp)
movl   $0x41f,-0x38(%rbp)
movl   $0xb,-0x64(%rbp)
cmpl   $0x16,-0x64(%rbp)
jge    11b8 <main+0x98>
mov    -0x64(%rbp),%eax
sub    $0xb,%eax
cltq
mov    -0x60(%rbp,%rax,4),%ecx
add    $0x4b0,%ecx
movslq -0x64(%rbp),%rax
mov    %ecx,-0x60(%rbp,%rax,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1186 <main+0x66>
lea    0xe44(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1288 <main+0x168>
movl   $0x0,-0x80(%rbp)
lea    0xe14(%rip),%rdi
lea    -0x68(%rbp),%rsi
lea    -0x6c(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xdfe(%rip),%rdi
lea    -0x70(%rbp),%rsi
lea    -0x74(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
imul   $0x64,-0x68(%rbp),%eax
add    -0x6c(%rbp),%eax
mov    %eax,-0x78(%rbp)
imul   $0x64,-0x70(%rbp),%eax
add    -0x74(%rbp),%eax
mov    %eax,-0x7c(%rbp)
movl   $0x0,-0x64(%rbp)
cmpl   $0x16,-0x64(%rbp)
jge    1274 <main+0x154>
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%eax
cmp    -0x78(%rbp),%eax
jle    1261 <main+0x141>
movslq -0x64(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%eax
cmp    -0x7c(%rbp),%eax
jg     1261 <main+0x141>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1266 <main+0x146>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    122c <main+0x10c>
mov    -0x80(%rbp),%esi
lea    0xd88(%rip),%rdi
call   1030 <printf@plt>
jmp    11ca <main+0xaa>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
movaps 0xec8(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xed0(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movdqa 0xed7(%rip),%xmm0
movdqa %xmm0,0x60(%rsp)
movabs $0x8cf00000865,%rax
mov    %rax,0x70(%rsp)
lea    0xece(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0xc(%rsp)
jb     132f <main+0x20f>
movaps 0x20(%rsp),%xmm0
movaps %xmm0,0xc0(%rsp)
movaps 0x30(%rsp),%xmm0
movaps %xmm0,0xb0(%rsp)
movaps 0x40(%rsp),%xmm0
movaps %xmm0,0xa0(%rsp)
movaps 0x50(%rsp),%xmm0
movaps %xmm0,0x90(%rsp)
movdqa 0x60(%rsp),%xmm0
movdqa %xmm0,0x80(%rsp)
mov    0x70(%rsp),%r14d
mov    0x74(%rsp),%r15d
lea    0xe60(%rip),%r12
lea    0x10(%rsp),%r13
lea    0xe5a(%rip),%rbp
nopl   0x0(%rax)
mov    %r12,%rdi
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r12,%rdi
lea    0x14(%rsp),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
imul   $0x64,0x1c(%rsp),%eax
add    0x18(%rsp),%eax
imul   $0x64,0x14(%rsp),%ecx
add    0x10(%rsp),%ecx
movd   %eax,%xmm0
pshufd $0x0,%xmm0,%xmm1
movd   %ecx,%xmm0
pshufd $0x0,%xmm0,%xmm2
movdqa 0xc0(%rsp),%xmm0
movdqa %xmm0,%xmm3
pcmpgtd %xmm1,%xmm3
pcmpgtd %xmm2,%xmm0
pandn  %xmm3,%xmm0
psrld  $0x1f,%xmm0
movdqa 0xb0(%rsp),%xmm4
movdqa %xmm4,%xmm3
pcmpgtd %xmm1,%xmm3
pcmpgtd %xmm2,%xmm4
pandn  %xmm3,%xmm4
psubd  %xmm4,%xmm0
movdqa 0xa0(%rsp),%xmm4
movdqa %xmm4,%xmm3
pcmpgtd %xmm1,%xmm3
pcmpgtd %xmm2,%xmm4
pandn  %xmm3,%xmm4
psubd  %xmm4,%xmm0
movdqa 0x90(%rsp),%xmm4
movdqa %xmm4,%xmm3
pcmpgtd %xmm1,%xmm3
pcmpgtd %xmm2,%xmm4
pandn  %xmm3,%xmm4
psubd  %xmm4,%xmm0
movdqa 0x80(%rsp),%xmm4
movdqa %xmm4,%xmm3
pcmpgtd %xmm1,%xmm3
movdqa %xmm4,%xmm1
pcmpgtd %xmm2,%xmm1
pandn  %xmm3,%xmm1
psubd  %xmm1,%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%esi
cmp    %eax,%r14d
setg   %bl
cmp    %ecx,%r14d
setle  %dl
and    %bl,%dl
movzbl %dl,%edx
add    %esi,%edx
cmp    %eax,%r15d
setg   %al
cmp    %ecx,%r15d
setle  %cl
and    %al,%cl
movzbl %cl,%esi
add    %edx,%esi
mov    %rbp,%rdi
call   1030 <printf@plt>
subl   $0x1,0xc(%rsp)
jae    1200 <main+0xe0>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d:%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [22 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 0
store i32 0, i32* %12
%13 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 1
store i32 106, i32* %13
%14 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 2
store i32 211, i32* %14
%15 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 3
store i32 317, i32* %15
%16 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 4
store i32 422, i32* %16
%17 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 5
store i32 528, i32* %17
%18 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 6
store i32 633, i32* %18
%19 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 7
store i32 738, i32* %19
%20 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 8
store i32 844, i32* %20
%21 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 9
store i32 949, i32* %21
%22 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 10
store i32 1055, i32* %22
store i32 11, i32* %4
br label %23
23: ; preds = %36, %0
%24 = load i32, i32* %4
%25 = icmp slt i32 %24, 22
br i1 %25, label %26, label %39
26: ; preds = %23
%27 = load i32, i32* %4
%28 = sub nsw i32 %27, 11
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = add nsw i32 %31, 1200
%33 = load i32, i32* %4
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 %34
store i32 %32, i32* %35
br label %36
36: ; preds = %26
%37 = load i32, i32* %4
%38 = add nsw i32 %37, 1
store i32 %38, i32* %4
br label %23
39: ; preds = %23
%40 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %41
41: ; preds = %80, %39
%42 = load i32, i32* %2
%43 = add nsw i32 %42, -1
store i32 %43, i32* %2
%44 = icmp ne i32 %42, 0
br i1 %44, label %45, label %83
45: ; preds = %41
store i32 0, i32* %11
%46 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6)
%47 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %7, i32* %8)
%48 = load i32, i32* %5
%49 = mul nsw i32 %48, 100
%50 = load i32, i32* %6
%51 = add nsw i32 %49, %50
store i32 %51, i32* %9
%52 = load i32, i32* %7
%53 = mul nsw i32 %52, 100
%54 = load i32, i32* %8
%55 = add nsw i32 %53, %54
store i32 %55, i32* %10
store i32 0, i32* %4
br label %56
56: ; preds = %77, %45
%57 = load i32, i32* %4
%58 = icmp slt i32 %57, 22
br i1 %58, label %59, label %80
59: ; preds = %56
%60 = load i32, i32* %4
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 %61
%63 = load i32, i32* %62
%64 = load i32, i32* %9
%65 = icmp sgt i32 %63, %64
br i1 %65, label %66, label %76
66: ; preds = %59
%67 = load i32, i32* %4
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [22 x i32], [22 x i32]* %3, i64 0, i64 %68
%70 = load i32, i32* %69
%71 = load i32, i32* %10
%72 = icmp sle i32 %70, %71
br i1 %72, label %73, label %76
73: ; preds = %66
%74 = load i32, i32* %11
%75 = add nsw i32 %74, 1
store i32 %75, i32* %11
br label %76
76: ; preds = %73, %66, %59
br label %77
77: ; preds = %76
%78 = load i32, i32* %4
%79 = add nsw i32 %78, 1
store i32 %79, i32* %4
br label %56
80: ; preds = %56
%81 = load i32, i32* %11
%82 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %81)
br label %41
83: ; preds = %41
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d:%d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [22 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %1 to i8*
%8 = bitcast [22 x i32]* %2 to i8*
%9 = bitcast [22 x i32]* %2 to <4 x i32>*
store <4 x i32> <i32 0, i32 106, i32 211, i32 317>, <4 x i32>* %9
%10 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 4
%11 = bitcast i32* %10 to <4 x i32>*
store <4 x i32> <i32 422, i32 528, i32 633, i32 738>, <4 x i32>* %11
%12 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 8
%13 = bitcast i32* %12 to <4 x i32>*
store <4 x i32> <i32 844, i32 949, i32 1055, i32 1200>, <4 x i32>* %13
%14 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 12
%15 = bitcast i32* %14 to <4 x i32>*
store <4 x i32> <i32 1306, i32 1411, i32 1517, i32 1622>, <4 x i32>* %15
%16 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 16
%17 = bitcast i32* %16 to <4 x i32>*
store <4 x i32> <i32 1728, i32 1833, i32 1938, i32 2044>, <4 x i32>* %17
%18 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 20
store i32 2149, i32* %18
%19 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 21
store i32 2255, i32* %19
%20 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%21 = bitcast i32* %3 to i8*
%22 = bitcast i32* %4 to i8*
%23 = bitcast i32* %5 to i8*
%24 = bitcast i32* %6 to i8*
%25 = load i32, i32* %1
%26 = add nsw i32 %25, -1
store i32 %26, i32* %1
%27 = icmp eq i32 %25, 0
br i1 %27, label %101, label %28
28: ; preds = %0
%29 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 20
%30 = bitcast [22 x i32]* %2 to <4 x i32>*
%31 = load <4 x i32>, <4 x i32>* %30
%32 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 4
%33 = bitcast i32* %32 to <4 x i32>*
%34 = load <4 x i32>, <4 x i32>* %33
%35 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 8
%36 = bitcast i32* %35 to <4 x i32>*
%37 = load <4 x i32>, <4 x i32>* %36
%38 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 12
%39 = bitcast i32* %38 to <4 x i32>*
%40 = load <4 x i32>, <4 x i32>* %39
%41 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 16
%42 = bitcast i32* %41 to <4 x i32>*
%43 = load <4 x i32>, <4 x i32>* %42
%44 = load i32, i32* %29
%45 = getelementptr inbounds [22 x i32], [22 x i32]* %2, i64 0, i64 21
%46 = load i32, i32* %45
br label %47
47: ; preds = %28, %47
%48 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%49 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6)
%50 = load i32, i32* %3
%51 = mul nsw i32 %50, 100
%52 = load i32, i32* %4
%53 = add nsw i32 %51, %52
%54 = load i32, i32* %5
%55 = mul nsw i32 %54, 100
%56 = load i32, i32* %6
%57 = add nsw i32 %55, %56
%58 = insertelement <4 x i32> poison, i32 %53, i64 0
%59 = shufflevector <4 x i32> %58, <4 x i32> poison, <4 x i32> zeroinitializer
%60 = insertelement <4 x i32> poison, i32 %57, i64 0
%61 = shufflevector <4 x i32> %60, <4 x i32> poison, <4 x i32> zeroinitializer
%62 = icmp sgt <4 x i32> %31, %59
%63 = icmp sle <4 x i32> %31, %61
%64 = select <4 x i1> %62, <4 x i1> %63, <4 x i1> zeroinitializer
%65 = zext <4 x i1> %64 to <4 x i32>
%66 = icmp sgt <4 x i32> %34, %59
%67 = icmp sle <4 x i32> %34, %61
%68 = select <4 x i1> %66, <4 x i1> %67, <4 x i1> zeroinitializer
%69 = zext <4 x i1> %68 to <4 x i32>
%70 = add nuw nsw <4 x i32> %65, %69
%71 = icmp sgt <4 x i32> %37, %59
%72 = icmp sle <4 x i32> %37, %61
%73 = select <4 x i1> %71, <4 x i1> %72, <4 x i1> zeroinitializer
%74 = zext <4 x i1> %73 to <4 x i32>
%75 = add nuw nsw <4 x i32> %70, %74
%76 = icmp sgt <4 x i32> %40, %59
%77 = icmp sle <4 x i32> %40, %61
%78 = select <4 x i1> %76, <4 x i1> %77, <4 x i1> zeroinitializer
%79 = zext <4 x i1> %78 to <4 x i32>
%80 = add nuw nsw <4 x i32> %75, %79
%81 = icmp sgt <4 x i32> %43, %59
%82 = icmp sle <4 x i32> %43, %61
%83 = select <4 x i1> %81, <4 x i1> %82, <4 x i1> zeroinitializer
%84 = zext <4 x i1> %83 to <4 x i32>
%85 = add nuw nsw <4 x i32> %80, %84
%86 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %85)
%87 = icmp sgt i32 %44, %53
%88 = icmp sle i32 %44, %57
%89 = select i1 %87, i1 %88, i1 false
%90 = zext i1 %89 to i32
%91 = add nuw nsw i32 %86, %90
%92 = icmp sgt i32 %46, %53
%93 = icmp sle i32 %46, %57
%94 = select i1 %92, i1 %93, i1 false
%95 = zext i1 %94 to i32
%96 = add nuw nsw i32 %91, %95
%97 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %96)
%98 = load i32, i32* %1
%99 = add nsw i32 %98, -1
store i32 %99, i32* %1
%100 = icmp eq i32 %98, 0
br i1 %100, label %101, label %47
101: ; preds = %47, %0
ret i32 0
}