QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#69823#1386. Samochody dostawcze [C]mik10 ✓211ms23740kbC++14336b2023-01-02 03:39:492023-01-02 03:39:52

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-02 03:39:52]
  • 评测
  • 测评结果:10
  • 用时:211ms
  • 内存:23740kb
  • [2023-01-02 03:39:49]
  • 提交

answer

#include <cstdio>
#include <unordered_map>

int main ()
{
  std::unordered_map <int, int[2]> m;
  int n;
  scanf ("%i", &n);
  while (n--)
  {
    int r, w, t;
    scanf ("%i%i%i", &r, &w, &t);
    m[w-t][r-1]++;
  }
  int c = 0;
  for (auto [i, j]: m) c += std::min (j[0], j[1]);
  printf ("%i\n", c);
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #2:

score: 1
Accepted
time: 3ms
memory: 2908kb

input:

1
1 1 2

output:

0

result:

ok single line: '0'

Test #3:

score: 0
Accepted
time: 2ms
memory: 3208kb

input:

5
2 1 8
2 7 10
2 3 3
1 4 7
1 3 7

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 2ms
memory: 2964kb

input:

9
1 7 8
2 14 5
1 9 12
2 6 4
2 1 13
2 7 18
2 5 11
1 4 7
2 1 15

output:

0

result:

ok single line: '0'

Test #5:

score: 0
Accepted
time: 2ms
memory: 2984kb

input:

13
2 26 13
2 4 8
2 21 17
1 6 9
1 7 17
1 14 24
2 19 20
2 21 24
2 2 8
1 6 23
2 2 19
1 1 2
2 5 12

output:

3

result:

ok single line: '3'

Test #6:

score: 0
Accepted
time: 0ms
memory: 2948kb

input:

16
2 53 12
2 75 44
1 43 2
2 78 37
1 86 55
2 17 51
2 60 19
2 46 5
2 38 72
2 66 35
2 41 10
1 71 30
2 46 80
2 71 30
1 75 34
2 63 32

output:

4

result:

ok single line: '4'

Test #7:

score: 0
Accepted
time: 2ms
memory: 2908kb

input:

16
1 57 51
2 50 44
1 86 91
2 54 48
2 30 24
2 46 40
1 90 84
1 75 69
2 99 7
1 69 74
2 88 54
1 96 90
1 92 86
2 7 1
1 71 65
1 30 24

output:

5

result:

ok single line: '5'

Test #8:

score: 0
Accepted
time: 2ms
memory: 3208kb

input:

16
2 33 99
1 34 20
2 82 4
2 24 83
1 15 55
2 15 55
1 34 100
2 9 75
2 23 9
1 36 76
1 60 100
1 24 90
1 12 78
1 50 90
2 23 63
1 27 13

output:

5

result:

ok single line: '5'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3032kb

input:

16
1 23 69
1 91 51
1 26 89
1 80 29
1 30 76
1 26 55
1 26 25
2 8 94
1 48 8
1 35 98
2 31 77
1 4 90
2 36 99
1 90 50
2 18 47
2 8 7

output:

5

result:

ok single line: '5'

Test #10:

score: 0
Accepted
time: 2ms
memory: 3028kb

input:

16
1 3 94
1 13 3
2 68 16
2 38 6
1 41 9
2 54 2
2 98 88
1 17 84
1 54 44
2 39 89
1 84 52
1 12 62
2 79 18
2 94 33
2 68 7
2 31 98

output:

4

result:

ok single line: '4'

Test #11:

score: 0
Accepted
time: 2ms
memory: 3044kb

input:

16
2 15 84
1 80 2
1 17 86
2 27 89
2 100 22
2 18 87
2 4 73
2 6 75
1 88 10
2 1 70
2 13 67
1 7 76
1 16 70
2 29 83
2 18 72
2 4 66

output:

4

result:

ok single line: '4'

Test #12:

score: 0
Accepted
time: 0ms
memory: 2904kb

input:

16
1 85 38
1 98 90
2 65 50
1 92 77
1 23 15
2 100 19
1 48 40
1 61 14
2 90 43
1 40 63
1 64 87
1 77 69
1 43 28
2 94 13
1 55 78
1 7 30

output:

2

result:

ok single line: '2'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3216kb

input:

16
1 89 15
1 86 12
2 83 9
2 100 26
1 74 0
1 79 5
2 65 29
2 98 24
2 96 22
2 92 18
2 91 17
1 98 24
1 88 14
2 79 5
2 94 20
1 75 1

output:

7

result:

ok single line: '7'

Test #14:

score: 0
Accepted
time: 2ms
memory: 3048kb

input:

16
2 31 2
2 82 3
2 81 2
2 1 62
2 100 1
1 17 22
2 41 85
2 9 70
2 99 14
2 48 74
2 56 82
2 59 64
1 3 34
1 85 6
1 8 34
1 74 100

output:

4

result:

ok single line: '4'

Test #15:

score: 0
Accepted
time: 2ms
memory: 2952kb

input:

16
2 11 94
2 59 69
2 8 23
1 59 57
2 94 42
2 29 78
2 69 21
1 33 48
2 62 77
1 10 25
2 49 47
2 34 56
1 87 85
1 12 84
1 26 98
2 2 85

output:

3

result:

ok single line: '3'

Test #16:

score: 0
Accepted
time: 2ms
memory: 2948kb

input:

16
1 99 0
2 1 99
1 1 0
1 100 100
2 1 0
2 1 100
1 1 99
1 100 99
2 99 100
2 99 99
1 1 100
2 100 0
2 99 0
1 100 0
1 99 100
1 99 99

output:

7

result:

ok single line: '7'

Test #17:

score: 0
Accepted
time: 2ms
memory: 2968kb

input:

16
1 100 14
2 52 91
2 37 43
1 22 84
1 88 85
2 91 88
2 89 3
2 8 0
1 19 11
1 69 75
2 26 88
1 50 98
1 42 79
2 30 78
2 42 79
1 49 88

output:

8

result:

ok single line: '8'

Test #18:

score: 0
Accepted
time: 2ms
memory: 2984kb

input:

16
1 11 100
1 68 49
1 36 87
1 97 8
1 11 84
1 57 80
1 12 0
1 93 36
1 90 16
1 20 19
1 94 16
1 83 8
1 57 49
1 87 3
1 67 51
1 70 10

output:

0

result:

ok single line: '0'

Test #19:

score: 0
Accepted
time: 2ms
memory: 3180kb

input:

16
2 56 56
2 58 58
2 9 9
1 14 14
2 90 90
1 58 58
1 64 64
1 4 4
2 52 52
2 54 54
2 94 94
1 98 98
1 11 11
1 99 99
1 69 69
2 85 85

output:

8

result:

ok single line: '8'

Subtask #2:

score: 1
Accepted

Test #20:

score: 1
Accepted
time: 0ms
memory: 2948kb

input:

3
1 5 5
1 3 0
1 3 4

output:

0

result:

ok single line: '0'

Test #21:

score: 0
Accepted
time: 2ms
memory: 2968kb

input:

7
2 13 1
2 8 13
1 3 7
1 10 12
2 5 5
2 5 1
2 8 11

output:

0

result:

ok single line: '0'

Test #22:

score: 0
Accepted
time: 2ms
memory: 3180kb

input:

11
2 20 3
2 21 11
1 3 1
2 22 22
2 7 22
2 14 3
1 19 6
2 4 3
1 12 7
1 18 17
1 3 16

output:

1

result:

ok single line: '1'

Test #23:

score: 0
Accepted
time: 2ms
memory: 3216kb

input:

15
1 14 23
1 7 21
2 5 13
1 17 18
2 3 0
2 18 27
2 8 2
2 23 15
2 20 3
1 25 17
2 13 16
1 2 8
2 25 26
2 3 1
1 10 27

output:

3

result:

ok single line: '3'

Test #24:

score: 0
Accepted
time: 1ms
memory: 2948kb

input:

16
2 34 85
2 7 58
1 12 63
2 40 91
1 11 62
2 47 98
2 74 31
1 6 57
2 16 67
1 41 92
2 17 68
1 35 86
1 23 74
1 4 55
2 15 66
2 10 56

output:

7

result:

ok single line: '7'

Test #25:

score: 0
Accepted
time: 2ms
memory: 3176kb

input:

16
1 23 97
2 17 91
1 3 77
2 87 33
2 22 96
2 83 9
1 21 95
1 77 3
2 71 17
1 81 27
1 68 14
2 75 21
2 70 16
1 55 1
2 25 99
2 79 25

output:

7

result:

ok single line: '7'

Test #26:

score: 0
Accepted
time: 1ms
memory: 2956kb

input:

16
1 26 41
1 58 73
1 48 63
2 71 94
2 25 70
2 21 36
2 3 36
2 66 4
2 29 74
1 12 27
2 81 49
1 20 35
1 19 26
1 95 33
1 66 89
2 25 40

output:

4

result:

ok single line: '4'

Test #27:

score: 0
Accepted
time: 2ms
memory: 3040kb

input:

16
1 83 30
2 20 22
2 5 99
2 27 68
2 2 96
1 19 52
1 54 95
2 35 87
1 39 91
2 2 4
2 46 98
1 33 74
1 93 40
1 35 68
2 46 48
1 9 100

output:

2

result:

ok single line: '2'

Test #28:

score: 0
Accepted
time: 1ms
memory: 2944kb

input:

16
1 12 42
1 35 52
2 49 52
2 3 88
1 79 10
1 15 100
1 90 52
1 3 88
2 93 3
1 39 56
1 77 12
1 99 9
2 66 1
1 26 29
1 41 3
2 64 94

output:

5

result:

ok single line: '5'

Test #29:

score: 0
Accepted
time: 2ms
memory: 3024kb

input:

16
1 96 47
1 20 90
1 24 84
1 34 8
1 92 66
1 7 77
1 84 35
2 1 71
2 99 23
1 12 82
2 30 4
1 89 40
2 85 9
2 92 43
1 94 18
1 81 55

output:

4

result:

ok single line: '4'

Test #30:

score: 0
Accepted
time: 0ms
memory: 2896kb

input:

16
1 23 79
1 76 47
1 80 15
1 98 38
2 82 17
2 84 24
1 98 69
2 79 19
1 12 68
2 37 93
1 59 30
1 100 35
1 36 92
1 62 2
2 91 62
2 56 61

output:

5

result:

ok single line: '5'

Test #31:

score: 0
Accepted
time: 2ms
memory: 3044kb

input:

16
2 79 33
2 99 80
2 71 52
2 83 37
1 87 41
1 77 31
1 66 47
1 25 6
1 37 18
2 48 2
2 50 4
2 86 67
2 45 26
2 87 68
2 98 52
1 58 12

output:

6

result:

ok single line: '6'

Test #32:

score: 0
Accepted
time: 2ms
memory: 3100kb

input:

16
1 3 99
2 25 63
2 3 99
1 83 21
2 69 38
1 49 18
1 98 10
1 90 28
1 90 14
2 33 63
1 32 37
1 80 30
2 67 5
2 66 16
2 1 97
2 10 48

output:

4

result:

ok single line: '4'

Test #33:

score: 0
Accepted
time: 2ms
memory: 2952kb

input:

16
2 68 68
2 55 88
2 84 9
1 79 4
2 41 25
1 53 19
2 58 33
1 88 13
2 59 59
2 89 14
2 80 5
2 81 6
1 82 7
2 20 36
1 89 55
1 75 0

output:

4

result:

ok single line: '4'

Test #34:

score: 0
Accepted
time: 2ms
memory: 3188kb

input:

16
2 21 2
1 28 59
2 25 6
1 44 43
1 41 66
1 28 27
1 9 92
1 99 7
1 32 3
1 29 0
2 70 7
1 38 63
1 100 8
2 86 23
1 16 99
1 69 100

output:

0

result:

ok single line: '0'

Test #35:

score: 0
Accepted
time: 2ms
memory: 3044kb

input:

16
1 19 41
2 28 9
2 66 82
2 18 34
1 59 55
1 98 18
2 71 93
1 11 99
2 95 15
1 97 38
2 85 26
2 68 49
2 65 61
2 1 89
1 5 85
2 17 97

output:

6

result:

ok single line: '6'

Test #36:

score: 0
Accepted
time: 0ms
memory: 2944kb

input:

16
1 98 81
1 1 34
1 47 84
2 99 3
1 16 59
1 89 33
2 72 30
1 47 25
2 75 26
2 11 87
2 48 55
1 4 83
2 35 17
2 25 89
2 46 93
1 31 75

output:

0

result:

ok single line: '0'

Test #37:

score: 0
Accepted
time: 1ms
memory: 2904kb

input:

16
2 22 22
2 68 68
1 47 47
1 96 96
1 46 46
2 71 71
2 84 84
2 59 59
2 37 37
1 65 65
1 100 100
1 30 30
2 67 67
1 10 10
2 90 90
2 93 93

output:

7

result:

ok single line: '7'

Subtask #3:

score: 1
Accepted

Test #38:

score: 1
Accepted
time: 2ms
memory: 3184kb

input:

99
1 69 93
2 23 23
1 9 33
2 5 29
2 6 84
1 7 31
1 54 61
2 1 25
2 26 50
2 26 69
1 66 90
2 14 21
1 80 80
2 6 13
1 60 67
2 13 91
2 47 35
2 62 30
1 39 7
1 70 94
1 14 92
1 30 30
2 32 75
2 24 48
1 13 56
2 92 80
2 20 63
2 87 75
2 28 16
2 22 29
2 46 89
2 67 67
2 67 55
2 16 4
2 56 24
1 31 74
2 83 83
1 3 10
1 ...

output:

43

result:

ok single line: '43'

Test #39:

score: 0
Accepted
time: 2ms
memory: 2944kb

input:

97
2 22 98
1 14 90
1 53 36
1 12 1
1 61 84
1 80 69
1 41 30
2 29 12
1 30 19
1 87 78
1 76 99
1 69 58
1 35 26
2 77 60
1 59 48
1 65 88
1 40 79
2 22 45
1 33 22
2 39 62
1 41 64
2 52 35
2 16 5
1 94 8
2 58 41
2 13 2
1 89 3
1 78 91
2 34 57
1 21 44
1 84 73
1 16 39
2 25 14
1 45 36
1 89 20
1 25 14
2 15 91
2 35 2...

output:

32

result:

ok single line: '32'

Test #40:

score: 0
Accepted
time: 2ms
memory: 2960kb

input:

100
2 1 0
2 80 79
1 9 77
1 28 55
2 13 84
1 3 64
2 17 44
2 11 79
1 14 75
1 13 81
2 6 33
2 28 42
1 32 59
1 24 85
2 17 78
2 17 80
2 1 64
2 37 98
1 30 91
1 8 69
2 99 6
2 7 68
1 7 15
2 49 76
1 2 29
1 32 93
1 82 9
2 23 22
2 75 87
1 20 81
2 2 63
2 28 40
2 22 90
2 72 99
2 26 87
1 7 75
1 14 77
2 3 32
2 39 66...

output:

40

result:

ok single line: '40'

Test #41:

score: 0
Accepted
time: 2ms
memory: 2984kb

input:

100
1 3 44
2 49 77
1 85 7
1 19 98
1 15 96
2 31 90
1 31 8
2 7 79
2 64 43
1 34 42
1 4 70
2 91 70
1 86 29
1 3 69
2 14 24
1 12 93
1 70 99
1 10 88
1 28 26
2 44 61
2 11 47
2 11 28
2 42 40
1 6 47
2 18 88
1 16 97
1 25 58
2 19 48
2 73 98
2 87 27
2 54 80
2 32 38
2 13 94
1 86 4
1 11 47
1 86 44
2 6 48
2 72 22
2...

output:

25

result:

ok single line: '25'

Test #42:

score: 0
Accepted
time: 2ms
memory: 2984kb

input:

100
2 6 84
2 32 14
2 47 5
2 54 17
1 91 97
2 99 81
2 99 95
2 47 53
2 61 21
2 65 28
2 48 6
2 11 59
2 14 26
2 94 57
2 29 14
2 13 58
2 35 83
1 58 41
2 60 66
1 62 47
2 39 28
1 95 64
2 76 82
1 63 85
1 41 4
2 79 61
1 43 88
1 88 57
1 92 50
1 3 85
1 94 90
2 54 39
2 84 90
2 84 34
1 72 22
1 22 44
1 66 72
2 9 9...

output:

29

result:

ok single line: '29'

Test #43:

score: 0
Accepted
time: 2ms
memory: 3032kb

input:

97
1 88 34
2 96 26
2 64 49
2 58 54
2 17 88
2 78 74
2 12 3
2 3 89
1 34 79
2 75 38
2 8 94
2 17 97
2 83 15
2 67 13
2 90 81
1 86 49
2 71 1
1 58 43
1 27 23
1 9 95
2 79 70
2 55 51
1 79 9
2 59 93
1 5 91
2 71 34
2 44 35
1 15 6
2 97 13
1 10 55
1 87 50
2 59 5
1 21 94
2 83 46
1 74 20
2 80 26
2 24 97
2 98 81
2 ...

output:

32

result:

ok single line: '32'

Test #44:

score: 0
Accepted
time: 2ms
memory: 3060kb

input:

96
1 11 4
2 5 52
2 5 49
1 29 93
2 58 18
2 36 82
2 32 79
2 92 3
2 38 82
2 91 38
2 22 86
1 58 9
2 68 61
2 89 0
2 70 63
2 99 10
2 13 60
2 9 73
2 11 55
1 25 89
2 22 76
2 41 87
2 29 22
1 11 55
1 12 58
2 21 67
1 18 62
2 21 85
1 59 6
1 22 15
2 24 71
2 63 10
2 96 7
1 26 90
1 96 89
1 7 51
1 50 10
2 8 52
2 51...

output:

30

result:

ok single line: '30'

Test #45:

score: 0
Accepted
time: 0ms
memory: 3048kb

input:

100
1 76 71
2 60 55
1 28 23
1 96 53
2 39 34
1 88 83
2 29 24
2 73 30
1 7 2
1 55 50
2 76 33
1 20 15
1 85 80
2 57 14
2 77 34
1 36 67
2 98 93
2 82 39
2 60 17
1 64 59
1 31 26
2 35 30
2 100 95
2 95 52
1 63 58
1 56 51
2 69 64
1 63 20
1 16 11
2 28 23
2 59 54
2 34 29
1 18 13
2 88 45
1 65 22
1 77 34
2 44 1
1 ...

output:

48

result:

ok single line: '48'

Test #46:

score: 0
Accepted
time: 2ms
memory: 2952kb

input:

97
2 38 11
1 9 32
1 56 29
1 63 86
1 90 63
2 91 64
1 65 7
1 41 14
2 97 39
1 64 37
1 80 22
1 3 8
2 49 72
1 22 45
2 68 10
2 53 26
1 70 43
2 27 50
1 40 13
1 5 10
1 69 11
2 95 37
2 39 62
2 66 39
2 75 48
2 49 22
2 46 19
1 48 71
1 39 12
2 42 65
2 78 20
1 54 27
2 69 11
1 87 60
1 74 16
1 67 40
1 79 52
1 32 5...

output:

41

result:

ok single line: '41'

Test #47:

score: 0
Accepted
time: 2ms
memory: 3028kb

input:

100
2 96 5
2 31 83
2 57 4
2 13 19
2 16 14
1 45 22
2 33 32
1 98 41
2 96 94
1 81 0
1 100 12
2 52 29
1 80 31
2 99 98
2 100 71
1 90 96
2 93 12
1 59 48
1 92 4
2 92 15
1 72 99
2 97 47
1 24 52
2 6 12
2 75 29
2 26 3
2 40 91
1 39 90
1 94 44
2 97 86
2 32 38
1 20 18
2 71 18
2 91 45
2 43 70
1 7 71
1 75 25
1 66 ...

output:

34

result:

ok single line: '34'

Test #48:

score: 0
Accepted
time: 0ms
memory: 2960kb

input:

96
2 64 34
1 6 98
2 84 15
2 26 50
2 94 30
2 3 95
1 45 85
2 63 99
2 37 83
1 93 29
2 61 76
2 87 59
2 96 27
1 10 70
2 34 4
2 79 10
2 35 95
2 100 19
2 75 11
1 89 8
2 22 80
1 82 97
1 8 18
2 11 90
1 26 36
2 43 13
2 94 13
2 33 3
1 44 59
2 49 89
1 32 72
2 74 10
1 18 78
2 7 7
1 15 97
2 60 100
1 16 40
1 38 98...

output:

32

result:

ok single line: '32'

Test #49:

score: 0
Accepted
time: 2ms
memory: 3036kb

input:

100
2 100 1
1 1 100
2 98 97
1 3 97
2 97 0
2 3 0
2 99 1
2 3 98
1 97 1
2 99 97
1 98 1
1 2 99
1 2 0
2 98 0
1 1 2
2 3 100
1 1 98
2 97 99
1 97 2
1 98 2
1 99 97
1 3 2
1 100 1
1 100 98
2 2 97
2 98 1
1 3 98
1 100 0
1 2 100
1 100 100
1 98 99
2 99 98
2 2 98
1 3 1
1 97 97
1 99 0
2 98 100
2 98 98
2 2 1
1 99 2
2...

output:

49

result:

ok single line: '49'

Test #50:

score: 0
Accepted
time: 2ms
memory: 3052kb

input:

100
2 8 91
1 94 57
1 66 26
1 17 88
1 4 43
2 2 73
2 82 44
1 1 99
1 12 98
2 1 100
1 99 3
2 1 96
2 15 55
2 89 1
1 87 78
1 1 100
2 3 62
2 35 61
1 92 29
2 95 41
2 84 17
1 9 50
2 6 92
1 72 21
1 16 78
1 5 100
1 55 30
1 65 6
2 17 99
2 5 81
2 38 13
1 69 92
2 35 91
1 17 66
2 22 84
1 7 71
1 3 73
1 43 33
2 53 2...

output:

50

result:

ok single line: '50'

Test #51:

score: 0
Accepted
time: 2ms
memory: 3104kb

input:

100
1 38 74
1 65 19
1 68 48
1 80 0
1 87 33
1 96 81
1 95 5
1 87 5
1 77 36
1 71 14
1 51 60
1 31 8
1 47 95
1 47 47
1 60 20
1 3 33
1 1 98
1 51 96
1 100 6
1 11 23
1 59 91
1 40 19
1 14 92
1 20 71
1 88 15
1 77 5
1 100 2
1 57 82
1 62 2
1 93 35
1 79 50
1 5 100
1 51 27
1 65 79
1 4 96
1 1 97
1 81 10
1 21 85
1 ...

output:

0

result:

ok single line: '0'

Test #52:

score: 0
Accepted
time: 2ms
memory: 2960kb

input:

100
2 50 50
2 91 91
1 71 71
2 8 8
2 33 33
1 11 11
2 11 11
2 82 82
1 99 99
2 6 6
2 64 64
1 53 53
1 7 7
2 54 54
2 37 37
1 8 8
2 75 75
2 85 85
2 93 93
1 94 94
2 25 25
1 92 92
1 40 40
2 76 76
1 14 14
2 58 58
1 20 20
1 86 86
1 74 74
2 51 51
1 44 44
2 40 40
2 57 57
1 49 49
2 86 86
2 60 60
1 39 39
1 96 96
...

output:

50

result:

ok single line: '50'

Subtask #4:

score: 1
Accepted

Test #53:

score: 1
Accepted
time: 3ms
memory: 2948kb

input:

96
1 14 98
2 82 82
1 91 19
2 77 77
1 42 87
1 10 10
1 68 4
1 98 29
1 6 59
2 85 21
1 2 2
1 87 18
2 1 58
2 22 79
1 9 9
2 35 35
1 15 15
1 74 2
1 39 39
2 8 88
2 40 40
2 79 7
1 38 91
2 25 78
2 9 9
1 99 27
2 47 100
2 95 26
2 52 97
1 24 77
1 3 3
2 23 31
2 98 34
2 18 71
2 22 22
1 12 12
1 39 92
2 7 7
1 29 29
...

output:

41

result:

ok single line: '41'

Test #54:

score: 0
Accepted
time: 2ms
memory: 2984kb

input:

97
2 37 20
1 43 90
2 94 85
2 85 68
2 55 40
2 20 5
2 31 16
2 29 14
1 13 95
1 71 56
1 17 2
1 52 92
1 40 25
1 16 89
1 59 44
1 49 89
1 38 85
2 73 6
1 91 76
1 37 22
2 1 74
2 36 83
1 17 90
1 62 47
1 86 71
1 92 28
1 67 50
2 52 35
1 61 46
2 9 82
1 44 27
1 79 64
1 15 97
2 95 78
2 36 21
2 28 60
2 54 37
1 74 5...

output:

36

result:

ok single line: '36'

Test #55:

score: 0
Accepted
time: 2ms
memory: 2956kb

input:

99
2 31 82
1 29 99
2 18 69
1 10 84
1 9 86
1 91 82
2 62 43
2 23 100
2 35 26
1 16 93
2 12 81
2 22 98
2 21 97
2 1 94
2 6 82
2 19 96
2 14 83
1 11 87
2 97 16
1 6 83
1 65 4
2 47 98
1 19 96
1 83 2
2 100 81
1 2 79
2 41 32
1 8 85
2 66 14
2 73 54
1 59 10
1 3 80
2 83 22
2 19 88
1 7 81
2 8 85
2 1 68
2 4 81
2 89...

output:

34

result:

ok single line: '34'

Test #56:

score: 0
Accepted
time: 2ms
memory: 3028kb

input:

99
1 82 89
1 90 3
2 99 2
2 82 40
2 100 58
2 91 4
1 48 55
1 77 3
1 20 93
1 82 55
1 99 2
1 53 26
2 67 7
2 96 75
1 44 89
1 23 92
1 88 14
1 26 98
2 49 22
2 8 99
1 8 76
2 51 17
2 61 57
1 91 55
2 65 2
1 56 68
2 16 84
2 9 81
2 47 13
1 88 52
1 100 37
1 84 21
2 76 97
2 87 24
2 1 46
1 3 22
2 80 17
1 85 11
2 8...

output:

31

result:

ok single line: '31'

Test #57:

score: 0
Accepted
time: 3ms
memory: 3044kb

input:

95
1 45 69
1 17 84
1 13 85
2 96 39
2 38 84
1 8 100
2 1 93
2 74 2
2 6 78
2 45 69
2 94 32
1 30 54
2 99 14
1 7 88
2 21 45
1 19 93
2 49 21
1 14 63
1 19 91
2 26 72
2 5 97
2 46 70
2 84 12
1 68 6
2 19 65
2 88 26
1 53 34
2 86 1
1 4 97
1 47 71
1 42 66
2 28 100
2 8 80
1 61 85
2 23 95
1 34 80
1 85 0
2 97 12
2 ...

output:

35

result:

ok single line: '35'

Test #58:

score: 0
Accepted
time: 2ms
memory: 3220kb

input:

95
2 21 22
1 54 45
1 70 71
1 34 58
1 38 65
1 30 83
1 4 96
2 22 13
1 9 33
1 75 99
1 7 89
2 6 88
2 83 1
2 79 31
1 75 32
2 58 82
2 8 90
1 79 80
1 73 25
2 6 98
2 7 89
2 86 4
1 81 36
1 47 71
2 42 33
2 89 44
2 75 30
2 23 50
1 69 21
1 94 12
2 5 6
2 66 90
2 18 71
2 26 53
2 86 44
1 46 37
2 99 100
1 7 34
1 69...

output:

36

result:

ok single line: '36'

Test #59:

score: 0
Accepted
time: 2ms
memory: 3040kb

input:

100
2 78 20
2 96 38
2 53 51
1 70 12
2 18 24
1 59 73
1 40 46
2 24 14
2 78 21
1 37 43
1 59 2
2 45 51
1 58 64
1 9 68
2 46 54
2 81 23
1 21 27
2 95 91
2 64 6
2 13 71
2 88 84
1 62 4
2 15 21
1 89 32
1 25 21
2 2 60
1 42 73
1 89 95
2 14 22
2 89 31
1 91 87
2 16 22
1 73 16
2 64 23
1 84 80
1 82 25
1 22 36
2 32 ...

output:

42

result:

ok single line: '42'

Test #60:

score: 0
Accepted
time: 2ms
memory: 2952kb

input:

100
1 82 98
2 70 78
2 57 65
1 41 20
2 33 49
1 78 94
1 83 62
1 3 19
2 58 37
2 53 69
2 27 6
1 25 33
1 69 48
2 36 44
2 48 27
1 30 46
1 54 62
1 50 58
2 15 23
2 68 76
1 28 36
2 18 26
2 52 60
1 7 15
1 36 15
1 61 40
2 28 7
1 18 26
2 85 64
2 75 83
1 57 65
2 1 17
2 12 20
2 96 75
2 14 30
2 54 62
1 66 74
2 78 ...

output:

47

result:

ok single line: '47'

Test #61:

score: 0
Accepted
time: 1ms
memory: 3212kb

input:

100
1 34 58
2 91 31
2 66 6
1 10 34
2 52 76
1 93 33
2 30 43
2 87 27
2 71 26
2 20 26
2 85 25
1 99 54
1 55 79
2 34 40
1 11 24
2 78 33
2 6 12
2 61 74
2 60 66
2 68 23
2 57 63
2 44 50
1 25 38
1 68 8
2 23 36
2 38 62
2 65 5
1 18 24
1 45 69
1 67 73
1 83 36
2 86 99
2 50 56
2 51 57
2 75 15
1 66 79
2 32 56
2 62...

output:

40

result:

ok single line: '40'

Test #62:

score: 0
Accepted
time: 1ms
memory: 2964kb

input:

100
2 79 61
2 78 13
2 96 78
1 69 4
2 86 1
1 21 45
2 99 88
1 98 7
1 93 2
2 57 12
2 97 92
2 61 29
1 85 22
2 56 16
1 91 0
2 94 7
1 96 11
2 56 68
1 47 29
2 12 24
1 12 80
2 48 30
2 91 6
2 97 6
1 94 9
2 9 74
2 86 6
1 9 77
1 99 14
1 98 13
2 5 17
2 96 11
2 31 7
1 24 6
2 68 36
2 79 93
2 29 97
2 73 34
2 91 0
...

output:

33

result:

ok single line: '33'

Test #63:

score: 0
Accepted
time: 1ms
memory: 3044kb

input:

100
2 57 92
2 24 59
2 26 18
1 70 81
1 61 86
2 97 11
2 55 50
2 22 60
2 96 10
2 13 5
2 65 90
2 10 21
2 81 45
2 21 46
2 71 35
1 63 33
1 62 9
2 55 10
1 63 88
2 81 48
2 43 66
1 3 14
2 55 86
1 66 74
2 100 14
2 27 22
1 100 14
2 2 61
1 44 96
2 94 8
1 31 73
2 52 59
2 88 80
1 40 32
2 11 70
2 19 54
1 51 74
2 8...

output:

31

result:

ok single line: '31'

Test #64:

score: 0
Accepted
time: 2ms
memory: 3028kb

input:

100
1 8 62
1 12 80
1 2 98
1 96 97
2 81 45
1 12 96
2 6 73
1 31 81
2 74 65
1 49 27
2 50 29
2 93 3
2 14 67
1 4 100
1 79 52
2 47 70
2 11 20
1 5 55
2 22 89
2 3 75
1 63 15
1 98 12
1 5 91
2 90 45
2 30 7
1 93 39
2 82 46
1 40 13
1 36 28
1 36 77
1 85 50
1 41 82
1 43 89
1 74 33
1 22 30
1 38 84
2 75 30
1 26 64
...

output:

0

result:

ok single line: '0'

Test #65:

score: 0
Accepted
time: 2ms
memory: 2920kb

input:

100
2 84 19
2 59 42
2 92 52
1 75 73
1 100 1
2 82 3
2 89 10
1 56 1
1 14 88
1 72 79
2 48 15
1 31 30
1 42 25
1 27 69
1 87 21
2 66 94
2 65 0
2 4 18
2 79 37
2 4 93
2 100 0
1 98 5
2 97 4
2 77 75
1 19 35
1 17 91
1 90 12
1 85 14
2 4 77
2 97 46
2 22 35
2 12 94
2 45 66
1 64 7
2 77 4
2 12 99
2 35 4
1 81 20
2 3...

output:

19

result:

ok single line: '19'

Test #66:

score: 0
Accepted
time: 2ms
memory: 2968kb

input:

100
1 64 13
1 7 52
2 66 50
1 91 62
2 15 84
2 37 95
1 100 2
2 23 77
2 45 96
2 12 36
2 59 52
1 100 0
1 44 16
1 3 94
1 79 17
2 47 59
2 37 5
1 8 100
2 91 38
1 65 6
2 69 0
2 90 81
2 28 7
1 99 14
2 7 92
1 35 43
2 22 97
2 18 84
1 58 1
2 1 84
2 94 52
1 32 81
2 56 61
1 87 12
2 76 28
2 77 3
2 52 69
1 16 98
2 ...

output:

0

result:

ok single line: '0'

Test #67:

score: 0
Accepted
time: 2ms
memory: 3184kb

input:

100
1 97 97
2 87 87
1 1 1
1 74 74
2 25 25
2 7 7
2 65 65
2 100 100
1 44 44
1 61 61
1 92 92
2 78 78
2 81 81
2 12 12
2 85 85
1 31 31
1 47 47
1 95 95
1 9 9
2 69 69
1 99 99
2 75 75
2 55 55
1 48 48
2 52 52
2 15 15
1 71 71
1 46 46
1 88 88
1 34 34
2 56 56
2 84 84
2 26 26
1 22 22
1 3 3
2 57 57
2 4 4
2 6 6
1 ...

output:

46

result:

ok single line: '46'

Subtask #5:

score: 1
Accepted

Test #68:

score: 1
Accepted
time: 3ms
memory: 2908kb

input:

3000
2 2340 920
2 2956 2668
1 2194 464
1 729 1562
1 1083 2013
1 2783 2495
1 1952 222
1 2472 2184
2 1380 2213
2 2995 2013
1 2268 538
2 2321 901
2 2424 2136
1 212 1045
2 658 370
2 1920 2850
1 2709 2421
2 1948 2878
2 2407 2119
1 2931 1511
2 1878 148
2 1654 2487
2 2499 769
1 2707 1287
2 2497 767
2 2939 ...

output:

1439

result:

ok single line: '1439'

Test #69:

score: 0
Accepted
time: 1ms
memory: 2952kb

input:

2995
1 413 2207
1 855 1226
2 1114 1485
2 1272 2475
1 1474 2677
1 426 1629
1 72 1744
1 314 2108
2 1357 1728
1 844 255
1 2513 1924
2 1857 2228
1 550 921
1 101 472
2 2611 62
1 1107 2310
2 1049 2843
2 225 1815
1 732 143
1 1594 2797
2 1082 2876
1 1084 2287
2 934 2728
1 236 1439
1 1428 2631
1 1797 3000
1 ...

output:

1429

result:

ok single line: '1429'

Test #70:

score: 0
Accepted
time: 3ms
memory: 2960kb

input:

3000
2 380 437
1 342 2552
1 2146 100
2 2858 812
2 1789 1931
2 465 2402
2 2119 1675
1 2284 238
2 577 634
1 152 2362
2 257 2467
1 1087 2137
2 2692 2749
2 193 1086
2 119 1661
2 1062 2604
2 2417 371
1 1489 62
1 449 2659
1 500 557
1 905 962
1 2913 867
1 543 600
1 779 1829
2 2273 227
1 2637 591
2 2789 743...

output:

1416

result:

ok single line: '1416'

Test #71:

score: 0
Accepted
time: 2ms
memory: 2972kb

input:

2996
1 13 2946
2 2887 446
2 2886 226
1 3 1351
2 692 2553
1 2507 228
2 2226 1368
2 2994 2366
1 2644 2424
2 2789 1737
2 2917 75
2 2805 155
2 535 2170
1 1167 1204
1 1845 267
1 1604 30
1 2958 2469
1 2951 828
1 289 907
2 2599 2937
2 1304 77
2 2446 253
2 341 403
2 1190 2838
2 3 2756
1 2863 1089
2 1436 123...

output:

689

result:

ok single line: '689'

Test #72:

score: 0
Accepted
time: 4ms
memory: 3060kb

input:

3000
1 22 2941
2 919 154
1 1169 2590
1 2444 265
2 2777 442
1 2815 480
2 1680 2178
2 1441 2550
1 161 3000
2 120 1220
2 2193 949
2 1536 455
1 138 364
1 107 2664
1 442 2653
1 1104 1982
1 2701 90
1 1711 768
1 2100 717
2 2877 2124
2 140 180
1 2966 687
2 119 2595
1 2533 766
1 884 2059
1 2180 2759
2 258 29...

output:

938

result:

ok single line: '938'

Test #73:

score: 0
Accepted
time: 0ms
memory: 3072kb

input:

3000
1 656 2908
1 1250 1913
2 2791 591
2 2965 23
1 199 369
1 1680 2892
1 1420 1048
2 1615 723
1 2035 1393
2 2914 74
2 2672 228
2 1911 1649
1 2229 76
1 2753 648
1 714 1965
2 2752 323
1 2262 175
2 2935 624
1 2682 529
1 1122 2633
2 523 1284
2 479 1985
1 2267 2138
2 2831 825
2 45 2836
2 2371 16
1 577 29...

output:

1025

result:

ok single line: '1025'

Test #74:

score: 0
Accepted
time: 3ms
memory: 3056kb

input:

3000
1 2966 40
1 195 2289
2 269 2766
1 504 2091
2 1902 2157
1 837 2817
2 755 2930
1 773 2504
1 282 2775
2 9 2909
2 1739 596
1 2531 17
1 129 524
1 1625 256
1 2979 2916
2 556 2991
2 2870 2828
2 2982 56
1 1641 409
1 837 2180
2 1599 2443
1 853 2504
2 2809 1282
1 298 2524
2 667 523
2 1884 2369
1 778 2196...

output:

1101

result:

ok single line: '1101'

Test #75:

score: 0
Accepted
time: 3ms
memory: 3184kb

input:

3000
1 1148 179
1 2319 2048
2 713 442
1 680 1897
1 980 11
2 2620 2349
1 2144 1873
1 1503 534
1 1277 1006
1 2369 2098
2 1511 542
2 2508 2237
1 2505 2234
2 2985 2714
2 2389 1420
1 2461 1492
2 2359 2088
2 2131 1860
1 1313 1042
1 1060 789
1 2094 1823
2 281 10
1 1390 421
2 2137 1866
2 2472 1503
2 1354 38...

output:

1470

result:

ok single line: '1470'

Test #76:

score: 0
Accepted
time: 1ms
memory: 2948kb

input:

3000
1 672 2729
2 899 1712
1 2009 2267
2 517 1330
1 977 1790
2 1640 1898
1 44 2101
2 281 1124
1 1963 2806
2 488 2545
1 711 2768
1 1812 2655
2 751 2808
2 2157 2415
1 520 1363
1 214 2271
1 2071 2914
2 342 2399
1 175 2232
2 660 1473
1 1879 2692
1 95 908
2 644 1487
2 521 2578
1 468 2525
1 673 1486
1 203...

output:

1464

result:

ok single line: '1464'

Test #77:

score: 0
Accepted
time: 2ms
memory: 3228kb

input:

2998
2 2716 1235
1 313 1960
2 2356 152
1 2624 1143
2 329 2499
2 117 285
2 2689 378
2 796 1869
2 764 2563
1 223 2670
1 2559 144
2 2871 804
2 2694 173
1 1881 823
1 2314 110
1 815 845
2 1266 2913
1 1808 625
2 2545 391
1 1539 1606
1 2750 57
1 1732 2936
2 2232 241
2 2778 1553
2 2393 1210
1 245 2918
1 288...

output:

1217

result:

ok single line: '1217'

Test #78:

score: 0
Accepted
time: 1ms
memory: 3064kb

input:

2997
2 2194 1296
2 931 2949
1 1145 891
1 2867 2128
1 1796 1542
1 1027 2322
1 2094 1929
2 1056 1771
1 69 2776
1 1266 527
1 392 1941
2 2667 443
2 2760 2274
1 621 2540
2 2784 2689
1 1270 531
1 2203 2038
1 435 1150
2 1091 1077
2 2878 654
1 1151 580
2 788 623
2 2610 386
2 2721 2467
1 1716 977
2 1047 1025...

output:

1213

result:

ok single line: '1213'

Test #79:

score: 0
Accepted
time: 3ms
memory: 2908kb

input:

3000
1 3 17
1 2992 6
2 2998 6
1 6 2986
1 7 2988
1 1 2992
2 14 2986
1 3 2988
1 15 11
2 14 2993
1 9 2
2 6 2991
1 9 2987
2 13 2985
2 2997 2999
2 6 4
2 18 1
1 6 17
2 3 11
2 3000 13
1 2983 2994
1 2 0
1 9 2989
1 2 3
2 3000 1
2 3000 2993
2 6 2982
2 10 2990
1 2984 2982
1 7 2999
1 2991 14
2 2987 2991
2 7 298...

output:

1479

result:

ok single line: '1479'

Test #80:

score: 0
Accepted
time: 3ms
memory: 3032kb

input:

3000
2 1121 1884
2 350 2828
1 466 2578
2 2178 298
2 1814 2654
2 1622 1177
2 1675 849
1 2330 376
2 1234 2972
1 2766 979
1 2682 564
1 897 2167
1 2884 380
2 2326 205
1 1276 2203
2 2263 2253
2 2098 1214
1 2820 90
1 2510 163
2 1970 2839
2 550 2476
1 30 2910
1 16 2240
1 165 2419
1 165 2746
2 2826 842
1 29...

output:

1500

result:

ok single line: '1500'

Test #81:

score: 0
Accepted
time: 0ms
memory: 3176kb

input:

3000
1 1261 213
1 2811 48
1 2920 106
1 630 2319
1 236 2931
1 1590 1885
1 31 2913
1 649 335
1 388 2258
1 347 2414
1 2036 2980
1 2580 43
1 2140 986
1 2984 46
1 1541 606
1 2587 1271
1 2854 836
1 5 2779
1 520 1525
1 2235 1333
1 3000 1
1 715 181
1 818 2866
1 631 2456
1 1009 914
1 1518 550
1 24 1305
1 283...

output:

0

result:

ok single line: '0'

Test #82:

score: 0
Accepted
time: 3ms
memory: 3040kb

input:

3000
2 1029 1029
1 962 962
1 309 309
1 1647 1647
1 1134 1134
1 925 925
2 2477 2477
1 257 257
1 2308 2308
2 2472 2472
2 108 108
1 1190 1190
2 939 939
1 989 989
2 337 337
1 2873 2873
2 1617 1617
1 1918 1918
2 1198 1198
1 2033 2033
2 535 535
2 2792 2792
2 32 32
1 512 512
1 1759 1759
1 1570 1570
1 729 7...

output:

1500

result:

ok single line: '1500'

Subtask #6:

score: 1
Accepted

Test #83:

score: 1
Accepted
time: 0ms
memory: 3028kb

input:

2999
2 357 1236
1 1486 2365
2 539 1418
2 938 1817
1 1365 1544
1 2972 347
2 591 1470
1 2302 364
2 340 1219
1 790 1669
2 1585 2464
2 1824 2703
2 2900 275
2 1757 2636
2 1318 1497
1 1126 2005
2 1377 2256
1 2640 2819
2 925 1804
2 671 1550
1 212 1091
2 889 129
2 2990 365
2 1912 2091
2 1317 2196
2 2645 20
...

output:

1443

result:

ok single line: '1443'

Test #84:

score: 0
Accepted
time: 3ms
memory: 3048kb

input:

2997
1 1668 1610
1 1834 1381
1 1638 1955
2 415 357
2 1246 1188
1 1205 1147
1 1863 1045
1 207 149
2 2432 1685
2 2051 634
1 2627 1210
1 1439 2125
1 1897 480
2 1898 1840
2 2065 2007
2 2879 2821
2 901 843
1 1831 414
2 261 947
2 1815 2501
1 2174 2116
2 2516 2833
1 1691 274
1 2765 1947
1 1622 1564
2 2634 ...

output:

1427

result:

ok single line: '1427'

Test #85:

score: 0
Accepted
time: 1ms
memory: 2956kb

input:

3000
2 2157 51
2 1489 898
2 590 2130
2 567 2623
1 532 2588
1 429 283
2 934 343
1 2987 253
2 525 1164
2 232 2141
1 193 2102
1 2621 515
2 2477 264
1 1523 2335
1 1054 1693
2 833 2373
2 2803 69
1 208 2117
2 180 1720
1 223 2987
2 1412 2952
2 978 387
1 1160 1972
2 823 2363
1 1936 1790
1 1017 2557
1 2347 2...

output:

1398

result:

ok single line: '1398'

Test #86:

score: 0
Accepted
time: 3ms
memory: 3076kb

input:

3000
1 91 2839
1 2602 1577
1 1466 1931
2 1237 1540
1 2021 540
2 366 1559
1 712 2861
2 1184 135
2 549 1998
2 1812 1596
2 704 2771
1 340 2955
1 1769 226
2 373 1130
2 355 1797
1 2997 16
1 1971 668
2 126 2317
1 2177 621
2 2952 1571
1 20 1821
1 1660 279
1 2952 465
2 2029 2567
1 228 681
2 443 500
1 342 16...

output:

816

result:

ok single line: '816'

Test #87:

score: 0
Accepted
time: 1ms
memory: 2980kb

input:

2998
2 654 2494
2 2031 471
1 2781 173
1 2672 1490
1 1215 826
2 1961 2198
2 1771 500
2 2838 194
1 1660 2373
1 789 2440
2 363 1958
2 434 2811
2 1358 459
1 2495 1009
1 1163 17
1 1288 2688
2 2955 12
2 442 2667
1 2308 418
2 2967 1032
1 1806 344
2 209 2510
2 2498 458
1 2975 50
2 1377 2443
2 130 2602
2 690...

output:

1003

result:

ok single line: '1003'

Test #88:

score: 0
Accepted
time: 0ms
memory: 2996kb

input:

3000
1 2491 731
1 2824 1527
2 2955 22
2 2644 198
2 2384 1661
2 2774 2756
1 2416 2973
2 568 1078
2 345 2805
1 360 231
1 1221 2506
2 1838 453
1 143 372
1 2755 846
2 317 2861
2 1143 711
1 2762 317
1 2303 533
2 2929 597
1 2779 25
2 449 2411
1 67 1796
2 1128 50
1 1169 1760
1 179 2723
1 456 2748
1 836 222...

output:

1043

result:

ok single line: '1043'

Test #89:

score: 0
Accepted
time: 3ms
memory: 2960kb

input:

2999
1 2179 2179
1 141 2840
1 942 2972
1 2814 2279
2 154 135
1 302 2053
2 2938 1481
1 2427 1603
2 439 2891
2 257 2956
1 1984 990
2 1087 900
2 2770 972
1 855 379
2 2325 1417
2 2718 346
1 2507 363
1 1286 2350
2 791 2739
1 2996 396
1 426 1121
2 2458 1727
2 2102 132
2 2631 611
2 670 1516
2 2625 1717
1 3...

output:

1101

result:

ok single line: '1101'

Test #90:

score: 0
Accepted
time: 1ms
memory: 3216kb

input:

2998
2 281 1568
1 578 2015
1 137 361
1 2095 2319
1 1194 2631
2 1215 2652
1 1152 2439
2 873 1097
1 157 1444
2 2796 1037
2 1636 1860
1 362 1649
2 1834 2058
1 1477 2914
2 1291 1515
1 1440 2877
1 1423 2860
1 368 1805
2 1901 2125
2 1244 2531
2 522 746
2 1820 2044
1 776 2213
1 2667 2891
1 2565 2789
1 145 ...

output:

1472

result:

ok single line: '1472'

Test #91:

score: 0
Accepted
time: 3ms
memory: 3028kb

input:

3000
2 1206 2225
2 159 286
1 1092 931
2 1321 1618
1 535 2479
2 914 2858
1 538 665
1 971 2915
2 677 1696
1 735 1754
1 170 297
1 972 2916
2 698 537
2 528 655
2 1654 1781
2 1726 2745
1 441 568
1 2032 1871
2 347 1366
2 428 267
1 1758 2777
2 2426 2553
2 391 518
2 1874 1713
2 86 1105
1 2781 2908
2 1481 16...

output:

1450

result:

ok single line: '1450'

Test #92:

score: 0
Accepted
time: 3ms
memory: 3072kb

input:

2996
2 2511 1900
2 2372 381
1 1450 2416
1 2922 2149
2 662 2864
1 1348 2481
1 85 2945
2 179 588
2 1439 35
1 1693 2662
1 378 748
2 2484 1224
2 2804 197
2 2648 114
2 2939 1064
2 1994 1383
1 117 1562
1 2796 189
2 1761 1411
2 2710 103
2 2887 351
1 2672 483
2 11 2987
1 554 1523
1 381 1350
2 579 1791
1 212...

output:

1219

result:

ok single line: '1219'

Test #93:

score: 0
Accepted
time: 3ms
memory: 2920kb

input:

3000
1 949 2433
2 1788 2484
2 2767 642
1 2959 415
1 1498 1759
1 1210 1471
2 2413 43
2 901 995
2 2857 1564
2 2711 239
2 223 2033
2 425 2439
1 1862 1576
1 347 2679
1 1294 1222
1 515 2801
2 596 2557
1 2948 637
2 307 2805
2 1443 109
1 147 2999
1 2320 2408
2 623 2778
2 1963 2952
2 1860 636
1 806 2767
1 3...

output:

1208

result:

ok single line: '1208'

Test #94:

score: 0
Accepted
time: 0ms
memory: 3160kb

input:

3000
2 2442 54
2 1742 395
2 1400 865
1 1129 2135
1 1046 1225
2 1550 1640
1 896 2929
2 26 2601
2 806 1273
2 2561 1954
2 257 1923
2 2989 710
2 2435 1003
2 2710 647
2 806 1124
2 2999 1
2 1802 1195
2 2758 921
2 810 716
1 2162 2105
1 800 2733
1 2743 492
2 112 2378
2 440 286
2 2392 269
2 346 2823
2 733 80...

output:

0

result:

ok single line: '0'

Test #95:

score: 0
Accepted
time: 4ms
memory: 3088kb

input:

3000
2 591 2586
2 2235 2958
1 561 1948
1 2927 217
1 2524 135
2 1860 2730
1 2458 1556
1 2785 403
2 743 2633
1 2074 1012
1 81 2868
2 271 2929
2 204 2962
1 1327 797
1 2647 97
2 462 1936
2 1320 2726
1 188 1881
2 124 2813
2 324 1319
1 70 436
1 2748 64
2 2136 1772
1 2128 2316
2 1449 1581
1 2577 2609
1 196...

output:

743

result:

ok single line: '743'

Test #96:

score: 0
Accepted
time: 3ms
memory: 3352kb

input:

3000
1 2747 2412
1 2376 2731
2 324 2530
1 2098 153
1 1804 2505
1 283 2903
2 599 568
2 2879 36
1 2223 1953
2 377 1718
2 2462 1891
2 2448 1900
2 181 67
2 1485 551
2 117 1529
2 2357 1098
2 918 2901
1 2294 118
1 2519 635
1 815 214
2 1257 2721
2 2264 109
2 833 198
1 999 2986
2 1319 2143
2 1073 2997
2 17 ...

output:

0

result:

ok single line: '0'

Test #97:

score: 0
Accepted
time: 3ms
memory: 3028kb

input:

3000
2 63 63
2 1653 1653
2 2460 2460
2 710 710
2 994 994
1 2300 2300
2 409 409
2 1958 1958
2 735 735
1 2501 2501
2 2873 2873
1 2400 2400
2 829 829
2 2949 2949
1 2553 2553
1 2830 2830
2 2157 2157
1 2980 2980
1 1258 1258
1 2467 2467
1 2341 2341
1 1374 1374
1 2629 2629
1 2920 2920
1 1863 1863
1 2599 25...

output:

1483

result:

ok single line: '1483'

Subtask #7:

score: 1
Accepted

Test #98:

score: 1
Accepted
time: 26ms
memory: 2984kb

input:

80000
2 490148 530326
1 331678 371856
1 513421 553599
1 283158 304972
1 5942 987325
2 98119 138297
1 293776 839188
2 126545 148359
2 824409 846223
1 673068 713246
2 468238 74304
2 637962 678140
1 799539 405605
1 710219 750397
2 847127 887305
2 193850 234028
1 424112 30178
2 612314 652492
2 805109 84...

output:

39764

result:

ok single line: '39764'

Test #99:

score: 0
Accepted
time: 16ms
memory: 2952kb

input:

79995
2 511629 741101
2 996783 1607
1 135849 937147
1 746056 975528
1 4036 805334
1 174597 975895
1 170927 972225
1 776354 958612
1 686335 868593
2 184378 541125
2 102721 904019
1 23421 824719
1 306881 37666
1 160421 961719
1 273823 503295
1 164390 965688
2 113697 914995
1 604844 787102
1 942737 673...

output:

39705

result:

ok single line: '39705'

Test #100:

score: 0
Accepted
time: 18ms
memory: 3032kb

input:

79996
1 947281 878276
1 523661 690985
1 326256 493580
1 228145 395469
2 712515 232585
2 531027 462022
2 685929 853253
1 427604 594928
2 603862 771186
1 114330 979358
1 991590 922585
1 77827 942855
1 77498 942526
2 990968 35491
1 528425 48495
2 967984 461513
2 60756 999084
1 11180 949508
2 49262 9875...

output:

39475

result:

ok single line: '39475'

Test #101:

score: 0
Accepted
time: 24ms
memory: 4184kb

input:

80000
2 126114 849510
2 42267 841602
1 955788 60315
1 9623 514657
2 855709 72452
2 996807 264559
1 843661 360701
1 773669 213448
1 703764 98814
2 560455 36516
1 222261 710687
2 993720 9278
1 839163 332216
1 166253 962927
2 71448 856612
2 429492 205764
1 988886 32126
2 689941 689285
1 834557 683489
2...

output:

16905

result:

ok single line: '16905'

Test #102:

score: 0
Accepted
time: 19ms
memory: 3884kb

input:

79996
2 970841 511586
2 265888 682476
2 339531 162800
2 228561 360901
2 998930 583339
1 865949 627284
1 296703 543913
1 435987 451217
1 274079 686555
1 286955 702325
2 725787 474015
2 990381 923
1 128304 783552
1 12770 137029
2 67010 930492
1 654103 99735
1 616483 532837
1 471917 250815
2 565053 374...

output:

21808

result:

ok single line: '21808'

Test #103:

score: 0
Accepted
time: 23ms
memory: 3584kb

input:

79997
1 110948 668509
1 122856 938505
1 810804 7830
1 389912 916078
2 542824 54615
2 979395 29785
2 930621 132337
1 22993 964707
2 523684 967621
2 105286 455832
2 599430 102249
1 199149 644458
2 387122 89405
1 421390 435607
2 28797 706484
1 195033 659781
1 990149 225790
1 183882 717881
2 375851 2516...

output:

24333

result:

ok single line: '24333'

Test #104:

score: 0
Accepted
time: 22ms
memory: 3484kb

input:

80000
2 821882 180524
1 674323 644253
1 923087 558961
1 897040 24117
2 838420 483967
2 997591 81108
1 250281 758367
1 93910 971774
2 106882 734499
1 72590 980770
1 160045 544227
2 204044 643266
1 711577 336132
2 107664 853506
2 136720 976295
2 931979 21716
2 223677 499327
2 867623 152288
1 772542 39...

output:

26232

result:

ok single line: '26232'

Test #105:

score: 0
Accepted
time: 28ms
memory: 3452kb

input:

80000
2 37972 941181
1 331387 882970
1 990955 145547
1 933222 75462
1 571118 957198
1 201601 706821
2 367612 936912
2 32382 931652
1 999363 507
1 638279 669415
2 724596 434858
2 448923 781122
1 14052 256047
1 636527 274908
1 348646 850452
1 951606 417899
1 977193 29964
2 655016 200517
1 308328 44197...

output:

27460

result:

ok single line: '27460'

Test #106:

score: 0
Accepted
time: 13ms
memory: 3304kb

input:

79997
1 924290 92256
2 735629 15905
1 496365 276741
1 323226 919652
2 673585 109680
2 583317 673707
1 133803 919935
2 847202 216297
1 253354 790410
1 504089 895177
2 812432 153329
1 334932 566551
2 106120 446419
1 499950 41628
2 518777 256655
2 543957 97972
2 645796 359876
2 915427 241278
1 150794 4...

output:

28386

result:

ok single line: '28386'

Test #107:

score: 0
Accepted
time: 23ms
memory: 3608kb

input:

80000
1 736783 236524
2 85906 989350
2 382302 888877
2 976173 373806
1 137668 104867
2 753280 988586
2 2075 999984
1 999803 215072
2 173753 922805
1 609480 851219
2 327559 981741
1 998551 24974
2 604332 420086
1 81242 977462
2 191904 86968
2 39073 852268
1 5638 758405
1 992815 392488
2 595373 930029...

output:

29155

result:

ok single line: '29155'

Test #108:

score: 0
Accepted
time: 29ms
memory: 3388kb

input:

79999
1 307756 104288
1 396051 267141
2 20481 442435
2 672858 117700
2 915925 136023
1 980982 452263
2 930669 524308
1 488208 774399
2 618245 315245
1 361677 239690
2 584396 849475
1 26766 981624
2 923529 170701
1 278128 476212
1 48253 948249
2 350593 577831
2 444606 841886
1 244307 835844
2 967725 ...

output:

29843

result:

ok single line: '29843'

Test #109:

score: 0
Accepted
time: 19ms
memory: 2956kb

input:

79998
2 692254 411211
1 686233 479242
1 986449 705406
2 323560 42517
2 426917 219926
1 871451 590408
1 730477 449434
1 827888 546845
1 373071 166080
2 349432 68389
2 790200 509157
2 500210 219167
2 515843 234800
2 827223 546180
1 590667 309624
1 666662 385619
2 921964 640921
1 365586 84543
2 374571 ...

output:

39790

result:

ok single line: '39790'

Test #110:

score: 0
Accepted
time: 18ms
memory: 2908kb

input:

79996
2 805485 193845
1 933420 53579
1 849396 342065
2 820837 313506
2 987366 107525
2 759080 147440
1 516406 9075
2 981624 369984
2 789018 177378
1 613856 2216
1 973190 361550
1 985598 373958
2 975403 468072
2 962566 455235
1 954449 74608
1 977213 97372
2 888071 8230
2 972344 92503
1 539139 31808
1...

output:

39853

result:

ok single line: '39853'

Test #111:

score: 0
Accepted
time: 12ms
memory: 2900kb

input:

80000
1 920501 424670
1 436902 433944
2 669592 666634
2 581777 85946
1 60419 593012
2 279025 979505
1 264951 797544
2 217706 918186
2 60713 761193
2 737096 241265
1 16920 717400
1 362591 359633
2 317922 314964
1 988307 492476
2 555054 59223
2 175347 707940
2 470802 467844
1 282769 815362
2 937133 44...

output:

39811

result:

ok single line: '39811'

Test #112:

score: 0
Accepted
time: 27ms
memory: 3216kb

input:

80000
1 62289 992118
1 657622 796802
1 66891 963968
2 111082 911338
1 66656 963733
1 67361 997190
2 25559 922636
1 914689 47467
2 65269 962346
1 939014 71792
1 18073 915150
2 28267 958096
1 122312 261492
1 919892 52670
2 938501 71279
2 5089 902166
1 36547 966376
1 997650 130428
2 734666 873846
2 934...

output:

39701

result:

ok single line: '39701'

Test #113:

score: 0
Accepted
time: 12ms
memory: 3204kb

input:

80000
2 449024 103468
2 968208 998729
1 155771 450750
2 704789 50361
2 5641 995445
1 33158 981889
1 51727 312737
1 995787 260270
2 129245 777646
1 153961 390391
2 443452 97896
2 177305 825706
2 515933 984086
1 358756 563380
2 79535 968216
1 72229 720630
1 441810 322300
1 685383 565873
2 994221 47656...

output:

34520

result:

ok single line: '34520'

Test #114:

score: 0
Accepted
time: 26ms
memory: 3364kb

input:

80000
2 720831 934632
1 51990 854640
1 559610 202096
2 326704 40592
1 448228 25947
2 858503 426405
2 167201 489587
2 378325 383004
1 912292 480194
1 320837 936994
2 465163 316788
2 8200 702330
1 970958 408595
2 76908 908201
1 143474 723981
1 412283 203690
2 216806 301610
1 332508 913015
2 63061 8657...

output:

34510

result:

ok single line: '34510'

Test #115:

score: 0
Accepted
time: 23ms
memory: 3128kb

input:

80000
1 999907 999916
1 999978 4
2 54 32
2 26 66
1 72 999928
2 999912 81
2 999951 999969
1 999924 999935
1 18 999934
1 999933 41
2 999930 999994
1 86 999992
2 999937 999952
1 999952 59
1 75 3
2 43 72
1 94 31
2 999914 999993
1 999936 999912
1 53 54
2 19 16
2 999947 999929
1 999955 999991
2 39 15
1 99...

output:

39601

result:

ok single line: '39601'

Test #116:

score: 0
Accepted
time: 25ms
memory: 4200kb

input:

80000
1 785302 104100
2 119701 922225
2 808675 956972
2 893817 56219
1 383059 776561
2 798729 348828
2 136301 290548
2 742420 117203
2 959202 90669
2 835560 117065
1 444507 476255
1 462215 121272
2 104013 229232
2 471050 309022
2 772897 624967
1 542505 993032
1 882032 28911
2 541972 668151
2 972180 ...

output:

0

result:

ok single line: '0'

Test #117:

score: 0
Accepted
time: 23ms
memory: 4292kb

input:

80000
1 211178 984068
2 68880 955130
1 592677 588646
2 10449 923416
2 46305 643508
2 113629 86746
2 982678 86889
1 445013 976673
2 760090 480079
2 349295 947086
2 485584 913097
1 356768 424567
2 682726 19579
2 847954 274900
1 163845 867863
1 633470 88737
2 47953 853332
1 928771 113317
1 741481 24607...

output:

40000

result:

ok single line: '40000'

Test #118:

score: 0
Accepted
time: 12ms
memory: 4204kb

input:

80000
1 892666 697363
1 206589 936778
1 217157 704450
2 232888 3925
1 201704 908458
1 476805 292198
2 375018 982018
2 107092 937815
2 979720 31302
2 162833 601743
2 968429 602730
2 292316 115325
2 856319 110125
1 429044 442489
2 45677 506703
1 919068 17664
1 872392 13366
2 22612 407552
1 78594 74956...

output:

19985

result:

ok single line: '19985'

Test #119:

score: 0
Accepted
time: 37ms
memory: 5700kb

input:

80000
1 991344 9583
1 2645 938509
1 719303 213453
1 792056 442231
1 579089 16615
1 878810 397689
1 354543 853973
1 147093 734370
1 117569 183509
1 929858 10252
1 677746 476041
1 6396 994644
1 136139 416992
1 975805 511837
1 304192 853335
1 240544 650995
1 428745 603391
1 925010 156874
1 576338 81440...

output:

0

result:

ok single line: '0'

Test #120:

score: 0
Accepted
time: 32ms
memory: 5744kb

input:

80000
1 209911 933934
2 131562 253269
2 412547 977462
2 248317 842891
1 362439 186992
2 987787 127683
1 879341 298323
1 806397 460045
1 518894 129935
2 668083 718878
1 855316 699704
2 843641 91552
1 737844 443630
2 634716 637142
1 992100 188664
2 6144 336638
1 107680 625077
2 999798 62018
1 27154 97...

output:

0

result:

ok single line: '0'

Test #121:

score: 0
Accepted
time: 18ms
memory: 3028kb

input:

80000
2 774313 774313
1 729907 729907
2 29887 29887
1 950501 950501
1 488246 488246
1 121361 121361
2 839622 839622
1 65772 65772
2 559001 559001
2 71566 71566
2 224594 224594
2 850409 850409
1 682598 682598
2 844907 844907
1 25810 25810
1 830527 830527
2 490856 490856
2 348962 348962
1 629532 62953...

output:

40000

result:

ok single line: '40000'

Test #122:

score: 0
Accepted
time: 24ms
memory: 3208kb

input:

80000
1 134892 134892
1 313962 313962
1 686402 686402
1 263143 263143
1 837548 837548
1 903680 903680
1 416069 416069
1 102584 102584
2 977021 977021
2 356140 356140
1 737220 737220
2 757426 757426
2 473058 473058
1 998547 998547
2 616163 616163
2 557525 557525
1 533327 533327
1 346769 346769
1 7705...

output:

39862

result:

ok single line: '39862'

Test #123:

score: 0
Accepted
time: 2ms
memory: 3180kb

input:

2
1 948209 35566
1 916554 3911

output:

0

result:

ok single line: '0'

Subtask #8:

score: 1
Accepted

Test #124:

score: 1
Accepted
time: 36ms
memory: 2944kb

input:

200000
1 639606 164205
1 190717 994735
1 1159 805177
2 135116 939134
2 156596 960614
1 161190 965208
1 36977 840995
2 122084 990665
1 561803 923446
2 665694 429434
1 79614 948195
1 166387 970405
1 171507 975525
1 599349 363089
2 49050 917631
2 33840 969885
1 484904 248644
2 718674 243273
1 449141 21...

output:

99361

result:

ok single line: '99361'

Test #125:

score: 0
Accepted
time: 52ms
memory: 3024kb

input:

199995
1 962168 134259
1 642022 176430
2 703121 456532
2 297501 866095
1 953310 125401
1 838053 10144
2 489311 242722
1 844008 16099
1 828221 312
2 964799 136890
1 551121 33330
2 869961 42052
2 933849 105940
2 943303 115394
1 980818 152909
1 951513 123604
1 766513 643907
1 74505 945884
2 974183 1462...

output:

99270

result:

ok single line: '99270'

Test #126:

score: 0
Accepted
time: 23ms
memory: 3032kb

input:

199997
1 976962 249644
1 647986 999989
1 764952 407025
2 41637 999981
1 832023 104705
1 963138 101314
2 186764 257453
2 822381 95063
2 616334 687023
2 983129 121305
2 756380 29062
2 809061 81743
1 952167 224849
2 219199 632754
1 873921 861616
2 796848 69530
2 794226 66908
2 678863 320936
2 696162 76...

output:

98836

result:

ok single line: '98836'

Test #127:

score: 0
Accepted
time: 70ms
memory: 7272kb

input:

200000
2 985777 56903
2 405741 736557
1 174381 416822
1 123189 816279
2 974864 60646
2 673764 983516
1 355422 392330
2 364511 264054
1 574699 641303
2 781992 442045
1 276880 8284
2 548084 946038
1 545460 156786
2 912639 646952
1 249647 601187
1 750091 810076
1 144707 94175
2 263562 837532
2 960001 1...

output:

42664

result:

ok single line: '42664'

Test #128:

score: 0
Accepted
time: 60ms
memory: 5220kb

input:

200000
1 722296 946252
1 639239 118415
1 239466 108077
1 289045 911902
2 926024 559407
2 621232 237340
2 517283 440340
1 35285 728433
1 625970 850210
2 346279 922166
1 78826 402484
1 481218 935829
2 996335 17709
1 136780 943606
1 948101 20446
1 941791 383320
2 802481 164915
2 649081 252980
1 490577 ...

output:

54726

result:

ok single line: '54726'

Test #129:

score: 0
Accepted
time: 37ms
memory: 4920kb

input:

199995
2 319940 639597
1 357185 50560
2 391808 649656
2 131505 790427
1 9513 580206
2 996144 8611
1 1126 876566
1 62771 791701
2 172971 985495
2 128633 376261
1 278024 975967
2 158117 191551
1 435981 687638
1 246587 4204
2 68053 535203
2 860822 158607
2 579407 967667
2 392314 771866
1 657664 783152
...

output:

61276

result:

ok single line: '61276'

Test #130:

score: 0
Accepted
time: 61ms
memory: 4192kb

input:

199999
1 691823 547823
2 319233 640806
1 180535 692819
2 19037 869666
1 402860 972966
2 794539 122190
2 294260 445267
2 528057 903412
2 811599 119487
2 531415 324492
2 829720 34561
1 14779 974564
2 322710 243846
1 751098 161869
2 861716 657916
1 789872 689920
2 248876 755502
1 876279 653299
2 906255...

output:

65388

result:

ok single line: '65388'

Test #131:

score: 0
Accepted
time: 56ms
memory: 3956kb

input:

200000
1 109544 386448
1 828935 69105
2 482934 376010
2 721596 613317
2 933836 4626
1 7527 495849
1 886611 729303
1 465900 882472
1 43475 844989
1 385382 708923
1 984575 1642
2 209553 52643
1 751218 651498
2 586975 5502
2 171065 860214
2 820897 198536
2 957826 146115
1 260392 953881
2 271627 422818
...

output:

68786

result:

ok single line: '68786'

Test #132:

score: 0
Accepted
time: 59ms
memory: 3928kb

input:

200000
2 938267 94144
2 898162 116261
2 724166 534542
1 570676 890282
2 618203 592321
2 823303 865148
2 988657 64632
1 199122 498258
1 999302 6653
1 260776 721133
1 368708 964551
2 533348 872369
2 402066 985020
2 129128 985390
2 329569 724160
2 35756 937806
1 134455 767632
2 718726 779365
1 339907 1...

output:

71109

result:

ok single line: '71109'

Test #133:

score: 0
Accepted
time: 46ms
memory: 3880kb

input:

200000
1 834138 209033
2 127979 564
2 609747 948904
1 1484 740094
2 310702 937810
2 886091 578545
2 370612 904615
1 967718 76520
2 689006 94076
2 898735 126546
2 804720 544028
1 720088 733900
1 18238 975498
2 959521 132194
2 464190 98737
1 241500 90617
1 483173 624894
1 639508 673525
2 833101 462525...

output:

72867

result:

ok single line: '72867'

Test #134:

score: 0
Accepted
time: 41ms
memory: 3680kb

input:

200000
1 220927 432840
1 898199 385978
2 999835 3581
2 903513 18531
1 871226 492614
2 479351 884988
1 886380 794152
2 213641 487180
1 242 999023
1 4255 628830
2 971975 667681
2 170120 744573
2 811812 188760
2 73357 837214
2 204347 232894
1 85259 562637
2 813262 349947
1 441648 260731
1 833831 446945...

output:

74633

result:

ok single line: '74633'

Test #135:

score: 0
Accepted
time: 53ms
memory: 3184kb

input:

200000
1 532702 970663
1 687208 500422
1 147279 585240
1 422992 860953
2 89381 527342
1 156570 594531
1 374558 187772
2 320952 758913
2 381920 819881
1 525057 963018
2 931801 745015
2 598497 411711
2 893101 706315
2 870497 78089
1 333424 146638
1 512378 325592
1 512289 950250
1 827581 640795
1 33134...

output:

99619

result:

ok single line: '99619'

Test #136:

score: 0
Accepted
time: 45ms
memory: 2960kb

input:

199998
2 140836 756860
1 583019 304567
1 793717 515265
2 139406 755430
2 18755 634779
1 95739 711763
2 584487 306035
2 435716 157264
2 805084 526632
1 988379 91203
1 475191 196739
2 17225 633249
2 969449 72273
2 828896 550444
1 113936 729960
2 457368 178916
2 819854 541402
2 228608 844632
1 49784 66...

output:

99381

result:

ok single line: '99381'

Test #137:

score: 0
Accepted
time: 51ms
memory: 2904kb

input:

200000
1 235490 750272
1 937595 10437
2 469549 633690
2 938811 11653
2 217246 732028
1 970555 43397
1 150106 664888
1 685390 849531
1 196805 602798
2 63770 227911
2 983468 56310
2 142719 657501
1 968137 40979
2 115458 712055
1 183121 697903
1 99768 696365
2 304991 819773
1 661757 825898
2 968699 415...

output:

99789

result:

ok single line: '99789'

Test #138:

score: 0
Accepted
time: 35ms
memory: 3212kb

input:

200000
1 70782 13980
2 294954 901829
1 113976 624948
1 2429 409010
1 308825 493177
1 293551 900426
2 175441 782316
2 186346 592927
1 50746 657621
2 185759 696731
2 102285 45483
1 95816 502397
1 336993 743574
1 876586 819784
2 3992 514964
2 130018 736893
2 43101 227453
1 193508 800383
2 313550 256748...

output:

99705

result:

ok single line: '99705'

Test #139:

score: 0
Accepted
time: 59ms
memory: 3456kb

input:

199995
2 3647 989179
2 170444 838232
1 977118 27900
2 74046 853013
1 448461 422114
2 933605 112606
1 910918 136300
1 159556 879873
1 962690 13472
1 501975 102881
2 591014 585880
2 481229 476095
2 593678 278786
2 781 986313
2 893264 287180
2 264716 344507
2 235924 956241
1 512721 743738
2 219544 9901...

output:

86795

result:

ok single line: '86795'

Test #140:

score: 0
Accepted
time: 38ms
memory: 3376kb

input:

200000
2 703889 893315
2 966027 77041
1 639901 829327
2 968942 424430
2 430178 419506
2 84589 274015
1 147645 136973
2 862656 236085
1 451728 441056
1 416471 663136
1 187 997791
1 920469 128894
1 972557 720342
2 173780 545352
2 630340 57504
1 967579 4763
2 74412 172181
1 609015 382997
1 977092 14324...

output:

86905

result:

ok single line: '86905'

Test #141:

score: 0
Accepted
time: 46ms
memory: 2996kb

input:

200000
2 120 88
1 999872 999999
1 999907 112
1 122 61
2 999952 97
1 999913 999887
2 155 6
2 99 999936
2 87 999989
1 54 41
2 12 147
2 999978 74
2 999850 86
2 999979 999863
1 138 14
2 999911 999989
1 999952 999899
2 83 999965
1 999968 999896
1 999899 47
2 999923 4
2 62 83
2 999941 41
1 66 74
2 999916 ...

output:

99511

result:

ok single line: '99511'

Test #142:

score: 0
Accepted
time: 64ms
memory: 7332kb

input:

200000
1 264144 452331
1 24012 862398
1 161820 217179
1 680213 566497
2 132183 563595
2 876035 549935
2 531823 833511
1 760936 869247
1 152192 604240
2 258919 41153
1 996996 464511
1 597136 187654
2 752701 41428
1 40951 988905
1 175971 834403
1 120852 491303
1 913154 789558
2 485576 90637
1 483693 5...

output:

0

result:

ok single line: '0'

Test #143:

score: 0
Accepted
time: 63ms
memory: 7328kb

input:

200000
2 16975 994417
1 244942 946448
1 969667 10598
2 334420 650271
1 250193 531585
2 180688 840571
2 614175 11395
1 20427 997533
2 109573 758719
1 220476 369276
1 580175 622082
1 913402 143006
1 608481 197128
1 130741 239046
1 737078 469029
2 87243 994583
1 994003 102635
2 585301 903114
1 385880 5...

output:

100000

result:

ok single line: '100000'

Test #144:

score: 0
Accepted
time: 67ms
memory: 7424kb

input:

200000
1 452447 162555
1 439133 822110
2 964954 1604
2 561540 320054
2 797539 267693
1 659007 127471
2 111519 818663
2 300208 598168
1 586816 137527
2 564103 518981
1 192018 93629
1 911204 389497
2 418241 492781
2 360597 55211
1 93555 920001
2 698750 356830
1 980366 17575
1 300333 236161
1 529170 73...

output:

49928

result:

ok single line: '49928'

Test #145:

score: 0
Accepted
time: 74ms
memory: 12024kb

input:

200000
2 706098 171947
2 206866 385906
2 595029 307452
2 443888 726725
2 808818 186493
2 17831 709121
2 538315 835447
2 12471 824610
2 994909 6773
2 911123 583647
2 296989 931846
2 919039 171601
2 966581 369561
2 413910 782264
2 22816 973051
2 136898 934454
2 936453 128056
2 308922 958975
2 198731 9...

output:

0

result:

ok single line: '0'

Test #146:

score: 0
Accepted
time: 88ms
memory: 12012kb

input:

200000
1 634428 106661
2 367480 803157
1 178741 855484
2 595630 515597
1 192629 304615
2 808925 99990
2 455658 545789
2 826555 255793
1 999282 4237
2 989174 104874
1 53403 440358
2 163480 536321
1 808962 239847
2 443108 722020
1 157951 538705
2 983149 33642
1 53102 979788
1 6893 993771
1 7288 977602...

output:

0

result:

ok single line: '0'

Test #147:

score: 0
Accepted
time: 45ms
memory: 3096kb

input:

200000
1 78713 78713
2 141283 141283
1 58520 58520
1 540112 540112
2 107303 107303
2 970659 970659
1 799793 799793
2 366668 366668
1 535678 535678
1 486851 486851
1 685369 685369
2 319937 319937
1 106708 106708
1 551973 551973
1 74765 74765
1 322340 322340
2 201547 201547
2 280673 280673
1 385067 38...

output:

100000

result:

ok single line: '100000'

Test #148:

score: 0
Accepted
time: 45ms
memory: 2956kb

input:

200000
1 65513 65513
1 790189 790189
1 472392 472392
2 60597 60597
1 284347 284347
2 606859 606859
2 999966 999966
2 828233 828233
1 877724 877724
2 533101 533101
2 874486 874486
2 718679 718679
2 176518 176518
2 391232 391232
1 172210 172210
1 928652 928652
2 609461 609461
1 224237 224237
1 399092 ...

output:

99832

result:

ok single line: '99832'

Test #149:

score: 0
Accepted
time: 2ms
memory: 2904kb

input:

2
2 674542 909605
1 664998 900061

output:

1

result:

ok single line: '1'

Subtask #9:

score: 1
Accepted

Test #150:

score: 1
Accepted
time: 127ms
memory: 2948kb

input:

499997
2 22240 542834
1 17375 83647
2 416557 937151
2 55428 576022
2 768119 834391
1 951337 524096
1 362059 882653
2 389397 909991
2 794570 367329
2 806971 583095
1 797600 863872
1 487687 60446
1 381521 902115
2 712491 285250
1 91192 611786
2 119874 640468
2 900591 473350
2 281654 802248
1 352518 87...

output:

248975

result:

ok single line: '248975'

Test #151:

score: 0
Accepted
time: 122ms
memory: 2956kb

input:

500000
1 213438 629382
2 751408 353298
2 402750 818694
1 157962 608679
1 928866 8434
2 552988 142608
2 924734 4302
2 248376 664320
2 758678 348298
1 558816 974760
1 910481 765357
1 457574 873518
2 17546 665439
2 149761 797654
1 474495 890439
1 145619 561563
1 511300 962017
1 337696 753640
1 18485 70...

output:

248890

result:

ok single line: '248890'

Test #152:

score: 0
Accepted
time: 139ms
memory: 2948kb

input:

499996
1 114717 202311
1 209557 328864
2 918155 22936
1 584265 660476
2 761581 552706
1 114015 233322
1 764292 294884
2 700645 788239
2 990884 559933
2 403612 194737
1 907648 12429
2 457559 248684
1 771708 562833
1 281806 401113
1 698458 817765
1 453771 979561
2 579938 667532
2 144372 231966
2 20873...

output:

248101

result:

ok single line: '248101'

Test #153:

score: 0
Accepted
time: 173ms
memory: 12644kb

input:

499995
2 668488 308874
2 347781 521999
2 971232 467404
2 903157 268263
1 102461 821099
2 460605 911072
1 997894 8186
1 997011 45595
2 880861 872799
2 1372 475034
1 948439 757043
1 366595 910887
1 523826 798776
2 22322 629338
1 420890 759124
2 19046 530098
2 992908 221
2 890156 109179
1 493432 938162...

output:

109493

result:

ok single line: '109493'

Test #154:

score: 0
Accepted
time: 172ms
memory: 7784kb

input:

499996
2 970686 107801
1 298203 495601
1 986123 183923
2 685343 481726
1 888501 13803
1 66708 680886
2 549178 334692
1 915803 146196
2 116519 105448
2 225963 467329
2 300286 745917
2 84693 808854
2 381170 902436
2 940925 342340
1 884785 254901
1 303573 438902
2 997306 6761
2 966698 104312
1 940409 2...

output:

153902

result:

ok single line: '153902'

Test #155:

score: 0
Accepted
time: 155ms
memory: 5840kb

input:

499997
2 106387 778184
1 996386 241032
2 29057 828036
1 763748 408267
2 518932 164993
2 742840 86372
2 995366 597971
1 887520 27722
2 71824 168989
1 362687 948081
2 190476 948761
2 942462 104613
2 879691 834833
1 137789 982429
1 500872 969798
2 262445 649149
1 849989 826877
1 209949 693497
2 63724 1...

output:

172105

result:

ok single line: '172105'

Test #156:

score: 0
Accepted
time: 148ms
memory: 5208kb

input:

499998
2 126258 954928
2 984353 23286
1 875565 730485
1 923602 194959
2 212411 549029
2 34662 541274
2 199784 283155
2 434540 442792
1 574 950964
2 292633 908330
1 355775 746745
1 442705 490834
1 28597 356177
1 946480 173704
2 83848 948663
1 637904 535224
2 905753 621926
2 96036 890030
2 46712 98751...

output:

183343

result:

ok single line: '183343'

Test #157:

score: 0
Accepted
time: 112ms
memory: 3020kb

input:

499998
1 27842 535039
1 489108 996305
2 921148 635104
2 206560 713757
1 941615 655571
2 415955 923152
2 626903 340859
2 800292 26484
2 423711 137667
1 169836 677033
2 990286 704242
2 95126 602323
2 132157 639354
2 245611 752808
1 30935 538132
2 299199 13155
2 359293 866490
2 115255 622452
2 128489 6...

output:

249469

result:

ok single line: '249469'

Test #158:

score: 0
Accepted
time: 123ms
memory: 3060kb

input:

499997
1 361986 199454
2 347695 185163
1 655474 492942
1 433212 976630
1 401687 239155
2 310627 148095
2 373143 916561
2 543317 193729
2 624423 461891
2 263849 101317
2 338726 882144
2 28502 571920
1 169405 712823
2 691677 529145
2 463085 113497
2 327505 105618
2 518466 355934
1 186540 24008
1 39948...

output:

249573

result:

ok single line: '249573'

Test #159:

score: 0
Accepted
time: 145ms
memory: 3696kb

input:

499998
1 846935 283402
2 239430 816310
2 210133 907143
2 611398 149577
2 15047 943074
1 43003 990371
2 67807 839234
2 487611 25790
1 839940 378119
2 710215 196480
1 490123 2495
1 9325 980573
1 547975 983392
1 404744 842308
1 644087 490961
2 476291 114912
1 15379 986058
1 167462 534625
2 606460 2355
...

output:

219020

result:

ok single line: '219020'

Test #160:

score: 0
Accepted
time: 141ms
memory: 3760kb

input:

499996
2 786841 518957
2 434016 295113
1 415277 317680
2 257365 750721
1 769953 937443
2 585726 992840
1 942991 675107
2 841577 494531
2 417064 232009
2 925419 265300
2 869324 190339
1 26803 363876
1 834709 10982
1 900262 102895
2 911424 180243
1 437934 21099
1 441273 150968
2 809088 434745
1 589894...

output:

219348

result:

ok single line: '219348'

Test #161:

score: 0
Accepted
time: 114ms
memory: 3024kb

input:

500000
2 142 999843
1 999973 187
2 999936 162
1 189 124
2 109 215
1 999783 999966
2 999942 64
2 239 999936
2 999771 81
1 49 107
2 114 999969
1 174 999777
1 245 0
2 157 999842
2 999989 999849
2 151 163
2 223 145
2 999992 78
2 999805 999763
2 999858 999954
2 32 999917
1 26 77
1 118 44
2 999785 65
2 99...

output:

249001

result:

ok single line: '249001'

Test #162:

score: 0
Accepted
time: 173ms
memory: 13172kb

input:

500000
1 443711 810149
1 936737 227982
2 998312 43513
1 293692 386097
1 142076 861983
1 878966 236033
2 424788 370590
2 177290 686927
2 503883 112492
1 49440 360247
2 268075 934639
1 572206 317282
2 63989 589060
1 25791 490629
2 128838 711093
1 31896 993671
2 900607 369692
2 568691 722471
2 716623 4...

output:

250000

result:

ok single line: '250000'

Test #163:

score: 0
Accepted
time: 197ms
memory: 23736kb

input:

500000
2 97417 925504
2 8156 480461
2 624250 952886
2 563700 766430
2 324237 333997
2 306692 211879
2 248976 864779
2 652683 624674
2 142054 837315
2 353489 905585
2 307049 810150
2 629313 450540
2 560964 70310
2 14369 877241
2 932448 6532
2 170603 985693
2 848752 142901
2 938611 698740
2 1271 67812...

output:

0

result:

ok single line: '0'

Test #164:

score: 0
Accepted
time: 107ms
memory: 3056kb

input:

500000
2 936746 936746
2 478058 478058
1 300492 300492
1 252211 252211
2 596500 596500
2 925193 925193
2 947057 947057
2 731078 731078
1 733065 733065
1 814930 814930
2 965256 965256
2 538361 538361
1 803906 803906
1 376131 376131
1 370166 370166
2 537932 537932
1 453478 453478
1 417337 417337
2 819...

output:

250000

result:

ok single line: '250000'

Test #165:

score: 0
Accepted
time: 2ms
memory: 2908kb

input:

1
2 325461 129164

output:

0

result:

ok single line: '0'

Test #166:

score: 0
Accepted
time: 2ms
memory: 3216kb

input:

97
2 319999 467140
1 968229 24482
2 240 851896
1 14127 385833
1 429633 801339
2 978900 35153
1 262696 436655
2 46703 418409
2 306490 678196
2 569698 743657
1 709600 883559
2 23020 196979
2 971646 27899
2 30922 662827
2 478815 850521
2 263658 635364
1 538416 994386
2 24062 395768
1 638206 812165
1 63...

output:

42

result:

ok single line: '42'

Subtask #10:

score: 1
Accepted

Test #167:

score: 1
Accepted
time: 120ms
memory: 2948kb

input:

499996
2 39806 661247
1 198235 819676
1 156487 777928
1 45648 667089
2 57612 87082
1 256299 987288
2 358148 979589
1 377036 998477
1 130450 947141
2 4913 626354
1 369985 991426
2 176166 797607
1 247057 868498
1 24245 840936
2 147451 768892
1 22764 644205
1 133292 949983
1 146360 963051
1 343061 9645...

output:

249266

result:

ok single line: '249266'

Test #168:

score: 0
Accepted
time: 105ms
memory: 3212kb

input:

500000
2 293774 818406
2 755787 390633
1 516381 108095
2 854328 446042
1 38571 777736
1 527998 119712
2 496380 287437
2 501163 104450
2 527772 625509
2 210723 1780
1 96769 835934
1 674398 266112
1 39457 953338
1 469785 61499
2 57479 971360
1 293393 818025
1 611413 203127
2 68542 982423
1 25123 54975...

output:

249201

result:

ok single line: '249201'

Test #169:

score: 0
Accepted
time: 132ms
memory: 2960kb

input:

500000
1 16896 657581
2 123934 866146
1 465421 208430
1 461159 350004
2 680438 871460
1 591189 72864
1 568238 951904
1 697281 54695
1 344115 87124
1 138139 880351
1 745046 488055
1 584481 327490
1 571916 802609
2 815963 106778
2 320573 639232
2 462075 653097
2 426621 5948
2 761172 504181
2 752875 33...

output:

248558

result:

ok single line: '248558'

Test #170:

score: 0
Accepted
time: 170ms
memory: 8804kb

input:

500000
2 780304 947919
1 491473 181308
1 1948 380213
2 237499 915339
1 452958 489169
1 390166 544561
1 799745 202832
1 350780 332272
1 148713 914166
1 789280 75263
1 868079 84735
1 188985 505459
1 721208 869227
2 80757 236270
2 961256 382435
2 445549 200342
1 352702 388353
2 29486 861031
1 23811 914...

output:

138511

result:

ok single line: '138511'

Test #171:

score: 0
Accepted
time: 159ms
memory: 7424kb

input:

499998
1 714629 649236
2 365899 444903
1 220851 763979
1 679324 25582
2 997858 240964
2 600004 352009
1 197551 620685
1 411450 74823
1 982263 60396
1 48834 459060
1 990566 469741
2 193961 477126
1 896705 2763
1 979326 2631
2 38138 148798
2 268691 98856
2 481318 52209
1 890666 20080
1 795903 864326
1...

output:

164451

result:

ok single line: '164451'

Test #172:

score: 0
Accepted
time: 154ms
memory: 5400kb

input:

500000
2 962158 546660
1 389386 100354
1 803036 338051
1 955215 27354
2 888231 604662
1 126777 449858
1 329725 848156
2 332950 58116
1 512318 459988
1 862481 555710
1 106879 268560
1 712893 433729
1 504236 30349
2 490815 473802
2 738539 43539
2 969553 142689
1 123233 692115
2 488384 156622
2 865600 ...

output:

178171

result:

ok single line: '178171'

Test #173:

score: 0
Accepted
time: 138ms
memory: 5048kb

input:

499997
2 44039 296563
2 769632 439253
2 928847 315438
1 804288 476786
1 897586 75067
2 425229 731958
1 660831 145310
1 954019 346771
1 789113 210586
2 27636 630218
1 997024 10380
2 165843 245470
1 416710 883160
2 748435 75968
1 7761 993470
2 406701 38751
2 983381 279
2 200153 91372
2 741666 148786
2...

output:

186693

result:

ok single line: '186693'

Test #174:

score: 0
Accepted
time: 110ms
memory: 2916kb

input:

499997
2 141244 712554
1 783953 976657
2 17604 588914
2 335373 906683
2 341093 912403
1 77038 648348
2 125072 696382
1 678814 871518
2 949311 539626
2 585007 175322
2 142522 335226
2 105127 676437
1 99152 670462
1 220978 413682
2 305783 877093
2 342328 913638
2 343316 914626
1 467767 660471
2 72425 ...

output:

249586

result:

ok single line: '249586'

Test #175:

score: 0
Accepted
time: 117ms
memory: 2964kb

input:

500000
2 949772 158258
1 83746 931758
1 25007 873019
1 148830 564044
1 865851 74337
1 95335 943347
2 111849 959861
2 245998 524687
1 381464 796678
2 81895 497109
2 97333 512547
2 692837 407943
2 51027 329716
2 268886 684100
1 644218 359324
1 839624 48110
2 348917 64023
2 622749 337855
1 492840 90805...

output:

249536

result:

ok single line: '249536'

Test #176:

score: 0
Accepted
time: 129ms
memory: 3720kb

input:

499996
1 777512 794765
2 690859 55708
1 24166 786342
1 50596 849054
2 655791 23347
2 46233 816429
2 75573 924524
1 623273 10846
2 548677 565930
2 13911 31164
1 920872 81974
1 634288 321428
1 767432 281389
2 803713 75571
2 692169 79742
2 662071 954027
2 649159 444165
2 507568 826621
1 933001 2327
1 4...

output:

219096

result:

ok single line: '219096'

Test #177:

score: 0
Accepted
time: 129ms
memory: 3736kb

input:

500000
2 51789 658889
2 812509 63611
1 75538 26416
2 261838 634834
1 227384 852081
2 97127 974365
2 323202 696198
2 197028 821725
2 443809 724787
1 122336 938673
2 191666 997470
1 846263 70874
1 851798 576778
2 972248 742607
2 850531 56815
2 23225 937398
2 14571 909197
1 403298 352849
1 928984 31629...

output:

218792

result:

ok single line: '218792'

Test #178:

score: 0
Accepted
time: 169ms
memory: 13140kb

input:

500000
1 968402 806647
1 998994 112474
2 522443 207705
2 502872 940766
2 223267 767775
2 583070 475694
2 392359 410095
1 927141 180035
2 919923 541597
2 32921 859757
2 546260 7656
1 56922 972661
2 348118 472432
1 871430 475763
2 29980 914870
2 851110 498711
1 236673 629737
2 15419 895570
2 166995 44...

output:

0

result:

ok single line: '0'

Test #179:

score: 0
Accepted
time: 164ms
memory: 13200kb

input:

500000
2 153127 962566
2 14962 998794
2 47432 827658
2 189760 707248
2 778055 600872
1 254666 827781
1 26832 888604
2 432061 75483
1 539114 47772
2 47 972549
1 16085 865936
2 959140 347719
1 270711 776263
1 953551 101382
1 276538 131323
2 30789 969829
2 93627 970491
1 94351 650353
1 35793 892317
1 8...

output:

125030

result:

ok single line: '125030'

Test #180:

score: 0
Accepted
time: 211ms
memory: 23740kb

input:

500000
1 301503 816203
1 907718 135812
2 642421 448596
2 743552 300850
2 610167 888014
1 568533 961481
2 139823 790155
1 254622 49368
1 487819 239273
1 25492 660041
1 122375 951358
1 623923 706342
1 884447 206414
1 841407 323422
2 819807 92878
1 789010 866792
1 161464 956322
2 157532 786172
1 872678...

output:

0

result:

ok single line: '0'

Test #181:

score: 0
Accepted
time: 135ms
memory: 3052kb

input:

500000
2 380949 380949
1 218012 218012
2 488892 488892
2 828130 828130
1 165726 165726
1 363260 363260
2 268993 268993
1 25509 25509
1 411197 411197
2 173256 173256
2 33744 33744
1 101281 101281
1 445400 445400
2 531463 531463
2 94934 94934
1 310850 310850
1 55317 55317
1 321259 321259
2 908980 9089...

output:

249782

result:

ok single line: '249782'

Test #182:

score: 0
Accepted
time: 2ms
memory: 2956kb

input:

10
1 839421 107323
1 948109 33759
1 935719 21369
1 988737 181467
1 7296 919882
1 820496 88398
1 949048 34698
1 989691 75341
1 807471 201
2 939436 207338

output:

1

result:

ok single line: '1'

Test #183:

score: 0
Accepted
time: 2ms
memory: 3044kb

input:

995
2 657674 424848
2 468851 236025
1 998218 8237
1 468189 528641
1 997146 7165
1 676981 444155
1 835120 544920
1 996427 6446
2 723579 54569
1 994538 4557
2 999881 9900
1 744935 512109
1 830497 720769
2 824256 591430
1 785284 13199
1 86700 147152
2 991203 1222
1 300802 67976
1 473339 240513
1 248798...

output:

465

result:

ok single line: '465'