#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 i, j, array[100], k, n, count;
  scanf("%i %i", &n, &k);
  for (i = 0; i < n; i++) {
    scanf("%i", &array[i]);
  }
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      if (!((array[i] + array[j]) % k))
        count++;
    }
  }
  printf("%i\n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x1a8(%rbp),%rsi
lea    -0x1a4(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jge    1192 <main+0x72>
movslq -0x8(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1155 <main+0x35>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jge    121b <main+0xfb>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jge    1208 <main+0xe8>
movslq -0x8(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
movslq -0xc(%rbp),%rcx
add    -0x1a0(%rbp,%rcx,4),%eax
cltd
idivl  -0x1a4(%rbp)
cmp    $0x0,%edx
jne    11f5 <main+0xd5>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    11fa <main+0xda>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b1 <main+0x91>
jmp    120d <main+0xed>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1199 <main+0x79>
mov    -0x1ac(%rbp),%esi
lea    0xdde(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1a0,%rsp
lea    0xecd(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    117f <main+0x5f>
lea    0x10(%rsp),%r15
lea    0xeab(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
add    $0x4,%r15
cmp    %rax,%rbx
jl     1160 <main+0x40>
mov    0xc(%rsp),%r10d
mov    %eax,%r8d
lea    0x10(%rsp),%r11
xor    %r9d,%r9d
mov    %r8,%rdi
jmp    11ad <main+0x8d>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x4,%r11
add    $0xffffffffffffffff,%rdi
cmp    %r8,%r9
je     11eb <main+0xcb>
mov    %r9,%rax
add    $0x1,%r9
cmp    %r8,%r9
jae    11a0 <main+0x80>
mov    0x10(%rsp,%rax,4),%ecx
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r11,%rbx,4),%eax
add    %ecx,%eax
cltd
idiv   %r10d
cmp    $0x1,%edx
adc    $0x0,%esi
add    $0x1,%rbx
cmp    %rbx,%rdi
jne    11d0 <main+0xb0>
jmp    11a0 <main+0x80>
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%i %i\00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = bitcast [100 x i32]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %2)
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %15, %0
%11 = phi i32 [ %8, %0 ], [ %20, %15 ]
%12 = icmp sgt i32 %11, 0
%13 = load i32, i32* %2
%14 = zext i32 %11 to i64
br label %27
15: ; preds = %0, %15
%16 = phi i64 [ %19, %15 ], [ 0, %0 ]
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %16
%18 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %17)
%19 = add nuw nsw i64 %16, 1
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = icmp slt i64 %19, %21
br i1 %22, label %15, label %10
23: ; preds = %36, %27
%24 = phi i32 [ %30, %27 ], [ %45, %36 ]
%25 = add nuw nsw i64 %29, 1
%26 = icmp eq i64 %31, %14
br i1 %26, label %48, label %27
27: ; preds = %10, %23
%28 = phi i64 [ 0, %10 ], [ %31, %23 ]
%29 = phi i64 [ 1, %10 ], [ %25, %23 ]
%30 = phi i32 [ undef, %10 ], [ %24, %23 ]
%31 = add nuw nsw i64 %28, 1
%32 = icmp ult i64 %31, %14
br i1 %32, label %33, label %23
33: ; preds = %27
%34 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %28
%35 = load i32, i32* %34
br label %36
36: ; preds = %33, %36
%37 = phi i64 [ %29, %33 ], [ %46, %36 ]
%38 = phi i32 [ %30, %33 ], [ %45, %36 ]
%39 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %37
%40 = load i32, i32* %39
%41 = add nsw i32 %40, %35
%42 = srem i32 %41, %13
%43 = icmp eq i32 %42, 0
%44 = zext i1 %43 to i32
%45 = add nsw i32 %38, %44
%46 = add nuw nsw i64 %37, 1
%47 = icmp eq i64 %46, %14
br i1 %47, label %23, label %36
48: ; preds = %23
%49 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %24)
ret i32 0
}