Filling in gaps with awk or anything - bash

I have a list such as below, where the 1 column is position and the other columns aren't important for this question.
1 1 2 3 4 5
2 1 2 3 4 5
5 1 2 3 4 5
8 1 2 3 4 5
9 1 2 3 4 5
10 1 2 3 4 5
11 1 2 3 4 5
I want to fill in the gaps such that the list is continuous and it reads
1 1 2 3 4 5
2 1 2 3 4 5
3 0 0 0 0 0
4 0 0 0 0 0
5 1 2 3 4 5
6 0 0 0 0 0
7 0 0 0 0 0
8 1 2 3 4 5
9 1 2 3 4 5
10 1 2 3 4 5
11 1 2 3 4 5
I am familiar with awk and shell scripts, but whatever way it can be done is fine with me.
Thanks for any help..

this one-liner may work for you:
awk '$1>++p{for(;p<$1;p++)print p"  0 0 0 0 0"}1' file
with your example:
kent$ echo '1 1 2 3 4 5
2 1 2 3 4 5
5 1 2 3 4 5
8 1 2 3 4 5
9 1 2 3 4 5
10 1 2 3 4 5
11 1 2 3 4 5'|awk '$1>++p{for(;p<$1;p++)print p" 0 0 0 0 0"}1'
1 1 2 3 4 5
2 1 2 3 4 5
3 0 0 0 0 0
4 0 0 0 0 0
5 1 2 3 4 5
6 0 0 0 0 0
7 0 0 0 0 0
8 1 2 3 4 5
9 1 2 3 4 5
10 1 2 3 4 5
11 1 2 3 4 5

You can use the following awk one-liner:
awk '{b=a;a=$1;while(a>(b++)+1){print(b+1)," 0 0 0 0 0"}}1' input.file
Tested with here-doc input:
awk '{b=a;a=$1;while(a>(b++)+1){print(b+1)," 0 0 0 0 0"}}1' <<EOF
1 1 2 3 4 5
2 1 2 3 4 5
5 1 2 3 4 5
8 1 2 3 4 5
9 1 2 3 4 5
10 1 2 3 4 5
11 1 2 3 4 5
EOF
the output is as follows:
1 1 2 3 4 5
2 1 2 3 4 5
3 0 0 0 0 0
4 0 0 0 0 0
5 1 2 3 4 5
6 0 0 0 0 0
7 0 0 0 0 0
8 1 2 3 4 5
9 1 2 3 4 5
10 1 2 3 4 5
11 1 2 3 4 5
Explanation:
On every input line b is set to a where a is the value of the first column. Because of the order in which b and a are initialized, b can be used in a while loop that runs as long as b < a-1 and inserts the missing lines, filled up with zeros. The 1 at the end of the script will finally print the input line.

This is only for fun:
join -a2 FILE <(seq -f "%g 0 0 0 0 0" $(tail -1 FILE | cut -d' ' -f1)) | cut -d' ' -f -6
produces:
1 1 2 3 4 5
2 1 2 3 4 5
3 0 0 0 0 0
4 0 0 0 0 0
5 1 2 3 4 5
6 0 0 0 0 0
7 0 0 0 0 0
8 1 2 3 4 5
9 1 2 3 4 5
10 1 2 3 4 5
11 1 2 3 4 5

Here is another way:
awk '{x=$1-b;while(x-->1){print ++b," 0 0 0 0 0"};b=$1}1' file
Test:
$ cat file
1 1 2 3 4 5
2 1 2 3 4 5
5 1 2 3 4 5
8 1 2 3 4 5
9 1 2 3 4 5
10 1 2 3 4 5
11 1 2 3 4 5
$ awk '{x=$1-b;while(x-->1){print ++b," 0 0 0 0 0"};b=$1}1' file
1 1 2 3 4 5
2 1 2 3 4 5
3 0 0 0 0 0
4 0 0 0 0 0
5 1 2 3 4 5
6 0 0 0 0 0
7 0 0 0 0 0
8 1 2 3 4 5
9 1 2 3 4 5
10 1 2 3 4 5
11 1 2 3 4 5

Related

Fastest way to transpose large, space delimited text file [duplicate]

This question already has answers here:
An efficient way to transpose a file in Bash
(33 answers)
Closed last month.
I face a large text file with which contains space delimited numbers, ranging from 0-9. Each line contains 3207 numbers and the file consists of 4611769 lines. I want to transpose this file.
Input example :
9 9 2 0 2 2 2 2 9 2 2 2 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 9 2 9 2 2 2 9 2 2 2 2 2 0 2 1 2 2 2 2 2 2 2 2 2 9 2 2 2 2 2 9 2 2 1 1 0 2 2 2 2 2 1 2 2 9 2 2 9 2 2 2 2 2 2 1 2 2 9 2 2 2 2 2 2 9 2 1 1 2 9 2 2 9 2 2 2 2 2 1 2 2 2 9 2 2 2 2 9 9 2 2 2 2 2 2 2 2 2 2 2 9 2 9 2 2 2 2 2 9 2 2 1 9 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9 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 9 9 2 0 2 2 2 2 9 2 2 2 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 9 2 9 2 2 2 9 2 2 2 2 2 0 2 1 2 2 2 2 2 2 2 2 2 9 2 2 2 2 2 9 2 2 1 1 0 2 2 2 2 2 1 2 2 9 2 2 9 2 2 2 2 2 2 1 2 2 9 2 2 2 2 2 2 9 2 1 1 2 9 2 2 9 2 2 2 2 2 1 2 2 2 9 2 2 2 2 9 9 2 2 2 2 2 2 2 2 2 2 2 9 2 9 2 2 2 2 2 9 2 2 1 9 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 9 9 2 0 2 2 2 2 9 2 2 2 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 9 2 9 2 2 2 9 2 2 2 2 2 0 2 1 2 2 2 2 2 2 2 2 2 9 2 2 2 2 2 9 2 2 1 1 0 2 2 2 2 2 1 2 2 9 2 2 9 2 2 2 2 2 2 1 2 2 9 2 2 2 2 2 2 9 2 1 1 2 9 2 2 9 2 2 2 2 2 1 2 2 2 9 2 2 2 2 9 9 2 2 2 2 2 2 2 2 2 2 2 9 2 9 2 2 2 2 2 9 2 2 1 9 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
...
I already tried this awk-solution : awk '{for (i=1; i<=NF; i++) a[i]=a[i](NR!=1?FS:"")$i} END {for (i=1; i in a; i++) print a[i]}' which I found here.
I chose an awk-solution due to this similar question where one user already benchmarked different solutions.
This operation runs now for more than 24 hours and I'm curious if there is by chance any other way in any possible language to achieve the same result in less computational time.
Q: What is the fastest way to transpose such a file?
EDIT I: The large amount of possible answers in this similar question is an argument to not see this question as an duplicate. The simple datamash answer as suggested in the comments should help less experienced users with bash to find the answer to this question more easily.
As mentioned in the comments by #kvantour and #Inian datamash seems to be the way to go. This one-liner should solve the question:
datamash transpose -t ' ' < input.txt > output.txt

numeric vs alphanumeric sort on ubuntu 18.04.2

I am getting some strange behavior on sort utility on Ubuntu 18.04.2. Here's some sequence of commands issued. How can I ensure numeric sort for all the columns? column 1, 2, 3, 4 should be in order.
$ cat zz
0 0 0 0
0 1 0 0
1 0 0 0
1 1 0 0
1 1 1 0
1 1 1 1
2 2 2 2
10 10 10 10
1 1 10 1
1 1 100 1
$ cat zz | sort
0 0 0 0
0 1 0 0
1 0 0 0
10 10 10 10
1 1 0 0
1 1 1 0
1 1 100 1
1 1 10 1
1 1 1 1
2 2 2 2
$ cat zz | sort -n
0 0 0 0
0 1 0 0
1 0 0 0
1 1 0 0
1 1 1 0
1 1 100 1
1 1 10 1
1 1 1 1
2 2 2 2
10 10 10 10
$ cat zz | sort -n -k1,3
0 0 0 0
0 1 0 0
1 0 0 0
1 1 0 0
1 1 1 0
1 1 100 1
1 1 10 1
1 1 1 1
2 2 2 2
10 10 10 10
Desired output (with numeric sorting):
0 0 0 0
0 1 0 0
1 0 0 0
1 1 0 0
1 1 1 0
1 1 1 1
1 1 10 1
1 1 100 1
2 2 2 2
10 10 10 10
What options should I use in sort to get my desired output i.e. sorted in numeric order

Generation of a counter variable for episodes in panel data in stata [duplicate]

This question already has an answer here:
Calculating consecutive ones
(1 answer)
Closed 1 year ago.
I am trying to generate a counter variable that describes the duration of a temporal episode in panel data.
I am using long format data that looks something like this:
clear
input byte id int time byte var1 int aim1
1 1 0 .
1 2 0 .
1 3 1 1
1 4 1 2
1 5 0 .
1 6 0 .
1 7 0 .
2 1 0 .
2 2 1 1
2 3 1 2
2 4 1 3
2 5 0 .
2 6 1 1
2 7 1 2
end
I want to generate a variable like aim1 that starts with a value of 1 when var1==1, and counts up one unit with each subsequent observation per ID where var1 is still equal to 1. For each observation where var1!=1, aim1 should contain missing values.
I already tried using rangestat (count) to solve the problem, however the created variable does not restart the count with each episode:
ssc install rangestat
gen var2=1 if var1==1
rangestat (count) aim2=var2, interval(time -7 0) by (id)
Here are two ways to do it: (1) from first principles, but see this paper for more and (2) using tsspell from SSC.
clear
input byte id int time byte var1 int aim1
1 1 0 .
1 2 0 .
1 3 1 1
1 4 1 2
1 5 0 .
1 6 0 .
1 7 0 .
2 1 0 .
2 2 1 1
2 3 1 2
2 4 1 3
2 5 0 .
2 6 1 1
2 7 1 2
end
bysort id (time) : gen wanted = 1 if var1 == 1 & var1[_n-1] != 1
by id: replace wanted = wanted[_n-1] + 1 if var1 == 1 & missing(wanted)
tsset id time
ssc inst tsspell
tsspell, cond(var1 == 1)
list, sepby(id _spell)
+---------------------------------------------------------+
| id time var1 aim1 wanted _seq _spell _end |
|---------------------------------------------------------|
1. | 1 1 0 . . 0 0 0 |
2. | 1 2 0 . . 0 0 0 |
|---------------------------------------------------------|
3. | 1 3 1 1 1 1 1 0 |
4. | 1 4 1 2 2 2 1 1 |
|---------------------------------------------------------|
5. | 1 5 0 . . 0 0 0 |
6. | 1 6 0 . . 0 0 0 |
7. | 1 7 0 . . 0 0 0 |
|---------------------------------------------------------|
8. | 2 1 0 . . 0 0 0 |
|---------------------------------------------------------|
9. | 2 2 1 1 1 1 1 0 |
10. | 2 3 1 2 2 2 1 0 |
11. | 2 4 1 3 3 3 1 1 |
|---------------------------------------------------------|
12. | 2 5 0 . . 0 0 0 |
|---------------------------------------------------------|
13. | 2 6 1 1 1 1 2 0 |
14. | 2 7 1 2 2 2 2 1 |
+---------------------------------------------------------+
The approach of tsspell is very close to what you ask for, except (a) its counter (by default _seq is 0 when out of spell, but replace _seq = . if _seq == 0 gets what you ask (b) its auxiliary variables (by default _spell and _end) are useful in many problems. You must install tsspell before you can use it with ssc install tsspell.

Covering the zeros with minimum lines in the Hungarian Method

I am trying to follow the steps of covering the zeros with the minimum number of lines in the Hungarian Method as follows:
Tick all unassigned rows.
If the ticked row has zeros, then tick the correspondent column.
Within the ticked column, if there is an assignment, then tick the correspondent row.
Draw a line above each un-ticked row and ticked column.
Repeat for each unassigned row.
Then find Theta (which is the smallest uncovered value)
The problem is when I do that, I still have zeros uncovered! causing Theta to be zero and go to an infinite loop!
For example, If we take the following matrix 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3 0 3 4 3 1 0 2 1 0 1 1 2 3 0 3 4 3 1 0 2 1
4 4 0 4 0 4 4 4 1 4 4 0 1 4 4 0 4 0 4 4 4 1 4 4 0
4 0 3 2 1 4 2 4 0 3 2 1 4 2 4 1 1 2 4 1 1 2 1 4 2
2 3 0 3 0 0 0 0 0 3 0 1 4 4 0 3 2 1 4 0 3 0 1 4 1
0 4 4 1 2 0 4 2 1 3 4 1 4 0 0 3 0 1 4 1 3 4 1 4 4
4 4 2 1 2 1 1 1 1 2 3 0 3 2 1 3 4 1 4 1 2 3 0 3 2
4 0 3 2 1 4 1 4 4 0 4 0 4 1 1 2 3 0 3 4 0 4 0 4 4
0 0 3 0 1 4 1 4 3 1 0 2 1 4 4 0 4 0 4 3 1 0 2 1 0
2 1 3 4 1 4 0 4 4 1 4 4 0 4 3 1 0 2 1 4 1 4 4 0 2
1 1 2 3 0 3 0 1 3 4 2 3 1 4 4 1 4 4 0 3 4 2 3 1 1
Then when we do the assignment, we will have 23 assignments instead of 25, so we do the mentioned earlier covering zeros based on the above steps, I would get the following:
The bold cells are the ones covered according to the above steps.
Notice that there are still zeros uncovered causing the infinite loop as it will be selected next.
Please help me.
Thank you in advance
You can use min-cost maximum flow algorithm for solving the problem when each worker may accomplish two tasks.
At first, let's see how to solve standard assignment problem using min-cost max flow. Create a bipartite graph where workers are in one part and tasks are in another. Put an edge with the capacity 1 and cost cost_ij between worker i and task j for all i, j. Then add a source S and edges from source to every worker of capacity 1 and cost 0. Similarly, add a sink T and edges from every task to sink of same cost and capacity. Then, if you find a min-cost max flow from S to T, then its value will be the total assignment cost.
So, if you allow each worker to select two tasks then edges from source to workers should be with capacity 2. This addition to the algorithm will solve your problem in the optimal way regardless to the given constraint on maximum difference.
However, at the moment I do not know the solution for the task with given restriction on every possible input. If your input values are something special, you may say it in the response and we'll think about special cases of the problem.

Average process speed is getting slower

I'm not good at English. So I ask for your patience and editing.
I have analysed census data of South Korea. I used 'adaboost' as a analysis method and adaboost was implemented for each cities. Target variable, independent variables, formula, options, the number of observation, etc, everything is same among cities. There is no difference. And I made a macro that implements adaboost for the cities one by one. The macro removes all objects except for itself before it starts to analyse the next city.
And I found that average process speed is getting slower as time goes on. I mean that the average time needed for cities 1-30 was around 10 minutes, but it became 25 minutes for the cities 80-100. So I terminated the R session and re-opened. I re-ran the macro from 80th city, then the average time for cities 80-100 was reduced to 10 minutes.
Why does this happen? How can I solve this problem? I need your help. Thanks in advance.
The r code and macro are as below. 'sgg' macro variable indicates city codes. Target variable has six categories. So I used 'one-others' method for multi-class classification.
memory.limit(size=4095)
library(gbm)
library(gtools)
dbset<-strmacro(sgg,sampnum,
expr=
{
setwd("C:\\Users\\Kim\\Desktop\\JQ\\");
db.sgg<-read.table('sgg.TXT', header=TRUE);
db.sgg<-subset(db.sgg, AGE>=10)
N<-nrow(db.sgg);
if(N>=sampnum)
{
db.sgg<-db.sgg[sample(1:N, sampnum),]
};
db.sgg$SEX<-factor(letters[db.sgg$SEX])
ordered(db.sgg$AREA);
db.sgg$josagu_attri_mod2<-factor(letters[db.sgg$josagu_attri_mod])
db.sgg$geocheo_type_mod2<-factor(letters[db.sgg$geocheo_type_mod])
db.sgg$dandok_type_mod2<-factor(letters[db.sgg$dandok_type_mod])
colnames(db.sgg)[10:15]<-c('FLC3.1','FLC3.3','FLC3.4','FLC3.5','FLC3.6','FLC3.7');
}
);
train<-strmacro(i, sgg,
expr={
res.sgg.i<-gbm(FLC3.i~SEX+AREA+AGE+josagu_attri_mod2+geocheo_type_mod2+dandok_type_mod2,
data=db.sgg, distribution='adaboost', n.trees=3000,shrinkage = 0.005,
cv.folds=5, keep.data=TRUE,
bag.fraction=0.7, interaction.depth=3);
BI.sgg.i<-gbm.perf(res.sgg.i, method='cv');
PRED.sgg.i<-predict.gbm(res.sgg.i, db.sgg, BI.sgg.i);
}
);
clean<-strmacro(sgg,
expr={
rm(BI.sgg.1);rm(BI.sgg.3);rm(BI.sgg.4);rm(BI.sgg.5);rm(BI.sgg.6);rm(BI.sgg.7);
rm(res.sgg.1);rm(res.sgg.3);rm(res.sgg.4);rm(res.sgg.5);rm(res.sgg.6);rm(res.sgg.7);
rm(PRED.sgg.1);rm(PRED.sgg.3);rm(PRED.sgg.4);rm(PRED.sgg.5);rm(PRED.sgg.6);rm(PRED.sgg.7);
rm(db.sgg);
}
);
all<-strmacro(sgg,num,
expr={
dbset(sgg,num);
train(1,sgg);train(3,sgg);train(4,sgg);train(5,sgg);train(6,sgg);train(7,sgg);
clean(sgg);
}
);
all(11010,3000)
all(11020,3000)
all(11030,3000)
Data is as below. This data is stored in '11010.txt'.
C3 mem_num josagu_attri_mod SEX AGE geocheo_type_mod dandok_type_mod C97 FLC3 FLC3_1 FLC3_3 FLC3_4 FLC_4 FLC3_6 FLC3_7 AREA
1 3 3 1 14 1 1 49 3 0 0 1 0 0 0 2
1 1 1 2 44 1 1 49 3 0 0 1 0 0 0 2
2 1 1 1 67 1 1 46 6 0 0 0 0 0 1 2
2 2 2 2 60 1 1 46 6 0 0 0 0 0 1 2
3 1 1 2 65 1 1 49 6 0 0 0 0 0 1 2
4 1 1 1 66 1 4 16 6 0 0 0 0 0 1 1
4 2 2 2 61 1 4 16 6 0 0 0 0 0 1 1
5 1 1 2 32 1 6 15 1 1 0 0 0 0 0 1
7 2 2 1 55 1 6 59 5 0 0 0 0 1 0 2
7 4 3 1 23 1 6 59 5 0 0 0 0 1 0 2
7 1 1 2 50 1 6 59 5 0 0 0 0 1 0 2
7 3 3 2 24 1 6 59 5 0 0 0 0 1 0 2
8 1 1 1 68 1 1 46 6 0 0 0 0 0 1 2
8 2 2 2 64 1 1 46 6 0 0 0 0 0 1 2
9 1 1 1 57 1 1 59 5 0 0 0 0 1 0 2
9 2 2 2 55 1 1 59 5 0 0 0 0 1 0 2
9 3 3 2 28 1 1 59 5 0 0 0 0 1 0 2
10 2 3 1 17 1 6 16 4 0 0 0 1 0 0 1
10 1 1 2 41 1 6 16 4 0 0 0 1 0 0 1
12 1 1 2 24 1 6 16 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5 0 0 0 0 1 0 2
66 2 2 2 54 2 1 50 5 0 0 0 0 1 0 2
66 3 3 2 25 2 1 50 5 0 0 0 0 1 0 2
67 1 1 1 67 2 1 120 6 0 0 0 0 0 1 4
67 2 2 2 65 2 1 120 6 0 0 0 0 0 1 4
68 1 1 1 49 2 4 98 5 0 0 0 0 1 0 3
68 4 3 1 18 2 4 98 5 0 0 0 0 1 0 3
68 2 2 2 48 2 4 98 5 0 0 0 0 1 0 3
68 3 3 2 20 2 4 98 5 0 0 0 0 1 0 3
70 1 1 1 66 2 1 101 6 0 0 0 0 0 1 4
70 2 2 2 56 2 1 101 6 0 0 0 0 0 1 4
71 1 1 1 37 2 2 101 2 0 1 0 0 0 0 4
71 2 2 2 37 2 2 101 2 0 1 0 0 0 0 4
72 1 1 1 74 1 1 91 5 0 0 0 0 1 0 3
72 3 3 1 41 1 1 91 5 0 0 0 0 1 0 3
72 2 2 2 71 1 1 91 5 0 0 0 0 1 0 3
73 1 1 1 60 1 1 91 5 0 0 0 0 1 0 3
73 3 3 1 27 1 1 91 5 0 0 0 0 1 0 3
73 2 2 2 57 1 1 91 5 0 0 0 0 1 0 3
74 1 1 1 61 2 1 119 5 0 0 0 0 1 0 4
74 4 3 1 30 2 1 119 5 0 0 0 0 1 0 4
74 2 2 2 56 2 1 119 5 0 0 0 0 1 0 4
74 3 3 2 32 2 1 119 5 0 0 0 0 1 0 4
75 2 2 1 72 1 1 99 6 0 0 0 0 0 1 3
75 1 1 2 71 1 1 99 6 0 0 0 0 0 1 3
78 1 1 2 28 1 4 15 1 1 0 0 0 0 0 1
80 1 1 1 68 1 1 92 6 0 0 0 0 0 1 3
80 2 2 2 66 1 1 92 6 0 0 0 0 0 1 3
81 2 3 1 27 1 6 46 5 0 0 0 0 1 0 2
81 3 3 1 29 1 6 46 5 0 0 0 0 1 0 2
81 1 1 2 57 1 6 46 5 0 0 0 0 1 0 2
83 1 1 1 30 1 4 43 2 0 1 0 0 0 0 2
83 2 2 2 30 1 4 43 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4 0 0 0 1 0 0 3
98 1 1 1 49 4 1 85 4 0 0 0 1 0 0 3
98 2 2 2 42 4 1 85 4 0 0 0 1 0 0 3
98 3 3 2 20 4 1 85 4 0 0 0 1 0 0 3
98 4 3 2 17 4 1 85 4 0 0 0 1 0 0 3
99 1 1 1 69 4 1 96 6 0 0 0 0 0 1 3
99 2 2 2 66 4 1 96 6 0 0 0 0 0 1 3
100 1 1 1 69 4 1 96 6 0 0 0 0 0 1 3
100 2 2 2 60 4 1 96 6 0 0 0 0 0 1 3
101 1 1 1 32 4 4 33 1 1 0 0 0 0 0 2
101 2 2 2 32 4 4 33 1 1 0 0 0 0 0 2
103 1 1 1 39 1 6 27 4 0 0 0 1 0 0 1
103 2 2 2 34 1 6 27 4 0 0 0 1 0 0 1
103 3 3 2 13 1 6 27 4 0 0 0 1 0 0 1
105 2 3 1 19 1 6 27 5 0 0 0 0 1 0 1
105 3 3 1 25 1 6 27 5 0 0 0 0 1 0 1
105 1 1 2 49 1 6 27 5 0 0 0 0 1 0 1
106 1 1 1 28 1 6 23 1 1 0 0 0 0 0 1
107 1 1 1 49 2 1 78 5 0 0 0 0 1 0 3
107 3 3 1 18 2 1 78 5 0 0 0 0 1 0 3
107 4 3 1 21 2 1 78 5 0 0 0 0 1 0 3
107 2 2 2 49 2 1 78 5 0 0 0 0 1 0 3
108 1 1 1 33 2 4 78 1 1 0 0 0 0 0 3
108 2 2 2 28 2 4 78 1 1 0 0 0 0 0 3
109 1 1 1 55 2 1 78 5 0 0 0 0 1 0 3
109 3 3 1 21 2 1 78 5 0 0 0 0 1 0 3
109 2 2 2 53 2 1 78 5 0 0 0 0 1 0 3
110 1 1 1 48 2 1 78 4 0 0 0 1 0 0 3
110 2 2 2 45 2 1 78 4 0 0 0 1 0 0 3
110 3 3 2 20 2 1 78 4 0 0 0 1 0 0 3
110 4 3 2 15 2 1 78 4 0 0 0 1 0 0 3
111 1 1 1 37 2 4 78 2 0 1 0 0 0 0 3
111 2 2 2 34 2 4 78 2 0 1 0 0 0 0 3
112 1 1 1 28 4 4 82 2 0 1 0 0 0 0 3
112 2 2 2 30 4 4 82 2 0 1 0 0 0 0 3
113 1 1 1 64 4 1 63 5 0 0 0 0 1 0 2
113 3 3 1 26 4 1 63 5 0 0 0 0 1 0 2
113 2 2 2 55 4 1 63 5 0 0 0 0 1 0 2
113 4 3 2 24 4 1 63 5 0 0 0 0 1 0 2
115 1 1 1 42 4 4 58 3 0 0 1 0 0 0 2
115 4 3 1 10 4 4 58 3 0 0 1 0 0 0 2
115 2 2 2 39 4 4 58 3 0 0 1 0 0 0 2
115 3 3 2 12 4 4 58 3 0 0 1 0 0 0 2
116 1 1 1 56 4 1 63 5 0 0 0 0 1 0 2
116 3 3 1 29 4 1 63 5 0 0 0 0 1 0 2
116 2 2 2 51 4 1 63 5 0 0 0 0 1 0 2
118 1 1 1 75 4 1 70 6 0 0 0 0 0 1 3
118 2 2 2 74 4 1 70 6 0 0 0 0 0 1 3
119 1 1 1 49 1 4 66 4 0 0 0 1 0 0 2
119 3 3 1 18 1 4 66 4 0 0 0 1 0 0 2
119 4 3 1 17 1 4 66 4 0 0 0 1 0 0 2
119 2 2 2 47 1 4 66 4 0 0 0 1 0 0 2
120 2 3 1 32 4 1 56 5 0 0 0 0 1 0 2
120 1 1 2 64 4 1 56 5 0 0 0 0 1 0 2
120 3 3 2 41 4 1 56 5 0 0 0 0 1 0 2
121 1 1 1 44 4 4 56 4 0 0 0 1 0 0 2
121 3 3 1 17 4 4 56 4 0 0 0 1 0 0 2
121 4 3 1 16 4 4 56 4 0 0 0 1 0 0 2
121 2 2 2 42 4 4 56 4 0 0 0 1 0 0 2
123 1 1 1 44 4 4 56 3 0 0 1 0 0 0 2
123 2 2 2 43 4 4 56 3 0 0 1 0 0 0 2
123 3 3 2 11 4 4 56 3 0 0 1 0 0 0 2
123 5 3 2 14 4 4 56 3 0 0 1 0 0 0 2
125 2 3 1 21 1 4 30 5 0 0 0 0 1 0 1
125 1 1 2 48 1 4 30 5 0 0 0 0 1 0 1
126 1 1 1 49 1 4 30 5 0 0 0 0 1 0 1
126 2 2 2 44 1 4 30 5 0 0 0 0 1 0 1
126 3 3 2 25 1 4 30 5 0 0 0 0 1 0 1
127 1 1 1 75 1 6 25 6 0 0 0 0 0 1 1
128 1 1 1 49 2 1 82 3 0 0 1 0 0 0 3
128 3 3 1 12 2 1 82 3 0 0 1 0 0 0 3
128 2 2 2 43 2 1 82 3 0 0 1 0 0 0 3
129 1 1 2 66 2 1 82 6 0 0 0 0 0 1 3
130 1 1 1 36 2 4 82 3 0 0 1 0 0 0 3
130 2 2 2 41 2 4 82 3 0 0 1 0 0 0 3
130 3 3 2 11 2 4 82 3 0 0 1 0 0 0 3
132 1 1 2 64 2 1 82 6 0 0 0 0 0 1 3
133 1 1 1 34 2 1 82 2 0 1 0 0 0 0 3
133 2 2 2 35 2 1 82 2 0 1 0 0 0 0 3
134 1 1 1 37 2 4 82 2 0 1 0 0 0 0 3
134 2 2 2 35 2 4 82 2 0 1 0 0 0 0 3
135 1 1 1 38 2 4 82 2 0 1 0 0 0 0 3
135 2 2 2 37 2 4 82 2 0 1 0 0 0 0 3
136 1 1 1 31 2 6 83 1 1 0 0 0 0 0 3
136 2 2 2 29 2 6 83 1 1 0 0 0 0 0 3
137 2 2 1 47 2 5 30 3 0 0 1 0 0 0 1
137 3 3 1 19 2 5 30 3 0 0 1 0 0 0 1
137 1 1 2 43 2 5 30 3 0 0 1 0 0 0 1
137 4 3 2 10 2 5 30 3 0 0 1 0 0 0 1
138 2 3 1 24 2 5 30 5 0 0 0 0 1 0 1
138 1 1 2 54 2 5 30 5 0 0 0 0 1 0 1
139 1 1 2 44 2 5 30 4 0 0 0 1 0 0 1
139 2 3 2 13 2 5 30 4 0 0 0 1 0 0 1
139 3 3 2 15 2 5 30 4 0 0 0 1 0 0 1
140 1 1 2 55 2 5 30 5 0 0 0 0 1 0 1
140 2 3 2 29 2 5 30 5 0 0 0 0 1 0 1
141 1 1 1 45 2 5 30 4 0 0 0 1 0 0 1
141 2 2 2 43 2 5 30 4 0 0 0 1 0 0 1
141 3 3 2 15 2 5 30 4 0 0 0 1 0 0 1
141 4 3 2 13 2 5 30 4 0 0 0 1 0 0 1
142 1 1 2 52 2 5 30 4 0 0 0 1 0 0 1
142 2 3 2 23 2 5 30 4 0 0 0 1 0 0 1
142 3 3 2 18 2 5 30 4 0 0 0 1 0 0 1
144 1 1 1 52 2 5 30 5 0 0 0 0 1 0 1
144 4 3 1 19 2 5 30 5 0 0 0 0 1 0 1
144 2 2 2 48 2 5 30 5 0 0 0 0 1 0 1
144 3 3 2 22 2 5 30 5 0 0 0 0 1 0 1
145 1 1 1 61 2 4 72 6 0 0 0 0 0 1 3
145 2 2 2 55 2 4 72 6 0 0 0 0 0 1 3
147 1 1 1 32 2 4 85 1 1 0 0 0 0 0 3
147 2 2 2 33 2 4 85 1 1 0 0 0 0 0 3
148 1 1 1 30 2 1 85 1 1 0 0 0 0 0 3
148 2 2 2 35 2 1 85 1 1 0 0 0 0 0 3
149 2 2 1 54 1 1 46 4 0 0 0 1 0 0 2
149 1 1 2 51 1 1 46 4 0 0 0 1 0 0 2
149 3 3 2 20 1 1 46 4 0 0 0 1 0 0 2
149 4 3 2 13 1 1 46 4 0 0 0 1 0 0 2
149 5 3 2 27 1 1 46 4 0 0 0 1 0 0 2
152 1 1 1 72 1 1 99 5 0 0 0 0 1 0 3
152 3 3 1 39 1 1 99 5 0 0 0 0 1 0 3
152 2 2 2 69 1 1 99 5 0 0 0 0 1 0 3
153 1 1 1 28 1 6 49 2 0 1 0 0 0 0 2
153 2 2 2 27 1 6 49 2 0 1 0 0 0 0 2
155 1 1 2 54 1 6 27 5 0 0 0 0 1 0 1
155 2 3 2 29 1 6 27 5 0 0 0 0 1 0 1
156 1 1 1 48 1 1 76 3 0 0 1 0 0 0 3
156 3 3 1 17 1 1 76 3 0 0 1 0 0 0 3
156 2 2 2 43 1 1 76 3 0 0 1 0 0 0 3
158 1 1 1 52 1 4 50 5 0 0 0 0 1 0 2
158 3 3 1 23 1 4 50 5 0 0 0 0 1 0 2
158 2 2 2 47 1 4 50 5 0 0 0 0 1 0 2
158 4 3 2 20 1 4 50 5 0 0 0 0 1 0 2
159 1 1 1 54 1 6 40 5 0 0 0 0 1 0 2
159 3 3 1 30 1 6 40 5 0 0 0 0 1 0 2
159 2 2 2 51 1 6 40 5 0 0 0 0 1 0 2
159 4 3 2 28 1 6 40 5 0 0 0 0 1 0 2
160 1 1 1 35 1 4 36 2 0 1 0 0 0 0 2
160 2 2 2 34 1 4 36 2 0 1 0 0 0 0 2
162 1 1 1 74 1 1 76 6 0 0 0 0 0 1 3
162 2 2 2 74 1 1 76 6 0 0 0 0 0 1 3
163 3 3 1 16 1 4 40 4 0 0 0 1 0 0 2
163 1 1 2 44 1 4 40 4 0 0 0 1 0 0 2
163 2 3 2 20 1 4 40 4 0 0 0 1 0 0 2
165 1 1 1 72 2 1 114 6 0 0 0 0 0 1 4
165 2 2 2 69 2 1 114 6 0 0 0 0 0 1 4
166 1 1 1 59 2 4 114 5 0 0 0 0 1 0 4
166 3 3 1 26 2 4 114 5 0 0 0 0 1 0 4
166 2 2 2 54 2 4 114 5 0 0 0 0 1 0 4
166 4 3 2 28 2 4 114 5 0 0 0 0 1 0 4
168 1 1 1 55 2 1 114 5 0 0 0 0 1 0 4
168 3 3 1 28 2 1 114 5 0 0 0 0 1 0 4
168 2 2 2 49 2 1 114 5 0 0 0 0 1 0 4
168 4 3 2 26 2 1 114 5 0 0 0 0 1 0 4
171 1 1 1 57 2 1 114 5 0 0 0 0 1 0 4
171 3 3 1 26 2 1 114 5 0 0 0 0 1 0 4
171 2 2 2 50 2 1 114 5 0 0 0 0 1 0 4
172 1 1 1 58 2 1 114 5 0 0 0 0 1 0 4
172 3 3 1 22 2 1 114 5 0 0 0 0 1 0 4
172 4 3 1 25 2 1 114 5 0 0 0 0 1 0 4
172 2 2 2 53 2 1 114 5 0 0 0 0 1 0 4
172 5 3 2 27 2 1 114 5 0 0 0 0 1 0 4
173 1 1 1 45 3 4 59 3 0 0 1 0 0 0 2
173 3 3 1 12 3 4 59 3 0 0 1 0 0 0 2
173 2 2 2 33 3 4 59 3 0 0 1 0 0 0 2
174 1 1 2 80 3 1 59 6 0 0 0 0 0 1 2
175 1 1 1 71 3 1 59 5 0 0 0 0 1 0 2
175 2 2 2 67 3 1 59 5 0 0 0 0 1 0 2
175 3 3 2 28 3 1 59 5 0 0 0 0 1 0 2
176 1 1 1 55 3 1 59 4 0 0 0 1 0 0 2
176 3 3 1 25 3 1 59 4 0 0 0 1 0 0 2
176 2 2 2 50 3 1 59 4 0 0 0 1 0 0 2
176 4 3 2 17 3 1 59 4 0 0 0 1 0 0 2
178 2 2 1 60 3 1 59 5 0 0 0 0 1 0 2
178 3 3 1 26 3 1 59 5 0 0 0 0 1 0 2
178 4 3 1 23 3 1 59 5 0 0 0 0 1 0 2
178 1 1 2 50 3 1 59 5 0 0 0 0 1 0 2
179 1 1 1 52 3 1 59 4 0 0 0 1 0 0 2
179 3 3 1 18 3 1 59 4 0 0 0 1 0 0 2
179 2 2 2 43 3 1 59 4 0 0 0 1 0 0 2
179 4 3 2 17 3 1 59 4 0 0 0 1 0 0 2
180 1 1 1 60 3 1 59 5 0 0 0 0 1 0 2
180 3 3 1 27 3 1 59 5 0 0 0 0 1 0 2
180 2 2 2 60 3 1 59 5 0 0 0 0 1 0 2
182 1 1 2 47 4 1 53 3 0 0 1 0 0 0 2
182 2 3 2 10 4 1 53 3 0 0 1 0 0 0 2
184 1 1 1 36 4 4 59 2 0 1 0 0 0 0 2
184 2 2 2 38 4 4 59 2 0 1 0 0 0 0 2
185 1 1 1 43 4 1 59 3 0 0 1 0 0 0 2
185 3 3 1 15 4 1 59 3 0 0 1 0 0 0 2
185 4 3 1 11 4 1 59 3 0 0 1 0 0 0 2
185 2 2 2 41 4 1 59 3 0 0 1 0 0 0 2
186 1 1 1 36 4 1 50 2 0 1 0 0 0 0 2
186 2 2 2 32 4 1 50 2 0 1 0 0 0 0 2
186 5 3 2 10 4 1 50 2 0 1 0 0 0 0 2
187 1 1 2 55 4 1 53 5 0 0 0 0 1 0 2
187 2 3 2 25 4 1 53 5 0 0 0 0 1 0 2
187 3 3 2 27 4 1 53 5 0 0 0 0 1 0 2
188 1 1 1 67 4 1 53 6 0 0 0 0 0 1 2
188 2 2 2 64 4 1 53 6 0 0 0 0 0 1 2
189 1 1 1 69 4 1 50 5 0 0 0 0 1 0 2
189 3 3 1 34 4 1 50 5 0 0 0 0 1 0 2
189 2 2 2 57 4 1 50 5 0 0 0 0 1 0 2
190 1 1 1 62 4 1 50 5 0 0 0 0 1 0 2
190 3 3 1 27 4 1 50 5 0 0 0 0 1 0 2
190 2 2 2 55 4 1 50 5 0 0 0 0 1 0 2
191 1 1 1 38 3 1 54 2 0 1 0 0 0 0 2
191 2 2 2 36 3 1 54 2 0 1 0 0 0 0 2
192 1 1 2 69 3 4 54 6 0 0 0 0 0 1 2
193 1 1 1 58 3 4 54 5 0 0 0 0 1 0 2
193 3 3 1 27 3 4 54 5 0 0 0 0 1 0 2
193 4 3 1 24 3 4 54 5 0 0 0 0 1 0 2
193 2 2 2 50 3 4 54 5 0 0 0 0 1 0 2
194 1 1 1 77 3 1 54 6 0 0 0 0 0 1 2
194 2 2 2 77 3 1 54 6 0 0 0 0 0 1 2
196 1 1 1 63 4 1 73 5 0 0 0 0 1 0 3
196 3 3 1 37 4 1 73 5 0 0 0 0 1 0 3
196 4 3 1 33 4 1 73 5 0 0 0 0 1 0 3
196 2 2 2 62 4 1 73 5 0 0 0 0 1 0 3
197 1 1 1 66 4 1 73 6 0 0 0 0 0 1 3
197 2 2 2 59 4 1 73 6 0 0 0 0 0 1 3
198 1 1 1 52 4 1 73 3 0 0 1 0 0 0 3
198 3 3 1 13 4 1 73 3 0 0 1 0 0 0 3
198 2 2 2 47 4 1 73 3 0 0 1 0 0 0 3
198 4 3 2 12 4 1 73 3 0 0 1 0 0 0 3
199 1 1 1 43 4 4 73 3 0 0 1 0 0 0 3
199 2 2 2 41 4 4 73 3 0 0 1 0 0 0 3
199 3 3 2 11 4 4 73 3 0 0 1 0 0 0 3
200 2 3 1 26 4 1 73 5 0 0 0 0 1 0 3
200 3 3 1 28 4 1 73 5 0 0 0 0 1 0 3
200 1 1 2 53 4 1 73 5 0 0 0 0 1 0 3
201 1 1 1 53 4 1 73 5 0 0 0 0 1 0 3
201 3 3 1 27 4 1 73 5 0 0 0 0 1 0 3
201 2 2 2 50 4 1 73 5 0 0 0 0 1 0 3
202 1 1 1 77 4 1 73 5 0 0 0 0 1 0 3
202 3 3 1 35 4 1 73 5 0 0 0 0 1 0 3
202 2 2 2 60 4 1 73 5 0 0 0 0 1 0 3
204 1 1 1 56 4 1 53 5 0 0 0 0 1 0 2
204 2 2 2 53 4 1 53 5 0 0 0 0 1 0 2
204 3 3 2 22 4 1 53 5 0 0 0 0 1 0 2
205 1 1 1 60 4 4 66 5 0 0 0 0 1 0 2
205 3 3 1 29 4 4 66 5 0 0 0 0 1 0 2
205 4 3 1 27 4 4 66 5 0 0 0 0 1 0 2
205 2 2 2 56 4 4 66 5 0 0 0 0 1 0 2
206 1 1 1 67 4 1 76 6 0 0 0 0 0 1 3
206 2 2 2 67 4 1 76 6 0 0 0 0 0 1 3
208 1 1 1 46 4 1 66 4 0 0 0 1 0 0 2
208 4 3 1 14 4 1 66 4 0 0 0 1 0 0 2
208 2 2 2 45 4 1 66 4 0 0 0 1 0 0 2
208 3 3 2 17 4 1 66 4 0 0 0 1 0 0 2
209 1 1 1 42 4 4 56 2 0 1 0 0 0 0 2
209 3 3 1 10 4 4 56 2 0 1 0 0 0 0 2
209 2 2 2 38 4 4 56 2 0 1 0 0 0 0 2
210 3 3 1 12 4 1 56 3 0 0 1 0 0 0 2
210 1 1 2 40 4 1 56 3 0 0 1 0 0 0 2
210 2 3 2 10 4 1 56 3 0 0 1 0 0 0 2
212 1 1 2 37 1 4 63 2 0 1 0 0 0 0 2
214 1 1 1 63 3 1 40 6 0 0 0 0 0 1 2
215 1 1 1 62 3 1 40 5 0 0 0 0 1 0 2
215 3 3 1 28 3 1 40 5 0 0 0 0 1 0 2
215 2 2 2 57 3 1 40 5 0 0 0 0 1 0 2
216 1 1 2 71 3 1 40 6 0 0 0 0 0 1 2
217 1 1 2 49 4 1 40 5 0 0 0 0 1 0 2
217 2 3 2 24 4 1 40 5 0 0 0 0 1 0 2
218 1 1 1 74 1 1 37 6 0 0 0 0 0 1 2
218 2 2 2 67 1 1 37 6 0 0 0 0 0 1 2
220 1 1 1 51 4 4 66 4 0 0 0 1 0 0 2
220 4 3 1 13 4 4 66 4 0 0 0 1 0 0 2
220 5 3 1 18 4 4 66 4 0 0 0 1 0 0 2
220 2 2 2 49 4 4 66 4 0 0 0 1 0 0 2
220 3 3 2 16 4 4 66 4 0 0 0 1 0 0 2
221 1 1 2 81 1 6 40 6 0 0 0 0 0 1 2
222 1 1 1 45 2 1 85 3 0 0 1 0 0 0 3
222 4 3 1 10 2 1 85 3 0 0 1 0 0 0 3
222 2 2 2 41 2 1 85 3 0 0 1 0 0 0 3
222 3 3 2 15 2 1 85 3 0 0 1 0 0 0 3
223 1 1 2 51 2 1 85 5 0 0 0 0 1 0 3
223 2 3 2 25 2 1 85 5 0 0 0 0 1 0 3
224 2 3 1 12 2 4 85 4 0 0 0 1 0 0 3
224 1 1 2 47 2 4 85 4 0 0 0 1 0 0 3
224 3 3 2 18 2 4 85 4 0 0 0 1 0 0 3
225 1 1 1 68 2 1 85 6 0 0 0 0 0 1 3
225 2 2 2 67 2 1 85 6 0 0 0 0 0 1 3
226 1 1 1 50 2 1 85 4 0 0 0 1 0 0 3
226 4 3 1 17 2 1 85 4 0 0 0 1 0 0 3
226 2 2 2 46 2 1 85 4 0 0 0 1 0 0 3
226 3 3 2 19 2 1 85 4 0 0 0 1 0 0 3
229 2 2 1 67 2 1 85 5 0 0 0 0 1 0 3
229 1 1 2 57 2 1 85 5 0 0 0 0 1 0 3
229 3 3 2 37 2 1 85 5 0 0 0 0 1 0 3
232 1 1 1 54 2 1 86 5 0 0 0 0 1 0 3
232 2 2 2 53 2 1 86 5 0 0 0 0 1 0 3
232 3 3 2 29 2 1 86 5 0 0 0 0 1 0 3
233 1 1 1 57 2 1 86 5 0 0 0 0 1 0 3
233 2 2 2 52 2 1 86 5 0 0 0 0 1 0 3
233 3 3 2 24 2 1 86 5 0 0 0 0 1 0 3
235 1 1 2 51 2 1 86 3 0 0 1 0 0 0 3
236 1 1 1 41 2 4 86 2 0 1 0 0 0 0 3
236 5 3 1 12 2 4 86 2 0 1 0 0 0 0 3
236 2 2 2 39 2 4 86 2 0 1 0 0 0 0 3
236 3 3 2 10 2 4 86 2 0 1 0 0 0 0 3
237 1 1 1 48 2 1 86 4 0 0 0 1 0 0 3
237 2 2 2 48 2 1 86 4 0 0 0 1 0 0 3
237 3 3 2 20 2 1 86 4 0 0 0 1 0 0 3
237 4 3 2 16 2 1 86 4 0 0 0 1 0 0 3
238 1 1 2 53 4 1 50 5 0 0 0 0 1 0 2
238 2 3 2 29 4 1 50 5 0 0 0 0 1 0 2
240 2 3 1 31 4 1 50 5 0 0 0 0 1 0 2
240 1 1 2 61 4 1 50 5 0 0 0 0 1 0 2
241 2 3 1 24 4 1 50 5 0 0 0 0 1 0 2
241 1 1 2 51 4 1 50 5 0 0 0 0 1 0 2
242 1 1 1 39 4 6 50 3 0 0 1 0 0 0 2
242 3 3 1 11 4 6 50 3 0 0 1 0 0 0 2
242 2 2 2 38 4 6 50 3 0 0 1 0 0 0 2
245 1 1 1 48 4 1 50 4 0 0 0 1 0 0 2
245 3 3 1 17 4 1 50 4 0 0 0 1 0 0 2
245 2 2 2 42 4 1 50 4 0 0 0 1 0 0 2
246 1 1 1 58 5 4 50 5 0 0 0 0 1 0 2
246 2 2 2 50 5 4 50 5 0 0 0 0 1 0 2
246 3 3 2 26 5 4 50 5 0 0 0 0 1 0 2
247 2 2 1 43 4 1 46 3 0 0 1 0 0 0 2
247 1 1 2 41 4 1 46 3 0 0 1 0 0 0 2
247 3 3 2 11 4 1 46 3 0 0 1 0 0 0 2
248 1 1 1 40 4 1 70 1 1 0 0 0 0 0 3
248 2 2 2 32 4 1 70 1 1 0 0 0 0 0 3
249 1 1 1 43 4 1 64 4 0 0 0 1 0 0 2
249 3 3 1 16 4 1 64 4 0 0 0 1 0 0 2
249 2 2 2 41 4 1 64 4 0 0 0 1 0 0 2
249 4 3 2 15 4 1 64 4 0 0 0 1 0 0 2
250 2 2 1 32 4 1 54 1 1 0 0 0 0 0 2
250 1 1 2 30 4 1 54 1 1 0 0 0 0 0 2
251 1 1 1 65 1 1 132 6 0 0 0 0 0 1 4
251 2 2 2 62 1 1 132 6 0 0 0 0 0 1 4
254 1 1 1 37 2 4 85 2 0 1 0 0 0 0 3
254 2 2 2 37 2 4 85 2 0 1 0 0 0 0 3
256 1 1 1 50 2 1 85 4 0 0 0 1 0 0 3
256 2 2 2 47 2 1 85 4 0 0 0 1 0 0 3
256 3 3 2 16 2 1 85 4 0 0 0 1 0 0 3
256 4 3 2 14 2 1 85 4 0 0 0 1 0 0 3
257 1 1 1 46 2 4 85 4 0 0 0 1 0 0 3
257 4 3 1 16 2 4 85 4 0 0 0 1 0 0 3
257 2 2 2 44 2 4 85 4 0 0 0 1 0 0 3
257 3 3 2 19 2 4 85 4 0 0 0 1 0 0 3
259 1 1 1 55 2 1 85 5 0 0 0 0 1 0 3
259 2 2 2 53 2 1 85 5 0 0 0 0 1 0 3
259 3 3 2 31 2 1 85 5 0 0 0 0 1 0 3
261 1 1 1 65 2 1 145 6 0 0 0 0 0 1 5
261 2 2 2 62 2 1 145 6 0 0 0 0 0 1 5
262 1 1 1 44 3 1 56 4 0 0 0 1 0 0 2
262 3 3 1 19 3 1 56 4 0 0 0 1 0 0 2
262 2 2 2 42 3 1 56 4 0 0 0 1 0 0 2
262 4 3 2 15 3 1 56 4 0 0 0 1 0 0 2
263 1 1 1 49 3 1 54 5 0 0 0 0 1 0 2
263 4 3 1 22 3 1 54 5 0 0 0 0 1 0 2
263 2 2 2 47 3 1 54 5 0 0 0 0 1 0 2
263 3 3 2 19 3 1 54 5 0 0 0 0 1 0 2
266 1 1 1 54 3 1 56 5 0 0 0 0 1 0 2
266 3 3 1 29 3 1 56 5 0 0 0 0 1 0 2
266 2 2 2 49 3 1 56 5 0 0 0 0 1 0 2
267 1 1 2 63 3 1 42 6 0 0 0 0 0 1 2
268 1 1 1 45 3 1 43 3 0 0 1 0 0 0 2
268 3 3 1 11 3 1 43 3 0 0 1 0 0 0 2
268 2 2 2 36 3 1 43 3 0 0 1 0 0 0 2
268 5 3 2 12 3 1 43 3 0 0 1 0 0 0 2
269 1 1 1 45 3 1 47 3 0 0 1 0 0 0 2
269 2 2 2 42 3 1 47 3 0 0 1 0 0 0 2
269 3 3 2 11 3 1 47 3 0 0 1 0 0 0 2
270 1 1 1 34 2 4 59 2 0 1 0 0 0 0 2
270 2 2 2 34 2 4 59 2 0 1 0 0 0 0 2
271 2 2 1 60 2 1 59 5 0 0 0 0 1 0 2
271 3 3 1 34 2 1 59 5 0 0 0 0 1 0 2
271 1 1 2 57 2 1 59 5 0 0 0 0 1 0 2
272 1 1 1 35 2 1 59 2 0 1 0 0 0 0 2
272 2 2 2 35 2 1 59 2 0 1 0 0 0 0 2
273 1 1 1 35 2 1 59 2 0 1 0 0 0 0 2
273 2 2 2 39 2 1 59 2 0 1 0 0 0 0 2
275 1 1 1 33 2 1 59 2 0 1 0 0 0 0 2
275 2 2 2 29 2 1 59 2 0 1 0 0 0 0 2
276 1 1 1 30 2 4 59 1 1 0 0 0 0 0 2
277 1 1 1 47 2 1 59 4 0 0 0 1 0 0 2
277 2 2 2 48 2 1 59 4 0 0 0 1 0 0 2
277 3 3 2 17 2 1 59 4 0 0 0 1 0 0 2
277 4 3 2 15 2 1 59 4 0 0 0 1 0 0 2
278 1 1 1 78 2 1 84 6 0 0 0 0 0 1 3
278 2 2 2 79 2 1 84 6 0 0 0 0 0 1 3
280 1 1 1 56 2 1 84 5 0 0 0 0 1 0 3
280 2 2 2 53 2 1 84 5 0 0 0 0 1 0 3
280 3 3 2 27 2 1 84 5 0 0 0 0 1 0 3
281 1 1 1 50 2 1 84 4 0 0 0 1 0 0 3
281 4 3 1 17 2 1 84 4 0 0 0 1 0 0 3
281 2 2 2 45 2 1 84 4 0 0 0 1 0 0 3
281 3 3 2 22 2 1 84 4 0 0 0 1 0 0 3
283 1 1 1 51 2 1 84 5 0 0 0 0 1 0 3
283 4 3 1 25 2 1 84 5 0 0 0 0 1 0 3
283 2 2 2 49 2 1 84 5 0 0 0 0 1 0 3
283 3 3 2 27 2 1 84 5 0 0 0 0 1 0 3
285 1 1 1 48 2 1 122 3 0 0 1 0 0 0 4
285 5 3 1 17 2 1 122 3 0 0 1 0 0 0 4
285 2 2 2 41 2 1 122 3 0 0 1 0 0 0 4
285 3 3 2 15 2 1 122 3 0 0 1 0 0 0 4
286 1 1 1 57 2 1 122 5 0 0 0 0 1 0 4
286 4 3 1 25 2 1 122 5 0 0 0 0 1 0 4
286 2 2 2 51 2 1 122 5 0 0 0 0 1 0 4
286 3 3 2 29 2 1 122 5 0 0 0 0 1 0 4
287 1 1 1 43 2 1 122 2 0 1 0 0 0 0 4
287 2 2 2 40 2 1 122 2 0 1 0 0 0 0 4
287 3 3 2 12 2 1 122 2 0 1 0 0 0 0 4
290 1 1 1 46 2 1 102 3 0 0 1 0 0 0 4
290 4 3 1 10 2 1 102 3 0 0 1 0 0 0 4
290 2 2 2 42 2 1 102 3 0 0 1 0 0 0 4
290 3 3 2 15 2 1 102 3 0 0 1 0 0 0 4
291 1 1 1 30 2 4 102 2 0 1 0 0 0 0 4
291 2 2 2 26 2 4 102 2 0 1 0 0 0 0 4
292 1 1 2 61 1 1 59 6 0 0 0 0 0 1 2
295 1 1 1 47 1 4 43 3 0 0 1 0 0 0 2
295 3 3 1 11 1 4 43 3 0 0 1 0 0 0 2
295 2 2 2 43 1 4 43 3 0 0 1 0 0 0 2
297 1 1 1 43 1 4 43 2 0 1 0 0 0 0 2
297 2 2 2 46 1 4 43 2 0 1 0 0 0 0 2
298 1 1 1 40 1 4 56 2 0 1 0 0 0 0 2
298 2 2 2 37 1 4 56 2 0 1 0 0 0 0 2
299 2 3 1 24 1 4 50 5 0 0 0 0 1 0 2
299 1 1 2 60 1 4 50 5 0 0 0 0 1 0 2
300 1 1 1 46 4 4 83 4 0 0 0 1 0 0 3
300 2 2 2 43 4 4 83 4 0 0 0 1 0 0 3
300 3 3 2 13 4 4 83 4 0 0 0 1 0 0 3
My understanding is that R is implemented as copy-on-write.
Take for instance:
X <- 1:1000
y <- x # no copy made. x & y share the reference
y[1] <- 8 # now a copy is made.
If x is growing, the copies take longer and longer, and the script slows down.
I'm not that familiar with macro variables, but I suspect something like this is happening.
If you're working with a list, every time you add a new element to the list, every thing is recopied.
y <- list()
y$this <- 1:5
y$that <- 6:10 # now every thing was recopied.
Therefore it's better to allocate first. It really helps the performance.
y <- vector("list", 2)
y[[1]] <- 1:5
y[[2]] <- 6:10
These slides are really good: a link take a look!

Resources