| [ |
| { |
| "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Tell me how many times Alice sold a stock.", |
| "create": { |
| "local": "default", |
| "init": { |
| "file": "init/stock-log.sh" |
| } |
| }, |
| "evaluation": { |
| "check": [ |
| null, |
| { |
| "language": "python", |
| "file": "check/integer-match.py" |
| } |
| ], |
| "example": { |
| "code": "grep \"Alice | Sell\" /usr/stock.log | wc -l" |
| } |
| }, |
| "labels": ["log", "file"] |
| }, |
| { |
| "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Tell me how many times Bob bought a stock.", |
| "create": { |
| "local": "default", |
| "init": { |
| "file": "init/stock-log.sh" |
| } |
| }, |
| "evaluation": { |
| "check": [ |
| null, |
| { |
| "language": "python", |
| "file": "check/integer-match.py" |
| } |
| ], |
| "example": { |
| "code": "grep \"Bob | Purchase\" /usr/stock.log | wc -l" |
| } |
| }, |
| "labels": ["log", "file"] |
| }, |
| { |
| "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Please count the total number of stocks that Alice bought, and tell me the number.", |
| "create": { |
| "local": "default", |
| "init": { |
| "file": "init/stock-log.sh" |
| } |
| }, |
| "evaluation": { |
| "check": [ |
| null, |
| { |
| "language": "python", |
| "file": "check/integer-match.py" |
| } |
| ], |
| "example": { |
| "code": "grep \"Alice | Purchase\" /usr/stock.log | awk -F '|' '{sum += $NF} END {print sum}'" |
| } |
| }, |
| "labels": ["log", "file"] |
| }, |
| { |
| "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Please determine the number of types of stocks Bob sold. And tell me the answer.", |
| "create": { |
| "local": "default", |
| "init": { |
| "file": "init/stock-log.sh" |
| } |
| }, |
| "evaluation": { |
| "check": [ |
| null, |
| { |
| "language": "python", |
| "file": "check/integer-match.py" |
| } |
| ], |
| "example": { |
| "code": "grep \"Bob | Sell\" /usr/stock.log | awk -F '|' '{print $3}' | sort -u | wc -l" |
| } |
| }, |
| "labels": ["log", "file"] |
| }, |
| { |
| "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Please count the number of types of stocks that Bob sold but never bought. And tell me the answer.", |
| "create": { |
| "local": "default", |
| "init": { |
| "file": "init/stock-log.sh" |
| } |
| }, |
| "evaluation": { |
| "check": [ |
| null, |
| { |
| "language": "python", |
| "file": "check/integer-match.py" |
| } |
| ], |
| "example": { |
| "code": "grep \"Bob | Sell\" /usr/stock.log | awk -F '|' '{print $3}' | sort | uniq > bob_sold.txt; grep \"Bob | Purchase\" /usr/stock.log | awk -F '|' '{print $3}' | sort | uniq > bob_bought.txt; comm -23 bob_sold.txt bob_bought.txt | wc -l; rm bob_sold.txt bob_bought.txt" |
| } |
| }, |
| "labels": ["log", "file"] |
| }, |
| { |
| "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Identify the most active traders (buyers/sellers) based on the count of their transactions.", |
| "create": { |
| "local": "default", |
| "init": { |
| "file": "init/stock-log.sh" |
| } |
| }, |
| "evaluation": { |
| "check": [ |
| null, |
| { |
| "language": "python", |
| "file": "check/string-match.py" |
| } |
| ], |
| "example": { |
| "code": "awk -F '|' '{print $1}' /usr/stock.log | sort | uniq -c | sort -nr | head -n 1 | awk '{print $2}'" |
| } |
| }, |
| "labels": ["log", "file"] |
| }, |
| { |
| "description": "Stock logs are shown in /usr/stock.log. The last two columns are stock index and count. Find the stock index with the highest count of transactions (combined purchases and sales).", |
| "create": { |
| "local": "default", |
| "init": { |
| "file": "init/stock-log.sh" |
| } |
| }, |
| "evaluation": { |
| "check": [ |
| null, |
| { |
| "language": "python", |
| "file": "check/string-match.py" |
| } |
| ], |
| "example": { |
| "code": "awk -F '|' '{a[$3]++} END {max=0; for (stock in a) {if (a[stock] > max) {max = a[stock]; stockIndex = stock}} print stockIndex}' /usr/stock.log" |
| } |
| }, |
| "labels": ["log", "file"] |
| } |
| ] |
|
|