#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 determineMatchResult(int, char *, int, char *);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main(void) {
  int numPeople, numRound, numWinGames[100], numNotDrawnGames[100], idOne,
      idTwo, numTotalGames, i, idWin, isFirst;
  char choiceOne[20 + 1], choiceTwo[20 + 1];
  isFirst = 1;
  while (1) {
    scanf("%d", &numPeople);
    if (numPeople == 0)
      break;
    scanf("%d", &numRound);
    memset(numWinGames, 0, 100 * sizeof(int));
    memset(numNotDrawnGames, 0, 100 * sizeof(int));
    numTotalGames = (numRound * numPeople * (numPeople - 1)) >> 1;
    for (i = 0; i < numTotalGames; i++) {
      scanf("%d %s %d %s", &idOne, choiceOne, &idTwo, choiceTwo);
      idOne--;
      idTwo--;
      idWin = determineMatchResult(idOne, choiceOne, idTwo, choiceTwo);
      if (idWin >= 0) {
        numWinGames[idWin]++;
        numNotDrawnGames[idOne]++;
        numNotDrawnGames[idTwo]++;
      }
    }
    if (isFirst)
      isFirst = 0;
    else
      printf("\n");
    for (i = 0; i < numPeople; i++) {
      if (numNotDrawnGames[i] == 0)
        printf("-\n");
      else
        printf("%.3lf\n", numWinGames[i] * 1.0 / numNotDrawnGames[i]);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x380,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x348(%rbp)
lea    0xea5(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    117d <main+0x3d>
jmp    138c <main+0x24c>
lea    0xe84(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1040 <memset@plt>
lea    -0x330(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1040 <memset@plt>
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
sar    $0x1,%eax
mov    %eax,-0x33c(%rbp)
movl   $0x0,-0x340(%rbp)
mov    -0x340(%rbp),%eax
cmp    -0x33c(%rbp),%eax
jge    12c5 <main+0x185>
lea    -0x360(%rbp),%rdx
lea    -0x380(%rbp),%r8
lea    0xe0c(%rip),%rdi
lea    -0x334(%rbp),%rsi
lea    -0x338(%rbp),%rcx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x334(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x334(%rbp)
mov    -0x338(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x338(%rbp)
mov    -0x334(%rbp),%edi
lea    -0x360(%rbp),%rsi
mov    -0x338(%rbp),%edx
lea    -0x380(%rbp),%rcx
call   1050 <determineMatchResult@plt>
mov    %eax,-0x344(%rbp)
cmpl   $0x0,-0x344(%rbp)
jl     12ac <main+0x16c>
movslq -0x344(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1a0(%rbp,%rax,4)
movslq -0x334(%rbp),%rax
mov    -0x330(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x330(%rbp,%rax,4)
movslq -0x338(%rbp),%rax
mov    -0x330(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x330(%rbp,%rax,4)
jmp    12b1 <main+0x171>
mov    -0x340(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x340(%rbp)
jmp    11d8 <main+0x98>
cmpl   $0x0,-0x348(%rbp)
je     12e1 <main+0x1a1>
movl   $0x0,-0x348(%rbp)
jmp    12ef <main+0x1af>
lea    0xd30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x340(%rbp)
mov    -0x340(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1387 <main+0x247>
movslq -0x340(%rbp),%rax
cmpl   $0x0,-0x330(%rbp,%rax,4)
jne    1330 <main+0x1f0>
lea    0xcf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    136e <main+0x22e>
movslq -0x340(%rbp),%rax
cvtsi2sdl -0x1a0(%rbp,%rax,4),%xmm0
ff ff
movsd  0xcb8(%rip),%xmm1
mulsd  %xmm1,%xmm0
movslq -0x340(%rbp),%rax
cvtsi2sdl -0x330(%rbp,%rax,4),%xmm1
ff ff
divsd  %xmm1,%xmm0
lea    0xcb3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    1373 <main+0x233>
mov    -0x340(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x340(%rbp)
jmp    12f9 <main+0x1b9>
jmp    115c <main+0x1c>
xor    %eax,%eax
add    $0x380,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x388,%rsp
lea    0xe88(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
je     131d <main+0x1bd>
lea    0xe6a(%rip),%rbx
lea    0x10(%rsp),%rbp
lea    0x40(%rsp),%r14
lea    0xc(%rsp),%r15
lea    0x20(%rsp),%r12
xor    %eax,%eax
jmp    11cf <main+0x6f>
xchg   %ax,%ax
mov    %r13,%rbx
mov    %r13,%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,0x8(%rsp)
je     131d <main+0x1bd>
mov    %rax,0x18(%rsp)
mov    %rbx,%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
lea    0x1f0(%rsp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1060 <memset@plt>
lea    0x60(%rsp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1060 <memset@plt>
mov    0x8(%rsp),%r13d
mov    0x14(%rsp),%eax
imul   %r13d,%eax
add    $0xffffffff,%r13d
imul   %eax,%r13d
cmp    $0x2,%r13d
jl     12a0 <main+0x140>
shr    %r13d
jmp    1236 <main+0xd6>
nopl   0x0(%rax)
add    $0xffffffff,%r13d
je     12a0 <main+0x140>
lea    0xdc6(%rip),%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %r12,%r8
xor    %eax,%eax
call   1080 <scanf@plt>
mov    0x10(%rsp),%edi
add    $0xffffffff,%edi
mov    %edi,0x10(%rsp)
mov    0xc(%rsp),%edx
add    $0xffffffff,%edx
mov    %edx,0xc(%rsp)
mov    %r14,%rsi
mov    %r12,%rcx
call   1070 <determineMatchResult@plt>
test   %eax,%eax
js     1230 <main+0xd0>
mov    %eax,%eax
addl   $0x1,0x1f0(%rsp,%rax,4)
01
movslq 0x10(%rsp),%rax
addl   $0x1,0x60(%rsp,%rax,4)
movslq 0xc(%rsp),%rax
addl   $0x1,0x60(%rsp,%rax,4)
jmp    1230 <main+0xd0>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%r13
testb  $0x1,0x18(%rsp)
je     12b4 <main+0x154>
mov    $0xa,%edi
call   1030 <putchar@plt>
cmpl   $0x0,0x8(%rsp)
jle    11b0 <main+0x50>
xor    %ebx,%ebx
jmp    1307 <main+0x1a7>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xorps  %xmm0,%xmm0
cvtsi2sdl 0x1f0(%rsp,%rbx,4),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
lea    0xd21(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
movslq 0x8(%rsp),%rax
cmp    %rax,%rbx
jge    11b0 <main+0x50>
mov    0x60(%rsp,%rbx,4),%eax
test   %eax,%eax
jne    12d0 <main+0x170>
lea    0xd00(%rip),%rdi
call   1040 <puts@plt>
jmp    12f5 <main+0x195>
xor    %eax,%eax
add    $0x388,%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 = [12 x i8] c"%d %s %d %s\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [3 x i8] c"-\0A\00"
@.str.4 = [7 x i8] c"%.3lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i32]
%5 = alloca [100 x i32]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [21 x i8]
%13 = alloca [21 x i8]
store i32 0, i32* %1
store i32 1, i32* %11
br label %14
14: ; preds = %0, %108
%15 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%16 = load i32, i32* %2
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %14
br label %109
19: ; preds = %14
%20 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%21 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%22 = call i32 @memset(i32* %21, i32 0, i32 400)
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 0
%24 = call i32 @memset(i32* %23, i32 0, i32 400)
%25 = load i32, i32* %3
%26 = load i32, i32* %2
%27 = mul nsw i32 %25, %26
%28 = load i32, i32* %2
%29 = sub nsw i32 %28, 1
%30 = mul nsw i32 %27, %29
%31 = ashr i32 %30, 1
store i32 %31, i32* %8
store i32 0, i32* %9
br label %32
32: ; preds = %68, %19
%33 = load i32, i32* %9
%34 = load i32, i32* %8
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %71
36: ; preds = %32
%37 = getelementptr inbounds [21 x i8], [21 x i8]* %12, i64 0, i64 0
%38 = getelementptr inbounds [21 x i8], [21 x i8]* %13, i64 0, i64 0
%39 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %6, i8* %37, i32* %7, i8* %38)
%40 = load i32, i32* %6
%41 = add nsw i32 %40, -1
store i32 %41, i32* %6
%42 = load i32, i32* %7
%43 = add nsw i32 %42, -1
store i32 %43, i32* %7
%44 = load i32, i32* %6
%45 = getelementptr inbounds [21 x i8], [21 x i8]* %12, i64 0, i64 0
%46 = load i32, i32* %7
%47 = getelementptr inbounds [21 x i8], [21 x i8]* %13, i64 0, i64 0
%48 = call i32 @determineMatchResult(i32 %44, i8* %45, i32 %46, i8* %47)
store i32 %48, i32* %10
%49 = load i32, i32* %10
%50 = icmp sge i32 %49, 0
br i1 %50, label %51, label %67
51: ; preds = %36
%52 = load i32, i32* %10
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %53
%55 = load i32, i32* %54
%56 = add nsw i32 %55, 1
store i32 %56, i32* %54
%57 = load i32, i32* %6
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %58
%60 = load i32, i32* %59
%61 = add nsw i32 %60, 1
store i32 %61, i32* %59
%62 = load i32, i32* %7
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = add nsw i32 %65, 1
store i32 %66, i32* %64
br label %67
67: ; preds = %51, %36
br label %68
68: ; preds = %67
%69 = load i32, i32* %9
%70 = add nsw i32 %69, 1
store i32 %70, i32* %9
br label %32
71: ; preds = %32
%72 = load i32, i32* %11
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %75
74: ; preds = %71
store i32 0, i32* %11
br label %77
75: ; preds = %71
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %77
77: ; preds = %75, %74
store i32 0, i32* %9
br label %78
78: ; preds = %105, %77
%79 = load i32, i32* %9
%80 = load i32, i32* %2
%81 = icmp slt i32 %79, %80
br i1 %81, label %82, label %108
82: ; preds = %78
%83 = load i32, i32* %9
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %84
%86 = load i32, i32* %85
%87 = icmp eq i32 %86, 0
br i1 %87, label %88, label %90
88: ; preds = %82
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %104
90: ; preds = %82
%91 = load i32, i32* %9
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %92
%94 = load i32, i32* %93
%95 = sitofp i32 %94 to double
%96 = fmul double %95, 1.000000e+00
%97 = load i32, i32* %9
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [100 x i32], [100 x i32]* %5, i64 0, i64 %98
%100 = load i32, i32* %99
%101 = sitofp i32 %100 to double
%102 = fdiv double %96, %101
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %102)
br label %104
104: ; preds = %90, %88
br label %105
105: ; preds = %104
%106 = load i32, i32* %9
%107 = add nsw i32 %106, 1
store i32 %107, i32* %9
br label %78
108: ; preds = %78
br label %14
109: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"%d %s %d %s\00"
@.str.4 = [7 x i8] c"%.3lf\0A\00"
@str = [2 x i8] c"-\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i32]
%4 = alloca [100 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca [21 x i8]
%8 = alloca [21 x i8]
%9 = bitcast i32* %1 to i8*
%10 = bitcast i32* %2 to i8*
%11 = bitcast [100 x i32]* %3 to i8*
%12 = bitcast [100 x i32]* %4 to i8*
%13 = bitcast i32* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = getelementptr inbounds [21 x i8], [21 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [21 x i8], [21 x i8]* %8, i64 0, i64 0
%17 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%18 = load i32, i32* %1
%19 = icmp eq i32 %18, 0
br i1 %19, label %92, label %20
20: ; preds = %0
%21 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%22 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
br label %27
23: ; preds = %87, %70
%24 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%25 = load i32, i32* %1
%26 = icmp eq i32 %25, 0
br i1 %26, label %92, label %27
27: ; preds = %20, %23
%28 = phi i1 [ false, %20 ], [ true, %23 ]
%29 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%30 = call i32 @memset(i32* %21, i32 0, i32 400)
%31 = call i32 @memset(i32* %22, i32 0, i32 400)
%32 = load i32, i32* %2
%33 = load i32, i32* %1
%34 = mul nsw i32 %33, %32
%35 = add nsw i32 %33, -1
%36 = mul nsw i32 %34, %35
%37 = icmp sgt i32 %36, 1
br i1 %37, label %38, label %67
38: ; preds = %27
%39 = lshr i32 %36, 1
br label %40
40: ; preds = %38, %64
%41 = phi i32 [ %65, %64 ], [ 0, %38 ]
%42 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %5, i8* %15, i32* %6, i8* %16)
%43 = load i32, i32* %5
%44 = add nsw i32 %43, -1
store i32 %44, i32* %5
%45 = load i32, i32* %6
%46 = add nsw i32 %45, -1
store i32 %46, i32* %6
%47 = call i32 @determineMatchResult(i32 %44, i8* %15, i32 %46, i8* %16)
%48 = icmp sgt i32 %47, -1
br i1 %48, label %49, label %64
49: ; preds = %40
%50 = zext i32 %47 to i64
%51 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %50
%52 = load i32, i32* %51
%53 = add nsw i32 %52, 1
store i32 %53, i32* %51
%54 = load i32, i32* %5
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = add nsw i32 %57, 1
store i32 %58, i32* %56
%59 = load i32, i32* %6
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = add nsw i32 %62, 1
store i32 %63, i32* %61
br label %64
64: ; preds = %40, %49
%65 = add nuw nsw i32 %41, 1
%66 = icmp eq i32 %65, %39
br i1 %66, label %67, label %40
67: ; preds = %64, %27
br i1 %28, label %68, label %70
68: ; preds = %67
%69 = call i32 @putchar(i32 10)
br label %70
70: ; preds = %67, %68
%71 = load i32, i32* %1
%72 = icmp sgt i32 %71, 0
br i1 %72, label %73, label %23
73: ; preds = %70, %87
%74 = phi i64 [ %88, %87 ], [ 0, %70 ]
%75 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %74
%76 = load i32, i32* %75
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %73
%79 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
br label %87
80: ; preds = %73
%81 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %74
%82 = load i32, i32* %81
%83 = sitofp i32 %82 to double
%84 = sitofp i32 %76 to double
%85 = fdiv double %83, %84
%86 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), double %85)
br label %87
87: ; preds = %78, %80
%88 = add nuw nsw i64 %74, 1
%89 = load i32, i32* %1
%90 = sext i32 %89 to i64
%91 = icmp slt i64 %88, %90
br i1 %91, label %73, label %23
92: ; preds = %23, %0
ret i32 0
}