summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--get_mode.cpp56
-rw-r--r--testdata/empty0
-rw-r--r--testdata/longdata5000
-rw-r--r--testdata/test1000
-rw-r--r--testdata/test11000
-rw-r--r--testdata/test21000
-rw-r--r--write_data.cpp18
7 files changed, 8074 insertions, 0 deletions
diff --git a/get_mode.cpp b/get_mode.cpp
new file mode 100644
index 0000000..edf0958
--- /dev/null
+++ b/get_mode.cpp
@@ -0,0 +1,56 @@
+
+#include "statistics.h"
+
+using namespace std;
+
+float get_mode(const char *filename)
+{
+ ifstream in;
+ in.open(filename);
+
+ unsigned size = 1024;
+ int *data = new int[size];
+
+ int i = 0;
+ int max = 0;
+
+ while (!in.eof()) {
+ in >> data[i];
+ if (data[i] > max)
+ max = data[i];
+ i++;
+
+ if (i >= size) { // have to reallocate array if we get too big
+ size *= 2;
+ int *newdata = new int[size];
+ for (int j = 0; j <= i; j++)
+ newdata[j] = data[j];
+ delete data;
+ data = newdata;
+ }
+ }
+ i--;
+ int *freq = new int[i];
+
+ int j;
+ for (j = 0; j < i; j++)
+ freq[j] = 0;
+
+ for (j = 0; j < i; j++)
+ freq[data[j]]++;
+
+ float mode = 0;
+ max = 0;
+ for (j = 0; j < i; j++) {
+ if (freq[j] > max) {
+ max = freq[j];
+ mode = (float)j;
+ }
+ }
+
+ in.close();
+ delete freq;
+ delete data;
+
+ return mode;
+}
diff --git a/testdata/empty b/testdata/empty
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/testdata/empty
diff --git a/testdata/longdata b/testdata/longdata
new file mode 100644
index 0000000..fc6175d
--- /dev/null
+++ b/testdata/longdata
@@ -0,0 +1,5000 @@
+381
+482
+344
+90
+230
+78
+419
+383
+309
+103
+15
+121
+373
+350
+164
+313
+82
+1
+128
+456
+305
+478
+365
+433
+59
+211
+383
+283
+85
+428
+221
+466
+156
+311
+303
+386
+389
+221
+268
+445
+70
+30
+65
+189
+126
+476
+248
+208
+478
+376
+164
+28
+354
+275
+461
+159
+486
+343
+443
+70
+16
+410
+283
+419
+220
+85
+50
+356
+52
+319
+300
+370
+95
+111
+305
+221
+86
+53
+430
+63
+429
+340
+91
+28
+361
+298
+188
+347
+387
+130
+163
+404
+39
+192
+68
+5
+23
+119
+361
+76
+184
+407
+192
+279
+17
+497
+500
+104
+296
+175
+414
+225
+261
+252
+500
+122
+296
+187
+215
+183
+63
+378
+333
+349
+317
+401
+355
+340
+19
+462
+416
+203
+369
+354
+228
+386
+351
+228
+236
+146
+149
+150
+117
+411
+148
+117
+32
+444
+50
+247
+373
+361
+371
+205
+456
+187
+353
+56
+27
+372
+18
+189
+322
+133
+43
+296
+265
+140
+23
+1
+32
+420
+398
+397
+330
+292
+260
+362
+235
+56
+108
+355
+417
+225
+59
+373
+413
+412
+429
+440
+30
+193
+375
+98
+72
+164
+394
+338
+304
+164
+85
+83
+83
+229
+480
+413
+20
+239
+20
+1
+295
+375
+356
+459
+99
+416
+77
+258
+73
+252
+197
+350
+192
+319
+448
+264
+483
+88
+101
+33
+252
+433
+363
+81
+161
+342
+240
+181
+327
+260
+183
+368
+381
+38
+72
+226
+200
+149
+485
+20
+148
+428
+370
+340
+246
+318
+103
+476
+406
+452
+8
+404
+384
+371
+231
+45
+459
+471
+473
+31
+477
+155
+399
+103
+441
+218
+329
+387
+113
+313
+407
+261
+241
+277
+100
+233
+341
+204
+208
+493
+155
+463
+396
+285
+333
+373
+330
+37
+343
+303
+68
+65
+204
+214
+168
+391
+178
+497
+278
+291
+310
+431
+52
+297
+207
+152
+29
+294
+356
+485
+286
+257
+447
+428
+42
+26
+300
+118
+63
+389
+167
+379
+454
+372
+339
+121
+262
+16
+365
+286
+307
+174
+217
+359
+217
+170
+11
+493
+211
+113
+477
+497
+117
+424
+171
+406
+450
+217
+23
+259
+106
+438
+384
+59
+55
+222
+428
+317
+238
+292
+350
+292
+212
+313
+150
+175
+229
+408
+167
+440
+268
+144
+183
+385
+314
+354
+36
+9
+317
+306
+14
+423
+243
+399
+229
+298
+120
+403
+362
+105
+194
+458
+397
+152
+270
+293
+327
+499
+201
+240
+185
+469
+384
+368
+99
+444
+468
+135
+453
+284
+441
+468
+207
+431
+112
+182
+228
+232
+84
+336
+83
+24
+293
+480
+176
+62
+273
+249
+308
+220
+489
+493
+188
+119
+360
+33
+62
+73
+168
+262
+357
+355
+476
+310
+285
+87
+492
+260
+65
+322
+95
+149
+346
+389
+128
+21
+197
+147
+16
+4
+367
+5
+497
+301
+371
+102
+80
+179
+422
+495
+441
+279
+350
+416
+335
+381
+249
+73
+387
+315
+395
+483
+464
+241
+117
+338
+8
+314
+486
+25
+65
+98
+277
+308
+146
+394
+157
+226
+72
+78
+468
+13
+103
+317
+175
+439
+444
+425
+11
+331
+239
+406
+59
+449
+146
+423
+286
+155
+236
+17
+427
+47
+363
+450
+356
+255
+343
+12
+227
+415
+90
+194
+174
+194
+10
+96
+379
+201
+267
+390
+278
+252
+295
+337
+200
+188
+259
+486
+89
+241
+250
+262
+289
+112
+211
+391
+367
+53
+149
+93
+214
+486
+288
+389
+179
+44
+231
+304
+492
+498
+193
+269
+249
+235
+105
+195
+169
+110
+180
+258
+98
+176
+19
+133
+288
+477
+23
+401
+29
+172
+241
+490
+157
+275
+378
+83
+319
+108
+387
+57
+352
+327
+326
+347
+61
+178
+41
+477
+288
+222
+481
+386
+144
+500
+18
+433
+222
+288
+79
+498
+206
+320
+487
+364
+94
+111
+193
+160
+219
+326
+217
+318
+152
+42
+164
+460
+220
+206
+182
+255
+174
+162
+387
+318
+408
+152
+497
+129
+440
+76
+126
+146
+142
+113
+256
+237
+224
+195
+397
+189
+20
+360
+253
+420
+402
+418
+125
+369
+123
+308
+123
+43
+470
+256
+361
+378
+408
+104
+6
+348
+180
+380
+240
+322
+493
+242
+305
+463
+437
+448
+398
+203
+307
+151
+122
+456
+68
+495
+324
+438
+302
+193
+481
+17
+449
+87
+395
+357
+191
+148
+451
+117
+274
+190
+186
+12
+178
+491
+475
+114
+439
+118
+63
+492
+269
+433
+447
+83
+427
+270
+20
+475
+209
+247
+492
+158
+81
+133
+261
+18
+27
+458
+136
+301
+394
+68
+313
+71
+58
+33
+432
+243
+151
+495
+235
+421
+427
+181
+3
+353
+198
+271
+73
+153
+264
+65
+57
+345
+445
+318
+364
+472
+21
+246
+18
+415
+314
+77
+486
+118
+110
+163
+362
+7
+158
+343
+174
+84
+270
+178
+184
+214
+195
+3
+368
+459
+68
+425
+304
+259
+490
+414
+477
+257
+159
+495
+172
+473
+71
+404
+337
+428
+67
+198
+436
+225
+287
+109
+55
+57
+33
+486
+271
+475
+490
+385
+180
+304
+56
+230
+310
+292
+143
+286
+48
+48
+27
+220
+267
+345
+124
+103
+273
+438
+302
+455
+409
+335
+310
+464
+392
+90
+196
+410
+311
+432
+40
+491
+482
+96
+220
+291
+134
+363
+77
+183
+411
+351
+403
+424
+195
+273
+27
+214
+210
+75
+415
+118
+410
+225
+329
+48
+61
+271
+204
+372
+202
+244
+363
+183
+87
+82
+475
+221
+192
+298
+404
+349
+148
+53
+273
+343
+72
+300
+304
+29
+375
+218
+147
+30
+443
+222
+78
+250
+493
+282
+122
+441
+273
+485
+124
+360
+313
+345
+327
+251
+142
+231
+100
+36
+30
+119
+125
+102
+419
+429
+131
+39
+147
+25
+316
+336
+247
+141
+86
+487
+423
+455
+427
+442
+185
+297
+47
+498
+388
+375
+496
+29
+352
+95
+312
+382
+214
+438
+484
+379
+112
+362
+164
+259
+387
+480
+342
+380
+120
+174
+112
+290
+128
+39
+478
+313
+82
+25
+56
+471
+400
+298
+246
+251
+393
+305
+379
+353
+242
+362
+478
+100
+223
+388
+360
+356
+114
+448
+236
+481
+121
+348
+16
+496
+133
+495
+54
+463
+19
+357
+433
+165
+155
+425
+416
+294
+229
+294
+394
+217
+402
+371
+318
+372
+259
+424
+227
+119
+371
+209
+99
+238
+304
+116
+480
+183
+110
+33
+145
+129
+136
+324
+294
+291
+496
+456
+332
+471
+496
+225
+188
+143
+342
+5
+14
+347
+175
+489
+466
+45
+444
+65
+29
+247
+181
+8
+177
+37
+288
+68
+413
+424
+139
+453
+462
+134
+408
+39
+104
+149
+264
+292
+292
+352
+43
+307
+199
+218
+41
+411
+9
+485
+476
+285
+479
+403
+39
+402
+186
+73
+470
+98
+498
+108
+50
+205
+489
+204
+244
+93
+353
+254
+131
+145
+105
+422
+198
+50
+386
+486
+462
+142
+470
+183
+173
+194
+86
+213
+95
+272
+286
+312
+117
+29
+420
+167
+481
+155
+372
+471
+495
+471
+224
+125
+362
+76
+293
+59
+126
+426
+291
+87
+67
+7
+271
+240
+201
+103
+199
+43
+121
+486
+355
+238
+261
+20
+406
+242
+175
+23
+212
+169
+494
+183
+41
+102
+259
+80
+408
+131
+5
+199
+466
+319
+206
+483
+59
+153
+85
+4
+196
+453
+490
+297
+191
+498
+64
+343
+486
+486
+112
+444
+402
+352
+126
+189
+454
+131
+269
+362
+9
+21
+60
+475
+340
+12
+457
+145
+165
+288
+150
+108
+240
+386
+151
+431
+383
+215
+19
+368
+448
+131
+312
+349
+484
+184
+37
+437
+62
+52
+298
+71
+320
+104
+45
+160
+116
+1
+51
+28
+35
+201
+136
+275
+334
+287
+453
+216
+249
+472
+331
+443
+103
+389
+291
+333
+319
+74
+269
+381
+373
+314
+452
+193
+418
+243
+99
+281
+491
+150
+309
+25
+98
+445
+301
+432
+478
+253
+394
+473
+471
+471
+415
+73
+359
+452
+406
+425
+272
+422
+305
+145
+235
+3
+338
+399
+246
+437
+179
+237
+333
+234
+262
+431
+425
+309
+362
+149
+61
+256
+121
+279
+473
+283
+98
+332
+234
+4
+256
+6
+172
+307
+398
+153
+310
+235
+51
+56
+418
+478
+293
+250
+458
+301
+428
+383
+110
+289
+31
+418
+291
+399
+196
+10
+181
+295
+342
+162
+45
+344
+168
+464
+150
+65
+116
+207
+46
+414
+263
+210
+137
+302
+206
+95
+349
+133
+478
+459
+169
+255
+123
+206
+153
+65
+216
+335
+106
+304
+497
+398
+147
+411
+361
+44
+222
+477
+251
+268
+137
+260
+478
+274
+61
+183
+369
+156
+63
+92
+115
+232
+347
+485
+438
+0
+296
+401
+81
+403
+204
+77
+300
+352
+234
+161
+142
+456
+384
+393
+470
+267
+152
+447
+41
+460
+376
+156
+115
+439
+249
+477
+417
+95
+207
+101
+342
+3
+1
+423
+406
+205
+246
+452
+303
+480
+359
+445
+435
+490
+83
+404
+256
+235
+96
+297
+441
+219
+454
+56
+404
+449
+32
+67
+43
+487
+168
+132
+490
+169
+54
+141
+120
+301
+92
+424
+26
+198
+114
+208
+187
+198
+358
+443
+433
+201
+487
+374
+420
+186
+176
+69
+134
+455
+136
+177
+441
+304
+309
+176
+219
+110
+317
+340
+157
+410
+9
+430
+354
+123
+137
+40
+67
+242
+229
+247
+443
+215
+367
+108
+401
+42
+177
+34
+243
+60
+459
+184
+364
+13
+360
+330
+370
+424
+416
+26
+333
+425
+457
+186
+294
+340
+473
+108
+81
+201
+355
+23
+163
+221
+378
+63
+263
+55
+345
+252
+362
+49
+436
+225
+309
+42
+301
+179
+466
+216
+205
+44
+387
+408
+477
+428
+248
+449
+35
+75
+396
+390
+346
+58
+357
+223
+369
+119
+24
+460
+117
+386
+8
+53
+358
+317
+342
+158
+496
+53
+121
+448
+97
+7
+101
+320
+435
+95
+14
+216
+171
+410
+352
+16
+215
+208
+486
+83
+73
+10
+42
+191
+142
+297
+491
+500
+113
+332
+405
+356
+131
+25
+303
+228
+279
+150
+294
+461
+246
+308
+176
+417
+464
+28
+179
+178
+236
+411
+7
+310
+167
+49
+0
+310
+92
+237
+55
+206
+68
+460
+61
+199
+231
+110
+173
+10
+260
+213
+471
+252
+20
+146
+168
+484
+421
+93
+409
+404
+251
+416
+460
+418
+212
+206
+227
+304
+443
+29
+256
+257
+489
+317
+456
+467
+173
+375
+477
+180
+87
+193
+432
+354
+85
+347
+83
+6
+186
+492
+156
+437
+154
+115
+355
+366
+321
+328
+169
+263
+357
+426
+19
+92
+489
+221
+305
+409
+342
+281
+335
+175
+474
+12
+28
+58
+359
+111
+311
+292
+350
+467
+228
+3
+81
+329
+369
+148
+404
+284
+411
+6
+456
+176
+98
+191
+397
+403
+346
+238
+430
+180
+413
+149
+192
+187
+455
+298
+299
+265
+336
+395
+479
+63
+398
+306
+139
+12
+455
+42
+42
+365
+295
+499
+41
+394
+436
+184
+42
+281
+423
+219
+207
+81
+368
+399
+269
+322
+443
+314
+334
+278
+208
+58
+88
+352
+364
+474
+364
+318
+262
+406
+430
+56
+150
+217
+196
+85
+401
+486
+112
+69
+204
+319
+398
+318
+465
+166
+387
+153
+226
+220
+432
+434
+24
+266
+285
+388
+239
+395
+453
+0
+300
+128
+56
+197
+345
+253
+28
+245
+238
+388
+61
+188
+206
+459
+5
+417
+371
+392
+70
+96
+358
+248
+276
+382
+13
+307
+16
+252
+201
+469
+499
+247
+96
+301
+444
+187
+53
+219
+432
+37
+106
+239
+472
+58
+197
+478
+476
+67
+369
+292
+163
+474
+286
+185
+355
+45
+492
+117
+43
+192
+85
+41
+440
+428
+342
+129
+114
+142
+94
+293
+426
+200
+31
+398
+259
+476
+375
+481
+42
+490
+18
+453
+463
+304
+137
+64
+95
+129
+181
+138
+67
+13
+179
+253
+187
+267
+383
+302
+409
+477
+341
+81
+424
+118
+479
+429
+93
+99
+409
+136
+88
+173
+335
+298
+223
+472
+108
+318
+347
+35
+456
+415
+48
+134
+167
+236
+147
+296
+284
+56
+273
+124
+137
+443
+242
+362
+371
+82
+461
+25
+465
+295
+198
+299
+339
+421
+270
+447
+485
+364
+483
+440
+278
+277
+320
+445
+12
+467
+241
+42
+269
+260
+413
+152
+449
+402
+13
+319
+484
+220
+344
+448
+15
+288
+246
+354
+208
+262
+301
+192
+125
+29
+378
+149
+306
+197
+341
+65
+410
+328
+354
+179
+334
+267
+331
+282
+168
+91
+347
+151
+311
+190
+345
+72
+478
+90
+427
+432
+98
+474
+370
+471
+249
+494
+119
+54
+437
+206
+366
+346
+33
+220
+271
+367
+487
+349
+148
+401
+440
+495
+51
+497
+431
+142
+69
+154
+479
+496
+332
+76
+215
+448
+293
+464
+441
+159
+264
+377
+365
+130
+223
+399
+350
+240
+11
+82
+88
+160
+483
+27
+401
+280
+271
+78
+422
+340
+479
+400
+81
+311
+222
+296
+258
+15
+5
+446
+174
+269
+322
+38
+399
+291
+183
+495
+31
+195
+76
+366
+101
+305
+140
+248
+84
+411
+326
+252
+497
+305
+151
+77
+362
+120
+119
+366
+135
+124
+311
+309
+393
+380
+93
+38
+417
+277
+32
+194
+472
+356
+60
+72
+407
+200
+320
+238
+357
+393
+490
+353
+444
+388
+430
+305
+7
+295
+417
+142
+419
+228
+197
+57
+354
+290
+95
+270
+313
+375
+211
+284
+477
+271
+102
+129
+217
+169
+367
+73
+308
+357
+426
+251
+244
+101
+302
+251
+142
+218
+139
+60
+192
+336
+364
+45
+372
+206
+62
+185
+327
+273
+215
+49
+43
+64
+178
+6
+480
+45
+326
+287
+402
+251
+284
+392
+98
+85
+142
+240
+49
+27
+46
+242
+363
+410
+287
+481
+362
+95
+165
+188
+368
+127
+237
+157
+191
+416
+163
+417
+461
+489
+203
+108
+486
+487
+500
+330
+318
+388
+316
+367
+415
+108
+108
+277
+18
+142
+3
+380
+237
+169
+315
+105
+42
+51
+8
+480
+467
+172
+396
+173
+407
+345
+281
+139
+331
+280
+215
+395
+414
+31
+261
+328
+139
+370
+351
+404
+258
+355
+30
+495
+270
+345
+346
+312
+396
+355
+291
+109
+273
+433
+28
+179
+277
+310
+64
+354
+336
+280
+248
+250
+311
+255
+324
+196
+124
+175
+100
+128
+29
+377
+123
+299
+221
+469
+110
+363
+69
+147
+218
+342
+326
+247
+268
+102
+56
+332
+202
+138
+358
+196
+134
+415
+451
+459
+111
+322
+133
+458
+450
+409
+334
+72
+207
+301
+288
+63
+163
+357
+457
+382
+446
+282
+375
+213
+130
+177
+291
+78
+315
+149
+274
+196
+63
+224
+401
+174
+292
+33
+378
+242
+188
+211
+60
+395
+258
+94
+204
+422
+452
+160
+49
+397
+188
+424
+356
+318
+100
+146
+396
+161
+295
+416
+103
+359
+386
+3
+279
+178
+283
+157
+420
+471
+114
+226
+111
+373
+321
+315
+40
+272
+221
+336
+415
+409
+5
+270
+473
+352
+416
+368
+259
+458
+29
+363
+316
+416
+366
+341
+93
+149
+498
+259
+366
+359
+485
+478
+478
+305
+292
+17
+323
+13
+99
+237
+168
+104
+253
+141
+456
+416
+255
+214
+373
+285
+76
+435
+200
+189
+275
+39
+84
+19
+298
+450
+124
+282
+427
+101
+87
+466
+365
+156
+225
+464
+394
+393
+67
+393
+33
+269
+308
+35
+483
+427
+66
+306
+107
+266
+495
+129
+51
+78
+148
+349
+27
+18
+377
+201
+119
+210
+166
+484
+367
+391
+193
+6
+29
+6
+399
+310
+275
+454
+345
+257
+126
+411
+309
+234
+423
+303
+363
+474
+127
+257
+68
+402
+275
+445
+349
+140
+155
+14
+370
+268
+151
+62
+274
+180
+315
+172
+490
+89
+372
+80
+346
+499
+491
+402
+232
+413
+204
+341
+132
+78
+344
+200
+226
+365
+392
+74
+4
+293
+88
+120
+60
+486
+429
+334
+412
+243
+252
+402
+332
+124
+482
+424
+369
+219
+325
+347
+378
+276
+187
+10
+354
+277
+457
+326
+141
+94
+400
+392
+387
+234
+11
+447
+219
+440
+26
+130
+429
+279
+278
+260
+149
+6
+430
+17
+225
+255
+364
+349
+277
+297
+105
+377
+73
+62
+202
+214
+403
+101
+105
+290
+335
+363
+483
+300
+48
+256
+176
+477
+34
+455
+483
+430
+461
+412
+447
+432
+413
+56
+280
+189
+99
+132
+65
+172
+194
+13
+132
+343
+114
+484
+132
+195
+346
+362
+241
+394
+117
+418
+116
+398
+372
+98
+327
+78
+9
+19
+256
+423
+322
+282
+358
+421
+414
+170
+92
+354
+183
+471
+197
+44
+454
+75
+239
+299
+183
+481
+439
+300
+398
+54
+197
+15
+152
+270
+340
+408
+35
+342
+76
+357
+370
+435
+277
+284
+104
+115
+384
+33
+85
+80
+77
+38
+403
+317
+83
+85
+43
+21
+386
+187
+75
+329
+449
+227
+346
+34
+382
+381
+376
+458
+238
+245
+392
+14
+275
+242
+377
+159
+22
+462
+486
+99
+0
+388
+162
+83
+474
+205
+105
+105
+138
+427
+180
+333
+401
+25
+367
+282
+407
+489
+239
+144
+481
+378
+405
+255
+366
+281
+160
+134
+490
+146
+234
+236
+33
+396
+319
+253
+348
+170
+104
+232
+344
+285
+65
+244
+310
+432
+272
+463
+167
+257
+353
+147
+134
+258
+148
+247
+285
+309
+381
+20
+455
+361
+256
+234
+3
+75
+234
+97
+492
+338
+329
+335
+369
+140
+325
+179
+319
+96
+141
+486
+354
+495
+132
+234
+499
+280
+227
+29
+335
+355
+50
+35
+215
+306
+270
+218
+127
+250
+315
+366
+334
+391
+200
+203
+30
+272
+382
+349
+114
+269
+80
+214
+9
+212
+195
+7
+239
+422
+284
+320
+276
+334
+356
+238
+386
+372
+202
+13
+121
+264
+379
+455
+154
+325
+157
+431
+343
+285
+26
+458
+54
+106
+171
+63
+65
+366
+318
+50
+34
+101
+370
+56
+181
+225
+294
+66
+96
+243
+326
+464
+6
+204
+419
+407
+276
+322
+337
+118
+107
+109
+322
+408
+463
+494
+217
+27
+105
+34
+324
+139
+382
+193
+196
+62
+165
+236
+129
+7
+479
+455
+472
+485
+406
+136
+391
+181
+204
+475
+45
+57
+330
+368
+211
+292
+107
+429
+65
+212
+209
+389
+352
+91
+329
+294
+153
+240
+29
+28
+247
+255
+230
+465
+239
+135
+347
+377
+62
+298
+97
+354
+355
+173
+221
+66
+466
+74
+241
+30
+287
+450
+166
+385
+40
+495
+425
+441
+481
+454
+469
+227
+455
+198
+439
+441
+79
+31
+63
+388
+329
+160
+242
+184
+333
+209
+497
+44
+284
+237
+322
+317
+186
+488
+201
+474
+228
+125
+414
+208
+325
+128
+181
+280
+73
+119
+467
+152
+151
+29
+287
+480
+189
+275
+410
+268
+484
+152
+313
+13
+389
+134
+330
+322
+368
+277
+41
+95
+402
+455
+49
+474
+329
+230
+500
+402
+96
+466
+301
+247
+495
+87
+473
+430
+362
+129
+197
+91
+281
+256
+105
+417
+136
+435
+485
+250
+212
+25
+345
+360
+226
+140
+79
+54
+371
+78
+457
+467
+43
+257
+460
+284
+344
+432
+213
+452
+60
+157
+42
+88
+413
+394
+4
+296
+329
+489
+45
+287
+13
+137
+393
+239
+277
+473
+39
+394
+297
+496
+106
+341
+252
+65
+124
+342
+244
+84
+39
+50
+241
+82
+138
+400
+476
+142
+195
+50
+377
+488
+83
+136
+124
+223
+121
+147
+442
+161
+41
+238
+156
+394
+78
+155
+460
+450
+243
+203
+33
+283
+253
+274
+365
+138
+173
+86
+280
+115
+384
+404
+102
+467
+39
+473
+436
+408
+366
+377
+68
+153
+115
+471
+47
+440
+372
+6
+135
+115
+456
+168
+398
+455
+188
+8
+92
+108
+94
+119
+470
+224
+22
+318
+438
+308
+290
+373
+215
+155
+250
+29
+55
+111
+247
+102
+50
+118
+355
+433
+233
+56
+100
+377
+10
+35
+385
+350
+390
+226
+469
+359
+450
+237
+176
+387
+44
+466
+260
+6
+367
+256
+282
+168
+367
+28
+270
+163
+394
+371
+95
+126
+427
+443
+250
+438
+224
+134
+287
+113
+360
+1
+472
+310
+238
+147
+196
+28
+359
+202
+281
+472
+458
+63
+140
+70
+338
+410
+481
+231
+281
+322
+104
+454
+264
+354
+391
+488
+234
+424
+100
+94
+171
+318
+150
+155
+465
+346
+184
+69
+295
+211
+41
+499
+274
+181
+69
+359
+337
+296
+336
+364
+117
+186
+318
+382
+39
+455
+115
+274
+125
+463
+114
+296
+280
+264
+452
+492
+356
+382
+60
+150
+92
+101
+149
+113
+28
+465
+472
+366
+260
+53
+229
+377
+240
+293
+4
+25
+248
+367
+299
+119
+75
+159
+415
+101
+423
+112
+92
+25
+240
+400
+175
+333
+0
+70
+192
+29
+281
+410
+141
+287
+463
+116
+411
+202
+410
+415
+228
+404
+27
+273
+22
+349
+433
+437
+451
+101
+296
+42
+373
+282
+442
+295
+114
+189
+365
+52
+465
+393
+462
+105
+179
+171
+468
+89
+373
+377
+251
+347
+280
+278
+120
+302
+127
+299
+486
+77
+146
+27
+366
+19
+309
+54
+314
+170
+490
+425
+222
+454
+317
+431
+305
+497
+101
+272
+85
+220
+396
+336
+67
+175
+361
+187
+224
+234
+232
+456
+57
+378
+483
+423
+143
+37
+223
+457
+207
+212
+128
+176
+412
+445
+106
+216
+187
+454
+235
+273
+173
+130
+355
+240
+51
+462
+173
+21
+195
+151
+477
+252
+276
+205
+422
+419
+243
+391
+122
+196
+103
+250
+372
+261
+194
+224
+224
+382
+177
+459
+401
+351
+335
+1
+337
+132
+464
+10
+154
+158
+161
+377
+157
+437
+82
+78
+102
+71
+215
+224
+267
+64
+220
+139
+326
+414
+109
+49
+41
+287
+254
+188
+384
+335
+190
+220
+467
+153
+477
+367
+57
+385
+244
+214
+67
+72
+38
+169
+390
+254
+139
+156
+64
+359
+41
+390
+19
+151
+185
+307
+184
+439
+496
+67
+19
+432
+287
+487
+84
+264
+99
+388
+395
+89
+349
+462
+161
+387
+131
+50
+387
+270
+454
+452
+376
+495
+87
+395
+392
+273
+201
+75
+458
+196
+142
+224
+374
+176
+457
+458
+186
+55
+92
+80
+145
+441
+288
+52
+73
+419
+350
+207
+436
+303
+158
+57
+43
+492
+452
+436
+10
+152
+257
+469
+95
+146
+439
+469
+322
+395
+173
+254
+450
+11
+80
+341
+452
+368
+394
+271
+33
+243
+478
+469
+45
+382
+272
+335
+374
+223
+270
+384
+121
+27
+98
+463
+420
+36
+178
+241
+431
+97
+241
+127
+108
+321
+468
+306
+188
+361
+76
+221
+103
+54
+436
+395
+436
+207
+230
+309
+430
+246
+440
+298
+19
+37
+260
+439
+74
+438
+426
+251
+34
+166
+378
+389
+487
+346
+194
+175
+453
+271
+142
+303
+325
+78
+197
+6
+285
+173
+316
+462
+166
+255
+259
+185
+38
+265
+371
+359
+450
+296
+110
+484
+463
+234
+119
+195
+79
+313
+370
+279
+330
+12
+81
+154
+337
+24
+408
+121
+445
+223
+329
+110
+224
+87
+41
+262
+353
+412
+368
+48
+208
+224
+31
+417
+458
+397
+111
+284
+210
+228
+62
+39
+240
+143
+441
+76
+414
+348
+444
+358
+317
+273
+468
+287
+106
+9
+295
+205
+167
+162
+253
+375
+386
+31
+291
+344
+428
+149
+374
+384
+377
+436
+170
+116
+325
+357
+439
+485
+204
+128
+343
+267
+401
+56
+53
+254
+312
+94
+459
+480
+257
+459
+100
+389
+490
+392
+479
+417
+40
+352
+47
+417
+33
+217
+279
+104
+73
+464
+89
+23
+91
+178
+290
+239
+234
+89
+239
+46
+183
+197
+272
+186
+155
+372
+75
+391
+263
+300
+54
+49
+152
+101
+212
+432
+318
+237
+36
+391
+447
+372
+414
+285
+49
+450
+23
+283
+285
+8
+75
+214
+205
+347
+401
+107
+219
+222
+244
+228
+21
+298
+278
+420
+399
+236
+352
+216
+220
+134
+353
+166
+5
+12
+451
+54
+208
+220
+337
+493
+228
+413
+454
+180
+5
+100
+33
+224
+322
+277
+453
+89
+75
+477
+9
+220
+212
+107
+437
+432
+241
+35
+345
+246
+295
+295
+300
+2
+15
+383
+242
+243
+41
+442
+169
+47
+41
+202
+271
+363
+480
+223
+452
+54
+446
+207
+274
+158
+314
+457
+336
+54
+239
+427
+300
+280
+222
+346
+28
+484
+229
+16
+473
+16
+458
+142
+63
+499
+344
+335
+107
+323
+304
+306
+123
+497
+12
+144
+401
+327
+347
+236
+127
+332
+410
+174
+111
+131
+19
+140
+114
+495
+156
+86
+11
+361
+475
+74
+359
+319
+155
+467
+388
+206
+272
+258
+202
+30
+148
+102
+357
+241
+84
+231
+73
+494
+405
+431
+371
+170
+317
+231
+165
+220
+64
+423
+80
+38
+243
+185
+103
+145
+151
+492
+351
+169
+249
+299
+200
+143
+147
+303
+384
+478
+33
+457
+218
+184
+388
+335
+355
+451
+66
+19
+170
+130
+442
+250
+415
+184
+436
+18
+75
+333
+9
+426
+249
+4
+471
+449
+147
+364
+498
+30
+88
+31
+234
+52
+215
+368
+387
+316
+318
+453
+335
+489
+329
+22
+485
+244
+454
+166
+262
+28
+246
+17
+201
+495
+268
+418
+189
+415
+28
+186
+191
+116
+217
+425
+415
+179
+38
+301
+495
+357
+0
+76
+91
+75
+345
+322
+319
+44
+235
+327
+320
+481
+90
+20
+221
+358
+184
+410
+18
+212
+95
+457
+74
+59
+127
+489
+485
+166
+36
+225
+269
+36
+301
+360
+111
+393
+428
+177
+437
+162
+250
+256
+389
+87
+22
+109
+445
+207
+265
+210
+165
+361
+166
+487
+420
+293
+475
+150
+459
+10
+375
+227
+293
+423
+333
+151
+315
+261
+328
+498
+169
+324
+0
+305
+411
+269
+414
+102
+222
+426
+312
+388
+286
+478
+374
+452
+16
+94
+101
+476
+352
+222
+449
+144
+144
+28
+295
+205
+35
+369
+450
+204
+193
+450
+255
+350
+465
+169
+452
+187
+341
+263
+321
+126
+487
+441
+324
+3
+34
+171
+225
+132
+393
+420
+23
+37
+448
+318
+489
+483
+434
+438
+434
+373
+133
+188
+222
+98
+103
+174
+285
+444
+183
+105
+316
+170
+45
+139
+173
+326
+310
+144
+205
+203
+63
+228
+487
+258
+292
+475
+487
+225
+159
+420
+97
+292
+355
+66
+390
+458
+240
+174
+148
+423
+25
+464
+339
+317
+103
+258
+390
+159
+402
+94
+108
+212
+322
+341
+216
+113
+62
+202
+85
+221
+369
+429
+12
+223
+495
+149
+180
+481
+69
+328
+404
+342
+38
+242
+158
+388
+247
+294
+46
+148
+388
+402
+106
+456
+242
+322
+316
+50
+24
+401
+271
+139
+329
+30
+362
+324
+179
+41
+304
+495
+116
+454
+336
+401
+443
+495
+288
+189
+34
+80
+83
+169
+482
+190
+124
+471
+258
+186
+20
+28
+86
+38
+167
+162
+68
+28
+486
+494
+317
+35
+488
+179
+236
+324
+79
+178
+64
+113
+113
+345
+193
+196
+13
+175
+132
+385
+392
+137
+70
+412
+165
+157
+196
+333
+319
+264
+107
+50
+3
+170
+332
+238
+349
+67
+308
+174
+492
+118
+287
+351
+463
+481
+294
+223
+402
+426
+107
+293
+62
+177
+451
+475
+80
+147
+53
+145
+157
+160
+442
+408
+331
+20
+145
+426
+87
+199
+100
+326
+317
+387
+176
+279
+113
+470
+1
+14
+142
+355
+53
+451
+279
+4
+425
+359
+398
+224
+251
+301
+131
+439
+208
+208
+459
+99
+133
+46
+298
+480
+118
+114
+113
+294
+140
+226
+10
+388
+488
+399
+243
+40
+349
+21
+44
+20
+126
+188
+244
+377
+490
+375
+316
+197
+329
+20
+297
+463
+313
+94
+188
+431
+456
+301
+472
+95
+27
+482
+483
+14
+380
+225
+54
+475
+493
+346
+495
+119
+280
+486
+496
+269
+106
+57
+467
+436
+325
+9
+144
+137
+350
+332
+68
+305
+133
+39
+146
+407
+267
+129
+421
+393
+100
+221
+113
+93
+313
+108
+212
+93
+340
+454
+362
+446
+258
+74
+127
+82
+330
+271
+466
+180
+103
+33
+231
+483
+319
+378
+389
+332
+6
+55
+471
+353
+22
+84
+446
+82
+439
+404
+175
+278
+104
+283
+223
+108
+104
+97
+437
+434
+368
+402
+360
+217
+436
+91
+199
+0
+469
+334
+333
+221
+135
+49
+73
+158
+133
+266
+240
+71
+416
+161
+95
+19
+190
+65
+127
+40
+162
+63
+221
+29
+466
+80
+247
+147
+418
+192
+394
+132
+26
+473
+99
+408
+22
+420
+65
+155
+185
+51
+474
+347
+459
+68
+367
+396
+133
+240
+436
+295
+50
+156
+71
+262
+484
+64
+409
+147
+256
+48
+26
+28
+21
+125
+437
+43
+44
+248
+445
+476
+46
+418
+323
+4
+487
+436
+146
+366
+175
+82
+161
+472
+485
+479
+233
+214
+42
+388
+108
+298
+437
+134
+73
+458
+259
+9
+247
+304
+3
+191
+25
+49
+109
+348
+301
+342
+283
+447
+207
+205
+275
+114
+176
+6
+92
+156
+220
+134
+43
+328
+179
+226
+462
+252
+430
+468
+7
+176
+17
+10
+368
+42
+307
+477
+137
+107
+64
+166
+300
+271
+371
+322
+132
+294
+328
+471
+196
+294
+352
+239
+369
+30
+212
+330
+28
+141
+43
+282
+318
+60
+38
+185
+350
+345
+408
+487
+198
+472
+152
+245
+489
+270
+66
+120
+310
+394
+338
+5
+187
+189
+491
+55
+219
+202
+132
+494
+344
+175
+275
+408
+483
+313
+339
+332
+405
+246
+64
+102
+464
+463
+93
+452
+479
+159
+319
+288
+52
+156
+39
+487
+345
+277
+41
+310
+479
+420
+49
+68
+342
+324
+222
+324
+383
+60
+402
+33
+306
+212
+383
+269
+421
+476
+468
+400
+135
+32
+434
+187
+188
+220
+173
+279
+497
+462
+335
+221
+381
+384
+36
+469
+454
+258
+292
+336
+319
+440
+116
+371
+398
+499
+387
+319
+474
+100
+218
+108
+132
+398
+42
+66
+117
+215
+345
+113
+423
+426
+81
+50
+309
+117
+18
+262
+121
+57
+344
+440
+497
+460
+57
+141
+458
+190
+460
+178
+290
+424
+286
+168
+67
+328
+234
+432
+290
+325
+291
+212
+250
+372
+8
+305
+489
+27
+66
+110
+84
+156
+296
+327
+363
+99
+468
+66
+289
+173
+244
+325
+343
+277
+493
+157
+351
+473
+88
+140
+297
+379
+99
+293
+251
+107
+97
+486
+381
+410
+342
+465
+66
+138
diff --git a/testdata/test b/testdata/test
new file mode 100644
index 0000000..00b07e5
--- /dev/null
+++ b/testdata/test
@@ -0,0 +1,1000 @@
+411
+436
+4
+423
+387
+365
+102
+359
+115
+412
+197
+367
+29
+126
+157
+28
+103
+495
+343
+69
+492
+414
+265
+168
+214
+31
+305
+416
+363
+301
+262
+273
+483
+266
+195
+369
+377
+43
+228
+492
+455
+171
+104
+231
+298
+7
+259
+401
+2
+348
+470
+494
+262
+481
+161
+476
+11
+212
+391
+120
+260
+152
+393
+242
+164
+335
+111
+287
+378
+339
+24
+79
+9
+375
+310
+53
+383
+68
+454
+385
+417
+170
+124
+425
+150
+31
+400
+409
+244
+36
+28
+3
+188
+422
+245
+98
+2
+102
+131
+380
+441
+155
+205
+197
+29
+14
+497
+412
+330
+197
+42
+493
+367
+166
+417
+263
+198
+316
+171
+188
+352
+447
+191
+286
+114
+182
+130
+116
+285
+261
+242
+472
+162
+448
+415
+191
+462
+412
+350
+291
+108
+138
+283
+221
+51
+446
+484
+496
+7
+402
+183
+359
+348
+120
+391
+462
+302
+267
+324
+333
+27
+65
+51
+189
+12
+466
+127
+221
+123
+223
+11
+478
+107
+41
+198
+158
+233
+182
+153
+241
+330
+336
+346
+177
+456
+237
+385
+4
+250
+208
+337
+278
+273
+388
+213
+286
+100
+86
+253
+223
+55
+264
+201
+163
+51
+145
+67
+285
+73
+221
+272
+403
+303
+117
+326
+5
+100
+210
+9
+351
+418
+92
+375
+438
+227
+334
+470
+327
+421
+222
+296
+222
+232
+243
+131
+284
+389
+199
+315
+462
+420
+333
+111
+469
+450
+437
+474
+50
+147
+483
+147
+64
+322
+21
+248
+48
+355
+217
+121
+21
+439
+417
+244
+171
+160
+375
+201
+295
+320
+15
+256
+239
+94
+367
+455
+43
+50
+428
+340
+197
+157
+487
+7
+479
+254
+256
+273
+356
+473
+394
+377
+412
+310
+367
+82
+216
+489
+283
+10
+308
+44
+13
+294
+138
+126
+248
+428
+176
+175
+268
+373
+78
+0
+127
+56
+1
+383
+329
+357
+101
+469
+480
+12
+279
+347
+341
+241
+335
+370
+252
+142
+160
+11
+436
+298
+137
+183
+473
+314
+105
+240
+433
+183
+487
+59
+487
+488
+188
+61
+344
+290
+30
+324
+48
+55
+417
+390
+296
+251
+259
+294
+139
+420
+305
+322
+464
+443
+4
+436
+2
+356
+422
+435
+286
+409
+241
+18
+142
+429
+326
+233
+218
+102
+303
+267
+157
+219
+403
+200
+216
+161
+240
+355
+327
+45
+176
+37
+234
+428
+219
+483
+29
+141
+163
+315
+296
+404
+79
+438
+333
+406
+170
+297
+7
+219
+63
+412
+438
+466
+111
+400
+374
+97
+255
+447
+389
+177
+484
+369
+351
+203
+351
+381
+90
+14
+442
+386
+164
+21
+323
+497
+427
+240
+294
+180
+459
+103
+91
+143
+69
+449
+42
+189
+46
+43
+135
+435
+221
+366
+50
+318
+68
+401
+198
+158
+161
+387
+290
+326
+408
+359
+68
+80
+98
+108
+260
+304
+212
+352
+193
+27
+46
+235
+216
+92
+279
+97
+274
+246
+463
+324
+310
+277
+471
+8
+181
+379
+141
+471
+451
+48
+330
+18
+128
+174
+374
+134
+224
+85
+486
+417
+359
+279
+152
+321
+371
+177
+418
+391
+169
+127
+461
+479
+150
+178
+233
+332
+56
+374
+48
+6
+168
+378
+271
+42
+299
+144
+177
+22
+476
+409
+440
+80
+187
+338
+401
+305
+14
+65
+195
+430
+439
+403
+154
+88
+80
+134
+420
+136
+7
+215
+389
+423
+92
+406
+465
+137
+297
+141
+160
+272
+297
+346
+353
+484
+183
+500
+288
+444
+311
+230
+373
+249
+132
+273
+338
+212
+407
+3
+94
+161
+218
+229
+83
+57
+134
+47
+194
+431
+436
+100
+450
+232
+446
+48
+462
+128
+47
+250
+71
+105
+226
+190
+354
+358
+464
+438
+69
+370
+442
+410
+30
+159
+138
+360
+463
+272
+154
+157
+450
+89
+257
+399
+67
+450
+447
+275
+77
+240
+271
+396
+345
+497
+85
+446
+354
+48
+383
+169
+165
+324
+78
+442
+230
+463
+302
+439
+235
+456
+95
+431
+291
+99
+329
+104
+295
+21
+379
+372
+7
+150
+267
+99
+393
+99
+291
+494
+147
+173
+162
+58
+244
+488
+0
+220
+450
+302
+158
+431
+3
+0
+361
+40
+99
+436
+144
+394
+203
+269
+11
+211
+165
+25
+56
+58
+124
+347
+51
+17
+266
+460
+76
+9
+447
+76
+229
+143
+124
+388
+320
+127
+388
+181
+167
+233
+363
+57
+373
+66
+326
+384
+23
+238
+155
+326
+296
+279
+172
+93
+297
+184
+52
+373
+194
+246
+195
+169
+135
+319
+56
+455
+192
+190
+382
+105
+169
+245
+162
+41
+57
+234
+172
+327
+472
+327
+152
+13
+106
+70
+106
+149
+254
+406
+21
+194
+398
+216
+364
+32
+281
+420
+487
+473
+357
+369
+77
+25
+360
+486
+314
+163
+466
+486
+490
+438
+58
+141
+197
+411
+458
+304
+59
+211
+456
+327
+406
+353
+42
+269
+385
+69
+435
+117
+41
+37
+486
+365
+63
+91
+96
+377
+254
+62
+108
+243
+500
+166
+130
+196
+324
+87
+246
+383
+45
+201
+210
+197
+300
+499
+466
+184
+68
+146
+302
+356
+184
+33
+221
+494
+372
+63
+116
+125
+125
+224
+115
+124
+136
+245
+67
+460
+79
+59
+89
+124
+7
+45
+321
+307
+290
+32
+238
+104
+425
+286
+461
+355
+65
+428
+94
+437
+491
+210
+309
+116
+180
+424
+487
+63
+415
+300
+269
+494
+360
+358
+364
+113
+149
+184
+420
+440
+463
+404
+43
+388
+189
+250
+489
+255
+177
+83
+191
+415
+293
+500
+277
+220
+169
+263
+283
+84
+310
+51
+77
+416
+156
+442
+28
+305
+372
+194
+491
+335
+98
+34
+469
+33
+284
+203
+288
+208
+286
+226
+122
+326
+472
+145
+45
+141
+408
+328
+225
+464
+125
+48
+379
+281
+490
+407
+333
+108
+348
+323
+189
+446
+357
+404
+225
+388
+106
+13
+342
+139
+239
+210
+465
+457
+355
+9
+97
+8
+83
+322
+473
+208
+371
+351
+490
+106
+4
+322
+461
+352
+144
+396
+43
+248
+299
+268
+382
diff --git a/testdata/test1 b/testdata/test1
new file mode 100644
index 0000000..b37c0ad
--- /dev/null
+++ b/testdata/test1
@@ -0,0 +1,1000 @@
+184
+403
+418
+462
+42
+49
+442
+329
+20
+201
+125
+388
+123
+18
+284
+182
+348
+392
+174
+249
+179
+335
+271
+17
+144
+28
+162
+428
+429
+51
+63
+112
+201
+482
+321
+243
+277
+262
+318
+44
+209
+443
+432
+332
+207
+463
+13
+54
+354
+434
+49
+279
+14
+321
+42
+159
+349
+451
+86
+24
+2
+396
+136
+450
+123
+203
+192
+147
+465
+257
+438
+173
+199
+369
+251
+407
+77
+11
+207
+177
+445
+3
+456
+206
+324
+245
+365
+419
+195
+197
+443
+444
+339
+326
+393
+209
+28
+332
+356
+240
+88
+293
+413
+33
+408
+411
+186
+486
+422
+140
+162
+366
+143
+365
+318
+467
+356
+182
+131
+50
+125
+321
+241
+211
+393
+380
+420
+167
+211
+275
+407
+45
+314
+66
+326
+221
+477
+11
+453
+398
+151
+362
+9
+40
+473
+328
+6
+328
+256
+385
+124
+128
+205
+365
+339
+344
+245
+258
+10
+202
+279
+164
+248
+339
+230
+320
+59
+453
+331
+259
+96
+229
+120
+352
+269
+92
+426
+22
+166
+182
+153
+290
+310
+104
+155
+395
+448
+146
+399
+458
+348
+177
+368
+342
+15
+97
+161
+321
+296
+239
+326
+138
+214
+446
+491
+229
+284
+416
+498
+450
+97
+150
+487
+153
+254
+388
+294
+448
+33
+192
+152
+381
+115
+19
+470
+377
+364
+130
+445
+159
+115
+270
+44
+329
+216
+34
+305
+246
+450
+302
+443
+294
+199
+429
+193
+199
+316
+488
+147
+95
+426
+299
+222
+41
+64
+191
+418
+428
+68
+108
+334
+430
+379
+378
+5
+94
+412
+310
+86
+107
+358
+28
+147
+56
+203
+341
+256
+265
+74
+149
+360
+500
+448
+82
+287
+258
+19
+452
+186
+87
+59
+19
+264
+438
+143
+269
+278
+301
+78
+365
+408
+436
+139
+55
+239
+89
+142
+495
+354
+216
+390
+214
+462
+83
+42
+496
+341
+61
+447
+26
+396
+252
+292
+159
+190
+435
+428
+214
+482
+252
+325
+390
+434
+211
+191
+172
+300
+333
+413
+153
+295
+302
+113
+2
+385
+155
+498
+226
+464
+444
+499
+105
+443
+291
+264
+132
+472
+438
+92
+454
+436
+418
+89
+369
+128
+280
+288
+428
+359
+200
+327
+153
+249
+441
+402
+133
+342
+400
+105
+51
+89
+104
+156
+31
+141
+420
+410
+359
+103
+2
+58
+38
+420
+394
+408
+294
+173
+442
+468
+278
+141
+294
+177
+136
+481
+79
+270
+69
+225
+121
+120
+314
+472
+277
+92
+359
+443
+1
+218
+46
+3
+22
+331
+169
+417
+485
+209
+336
+426
+176
+361
+67
+217
+37
+203
+444
+363
+219
+12
+87
+87
+133
+402
+58
+156
+494
+418
+98
+241
+382
+144
+492
+404
+476
+160
+66
+460
+116
+149
+132
+292
+9
+446
+255
+46
+148
+199
+410
+114
+458
+497
+448
+90
+144
+5
+246
+384
+169
+91
+125
+297
+235
+116
+448
+457
+22
+13
+163
+138
+162
+295
+177
+171
+240
+178
+465
+134
+377
+374
+495
+335
+116
+442
+171
+7
+194
+164
+391
+363
+255
+262
+407
+236
+124
+354
+440
+147
+367
+102
+31
+276
+143
+208
+193
+129
+133
+157
+263
+9
+277
+4
+90
+140
+446
+8
+147
+386
+419
+284
+496
+173
+293
+402
+155
+417
+255
+94
+63
+368
+443
+95
+390
+332
+49
+83
+461
+182
+487
+224
+439
+264
+475
+275
+150
+420
+29
+297
+52
+448
+327
+47
+367
+119
+449
+269
+36
+450
+363
+346
+63
+52
+187
+454
+384
+237
+36
+345
+165
+22
+315
+103
+32
+289
+125
+182
+455
+154
+225
+6
+349
+52
+300
+215
+418
+248
+484
+200
+444
+93
+46
+7
+392
+233
+461
+275
+216
+243
+366
+382
+11
+180
+231
+44
+215
+356
+473
+170
+257
+198
+423
+352
+497
+223
+313
+160
+217
+43
+361
+161
+136
+153
+168
+27
+386
+375
+48
+349
+117
+415
+230
+128
+341
+461
+419
+56
+63
+138
+226
+66
+82
+148
+418
+325
+117
+230
+485
+335
+19
+91
+496
+155
+244
+410
+429
+377
+30
+224
+225
+147
+385
+201
+21
+225
+408
+187
+281
+471
+325
+6
+283
+407
+402
+447
+231
+18
+424
+462
+353
+443
+53
+94
+345
+43
+250
+19
+420
+280
+243
+391
+427
+127
+91
+195
+353
+500
+382
+133
+216
+453
+387
+500
+105
+34
+192
+336
+52
+115
+297
+152
+58
+96
+493
+403
+140
+243
+168
+306
+22
+412
+197
+196
+285
+288
+137
+384
+33
+265
+264
+250
+217
+397
+496
+322
+431
+187
+404
+229
+303
+447
+127
+107
+43
+120
+256
+430
+363
+424
+235
+131
+81
+178
+73
+367
+213
+210
+497
+246
+475
+260
+496
+191
+156
+491
+259
+333
+178
+162
+62
+227
+109
+436
+334
+399
+55
+89
+74
+164
+259
+309
+42
+341
+234
+115
+454
+447
+326
+450
+192
+300
+457
+435
+238
+359
+425
+497
+192
+349
+406
+0
+75
+261
+436
+155
+406
+238
+491
+480
+148
+250
+288
+190
+90
+21
+306
+43
+214
+378
+239
+407
+424
+195
+341
+161
+54
+11
+405
+493
+361
+310
+239
+182
+317
+421
+84
+222
+158
+74
+201
+53
+324
+235
+243
+160
+3
+295
+203
+217
+419
+443
+370
+343
+384
+210
+3
+184
+469
+154
+176
+75
+210
+161
+3
+26
+82
+87
+495
+487
+409
+442
+39
+232
+177
+283
+139
+427
+324
+342
+390
+243
+30
+260
+85
+161
+216
+335
+345
+431
+490
+268
+5
+446
+429
+9
+219
+10
+343
+213
+498
+251
+155
+283
+230
+78
+65
+369
+4
+136
+457
+140
+379
+234
+146
+210
+395
+109
+44
+239
+39
+280
+253
+45
+226
+429
+301
+445
+185
+143
+404
+182
+395
+58
+212
+371
+136
+277
+239
+387
+413
+442
+274
+37
+175
+420
+247
+69
+28
+292
+55
+68
+318
+54
+113
+290
+483
+414
+481
+168
+303
+385
+96
+444
+189
+308
+314
+72
+85
+299
+459
+244
+241
+232
+282
+416
+152
+28
+232
+427
+66
+33
+495
diff --git a/testdata/test2 b/testdata/test2
new file mode 100644
index 0000000..0fd9ee7
--- /dev/null
+++ b/testdata/test2
@@ -0,0 +1,1000 @@
+262
+304
+392
+477
+436
+155
+33
+220
+185
+410
+476
+265
+81
+107
+257
+443
+143
+149
+349
+146
+284
+170
+219
+102
+254
+419
+322
+39
+416
+465
+381
+424
+268
+272
+147
+450
+427
+180
+169
+358
+336
+144
+122
+418
+499
+380
+360
+388
+275
+455
+33
+305
+124
+500
+407
+378
+418
+228
+163
+79
+192
+44
+2
+206
+62
+149
+155
+236
+75
+70
+340
+412
+214
+463
+329
+459
+88
+435
+92
+109
+390
+373
+414
+260
+372
+320
+385
+35
+294
+47
+114
+232
+338
+116
+438
+147
+266
+339
+383
+341
+409
+222
+252
+369
+431
+327
+328
+265
+262
+166
+374
+398
+38
+33
+157
+410
+353
+41
+191
+393
+336
+305
+124
+173
+422
+61
+320
+187
+400
+449
+274
+54
+418
+273
+424
+94
+99
+498
+360
+361
+163
+480
+4
+202
+13
+162
+358
+112
+450
+49
+5
+285
+354
+129
+205
+21
+191
+271
+455
+337
+220
+229
+392
+384
+1
+315
+478
+100
+312
+337
+208
+221
+317
+212
+423
+76
+120
+27
+188
+70
+323
+193
+101
+176
+323
+306
+198
+260
+77
+399
+96
+43
+127
+488
+427
+375
+48
+404
+222
+106
+488
+176
+328
+50
+388
+497
+126
+255
+23
+314
+325
+346
+7
+426
+269
+76
+479
+213
+336
+55
+111
+432
+98
+486
+166
+271
+106
+461
+174
+328
+67
+161
+3
+395
+458
+138
+137
+83
+393
+408
+144
+464
+500
+398
+135
+268
+474
+113
+227
+309
+168
+85
+487
+12
+70
+399
+283
+176
+360
+204
+251
+427
+111
+254
+67
+69
+138
+451
+152
+277
+358
+296
+240
+358
+440
+122
+372
+413
+235
+99
+468
+150
+431
+455
+162
+247
+99
+192
+169
+459
+396
+420
+131
+253
+421
+445
+322
+58
+396
+221
+336
+253
+263
+322
+357
+203
+444
+229
+115
+179
+74
+83
+75
+251
+284
+484
+498
+129
+175
+166
+88
+317
+86
+219
+70
+6
+164
+138
+311
+306
+359
+393
+58
+122
+215
+416
+325
+405
+391
+186
+330
+211
+15
+405
+462
+299
+389
+459
+429
+63
+371
+263
+127
+457
+228
+444
+209
+138
+81
+267
+444
+441
+159
+2
+62
+120
+164
+133
+25
+301
+319
+355
+11
+335
+260
+219
+380
+148
+424
+54
+458
+294
+317
+331
+498
+45
+274
+206
+430
+356
+219
+374
+296
+125
+376
+104
+245
+286
+237
+16
+86
+302
+372
+344
+136
+378
+309
+263
+272
+232
+317
+476
+25
+381
+307
+22
+172
+80
+476
+101
+182
+194
+475
+478
+319
+96
+328
+311
+382
+64
+327
+214
+113
+445
+304
+249
+68
+112
+258
+86
+344
+75
+62
+116
+456
+115
+138
+374
+195
+360
+475
+378
+301
+450
+101
+366
+45
+430
+176
+174
+240
+250
+134
+353
+441
+439
+349
+9
+50
+106
+95
+141
+181
+404
+257
+383
+18
+141
+256
+461
+248
+478
+84
+48
+427
+185
+414
+218
+361
+337
+392
+101
+86
+26
+200
+26
+211
+48
+282
+261
+155
+124
+148
+82
+27
+151
+212
+46
+39
+214
+6
+287
+191
+90
+335
+117
+21
+248
+336
+383
+331
+474
+230
+417
+246
+430
+190
+457
+225
+218
+465
+380
+342
+112
+208
+370
+10
+420
+416
+49
+134
+168
+336
+71
+4
+417
+189
+25
+411
+271
+154
+242
+491
+130
+405
+237
+307
+94
+193
+31
+59
+404
+157
+401
+263
+365
+270
+273
+31
+432
+68
+412
+99
+404
+483
+350
+66
+418
+376
+477
+435
+276
+218
+426
+407
+370
+162
+460
+210
+101
+491
+269
+5
+147
+170
+268
+258
+440
+287
+35
+118
+355
+447
+464
+4
+176
+314
+70
+340
+436
+46
+275
+211
+11
+200
+364
+381
+108
+69
+90
+209
+59
+106
+461
+453
+276
+475
+458
+462
+261
+493
+79
+115
+186
+43
+366
+108
+103
+436
+448
+38
+229
+222
+496
+240
+422
+106
+367
+29
+175
+203
+486
+482
+309
+192
+434
+84
+167
+137
+293
+174
+130
+372
+36
+62
+161
+402
+170
+10
+338
+117
+48
+66
+340
+291
+52
+7
+143
+419
+284
+318
+368
+15
+45
+177
+207
+226
+7
+374
+363
+300
+295
+493
+419
+331
+301
+326
+232
+471
+337
+69
+88
+131
+135
+174
+168
+434
+428
+311
+98
+211
+376
+467
+226
+421
+390
+180
+146
+397
+300
+9
+444
+94
+248
+108
+425
+49
+434
+157
+266
+16
+226
+100
+395
+108
+274
+62
+288
+449
+374
+387
+159
+249
+353
+132
+416
+242
+58
+62
+385
+358
+318
+74
+453
+312
+182
+377
+107
+363
+280
+374
+379
+253
+474
+273
+361
+495
+336
+148
+443
+456
+281
+348
+204
+380
+226
+366
+121
+284
+174
+253
+389
+492
+327
+341
+50
+256
+464
+404
+118
+244
+23
+497
+497
+498
+16
+103
+238
+98
+498
+180
+53
+25
+274
+3
+405
+0
+369
+26
+30
+43
+25
+419
+281
+98
+5
+331
+354
+470
+482
+218
+460
+4
+215
+202
+248
+478
+51
+486
+75
+48
+412
+128
+73
+186
+131
+479
+433
+500
+251
+463
+42
+22
+128
+70
+367
+133
+147
+221
+102
+128
+439
+308
+133
+400
+9
+381
+377
+307
+367
+198
+356
+24
+326
+175
+210
+203
+400
+389
+450
+397
+98
+492
+165
+226
+308
+32
+359
+456
+500
+208
+83
+438
+15
+463
+84
+272
+344
+207
+78
+457
+406
+180
+481
+478
+102
+438
+181
+248
+72
+130
+392
+170
+368
+56
+396
+176
+88
+255
+378
+334
+463
+461
+18
+224
+170
+102
+496
+13
+55
+321
+216
+207
+0
+443
+185
+349
+126
+112
+97
+199
+489
+489
+369
+356
+44
+265
+278
+380
+266
+402
+213
+475
+363
+231
+198
+32
+79
+441
+292
+135
+261
+254
+342
+7
+443
+273
+357
+69
+385
+454
+14
+373
+188
+383
+476
+232
+394
+500
+358
+159
+402
+318
+133
+10
+48
+78
+289
+128
+18
+80
+9
+25
+80
+351
+279
+22
+371
+135
+338
+255
+335
+352
+375
+22
+482
+350
+1
+375
+95
diff --git a/write_data.cpp b/write_data.cpp
new file mode 100644
index 0000000..ebd655b
--- /dev/null
+++ b/write_data.cpp
@@ -0,0 +1,18 @@
+
+#include "statistics.h"
+
+using namespace std;
+
+void write_data(const char *filename, unsigned int N, unsigned int M)
+{
+ srand(time(0));
+
+ ofstream out;
+ out.open(filename);
+
+ for (int i = 0; i < N; i++) {
+ out << rand() % (M+1) << endl;
+ }
+
+ out.close();
+}