code
stringlengths 24
983k
| language
stringclasses 3
values | AST_depth
int64 -1
40
| alphanumeric_fraction
float64 0
1
| max_line_length
int64 0
500k
| avg_line_length
float64 0
249k
| num_lines
int64 0
33.7k
| source
stringclasses 1
value |
---|---|---|---|---|---|---|---|
for(var i = 1; i <= 9; i++){
for(var j = 1; j <= 9; j++){
console.log(i + "x" + j + "=" + i * j);
}
} | javascript | 13 | 0.352381 | 41 | 20.2 | 5 | codenet |
(function () {
function main () {
var i, j;
for (i = 1; i < 10; i += 1) {
for (j = 1; j < 10; j += 1) {
console.log(i + 'x' + j + '=' + i * j);
}
}
}
main();
}()); | javascript | 20 | 0.315271 | 47 | 14.692308 | 13 | codenet |
for ( i = 1; i <= 9; i++)
{
for ( j = 1; j <= 9; j++)
{
console.log(i+"x"+j+"="+(i*j));
}
} | javascript | 13 | 0.303922 | 33 | 13.714286 | 7 | codenet |
for (var i = 1; i < 10; i++) {
for (var j = 1; j < 10; j++) {
console.log((i + 'x' + j + '=') + (i * j))
}
} | javascript | 14 | 0.314516 | 50 | 24 | 5 | codenet |
for (var i = 1; i < 10; i++) {
for (var j = 1; j < 10; j++) {
console.log(i + "x" + j + "=" + i * j);
}
} | javascript | 13 | 0.322314 | 47 | 23.4 | 5 | codenet |
for(var i=1;i<10;i++)for(var j=1;j<10;j++)console.log(i+"x"+j+"="+(i*j)) | javascript | 11 | 0.541667 | 72 | 72 | 1 | codenet |
for(var i=1;i<=9;i++){
for(var j=1;j<=9;j++){
console.log(i+"x"+j+"="+i*j);
}
} | javascript | 13 | 0.468354 | 29 | 15 | 5 | codenet |
for(var i = 1; i < 10; i++){
for(var j = 1; j < 10; j++){
console.log(i+"x"+j+"="+(i*j));
}
} | javascript | 13 | 0.402062 | 33 | 18.6 | 5 | codenet |
for (var i = 1; i <= 9; i++) {
for(var j = 1; j <= 9; j++){
console.log(i + "x" + j + "=" + i * j);
}
}; | javascript | 13 | 0.342593 | 41 | 20.8 | 5 | codenet |
for (var i = 1; i <= 9; i++) {
for (var j = 1; j <= 9; j++) {
console.log(i + 'x' + j + '=' + (i*j));
}
} | javascript | 13 | 0.33945 | 41 | 21 | 5 | codenet |
for (var i = 1; i <= 9; i++) {
for (var j = 1; j <= 9; j++) {
console.log(i + "x" + j + "=" + (i*j));
}
} | javascript | 13 | 0.305785 | 47 | 23.4 | 5 | codenet |
// Generated by CoffeeScript 1.7.1
(function() {
var i, j, _i, _j;
for (i = _i = 1; _i <= 9; i = ++_i) {
for (j = _j = 1; _j <= 9; j = ++_j) {
console.log(i + "x" + j + "=" + i * j);
}
}
}).call(this); | javascript | 19 | 0.376682 | 45 | 19.363636 | 11 | codenet |
for(var i=1; i<=9; i++) {
for(var j=1; j<=9; j++) {
console.log(i + 'x' + j + '=' + (i*j));
}
} | javascript | 13 | 0.333333 | 47 | 21.4 | 5 | codenet |
for(var i = 1; i < 10; i++) {
for(var j = 1; j < 10; j++) {
console.log(i+"x"+j+"="+i*j);
}
} | javascript | 13 | 0.357798 | 37 | 21 | 5 | codenet |
for (let i = 1; i <= 9; i ++) {
for (let j = 1; j <= 9; j ++) {
console.log(i + "x" + j + "=" + i * j);
}
}
| javascript | 13 | 0.316239 | 43 | 18.5 | 6 | codenet |
for (let x = 1; x <= 9; x++) {
for (let y = 1; y <= 9; y++) {
console.log(x+'x'+y+'='+x*y);
}
}
| javascript | 13 | 0.366337 | 31 | 15.833333 | 6 | codenet |
for(let i = 1; i <= 9; i++) {
for(let j = 1; j <= 9; j++) {
console.log(`${i}x${j}=${i*j}`);
}
}
| javascript | 11 | 0.352381 | 36 | 20 | 5 | codenet |
for(var i=1;i<10;i++){
for(var ii=1;ii<10;ii++){
console.log(String(i)+"x"+String(ii)+"="+String(i*ii))
}
}
| javascript | 14 | 0.574074 | 54 | 20.6 | 5 | codenet |
for (i=1 ; i <= 9 ; i++) for (j=1 ; j <= 9 ; j++) console.log(i+'x'+j+'='+(i*j));
| javascript | 11 | 0.378049 | 81 | 81 | 1 | codenet |
"use strict";
for (let i = 1; i <= 9; ++i) {
for (let j = 1; j <= 9; ++j) {
process.stdout.write(`${i}x${j}=${i * j}\n`);
}
}
| javascript | 11 | 0.381944 | 53 | 17 | 8 | codenet |
for(var i = 1; i <= 9; i++){
for(var j = 1; j <= 9; j++){
console.log(i+'x'+j+'='+i*j);
}
}
| javascript | 13 | 0.37 | 33 | 19 | 5 | codenet |
var input = ''
process.stdin.resume()
process.stdin.setEncoding('utf8')
process.stdin.on('data', function(chunk) {
input += chunk
})
process.stdin.on('end', function() {
input = input.split('\n')
main()
})
function main() {
input.sort(function(a, b) {
return (parseInt(a) < parseInt(b)) ? 1 : -1;
});
console.log(input[0])
console.log(input[1])
console.log(input[2])
}
| javascript | 14 | 0.627249 | 52 | 18.45 | 20 | codenet |
var heights = [];
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (height) {
height.trim().split('\n').forEach(function(line){
heights.push(parseInt(line));
});
});
process.stdin.on('end', function () {
heights.sort(function(a, b){
if(a > b){
return -1;
} else if (a == b){
return 0;
} else {
return 1;
}
});
for(var i = 0; i < 3; i++ ){
console.log(heights[i]);
};
}); | javascript | 17 | 0.489524 | 53 | 20.04 | 25 | codenet |
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n").map(Number);
Arr.sort(function(a,b){return b-a;});
console.log(Arr[0]);
console.log(Arr[1]);
console.log(Arr[2]); | javascript | 10 | 0.657143 | 61 | 34.166667 | 6 | codenet |
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var heights = input.trim().split('\n');
heights.sort(function(a, b) { return b - a; });
for (var i = 0; i < 3; i++) {
console.log(heights[i]);
} | javascript | 8 | 0.596154 | 61 | 33.833333 | 6 | codenet |
(function(input) {
var p = input.split('\n');
var heights = p.map(Number).sort(function(a, b) {
return b - a;
});
console.log(heights.slice(0, 3).join('\n'));
})(require('fs').readFileSync('/dev/stdin', 'utf8')); | javascript | 14 | 0.559322 | 53 | 32.857143 | 7 | codenet |
console.log(require("fs").readFileSync("/dev/stdin","utf8").trim().split('\n').sort(function(a,b){return b-a;}).slice(0,3).join('\n')); | javascript | 19 | 0.644444 | 135 | 135 | 1 | codenet |
console.log(require("fs").readFileSync("/dev/stdin","utf8").trim().split('\n').sort(function(a,b){return b-a;}).slice(0,3).join('\n')) | javascript | 19 | 0.649254 | 134 | 134 | 1 | codenet |
console.log(require("fs").readFileSync("/dev/stdin","utf8").split('\n').sort(function(a,b){return b-a;}).slice(0,3).join('\n')) | javascript | 17 | 0.653543 | 127 | 127 | 1 | codenet |
'use strict';
(function(stdin) {
var inputs = stdin.toString().trim().split('\n');
var sorted = inputs
.map(Number)
.sort(function(a,b){
return b - a;
})
.slice(0,3)
.join('\n');
console.log(sorted);
}(require('fs').readFileSync('/dev/stdin', 'utf8'))); | javascript | 18 | 0.547619 | 53 | 21.692308 | 13 | codenet |
'use strict';
(function(stdin) {
var inputs = stdin.toString().trim().split('\n');
var sorted = inputs
.map(Number)
.sort(function(a,b){
return b - a;
})
.slice(0,3)
.join('\n');
console.log(sorted);
}(require('fs').readFileSync('/dev/stdin', 'utf8'))); | javascript | 18 | 0.538462 | 53 | 20.428571 | 14 | codenet |
'use strict';
(function(stdin) {
var inputs = stdin.toString().trim().split('\n');
var sorts = inputs
.map(Number) // ??°??????
.sort(function(a,b){ // ????????????????????????
return b-a;
})
.slice(0,3) //????????????3????????????
.join('\n'); //????????§??????
console.log(sorts);
}(require('fs').readFileSync('/dev/stdin', 'utf8'))); | javascript | 18 | 0.39604 | 56 | 22.823529 | 17 | codenet |
'use strict';
(function(stdin) {
var inputs = stdin
.toString()
.trim()
.split('\n');
var sorted = inputs
.map(Number)
.sort(function(a,b){
return b - a;
})
.slice(0,3)
.join('\n');
console.log(sorted);
}(require('fs').readFileSync('/dev/stdin', 'utf8'))); | javascript | 18 | 0.375291 | 61 | 25.875 | 16 | codenet |
'use strict';
(function(stdin) {
var inputs = stdin
.toString() // ?????????????????????
.trim() // ????????¨????????????????????????????????????
.split('\n'); // ???????????????
var sorted = inputs
.map(Number) // ??°??????
.sort(function(a,b) { // ????????????????????????
return b - a;
})
.slice(0,3) // ????????????3????????????
.join('\n'); // ????????§??????
console.log(sorted);
}(require('fs').readFileSync('/dev/stdin', 'utf8'))); | javascript | 18 | 0.27598 | 72 | 35.75 | 16 | codenet |
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: {},
});
hs = [];
rl.on('line', function(h) {
hs.push(h | 0);
});
rl.on('close', function() {
hs.sort(function(p, q) { return p - q; });
for(var i = 0; i < 3; ++i)
console.log(hs[hs.length - i - 1]);
}); | javascript | 14 | 0.52819 | 46 | 16.789474 | 19 | codenet |
function Main(input) {
input = input.split("\n");
for(var i=0;i<10;i++){
input[i]=parseInt(input[i], 10);
}
input.sort(descendingOrder);
for(i=0;i<3;i++){
console.log(input[i]);
}
}
//??°????????????????????¢??°??¨(??????)
function ascendingOrder(val1,val2){
return val1 - val2;
}
//??°????????????????????¢??°??¨(??????)
function descendingOrder(val1,val2){
return val2 - val1;
}
//???????????°??¨
function debug(){
var input = document.getElementById("input").value;
Main(input);
}
//?????????????????\??????????????????
Main(require("fs").readFileSync("/dev/stdin", "utf8")); | javascript | 10 | 0.48019 | 55 | 21.571429 | 28 | codenet |
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var heigths = input.trim().split("\n");
var n = heigths.sort(compareNumbers);
for (i=0; i!=3; i++) {
console.log (n[i]);
}
function compareNumbers(a, b) {
return b - a;
} | javascript | 8 | 0.617647 | 62 | 20.727273 | 11 | codenet |
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
var hills = [];
rl.on('line', function(line) {
hills.push(parseInt(line.trim()));
}).on('close', function() {
var top3 = hills.sort(function(a, b) {
return a - b;
}).reverse().slice(0, 3);
for (i=0; i<top3.length; i++) {
console.log(top3[i]);
}
}); | javascript | 18 | 0.577011 | 42 | 23.222222 | 18 | codenet |
function main(){
x = [];
rep(10, function(i){
x[i] = scan();
});
x.sort(function(a, b){
return b - a;
});
rep(3, function(i){
print(x[i]);
});
}
function rep(a, b, c){
if(c == null){
c = b;
b = a;
a = 0;
}
for(var i = a; i < b; ++i){
c(i);
}
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
var input = '';
var input_index = 0;
function scan(type){
if(type === 'string'){
return input[input_index++];
}
else{
return +input[input_index++];
}
}
function print(val){
console.log(val);
}
process.stdin.on('data', function(chunk){
input += chunk;
});
process.stdin.on('end', function(){
input = input.split(/\s+/);
main();
}); | javascript | 12 | 0.545455 | 41 | 12.66 | 50 | codenet |
x=require('fs').readFileSync('/dev/stdin','utf8').split("\n");x.sort(function(a,b){return b-a;});for(i=0;console.log(x[i++]),i<3;){}; | javascript | 10 | 0.616541 | 133 | 133 | 1 | codenet |
var input = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
input += chunk;
});
process.stdin.on('end', function() {
main(input)
});
function main(arg){
var mountains = arg.split('\n');
mountains = mountains.map(function(x){ return parseInt(x); })
var topMountains = [];
iterateTopMountains(function init(i){
topMountains[i] = 0;
})
for(var i = 0; i < mountains.length; i += 1){
var mountain = mountains[i];
iterateTopMountains(function displace(rank){
if(mountain > topMountains[rank]){
topMountains.splice(rank, 0, mountain);
return true;
}
})
}
iterateTopMountains(function show(i){
console.log(topMountains[i]);
})
}
function iterateTopMountains(func){
var numTopMountains = 3;
for(var i = 0; i < numTopMountains; i += 1){
var needBreak = func(i);
if(needBreak){ break; }
}
} | javascript | 15 | 0.578895 | 65 | 21.555556 | 45 | codenet |
process.stdin.resume();
process.stdin.setEncoding('utf8');
// Get lines from standard input.
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
var number_of_hills_to_output = 3;
// Sort numerically greatest first.
lines.sort(function(a, b) {
return b - a;
});
// Print the output
for (var counter = 0; counter < number_of_hills_to_output; counter++){
console.log(lines[counter]);
} | javascript | 8 | 0.687646 | 70 | 24.294118 | 17 | codenet |
// Please run with node.js
// $ node p1.js < input.txt
// tested on node version 0.10.36
var fs = require("fs");
var input = fs.readFileSync('/dev/stdin').toString();
var numbers = input.split("\n").map(Number);
numbers = numbers.sort(function(a, b) { return b - a });
for(var i = 0; i < 3; i++) {
if(i < numbers.length) {
console.log(numbers[i]);
}
} | javascript | 9 | 0.604905 | 56 | 29.666667 | 12 | codenet |
function main(input) {
input.split("\n")
.slice(0,10)
.map(function(str){
return parseInt(str);
})
.sort(function(a,b){
return b - a;
})
.slice(0,3)
.map(function(height){
console.log(height);
});
}
main(require('fs').readFileSync('/dev/stdin','utf8')); | javascript | 17 | 0.586572 | 54 | 17.933333 | 15 | codenet |
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var data = (input.trim()).split('\n');
/**
* Prints highest mountains
*/
function main(input) {
// Sorts the data
var sorted = input.sort(function(a,b){
return b - a;
});
// Takes the top three ones
var topThreeMountains = sorted.slice(0, 3);
// Loops through the top three
for (var i = 0; i < topThreeMountains.length; i++) {
console.log(topThreeMountains[i]);
}
}
main(data); | javascript | 11 | 0.623679 | 61 | 18.75 | 24 | codenet |
process.stdin.resume();
process.stdin.setEncoding('utf8');
// Here your code !
process.stdin.on("data",function(chunk){
var line = chunk.trim().split("\n").map(function(e){return parseInt(e)});
console.log(line.sort(function(a,b){return b-a}).slice(0,3).join("\n"))
}) | javascript | 19 | 0.658363 | 77 | 34.25 | 8 | codenet |
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var heights = input.trim().split('\n');
heights.sort(function(a, b) { return b - a; }); // compare
for (var i = 0; i < 3; i++) {
console.log(heights[i]);
} | javascript | 8 | 0.598174 | 61 | 35.666667 | 6 | codenet |
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var height = input.trim().split('\n');
height.sort(function (a, b) {
return parseInt(b) - parseInt(a);
});
console.log(height.slice(0,3).join('\n')); | javascript | 10 | 0.643192 | 61 | 34.666667 | 6 | codenet |
var Mountains = {
mountain_input: function() {
var mountain = [];
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
input.trim().split('\n').forEach(function(line){
mountain.push(parseInt(line));
});
return mountain;
},
sort: function() {
var data = this.mountain_input();
data.sort(function(a,b){return a - b;});
for(k=data.length -1; k >= data.length-3; k--) {
console.log(data[k]);
}
return true;
}
}
Mountains.sort(); | javascript | 17 | 0.575758 | 65 | 25.105263 | 19 | codenet |
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk){
var c = chunk.split("\n")
c.sort(function(aft, bef){
return bef - aft
})
for (var j = 0; j < 3; j++) {
console.log(c[j])
}
}) | javascript | 13 | 0.594262 | 41 | 13.411765 | 17 | codenet |
var data = require('fs').readFileSync('/dev/stdin', 'utf8');
var input = data.trim().split('\n');
// var input = [
// 1819,
// 2003,
// 876,
// 2840,
// 1723,
// 1673,
// 3776,
// 2848,
// 1592,
// 922
// ];
function findHighestHills(arr) {
if (arr.length <= 1) {
return arr;
}
var pivot = parseInt(arr.pop());
var left = [];
var right = [];
while (arr.length) {
var elem = parseInt(arr.pop());
if (elem > pivot) {
left.push(elem);
} else {
right.push(elem);
}
}
var sorted = [].concat(findHighestHills(left), pivot, findHighestHills(right));
return sorted.splice(0, 3);
}
var output = findHighestHills(input);
for (var i = 0; i < output.length; i ++) {
console.log(output[i]);
} | javascript | 11 | 0.578947 | 80 | 15.813953 | 43 | codenet |
function main(input) {
var a = input.split("\n");
a.sort(function(a, b) {
return b - a
});
a.slice(0, 3).forEach(function(value) {
console.log(value);
});
}
main(require("fs").readFileSync("/dev/stdin", "utf8")); | javascript | 11 | 0.584416 | 55 | 20.090909 | 11 | codenet |
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
var aaa = chunk.toString();
var line = aaa.split("\n")
for(var i in line){
line[i] = new Number(line[i])
}
line.sort(function(a,b){
if( a > b ) return -1;
if( a < b ) return 1;
return 0;
});
//line.sort();
for(var i = 0;i<3;i++){
console.log(line[i].toString());
}
//console.log(line)
}); | javascript | 14 | 0.515723 | 43 | 21.761905 | 21 | codenet |
var input = [];
var max;
var maxIndex;
var temp;
var maxLength = 3;
process.stdin.resume();
process.stdin.setEncoding("utf8");
process.stdin.on('data', function(chunk){
input = chunk.toString("utf8").split("\n");
});
process.stdin.on('end', function(){
for (var m = 0; m < maxLength; m++) {
temp = 0;
for (var i = 0; i < input.length; i++) {
if (i === 0) {
temp = parseInt(input[i]);
}else{
if (temp < parseInt(input[i])) {
temp = input[i];
maxIndex = i;
}
}
}
input.splice(maxIndex, 1);
console.log(temp)
}
}); | javascript | 19 | 0.462882 | 48 | 24.481481 | 27 | codenet |
var sample_input = require('fs').readFileSync('/dev/stdin', 'utf8');
var hills = (sample_input.trim()).split("\n").map(Number);
hills.sort(function(a,b){return b-a;});
console.log(hills.slice(0,3).join('\n')); | javascript | 10 | 0.665072 | 68 | 51.5 | 4 | codenet |
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var mountains = (input.trim()).split("\n").map(Number);
mountains.sort(sortNumber);
function sortNumber(a,b) {
return b - a;
}
for (i=0; i!=3; i++) {
console.log(mountains[i]);
} | javascript | 10 | 0.624 | 61 | 21.818182 | 11 | codenet |
//config = {stdin: 'tmp', newline: '\r\n'}; // win
config = {stdin: '/dev/stdin', newline: '\n'}; // linux
line = require('fs').readFileSync(config.stdin, 'ascii')
.trim()
.split(config.newline)
.map(Number);
line.sort(function (a, b) { return b - a; });
console.log(line.slice(0, 3).join('\n')); | javascript | 14 | 0.604651 | 56 | 29.2 | 10 | codenet |
var sample_input = require('fs').readFileSync('/dev/stdin', 'utf8');
var hills = (sample_input.trim()).split("\n").map(Number);
hills.sort(function(a,b){return b-a;});
console.log(hills.slice(0,3).join('\n')); | javascript | 10 | 0.665072 | 68 | 51.5 | 4 | codenet |
(function main( input )
{
var lines = input.trim().split('\n').map(Number);
lines.sort( function(a,b){ return b-a; } );
console.log( lines.slice( 0, 3 ).join('\n') );
})( require('fs').readFileSync( '/dev/stdin', 'utf8' ) ); | javascript | 14 | 0.581197 | 57 | 28.375 | 8 | codenet |
(function main( input )
{
var lines = input.trim().split('\n');
lines.map(Number).sort( function(a,b){ return b-a; } ).slice( 0, 3 ).forEach( function(v){ console.log(v); } );
})( require('fs').readFileSync( '/dev/stdin', 'utf8' ) ); | javascript | 17 | 0.595833 | 113 | 39.166667 | 6 | codenet |
(function(stdin) {
var mountains = stdin.trim().split('\n').map(Number);
mountains.sort(function(a, b) {
return b - a;
});
console.log(mountains.slice(0, 3).join('\n'));
})(require('fs').readFileSync('/dev/stdin', 'utf8')); | javascript | 14 | 0.612766 | 55 | 32.714286 | 7 | codenet |
(function(){
'use strict';
(function() {
this.output = function() {
console.log.apply( console, arguments );
};
this.stdin = process.openStdin();
stdin.setEncoding('utf8');
stdin.on('end', function(){
process.exit();
});
this.fs = require('fs');
}).call( this );
(function(){
(function input(next_func) {
var list = [];
stdin.on('data', function(chunk){
var input_data = (function(){
chunk.replace(/\\r/, '');
return chunk.trim().split('\n');
})(chunk);
input_data.forEach(function(line){
list.push( parseInt(line.trim()) );
});
if ( list.length >= 10 )
return next_func(list);
});
}).call(this, function solve(list) {
list.sort(function(a,b){
return a < b;
});
var result = list.slice( 0, 3 );
result.forEach(function(height){
output(height);
});
process.exit();
});
}).call( this );
}).call(global); | javascript | 36 | 0.5625 | 43 | 22.410256 | 39 | codenet |
function Main(input){
var h = input.split("\n");
h.sort(function(a,b){return Number(b)-Number(a);});
console.log(h.slice(0,3).join("\n"));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8")); | javascript | 12 | 0.610577 | 55 | 33.833333 | 6 | codenet |
function Main(input){
var param = input.split("\n");
var sorted = param.sort(function(x, y){return(y - x)});
console.log(sorted.slice(0, 3).join("\n"));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8")); | javascript | 12 | 0.640187 | 56 | 29.714286 | 7 | codenet |
process.stdin.on("data",function(c){
(c+"").trim().split("\n").sort(function(a,b){return b-a}).slice(0,3).forEach(function(a){console.log(a)});
}).resume(); | javascript | 22 | 0.636943 | 107 | 51.666667 | 3 | codenet |
function Main(i) {
i.split("\n").sort(function(a,b){return b-a}).splice(0,3).forEach(function(x ){console.log(x)});
}
Main(require("fs").readFileSync("/dev/stdin", "utf8")); | javascript | 14 | 0.640449 | 101 | 43.75 | 4 | codenet |
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
lines.sort(function(a,b){return b-a;});
for (var i = 0; i < 3; i++) {
console.log(lines[i]);
} | javascript | 8 | 0.603175 | 61 | 26.142857 | 7 | codenet |
var input = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
input += chunk;
});
process.stdin.on('end', function() {
var lines = input.split('\n');
lines.sort(function(a, b){return b - a})
lines.slice(0, 3).forEach(function(x) {
console.log(x);
});
}); | javascript | 14 | 0.60355 | 44 | 25.076923 | 13 | codenet |
let sample_input = require('fs').readFileSync('/dev/stdin', 'utf8');
var hills = (sample_input.trim()).split("\n").map(Number);
hills.sort(function(a,b){return b-a;});
console.log(hills.slice(0,3).join("\n"));
| javascript | 10 | 0.658768 | 68 | 41.2 | 5 | codenet |
var sample_input = require('fs').readFileSync('/dev/stdin', 'utf8');
var hills = (sample_input.trim()).split("\n").map(Number);
hills.sort(function(a,b){return b-a;});
console.log(hills.slice(0,3).join('\n'));
| javascript | 10 | 0.661905 | 68 | 51.5 | 4 | codenet |
var fs = require('fs'),
length = fs.fstatSync(process.stdin.fd).size,
buffer = new Buffer(length),
bytesRead = fs.readSync(process.stdin.fd, buffer, 0, length, 0),
input = buffer.toString('utf8', 0, bytesRead).split('\n');
main();
function main(){
input.sort(function(a,b){return b-a}).slice(0,3).forEach(function(c){console.log(c)});
}
| javascript | 14 | 0.650838 | 90 | 34.8 | 10 | codenet |
"use strict";
new Promise(function(resolve, reject) {
let content = "";
process.stdin.on("data", chunk => { content += chunk; })
process.stdin.on("end", () => { resolve([content, process.stdout]); });
}).then(function([cin, cout]) {
const data = cin.split("\n").slice(0, 10).map(elt => parseInt(elt));
data.sort((a, b) => {
if (a > b) return -1;
if (b > a) return 1;
return 0;
});
for (let i = 0; i < 3; ++i) {
cout.write(`${data[i]}\n`);
}
});
| javascript | 18 | 0.500978 | 75 | 27.388889 | 18 | codenet |
let input = ''
process.stdin.resume()
process.stdin.setEncoding('utf8')
process.stdin.on('data', function(chunk) {
input += chunk
})
process.stdin.on('end', function() {
input = input.trim().split('\n')
main()
})
function main() {
for(i=0; i<input.length; i++) {
if(i>200) {
return
}
let input_line = input[i].split(' ')
let a = parseInt(input_line[0])
let b = parseInt(input_line[1])
if(0 > a || b > 1000000) {
return
}
console.log((a + b).toString().length)
}
}
| javascript | 13 | 0.514783 | 47 | 21.115385 | 26 | codenet |
var pairs = [];
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(input){
input.trim().split('\n').forEach(function(line){
pairs.push(line.split(' '));
});
});
process.stdin.on('end', function(){
for (var i in pairs){
var a = parseInt(pairs[i][0]);
var b = parseInt(pairs[i][1]);
console.log((Math.LOG10E * Math.log(a + b) | 0) + 1);
};
}); | javascript | 18 | 0.562212 | 61 | 23.166667 | 18 | codenet |
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
for(var i=0;i<Arr.length;i++){
var arr=Arr[i].split(" ").map(Number);
var ab=arr[0]+arr[1];
console.log((ab+"").length);
} | javascript | 10 | 0.618182 | 61 | 30.571429 | 7 | codenet |
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var abs = input.trim().split('\n');
abs.forEach(function(ab) {
console.log((ab.split(' ').reduce(function(m, e) {return +e + m}, 0) + "").length);
}); | javascript | 19 | 0.607477 | 85 | 42 | 5 | codenet |
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split('\n');
input.forEach(function(ab) {
console.log((ab.split(' ').reduce(function(m, e) {return +e + m}, 0) + "").length);
}); | javascript | 19 | 0.60804 | 85 | 49 | 4 | codenet |
(function(input) {
var p = input.replace(/\n$/, '').split('\n');
for (var i = 0; i < p.length; i++) {
var args = p[i].split(' ').map(Number);
var sum = args.reduce(function(a, b) {
return a + b;
});
console.log(String(sum).length);
}
})(require('fs').readFileSync('/dev/stdin', 'utf8')); | javascript | 16 | 0.489796 | 53 | 33.4 | 10 | codenet |
require("fs").readFileSync("/dev/stdin","utf8").trim().split('\n').forEach(function(e){i=e.split(' ');console.log((+i[0]+(+i[1])+'').length)}) | javascript | 16 | 0.605634 | 142 | 142 | 1 | codenet |
process.stdin.on('data',function(c){(c+'').trim().split('\n').forEach(function(e){i=e.split(' ');console.log((+i[0]+(+i[1])+'').length)})}).resume() | javascript | 23 | 0.587838 | 148 | 148 | 1 | codenet |
require("fs").readFileSync("/dev/stdin","utf8").split('\n').map(function(e){i=e.split(' ');if(i[1])console.log((+i[0]+(+i[1])+'').length)}) | javascript | 17 | 0.589928 | 139 | 139 | 1 | codenet |
require("fs").readFileSync("/dev/stdin","utf8").trim().split('\n').map(function(e){i=e.split(' ');console.log((+i[0]+(+i[1])+'').length)}) | javascript | 16 | 0.594203 | 138 | 138 | 1 | codenet |
for(j=0,i=require("fs").readFileSync("/dev/stdin","utf8").split(/\n| /);a=i[j++];)console.log((-a-i[j++]+'').length-1) | javascript | 12 | 0.576271 | 118 | 118 | 1 | codenet |
for(j=0,i=require("fs").readFileSync("/dev/stdin","utf8").split(/\s/);a=i[j++];)console.log((-a-i[j++]+'').length-1) | javascript | 12 | 0.586207 | 116 | 116 | 1 | codenet |
function Main(input) {
input = input.split("\n");
input.push("EOF");
for(var i=0;input[i]!="EOF";i++){
if(input[i].length>2){
num = input[i].split(" ");
console.log(Str(Int(num[0])+Int(num[1])).length);
}
}
}
//??°????????????????????¢??°??¨(??????)
function ascendingOrder(val1,val2){
return val1 - val2;
}
//??°????????????????????¢??°??¨(??????)
function descendingOrder(val1,val2){
return val2 - val1;
}
//??°??????
function Int(str){
return parseInt(str, 10);
}
//????????????
function Str(num){
return num.toString(10);
}
//???????????°??¨
function debug(){
var input = document.getElementById("input").value;
Main(input);
}
//?????????????????\??????????????????
Main(require("fs").readFileSync("/dev/stdin", "utf8")); | javascript | 17 | 0.483418 | 55 | 20.805556 | 36 | codenet |
x=require('fs').readFileSync('/dev/stdin','utf8').split(/[\n\s]/);for(i=0;console.log(String(x[i++]*1+x[i++]*1).length),i<x.length-2;){}; | javascript | 13 | 0.605839 | 137 | 137 | 1 | codenet |
var input = '';
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
input += chunk;
});
process.stdin.on('end', function() {
main(input)
});
function main(input){
var args = input.trim().split('\n');
args.forEach(function(pair){
pair = pair.split(' ').map(Number);
var res = '' + (pair[0] + pair[1]);
console.log(res.length);
})
} | javascript | 15 | 0.581176 | 43 | 22.666667 | 18 | codenet |
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
for (var i = 0; i < lines.length; i++) {
if (lines[i] == '') break;
var vals = lines[i].split(' ').map(function(i){return +i;});
var a = vals[0] + vals[1];
var str = a + '';
console.log(str.length);
} | javascript | 11 | 0.542857 | 64 | 30.6 | 10 | codenet |
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
if(lines.length > 200) {
console.log("Invalid dataset size. Dataset size is "+lines.length+" but must be <= 200");
} else {
for (var i = 0; i < lines.length; i++) {
var line = lines[i].trim();
if (line == '') break;
var vals = line.split(' ').map(function(i){return +i;});
if(vals.length != 2 || isNaN(vals[0])|| isNaN(vals[1]) || vals[0] < 0 || vals[0] > 1000000 || vals[1] < 0 || vals[1] > 1000000) {
console.log("invalid dataset: "+line+ ". Use 0 <= a, b <= 1,000,000");
} else {
var a = vals[0] + vals[1];
var str = a + '';
console.log(str.length);
}
}
} | javascript | 17 | 0.541844 | 134 | 32.619048 | 21 | codenet |
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = input.split('\n');
if(lines.length > 200) {
console.log("Invalid dataset size. Dataset size is "+lines.length+" but must be <= 200");
} else {
for (var i = 0; i < lines.length; i++) {
var line = lines[i].trim();
if (line == '') break;
var vals = line.split(' ').map(function(i){return +i;});
if(vals.length != 2 || isNaN(vals[0])|| isNaN(vals[1]) || vals[0] < 0 || vals[0] > 1000000 || vals[1] < 0 || vals[1] > 1000000) {
console.log("invalid dataset: "+line+ ". Use 0 <= a, b <= 1,000,000");
} else {
var a = vals[0] + vals[1];
var str = a + '';
console.log(str.length);
}
}
} | javascript | 17 | 0.541844 | 134 | 32.619048 | 21 | codenet |
// tested on node version 0.10.36
var fs = require("fs");
function digit_count(c) {
return String(c).length;
}
var input = fs.readFileSync('/dev/stdin').toString();
var lines = input.split("\n");
for(var i = 0; i < lines.length; i++) {
var parts = lines[i].split(" ");
var a = parseInt(parts.shift());
var b = parseInt(parts.shift());
if(!isNaN(a + b)) {
console.log(digit_count(a + b));
}
} | javascript | 11 | 0.586288 | 53 | 27.266667 | 15 | codenet |
function main(input) {
var lines = input.split("\n").slice(0,200);
for (var i = 0; i < lines.length; i++) {
var digits = lines[i].split(" ").map(function(value) {return parseInt(value);});
var digit = digits[0] + digits[1];
if (!isNaN(digit)) {console.log((digit + '').length);}
}
}
main(require('fs').readFileSync('/dev/stdin','utf8')); | javascript | 14 | 0.613833 | 82 | 37.666667 | 9 | codenet |
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var data = (input.trim()).split('\n');
/**
* Prints digit number of sum of two integers
* @param {Array} data
*/
function main(data) {
for (var i = 0; i < data.length; i++) {
console.log(digitNumber(data[i]));
}
}
/**
* Returns the output to be printed
* @param {String} numbers
* @returns {Number}
*/
function digitNumber(numbers) {
var ary = numbers.split(' ');
var numberString = String(Number(ary[0]) + Number(ary[1]));
return numberString.length;
}
main(data); | javascript | 11 | 0.633394 | 61 | 21.08 | 25 | codenet |
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on("data",function(chunk){
var nums=chunk.trim().split("\n");
function digit (e){
var a=e.split(" ");
var wa = parseInt(a[0]) + parseInt(a[1]);
return wa.toString().length;
}
console.log(nums.map(digit).join("\n"));
}); | javascript | 14 | 0.585075 | 48 | 24.846154 | 13 | codenet |
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var line = (input.trim()).split("\n");
for(i = 0; i < line.length; i++) {
var val = line[i].split(" ").map(Number);
var res = val[0] + val[1];
console.log((res + "").length);
} | javascript | 10 | 0.558704 | 61 | 23.8 | 10 | codenet |
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk){
array = (chunk.trim()).split("\n")
for (var i = 0; i < array.length; i++) {
var x = array[i].split(" ");
var xa = Number(x[0]) + Number(x[1]);
console.log(String(xa).length);
}
}) | javascript | 14 | 0.597973 | 41 | 16.470588 | 17 | codenet |
function main( input )
{
input = input.trim().split("\n");
for( var i = 0; i < input.length; ++i )
{
var ln = input[i].split(" ");
var a = parseInt(ln.shift());
var b = parseInt(ln.shift());
console.log( (a+b).toString().length );
}
}
main( require("fs").readFileSync( "/dev/stdin", "utf8" ) ); | javascript | 13 | 0.543478 | 59 | 19.1875 | 16 | codenet |
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 5);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = require("os");
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _StdIO = __webpack_require__(2);
var _StdIO2 = _interopRequireDefault(_StdIO);
var _os = __webpack_require__(0);
var _os2 = _interopRequireDefault(_os);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Main = function () {
function Main() {
_classCallCheck(this, Main);
}
_createClass(Main, null, [{
key: 'main',
value: function main() {
_StdIO2.default.readLine(function (input) {
var nums = input.split(_os2.default.EOL);
nums.forEach(function (row) {
var _Parser$toNumberArray = _StdIO.Parser.toNumberArray(row),
_Parser$toNumberArray2 = _slicedToArray(_Parser$toNumberArray, 2),
a = _Parser$toNumberArray2[0],
b = _Parser$toNumberArray2[1];
_StdIO2.default.printLine((a + b).toString().length);
});
});
}
}]);
return Main;
}();
exports.default = Main;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Parser = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _fs = __webpack_require__(3);
var _fs2 = _interopRequireDefault(_fs);
var _os = __webpack_require__(0);
var _os2 = _interopRequireDefault(_os);
var _readline = __webpack_require__(4);
var _readline2 = _interopRequireDefault(_readline);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var StdIO = function () {
function StdIO() {
_classCallCheck(this, StdIO);
}
_createClass(StdIO, null, [{
key: 'input',
/**
* ?¨??????\???
*
* @returns string ??\????????????
*/
value: function input() {
return _fs2.default.readFileSync(process.stdin.fd, 'utf8');
var buffer = new Buffer(this.BUFFER_SIZE);
var n = _fs2.default.readSync(process.stdin.fd, buffer, 0, this.BUFFER_SIZE);
var input = buffer.slice(0, n).toString();
return input;
}
}, {
key: 'readLine',
value: function readLine(callback) {
var lines = [];
var reader = _readline2.default.createInterface({
input: process.stdin,
output: process.stdout
});
reader.on('line', function (line) {
lines.push(line);
});
reader.on('close', function () {
callback(lines.join(_os2.default.EOL));
});
}
/**
* ?¨??????????
* ??????????????? printLine ????????£???????????????
*
* @param string str ?????????????????????
*/
}, {
key: 'print',
value: function print() {
var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
process.stdout.write(str);
}
/**
* ?¨????????????????????????????
*
* @param string str ?????????????????????
*/
}, {
key: 'printLine',
value: function printLine() {
var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
process.stdout.write(str + _os2.default.EOL);
}
}, {
key: 'BUFFER_SIZE',
get: function get() {
return 4096;
}
}]);
return StdIO;
}();
exports.default = StdIO;
var Parser = exports.Parser = function () {
function Parser() {
_classCallCheck(this, Parser);
}
_createClass(Parser, null, [{
key: 'toNumberArray',
/**
* ???????????? int ??????????????????
*
* @param {string} input ?????????????????????
* @param {string} [separator=' '] ???????????????
* @return {array} ??????????????????
*/
value: function toNumberArray(input) {
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
var strArray = input.split(separator);
return strArray.map(function (value) {
return parseInt(value);
});
}
}]);
return Parser;
}();
/***/ }),
/* 3 */
/***/ (function(module, exports) {
module.exports = require("fs");
/***/ }),
/* 4 */
/***/ (function(module, exports) {
module.exports = require("readline");
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _Main = __webpack_require__(1);
var _Main2 = _interopRequireDefault(_Main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_Main2.default.main();
/***/ })
/******/ ]); | javascript | 39 | 0.53724 | 664 | 32.204082 | 294 | codenet |
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 5);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = require("os");
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _StdIO = __webpack_require__(2);
var _StdIO2 = _interopRequireDefault(_StdIO);
var _os = __webpack_require__(0);
var _os2 = _interopRequireDefault(_os);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Main = function () {
function Main() {
_classCallCheck(this, Main);
}
_createClass(Main, null, [{
key: 'main',
value: function main() {
_StdIO2.default.readLine(function (input) {
var nums = input.split(_os2.default.EOL);
nums.forEach(function (row) {
var _Parser$toNumberArray = _StdIO.Parser.toNumberArray(row),
_Parser$toNumberArray2 = _slicedToArray(_Parser$toNumberArray, 2),
a = _Parser$toNumberArray2[0],
b = _Parser$toNumberArray2[1];
_StdIO2.default.printLine((a + b).toString().length);
});
});
}
}]);
return Main;
}();
exports.default = Main;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.Parser = undefined;
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _fs = __webpack_require__(3);
var _fs2 = _interopRequireDefault(_fs);
var _os = __webpack_require__(0);
var _os2 = _interopRequireDefault(_os);
var _readline = __webpack_require__(4);
var _readline2 = _interopRequireDefault(_readline);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var StdIO = function () {
function StdIO() {
_classCallCheck(this, StdIO);
}
_createClass(StdIO, null, [{
key: 'input',
/**
* ?¨??????\???
*
* @returns string ??\????????????
*/
value: function input() {
var buffer = new Buffer(this.BUFFER_SIZE);
var n = _fs2.default.readSync(process.stdin.fd, buffer, 0, this.BUFFER_SIZE);
var input = buffer.slice(0, n).toString();
return input === _os2.default.EOL ? "" : input;
}
}, {
key: 'readLine',
value: function readLine(callback) {
var input = '';
var reader = _readline2.default.createInterface({
input: process.stdin,
output: process.stdout
});
reader.on('line', function (line) {
input += input === '' ? line : _os2.default.EOL + line;
});
reader.on('close', function () {
callback(input);
});
}
/**
* ?¨??????????
* ??????????????? printLine ????????£???????????????
*
* @param string str ?????????????????????
*/
}, {
key: 'print',
value: function print() {
var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
process.stdout.write(str);
}
/**
* ?¨????????????????????????????
*
* @param string str ?????????????????????
*/
}, {
key: 'printLine',
value: function printLine() {
var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
process.stdout.write(str + _os2.default.EOL);
}
}, {
key: 'BUFFER_SIZE',
get: function get() {
return 4096;
}
}]);
return StdIO;
}();
exports.default = StdIO;
var Parser = exports.Parser = function () {
function Parser() {
_classCallCheck(this, Parser);
}
_createClass(Parser, null, [{
key: 'toNumberArray',
/**
* ???????????? int ??????????????????
*
* @param {string} input ?????????????????????
* @param {string} [separator=' '] ???????????????
* @return {array} ??????????????????
*/
value: function toNumberArray(input) {
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
var strArray = input.split(separator);
return strArray.map(function (value) {
return parseInt(value);
});
}
}]);
return Parser;
}();
/***/ }),
/* 3 */
/***/ (function(module, exports) {
module.exports = require("fs");
/***/ }),
/* 4 */
/***/ (function(module, exports) {
module.exports = require("readline");
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _Main = __webpack_require__(1);
var _Main2 = _interopRequireDefault(_Main);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_Main2.default.main();
/***/ })
/******/ ]); | javascript | 39 | 0.535791 | 664 | 32.349315 | 292 | codenet |
var os = require('os');
function func(line) {
var nums = line.split(' ');
var a = parseInt(nums[0]) + parseInt(nums[1]);
results.push(a.toString().length);
}
var results = [];
var input = '';
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(data) {
input += data;
var index = input.indexOf(os.EOL);
while(index > -1){
var line = input.substring(0, index);
input = input.substring(index + 1);
func(line);
index = input.indexOf(os.EOL);
}
});
process.stdin.on('end', function(data) {
if(input.length > 0){
func(input);
}
var output = results.join(os.EOL) + os.EOL;
process.stdout.write(output);
});
process.stdin.resume(); | javascript | 13 | 0.609687 | 50 | 22.433333 | 30 | codenet |