diff --git a/hackerrank/10 Days of JavaScript/0 - Data Types.js b/hackerrank/10 Days of JavaScript/0 - Data Types.js new file mode 100644 index 0000000..641bc7c --- /dev/null +++ b/hackerrank/10 Days of JavaScript/0 - Data Types.js @@ -0,0 +1,50 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +/* All three parameters to this function are strings. */ +function performOperation(secondInteger, secondDecimal, secondString) { + const firstInteger = 4; + const firstDecimal = 4.0; + const firstString = 'HackerRank '; + + console.log(firstInteger + parseInt(secondInteger)); + console.log(firstDecimal + parseFloat(secondDecimal)); + console.log(firstString + secondString); +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const secondInteger = readLine(); + const secondDecimal = readLine(); + const secondString = readLine(); + + performOperation(secondInteger, secondDecimal, secondString); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/0 - Hello World.js b/hackerrank/10 Days of JavaScript/0 - Hello World.js new file mode 100644 index 0000000..6e75b60 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/0 - Hello World.js @@ -0,0 +1,42 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function greeting(message) { + console.log('Hello, World!'); + console.log(message); +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const parameterVariable = readLine(); + + greeting(parameterVariable); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/1 - Arthmetic.js b/hackerrank/10 Days of JavaScript/1 - Arthmetic.js new file mode 100644 index 0000000..47dad8b --- /dev/null +++ b/hackerrank/10 Days of JavaScript/1 - Arthmetic.js @@ -0,0 +1,47 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function getArea(length, width) { + return length * width; +} + +function getPerimeter(length, width) { + return 2 * (length + width); +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const length = +(readLine()); + const width = +(readLine()); + + console.log(getArea(length, width)); + console.log(getPerimeter(length, width)); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/1 - Fnxn.js b/hackerrank/10 Days of JavaScript/1 - Fnxn.js new file mode 100644 index 0000000..a920aac --- /dev/null +++ b/hackerrank/10 Days of JavaScript/1 - Fnxn.js @@ -0,0 +1,47 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function factorial(n) { + if (n < 0) { + throw "Input to 'factorial()' must be non-negative"; + } else if (n == 0 || n == 1) { + return 1; + } else { + return n * factorial(n - 1); + } +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const n = +(readLine()); + + console.log(factorial(n)); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/1 - Let.js b/hackerrank/10 Days of JavaScript/1 - Let.js new file mode 100644 index 0000000..923ed86 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/1 - Let.js @@ -0,0 +1,48 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function main() { + const PI = Math.PI; + const r = parseFloat(readLine()); + + console.log(PI * (r ** 2)); + console.log(2 * PI * r); + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ + try { + // Attempt to redefine the value of constant variable PI + PI = 0; + // Attempt to print the value of PI + console.log(PI); + } catch(error) { + console.error("You correctly declared 'PI' as a constant."); + } +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/2 - If.js b/hackerrank/10 Days of JavaScript/2 - If.js new file mode 100644 index 0000000..51ff179 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/2 - If.js @@ -0,0 +1,61 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function getGrade(score) { + let grade; + + if (score > 30) { + throw "score must be <= 30"; + } else if (score > 25) { + grade = 'A'; + } else if (score > 20) { + grade = 'B'; + } else if (score > 15) { + grade = 'C'; + } else if (score > 10) { + grade = 'D'; + } else if (score > 5) { + grade = 'E'; + } else if (score >= 0) { + grade = 'F'; + } else { + throw "score must be non-negative"; + } + + return grade; +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const score = +(readLine()); + + console.log(getGrade(score)); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ \ No newline at end of file diff --git a/hackerrank/10 Days of JavaScript/2 - Loop.js b/hackerrank/10 Days of JavaScript/2 - Loop.js new file mode 100644 index 0000000..9b1b6ec --- /dev/null +++ b/hackerrank/10 Days of JavaScript/2 - Loop.js @@ -0,0 +1,58 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function isVowel(ch) { + ch = ch.toLowerCase(); + return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u'; +} + +function vowelsAndConsonants(s) { + let vowels = []; + let consonants = []; + + for (let ch of s) { + if (isVowel(ch)) { + vowels.push(ch); + } else { + consonants.push(ch); + } + } + + console.log(vowels.join('\n')); + console.log(consonants.join('\n')); +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const s = readLine(); + + vowelsAndConsonants(s); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/2 - Switch.js b/hackerrank/10 Days of JavaScript/2 - Switch.js new file mode 100644 index 0000000..8ff6a2f --- /dev/null +++ b/hackerrank/10 Days of JavaScript/2 - Switch.js @@ -0,0 +1,65 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function getLetter(s) { + const aSet = new Set(['a', 'e', 'i', 'o', 'u']); + const bSet = new Set(['b', 'c', 'd', 'f', 'g']); + const cSet = new Set(['h', 'j', 'k', 'l', 'm']); + const dSet = new Set(['n', 'p', 'q', 'r', 's', + 't', 'v', 'w', 'x', 'y', 'z']); + + let letter; + const firstChar = s.charAt(0); + switch (true) { + case aSet.has(firstChar): + letter = 'A'; + break; + case bSet.has(firstChar): + letter = 'B'; + break; + case cSet.has(firstChar): + letter = 'C'; + break; + case dSet.has(firstChar): + letter = 'D'; + break; + default: + throw "Unexpected first character" + } + return letter; +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const s = readLine(); + + console.log(getLetter(s)); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/3 - Array.js b/hackerrank/10 Days of JavaScript/3 - Array.js new file mode 100644 index 0000000..ced81e3 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/3 - Array.js @@ -0,0 +1,62 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +/** + * Finds the second largest value in the array, in one pass. + * If the array only has one distinct element, returns that element. + */ +function getSecondLargest(nums) { + let largest = Number.MIN_VALUE; + let secondLargest = Number.MIN_VALUE; + + for (let num of nums) { + if (num > largest) { + secondLargest = largest + largest = num; + } else if (num > secondLargest && num < largest) { + secondLargest = num; + } + } + + if (secondLargest == Number.MIN_VALUE) { + return largest; // only one distinct element + } else { + return secondLargest; + } +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const n = +(readLine()); + const nums = readLine().split(' ').map(Number); + + console.log(getSecondLargest(nums)); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/3 - Throw.js b/hackerrank/10 Days of JavaScript/3 - Throw.js new file mode 100644 index 0000000..ed73a48 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/3 - Throw.js @@ -0,0 +1,55 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function isPositive(a) { + if (a > 0) { + return "YES"; + } else if (a == 0) { + throw new Error("Zero Error"); + } else { + throw new Error("Negative Error"); + } +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const n = +(readLine()); + + for (let i = 0; i < n; i++) { + const a = +(readLine()); + + try { + console.log(isPositive(a)); + } catch (e) { + console.log(e.message); + } + } +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/3 - Try.js b/hackerrank/10 Days of JavaScript/3 - Try.js new file mode 100644 index 0000000..ece348b --- /dev/null +++ b/hackerrank/10 Days of JavaScript/3 - Try.js @@ -0,0 +1,49 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function reverseString(s) { + try { + let array = s.split(""); + array.reverse(); + s = array.join(""); + } catch (e) { + console.log(e.message); + } finally { + console.log(s); + } +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const s = eval(readLine()); + + reverseString(s); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/4 - Class.js b/hackerrank/10 Days of JavaScript/4 - Class.js new file mode 100644 index 0000000..7b5e326 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/4 - Class.js @@ -0,0 +1,21 @@ +class Polygon { + constructor(sideLengths) { + this.sideLengths = sideLengths; + } + + perimeter() { + return this.sideLengths.reduce((a, b) => a + b); + } +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +const rectangle = new Polygon([10, 20, 10, 20]); +const square = new Polygon([10, 10, 10, 10]); +const pentagon = new Polygon([10, 20, 30, 40, 43]); + +console.log(rectangle.perimeter()); +console.log(square.perimeter()); +console.log(pentagon.perimeter()); +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/4 - Count.js b/hackerrank/10 Days of JavaScript/4 - Count.js new file mode 100644 index 0000000..faf6dc6 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/4 - Count.js @@ -0,0 +1,57 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +/** + * Returns a count of the total number of objects 'o' satisfying o.x == o.y. + */ +function getCount(objects) { + let count = 0; + for (let o of objects) { + if (o.x == o.y) { + count++; + } + } + return count; +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const n = +(readLine()); + let objects = []; + + for (let i = 0; i < n; i++) { + const [a, b] = readLine().split(' '); + + objects.push({x: +(a), y: +(b)}); + } + + console.log(getCount(objects)); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ \ No newline at end of file diff --git a/hackerrank/10 Days of JavaScript/4 - Rect.js b/hackerrank/10 Days of JavaScript/4 - Rect.js new file mode 100644 index 0000000..4f79e6c --- /dev/null +++ b/hackerrank/10 Days of JavaScript/4 - Rect.js @@ -0,0 +1,50 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function Rectangle(a, b) { + this.length = a; + this.width = b; + this.perimeter = 2 * (a + b); + this.area = a * b; +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const a = +(readLine()); + const b = +(readLine()); + + const rec = new Rectangle(a, b); + + console.log(rec.length); + console.log(rec.width); + console.log(rec.perimeter); + console.log(rec.area); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/5 - Arrow.js b/hackerrank/10 Days of JavaScript/5 - Arrow.js new file mode 100644 index 0000000..db95d10 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/5 - Arrow.js @@ -0,0 +1,45 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +/** + * Doubles all even numbers in the array, and triples all odd numbers. + */ +function modifyArray(nums) { + return nums.map(n => (n % 2 == 0) ? (n * 2) : (n * 3)); +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const n = +(readLine()); + const a = readLine().split(' ').map(Number); + + console.log(modifyArray(a).toString().split(',').join(' ')); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/5 - Inheritance.js b/hackerrank/10 Days of JavaScript/5 - Inheritance.js new file mode 100644 index 0000000..36756d5 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/5 - Inheritance.js @@ -0,0 +1,35 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +class Rectangle { + constructor(w, h) { + this.w = w; + this.h = h; + } +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +Rectangle.prototype.area = function () { + return this.w * this.h; +} + +class Square extends Rectangle { + constructor(sideLength) { + super(sideLength, sideLength); + } +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +if (JSON.stringify(Object.getOwnPropertyNames(Square.prototype)) === JSON.stringify([ 'constructor' ])) { + const rec = new Rectangle(3, 4); + const sqr = new Square(3); + + console.log(rec.area()); + console.log(sqr.area()); +} else { + console.log(-1); + console.log(-1); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/5 - Literals.js b/hackerrank/10 Days of JavaScript/5 - Literals.js new file mode 100644 index 0000000..51457a8 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/5 - Literals.js @@ -0,0 +1,60 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +/* + * Determine the original side lengths and return an array: + * - The first element is the length of the shorter side + * - The second element is the length of the longer side + * + * Parameters: + * strings: The tagged template literal's array of strings. + * values: An array of: [area, perimeter]. + */ +function sides(strings, ...values) { + const A = values[0]; + const P = values[1]; + const s1 = (P + (P ** 2 - (16 * A)) ** 0.5) / 4; + const s2 = A / s1; + return [s1, s2].sort(); +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + let s1 = +(readLine()); + let s2 = +(readLine()); + + [s1, s2] = [s1, s2].sort(); + + const [x, y] = sides`The area is: ${s1 * s2}.\nThe perimeter is: ${2 * (s1 + s2)}.`; + + console.log((s1 === x) ? s1 : -1); + console.log((s2 === y) ? s2 : -1); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/6 - Bitwise.js b/hackerrank/10 Days of JavaScript/6 - Bitwise.js new file mode 100644 index 0000000..3e121bd --- /dev/null +++ b/hackerrank/10 Days of JavaScript/6 - Bitwise.js @@ -0,0 +1,48 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +/** + * See the Discussion tab on HackerRank for some explanations of this solution. + */ +function getMaxLessThanK(n, k) { + return (((k - 1) | k) <= n) ? (k - 1) : (k - 2); +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const q = +(readLine()); + + for (let i = 0; i < q; i++) { + const [n, k] = readLine().split(' ').map(Number); + + console.log(getMaxLessThanK(n, k)); + } +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/6 - Dates.js b/hackerrank/10 Days of JavaScript/6 - Dates.js new file mode 100644 index 0000000..90800c3 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/6 - Dates.js @@ -0,0 +1,49 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function getDayName(dateString) { + const days = ["Sunday", "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday"]; + const date = new Date(dateString); + const dayNum = date.getDay(); + return days[dayNum]; +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const d = +(readLine()); + + for (let i = 0; i < d; i++) { + const date = readLine(); + + console.log(getDayName(date)); + } +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/7 - Re1.js b/hackerrank/10 Days of JavaScript/7 - Re1.js new file mode 100644 index 0000000..8768236 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/7 - Re1.js @@ -0,0 +1,43 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function regexVar() { + /* Matches a string that starts and ends with the same vowel. */ + return /^([aeiou]).*\1$/; +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const re = regexVar(); + const s = readLine(); + + console.log(re.test(s)); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/7 - Re2.js b/hackerrank/10 Days of JavaScript/7 - Re2.js new file mode 100644 index 0000000..4866b3d --- /dev/null +++ b/hackerrank/10 Days of JavaScript/7 - Re2.js @@ -0,0 +1,44 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function regexVar() { + /* Matches a string that starts with 'Mr.', 'Mrs.', 'Ms.', 'Dr.', or 'Er.', + * followed by one or more letters. */ + return /^(?:Mr|Mrs|Ms|Dr|Er)\.[a-zA-Z]+$/; +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const re = regexVar(); + const s = readLine(); + + console.log(!!s.match(re)); +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/7 - Re3.js b/hackerrank/10 Days of JavaScript/7 - Re3.js new file mode 100644 index 0000000..8bf96c9 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/7 - Re3.js @@ -0,0 +1,47 @@ +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +'use strict'; + +process.stdin.resume(); +process.stdin.setEncoding('utf-8'); + +let inputString = ''; +let currentLine = 0; + +process.stdin.on('data', inputStdin => { + inputString += inputStdin; +}); + +process.stdin.on('end', _ => { + inputString = inputString.trim().split('\n').map(string => { + return string.trim(); + }); + + main(); +}); + +function readLine() { + return inputString[currentLine++]; +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ + +function regexVar() { + /* Matches ALL occurrences of numbers in a string. */ + return /(\d)+/g; +} + +/* ************************************************************************** */ +/* --------------------------- begin locked code ---------------------------- */ +function main() { + const re = regexVar(); + const s = readLine(); + + const r = s.match(re); + + for (const e of r) { + console.log(e); + } +} +/* ---------------------------- end locked code ----------------------------- */ +/* ************************************************************************** */ diff --git a/hackerrank/10 Days of JavaScript/Day 8 - Buttons Container/css/buttonsGrid.css b/hackerrank/10 Days of JavaScript/Day 8 - Buttons Container/css/buttonsGrid.css new file mode 100644 index 0000000..de289f3 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/Day 8 - Buttons Container/css/buttonsGrid.css @@ -0,0 +1,9 @@ +#btns { + width: 75%; +} + +.btn { + width: 30%; + height: 48px; + font-size: 24px; +} diff --git a/hackerrank/10 Days of JavaScript/Day 8 - Buttons Container/index.html b/hackerrank/10 Days of JavaScript/Day 8 - Buttons Container/index.html new file mode 100644 index 0000000..41bc11f --- /dev/null +++ b/hackerrank/10 Days of JavaScript/Day 8 - Buttons Container/index.html @@ -0,0 +1,23 @@ + + + + + Buttons Grid + + + + +
+ + + + + + + + + +
+ + + diff --git a/hackerrank/10 Days of JavaScript/Day 8 - Buttons Container/js/buttonsGrid.js b/hackerrank/10 Days of JavaScript/Day 8 - Buttons Container/js/buttonsGrid.js new file mode 100644 index 0000000..0b85c19 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/Day 8 - Buttons Container/js/buttonsGrid.js @@ -0,0 +1,12 @@ +/* Could adapt this to a general matrix rotation function */ +btn5.onclick = function() { + let temp = btn1.innerHTML; + btn1.innerHTML = btn4.innerHTML; + btn4.innerHTML = btn7.innerHTML; + btn7.innerHTML = btn8.innerHTML; + btn8.innerHTML = btn9.innerHTML; + btn9.innerHTML = btn6.innerHTML; + btn6.innerHTML = btn3.innerHTML; + btn3.innerHTML = btn2.innerHTML; + btn2.innerHTML = temp; +} diff --git a/hackerrank/10 Days of JavaScript/Day 8 - Create a Button/css/button.css b/hackerrank/10 Days of JavaScript/Day 8 - Create a Button/css/button.css new file mode 100644 index 0000000..cd35f6c --- /dev/null +++ b/hackerrank/10 Days of JavaScript/Day 8 - Create a Button/css/button.css @@ -0,0 +1,5 @@ +#btn { + width: 96px; + height: 48px; + font-size: 24px; +} diff --git a/hackerrank/10 Days of JavaScript/Day 8 - Create a Button/index.html b/hackerrank/10 Days of JavaScript/Day 8 - Create a Button/index.html new file mode 100644 index 0000000..98bde57 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/Day 8 - Create a Button/index.html @@ -0,0 +1,13 @@ + + + + + + Button + + + + + + + diff --git a/hackerrank/10 Days of JavaScript/Day 8 - Create a Button/js/button.js b/hackerrank/10 Days of JavaScript/Day 8 - Create a Button/js/button.js new file mode 100644 index 0000000..e5f4029 --- /dev/null +++ b/hackerrank/10 Days of JavaScript/Day 8 - Create a Button/js/button.js @@ -0,0 +1,9 @@ +var btn = document.createElement("Button"); + +btn.innerHTML = "0"; +btn.id = "btn"; +document.body.appendChild(btn); + +btn.onclick = function() { + btn.innerHTML++; +} diff --git a/hackerrank/10 Days of JavaScript/Day 9 - Binary Calculator/css/binaryCalculator.css b/hackerrank/10 Days of JavaScript/Day 9 - Binary Calculator/css/binaryCalculator.css new file mode 100644 index 0000000..2a480ae --- /dev/null +++ b/hackerrank/10 Days of JavaScript/Day 9 - Binary Calculator/css/binaryCalculator.css @@ -0,0 +1,33 @@ +body { + width: 33%; +} + +#res { + background-color: lightgray; + border: solid; + height: 48px; + font-size: 20px; +} + +#btns button { + width: 25%; + height: 36px; + font-size: 18px; + margin:0; + float: left; +} + +#btn0, #btn1 { + background-color: lightgreen; + color: brown; +} + +#btnClr, #btnEql { + background-color: darkgreen; + color: white; +} + +#btnSum, #btnSub, #btnMul, #btnDiv { + background-color: black; + color: red; +} diff --git a/hackerrank/10 Days of JavaScript/Day 9 - Binary Calculator/index.html b/hackerrank/10 Days of JavaScript/Day 9 - Binary Calculator/index.html new file mode 100644 index 0000000..9ee2b8a --- /dev/null +++ b/hackerrank/10 Days of JavaScript/Day 9 - Binary Calculator/index.html @@ -0,0 +1,25 @@ + + + + + Binary Calculator + + + + +
+
+
+ + + + + + + + +
+
+ + + diff --git a/hackerrank/10 Days of JavaScript/Day 9 - Binary Calculator/js/binaryCalculator.js b/hackerrank/10 Days of JavaScript/Day 9 - Binary Calculator/js/binaryCalculator.js new file mode 100644 index 0000000..018e54c --- /dev/null +++ b/hackerrank/10 Days of JavaScript/Day 9 - Binary Calculator/js/binaryCalculator.js @@ -0,0 +1,38 @@ +/* Adapted from code by @eloyekunle - thanks! */ + +let btns = document.getElementsByTagName('button'); +for (let btn of btns) { + button.onclick = click; +} + +function click(e) { + var btn = e.target || e.srcElement; + var action = document.getElementById(btn.id).innerHTML; + var res = document.getElementById('res'); + + switch (action) { + case '0': + case '1': + case '+': + case '-': + case '*': + case '/': + res.innerHTML += action; + break; + case 'C': + res.innerHTML = ''; + break; + case '=': + /* Parse binary numbers from res; + * replace with decimal equivalents */ + var expr = res.innerHTML; + var nums = /(\d+)/g; + expr = expr.replace(nums, function(match) { + return parseInt(match, 2); + }) + + /* Evaluate res and convert back to binary */ + res.innerHTML = eval(expr).toString(2); + break; + } +} diff --git a/hackerrank/AI/Bot-Building/#Save_Princess.py b/hackerrank/AI/Bot-Building/#Save_Princess.py new file mode 100644 index 0000000..8f9b798 --- /dev/null +++ b/hackerrank/AI/Bot-Building/#Save_Princess.py @@ -0,0 +1,81 @@ +def displayPathtoPrincess(n, grid): + g = Grid(n, grid) + if not g.is_valid(): + raise Exception('Grid validation error: %s' % '\n'.join(g.errors)) + g.get_bot_coordinates() + g.get_princess_coordinates() + print(g.get_path()) + + +class Grid(object): + def __init__(self, n, grid): + self.n = n + self.matrix = grid + self.errors = [] + self.princess_marker = 'p' + self.bot_marker = 'm' + self.princess_coord = None + self.bot_coord = None + + def has_valid_row_count(self): + return self.n == len(self.matrix) + + def has_valid_column_count(self): + for i in self.matrix: + if not len(i) == self.n: + self.errors.append( + 'Grid expected column size %s but got %s' % (self.n, len(i))) + return False + return True + + def is_valid(self): + r = True + if not self.has_valid_row_count(): + self.errors.append('Grid expected row size %s but got %s' % ( + self.n, len(self.matrix))) + r = False + if not self.has_valid_column_count(): + r = False + return r + + def get_coordinates_for(self, val): + for x, row in enumerate(self.matrix): + for y, col in enumerate(row): + if col == val: + return (x, y) + + def get_princess_coordinates(self): + if not self.princess_coord: + self.princess_coord = self.get_coordinates_for( + self.princess_marker) + return self.princess_coord + + def get_bot_coordinates(self): + if not self.bot_coord: + self.bot_coord = self.get_coordinates_for(self.bot_marker) + return self.bot_coord + + def get_path(self): + path = [] + row_diff = self.bot_coord[0] - self.princess_coord[0] + col_diff = self.bot_coord[1] - self.princess_coord[1] + if row_diff > 0: + row_direction = 'UP' + else: + row_direction = 'DOWN' + if col_diff > 0: + col_direction = 'LEFT' + else: + col_direction = 'RIGHT' + for i in range(abs(row_diff)): + path.append(row_direction) + for i in range(abs(col_diff)): + path.append(col_direction) + return '\n'.join(path) + + +m = eval(input()) +grid = [] +for i in range(0, m): + grid.append(input().strip()) +displayPathtoPrincess(m, grid) diff --git a/hackerrank/AI/Bot-Building/Save_Princess-2.py b/hackerrank/AI/Bot-Building/Save_Princess-2.py new file mode 100644 index 0000000..9ae5f2f --- /dev/null +++ b/hackerrank/AI/Bot-Building/Save_Princess-2.py @@ -0,0 +1,57 @@ +def nextMove(n, x, y, grid): + g = Grid(n, grid) + g.bot_coord = (x, y) + g.get_princess_coordinates() + return g.next_move() + + +class Grid(object): + def __init__(self, n, grid): + self.n = n + self.matrix = grid + self.errors = [] + self.princess_marker = 'p' + self.bot_marker = 'm' + self.princess_coord = None + self.bot_coord = None + + def get_coordinates_for(self, val): + for x, row in enumerate(self.matrix): + for y, col in enumerate(row): + if col == val: + return (x, y) + + def get_princess_coordinates(self): + if not self.princess_coord: + self.princess_coord = self.get_coordinates_for( + self.princess_marker) + return self.princess_coord + + def get_bot_coordinates(self): + if not self.bot_coord: + self.bot_coord = self.get_coordinates_for(self.bot_marker) + return self.bot_coord + + def next_move(self): + move = None + row_diff = self.bot_coord[0] - self.princess_coord[0] + col_diff = self.bot_coord[1] - self.princess_coord[1] + if not row_diff == 0: + if row_diff > 0: + move = 'UP' + else: + move = 'DOWN' + elif not col_diff == 0: + if col_diff > 0: + move = 'LEFT' + else: + move = 'RIGHT' + return move + + +n = eval(input()) +x, y = [int(i) for i in input().strip().split()] +grid = [] +for i in range(0, n): + grid.append(input()) +print(nextMove(n, x, y, grid)) diff --git a/hackerrank/AI/Bot-Building/bot-saves-princess-2.py b/hackerrank/AI/Bot-Building/bot-saves-princess-2.py new file mode 100644 index 0000000..9132e80 --- /dev/null +++ b/hackerrank/AI/Bot-Building/bot-saves-princess-2.py @@ -0,0 +1,30 @@ +def nextMove(n, r, c, grid): + pos_col_m = c + pos_row_m = r + pos_col_p = pos_row_p = 0 + for i in range(n): + line = len(grid[i]) + for j in range(line): + if grid[i][j] == 'p': + pos_row_p = i + pos_col_p = j + if pos_row_m < pos_row_p: + pos_row_m = pos_row_m + 1 + return 'DOWN' + elif pos_row_m > pos_row_p: + pos_row_m = pos_row_m - 1 + return 'UP' + if pos_col_m < pos_col_p: + pos_col_m = pos_col_m + 1 + return 'RIGHT' + elif pos_col_m > pos_col_p: + pos_col_m = pos_col_m - 1 + return 'LEFT' + + +n = int(input()) +r, c = [int(i) for i in input().strip().split()] +grid = [] +for i in range(0, n): + grid.append(input()) +print(nextMove(n, r, c, grid)) diff --git a/hackerrank/AI/Bot-Building/bot-saves-princess.py b/hackerrank/AI/Bot-Building/bot-saves-princess.py new file mode 100644 index 0000000..aef5dc5 --- /dev/null +++ b/hackerrank/AI/Bot-Building/bot-saves-princess.py @@ -0,0 +1,54 @@ +# Princess Peach is trapped in one of the four corners of a square grid. +# You are in the center of the grid and can move one step at a time in +# any of the four directions. Can you rescue the princess? + +# Complete the function displayPathtoPrincess which takes in two +# parameters - the integer N and the character array grid. The grid +# will be formatted exactly as you see it in the input, so for the +# sample input the princess is at grid[2][0]. The function shall output +# moves (LEFT, RIGHT, UP or DOWN) on consecutive lines to rescue/reach +# the princess. The goal is to reach the princess in as few moves as possible. + +# Link: https://www.hackerrank.com/challenges/saveprincess +# Developer: Murillo Grubler + +def displayPathtoPrincess(n,grid): + pos_col = {} + pos_row = {} + not_find = True + + for i in range(n): + line = len(grid[i]) + for j in range(line): + if grid[i][j] == 'm': + pos_row['m'] = i + pos_col['m'] = j + elif grid[i][j] == 'p': + pos_row['p'] = i + pos_col['p'] = j + + while (not_find): + if pos_row['m'] < pos_row['p']: + pos_row['m'] = pos_row['m'] + 1 + print ('DOWN') + elif pos_row['m'] > pos_row['p']: + pos_row['m'] = pos_row['m'] - 1 + print ('UP') + + if pos_col['m'] < pos_col['p']: + pos_col['m'] = pos_col['m'] + 1 + print ('RIGHT') + elif pos_col['m'] > pos_col['p']: + pos_col['m'] = pos_col['m'] - 1 + print ('LEFT') + + if pos_col['m'] == pos_col['p'] and pos_row['m'] == pos_row['m']: + not_find = False + +#print all the moves here +m = int(input()) +grid = [] +for i in range(0, m): + grid.append(input().strip()) + +displayPathtoPrincess(m,grid) \ No newline at end of file diff --git a/hackerrank/AI/Bot-Building/botclean-large.py b/hackerrank/AI/Bot-Building/botclean-large.py new file mode 100644 index 0000000..70d17f2 --- /dev/null +++ b/hackerrank/AI/Bot-Building/botclean-large.py @@ -0,0 +1,36 @@ +import math + + +def update_position(posr, posc, dirties): + nearest_dirt = [] + for i in range(len(dirties)): + result = math.sqrt( + ((dirties[i][0] - posr) ** 2) + ((dirties[i][1] - posc) ** 2)) + nearest_dirt.append(result) + return [x for (y, x) in sorted(zip(nearest_dirt, dirties))] + + +def next_move(posx, posy, dimx, dimy, board): + dirties = [] + for i in range(dimx): + for j in range(dimy): + if board[i][j] == 'd': + dirties.append([i, j]) + next_dirt = update_position(posx, posy, dirties) + if next_dirt[0][0] < posx: + print('UP') + elif next_dirt[0][0] > posx: + print('DOWN') + elif next_dirt[0][1] < posy: + print('LEFT') + elif next_dirt[0][1] > posy: + print('RIGHT') + else: + print('CLEAN') + + +if __name__ == "__main__": + pos = [int(i) for i in input().strip().split()] + dim = [int(i) for i in input().strip().split()] + board = [[j for j in input().strip()] for i in range(dim[0])] + next_move(pos[0], pos[1], dim[0], dim[1], board) diff --git a/hackerrank/AI/Bot-Building/botclean-partially-observable.py b/hackerrank/AI/Bot-Building/botclean-partially-observable.py new file mode 100644 index 0000000..fa13b2e --- /dev/null +++ b/hackerrank/AI/Bot-Building/botclean-partially-observable.py @@ -0,0 +1,95 @@ +import os +import math + + +def get_info_file(): + temp_memory_board = [] + filename = "file-bot/board.txt" + if os.path.isfile(filename): + with open(filename, "r") as f: + memory_board = f.read().split('\n') + for i in range(len(memory_board)): + temp_row_memory = [] + for j in range(len(memory_board[i])): + temp_row_memory.append(memory_board[i][j]) + temp_memory_board.append(temp_row_memory) + return temp_memory_board + + +def save_info_file(board, filename): + os.makedirs(os.path.dirname(filename), exist_ok=True) + with open(filename, "w") as f: + for i in range(len(board)): + columns = "\n" if i > 0 else "" + for j in range(len(board[i])): + if board[i][j] == "b": + columns = columns + "-" + else: + columns = columns + board[i][j] + f.write(columns) + + +def update_info_file(board): + filename = "file-bot/board.txt" + if os.path.isfile(filename): + with open(filename, "r") as f: + new_memory_board = [] + memory_board = f.read().split('\n') + for i in range(len(memory_board)): + new_row_memory = [] + for j in range(len(memory_board[i])): + if ((memory_board[i][j] == 'o' and board[i][j] == '-') or + (memory_board[i][j] == 'd' and board[i][j] == '-') or + (memory_board[i][j] == 'd' and board[i][j] == 'b')): + new_row_memory.append('-') + elif memory_board[i][j] == 'o' and board[i][j] == 'd': + new_row_memory.append('d') + else: + new_row_memory.append(memory_board[i][j]) + new_memory_board.append(new_row_memory) + save_info_file(new_memory_board, filename) + else: + save_info_file(board, filename) + + +def update_position(posr, posc, dirties): + nearest_dirt = [] + for i in range(len(dirties)): + result = math.sqrt( + ((dirties[i][0] - posr) ** 2) + ((dirties[i][1] - posc) ** 2)) + nearest_dirt.append(result) + return [x for (y, x) in sorted(zip(nearest_dirt, dirties))] + + +def get_element_board(board, element): + dirties = [] + for i in range(len(board)): + for j in range(len(board[i])): + if board[i][j] in element: + dirties.append([i, j]) + return dirties + + +def next_move(posx, posy, board): + update_info_file(board) + elements = get_element_board(board, ['d']) + if len(elements) == 0: + elements = get_element_board(get_info_file(), ['o', 'd']) + next_dirt = update_position(posx, posy, elements) + if (len(next_dirt) > 0): + if next_dirt[0][1] > posy: + print('RIGHT') + elif next_dirt[0][1] < posy: + print('LEFT') + elif next_dirt[0][0] < posx: + print('UP') + elif next_dirt[0][0] > posx: + print('DOWN') + else: + print('CLEAN') + + +if __name__ == "__main__": + pos = [int(i) for i in input().strip().split()] + board = [[j for j in input().strip()] for i in range(5)] + next_move(pos[0], pos[1], board) diff --git a/hackerrank/AI/Bot-Building/botclean-stochastic.py b/hackerrank/AI/Bot-Building/botclean-stochastic.py new file mode 100644 index 0000000..15ee86f --- /dev/null +++ b/hackerrank/AI/Bot-Building/botclean-stochastic.py @@ -0,0 +1,23 @@ +def nextMove(posr, posc, board): + dirty_row = dirty_col = 0 + for i in range(len(board)): + for j in range(len(board[i])): + if board[i][j] == 'd': + dirty_row = i + dirty_col = j + if dirty_col < posc: + print('LEFT') + elif dirty_col > posc: + print('RIGHT') + elif dirty_row < posr: + print('UP') + elif dirty_row > posr: + print('DOWN') + else: + print('CLEAN') + + +if __name__ == "__main__": + pos = [int(i) for i in input().strip().split()] + board = [[j for j in input().strip()] for i in range(5)] + nextMove(pos[0], pos[1], board) diff --git a/hackerrank/AI/Bot-Building/botclean.py b/hackerrank/AI/Bot-Building/botclean.py new file mode 100644 index 0000000..0417483 --- /dev/null +++ b/hackerrank/AI/Bot-Building/botclean.py @@ -0,0 +1,35 @@ +import math + + +def update_position(posr, posc, dirties): + nearest_dirt = [] + for i in range(len(dirties)): + result = math.sqrt( + ((dirties[i][0] - posr) ** 2) + ((dirties[i][1] - posc) ** 2)) + nearest_dirt.append(result) + return [x for (y, x) in sorted(zip(nearest_dirt, dirties))] + + +def next_move(posr, posc, board): + dirties = [] + for i in range(len(board)): + for j in range(len(board[i])): + if board[i][j] == 'd': + dirties.append([i, j]) + next_dirt = update_position(posr, posc, dirties) + if next_dirt[0][1] < posc: + print('LEFT') + elif next_dirt[0][1] > posc: + print('RIGHT') + elif next_dirt[0][0] < posr: + print('UP') + elif next_dirt[0][0] > posr: + print('DOWN') + else: + pass + + +if __name__ == "__main__": + pos = [int(i) for i in input().strip().split()] + board = [[j for j in input().strip()] for i in range(5)] + next_move(pos[0], pos[1], board) diff --git a/hackerrank/AI/Bot-Building/complex.py b/hackerrank/AI/Bot-Building/complex.py new file mode 100644 index 0000000..b2391fb --- /dev/null +++ b/hackerrank/AI/Bot-Building/complex.py @@ -0,0 +1,28 @@ +import math + +class Complex(complex): + def __add__(self, no): + return Complex(complex.__add__(self, no)) + + def __sub__(self, no): + return Complex(complex.__sub__(self, no)) + + def __mul__(self, no): + return Complex(complex.__mul__(self, no)) + + def __truediv__(self, no): + return Complex(complex.__truediv__(self, no)) + + def mod(self): + return Complex(complex.__abs__(self)) + + def __str__(self): + return '{0.real:.2f}{0.imag:+.2f}i'.format(self) + + +if __name__ == '__main__': + c = map(float, input().split()) + d = map(float, input().split()) + x = Complex(*c) + y = Complex(*d) + print(*map(str, [x+y, x-y, x*y, x/y, x.mod(), y.mod()]), sep='\n') \ No newline at end of file diff --git a/hackerrank/AI/Bot-Building/hanoi_4.py b/hackerrank/AI/Bot-Building/hanoi_4.py new file mode 100644 index 0000000..1d3e036 --- /dev/null +++ b/hackerrank/AI/Bot-Building/hanoi_4.py @@ -0,0 +1,45 @@ +from collections import deque + + +def moves(x): + for i in range(len(x)): + if x[i]: + for j in range(len(x)): + if not x[j] or x[i][-1] < x[j][-1]: + yield (i, j) + + +def goal(x): + return all([len(x[i]) == 0 for i in range(1, len(x))]) + + +def bfs(x): + def make_tuple(z): + return tuple(tuple(t) for t in z) + + def do_move(g, m): + y = [list(t) for t in g] + y[m[1]].append(y[m[0]].pop()) + y[1:4] = sorted(y[1:4], key=lambda t: t[-1] if t else 0) + return make_tuple(y) + visited = set() + start = (make_tuple(x), 0) + q = deque([start]) + visited.add(start) + while q: + node, depth = q.popleft() + if goal(node): + return depth + for move in moves(node): + child = do_move(node, move) + if child not in visited: + visited.add(child) + q.append((child, depth+1)) + + +N = int(input()) +A = [[] for i in range(4)] +R = [int(t) for t in input().split()] +for i in range(N): + A[R[i]-1] = [(i+1)] + A[R[i]-1] +print(bfs(A)) diff --git a/hackerrank/AI/Bot-Building/maze-escape.py b/hackerrank/AI/Bot-Building/maze-escape.py new file mode 100644 index 0000000..17aa080 --- /dev/null +++ b/hackerrank/AI/Bot-Building/maze-escape.py @@ -0,0 +1,16 @@ +def next_move(player, board): + print("Player: {}".format(player)) + move = '' + for i in range(len(board)): + for j in range(len(board[i])): + if i == 0 and j == 1 and board[i][j] == '-': + move = 'UP' + if i == 0 and j == 1 and board[i][j] == '-': + move = 'RIGHT' + print(move) + + +if __name__ == "__main__": + player = int(input()) + board = [[j for j in input().strip()] for i in range(3)] + next_move(player, board) diff --git a/hackerrank/AI/Bot-Building/test.py b/hackerrank/AI/Bot-Building/test.py new file mode 100644 index 0000000..6e512c1 --- /dev/null +++ b/hackerrank/AI/Bot-Building/test.py @@ -0,0 +1,26 @@ +def compatible(a, b): + count = 0 + for i in range(len(b)): + if a[i] == b[i]: + h = 10 + elif abs(ord(a[i])-ord(b[i])) == 1: + count += 1 + check = True + else: + count += 1 + if count == 1: + return True + else: + return False + +s = int(input()) +n = int(input()) +name = [] +count = 0 +for i in range(n): + name.append(input()) +for i in range(len(name)): + for j in range(i + 1, len(name)): + if compatible(name[i], name[j]): + count += 1 +print(count) diff --git a/hackerrank/AI/Bot-Building/timeconv.py b/hackerrank/AI/Bot-Building/timeconv.py new file mode 100644 index 0000000..afb4d83 --- /dev/null +++ b/hackerrank/AI/Bot-Building/timeconv.py @@ -0,0 +1,46 @@ +t = input() +flag = 0 +if 'P' in t: + if '12' in t: + flag = 0 + else: + flag = 1 +elif 'A' in t: + if '12' in t: + flag = 1 + else: + flag = 0 +else: + pass + +hh = int(t[:2]) +mm = int(t[3:5]) +ss = int(t[6:8]) +if flag == 1: + hh += 12 +elif flag == 0: + pass +else: + pass + + +if hh < 10: + hh = '0'+str(hh) +elif hh == 24: + hh = '00' +else: + hh = str(hh) + +if mm < 10: + mm = '0'+str(mm) +else: + mm = str(mm) + +if ss < 10: + ss = '0'+str(ss) +else: + ss = str(ss) + +time = hh+':'+mm+':'+ss + +print(time) diff --git a/hackerrank/AI/Bot-Building/tor.py b/hackerrank/AI/Bot-Building/tor.py new file mode 100644 index 0000000..9b42eb0 --- /dev/null +++ b/hackerrank/AI/Bot-Building/tor.py @@ -0,0 +1,30 @@ +import math +class Points(object): + def __init__(self, x, y, z): + self.x=x + self.y=y + self.z=z + + def __sub__(self, no): + return Points((self.x-no.x),(self.y-no.y),(self.z-no.z)) + + def dot(self, no): + return (self.x*no.x)+(self.y*no.y)+(self.z*no.z) + + def cross(self, no): + return Points((self.y*no.z-self.z*no.y),(self.z*no.x-self.x*no.z),(self.x*no.y-self.y*no.x)) + + def absolute(self): + return pow((self.x ** 2 + self.y ** 2 + self.z ** 2), 0.5) +if __name__ == '__main__': + points = list() + for i in range(4): + a = list(map(float, input().split())) + points.append(a) + + a, b, c, d = Points(*points[0]), Points(*points[1]), Points(*points[2]), Points(*points[3]) + x = (b - a).cross(c - b) + y = (c - b).cross(d - c) + angle = math.acos(x.dot(y) / (x.absolute() * y.absolute())) + + print("%.2f" % math.degrees(angle)) \ No newline at end of file diff --git a/hackerrank/AI/Digital-Image-Analysis/digital-camera-autodetect-day-or-night.py b/hackerrank/AI/Digital-Image-Analysis/digital-camera-autodetect-day-or-night.py new file mode 100644 index 0000000..92f1f7d --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/digital-camera-autodetect-day-or-night.py @@ -0,0 +1,7 @@ +import numpy as np +img = input().split(" ") +lum = 0 +for i in range(len(img)): + types = [int(i) for i in img[i].split(",")] + lum += np.sum(types) / 3 +print("day" if lum/len(img) > 90 else "night") diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input00.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input00.jpg new file mode 100644 index 0000000..c506bf8 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input00.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input00.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input00.txt new file mode 100644 index 0000000..e104288 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input00.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 255,255,255 253,253,253 244,244,244 246,246,246 255,255,255 197,197,197 253,253,253 254,254,254 255,255,255 255,255,255 181,181,181 194,194,194 253,253,253 255,255,255 249,249,249 239,239,239 255,255,255 255,255,255 245,245,245 255,255,255 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 241,241,241 255,255,255 193,193,193 232,232,232 199,199,199 255,255,255 176,176,176 251,251,251 255,255,255 238,238,238 252,252,252 255,255,255 254,254,254 255,255,255 249,249,249 255,255,255 245,245,245 253,253,253 188,188,188 251,251,251 255,255,255 192,192,192 255,255,255 251,251,251 249,249,249 255,255,255 250,250,250 181,181,181 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 248,248,248 185,185,185 241,241,241 235,235,235 255,255,255 246,246,246 200,200,200 193,193,193 245,245,245 246,246,246 255,255,255 255,255,255 232,232,232 255,255,255 253,253,253 242,242,242 255,255,255 246,246,246 255,255,255 255,255,255 223,223,223 255,255,255 255,255,255 241,241,241 183,183,183 236,236,236 191,191,191 241,241,241 203,203,203 250,250,250 236,236,236 247,247,247 255,255,255 243,243,243 254,254,254 248,248,248 255,255,255 249,249,249 255,255,255 253,253,253 192,192,192 250,250,250 245,245,245 192,192,192 255,255,255 255,255,255 253,253,253 255,255,255 253,253,253 184,184,184 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 251,251,251 255,255,255 255,255,255 238,238,238 255,255,255 171,171,171 219,219,219 197,197,197 198,198,198 174,174,174 209,209,209 195,195,195 252,252,252 255,255,255 249,249,249 246,246,246 255,255,255 231,231,231 255,255,255 242,242,242 246,246,246 255,255,255 248,248,248 249,249,249 255,255,255 255,255,255 249,249,249 245,245,245 179,179,179 255,255,255 228,228,228 249,249,249 194,194,194 255,255,255 255,255,255 255,255,255 243,243,243 239,239,239 255,255,255 255,255,255 238,238,238 255,255,255 255,255,255 231,231,231 207,207,207 255,255,255 254,254,254 179,179,179 247,247,247 252,252,252 251,251,251 255,255,255 255,255,255 194,194,194 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 241,241,241 240,240,240 255,255,255 0,0,0 0,0,0 18,18,18 0,0,0 3,3,3 18,18,18 0,0,0 197,197,197 244,244,244 229,229,229 250,250,250 0,0,0 0,0,0 18,18,18 6,6,6 0,0,0 247,247,247 255,255,255 3,3,3 12,12,12 218,218,218 255,255,255 240,240,240 255,255,255 18,18,18 0,0,0 255,255,255 14,14,14 3,3,3 176,176,176 186,186,186 191,191,191 191,191,191 0,0,0 0,0,0 170,170,170 200,200,200 188,188,188 196,196,196 216,216,216 170,170,170 0,0,0 0,0,0 203,203,203 255,255,255 255,255,255 249,249,249 246,246,246 250,250,250 191,191,191 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 241,241,241 255,255,255 255,255,255 243,243,243 0,0,0 0,0,0 250,250,250 248,248,248 248,248,248 237,237,237 250,250,250 188,188,188 255,255,255 255,255,255 10,10,10 0,0,0 254,254,254 234,234,234 242,242,242 13,13,13 13,13,13 245,245,245 0,0,0 0,0,0 246,246,246 255,255,255 242,242,242 254,254,254 0,0,0 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 247,247,247 0,0,0 36,36,36 247,247,247 255,255,255 251,251,251 239,239,239 245,245,245 248,248,248 12,12,12 2,2,2 13,13,13 182,182,182 237,237,237 248,248,248 255,255,255 255,255,255 255,255,255 192,192,192 243,243,243 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 248,248,248 255,255,255 239,239,239 255,255,255 2,2,2 15,15,15 250,250,250 255,255,255 245,245,245 255,255,255 255,255,255 173,173,173 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 247,247,247 255,255,255 247,247,247 236,236,236 249,249,249 247,247,247 0,0,0 19,19,19 247,247,247 250,250,250 1,1,1 13,13,13 250,250,250 252,252,252 0,0,0 0,0,0 255,255,255 255,255,255 0,0,0 7,7,7 233,233,233 252,252,252 239,239,239 234,234,234 255,255,255 240,240,240 0,0,0 0,0,0 0,0,0 0,0,0 196,196,196 209,209,209 185,185,185 180,180,180 184,184,184 210,210,210 184,184,184 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 246,246,246 255,255,255 255,255,255 234,234,234 0,0,0 0,0,0 249,249,249 255,255,255 231,231,231 255,255,255 243,243,243 178,178,178 255,255,255 25,25,25 0,0,0 253,253,253 230,230,230 251,251,251 255,255,255 255,255,255 189,189,189 206,206,206 188,188,188 200,200,200 0,0,0 19,19,19 0,0,0 2,2,2 159,159,159 203,203,203 191,191,191 0,0,0 8,8,8 180,180,180 11,11,11 0,0,0 170,170,170 212,212,212 184,184,184 192,192,192 194,194,194 239,239,239 10,10,10 10,10,10 255,255,255 0,0,0 10,10,10 243,243,243 255,255,255 247,247,247 255,255,255 255,255,255 247,247,247 186,186,186 240,240,240 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 255,255,255 239,239,239 240,240,240 255,255,255 0,0,0 0,0,0 2,2,2 0,0,0 10,10,10 0,0,0 235,235,235 213,213,213 250,250,250 0,0,0 6,6,6 251,251,251 255,255,255 255,255,255 235,235,235 255,255,255 192,192,192 243,243,243 255,255,255 251,251,251 255,255,255 0,0,0 8,8,8 255,255,255 255,255,255 250,250,250 247,247,247 0,0,0 0,0,0 10,10,10 0,0,0 255,255,255 248,248,248 255,255,255 252,252,252 255,255,255 197,197,197 6,6,6 0,0,0 252,252,252 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 239,239,239 255,255,255 251,251,251 248,248,248 197,197,197 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +191,191,191 192,192,192 194,194,194 198,198,198 195,195,195 4,4,4 2,2,2 247,247,247 179,179,179 207,207,207 184,184,184 182,182,182 220,220,220 219,219,219 15,15,15 0,0,0 243,243,243 255,255,255 243,243,243 0,0,0 5,5,5 0,0,0 247,247,247 255,255,255 247,247,247 255,255,255 0,0,0 0,0,0 255,255,255 246,246,246 236,236,236 255,255,255 3,3,3 3,3,3 0,0,0 0,0,0 255,255,255 250,250,250 252,252,252 255,255,255 255,255,255 0,0,0 0,0,0 255,255,255 241,241,241 254,254,254 18,18,18 0,0,0 249,249,249 255,255,255 246,246,246 255,255,255 255,255,255 251,251,251 210,210,210 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 254,254,254 239,239,239 240,240,240 246,246,246 8,8,8 1,1,1 255,255,255 199,199,199 232,232,232 251,251,251 255,255,255 184,184,184 255,255,255 0,0,0 0,0,0 255,255,255 234,234,234 255,255,255 255,255,255 3,3,3 11,11,11 228,228,228 255,255,255 255,255,255 239,239,239 0,0,0 4,4,4 250,250,250 254,254,254 255,255,255 251,251,251 0,0,0 0,0,0 255,255,255 12,12,12 0,0,0 254,254,254 253,253,253 246,246,246 252,252,252 5,5,5 18,18,18 0,0,0 13,13,13 0,0,0 0,0,0 21,21,21 2,2,2 233,233,233 255,255,255 235,235,235 252,252,252 251,251,251 183,183,183 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +238,238,238 254,254,254 255,255,255 255,255,255 255,255,255 0,0,0 0,0,0 253,253,253 195,195,195 255,255,255 255,255,255 253,253,253 185,185,185 244,244,244 14,14,14 0,0,0 254,254,254 245,245,245 253,253,253 244,244,244 0,0,0 0,0,0 255,255,255 255,255,255 255,255,255 255,255,255 1,1,1 0,0,0 255,255,255 246,246,246 249,249,249 248,248,248 14,14,14 0,0,0 255,255,255 241,241,241 2,2,2 21,21,21 255,255,255 249,249,249 251,251,251 196,196,196 236,236,236 255,255,255 243,243,243 253,253,253 8,8,8 0,0,0 255,255,255 255,255,255 247,247,247 255,255,255 249,249,249 252,252,252 211,211,211 239,239,239 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 248,248,248 249,249,249 240,240,240 245,245,245 5,5,5 31,31,31 233,233,233 190,190,190 202,202,202 179,179,179 203,203,203 197,197,197 239,239,239 255,255,255 0,0,0 6,6,6 255,255,255 255,255,255 255,255,255 13,13,13 0,0,0 255,255,255 248,248,248 236,236,236 243,243,243 0,0,0 8,8,8 241,241,241 252,252,252 255,255,255 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 249,249,249 0,0,0 0,0,0 255,255,255 247,247,247 194,194,194 255,255,255 252,252,252 255,255,255 242,242,242 1,1,1 0,0,0 243,243,243 250,250,250 242,242,242 255,255,255 255,255,255 244,244,244 194,194,194 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +239,239,239 186,186,186 203,203,203 190,190,190 188,188,188 2,2,2 0,0,0 8,8,8 0,0,0 0,0,0 0,0,0 8,8,8 193,193,193 197,197,197 159,159,159 197,197,197 0,0,0 0,0,0 0,0,0 8,8,8 0,0,0 170,170,170 250,250,250 255,255,255 255,255,255 255,255,255 6,6,6 0,0,0 244,244,244 255,255,255 247,247,247 255,255,255 6,6,6 0,0,0 248,248,248 255,255,255 248,248,248 255,255,255 0,0,0 5,5,5 255,255,255 185,185,185 238,238,238 255,255,255 251,251,251 254,254,254 9,9,9 5,5,5 247,247,247 255,255,255 248,248,248 232,232,232 255,255,255 255,255,255 182,182,182 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 188,188,188 238,238,238 243,243,243 255,255,255 239,239,239 255,255,255 255,255,255 253,253,253 250,250,250 215,215,215 248,248,248 204,204,204 247,247,247 255,255,255 249,249,249 255,255,255 212,212,212 251,251,251 248,248,248 255,255,255 212,212,212 255,255,255 241,241,241 240,240,240 255,255,255 236,236,236 255,255,255 255,255,255 236,236,236 255,255,255 240,240,240 242,242,242 179,179,179 252,252,252 255,255,255 255,255,255 236,236,236 255,255,255 235,235,235 249,249,249 171,171,171 222,222,222 187,187,187 164,164,164 217,217,217 159,159,159 255,255,255 252,252,252 236,236,236 254,254,254 255,255,255 246,246,246 247,247,247 197,197,197 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 181,181,181 255,255,255 251,251,251 245,245,245 242,242,242 255,255,255 244,244,244 255,255,255 255,255,255 177,177,177 240,240,240 200,200,200 255,255,255 241,241,241 244,244,244 241,241,241 201,201,201 255,255,255 243,243,243 242,242,242 176,176,176 181,181,181 192,192,192 200,200,200 182,182,182 186,186,186 204,204,204 198,198,198 193,193,193 198,198,198 194,194,194 197,197,197 197,197,197 255,255,255 246,246,246 255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 195,195,195 250,250,250 251,251,251 245,245,245 255,255,255 186,186,186 253,253,253 255,255,255 255,255,255 249,249,249 242,242,242 242,242,242 255,255,255 202,202,202 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 179,179,179 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 246,246,246 248,248,248 250,250,250 205,205,205 249,249,249 201,201,201 227,227,227 255,255,255 254,254,254 255,255,255 173,173,173 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 252,252,252 244,244,244 211,211,211 240,240,240 255,255,255 243,243,243 251,251,251 250,250,250 255,255,255 250,250,250 255,255,255 245,245,245 245,245,245 255,255,255 252,252,252 238,238,238 255,255,255 252,252,252 191,191,191 247,247,247 254,254,254 255,255,255 250,250,250 179,179,179 255,255,255 253,253,253 251,251,251 255,255,255 255,255,255 249,249,249 247,247,247 185,185,185 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input01.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input01.jpg new file mode 100644 index 0000000..51fb7cc Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input01.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input01.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input01.txt new file mode 100644 index 0000000..a7400f1 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input01.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 252,252,252 247,247,247 255,255,255 254,254,254 255,255,255 198,198,198 249,249,249 251,251,251 251,251,251 255,255,255 189,189,189 182,182,182 255,255,255 247,247,247 255,255,255 252,252,252 255,255,255 247,247,247 255,255,255 255,255,255 248,248,248 255,255,255 247,247,247 255,255,255 248,248,248 248,248,248 255,255,255 250,250,250 196,196,196 253,253,253 194,194,194 250,250,250 213,213,213 227,227,227 255,255,255 243,243,243 255,255,255 244,244,244 252,252,252 255,255,255 249,249,249 255,255,255 248,248,248 255,255,255 180,180,180 249,249,249 255,255,255 192,192,192 255,255,255 251,251,251 249,249,249 255,255,255 250,250,250 181,181,181 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +246,246,246 255,255,255 255,255,255 238,238,238 251,251,251 250,250,250 167,167,167 255,255,255 238,238,238 255,255,255 241,241,241 190,190,190 201,201,201 249,249,249 255,255,255 230,230,230 255,255,255 242,242,242 254,254,254 251,251,251 247,247,247 248,248,248 255,255,255 255,255,255 250,250,250 255,255,255 247,247,247 243,243,243 249,249,249 191,191,191 187,187,187 201,201,201 234,234,234 166,166,166 255,255,255 248,248,248 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 249,249,249 251,251,251 250,250,250 240,240,240 202,202,202 255,255,255 238,238,238 192,192,192 255,255,255 255,255,255 253,253,253 255,255,255 253,253,253 184,184,184 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 240,240,240 246,246,246 255,255,255 255,255,255 255,255,255 172,172,172 219,219,219 207,207,207 167,167,167 212,212,212 177,177,177 192,192,192 249,249,249 241,241,241 255,255,255 248,248,248 255,255,255 241,241,241 255,255,255 240,240,240 255,255,255 255,255,255 245,245,245 255,255,255 253,253,253 241,241,241 255,255,255 249,249,249 183,183,183 255,255,255 243,243,243 255,255,255 212,212,212 235,235,235 255,255,255 249,249,249 249,249,249 247,247,247 246,246,246 243,243,243 255,255,255 235,235,235 255,255,255 255,255,255 202,202,202 255,255,255 255,255,255 179,179,179 247,247,247 252,252,252 251,251,251 255,255,255 255,255,255 194,194,194 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 249,249,249 255,255,255 255,255,255 237,237,237 236,236,236 206,206,206 0,0,0 0,0,0 8,8,8 16,16,16 8,8,8 176,176,176 248,248,248 1,1,1 0,0,0 0,0,0 4,4,4 5,5,5 0,0,0 1,1,1 243,243,243 255,255,255 244,244,244 252,252,252 2,2,2 0,0,0 7,7,7 0,0,0 2,2,2 253,253,253 241,241,241 218,218,218 0,0,0 12,12,12 0,0,0 0,0,0 10,10,10 184,184,184 197,197,197 187,187,187 0,0,0 10,10,10 0,0,0 0,0,0 0,0,0 0,0,0 0,0,0 203,203,203 255,255,255 255,255,255 249,249,249 246,246,246 250,250,250 191,191,191 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +237,237,237 255,255,255 244,244,244 255,255,255 255,255,255 255,255,255 0,0,0 0,0,0 246,246,246 246,246,246 246,246,246 0,0,0 0,0,0 255,255,255 9,9,9 5,5,5 246,246,246 255,255,255 236,236,236 244,244,244 4,4,4 12,12,12 248,248,248 249,249,249 4,4,4 1,1,1 250,250,250 244,244,244 255,255,255 0,0,0 0,0,0 255,255,255 27,27,27 0,0,0 255,255,255 255,255,255 240,240,240 0,0,0 5,5,5 253,253,253 252,252,252 19,19,19 0,0,0 241,241,241 255,255,255 255,255,255 250,250,250 255,255,255 182,182,182 237,237,237 248,248,248 255,255,255 255,255,255 255,255,255 192,192,192 243,243,243 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 255,255,255 255,255,255 253,253,253 0,0,0 10,10,10 255,255,255 255,255,255 255,255,255 255,255,255 244,244,244 200,200,200 254,254,254 0,0,0 0,0,0 255,255,255 237,237,237 255,255,255 253,253,253 7,7,7 0,0,0 236,236,236 25,25,25 0,0,0 255,255,255 255,255,255 239,239,239 251,251,251 229,229,229 0,0,0 246,246,246 235,235,235 238,238,238 255,255,255 255,255,255 240,240,240 197,197,197 0,0,0 0,0,0 254,254,254 0,0,0 0,0,0 242,242,242 238,238,238 255,255,255 184,184,184 186,186,186 196,196,196 209,209,209 185,185,185 180,180,180 184,184,184 210,210,210 184,184,184 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 249,249,249 242,242,242 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 217,217,217 255,255,255 255,255,255 186,186,186 255,255,255 10,10,10 0,0,0 238,238,238 255,255,255 255,255,255 246,246,246 21,21,21 0,0,0 221,221,221 0,0,0 0,0,0 187,187,187 195,195,195 191,191,191 189,189,189 169,169,169 175,175,175 224,224,224 209,209,209 183,183,183 186,186,186 203,203,203 188,188,188 5,5,5 15,15,15 184,184,184 192,192,192 0,0,0 10,10,10 255,255,255 0,0,0 0,0,0 9,9,9 253,253,253 243,243,243 255,255,255 247,247,247 255,255,255 255,255,255 247,247,247 186,186,186 240,240,240 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 251,251,251 255,255,255 255,255,255 236,236,236 14,14,14 0,0,0 250,250,250 253,253,253 255,255,255 255,255,255 235,235,235 198,198,198 249,249,249 0,0,0 0,0,0 3,3,3 7,7,7 0,0,0 6,6,6 0,0,0 194,194,194 240,240,240 18,18,18 2,2,2 244,244,244 255,255,255 248,248,248 255,255,255 255,255,255 255,255,255 233,233,233 250,250,250 200,200,200 255,255,255 0,0,0 2,2,2 7,7,7 247,247,247 252,252,252 255,255,255 0,0,0 3,3,3 0,0,0 252,252,252 255,255,255 0,0,0 8,8,8 255,255,255 255,255,255 239,239,239 255,255,255 251,251,251 248,248,248 197,197,197 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +190,190,190 196,196,196 179,179,179 201,201,201 195,195,195 0,0,0 7,7,7 255,255,255 187,187,187 178,178,178 11,11,11 0,0,0 4,4,4 255,255,255 0,0,0 7,7,7 0,0,0 0,0,0 0,0,0 255,255,255 244,244,244 210,210,210 238,238,238 0,0,0 10,10,10 246,246,246 255,255,255 255,255,255 245,245,245 247,247,247 255,255,255 246,246,246 242,242,242 199,199,199 255,255,255 255,255,255 253,253,253 0,0,0 0,0,0 255,255,255 255,255,255 192,192,192 244,244,244 255,255,255 255,255,255 255,255,255 190,190,190 4,4,4 0,0,0 255,255,255 244,244,244 255,255,255 255,255,255 244,244,244 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 249,249,249 238,238,238 255,255,255 0,0,0 0,0,0 255,255,255 189,189,189 255,255,255 246,246,246 18,18,18 0,0,0 255,255,255 6,6,6 0,0,0 255,255,255 255,255,255 7,7,7 2,2,2 254,254,254 178,178,178 249,249,249 5,5,5 0,0,0 255,255,255 232,232,232 254,254,254 255,255,255 243,243,243 252,252,252 255,255,255 255,255,255 183,183,183 244,244,244 244,244,244 235,235,235 255,255,255 0,0,0 0,0,0 255,255,255 179,179,179 255,255,255 236,236,236 251,251,251 254,254,254 190,190,190 0,0,0 13,13,13 255,255,255 252,252,252 244,244,244 241,241,241 255,255,255 201,201,201 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 236,236,236 255,255,255 251,251,251 252,252,252 0,0,0 0,0,0 252,252,252 186,186,186 239,239,239 255,255,255 0,0,0 12,12,12 255,255,255 0,0,0 0,0,0 242,242,242 246,246,246 255,255,255 0,0,0 0,0,0 193,193,193 255,255,255 0,0,0 7,7,7 255,255,255 255,255,255 244,244,244 248,248,248 255,255,255 0,0,0 255,255,255 253,253,253 176,176,176 255,255,255 255,255,255 255,255,255 241,241,241 3,3,3 12,12,12 234,234,234 27,27,27 6,6,6 255,255,255 254,254,254 255,255,255 173,173,173 8,8,8 0,0,0 217,217,217 255,255,255 255,255,255 248,248,248 255,255,255 190,190,190 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 253,253,253 251,251,251 244,244,244 251,251,251 255,255,255 0,0,0 8,8,8 197,197,197 202,202,202 173,173,173 1,1,1 0,0,0 240,240,240 1,1,1 3,3,3 255,255,255 255,255,255 248,248,248 255,255,255 10,10,10 0,0,0 252,252,252 255,255,255 0,0,0 3,3,3 255,255,255 255,255,255 240,240,240 6,6,6 11,11,11 245,245,245 0,0,0 10,10,10 255,255,255 231,231,231 253,253,253 6,6,6 0,0,0 248,248,248 255,255,255 190,190,190 0,0,0 0,0,0 255,255,255 252,252,252 13,13,13 0,0,0 250,250,250 255,255,255 253,253,253 250,250,250 247,247,247 255,255,255 189,189,189 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +242,242,242 194,194,194 209,209,209 195,195,195 188,188,188 179,179,179 213,213,213 0,0,0 0,0,0 0,0,0 0,0,0 0,0,0 207,207,207 195,195,195 0,0,0 10,10,10 188,188,188 180,180,180 200,200,200 186,186,186 0,0,0 6,6,6 255,255,255 241,241,241 255,255,255 4,4,4 0,0,0 5,5,5 6,6,6 1,1,1 233,233,233 255,255,255 250,250,250 11,11,11 0,0,0 7,7,7 6,6,6 0,0,0 255,255,255 255,255,255 255,255,255 165,165,165 255,255,255 14,14,14 0,0,0 0,0,0 0,0,0 246,246,246 244,244,244 249,249,249 247,247,247 255,255,255 249,249,249 250,250,250 181,181,181 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 194,194,194 232,232,232 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 202,202,202 255,255,255 187,187,187 255,255,255 255,255,255 252,252,252 253,253,253 203,203,203 255,255,255 255,255,255 255,255,255 203,203,203 247,247,247 245,245,245 245,245,245 240,240,240 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 235,235,235 238,238,238 186,186,186 249,249,249 255,255,255 250,250,250 248,248,248 255,255,255 230,230,230 237,237,237 199,199,199 187,187,187 186,186,186 183,183,183 188,188,188 188,188,188 254,254,254 255,255,255 251,251,251 239,239,239 250,250,250 253,253,253 255,255,255 192,192,192 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 191,191,191 255,255,255 237,237,237 251,251,251 239,239,239 241,241,241 255,255,255 249,249,249 230,230,230 186,186,186 255,255,255 181,181,181 229,229,229 255,255,255 244,244,244 255,255,255 180,180,180 251,251,251 234,234,234 251,251,251 212,212,212 161,161,161 215,215,215 206,206,206 184,184,184 170,170,170 198,198,198 199,199,199 183,183,183 194,194,194 205,205,205 199,199,199 214,214,214 233,233,233 247,247,247 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 185,185,185 246,246,246 255,255,255 255,255,255 245,245,245 191,191,191 255,255,255 244,244,244 255,255,255 255,255,255 255,255,255 243,243,243 249,249,249 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 162,162,162 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 242,242,242 255,255,255 254,254,254 201,201,201 241,241,241 203,203,203 242,242,242 255,255,255 244,244,244 254,254,254 196,196,196 255,255,255 255,255,255 252,252,252 249,249,249 253,253,253 244,244,244 241,241,241 207,207,207 245,245,245 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 236,236,236 255,255,255 255,255,255 236,236,236 255,255,255 255,255,255 251,251,251 248,248,248 191,191,191 255,255,255 246,246,246 255,255,255 246,246,246 194,194,194 246,246,246 255,255,255 255,255,255 246,246,246 254,254,254 255,255,255 255,255,255 197,197,197 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input02.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input02.jpg new file mode 100644 index 0000000..07e59ce Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input02.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input02.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input02.txt new file mode 100644 index 0000000..c14bfbe --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input02.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 252,252,252 247,247,247 255,255,255 254,254,254 255,255,255 198,198,198 249,249,249 253,253,253 255,255,255 244,244,244 194,194,194 192,192,192 255,255,255 245,245,245 255,255,255 255,255,255 247,247,247 255,255,255 255,255,255 255,255,255 253,253,253 255,255,255 255,255,255 251,251,251 255,255,255 245,245,245 255,255,255 254,254,254 192,192,192 242,242,242 195,195,195 252,252,252 202,202,202 241,241,241 248,248,248 246,246,246 253,253,253 255,255,255 255,255,255 246,246,246 255,255,255 241,241,241 255,255,255 242,242,242 184,184,184 255,255,255 244,244,244 192,192,192 255,255,255 251,251,251 249,249,249 255,255,255 250,250,250 181,181,181 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +246,246,246 255,255,255 255,255,255 238,238,238 251,251,251 250,250,250 167,167,167 255,255,255 232,232,232 255,255,255 246,246,246 197,197,197 183,183,183 255,255,255 255,255,255 236,236,236 253,253,253 255,255,255 240,240,240 255,255,255 251,251,251 253,253,253 253,253,253 249,249,249 238,238,238 247,247,247 244,244,244 247,247,247 255,255,255 170,170,170 215,215,215 200,200,200 252,252,252 164,164,164 255,255,255 255,255,255 255,255,255 255,255,255 226,226,226 255,255,255 255,255,255 255,255,255 245,245,245 255,255,255 249,249,249 203,203,203 239,239,239 254,254,254 192,192,192 255,255,255 255,255,255 253,253,253 255,255,255 253,253,253 184,184,184 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 240,240,240 246,246,246 255,255,255 255,255,255 255,255,255 172,172,172 219,219,219 195,195,195 196,196,196 186,186,186 184,184,184 192,192,192 255,255,255 249,249,249 255,255,255 249,249,249 251,251,251 255,255,255 235,235,235 242,242,242 255,255,255 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 185,185,185 250,250,250 234,234,234 245,245,245 212,212,212 251,251,251 242,242,242 240,240,240 252,252,252 255,255,255 249,249,249 241,241,241 255,255,255 240,240,240 243,243,243 245,245,245 198,198,198 255,255,255 254,254,254 179,179,179 247,247,247 252,252,252 251,251,251 255,255,255 255,255,255 194,194,194 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 249,249,249 255,255,255 255,255,255 237,237,237 236,236,236 206,206,206 0,0,0 6,6,6 0,0,0 17,17,17 250,250,250 196,196,196 239,239,239 251,251,251 247,247,247 0,0,0 0,0,0 4,4,4 0,0,0 254,254,254 255,255,255 247,247,247 0,0,0 0,0,0 0,0,0 0,0,0 0,0,0 7,7,7 11,11,11 237,237,237 255,255,255 10,10,10 0,0,0 195,195,195 210,210,210 200,200,200 170,170,170 9,9,9 3,3,3 194,194,194 195,195,195 190,190,190 187,187,187 13,13,13 0,0,0 238,238,238 255,255,255 203,203,203 255,255,255 255,255,255 249,249,249 246,246,246 250,250,250 191,191,191 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +237,237,237 255,255,255 244,244,244 255,255,255 255,255,255 255,255,255 0,0,0 0,0,0 250,250,250 249,249,249 0,0,0 0,0,0 191,191,191 255,255,255 249,249,249 0,0,0 0,0,0 255,255,255 243,243,243 8,8,8 0,0,0 255,255,255 255,255,255 0,0,0 7,7,7 245,245,245 255,255,255 253,253,253 241,241,241 191,191,191 255,255,255 245,245,245 0,0,0 11,11,11 241,241,241 255,255,255 240,240,240 197,197,197 9,9,9 0,0,0 231,231,231 253,253,253 255,255,255 14,14,14 0,0,0 0,0,0 255,255,255 244,244,244 182,182,182 237,237,237 248,248,248 255,255,255 255,255,255 255,255,255 192,192,192 243,243,243 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 255,255,255 255,255,255 253,253,253 0,0,0 10,10,10 255,255,255 254,254,254 255,255,255 255,255,255 13,13,13 198,198,198 241,241,241 0,0,0 0,0,0 255,255,255 232,232,232 252,252,252 247,247,247 0,0,0 14,14,14 245,245,245 0,0,0 3,3,3 232,232,232 255,255,255 250,250,250 255,255,255 183,183,183 255,255,255 252,252,252 0,0,0 1,1,1 248,248,248 252,252,252 243,243,243 209,209,209 0,0,0 0,0,0 255,255,255 249,249,249 0,0,0 0,0,0 2,2,2 4,4,4 203,203,203 182,182,182 196,196,196 209,209,209 185,185,185 180,180,180 184,184,184 210,210,210 184,184,184 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 249,249,249 242,242,242 255,255,255 0,0,0 0,0,0 255,255,255 252,252,252 248,248,248 242,242,242 252,252,252 171,171,171 255,255,255 8,8,8 15,15,15 250,250,250 252,252,252 255,255,255 255,255,255 12,12,12 0,0,0 193,193,193 17,17,17 0,0,0 197,197,197 6,6,6 0,0,0 0,0,0 202,202,202 191,191,191 196,196,196 0,0,0 0,0,0 201,201,201 202,202,202 205,205,205 179,179,179 3,3,3 2,2,2 199,199,199 172,172,172 255,255,255 255,255,255 0,0,0 17,17,17 187,187,187 255,255,255 243,243,243 255,255,255 247,247,247 255,255,255 255,255,255 247,247,247 186,186,186 240,240,240 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 251,251,251 255,255,255 255,255,255 236,236,236 14,14,14 0,0,0 250,250,250 0,0,0 8,8,8 5,5,5 238,238,238 217,217,217 253,253,253 0,0,0 0,0,0 255,255,255 255,255,255 252,252,252 246,246,246 4,4,4 0,0,0 255,255,255 0,0,0 1,1,1 6,6,6 246,246,246 255,255,255 1,1,1 0,0,0 255,255,255 245,245,245 6,6,6 0,0,0 255,255,255 0,0,0 8,8,8 250,250,250 0,0,0 1,1,1 252,252,252 212,212,212 248,248,248 253,253,253 4,4,4 0,0,0 187,187,187 251,251,251 255,255,255 255,255,255 239,239,239 255,255,255 251,251,251 248,248,248 197,197,197 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +197,197,197 196,196,196 181,181,181 194,194,194 196,196,196 2,2,2 1,1,1 2,2,2 189,189,189 196,196,196 0,0,0 0,0,0 195,195,195 253,253,253 0,0,0 1,1,1 255,255,255 255,255,255 248,248,248 245,245,245 0,0,0 0,0,0 255,255,255 244,244,244 254,254,254 251,251,251 245,245,245 255,255,255 250,250,250 2,2,2 12,12,12 242,242,242 5,5,5 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 0,0,0 1,1,1 255,255,255 204,204,204 236,236,236 255,255,255 0,0,0 0,0,0 207,207,207 250,250,250 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +246,246,246 250,250,250 255,255,255 238,238,238 255,255,255 0,0,0 0,0,0 250,250,250 191,191,191 238,238,238 255,255,255 22,22,22 0,0,0 255,255,255 0,0,0 0,0,0 251,251,251 242,242,242 255,255,255 255,255,255 0,0,0 4,4,4 235,235,235 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 247,247,247 0,0,0 0,0,0 255,255,255 0,0,0 1,1,1 249,249,249 8,8,8 2,2,2 248,248,248 8,8,8 0,0,0 251,251,251 179,179,179 255,255,255 251,251,251 0,0,0 10,10,10 182,182,182 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 248,248,248 254,254,254 246,246,246 247,247,247 0,0,0 2,2,2 255,255,255 189,189,189 255,255,255 255,255,255 0,0,0 3,3,3 255,255,255 0,0,0 2,2,2 239,239,239 255,255,255 251,251,251 236,236,236 3,3,3 3,3,3 255,255,255 0,0,0 0,0,0 255,255,255 245,245,245 255,255,255 255,255,255 22,22,22 0,0,0 255,255,255 0,0,0 4,4,4 1,1,1 1,1,1 0,0,0 2,2,2 15,15,15 0,0,0 248,248,248 204,204,204 244,244,244 249,249,249 11,11,11 0,0,0 187,187,187 236,236,236 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +236,236,236 255,255,255 253,253,253 249,249,249 241,241,241 255,255,255 8,8,8 0,0,0 200,200,200 179,179,179 0,0,0 0,0,0 202,202,202 249,249,249 249,249,249 13,13,13 0,0,0 252,252,252 248,248,248 19,19,19 0,0,0 195,195,195 255,255,255 255,255,255 1,1,1 9,9,9 250,250,250 244,244,244 0,0,0 0,0,0 255,255,255 251,251,251 13,13,13 0,0,0 0,0,0 248,248,248 241,241,241 0,0,0 0,0,0 5,5,5 253,253,253 191,191,191 255,255,255 253,253,253 0,0,0 3,3,3 208,208,208 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 179,179,179 204,204,204 174,174,174 207,207,207 209,209,209 198,198,198 0,0,0 0,0,0 4,4,4 7,7,7 253,253,253 192,192,192 179,179,179 186,186,186 173,173,173 5,5,5 3,3,3 0,0,0 0,0,0 196,196,196 191,191,191 244,244,244 255,255,255 255,255,255 0,0,0 14,14,14 0,0,0 3,3,3 255,255,255 252,252,252 255,255,255 0,0,0 7,7,7 244,244,244 255,255,255 255,255,255 240,240,240 11,11,11 0,0,0 255,255,255 175,175,175 5,5,5 0,0,0 5,5,5 0,0,0 2,2,2 0,0,0 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 183,183,183 245,245,245 254,254,254 255,255,255 240,240,240 251,251,251 255,255,255 251,251,251 255,255,255 181,181,181 241,241,241 203,203,203 248,248,248 255,255,255 255,255,255 248,248,248 215,215,215 228,228,228 254,254,254 255,255,255 202,202,202 245,245,245 247,247,247 246,246,246 249,249,249 252,252,252 251,251,251 255,255,255 225,225,225 255,255,255 241,241,241 228,228,228 213,213,213 252,252,252 243,243,243 244,244,244 255,255,255 250,250,250 255,255,255 255,255,255 162,162,162 205,205,205 180,180,180 171,171,171 213,213,213 178,178,178 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 198,198,198 243,243,243 255,255,255 248,248,248 235,235,235 255,255,255 238,238,238 250,250,250 238,238,238 199,199,199 252,252,252 187,187,187 255,255,255 243,243,243 248,248,248 242,242,242 189,189,189 255,255,255 243,243,243 240,240,240 179,179,179 205,205,205 194,194,194 197,197,197 170,170,170 194,194,194 208,208,208 182,182,182 207,207,207 201,201,201 195,195,195 206,206,206 193,193,193 237,237,237 255,255,255 255,255,255 255,255,255 239,239,239 248,248,248 251,251,251 192,192,192 255,255,255 255,255,255 254,254,254 250,250,250 190,190,190 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 187,187,187 241,241,241 255,255,255 250,250,250 255,255,255 247,247,247 255,255,255 255,255,255 255,255,255 190,190,190 248,248,248 202,202,202 232,232,232 255,255,255 246,246,246 255,255,255 190,190,190 248,248,248 253,253,253 255,255,255 255,255,255 234,234,234 255,255,255 253,253,253 212,212,212 238,238,238 248,248,248 255,255,255 237,237,237 245,245,245 255,255,255 254,254,254 252,252,252 244,244,244 252,252,252 247,247,247 245,245,245 255,255,255 254,254,254 255,255,255 195,195,195 248,248,248 249,249,249 255,255,255 253,253,253 182,182,182 254,254,254 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input03.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input03.jpg new file mode 100644 index 0000000..5d8c767 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input03.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input03.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input03.txt new file mode 100644 index 0000000..0d561ea --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input03.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 255,255,255 250,250,250 255,255,255 250,250,250 255,255,255 198,198,198 255,255,255 249,249,249 255,255,255 254,254,254 185,185,185 191,191,191 255,255,255 250,250,250 254,254,254 255,255,255 239,239,239 255,255,255 255,255,255 255,255,255 254,254,254 250,250,250 255,255,255 251,251,251 255,255,255 246,246,246 252,252,252 255,255,255 193,193,193 224,224,224 204,204,204 254,254,254 186,186,186 247,247,247 250,250,250 250,250,250 240,240,240 255,255,255 244,244,244 255,255,255 254,254,254 253,253,253 247,247,247 255,255,255 198,198,198 255,255,255 247,247,247 189,189,189 255,255,255 249,249,249 253,253,253 255,255,255 242,242,242 184,184,184 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 254,254,254 251,251,251 255,255,255 255,255,255 255,255,255 182,182,182 234,234,234 255,255,255 244,244,244 249,249,249 183,183,183 203,203,203 253,253,253 236,236,236 255,255,255 254,254,254 255,255,255 255,255,255 229,229,229 246,246,246 255,255,255 236,236,236 255,255,255 249,249,249 255,255,255 255,255,255 235,235,235 227,227,227 190,190,190 222,222,222 193,193,193 246,246,246 181,181,181 248,248,248 255,255,255 244,244,244 255,255,255 249,249,249 255,255,255 255,255,255 242,242,242 244,244,244 255,255,255 247,247,247 194,194,194 242,242,242 255,255,255 196,196,196 255,255,255 255,255,255 249,249,249 255,255,255 255,255,255 196,196,196 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 249,249,249 255,255,255 255,255,255 254,254,254 175,175,175 222,222,222 187,187,187 194,194,194 196,196,196 207,207,207 167,167,167 255,255,255 255,255,255 249,249,249 253,253,253 241,241,241 247,247,247 255,255,255 255,255,255 235,235,235 255,255,255 253,253,253 249,249,249 228,228,228 255,255,255 255,255,255 255,255,255 190,190,190 255,255,255 237,237,237 255,255,255 191,191,191 250,250,250 245,245,245 255,255,255 252,252,252 236,236,236 240,240,240 242,242,242 255,255,255 248,248,248 255,255,255 247,247,247 188,188,188 255,255,255 239,239,239 184,184,184 238,238,238 255,255,255 255,255,255 255,255,255 251,251,251 192,192,192 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 254,254,254 249,249,249 255,255,255 252,252,252 255,255,255 186,186,186 240,240,240 0,0,0 0,0,0 0,0,0 8,8,8 183,183,183 248,248,248 239,239,239 255,255,255 3,3,3 0,0,0 7,7,7 0,0,0 255,255,255 248,248,248 245,245,245 237,237,237 246,246,246 23,23,23 0,0,0 5,5,5 0,0,0 190,190,190 242,242,242 255,255,255 0,0,0 6,6,6 21,21,21 0,0,0 0,0,0 3,3,3 10,10,10 2,2,2 193,193,193 177,177,177 194,194,194 0,0,0 0,0,0 1,1,1 0,0,0 0,0,0 201,201,201 255,255,255 251,251,251 245,245,245 252,252,252 244,244,244 192,192,192 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 255,255,255 252,252,252 255,255,255 250,250,250 255,255,255 194,194,194 255,255,255 234,234,234 255,255,255 0,0,0 1,1,1 211,211,211 255,255,255 243,243,243 7,7,7 1,1,1 251,251,251 250,250,250 0,0,0 0,0,0 255,255,255 255,255,255 255,255,255 13,13,13 0,0,0 253,253,253 255,255,255 0,0,0 5,5,5 255,255,255 253,253,253 244,244,244 255,255,255 228,228,228 255,255,255 249,249,249 196,196,196 0,0,0 1,1,1 255,255,255 254,254,254 0,0,0 14,14,14 248,248,248 253,253,253 254,254,254 17,17,17 7,7,7 231,231,231 254,254,254 249,249,249 255,255,255 255,255,255 206,206,206 234,234,234 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 254,254,254 255,255,255 255,255,255 252,252,252 254,254,254 192,192,192 255,255,255 255,255,255 255,255,255 0,0,0 11,11,11 175,175,175 231,231,231 0,0,0 2,2,2 250,250,250 252,252,252 244,244,244 255,255,255 0,0,0 245,245,245 238,238,238 0,0,0 0,0,0 246,246,246 255,255,255 254,254,254 242,242,242 0,0,0 0,0,0 250,250,250 255,255,255 236,236,236 254,254,254 255,255,255 229,229,229 198,198,198 5,5,5 0,0,0 245,245,245 1,1,1 8,8,8 248,248,248 255,255,255 242,242,242 204,204,204 162,162,162 0,0,0 195,195,195 196,196,196 181,181,181 195,195,195 197,197,197 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +250,250,250 254,254,254 254,254,254 255,255,255 252,252,252 255,255,255 191,191,191 252,252,252 255,255,255 216,216,216 0,0,0 0,0,0 205,205,205 255,255,255 9,9,9 0,0,0 255,255,255 244,244,244 247,247,247 252,252,252 255,255,255 180,180,180 234,234,234 191,191,191 190,190,190 178,178,178 197,197,197 189,189,189 193,193,193 14,14,14 8,8,8 193,193,193 187,187,187 167,167,167 201,201,201 220,220,220 191,191,191 13,13,13 0,0,0 193,193,193 175,175,175 17,17,17 0,0,0 245,245,245 255,255,255 254,254,254 205,205,205 255,255,255 248,248,248 255,255,255 241,241,241 245,245,245 255,255,255 249,249,249 181,181,181 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 248,248,248 253,253,253 250,250,250 255,255,255 195,195,195 255,255,255 251,251,251 255,255,255 5,5,5 0,0,0 181,181,181 244,244,244 3,3,3 0,0,0 255,255,255 0,0,0 11,11,11 3,3,3 244,244,244 200,200,200 236,236,236 255,255,255 254,254,254 255,255,255 237,237,237 255,255,255 0,0,0 0,0,0 255,255,255 244,244,244 255,255,255 204,204,204 254,254,254 249,249,249 1,1,1 0,0,0 255,255,255 254,254,254 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 242,242,242 186,186,186 252,252,252 254,254,254 238,238,238 251,251,251 255,255,255 247,247,247 255,255,255 187,187,187 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +191,191,191 197,197,197 184,184,184 199,199,199 186,186,186 188,188,188 205,205,205 248,248,248 177,177,177 198,198,198 0,0,0 6,6,6 195,195,195 245,245,245 8,8,8 0,0,0 0,0,0 255,255,255 254,254,254 1,1,1 0,0,0 198,198,198 244,244,244 250,250,250 246,246,246 255,255,255 247,247,247 22,22,22 1,1,1 252,252,252 251,251,251 254,254,254 254,254,254 190,190,190 255,255,255 2,2,2 0,0,0 255,255,255 245,245,245 255,255,255 255,255,255 0,0,0 3,3,3 244,244,244 255,255,255 242,242,242 191,191,191 255,255,255 255,255,255 242,242,242 255,255,255 243,243,243 255,255,255 242,242,242 189,189,189 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 247,247,247 253,253,253 240,240,240 255,255,255 242,242,242 247,247,247 255,255,255 202,202,202 241,241,241 0,0,0 0,0,0 186,186,186 255,255,255 1,1,1 5,5,5 255,255,255 252,252,252 246,246,246 246,246,246 6,6,6 14,14,14 235,235,235 255,255,255 255,255,255 246,246,246 11,11,11 0,0,0 251,251,251 254,254,254 243,243,243 255,255,255 255,255,255 172,172,172 0,0,0 6,6,6 240,240,240 255,255,255 248,248,248 245,245,245 255,255,255 0,0,0 4,4,4 255,255,255 248,248,248 250,250,250 206,206,206 240,240,240 255,255,255 255,255,255 241,241,241 248,248,248 253,253,253 255,255,255 207,207,207 239,239,239 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 245,245,245 252,252,252 249,249,249 248,248,248 255,255,255 0,0,0 255,255,255 196,196,196 250,250,250 3,3,3 8,8,8 204,204,204 228,228,228 0,0,0 3,3,3 242,242,242 255,255,255 255,255,255 255,255,255 8,8,8 0,0,0 247,247,247 251,251,251 253,253,253 2,2,2 0,0,0 255,255,255 255,255,255 252,252,252 255,255,255 252,252,252 239,239,239 29,29,29 0,0,0 255,255,255 255,255,255 243,243,243 244,244,244 255,255,255 234,234,234 9,9,9 0,0,0 255,255,255 249,249,249 240,240,240 191,191,191 255,255,255 0,0,0 243,243,243 255,255,255 255,255,255 251,251,251 252,252,252 191,191,191 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +252,252,252 249,249,249 255,255,255 250,250,250 236,236,236 244,244,244 10,10,10 13,13,13 187,187,187 13,13,13 0,0,0 203,203,203 197,197,197 243,243,243 255,255,255 0,0,0 3,3,3 255,255,255 245,245,245 11,11,11 0,0,0 209,209,209 255,255,255 254,254,254 0,0,0 0,0,0 255,255,255 248,248,248 218,218,218 255,255,255 255,255,255 244,244,244 4,4,4 0,0,0 255,255,255 250,250,250 255,255,255 253,253,253 255,255,255 239,239,239 255,255,255 189,189,189 10,10,10 0,0,0 254,254,254 255,255,255 202,202,202 0,0,0 2,2,2 255,255,255 254,254,254 243,243,243 255,255,255 255,255,255 186,186,186 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +232,232,232 191,191,191 209,209,209 186,186,186 205,205,205 200,200,200 192,192,192 0,0,0 0,0,0 1,1,1 180,180,180 255,255,255 188,188,188 202,202,202 168,168,168 187,187,187 0,0,0 0,0,0 4,4,4 0,0,0 191,191,191 180,180,180 254,254,254 0,0,0 0,0,0 4,4,4 6,6,6 0,0,0 20,20,20 1,1,1 0,0,0 255,255,255 13,13,13 0,0,0 243,243,243 255,255,255 234,234,234 255,255,255 255,255,255 252,252,252 255,255,255 180,180,180 255,255,255 1,1,1 3,3,3 0,0,0 0,0,0 0,0,0 241,241,241 255,255,255 245,245,245 255,255,255 255,255,255 255,255,255 193,193,193 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 192,192,192 249,249,249 227,227,227 252,252,252 255,255,255 245,245,245 255,255,255 240,240,240 253,253,253 195,195,195 250,250,250 199,199,199 251,251,251 246,246,246 255,255,255 251,251,251 224,224,224 238,238,238 248,248,248 252,252,252 220,220,220 255,255,255 255,255,255 255,255,255 242,242,242 245,245,245 255,255,255 250,250,250 236,236,236 248,248,248 254,254,254 230,230,230 196,196,196 255,255,255 254,254,254 255,255,255 254,254,254 249,249,249 250,250,250 234,234,234 184,184,184 205,205,205 174,174,174 175,175,175 207,207,207 178,178,178 255,255,255 255,255,255 242,242,242 255,255,255 255,255,255 255,255,255 247,247,247 182,182,182 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 176,176,176 255,255,255 249,249,249 255,255,255 247,247,247 244,244,244 255,255,255 248,248,248 255,255,255 181,181,181 244,244,244 196,196,196 254,254,254 249,249,249 254,254,254 249,249,249 183,183,183 241,241,241 255,255,255 248,248,248 191,191,191 161,161,161 185,185,185 200,200,200 174,174,174 183,183,183 196,196,196 202,202,202 195,195,195 213,213,213 189,189,189 203,203,203 202,202,202 245,245,245 241,241,241 252,252,252 255,255,255 241,241,241 255,255,255 255,255,255 182,182,182 250,250,250 255,255,255 255,255,255 244,244,244 188,188,188 255,255,255 247,247,247 254,254,254 255,255,255 237,237,237 255,255,255 255,255,255 184,184,184 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 187,187,187 253,253,253 255,255,255 254,254,254 254,254,254 251,251,251 248,248,248 255,255,255 238,238,238 190,190,190 255,255,255 192,192,192 234,234,234 255,255,255 240,240,240 255,255,255 162,162,162 255,255,255 242,242,242 245,245,245 255,255,255 255,255,255 255,255,255 243,243,243 224,224,224 229,229,229 255,255,255 249,249,249 239,239,239 255,255,255 255,255,255 252,252,252 247,247,247 249,249,249 253,253,253 255,255,255 255,255,255 243,243,243 255,255,255 247,247,247 190,190,190 255,255,255 250,250,250 246,246,246 255,255,255 180,180,180 249,249,249 255,255,255 244,244,244 252,252,252 255,255,255 246,246,246 255,255,255 196,196,196 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input04.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input04.jpg new file mode 100644 index 0000000..519720f Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input04.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input04.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input04.txt new file mode 100644 index 0000000..8479800 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input04.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +247,247,247 255,255,255 242,242,242 255,255,255 247,247,247 255,255,255 187,187,187 255,255,255 253,253,253 255,255,255 255,255,255 178,178,178 185,185,185 254,254,254 255,255,255 251,251,251 254,254,254 249,249,249 254,254,254 254,254,254 255,255,255 255,255,255 253,253,253 254,254,254 255,255,255 249,249,249 255,255,255 252,252,252 248,248,248 209,209,209 228,228,228 201,201,201 253,253,253 184,184,184 255,255,255 255,255,255 232,232,232 255,255,255 255,255,255 248,248,248 255,255,255 254,254,254 253,253,253 247,247,247 255,255,255 198,198,198 255,255,255 247,247,247 189,189,189 255,255,255 249,249,249 253,253,253 255,255,255 242,242,242 184,184,184 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 252,252,252 251,251,251 254,254,254 255,255,255 250,250,250 172,172,172 238,238,238 247,247,247 250,250,250 246,246,246 203,203,203 199,199,199 252,252,252 249,249,249 243,243,243 255,255,255 255,255,255 250,250,250 249,249,249 242,242,242 253,253,253 250,250,250 255,255,255 246,246,246 246,246,246 255,255,255 248,248,248 245,245,245 181,181,181 219,219,219 192,192,192 255,255,255 174,174,174 255,255,255 250,250,250 251,251,251 255,255,255 236,236,236 255,255,255 255,255,255 242,242,242 244,244,244 255,255,255 247,247,247 194,194,194 242,242,242 255,255,255 196,196,196 255,255,255 255,255,255 249,249,249 255,255,255 255,255,255 196,196,196 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 +241,241,241 255,255,255 244,244,244 253,253,253 255,255,255 255,255,255 170,170,170 221,221,221 191,191,191 184,184,184 198,198,198 198,198,198 171,171,171 255,255,255 255,255,255 255,255,255 243,243,243 255,255,255 252,252,252 255,255,255 247,247,247 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 251,251,251 250,250,250 255,255,255 183,183,183 255,255,255 234,234,234 243,243,243 197,197,197 255,255,255 239,239,239 255,255,255 242,242,242 241,241,241 244,244,244 242,242,242 255,255,255 248,248,248 255,255,255 247,247,247 188,188,188 255,255,255 239,239,239 184,184,184 238,238,238 255,255,255 255,255,255 255,255,255 251,251,251 192,192,192 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 250,250,250 255,255,255 253,253,253 236,236,236 0,0,0 12,12,12 239,239,239 243,243,243 244,244,244 255,255,255 0,0,0 0,0,0 255,255,255 5,5,5 0,0,0 247,247,247 255,255,255 247,247,247 255,255,255 240,240,240 252,252,252 246,246,246 242,242,242 9,9,9 0,0,0 0,0,0 0,0,0 11,11,11 0,0,0 238,238,238 255,255,255 239,239,239 213,213,213 0,0,0 5,5,5 0,0,0 14,14,14 194,194,194 196,196,196 193,193,193 177,177,177 194,194,194 0,0,0 0,0,0 1,1,1 0,0,0 0,0,0 201,201,201 255,255,255 251,251,251 245,245,245 252,252,252 244,244,244 192,192,192 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +252,252,252 255,255,255 225,225,225 255,255,255 255,255,255 9,9,9 0,0,0 255,255,255 255,255,255 245,245,245 255,255,255 3,3,3 0,0,0 250,250,250 0,0,0 0,0,0 251,251,251 255,255,255 238,238,238 253,253,253 246,246,246 255,255,255 255,255,255 255,255,255 247,247,247 236,236,236 18,18,18 3,3,3 240,240,240 195,195,195 252,252,252 255,255,255 255,255,255 0,0,0 0,0,0 255,255,255 250,250,250 0,0,0 6,6,6 255,255,255 255,255,255 254,254,254 0,0,0 14,14,14 248,248,248 253,253,253 254,254,254 17,17,17 7,7,7 231,231,231 254,254,254 249,249,249 255,255,255 255,255,255 206,206,206 234,234,234 255,255,255 255,255,255 255,255,255 255,255,255 +246,246,246 255,255,255 255,255,255 242,242,242 242,242,242 0,0,0 0,0,0 247,247,247 255,255,255 252,252,252 233,233,233 11,11,11 20,20,20 255,255,255 0,0,0 5,5,5 246,246,246 255,255,255 245,245,245 255,255,255 255,255,255 237,237,237 249,249,249 239,239,239 255,255,255 236,236,236 7,7,7 4,4,4 238,238,238 215,215,215 255,255,255 242,242,242 1,1,1 5,5,5 255,255,255 255,255,255 240,240,240 201,201,201 0,0,0 5,5,5 245,245,245 1,1,1 8,8,8 248,248,248 255,255,255 242,242,242 204,204,204 162,162,162 0,0,0 195,195,195 196,196,196 181,181,181 195,195,195 197,197,197 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +242,242,242 255,255,255 239,239,239 244,244,244 255,255,255 255,255,255 13,13,13 1,1,1 240,240,240 255,255,255 15,15,15 0,0,0 192,192,192 252,252,252 0,0,0 13,13,13 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 186,186,186 204,204,204 192,192,192 171,171,171 207,207,207 0,0,0 0,0,0 207,207,207 170,170,170 191,191,191 195,195,195 201,201,201 176,176,176 167,167,167 201,201,201 212,212,212 187,187,187 1,1,1 4,4,4 175,175,175 17,17,17 0,0,0 245,245,245 255,255,255 254,254,254 205,205,205 255,255,255 248,248,248 255,255,255 241,241,241 245,245,245 255,255,255 249,249,249 181,181,181 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 236,236,236 255,255,255 255,255,255 235,235,235 255,255,255 0,0,0 1,1,1 255,255,255 246,246,246 0,0,0 4,4,4 201,201,201 251,251,251 20,20,20 0,0,0 255,255,255 253,253,253 253,253,253 250,250,250 255,255,255 195,195,195 249,249,249 255,255,255 252,252,252 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 252,252,252 252,252,252 247,247,247 201,201,201 255,255,255 247,247,247 250,250,250 0,0,0 0,0,0 251,251,251 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 242,242,242 186,186,186 252,252,252 254,254,254 238,238,238 251,251,251 255,255,255 247,247,247 255,255,255 187,187,187 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +185,185,185 186,186,186 194,194,194 204,204,204 203,203,203 185,185,185 3,3,3 3,3,3 183,183,183 190,190,190 4,4,4 0,0,0 199,199,199 237,237,237 14,14,14 0,0,0 243,243,243 255,255,255 243,243,243 252,252,252 244,244,244 201,201,201 255,255,255 252,252,252 253,253,253 255,255,255 0,0,0 9,9,9 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 200,200,200 244,244,244 255,255,255 0,0,0 2,2,2 242,242,242 255,255,255 255,255,255 0,0,0 3,3,3 244,244,244 255,255,255 242,242,242 191,191,191 255,255,255 255,255,255 242,242,242 255,255,255 243,243,243 255,255,255 242,242,242 189,189,189 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 254,254,254 255,255,255 239,239,239 230,230,230 255,255,255 229,229,229 1,1,1 4,4,4 14,14,14 1,1,1 247,247,247 195,195,195 255,255,255 0,0,0 0,0,0 255,255,255 252,252,252 250,250,250 255,255,255 255,255,255 172,172,172 234,234,234 246,246,246 255,255,255 255,255,255 0,0,0 0,0,0 255,255,255 250,250,250 251,251,251 251,251,251 246,246,246 187,187,187 238,238,238 21,21,21 0,0,0 228,228,228 255,255,255 255,255,255 255,255,255 0,0,0 4,4,4 255,255,255 248,248,248 250,250,250 206,206,206 240,240,240 255,255,255 255,255,255 241,241,241 248,248,248 253,253,253 255,255,255 207,207,207 239,239,239 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 247,247,247 252,252,252 246,246,246 255,255,255 255,255,255 248,248,248 0,0,0 0,0,0 1,1,1 0,0,0 249,249,249 181,181,181 244,244,244 16,16,16 5,5,5 244,244,244 243,243,243 244,244,244 254,254,254 250,250,250 196,196,196 255,255,255 255,255,255 245,245,245 255,255,255 3,3,3 1,1,1 252,252,252 245,245,245 255,255,255 255,255,255 252,252,252 199,199,199 0,0,0 1,1,1 251,251,251 255,255,255 233,233,233 247,247,247 234,234,234 9,9,9 0,0,0 255,255,255 249,249,249 240,240,240 191,191,191 255,255,255 0,0,0 243,243,243 255,255,255 255,255,255 251,251,251 252,252,252 191,191,191 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 253,253,253 241,241,241 242,242,242 242,242,242 252,252,252 255,255,255 4,4,4 11,11,11 167,167,167 214,214,214 207,207,207 235,235,235 0,0,0 8,8,8 255,255,255 255,255,255 241,241,241 255,255,255 232,232,232 217,217,217 237,237,237 255,255,255 253,253,253 250,250,250 0,0,0 0,0,0 255,255,255 254,254,254 255,255,255 241,241,241 255,255,255 0,0,0 10,10,10 243,243,243 255,255,255 242,242,242 255,255,255 255,255,255 255,255,255 189,189,189 10,10,10 0,0,0 254,254,254 255,255,255 202,202,202 0,0,0 2,2,2 255,255,255 254,254,254 243,243,243 255,255,255 255,255,255 186,186,186 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +242,242,242 185,185,185 194,194,194 199,199,199 186,186,186 216,216,216 185,185,185 176,176,176 0,0,0 0,0,0 193,193,193 249,249,249 187,187,187 199,199,199 0,0,0 0,0,0 0,0,0 15,15,15 4,4,4 0,0,0 9,9,9 163,163,163 254,254,254 247,247,247 2,2,2 2,2,2 0,0,0 5,5,5 0,0,0 18,18,18 244,244,244 255,255,255 0,0,0 4,4,4 0,0,0 4,4,4 0,0,0 11,11,11 0,0,0 0,0,0 255,255,255 180,180,180 255,255,255 1,1,1 3,3,3 0,0,0 0,0,0 0,0,0 241,241,241 255,255,255 245,245,245 255,255,255 255,255,255 255,255,255 193,193,193 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 +248,248,248 200,200,200 249,249,249 247,247,247 238,238,238 246,246,246 255,255,255 255,255,255 255,255,255 240,240,240 191,191,191 255,255,255 193,193,193 255,255,255 255,255,255 250,250,250 255,255,255 206,206,206 237,237,237 251,251,251 255,255,255 227,227,227 248,248,248 255,255,255 250,250,250 236,236,236 245,245,245 255,255,255 248,248,248 230,230,230 255,255,255 231,231,231 248,248,248 205,205,205 255,255,255 254,254,254 255,255,255 252,252,252 242,242,242 255,255,255 234,234,234 184,184,184 205,205,205 174,174,174 175,175,175 207,207,207 178,178,178 255,255,255 255,255,255 242,242,242 255,255,255 255,255,255 255,255,255 247,247,247 182,182,182 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 191,191,191 244,244,244 247,247,247 255,255,255 240,240,240 255,255,255 242,242,242 249,249,249 249,249,249 208,208,208 241,241,241 189,189,189 249,249,249 253,253,253 249,249,249 255,255,255 184,184,184 240,240,240 248,248,248 248,248,248 184,184,184 183,183,183 181,181,181 205,205,205 177,177,177 186,186,186 212,212,212 188,188,188 192,192,192 202,202,202 189,189,189 197,197,197 186,186,186 237,237,237 243,243,243 255,255,255 252,252,252 254,254,254 253,253,253 255,255,255 182,182,182 250,250,250 255,255,255 255,255,255 244,244,244 188,188,188 255,255,255 247,247,247 254,254,254 255,255,255 237,237,237 255,255,255 255,255,255 184,184,184 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 165,165,165 255,255,255 255,255,255 247,247,247 249,249,249 255,255,255 255,255,255 255,255,255 249,249,249 179,179,179 255,255,255 197,197,197 227,227,227 255,255,255 244,244,244 249,249,249 203,203,203 253,253,253 255,255,255 248,248,248 250,250,250 255,255,255 253,253,253 238,238,238 219,219,219 235,235,235 255,255,255 240,240,240 255,255,255 241,241,241 255,255,255 255,255,255 252,252,252 250,250,250 255,255,255 244,244,244 255,255,255 255,255,255 250,250,250 247,247,247 190,190,190 255,255,255 250,250,250 246,246,246 255,255,255 180,180,180 249,249,249 255,255,255 244,244,244 252,252,252 255,255,255 246,246,246 255,255,255 196,196,196 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input05.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input05.jpg new file mode 100644 index 0000000..1345260 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input05.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input05.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input05.txt new file mode 100644 index 0000000..2d59c49 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input05.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 252,252,252 247,247,247 255,255,255 254,254,254 255,255,255 198,198,198 249,249,249 250,250,250 254,254,254 242,242,242 201,201,201 183,183,183 255,255,255 255,255,255 246,246,246 248,248,248 255,255,255 244,244,244 255,255,255 255,255,255 251,251,251 238,238,238 255,255,255 249,249,249 252,252,252 249,249,249 255,255,255 255,255,255 194,194,194 227,227,227 198,198,198 254,254,254 186,186,186 247,247,247 250,250,250 250,250,250 240,240,240 255,255,255 244,244,244 249,249,249 255,255,255 241,241,241 255,255,255 245,245,245 179,179,179 254,254,254 255,255,255 201,201,201 246,246,246 242,242,242 255,255,255 255,255,255 247,247,247 185,185,185 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +246,246,246 255,255,255 255,255,255 238,238,238 251,251,251 250,250,250 167,167,167 255,255,255 255,255,255 255,255,255 255,255,255 178,178,178 199,199,199 252,252,252 255,255,255 245,245,245 255,255,255 255,255,255 252,252,252 244,244,244 241,241,241 255,255,255 255,255,255 247,247,247 255,255,255 255,255,255 247,247,247 249,249,249 226,226,226 194,194,194 240,240,240 190,190,190 246,246,246 181,181,181 248,248,248 255,255,255 244,244,244 255,255,255 249,249,249 255,255,255 255,255,255 231,231,231 251,251,251 255,255,255 254,254,254 197,197,197 255,255,255 231,231,231 196,196,196 255,255,255 255,255,255 254,254,254 249,249,249 250,250,250 193,193,193 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 240,240,240 246,246,246 255,255,255 255,255,255 255,255,255 172,172,172 219,219,219 178,178,178 200,200,200 175,175,175 196,196,196 177,177,177 255,255,255 255,255,255 253,253,253 248,248,248 253,253,253 248,248,248 255,255,255 255,255,255 250,250,250 255,255,255 251,251,251 236,236,236 254,254,254 253,253,253 255,255,255 255,255,255 179,179,179 239,239,239 235,235,235 255,255,255 191,191,191 250,250,250 245,245,245 255,255,255 252,252,252 236,236,236 240,240,240 255,255,255 250,250,250 255,255,255 241,241,241 255,255,255 199,199,199 249,249,249 255,255,255 171,171,171 240,240,240 255,255,255 255,255,255 255,255,255 255,255,255 194,194,194 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 249,249,249 255,255,255 255,255,255 237,237,237 236,236,236 206,206,206 0,0,0 0,0,0 20,20,20 2,2,2 247,247,247 213,213,213 243,243,243 243,243,243 255,255,255 248,248,248 6,6,6 16,16,16 255,255,255 241,241,241 248,248,248 247,247,247 6,6,6 19,19,19 0,0,0 12,12,12 0,0,0 0,0,0 23,23,23 255,255,255 251,251,251 0,0,0 6,6,6 21,21,21 0,0,0 0,0,0 3,3,3 10,10,10 2,2,2 178,178,178 189,189,189 190,190,190 11,11,11 0,0,0 0,0,0 0,0,0 241,241,241 227,227,227 255,255,255 248,248,248 245,245,245 236,236,236 250,250,250 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +237,237,237 255,255,255 244,244,244 255,255,255 255,255,255 255,255,255 0,0,0 0,0,0 255,255,255 237,237,237 0,0,0 0,0,0 191,191,191 255,255,255 227,227,227 255,255,255 1,1,1 0,0,0 0,0,0 241,241,241 255,255,255 255,255,255 238,238,238 2,2,2 0,0,0 255,255,255 254,254,254 233,233,233 255,255,255 0,0,0 0,0,0 255,255,255 244,244,244 255,255,255 228,228,228 255,255,255 249,249,249 196,196,196 0,0,0 1,1,1 255,255,255 255,255,255 5,5,5 0,0,0 255,255,255 255,255,255 12,12,12 10,10,10 155,155,155 250,250,250 245,245,245 255,255,255 253,253,253 255,255,255 187,187,187 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 255,255,255 255,255,255 253,253,253 0,0,0 10,10,10 255,255,255 244,244,244 255,255,255 255,255,255 7,7,7 0,0,0 255,255,255 255,255,255 0,0,0 0,0,0 20,20,20 15,15,15 246,246,246 246,246,246 241,241,241 249,249,249 17,17,17 0,0,0 255,255,255 247,247,247 255,255,255 235,235,235 1,1,1 2,2,2 248,248,248 255,255,255 236,236,236 254,254,254 255,255,255 229,229,229 198,198,198 5,5,5 0,0,0 250,250,250 0,0,0 10,10,10 255,255,255 247,247,247 241,241,241 178,178,178 6,6,6 19,19,19 203,203,203 195,195,195 196,196,196 192,192,192 220,220,220 185,185,185 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 249,249,249 242,242,242 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 246,246,246 244,244,244 0,0,0 10,10,10 255,255,255 250,250,250 255,255,255 249,249,249 0,0,0 0,0,0 255,255,255 255,255,255 185,185,185 214,214,214 0,0,0 0,0,0 182,182,182 172,172,172 209,209,209 197,197,197 0,0,0 14,14,14 188,188,188 187,187,187 167,167,167 201,201,201 220,220,220 191,191,191 13,13,13 0,0,0 193,193,193 195,195,195 2,2,2 0,0,0 255,255,255 251,251,251 252,252,252 232,232,232 0,0,0 0,0,0 250,250,250 243,243,243 255,255,255 246,246,246 244,244,244 197,197,197 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 251,251,251 255,255,255 255,255,255 236,236,236 14,14,14 0,0,0 250,250,250 249,249,249 249,249,249 255,255,255 0,0,0 5,5,5 248,248,248 252,252,252 244,244,244 255,255,255 0,0,0 13,13,13 249,249,249 247,247,247 196,196,196 242,242,242 9,9,9 0,0,0 15,15,15 6,6,6 0,0,0 7,7,7 8,8,8 240,240,240 255,255,255 255,255,255 204,204,204 254,254,254 249,249,249 1,1,1 0,0,0 255,255,255 254,254,254 255,255,255 0,0,0 8,8,8 245,245,245 255,255,255 248,248,248 176,176,176 7,7,7 0,0,0 255,255,255 234,234,234 255,255,255 255,255,255 239,239,239 195,195,195 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +190,190,190 196,196,196 179,179,179 201,201,201 195,195,195 0,0,0 7,7,7 255,255,255 185,185,185 191,191,191 189,189,189 0,0,0 0,0,0 254,254,254 255,255,255 243,243,243 255,255,255 0,0,0 0,0,0 255,255,255 253,253,253 196,196,196 254,254,254 0,0,0 8,8,8 0,0,0 0,0,0 4,4,4 255,255,255 251,251,251 253,253,253 255,255,255 254,254,254 190,190,190 255,255,255 2,2,2 0,0,0 255,255,255 245,245,245 255,255,255 254,254,254 0,0,0 0,0,0 255,255,255 246,246,246 249,249,249 203,203,203 0,0,0 0,0,0 255,255,255 248,248,248 255,255,255 253,253,253 250,250,250 201,201,201 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 249,249,249 238,238,238 255,255,255 0,0,0 0,0,0 255,255,255 196,196,196 255,255,255 247,247,247 7,7,7 21,21,21 230,230,230 251,251,251 255,255,255 247,247,247 12,12,12 5,5,5 255,255,255 249,249,249 182,182,182 248,248,248 17,17,17 0,0,0 250,250,250 255,255,255 5,5,5 0,0,0 255,255,255 255,255,255 255,255,255 255,255,255 172,172,172 0,0,0 6,6,6 240,240,240 255,255,255 248,248,248 245,245,245 255,255,255 11,11,11 0,0,0 252,252,252 10,10,10 0,0,0 195,195,195 0,0,0 2,2,2 255,255,255 255,255,255 243,243,243 252,252,252 255,255,255 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 236,236,236 255,255,255 251,251,251 252,252,252 0,0,0 0,0,0 252,252,252 184,184,184 248,248,248 255,255,255 0,0,0 2,2,2 255,255,255 255,255,255 231,231,231 246,246,246 0,0,0 0,0,0 255,255,255 255,255,255 197,197,197 240,240,240 0,0,0 7,7,7 247,247,247 255,255,255 255,255,255 0,0,0 5,5,5 250,250,250 246,246,246 239,239,239 29,29,29 0,0,0 255,255,255 255,255,255 243,243,243 244,244,244 255,255,255 248,248,248 0,0,0 6,6,6 255,255,255 255,255,255 10,10,10 6,6,6 0,0,0 0,0,0 255,255,255 250,250,250 255,255,255 255,255,255 245,245,245 201,201,201 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 253,253,253 251,251,251 244,244,244 251,251,251 255,255,255 0,0,0 8,8,8 202,202,202 187,187,187 0,0,0 10,10,10 183,183,183 236,236,236 234,234,234 255,255,255 255,255,255 2,2,2 3,3,3 242,242,242 241,241,241 202,202,202 253,253,253 5,5,5 0,0,0 255,255,255 244,244,244 234,234,234 255,255,255 14,14,14 0,0,0 255,255,255 4,4,4 0,0,0 255,255,255 250,250,250 255,255,255 253,253,253 255,255,255 239,239,239 255,255,255 186,186,186 5,5,5 0,0,0 254,254,254 252,252,252 3,3,3 12,12,12 255,255,255 255,255,255 241,241,241 255,255,255 244,244,244 255,255,255 201,201,201 245,245,245 255,255,255 255,255,255 255,255,255 255,255,255 +242,242,242 194,194,194 209,209,209 195,195,195 188,188,188 179,179,179 213,213,213 0,0,0 15,15,15 0,0,0 0,0,0 236,236,236 204,204,204 197,197,197 196,196,196 0,0,0 0,0,0 0,0,0 4,4,4 6,6,6 9,9,9 163,163,163 255,255,255 1,1,1 16,16,16 249,249,249 255,255,255 255,255,255 238,238,238 0,0,0 0,0,0 255,255,255 13,13,13 0,0,0 243,243,243 255,255,255 234,234,234 255,255,255 255,255,255 252,252,252 248,248,248 190,190,190 255,255,255 0,0,0 5,5,5 15,15,15 0,0,0 246,246,246 0,0,0 248,248,248 255,255,255 255,255,255 255,255,255 239,239,239 191,191,191 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 194,194,194 232,232,232 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 248,248,248 209,209,209 255,255,255 194,194,194 255,255,255 255,255,255 255,255,255 255,255,255 206,206,206 223,223,223 255,255,255 252,252,252 211,211,211 250,250,250 255,255,255 253,253,253 241,241,241 243,243,243 255,255,255 255,255,255 249,249,249 255,255,255 227,227,227 230,230,230 196,196,196 255,255,255 254,254,254 255,255,255 254,254,254 249,249,249 250,250,250 255,255,255 164,164,164 192,192,192 213,213,213 183,183,183 183,183,183 188,188,188 253,253,253 255,255,255 252,252,252 255,255,255 255,255,255 245,245,245 255,255,255 191,191,191 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 191,191,191 255,255,255 237,237,237 251,251,251 239,239,239 241,241,241 255,255,255 254,254,254 255,255,255 186,186,186 253,253,253 181,181,181 239,239,239 255,255,255 234,234,234 235,235,235 209,209,209 255,255,255 250,250,250 235,235,235 205,205,205 183,183,183 187,187,187 194,194,194 182,182,182 189,189,189 196,196,196 209,209,209 173,173,173 210,210,210 199,199,199 203,203,203 202,202,202 245,245,245 241,241,241 252,252,252 255,255,255 241,241,241 255,255,255 251,251,251 197,197,197 255,255,255 244,244,244 255,255,255 250,250,250 208,208,208 250,250,250 252,252,252 255,255,255 250,250,250 255,255,255 250,250,250 243,243,243 203,203,203 245,245,245 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 162,162,162 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 242,242,242 255,255,255 248,248,248 202,202,202 243,243,243 209,209,209 242,242,242 239,239,239 255,255,255 255,255,255 173,173,173 251,251,251 255,255,255 244,244,244 252,252,252 251,251,251 253,253,253 239,239,239 219,219,219 231,231,231 255,255,255 247,247,247 250,250,250 243,243,243 255,255,255 252,252,252 247,247,247 249,249,249 253,253,253 255,255,255 255,255,255 243,243,243 255,255,255 249,249,249 196,196,196 252,252,252 249,249,249 250,250,250 255,255,255 170,170,170 255,255,255 254,254,254 253,253,253 255,255,255 252,252,252 250,250,250 255,255,255 191,191,191 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input06.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input06.jpg new file mode 100644 index 0000000..78386b8 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input06.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input06.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input06.txt new file mode 100644 index 0000000..a987934 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input06.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 252,252,252 247,247,247 255,255,255 254,254,254 255,255,255 198,198,198 249,249,249 250,250,250 255,255,255 242,242,242 195,195,195 187,187,187 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 243,243,243 255,255,255 255,255,255 254,254,254 246,246,246 255,255,255 239,239,239 255,255,255 246,246,246 241,241,241 255,255,255 194,194,194 229,229,229 208,208,208 255,255,255 185,185,185 253,253,253 254,254,254 253,253,253 245,245,245 255,255,255 255,255,255 253,253,253 248,248,248 252,252,252 255,255,255 247,247,247 195,195,195 249,249,249 255,255,255 201,201,201 246,246,246 242,242,242 255,255,255 255,255,255 247,247,247 185,185,185 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +246,246,246 255,255,255 255,255,255 238,238,238 251,251,251 250,250,250 167,167,167 255,255,255 246,246,246 255,255,255 255,255,255 201,201,201 183,183,183 241,241,241 255,255,255 239,239,239 245,245,245 255,255,255 255,255,255 241,241,241 236,236,236 247,247,247 255,255,255 234,234,234 254,254,254 252,252,252 253,253,253 252,252,252 240,240,240 179,179,179 236,236,236 177,177,177 227,227,227 190,190,190 252,252,252 246,246,246 254,254,254 255,255,255 255,255,255 238,238,238 255,255,255 255,255,255 250,250,250 255,255,255 237,237,237 211,211,211 255,255,255 235,235,235 196,196,196 255,255,255 255,255,255 254,254,254 249,249,249 250,250,250 193,193,193 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 240,240,240 246,246,246 255,255,255 255,255,255 255,255,255 172,172,172 219,219,219 190,190,190 181,181,181 179,179,179 177,177,177 184,184,184 255,255,255 255,255,255 251,251,251 251,251,251 255,255,255 234,234,234 254,254,254 255,255,255 255,255,255 236,236,236 255,255,255 254,254,254 251,251,251 255,255,255 255,255,255 243,243,243 191,191,191 248,248,248 252,252,252 255,255,255 204,204,204 251,251,251 251,251,251 255,255,255 244,244,244 241,241,241 255,255,255 255,255,255 253,253,253 238,238,238 250,250,250 255,255,255 166,166,166 255,255,255 255,255,255 171,171,171 240,240,240 255,255,255 255,255,255 255,255,255 255,255,255 194,194,194 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 249,249,249 255,255,255 255,255,255 237,237,237 236,236,236 206,206,206 0,0,0 0,0,0 14,14,14 4,4,4 255,255,255 206,206,206 242,242,242 0,0,0 2,2,2 250,250,250 255,255,255 255,255,255 255,255,255 0,0,0 0,0,0 248,248,248 0,0,0 1,1,1 0,0,0 0,0,0 15,15,15 12,12,12 0,0,0 0,0,0 254,254,254 221,221,221 181,181,181 222,222,222 0,0,0 0,0,0 202,202,202 175,175,175 192,192,192 181,181,181 0,0,0 15,15,15 1,1,1 2,2,2 16,16,16 1,1,1 246,246,246 227,227,227 255,255,255 248,248,248 245,245,245 236,236,236 250,250,250 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +237,237,237 255,255,255 244,244,244 255,255,255 255,255,255 255,255,255 0,0,0 0,0,0 255,255,255 230,230,230 0,0,0 4,4,4 184,184,184 255,255,255 0,0,0 14,14,14 249,249,249 252,252,252 231,231,231 255,255,255 0,0,0 0,0,0 255,255,255 253,253,253 252,252,252 249,249,249 15,15,15 0,0,0 253,253,253 178,178,178 255,255,255 251,251,251 255,255,255 253,253,253 0,0,0 0,0,0 5,5,5 0,0,0 250,250,250 255,255,255 255,255,255 0,0,0 8,8,8 230,230,230 251,251,251 255,255,255 0,0,0 4,4,4 155,155,155 250,250,250 245,245,245 255,255,255 253,253,253 255,255,255 187,187,187 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 255,255,255 255,255,255 253,253,253 0,0,0 10,10,10 255,255,255 255,255,255 246,246,246 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 0,0,0 19,19,19 254,254,254 248,248,248 0,0,0 0,0,0 242,242,242 255,255,255 237,237,237 255,255,255 230,230,230 1,1,1 14,14,14 249,249,249 239,239,239 244,244,244 254,254,254 244,244,244 0,0,0 5,5,5 251,251,251 255,255,255 6,6,6 0,0,0 250,250,250 247,247,247 13,13,13 0,0,0 255,255,255 255,255,255 244,244,244 195,195,195 14,14,14 19,19,19 203,203,203 195,195,195 196,196,196 192,192,192 220,220,220 185,185,185 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 249,249,249 242,242,242 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 246,246,246 241,241,241 13,13,13 0,0,0 248,248,248 255,255,255 253,253,253 0,0,0 0,0,0 10,10,10 3,3,3 250,250,250 197,197,197 190,190,190 201,201,201 174,174,174 203,203,203 3,3,3 0,0,0 181,181,181 166,166,166 191,191,191 194,194,194 1,1,1 0,0,0 191,191,191 202,202,202 194,194,194 188,188,188 5,5,5 0,0,0 203,203,203 0,0,0 21,21,21 251,251,251 255,255,255 237,237,237 211,211,211 0,0,0 0,0,0 250,250,250 243,243,243 255,255,255 246,246,246 244,244,244 197,197,197 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 251,251,251 255,255,255 255,255,255 236,236,236 14,14,14 0,0,0 250,250,250 249,249,249 255,255,255 255,255,255 0,0,0 9,9,9 254,254,254 247,247,247 254,254,254 254,254,254 6,6,6 0,0,0 250,250,250 255,255,255 199,199,199 255,255,255 245,245,245 255,255,255 255,255,255 0,0,0 5,5,5 255,255,255 253,253,253 255,255,255 246,246,246 6,6,6 0,0,0 255,255,255 255,255,255 247,247,247 253,253,253 1,1,1 0,0,0 243,243,243 19,19,19 0,0,0 250,250,250 255,255,255 255,255,255 180,180,180 8,8,8 0,0,0 255,255,255 234,234,234 255,255,255 255,255,255 239,239,239 195,195,195 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +190,190,190 196,196,196 179,179,179 201,201,201 195,195,195 0,0,0 7,7,7 255,255,255 181,181,181 194,194,194 190,190,190 0,0,0 0,0,0 255,255,255 240,240,240 253,253,253 250,250,250 9,9,9 0,0,0 238,238,238 255,255,255 209,209,209 241,241,241 252,252,252 247,247,247 255,255,255 0,0,0 0,0,0 255,255,255 246,246,246 236,236,236 255,255,255 4,4,4 0,0,0 255,255,255 254,254,254 249,249,249 255,255,255 0,0,0 0,0,0 249,249,249 8,8,8 7,7,7 242,242,242 255,255,255 255,255,255 194,194,194 0,0,0 0,0,0 255,255,255 244,244,244 255,255,255 255,255,255 244,244,244 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 249,249,249 238,238,238 255,255,255 0,0,0 0,0,0 255,255,255 201,201,201 255,255,255 248,248,248 1,1,1 12,12,12 239,239,239 255,255,255 252,252,252 255,255,255 0,0,0 0,0,0 255,255,255 254,254,254 174,174,174 238,238,238 255,255,255 255,255,255 239,239,239 0,0,0 4,4,4 250,250,250 254,254,254 255,255,255 251,251,251 0,0,0 1,1,1 0,0,0 5,5,5 0,0,0 0,0,0 8,8,8 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 251,251,251 242,242,242 209,209,209 0,0,0 13,13,13 255,255,255 252,252,252 244,244,244 241,241,241 255,255,255 201,201,201 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 236,236,236 255,255,255 251,251,251 252,252,252 0,0,0 0,0,0 252,252,252 188,188,188 255,255,255 240,240,240 1,1,1 0,0,0 251,251,251 240,240,240 244,244,244 244,244,244 0,0,0 9,9,9 255,255,255 249,249,249 197,197,197 255,255,255 249,249,249 255,255,255 255,255,255 1,1,1 0,0,0 255,255,255 246,246,246 249,249,249 248,248,248 0,0,0 0,0,0 251,251,251 255,255,255 255,255,255 253,253,253 8,8,8 0,0,0 253,253,253 0,0,0 9,9,9 244,244,244 241,241,241 255,255,255 175,175,175 7,7,7 0,0,0 217,217,217 255,255,255 255,255,255 248,248,248 255,255,255 190,190,190 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 253,253,253 251,251,251 244,244,244 251,251,251 255,255,255 0,0,0 8,8,8 196,196,196 183,183,183 7,7,7 12,12,12 191,191,191 241,241,241 255,255,255 254,254,254 255,255,255 0,0,0 0,0,0 244,244,244 255,255,255 184,184,184 248,248,248 243,243,243 236,236,236 243,243,243 0,0,0 8,8,8 241,241,241 252,252,252 255,255,255 255,255,255 12,12,12 2,2,2 254,254,254 251,251,251 244,244,244 250,250,250 5,5,5 4,4,4 255,255,255 0,0,0 1,1,1 255,255,255 255,255,255 255,255,255 0,0,0 7,7,7 250,250,250 255,255,255 253,253,253 250,250,250 247,247,247 255,255,255 189,189,189 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +242,242,242 194,194,194 209,209,209 195,195,195 188,188,188 179,179,179 213,213,213 0,0,0 2,2,2 5,5,5 0,0,0 243,243,243 196,196,196 196,196,196 206,206,206 170,170,170 184,184,184 11,11,11 11,11,11 180,180,180 213,213,213 182,182,182 245,245,245 255,255,255 255,255,255 255,255,255 6,6,6 0,0,0 244,244,244 255,255,255 247,247,247 255,255,255 0,0,0 0,0,0 244,244,244 255,255,255 249,249,249 241,241,241 1,1,1 0,0,0 246,246,246 5,5,5 5,5,5 0,0,0 13,13,13 0,0,0 3,3,3 253,253,253 244,244,244 249,249,249 247,247,247 255,255,255 249,249,249 250,250,250 181,181,181 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 194,194,194 232,232,232 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 242,242,242 218,218,218 249,249,249 192,192,192 250,250,250 239,239,239 255,255,255 255,255,255 215,215,215 238,238,238 254,254,254 237,237,237 227,227,227 249,249,249 237,237,237 240,240,240 255,255,255 236,236,236 255,255,255 255,255,255 236,236,236 255,255,255 240,240,240 232,232,232 215,215,215 251,251,251 245,245,245 246,246,246 255,255,255 252,252,252 255,255,255 255,255,255 188,188,188 198,198,198 184,184,184 162,162,162 203,203,203 159,159,159 255,255,255 255,255,255 251,251,251 239,239,239 250,250,250 253,253,253 255,255,255 192,192,192 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 191,191,191 255,255,255 237,237,237 251,251,251 239,239,239 241,241,241 255,255,255 251,251,251 255,255,255 167,167,167 255,255,255 197,197,197 252,252,252 255,255,255 252,252,252 246,246,246 195,195,195 254,254,254 255,255,255 236,236,236 194,194,194 184,184,184 204,204,204 200,200,200 182,182,182 186,186,186 204,204,204 198,198,198 193,193,193 198,198,198 194,194,194 196,196,196 205,205,205 233,233,233 255,255,255 255,255,255 255,255,255 251,251,251 238,238,238 249,249,249 191,191,191 241,241,241 255,255,255 251,251,251 254,254,254 208,208,208 255,255,255 244,244,244 255,255,255 255,255,255 255,255,255 243,243,243 249,249,249 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 162,162,162 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 242,242,242 255,255,255 249,249,249 198,198,198 255,255,255 192,192,192 237,237,237 255,255,255 247,247,247 255,255,255 181,181,181 249,249,249 255,255,255 255,255,255 255,255,255 243,243,243 251,251,251 244,244,244 211,211,211 240,240,240 255,255,255 243,243,243 251,251,251 250,250,250 255,255,255 255,255,255 238,238,238 255,255,255 249,249,249 244,244,244 255,255,255 249,249,249 255,255,255 255,255,255 190,190,190 255,255,255 251,251,251 253,253,253 255,255,255 180,180,180 248,248,248 255,255,255 255,255,255 246,246,246 254,254,254 255,255,255 255,255,255 197,197,197 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input07.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input07.jpg new file mode 100644 index 0000000..88821a6 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input07.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input07.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input07.txt new file mode 100644 index 0000000..184663f --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input07.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +248,248,248 254,254,254 255,255,255 255,255,255 255,255,255 246,246,246 197,197,197 255,255,255 251,251,251 255,255,255 245,245,245 182,182,182 209,209,209 243,243,243 255,255,255 245,245,245 251,251,251 254,254,254 239,239,239 255,255,255 255,255,255 242,242,242 255,255,255 240,240,240 255,255,255 238,238,238 255,255,255 243,243,243 255,255,255 187,187,187 247,247,247 199,199,199 255,255,255 188,188,188 242,242,242 253,253,253 253,253,253 255,255,255 246,246,246 254,254,254 255,255,255 244,244,244 255,255,255 255,255,255 252,252,252 195,195,195 255,255,255 255,255,255 197,197,197 255,255,255 255,255,255 253,253,253 255,255,255 250,250,250 186,186,186 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 250,250,250 251,251,251 252,252,252 245,245,245 255,255,255 168,168,168 225,225,225 246,246,246 248,248,248 243,243,243 213,213,213 182,182,182 246,246,246 247,247,247 255,255,255 255,255,255 252,252,252 255,255,255 252,252,252 233,233,233 255,255,255 242,242,242 255,255,255 252,252,252 255,255,255 249,249,249 253,253,253 245,245,245 188,188,188 216,216,216 189,189,189 243,243,243 192,192,192 252,252,252 249,249,249 245,245,245 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 247,247,247 250,250,250 194,194,194 251,251,251 244,244,244 195,195,195 251,251,251 244,244,244 247,247,247 255,255,255 248,248,248 187,187,187 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 247,247,247 250,250,250 255,255,255 255,255,255 253,253,253 180,180,180 231,231,231 181,181,181 207,207,207 201,201,201 173,173,173 204,204,204 255,255,255 251,251,251 246,246,246 243,243,243 254,254,254 243,243,243 255,255,255 224,224,224 255,255,255 255,255,255 245,245,245 253,253,253 236,236,236 255,255,255 255,255,255 246,246,246 176,176,176 248,248,248 246,246,246 252,252,252 204,204,204 246,246,246 255,255,255 255,255,255 241,241,241 241,241,241 246,246,246 245,245,245 255,255,255 243,243,243 255,255,255 254,254,254 193,193,193 255,255,255 255,255,255 174,174,174 255,255,255 255,255,255 255,255,255 254,254,254 251,251,251 195,195,195 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 232,232,232 255,255,255 255,255,255 0,0,0 9,9,9 3,3,3 0,0,0 0,0,0 15,15,15 0,0,0 195,195,195 248,248,248 8,8,8 6,6,6 6,6,6 0,0,0 2,2,2 0,0,0 14,14,14 238,238,238 250,250,250 0,0,0 8,8,8 244,244,244 255,255,255 241,241,241 251,251,251 13,13,13 3,3,3 251,251,251 238,238,238 178,178,178 8,8,8 0,0,0 0,0,0 2,2,2 190,190,190 197,197,197 184,184,184 0,0,0 1,1,1 189,189,189 194,194,194 201,201,201 239,239,239 0,0,0 9,9,9 219,219,219 255,255,255 254,254,254 250,250,250 255,255,255 198,198,198 237,237,237 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 253,253,253 255,255,255 253,253,253 230,230,230 255,255,255 182,182,182 253,253,253 250,250,250 252,252,252 0,0,0 21,21,21 190,190,190 253,253,253 0,0,0 1,1,1 247,247,247 255,255,255 245,245,245 240,240,240 5,5,5 18,18,18 247,247,247 0,0,0 1,1,1 2,2,2 249,249,249 243,243,243 5,5,5 3,3,3 0,0,0 255,255,255 255,255,255 0,0,0 19,19,19 245,245,245 247,247,247 7,7,7 7,7,7 244,244,244 241,241,241 11,11,11 4,4,4 243,243,243 255,255,255 251,251,251 251,251,251 4,4,4 8,8,8 250,250,250 255,255,255 250,250,250 240,240,240 254,254,254 206,206,206 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 +252,252,252 245,245,245 254,254,254 255,255,255 255,255,255 255,255,255 190,190,190 253,253,253 255,255,255 239,239,239 9,9,9 0,0,0 193,193,193 255,255,255 5,5,5 0,0,0 255,255,255 235,235,235 255,255,255 255,255,255 0,0,0 0,0,0 246,246,246 22,22,22 0,0,0 0,0,0 7,7,7 8,8,8 0,0,0 0,0,0 12,12,12 246,246,246 1,1,1 0,0,0 247,247,247 253,253,253 245,245,245 211,211,211 0,0,0 9,9,9 255,255,255 0,0,0 0,0,0 255,255,255 243,243,243 234,234,234 227,227,227 0,0,0 0,0,0 209,209,209 183,183,183 185,185,185 195,195,195 213,213,213 187,187,187 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 255,255,255 255,255,255 249,249,249 234,234,234 255,255,255 193,193,193 255,255,255 246,246,246 13,13,13 0,0,0 255,255,255 197,197,197 245,245,245 9,9,9 0,0,0 255,255,255 255,255,255 243,243,243 255,255,255 21,21,21 0,0,0 189,189,189 0,0,0 6,6,6 177,177,177 11,11,11 0,0,0 194,194,194 11,11,11 0,0,0 204,204,204 3,3,3 8,8,8 197,197,197 209,209,209 205,205,205 162,162,162 4,4,4 6,6,6 190,190,190 0,0,0 0,0,0 253,253,253 255,255,255 255,255,255 182,182,182 7,7,7 14,14,14 255,255,255 234,234,234 255,255,255 255,255,255 246,246,246 188,188,188 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 255,255,255 253,253,253 254,254,254 255,255,255 239,239,239 204,204,204 248,248,248 0,0,0 4,4,4 255,255,255 248,248,248 184,184,184 255,255,255 0,0,0 2,2,2 0,0,0 8,8,8 0,0,0 5,5,5 0,0,0 196,196,196 255,255,255 3,3,3 0,0,0 255,255,255 0,0,0 6,6,6 255,255,255 0,0,0 0,0,0 247,247,247 0,0,0 0,0,0 255,255,255 243,243,243 255,255,255 255,255,255 1,1,1 0,0,0 250,250,250 11,11,11 3,3,3 245,245,245 249,249,249 250,250,250 185,185,185 0,0,0 0,0,0 255,255,255 242,242,242 252,252,252 252,252,252 248,248,248 198,198,198 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 +182,182,182 214,214,214 177,177,177 189,189,189 211,211,211 180,180,180 210,210,210 0,0,0 0,0,0 199,199,199 184,184,184 187,187,187 208,208,208 250,250,250 0,0,0 8,8,8 5,5,5 0,0,0 0,0,0 244,244,244 250,250,250 208,208,208 240,240,240 14,14,14 0,0,0 255,255,255 0,0,0 2,2,2 255,255,255 0,0,0 0,0,0 255,255,255 2,2,2 0,0,0 255,255,255 255,255,255 244,244,244 255,255,255 4,4,4 0,0,0 245,245,245 0,0,0 4,4,4 243,243,243 255,255,255 246,246,246 197,197,197 0,0,0 0,0,0 255,255,255 244,244,244 255,255,255 255,255,255 244,244,244 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 242,242,242 255,255,255 250,250,250 252,252,252 252,252,252 0,0,0 10,10,10 183,183,183 255,255,255 247,247,247 245,245,245 168,168,168 251,251,251 7,7,7 0,0,0 236,236,236 255,255,255 0,0,0 21,21,21 247,247,247 170,170,170 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 238,238,238 253,253,253 0,0,0 0,0,0 251,251,251 0,0,0 23,23,23 240,240,240 0,0,0 5,5,5 250,250,250 0,0,0 7,7,7 255,255,255 8,8,8 5,5,5 255,255,255 255,255,255 237,237,237 197,197,197 3,3,3 13,13,13 255,255,255 252,252,252 244,244,244 241,241,241 255,255,255 201,201,201 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +237,237,237 255,255,255 240,240,240 236,236,236 255,255,255 12,12,12 12,12,12 250,250,250 197,197,197 249,249,249 255,255,255 252,252,252 205,205,205 255,255,255 0,0,0 9,9,9 247,247,247 249,249,249 244,244,244 0,0,0 0,0,0 189,189,189 251,251,251 3,3,3 9,9,9 240,240,240 255,255,255 249,249,249 255,255,255 13,13,13 0,0,0 255,255,255 6,6,6 0,0,0 254,254,254 255,255,255 4,4,4 0,0,0 10,10,10 0,0,0 228,228,228 6,6,6 3,3,3 237,237,237 249,249,249 255,255,255 172,172,172 11,11,11 0,0,0 217,217,217 255,255,255 255,255,255 248,248,248 255,255,255 190,190,190 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 223,223,223 255,255,255 255,255,255 235,235,235 0,0,0 0,0,0 246,246,246 186,186,186 200,200,200 173,173,173 213,213,213 177,177,177 240,240,240 0,0,0 0,0,0 254,254,254 255,255,255 255,255,255 252,252,252 0,0,0 8,8,8 255,255,255 2,2,2 2,2,2 243,243,243 243,243,243 252,252,252 254,254,254 0,0,0 0,0,0 244,244,244 255,255,255 0,0,0 3,3,3 255,255,255 249,249,249 0,0,0 25,25,25 249,249,249 255,255,255 194,194,194 0,0,0 8,8,8 255,255,255 241,241,241 14,14,14 0,0,0 250,250,250 255,255,255 253,253,253 250,250,250 247,247,247 255,255,255 189,189,189 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 178,178,178 202,202,202 188,188,188 197,197,197 17,17,17 4,4,4 4,4,4 0,0,0 0,0,0 0,0,0 1,1,1 210,210,210 179,179,179 24,24,24 0,0,0 199,199,199 172,172,172 186,186,186 198,198,198 0,0,0 1,1,1 248,248,248 0,0,0 0,0,0 255,255,255 255,255,255 243,243,243 243,243,243 0,0,0 7,7,7 255,255,255 241,241,241 192,192,192 1,1,1 12,12,12 0,0,0 0,0,0 239,239,239 1,1,1 245,245,245 183,183,183 255,255,255 0,0,0 0,0,0 15,15,15 0,0,0 247,247,247 244,244,244 249,249,249 247,247,247 255,255,255 249,249,249 250,250,250 181,181,181 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +250,250,250 209,209,209 228,228,228 247,247,247 239,239,239 250,250,250 245,245,245 255,255,255 250,250,250 252,252,252 202,202,202 254,254,254 201,201,201 245,245,245 237,237,237 253,253,253 247,247,247 224,224,224 255,255,255 243,243,243 248,248,248 214,214,214 244,244,244 255,255,255 249,249,249 254,254,254 244,244,244 255,255,255 255,255,255 244,244,244 247,247,247 245,245,245 247,247,247 200,200,200 249,249,249 234,234,234 255,255,255 246,246,246 255,255,255 255,255,255 248,248,248 179,179,179 223,223,223 174,174,174 183,183,183 189,189,189 182,182,182 253,253,253 255,255,255 251,251,251 239,239,239 250,250,250 253,253,253 255,255,255 192,192,192 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 +250,250,250 182,182,182 255,255,255 242,242,242 255,255,255 233,233,233 255,255,255 255,255,255 255,255,255 253,253,253 183,183,183 252,252,252 195,195,195 255,255,255 255,255,255 255,255,255 252,252,252 190,190,190 228,228,228 255,255,255 254,254,254 192,192,192 169,169,169 197,197,197 203,203,203 168,168,168 196,196,196 199,199,199 181,181,181 202,202,202 203,203,203 194,194,194 174,174,174 209,209,209 255,255,255 244,244,244 255,255,255 249,249,249 255,255,255 237,237,237 253,253,253 214,214,214 215,215,215 255,255,255 253,253,253 252,252,252 195,195,195 251,251,251 244,244,244 255,255,255 255,255,255 255,255,255 243,243,243 249,249,249 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 180,180,180 255,255,255 255,255,255 246,246,246 255,255,255 255,255,255 235,235,235 255,255,255 238,238,238 207,207,207 252,252,252 197,197,197 240,240,240 255,255,255 240,240,240 255,255,255 190,190,190 255,255,255 241,241,241 255,255,255 253,253,253 255,255,255 250,250,250 244,244,244 211,211,211 234,234,234 255,255,255 249,249,249 243,243,243 250,250,250 255,255,255 255,255,255 238,238,238 247,247,247 244,244,244 247,247,247 255,255,255 244,244,244 255,255,255 255,255,255 180,180,180 255,255,255 255,255,255 255,255,255 242,242,242 200,200,200 248,248,248 255,255,255 255,255,255 246,246,246 254,254,254 255,255,255 255,255,255 197,197,197 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input08.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input08.jpg new file mode 100644 index 0000000..7afb6df Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input08.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input08.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input08.txt new file mode 100644 index 0000000..7fce3f1 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input08.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +249,249,249 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 205,205,205 255,255,255 249,249,249 255,255,255 255,255,255 190,190,190 182,182,182 255,255,255 255,255,255 251,251,251 249,249,249 255,255,255 249,249,249 252,252,252 255,255,255 255,255,255 246,246,246 255,255,255 247,247,247 253,253,253 255,255,255 255,255,255 251,251,251 194,194,194 240,240,240 202,202,202 255,255,255 188,188,188 242,242,242 253,253,253 253,253,253 255,255,255 246,246,246 254,254,254 255,255,255 236,236,236 252,252,252 255,255,255 247,247,247 174,174,174 255,255,255 237,237,237 187,187,187 255,255,255 255,255,255 250,250,250 255,255,255 254,254,254 185,185,185 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 244,244,244 244,244,244 249,249,249 255,255,255 188,188,188 231,231,231 249,249,249 255,255,255 238,238,238 192,192,192 187,187,187 245,245,245 255,255,255 248,248,248 255,255,255 255,255,255 245,245,245 255,255,255 244,244,244 251,251,251 255,255,255 241,241,241 255,255,255 244,244,244 238,238,238 247,247,247 255,255,255 169,169,169 221,221,221 192,192,192 243,243,243 192,192,192 252,252,252 249,249,249 245,245,245 255,255,255 255,255,255 255,255,255 247,247,247 250,250,250 255,255,255 238,238,238 255,255,255 195,195,195 251,251,251 244,244,244 209,209,209 248,248,248 245,245,245 250,250,250 251,251,251 250,250,250 193,193,193 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +243,243,243 241,241,241 255,255,255 255,255,255 255,255,255 239,239,239 188,188,188 228,228,228 197,197,197 187,187,187 200,200,200 198,198,198 191,191,191 255,255,255 254,254,254 255,255,255 232,232,232 249,249,249 255,255,255 251,251,251 237,237,237 254,254,254 237,237,237 255,255,255 237,237,237 254,254,254 255,255,255 255,255,255 247,247,247 206,206,206 251,251,251 245,245,245 252,252,252 204,204,204 246,246,246 255,255,255 255,255,255 241,241,241 241,241,241 246,246,246 253,253,253 255,255,255 253,253,253 251,251,251 242,242,242 189,189,189 255,255,255 255,255,255 165,165,165 255,255,255 255,255,255 246,246,246 255,255,255 255,255,255 175,175,175 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 242,242,242 255,255,255 244,244,244 8,8,8 0,0,0 232,232,232 255,255,255 246,246,246 255,255,255 0,0,0 0,0,0 253,253,253 246,246,246 241,241,241 20,20,20 0,0,0 0,0,0 13,13,13 249,249,249 255,255,255 255,255,255 0,0,0 7,7,7 0,0,0 0,0,0 0,0,0 0,0,0 194,194,194 245,245,245 247,247,247 238,238,238 178,178,178 8,8,8 0,0,0 0,0,0 2,2,2 190,190,190 197,197,197 170,170,170 192,192,192 0,0,0 19,19,19 3,3,3 9,9,9 0,0,0 0,0,0 213,213,213 248,248,248 247,247,247 255,255,255 254,254,254 244,244,244 186,186,186 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 243,243,243 243,243,243 255,255,255 251,251,251 0,0,0 0,0,0 13,13,13 229,229,229 255,255,255 242,242,242 4,4,4 0,0,0 255,255,255 255,255,255 8,8,8 0,0,0 253,253,253 249,249,249 0,0,0 0,0,0 245,245,245 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 238,238,238 0,0,0 12,12,12 249,249,249 255,255,255 255,255,255 0,0,0 19,19,19 245,245,245 247,247,247 7,7,7 7,7,7 244,244,244 255,255,255 0,0,0 16,16,16 223,223,223 251,251,251 255,255,255 255,255,255 0,0,0 0,0,0 218,218,218 255,255,255 238,238,238 249,249,249 255,255,255 191,191,191 243,243,243 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 254,254,254 255,255,255 254,254,254 255,255,255 2,2,2 6,6,6 0,0,0 10,10,10 255,255,255 247,247,247 0,0,0 19,19,19 253,253,253 0,0,0 5,5,5 255,255,255 242,242,242 254,254,254 255,255,255 7,7,7 0,0,0 224,224,224 27,27,27 6,6,6 241,241,241 246,246,246 255,255,255 238,238,238 0,0,0 0,0,0 246,246,246 1,1,1 0,0,0 247,247,247 253,253,253 245,245,245 211,211,211 0,0,0 9,9,9 254,254,254 0,0,0 0,0,0 255,255,255 250,250,250 242,242,242 171,171,171 194,194,194 206,206,206 212,212,212 193,193,193 192,192,192 186,186,186 211,211,211 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 253,253,253 255,255,255 253,253,253 227,227,227 5,5,5 0,0,0 0,0,0 0,0,0 240,240,240 255,255,255 0,0,0 0,0,0 255,255,255 1,1,1 2,2,2 252,252,252 255,255,255 255,255,255 241,241,241 4,4,4 10,10,10 202,202,202 0,0,0 0,0,0 186,186,186 188,188,188 188,188,188 192,192,192 0,0,0 5,5,5 193,193,193 3,3,3 8,8,8 197,197,197 209,209,209 205,205,205 162,162,162 4,4,4 6,6,6 187,187,187 0,0,0 0,0,0 248,248,248 255,255,255 255,255,255 209,209,209 255,255,255 238,238,238 255,255,255 240,240,240 252,252,252 255,255,255 247,247,247 178,178,178 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 252,252,252 247,247,247 254,254,254 255,255,255 0,0,0 1,1,1 255,255,255 7,7,7 0,0,0 253,253,253 5,5,5 0,0,0 253,253,253 248,248,248 0,0,0 3,3,3 254,254,254 252,252,252 4,4,4 0,0,0 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 248,248,248 249,249,249 255,255,255 6,6,6 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 243,243,243 255,255,255 255,255,255 1,1,1 0,0,0 252,252,252 208,208,208 5,5,5 0,0,0 0,0,0 0,0,0 0,0,0 0,0,0 255,255,255 255,255,255 252,252,252 255,255,255 243,243,243 248,248,248 203,203,203 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 +199,199,199 186,186,186 181,181,181 198,198,198 194,194,194 0,0,0 7,7,7 251,251,251 7,7,7 0,0,0 183,183,183 13,13,13 0,0,0 245,245,245 255,255,255 238,238,238 0,0,0 0,0,0 0,0,0 255,255,255 0,0,0 1,1,1 251,251,251 0,0,0 0,0,0 255,255,255 245,245,245 255,255,255 255,255,255 0,0,0 1,1,1 255,255,255 2,2,2 0,0,0 255,255,255 255,255,255 244,244,244 255,255,255 4,4,4 0,0,0 253,253,253 203,203,203 244,244,244 254,254,254 250,250,250 255,255,255 185,185,185 0,0,0 8,8,8 251,251,251 255,255,255 255,255,255 241,241,241 255,255,255 198,198,198 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 254,254,254 253,253,253 255,255,255 251,251,251 0,0,0 0,0,0 255,255,255 187,187,187 6,6,6 1,1,1 0,0,0 0,0,0 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 231,231,231 12,12,12 0,0,0 241,241,241 8,8,8 7,7,7 255,255,255 248,248,248 247,247,247 255,255,255 0,0,0 0,0,0 255,255,255 0,0,0 23,23,23 240,240,240 0,0,0 5,5,5 250,250,250 0,0,0 7,7,7 255,255,255 175,175,175 255,255,255 255,255,255 255,255,255 252,252,252 177,177,177 15,15,15 0,0,0 254,254,254 248,248,248 255,255,255 255,255,255 246,246,246 190,190,190 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +239,239,239 255,255,255 254,254,254 224,224,224 255,255,255 20,20,20 0,0,0 241,241,241 184,184,184 255,255,255 0,0,0 6,6,6 10,10,10 250,250,250 250,250,250 0,0,0 251,251,251 251,251,251 239,239,239 255,255,255 0,0,0 16,16,16 234,234,234 7,7,7 0,0,0 255,255,255 243,243,243 255,255,255 247,247,247 6,6,6 3,3,3 255,255,255 6,6,6 0,0,0 254,254,254 255,255,255 4,4,4 0,0,0 10,10,10 0,0,0 254,254,254 193,193,193 249,249,249 255,255,255 242,242,242 255,255,255 196,196,196 0,0,0 2,2,2 255,255,255 251,251,251 242,242,242 254,254,254 255,255,255 205,205,205 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 239,239,239 255,255,255 244,244,244 252,252,252 0,0,0 0,0,0 255,255,255 199,199,199 193,193,193 13,13,13 0,0,0 0,0,0 244,244,244 246,246,246 6,6,6 0,0,0 255,255,255 253,253,253 0,0,0 0,0,0 198,198,198 255,255,255 0,0,0 11,11,11 232,232,232 255,255,255 255,255,255 0,0,0 3,3,3 239,239,239 246,246,246 255,255,255 0,0,0 3,3,3 255,255,255 249,249,249 0,0,0 25,25,25 249,249,249 237,237,237 15,15,15 0,0,0 248,248,248 255,255,255 252,252,252 194,194,194 0,0,0 0,0,0 239,239,239 255,255,255 255,255,255 248,248,248 247,247,247 200,200,200 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 178,178,178 213,213,213 189,189,189 183,183,183 0,0,0 7,7,7 173,173,173 193,193,193 201,201,201 159,159,159 24,24,24 7,7,7 191,191,191 175,175,175 190,190,190 10,10,10 17,17,17 0,0,0 1,1,1 195,195,195 193,193,193 245,245,245 7,7,7 0,0,0 8,8,8 9,9,9 0,0,0 2,2,2 255,255,255 255,255,255 249,249,249 241,241,241 192,192,192 1,1,1 12,12,12 0,0,0 0,0,0 239,239,239 1,1,1 255,255,255 177,177,177 0,0,0 2,2,2 0,0,0 4,4,4 2,2,2 10,10,10 255,255,255 255,255,255 242,242,242 253,253,253 255,255,255 255,255,255 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +252,252,252 186,186,186 248,248,248 230,230,230 255,255,255 248,248,248 255,255,255 255,255,255 255,255,255 243,243,243 205,205,205 247,247,247 188,188,188 249,249,249 255,255,255 245,245,245 243,243,243 191,191,191 239,239,239 255,255,255 241,241,241 202,202,202 252,252,252 255,255,255 255,255,255 255,255,255 238,238,238 244,244,244 250,250,250 248,248,248 235,235,235 255,255,255 247,247,247 200,200,200 249,249,249 234,234,234 255,255,255 246,246,246 255,255,255 255,255,255 253,253,253 173,173,173 202,202,202 192,192,192 176,176,176 194,194,194 187,187,187 240,240,240 252,252,252 237,237,237 253,253,253 255,255,255 248,248,248 251,251,251 186,186,186 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 179,179,179 255,255,255 255,255,255 255,255,255 237,237,237 253,253,253 254,254,254 240,240,240 255,255,255 194,194,194 250,250,250 197,197,197 255,255,255 250,250,250 255,255,255 255,255,255 206,206,206 250,250,250 255,255,255 239,239,239 189,189,189 205,205,205 178,178,178 194,194,194 168,168,168 204,204,204 215,215,215 204,204,204 184,184,184 206,206,206 193,193,193 174,174,174 209,209,209 255,255,255 244,244,244 255,255,255 249,249,249 255,255,255 237,237,237 255,255,255 172,172,172 255,255,255 253,253,253 255,255,255 255,255,255 190,190,190 255,255,255 255,255,255 255,255,255 255,255,255 251,251,251 244,244,244 255,255,255 202,202,202 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 177,177,177 255,255,255 255,255,255 242,242,242 255,255,255 255,255,255 240,240,240 254,254,254 255,255,255 186,186,186 255,255,255 191,191,191 241,241,241 255,255,255 245,245,245 255,255,255 170,170,170 255,255,255 255,255,255 255,255,255 255,255,255 232,232,232 255,255,255 253,253,253 206,206,206 235,235,235 255,255,255 247,247,247 252,252,252 255,255,255 255,255,255 255,255,255 238,238,238 247,247,247 244,244,244 247,247,247 255,255,255 244,244,244 255,255,255 242,242,242 199,199,199 255,255,255 255,255,255 243,243,243 255,255,255 184,184,184 249,249,249 246,246,246 255,255,255 245,245,245 255,255,255 255,255,255 249,249,249 193,193,193 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input09.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input09.jpg new file mode 100644 index 0000000..fe7b87b Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input09.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input09.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input09.txt new file mode 100644 index 0000000..b4626f3 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input09.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +248,248,248 254,254,254 255,255,255 255,255,255 255,255,255 246,246,246 197,197,197 255,255,255 255,255,255 254,254,254 254,254,254 180,180,180 196,196,196 254,254,254 255,255,255 254,254,254 255,255,255 243,243,243 249,249,249 255,255,255 242,242,242 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 251,251,251 255,255,255 255,255,255 196,196,196 236,236,236 200,200,200 251,251,251 204,204,204 239,239,239 255,255,255 251,251,251 251,251,251 255,255,255 254,254,254 255,255,255 248,248,248 254,254,254 254,254,254 243,243,243 186,186,186 255,255,255 250,250,250 184,184,184 255,255,255 252,252,252 247,247,247 255,255,255 247,247,247 185,185,185 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 250,250,250 251,251,251 252,252,252 245,245,245 255,255,255 168,168,168 225,225,225 237,237,237 255,255,255 251,251,251 186,186,186 205,205,205 242,242,242 244,244,244 251,251,251 254,254,254 255,255,255 255,255,255 240,240,240 241,241,241 246,246,246 249,249,249 255,255,255 255,255,255 255,255,255 247,247,247 243,243,243 236,236,236 174,174,174 219,219,219 188,188,188 254,254,254 169,169,169 250,250,250 255,255,255 253,253,253 240,240,240 248,248,248 255,255,255 255,255,255 248,248,248 241,241,241 255,255,255 255,255,255 192,192,192 253,253,253 254,254,254 195,195,195 248,248,248 244,244,244 255,255,255 255,255,255 240,240,240 186,186,186 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 247,247,247 250,250,250 255,255,255 255,255,255 253,253,253 180,180,180 231,231,231 188,188,188 193,193,193 198,198,198 201,201,201 187,187,187 245,245,245 255,255,255 250,250,250 236,236,236 255,255,255 221,221,221 255,255,255 255,255,255 248,248,248 255,255,255 244,244,244 246,246,246 248,248,248 255,255,255 255,255,255 243,243,243 208,208,208 252,252,252 245,245,245 250,250,250 207,207,207 255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 238,238,238 255,255,255 255,255,255 254,254,254 254,254,254 255,255,255 183,183,183 255,255,255 247,247,247 186,186,186 255,255,255 255,255,255 254,254,254 241,241,241 255,255,255 218,218,218 239,239,239 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 232,232,232 255,255,255 255,255,255 0,0,0 9,9,9 3,3,3 0,0,0 1,1,1 0,0,0 0,0,0 171,171,171 255,255,255 240,240,240 255,255,255 9,9,9 0,0,0 8,8,8 0,0,0 0,0,0 255,255,255 255,255,255 244,244,244 255,255,255 240,240,240 1,1,1 0,0,0 0,0,0 8,8,8 233,233,233 253,253,253 232,232,232 16,16,16 0,0,0 3,3,3 11,11,11 0,0,0 0,0,0 198,198,198 177,177,177 185,185,185 7,7,7 4,4,4 0,0,0 18,18,18 2,2,2 255,255,255 200,200,200 247,247,247 248,248,248 255,255,255 254,254,254 236,236,236 192,192,192 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 253,253,253 255,255,255 253,253,253 230,230,230 255,255,255 182,182,182 253,253,253 248,248,248 252,252,252 4,4,4 0,0,0 208,208,208 255,255,255 249,249,249 0,0,0 0,0,0 255,255,255 241,241,241 243,243,243 3,3,3 6,6,6 251,251,251 250,250,250 251,251,251 241,241,241 255,255,255 251,251,251 6,6,6 0,0,0 255,255,255 255,255,255 6,6,6 1,1,1 255,255,255 251,251,251 230,230,230 200,200,200 7,7,7 0,0,0 255,255,255 0,0,0 7,7,7 237,237,237 245,245,245 255,255,255 0,0,0 0,0,0 186,186,186 252,252,252 233,233,233 242,242,242 255,255,255 255,255,255 187,187,187 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +252,252,252 245,245,245 254,254,254 255,255,255 255,255,255 255,255,255 190,190,190 253,253,253 255,255,255 255,255,255 0,0,0 19,19,19 188,188,188 250,250,250 0,0,0 1,1,1 244,244,244 252,252,252 248,248,248 255,255,255 255,255,255 226,226,226 242,242,242 251,251,251 249,249,249 255,255,255 255,255,255 245,245,245 6,6,6 0,0,0 243,243,243 255,255,255 3,3,3 0,0,0 252,252,252 255,255,255 247,247,247 214,214,214 240,240,240 247,247,247 234,234,234 239,239,239 255,255,255 255,255,255 255,255,255 242,242,242 183,183,183 13,13,13 7,7,7 180,180,180 211,211,211 178,178,178 180,180,180 206,206,206 181,181,181 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 255,255,255 255,255,255 249,249,249 234,234,234 255,255,255 193,193,193 255,255,255 246,246,246 0,0,0 8,8,8 249,249,249 181,181,181 255,255,255 0,0,0 11,11,11 251,251,251 255,255,255 247,247,247 244,244,244 255,255,255 191,191,191 211,211,211 189,189,189 197,197,197 169,169,169 197,197,197 202,202,202 0,0,0 22,22,22 185,185,185 179,179,179 4,4,4 8,8,8 196,196,196 198,198,198 195,195,195 163,163,163 210,210,210 189,189,189 201,201,201 206,206,206 247,247,247 240,240,240 250,250,250 255,255,255 0,0,0 0,0,0 225,225,225 255,255,255 241,241,241 251,251,251 255,255,255 252,252,252 184,184,184 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 255,255,255 253,253,253 254,254,254 255,255,255 239,239,239 204,204,204 248,248,248 3,3,3 0,0,0 255,255,255 242,242,242 196,196,196 255,255,255 0,0,0 0,0,0 255,255,255 240,240,240 255,255,255 255,255,255 237,237,237 201,201,201 245,245,245 255,255,255 253,253,253 255,255,255 245,245,245 255,255,255 0,0,0 3,3,3 255,255,255 255,255,255 244,244,244 0,0,0 3,3,3 0,0,0 13,13,13 4,4,4 0,0,0 254,254,254 250,250,250 197,197,197 252,252,252 255,255,255 0,0,0 3,3,3 0,0,0 255,255,255 255,255,255 255,255,255 239,239,239 252,252,252 249,249,249 244,244,244 199,199,199 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +182,182,182 214,214,214 177,177,177 189,189,189 211,211,211 180,180,180 210,210,210 0,0,0 0,0,0 188,188,188 189,189,189 196,196,196 193,193,193 250,250,250 3,3,3 2,2,2 243,243,243 255,255,255 243,243,243 0,0,0 5,5,5 0,0,0 247,247,247 255,255,255 255,255,255 247,247,247 255,255,255 240,240,240 6,6,6 0,0,0 255,255,255 255,255,255 255,255,255 187,187,187 255,255,255 251,251,251 233,233,233 255,255,255 0,0,0 3,3,3 251,251,251 188,188,188 255,255,255 255,255,255 252,252,252 255,255,255 0,0,0 0,0,0 255,255,255 253,253,253 250,250,250 255,255,255 244,244,244 255,255,255 184,184,184 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 242,242,242 255,255,255 250,250,250 252,252,252 252,252,252 0,0,0 10,10,10 198,198,198 255,255,255 255,255,255 230,230,230 186,186,186 255,255,255 0,0,0 0,0,0 255,255,255 234,234,234 255,255,255 255,255,255 3,3,3 11,11,11 228,228,228 255,255,255 255,255,255 247,247,247 241,241,241 251,251,251 13,13,13 4,4,4 243,243,243 252,252,252 253,253,253 178,178,178 239,239,239 255,255,255 255,255,255 252,252,252 0,0,0 0,0,0 255,255,255 176,176,176 255,255,255 237,237,237 255,255,255 237,237,237 189,189,189 1,1,1 0,0,0 255,255,255 255,255,255 238,238,238 255,255,255 255,255,255 185,185,185 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +237,237,237 255,255,255 240,240,240 236,236,236 255,255,255 12,12,12 12,12,12 250,250,250 192,192,192 254,254,254 245,245,245 255,255,255 190,190,190 252,252,252 2,2,2 0,0,0 254,254,254 245,245,245 253,253,253 244,244,244 0,0,0 0,0,0 255,255,255 255,255,255 0,0,0 255,255,255 255,255,255 255,255,255 0,0,0 4,4,4 243,243,243 255,255,255 255,255,255 183,183,183 255,255,255 255,255,255 241,241,241 242,242,242 1,1,1 2,2,2 233,233,233 209,209,209 250,250,250 255,255,255 255,255,255 254,254,254 203,203,203 0,0,0 14,14,14 255,255,255 253,253,253 246,246,246 255,255,255 243,243,243 198,198,198 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 223,223,223 255,255,255 255,255,255 235,235,235 0,0,0 0,0,0 246,246,246 182,182,182 190,190,190 190,190,190 198,198,198 205,205,205 226,226,226 255,255,255 0,0,0 6,6,6 255,255,255 255,255,255 255,255,255 13,13,13 0,0,0 255,255,255 248,248,248 0,0,0 0,0,0 253,253,253 0,0,0 2,2,2 248,248,248 255,255,255 247,247,247 0,0,0 7,7,7 240,240,240 252,252,252 251,251,251 255,255,255 6,6,6 0,0,0 255,255,255 0,0,0 4,4,4 242,242,242 253,253,253 255,255,255 0,0,0 0,0,0 242,242,242 251,251,251 248,248,248 255,255,255 248,248,248 252,252,252 194,194,194 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 178,178,178 202,202,202 188,188,188 197,197,197 17,17,17 4,4,4 4,4,4 15,15,15 0,0,0 0,0,0 6,6,6 189,189,189 198,198,198 167,167,167 191,191,191 0,0,0 0,0,0 0,0,0 8,8,8 0,0,0 170,170,170 250,250,250 255,255,255 255,255,255 15,15,15 0,0,0 7,7,7 255,255,255 248,248,248 250,250,250 244,244,244 255,255,255 0,0,0 2,2,2 7,7,7 0,0,0 0,0,0 0,0,0 255,255,255 255,255,255 175,175,175 0,0,0 10,10,10 0,0,0 0,0,0 11,11,11 251,251,251 255,255,255 247,247,247 255,255,255 249,249,249 255,255,255 255,255,255 179,179,179 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +250,250,250 209,209,209 228,228,228 247,247,247 239,239,239 250,250,250 245,245,245 255,255,255 243,243,243 245,245,245 186,186,186 255,255,255 187,187,187 255,255,255 255,255,255 246,246,246 255,255,255 212,212,212 251,251,251 248,248,248 255,255,255 212,212,212 255,255,255 241,241,241 250,250,250 238,238,238 255,255,255 252,252,252 221,221,221 255,255,255 255,255,255 255,255,255 235,235,235 213,213,213 255,255,255 250,250,250 250,250,250 255,255,255 241,241,241 254,254,254 246,246,246 178,178,178 204,204,204 184,184,184 188,188,188 208,208,208 168,168,168 255,255,255 237,237,237 253,253,253 255,255,255 250,250,250 255,255,255 253,253,253 193,193,193 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +250,250,250 182,182,182 255,255,255 242,242,242 255,255,255 233,233,233 255,255,255 255,255,255 255,255,255 255,255,255 179,179,179 239,239,239 199,199,199 247,247,247 239,239,239 254,254,254 241,241,241 201,201,201 255,255,255 243,243,243 242,242,242 176,176,176 181,181,181 192,192,192 189,189,189 169,169,169 194,194,194 207,207,207 217,217,217 183,183,183 175,175,175 194,194,194 202,202,202 189,189,189 219,219,219 255,255,255 255,255,255 242,242,242 255,255,255 253,253,253 255,255,255 207,207,207 245,245,245 239,239,239 255,255,255 255,255,255 186,186,186 245,245,245 255,255,255 254,254,254 252,252,252 255,255,255 249,249,249 237,237,237 206,206,206 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 180,180,180 255,255,255 255,255,255 246,246,246 255,255,255 255,255,255 235,235,235 238,238,238 255,255,255 198,198,198 255,255,255 197,197,197 245,245,245 255,255,255 248,248,248 255,255,255 173,173,173 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 252,252,252 255,255,255 206,206,206 237,237,237 254,254,254 248,248,248 253,253,253 255,255,255 255,255,255 255,255,255 249,249,249 255,255,255 250,250,250 248,248,248 243,243,243 255,255,255 247,247,247 252,252,252 186,186,186 255,255,255 254,254,254 255,255,255 238,238,238 193,193,193 255,255,255 252,252,252 245,245,245 255,255,255 245,245,245 255,255,255 255,255,255 189,189,189 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input10.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input10.jpg new file mode 100644 index 0000000..65b4339 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input10.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input10.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input10.txt new file mode 100644 index 0000000..02f1195 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input10.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 252,252,252 247,247,247 255,255,255 254,254,254 255,255,255 198,198,198 249,249,249 255,255,255 253,253,253 253,253,253 189,189,189 192,192,192 252,252,252 255,255,255 252,252,252 255,255,255 250,250,250 255,255,255 246,246,246 250,250,250 255,255,255 246,246,246 255,255,255 255,255,255 238,238,238 255,255,255 243,243,243 255,255,255 187,187,187 247,247,247 199,199,199 252,252,252 187,187,187 249,249,249 241,241,241 255,255,255 246,246,246 246,246,246 255,255,255 250,250,250 255,255,255 247,247,247 255,255,255 237,237,237 198,198,198 244,244,244 252,252,252 191,191,191 255,255,255 252,252,252 255,255,255 255,255,255 245,245,245 193,193,193 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +246,246,246 255,255,255 255,255,255 238,238,238 251,251,251 250,250,250 167,167,167 255,255,255 247,247,247 249,249,249 248,248,248 201,201,201 187,187,187 255,255,255 255,255,255 232,232,232 255,255,255 234,234,234 255,255,255 255,255,255 238,238,238 255,255,255 253,253,253 244,244,244 252,252,252 255,255,255 249,249,249 253,253,253 245,245,245 188,188,188 216,216,216 189,189,189 252,252,252 175,175,175 255,255,255 255,255,255 247,247,247 246,246,246 255,255,255 255,255,255 255,255,255 250,250,250 249,249,249 255,255,255 255,255,255 183,183,183 255,255,255 251,251,251 174,174,174 254,254,254 255,255,255 251,251,251 255,255,255 247,247,247 187,187,187 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 240,240,240 246,246,246 255,255,255 255,255,255 255,255,255 172,172,172 219,219,219 197,197,197 184,184,184 207,207,207 184,184,184 193,193,193 239,239,239 233,233,233 255,255,255 255,255,255 239,239,239 255,255,255 236,236,236 250,250,250 255,255,255 241,241,241 255,255,255 253,253,253 236,236,236 255,255,255 255,255,255 246,246,246 176,176,176 248,248,248 246,246,246 250,250,250 203,203,203 249,249,249 237,237,237 245,245,245 255,255,255 249,249,249 250,250,250 249,249,249 247,247,247 240,240,240 249,249,249 255,255,255 189,189,189 255,255,255 241,241,241 200,200,200 254,254,254 255,255,255 233,233,233 255,255,255 255,255,255 195,195,195 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 249,249,249 255,255,255 255,255,255 237,237,237 236,236,236 206,206,206 0,0,0 0,0,0 2,2,2 9,9,9 0,0,0 200,200,200 255,255,255 0,0,0 0,0,0 0,0,0 19,19,19 0,0,0 15,15,15 0,0,0 254,254,254 247,247,247 0,0,0 8,8,8 244,244,244 255,255,255 241,241,241 251,251,251 13,13,13 3,3,3 251,251,251 0,0,0 3,3,3 9,9,9 19,19,19 5,5,5 0,0,0 182,182,182 192,192,192 187,187,187 200,200,200 198,198,198 195,195,195 0,0,0 8,8,8 227,227,227 255,255,255 195,195,195 242,242,242 255,255,255 251,251,251 251,251,251 239,239,239 189,189,189 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +237,237,237 255,255,255 244,244,244 255,255,255 255,255,255 255,255,255 0,0,0 0,0,0 246,246,246 249,249,249 239,239,239 6,6,6 0,0,0 253,253,253 255,255,255 254,254,254 254,254,254 242,242,242 224,224,224 0,0,0 9,9,9 255,255,255 255,255,255 1,1,1 1,1,1 2,2,2 249,249,249 243,243,243 5,5,5 3,3,3 0,0,0 255,255,255 4,4,4 0,0,0 245,245,245 238,238,238 240,240,240 0,0,0 13,13,13 255,255,255 250,250,250 249,249,249 251,251,251 0,0,0 8,8,8 0,0,0 24,24,24 234,234,234 207,207,207 227,227,227 251,251,251 255,255,255 254,254,254 253,253,253 202,202,202 239,239,239 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 255,255,255 255,255,255 253,253,253 0,0,0 10,10,10 255,255,255 255,255,255 247,247,247 255,255,255 250,250,250 197,197,197 252,252,252 238,238,238 254,254,254 251,251,251 255,255,255 255,255,255 8,8,8 0,0,0 235,235,235 255,255,255 0,0,0 0,0,0 0,0,0 7,7,7 8,8,8 0,0,0 0,0,0 12,12,12 246,246,246 2,2,2 22,22,22 235,235,235 255,255,255 232,232,232 212,212,212 0,0,0 0,0,0 254,254,254 254,254,254 0,0,0 17,17,17 254,254,254 232,232,232 1,1,1 0,0,0 177,177,177 212,212,212 182,182,182 177,177,177 178,178,178 214,214,214 198,198,198 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 249,249,249 242,242,242 255,255,255 0,0,0 0,0,0 255,255,255 246,246,246 241,241,241 254,254,254 255,255,255 199,199,199 241,241,241 255,255,255 254,254,254 249,249,249 247,247,247 8,8,8 0,0,0 255,255,255 187,187,187 197,197,197 7,7,7 6,6,6 177,177,177 11,11,11 0,0,0 194,194,194 11,11,11 0,0,0 204,204,204 4,4,4 0,0,0 214,214,214 207,207,207 187,187,187 0,0,0 0,0,0 198,198,198 183,183,183 10,10,10 0,0,0 243,243,243 246,246,246 255,255,255 209,209,209 5,5,5 17,17,17 230,230,230 255,255,255 255,255,255 253,253,253 237,237,237 180,180,180 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 251,251,251 255,255,255 255,255,255 236,236,236 14,14,14 0,0,0 250,250,250 255,255,255 251,251,251 251,251,251 237,237,237 199,199,199 255,255,255 245,245,245 254,254,254 255,255,255 7,7,7 2,2,2 249,249,249 255,255,255 196,196,196 249,249,249 1,1,1 0,0,0 255,255,255 0,0,0 6,6,6 255,255,255 0,0,0 0,0,0 247,247,247 0,0,0 16,16,16 0,0,0 0,0,0 9,9,9 1,1,1 251,251,251 248,248,248 255,255,255 3,3,3 0,0,0 252,252,252 255,255,255 255,255,255 167,167,167 6,6,6 0,0,0 255,255,255 239,239,239 242,242,242 253,253,253 255,255,255 189,189,189 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +190,190,190 196,196,196 179,179,179 201,201,201 195,195,195 0,0,0 7,7,7 255,255,255 181,181,181 201,201,201 0,0,0 0,0,0 1,1,1 241,241,241 253,253,253 248,248,248 5,5,5 0,0,0 255,255,255 244,244,244 247,247,247 204,204,204 247,247,247 11,11,11 0,0,0 255,255,255 0,0,0 2,2,2 255,255,255 0,0,0 0,0,0 255,255,255 0,0,0 4,4,4 253,253,253 255,255,255 255,255,255 0,0,0 11,11,11 247,247,247 252,252,252 0,0,0 7,7,7 245,245,245 255,255,255 242,242,242 190,190,190 8,8,8 0,0,0 251,251,251 255,255,255 255,255,255 248,248,248 255,255,255 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 249,249,249 238,238,238 255,255,255 0,0,0 0,0,0 255,255,255 186,186,186 255,255,255 250,250,250 0,0,0 9,9,9 255,255,255 255,255,255 3,3,3 12,12,12 252,252,252 233,233,233 255,255,255 255,255,255 181,181,181 240,240,240 0,0,0 0,0,0 255,255,255 255,255,255 238,238,238 253,253,253 0,0,0 0,0,0 251,251,251 6,6,6 0,0,0 248,248,248 237,237,237 234,234,234 255,255,255 0,0,0 11,11,11 255,255,255 0,0,0 0,0,0 23,23,23 0,0,0 4,4,4 11,11,11 0,0,0 11,11,11 250,250,250 241,241,241 251,251,251 255,255,255 255,255,255 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 236,236,236 255,255,255 251,251,251 252,252,252 0,0,0 0,0,0 252,252,252 185,185,185 251,251,251 246,246,246 14,14,14 0,0,0 255,255,255 0,0,0 0,0,0 239,239,239 255,255,255 255,255,255 232,232,232 255,255,255 187,187,187 255,255,255 5,5,5 9,9,9 240,240,240 255,255,255 249,249,249 255,255,255 13,13,13 0,0,0 255,255,255 2,2,2 0,0,0 255,255,255 255,255,255 254,254,254 240,240,240 8,8,8 0,0,0 250,250,250 0,0,0 22,22,22 235,235,235 255,255,255 246,246,246 193,193,193 1,1,1 0,0,0 255,255,255 255,255,255 255,255,255 250,250,250 244,244,244 194,194,194 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 253,253,253 251,251,251 244,244,244 251,251,251 255,255,255 0,0,0 8,8,8 209,209,209 169,169,169 190,190,190 6,6,6 0,0,0 243,243,243 0,0,0 20,20,20 255,255,255 245,245,245 249,249,249 255,255,255 243,243,243 207,207,207 240,240,240 3,3,3 2,2,2 243,243,243 243,243,243 252,252,252 254,254,254 0,0,0 0,0,0 244,244,244 0,0,0 1,1,1 249,249,249 255,255,255 255,255,255 0,0,0 15,15,15 244,244,244 255,255,255 0,0,0 0,0,0 250,250,250 252,252,252 255,255,255 172,172,172 19,19,19 11,11,11 255,255,255 255,255,255 248,248,248 254,254,254 255,255,255 204,204,204 238,238,238 255,255,255 255,255,255 255,255,255 255,255,255 +242,242,242 194,194,194 209,209,209 195,195,195 188,188,188 179,179,179 213,213,213 0,0,0 0,0,0 15,15,15 0,0,0 0,0,0 215,215,215 188,188,188 0,0,0 0,0,0 0,0,0 21,21,21 0,0,0 5,5,5 2,2,2 172,172,172 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 243,243,243 243,243,243 0,0,0 7,7,7 255,255,255 10,10,10 0,0,0 1,1,1 0,0,0 4,4,4 0,0,0 255,255,255 255,255,255 248,248,248 3,3,3 0,0,0 255,255,255 255,255,255 255,255,255 200,200,200 0,0,0 6,6,6 217,217,217 252,252,252 255,255,255 255,255,255 246,246,246 197,197,197 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 194,194,194 232,232,232 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 241,241,241 186,186,186 255,255,255 188,188,188 247,247,247 255,255,255 255,255,255 253,253,253 213,213,213 250,250,250 248,248,248 255,255,255 216,216,216 255,255,255 250,250,250 249,249,249 254,254,254 244,244,244 255,255,255 255,255,255 244,244,244 247,247,247 245,245,245 224,224,224 220,220,220 255,255,255 244,244,244 255,255,255 255,255,255 247,247,247 254,254,254 255,255,255 160,160,160 205,205,205 189,189,189 171,171,171 198,198,198 170,170,170 255,255,255 255,255,255 255,255,255 247,247,247 246,246,246 255,255,255 253,253,253 195,195,195 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 191,191,191 255,255,255 237,237,237 251,251,251 239,239,239 241,241,241 255,255,255 255,255,255 255,255,255 184,184,184 252,252,252 189,189,189 255,255,255 235,235,235 251,251,251 252,252,252 189,189,189 237,237,237 255,255,255 224,224,224 184,184,184 207,207,207 179,179,179 203,203,203 168,168,168 196,196,196 199,199,199 181,181,181 202,202,202 203,203,203 194,194,194 197,197,197 192,192,192 234,234,234 232,232,232 255,255,255 255,255,255 246,246,246 249,249,249 248,248,248 197,197,197 255,255,255 251,251,251 255,255,255 255,255,255 197,197,197 243,243,243 243,243,243 242,242,242 253,253,253 255,255,255 255,255,255 255,255,255 185,185,185 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 162,162,162 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 242,242,242 249,249,249 251,251,251 192,192,192 255,255,255 198,198,198 227,227,227 255,255,255 249,249,249 248,248,248 201,201,201 253,253,253 249,249,249 255,255,255 255,255,255 228,228,228 255,255,255 244,244,244 211,211,211 234,234,234 255,255,255 249,249,249 243,243,243 250,250,250 255,255,255 255,255,255 243,243,243 255,255,255 254,254,254 253,253,253 250,250,250 255,255,255 255,255,255 247,247,247 209,209,209 244,244,244 250,250,250 255,255,255 255,255,255 185,185,185 255,255,255 255,255,255 246,246,246 255,255,255 249,249,249 239,239,239 255,255,255 198,198,198 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input100.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input100.jpg new file mode 100644 index 0000000..5624587 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input100.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input11.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input11.jpg new file mode 100644 index 0000000..d8204d9 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input11.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input11.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input11.txt new file mode 100644 index 0000000..1ee03dd --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input11.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 255,255,255 250,250,250 255,255,255 250,250,250 255,255,255 198,198,198 255,255,255 255,255,255 255,255,255 249,249,249 192,192,192 182,182,182 254,254,254 255,255,255 250,250,250 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 243,243,243 251,251,251 253,253,253 249,249,249 247,247,247 255,255,255 255,255,255 234,234,234 213,213,213 236,236,236 193,193,193 255,255,255 186,186,186 255,255,255 254,254,254 243,243,243 253,253,253 255,255,255 240,240,240 255,255,255 244,244,244 251,251,251 255,255,255 237,237,237 192,192,192 248,248,248 255,255,255 197,197,197 255,255,255 255,255,255 253,253,253 255,255,255 250,250,250 186,186,186 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 254,254,254 251,251,251 255,255,255 255,255,255 255,255,255 182,182,182 234,234,234 245,245,245 233,233,233 255,255,255 198,198,198 203,203,203 246,246,246 251,251,251 240,240,240 255,255,255 248,248,248 255,255,255 249,249,249 237,237,237 250,250,250 255,255,255 252,252,252 255,255,255 255,255,255 227,227,227 230,230,230 255,255,255 160,160,160 227,227,227 201,201,201 235,235,235 192,192,192 229,229,229 255,255,255 248,248,248 251,251,251 243,243,243 255,255,255 249,249,249 243,243,243 255,255,255 240,240,240 255,255,255 196,196,196 255,255,255 241,241,241 195,195,195 251,251,251 244,244,244 247,247,247 255,255,255 248,248,248 187,187,187 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 249,249,249 255,255,255 255,255,255 254,254,254 175,175,175 222,222,222 199,199,199 197,197,197 201,201,201 188,188,188 180,180,180 255,255,255 248,248,248 255,255,255 234,234,234 255,255,255 253,253,253 249,249,249 253,253,253 255,255,255 246,246,246 255,255,255 255,255,255 243,243,243 255,255,255 255,255,255 255,255,255 193,193,193 254,254,254 233,233,233 255,255,255 205,205,205 255,255,255 246,246,246 255,255,255 255,255,255 222,222,222 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 255,255,255 213,213,213 244,244,244 255,255,255 174,174,174 255,255,255 255,255,255 255,255,255 254,254,254 251,251,251 195,195,195 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 254,254,254 249,249,249 255,255,255 252,252,252 255,255,255 186,186,186 240,240,240 0,0,0 14,14,14 0,0,0 5,5,5 191,191,191 251,251,251 254,254,254 249,249,249 248,248,248 0,0,0 0,0,0 255,255,255 243,243,243 238,238,238 255,255,255 232,232,232 246,246,246 237,237,237 253,253,253 235,235,235 0,0,0 0,0,0 250,250,250 255,255,255 0,0,0 6,6,6 6,6,6 1,1,1 3,3,3 0,0,0 210,210,210 176,176,176 178,178,178 0,0,0 0,0,0 209,209,209 200,200,200 161,161,161 248,248,248 0,0,0 9,9,9 219,219,219 255,255,255 254,254,254 250,250,250 255,255,255 198,198,198 237,237,237 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 255,255,255 252,252,252 255,255,255 250,250,250 255,255,255 194,194,194 255,255,255 246,246,246 255,255,255 0,0,0 2,2,2 204,204,204 255,255,255 228,228,228 255,255,255 8,8,8 11,11,11 5,5,5 244,244,244 241,241,241 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 2,2,2 6,6,6 0,0,0 254,254,254 255,255,255 8,8,8 0,0,0 230,230,230 255,255,255 255,255,255 4,4,4 0,0,0 255,255,255 255,255,255 5,5,5 14,14,14 0,0,0 254,254,254 247,247,247 7,7,7 15,15,15 8,8,8 250,250,250 255,255,255 250,250,250 240,240,240 254,254,254 206,206,206 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 254,254,254 255,255,255 255,255,255 252,252,252 254,254,254 192,192,192 255,255,255 255,255,255 238,238,238 14,14,14 0,0,0 177,177,177 255,255,255 254,254,254 0,0,0 0,0,0 0,0,0 0,0,0 255,255,255 255,255,255 244,244,244 236,236,236 240,240,240 247,247,247 244,244,244 8,8,8 5,5,5 0,0,0 6,6,6 243,243,243 255,255,255 2,2,2 0,0,0 255,255,255 245,245,245 238,238,238 196,196,196 6,6,6 0,0,0 249,249,249 0,0,0 11,11,11 1,1,1 0,0,0 17,17,17 1,1,1 0,0,0 0,0,0 209,209,209 183,183,183 185,185,185 195,195,195 213,213,213 187,187,187 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +250,250,250 254,254,254 254,254,254 255,255,255 252,252,252 255,255,255 191,191,191 252,252,252 241,241,241 255,255,255 0,0,0 6,6,6 200,200,200 240,240,240 255,255,255 255,255,255 248,248,248 11,11,11 2,2,2 255,255,255 243,243,243 181,181,181 208,208,208 200,200,200 199,199,199 0,0,0 0,0,0 201,201,201 0,0,0 0,0,0 204,204,204 180,180,180 6,6,6 0,0,0 185,185,185 215,215,215 198,198,198 179,179,179 1,1,1 0,0,0 200,200,200 0,0,0 4,4,4 255,255,255 0,0,0 0,0,0 216,216,216 2,2,2 14,14,14 255,255,255 234,234,234 255,255,255 255,255,255 246,246,246 188,188,188 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 248,248,248 253,253,253 250,250,250 255,255,255 195,195,195 255,255,255 255,255,255 250,250,250 0,0,0 0,0,0 206,206,206 246,246,246 255,255,255 239,239,239 255,255,255 0,0,0 13,13,13 237,237,237 253,253,253 206,206,206 249,249,249 252,252,252 0,0,0 6,6,6 251,251,251 255,255,255 2,2,2 0,0,0 255,255,255 252,252,252 0,0,0 4,4,4 252,252,252 250,250,250 246,246,246 255,255,255 8,8,8 0,0,0 250,250,250 7,7,7 0,0,0 247,247,247 13,13,13 0,0,0 176,176,176 0,0,0 0,0,0 255,255,255 242,242,242 252,252,252 252,252,252 248,248,248 198,198,198 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 +191,191,191 197,197,197 184,184,184 199,199,199 186,186,186 188,188,188 205,205,205 248,248,248 193,193,193 178,178,178 3,3,3 3,3,3 201,201,201 246,246,246 253,253,253 254,254,254 255,255,255 0,0,0 0,0,0 253,253,253 247,247,247 200,200,200 234,234,234 15,15,15 0,0,0 255,255,255 255,255,255 250,250,250 2,2,2 0,0,0 255,255,255 241,241,241 2,2,2 0,0,0 255,255,255 250,250,250 255,255,255 254,254,254 0,0,0 2,2,2 255,255,255 0,0,0 11,11,11 254,254,254 2,2,2 0,0,0 194,194,194 0,0,0 0,0,0 251,251,251 255,255,255 255,255,255 248,248,248 255,255,255 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 247,247,247 253,253,253 240,240,240 255,255,255 242,242,242 247,247,247 255,255,255 193,193,193 255,255,255 0,0,0 9,9,9 187,187,187 254,254,254 255,255,255 244,244,244 244,244,244 0,0,0 19,19,19 247,247,247 255,255,255 210,210,210 235,235,235 0,0,0 5,5,5 0,0,0 0,0,0 0,0,0 11,11,11 12,12,12 0,0,0 255,255,255 6,6,6 3,3,3 224,224,224 253,253,253 255,255,255 243,243,243 10,10,10 0,0,0 251,251,251 6,6,6 0,0,0 253,253,253 245,245,245 253,253,253 204,204,204 0,0,0 11,11,11 250,250,250 241,241,241 251,251,251 255,255,255 255,255,255 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 245,245,245 252,252,252 249,249,249 248,248,248 255,255,255 0,0,0 255,255,255 193,193,193 255,255,255 0,0,0 3,3,3 178,178,178 252,252,252 251,251,251 233,233,233 253,253,253 6,6,6 2,2,2 246,246,246 255,255,255 169,169,169 255,255,255 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 0,0,0 0,0,0 249,249,249 255,255,255 0,0,0 6,6,6 255,255,255 241,241,241 255,255,255 242,242,242 8,8,8 1,1,1 250,250,250 5,5,5 7,7,7 255,255,255 255,255,255 255,255,255 182,182,182 2,2,2 0,0,0 255,255,255 255,255,255 255,255,255 250,250,250 244,244,244 194,194,194 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +252,252,252 249,249,249 255,255,255 250,250,250 236,236,236 244,244,244 10,10,10 13,13,13 173,173,173 14,14,14 0,0,0 218,218,218 198,198,198 237,237,237 245,245,245 255,255,255 247,247,247 4,4,4 0,0,0 255,255,255 244,244,244 209,209,209 253,253,253 241,241,241 247,247,247 251,251,251 245,245,245 243,243,243 7,7,7 0,0,0 249,249,249 255,255,255 10,10,10 3,3,3 232,232,232 255,255,255 255,255,255 5,5,5 0,0,0 255,255,255 250,250,250 7,7,7 0,0,0 255,255,255 255,255,255 241,241,241 188,188,188 6,6,6 11,11,11 255,255,255 255,255,255 248,248,248 254,254,254 255,255,255 204,204,204 238,238,238 255,255,255 255,255,255 255,255,255 255,255,255 +232,232,232 191,191,191 209,209,209 186,186,186 205,205,205 200,200,200 192,192,192 0,0,0 12,12,12 0,0,0 205,205,205 230,230,230 189,189,189 197,197,197 192,192,192 0,0,0 0,0,0 15,15,15 0,0,0 0,0,0 0,0,0 166,166,166 255,255,255 239,239,239 255,255,255 255,255,255 255,255,255 254,254,254 0,0,0 0,0,0 255,255,255 243,243,243 0,0,0 0,0,0 6,6,6 0,0,0 0,0,0 0,0,0 255,255,255 250,250,250 254,254,254 0,0,0 12,12,12 248,248,248 249,249,249 255,255,255 208,208,208 0,0,0 6,6,6 217,217,217 252,252,252 255,255,255 255,255,255 246,246,246 197,197,197 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 192,192,192 249,249,249 227,227,227 252,252,252 255,255,255 245,245,245 255,255,255 254,254,254 244,244,244 201,201,201 248,248,248 202,202,202 248,248,248 239,239,239 255,255,255 250,250,250 193,193,193 253,253,253 255,255,255 226,226,226 223,223,223 255,255,255 255,255,255 244,244,244 251,251,251 236,236,236 255,255,255 255,255,255 248,248,248 241,241,241 255,255,255 234,234,234 191,191,191 255,255,255 252,252,252 255,255,255 255,255,255 251,251,251 248,248,248 255,255,255 184,184,184 204,204,204 195,195,195 174,174,174 205,205,205 173,173,173 255,255,255 255,255,255 255,255,255 247,247,247 246,246,246 255,255,255 253,253,253 195,195,195 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 176,176,176 255,255,255 249,249,249 255,255,255 247,247,247 244,244,244 255,255,255 250,250,250 255,255,255 191,191,191 248,248,248 193,193,193 255,255,255 255,255,255 235,235,235 251,251,251 201,201,201 250,250,250 251,251,251 238,238,238 187,187,187 176,176,176 191,191,191 192,192,192 186,186,186 198,198,198 188,188,188 192,192,192 200,200,200 186,186,186 195,195,195 207,207,207 198,198,198 224,224,224 245,245,245 243,243,243 252,252,252 253,253,253 255,255,255 249,249,249 200,200,200 255,255,255 246,246,246 242,242,242 255,255,255 183,183,183 255,255,255 243,243,243 242,242,242 253,253,253 255,255,255 255,255,255 255,255,255 185,185,185 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 187,187,187 253,253,253 255,255,255 254,254,254 254,254,254 251,251,251 248,248,248 255,255,255 242,242,242 209,209,209 248,248,248 206,206,206 229,229,229 249,249,249 255,255,255 255,255,255 190,190,190 237,237,237 255,255,255 255,255,255 255,255,255 249,249,249 255,255,255 247,247,247 213,213,213 234,234,234 255,255,255 251,251,251 242,242,242 255,255,255 255,255,255 255,255,255 238,238,238 255,255,255 255,255,255 253,253,253 251,251,251 254,254,254 255,255,255 253,253,253 189,189,189 238,238,238 255,255,255 255,255,255 247,247,247 195,195,195 250,250,250 255,255,255 246,246,246 255,255,255 249,249,249 239,239,239 255,255,255 198,198,198 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input12.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input12.jpg new file mode 100644 index 0000000..ac02691 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input12.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input12.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input12.txt new file mode 100644 index 0000000..c62215d --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input12.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 255,255,255 253,253,253 244,244,244 246,246,246 255,255,255 197,197,197 253,253,253 255,255,255 248,248,248 255,255,255 193,193,193 174,174,174 255,255,255 244,244,244 253,253,253 246,246,246 255,255,255 248,248,248 247,247,247 255,255,255 241,241,241 255,255,255 255,255,255 251,251,251 255,255,255 255,255,255 247,247,247 255,255,255 202,202,202 235,235,235 192,192,192 255,255,255 185,185,185 253,253,253 254,254,254 253,253,253 245,245,245 255,255,255 255,255,255 250,250,250 253,253,253 255,255,255 250,250,250 245,245,245 172,172,172 255,255,255 246,246,246 192,192,192 255,255,255 251,251,251 249,249,249 255,255,255 250,250,250 181,181,181 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 248,248,248 185,185,185 241,241,241 236,236,236 255,255,255 226,226,226 207,207,207 202,202,202 255,255,255 255,255,255 248,248,248 255,255,255 243,243,243 255,255,255 236,236,236 245,245,245 255,255,255 234,234,234 249,249,249 251,251,251 243,243,243 236,236,236 255,255,255 245,245,245 154,154,154 218,218,218 214,214,214 227,227,227 190,190,190 252,252,252 246,246,246 254,254,254 255,255,255 255,255,255 238,238,238 255,255,255 240,240,240 232,232,232 255,255,255 255,255,255 199,199,199 255,255,255 253,253,253 192,192,192 255,255,255 255,255,255 253,253,253 255,255,255 253,253,253 184,184,184 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 251,251,251 255,255,255 255,255,255 238,238,238 255,255,255 171,171,171 219,219,219 187,187,187 192,192,192 211,211,211 187,187,187 175,175,175 229,229,229 255,255,255 237,237,237 248,248,248 250,250,250 255,255,255 255,255,255 246,246,246 247,247,247 255,255,255 255,255,255 252,252,252 255,255,255 255,255,255 229,229,229 255,255,255 202,202,202 255,255,255 223,223,223 255,255,255 204,204,204 251,251,251 251,251,251 255,255,255 244,244,244 241,241,241 255,255,255 255,255,255 254,254,254 245,245,245 255,255,255 242,242,242 192,192,192 255,255,255 254,254,254 179,179,179 247,247,247 252,252,252 251,251,251 255,255,255 255,255,255 194,194,194 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 241,241,241 240,240,240 255,255,255 0,0,0 0,0,0 18,18,18 0,0,0 2,2,2 0,0,0 0,0,0 204,204,204 255,255,255 244,244,244 255,255,255 0,0,0 2,2,2 0,0,0 1,1,1 245,245,245 251,251,251 255,255,255 234,234,234 249,249,249 0,0,0 4,4,4 3,3,3 0,0,0 190,190,190 240,240,240 255,255,255 221,221,221 181,181,181 222,222,222 0,0,0 0,0,0 202,202,202 175,175,175 192,192,192 178,178,178 0,0,0 15,15,15 5,5,5 0,0,0 3,3,3 0,0,0 0,0,0 203,203,203 255,255,255 255,255,255 249,249,249 246,246,246 250,250,250 191,191,191 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 241,241,241 255,255,255 255,255,255 243,243,243 0,0,0 0,0,0 250,250,250 248,248,248 255,255,255 248,248,248 20,20,20 0,0,0 251,251,251 246,246,246 0,0,0 0,0,0 255,255,255 245,245,245 0,0,0 0,0,0 255,255,255 248,248,248 255,255,255 0,0,0 6,6,6 255,255,255 243,243,243 7,7,7 0,0,0 255,255,255 254,254,254 255,255,255 253,253,253 0,0,0 0,0,0 5,5,5 0,0,0 250,250,250 255,255,255 250,250,250 4,4,4 5,5,5 227,227,227 255,255,255 255,255,255 255,255,255 253,253,253 182,182,182 237,237,237 248,248,248 255,255,255 255,255,255 255,255,255 192,192,192 243,243,243 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 248,248,248 255,255,255 239,239,239 255,255,255 2,2,2 15,15,15 250,250,250 255,255,255 253,253,253 239,239,239 1,1,1 5,5,5 244,244,244 11,11,11 4,4,4 249,249,249 255,255,255 253,253,253 255,255,255 13,13,13 0,0,0 255,255,255 0,0,0 5,5,5 241,241,241 255,255,255 255,255,255 241,241,241 2,2,2 2,2,2 248,248,248 244,244,244 0,0,0 5,5,5 251,251,251 255,255,255 6,6,6 0,0,0 250,250,250 255,255,255 0,0,0 0,0,0 255,255,255 252,252,252 244,244,244 178,178,178 195,195,195 196,196,196 209,209,209 185,185,185 180,180,180 184,184,184 210,210,210 184,184,184 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 246,246,246 255,255,255 255,255,255 234,234,234 0,0,0 0,0,0 249,249,249 244,244,244 249,249,249 255,255,255 0,0,0 0,0,0 255,255,255 0,0,0 10,10,10 255,255,255 240,240,240 255,255,255 255,255,255 0,0,0 6,6,6 214,214,214 8,8,8 2,2,2 182,182,182 185,185,185 185,185,185 196,196,196 0,0,0 1,1,1 195,195,195 1,1,1 0,0,0 191,191,191 202,202,202 194,194,194 188,188,188 5,5,5 0,0,0 187,187,187 0,0,0 4,4,4 237,237,237 255,255,255 255,255,255 211,211,211 250,250,250 243,243,243 255,255,255 247,247,247 255,255,255 255,255,255 247,247,247 186,186,186 240,240,240 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 255,255,255 239,239,239 240,240,240 255,255,255 0,0,0 0,0,0 2,2,2 8,8,8 0,0,0 0,0,0 0,0,0 197,197,197 255,255,255 0,0,0 0,0,0 255,255,255 254,254,254 249,249,249 255,255,255 0,0,0 10,10,10 231,231,231 255,255,255 0,0,0 11,11,11 245,245,245 255,255,255 0,0,0 0,0,0 0,0,0 243,243,243 6,6,6 0,0,0 255,255,255 255,255,255 247,247,247 253,253,253 1,1,1 0,0,0 255,255,255 0,0,0 7,7,7 1,1,1 0,0,0 0,0,0 8,8,8 252,252,252 255,255,255 255,255,255 239,239,239 255,255,255 251,251,251 248,248,248 197,197,197 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +199,199,199 186,186,186 181,181,181 198,198,198 194,194,194 0,0,0 7,7,7 251,251,251 190,190,190 189,189,189 195,195,195 182,182,182 193,193,193 241,241,241 13,13,13 0,0,0 247,247,247 255,255,255 236,236,236 255,255,255 0,0,0 0,0,0 243,243,243 255,255,255 255,255,255 0,0,0 0,0,0 12,12,12 250,250,250 0,0,0 12,12,12 250,250,250 4,4,4 0,0,0 255,255,255 254,254,254 249,249,249 255,255,255 0,0,0 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 245,245,245 193,193,193 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 254,254,254 253,253,253 255,255,255 251,251,251 0,0,0 0,0,0 255,255,255 191,191,191 255,255,255 255,255,255 234,234,234 196,196,196 255,255,255 0,0,0 12,12,12 252,252,252 0,0,0 6,6,6 253,253,253 0,0,0 20,20,20 248,248,248 255,255,255 255,255,255 239,239,239 255,255,255 255,255,255 255,255,255 4,4,4 0,0,0 255,255,255 0,0,0 1,1,1 0,0,0 5,5,5 0,0,0 0,0,0 8,8,8 0,0,0 247,247,247 2,2,2 21,21,21 237,237,237 255,255,255 247,247,247 209,209,209 239,239,239 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +239,239,239 255,255,255 254,254,254 224,224,224 255,255,255 20,20,20 0,0,0 241,241,241 191,191,191 255,255,255 252,252,252 243,243,243 193,193,193 248,248,248 2,2,2 0,0,0 254,254,254 255,255,255 0,0,0 0,0,0 6,6,6 0,0,0 245,245,245 246,246,246 0,0,0 255,255,255 238,238,238 249,249,249 252,252,252 13,13,13 0,0,0 250,250,250 0,0,0 0,0,0 251,251,251 255,255,255 255,255,255 253,253,253 8,8,8 0,0,0 254,254,254 0,0,0 0,0,0 255,255,255 252,252,252 255,255,255 194,194,194 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 239,239,239 255,255,255 244,244,244 252,252,252 0,0,0 0,0,0 255,255,255 184,184,184 207,207,207 165,165,165 223,223,223 200,200,200 237,237,237 255,255,255 0,0,0 0,0,0 252,252,252 248,248,248 22,22,22 0,0,0 218,218,218 255,255,255 249,249,249 0,0,0 2,2,2 247,247,247 252,252,252 26,26,26 0,0,0 255,255,255 243,243,243 12,12,12 2,2,2 254,254,254 251,251,251 244,244,244 250,250,250 5,5,5 4,4,4 255,255,255 6,6,6 7,7,7 255,255,255 255,255,255 255,255,255 184,184,184 251,251,251 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 178,178,178 213,213,213 189,189,189 183,183,183 0,0,0 7,7,7 173,173,173 209,209,209 189,189,189 198,198,198 226,226,226 207,207,207 173,173,173 178,178,178 194,194,194 10,10,10 0,0,0 4,4,4 0,0,0 183,183,183 0,0,0 255,255,255 255,255,255 255,255,255 6,6,6 15,15,15 0,0,0 0,0,0 255,255,255 253,253,253 255,255,255 0,0,0 0,0,0 244,244,244 255,255,255 249,249,249 241,241,241 1,1,1 0,0,0 239,239,239 14,14,14 0,0,0 0,0,0 0,0,0 0,0,0 0,0,0 18,18,18 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +252,252,252 186,186,186 248,248,248 230,230,230 255,255,255 248,248,248 255,255,255 255,255,255 242,242,242 249,249,249 180,180,180 255,255,255 196,196,196 253,253,253 255,255,255 248,248,248 238,238,238 210,210,210 249,249,249 255,255,255 247,247,247 223,223,223 254,254,254 251,251,251 253,253,253 249,249,249 242,242,242 255,255,255 255,255,255 244,244,244 255,255,255 238,238,238 232,232,232 215,215,215 251,251,251 245,245,245 246,246,246 255,255,255 252,252,252 255,255,255 255,255,255 162,162,162 201,201,201 185,185,185 191,191,191 209,209,209 200,200,200 233,233,233 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 179,179,179 255,255,255 255,255,255 255,255,255 237,237,237 253,253,253 254,254,254 255,255,255 255,255,255 185,185,185 255,255,255 193,193,193 248,248,248 241,241,241 246,246,246 255,255,255 186,186,186 251,251,251 237,237,237 248,248,248 209,209,209 165,165,165 197,197,197 204,204,204 166,166,166 191,191,191 210,210,210 188,188,188 199,199,199 197,197,197 196,196,196 196,196,196 205,205,205 233,233,233 255,255,255 255,255,255 255,255,255 251,251,251 238,238,238 253,253,253 201,201,201 241,241,241 255,255,255 234,234,234 246,246,246 186,186,186 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 177,177,177 255,255,255 255,255,255 242,242,242 255,255,255 255,255,255 240,240,240 255,255,255 241,241,241 206,206,206 241,241,241 211,211,211 228,228,228 255,255,255 248,248,248 250,250,250 188,188,188 253,253,253 255,255,255 255,255,255 241,241,241 255,255,255 255,255,255 234,234,234 227,227,227 234,234,234 255,255,255 253,253,253 243,243,243 255,255,255 255,255,255 255,255,255 238,238,238 255,255,255 249,249,249 244,244,244 255,255,255 249,249,249 255,255,255 246,246,246 197,197,197 252,252,252 250,250,250 255,255,255 253,253,253 188,188,188 252,252,252 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input13.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input13.jpg new file mode 100644 index 0000000..dd4e33f Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input13.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input13.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input13.txt new file mode 100644 index 0000000..6049f86 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input13.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +247,247,247 255,255,255 242,242,242 255,255,255 247,247,247 255,255,255 187,187,187 255,255,255 253,253,253 255,255,255 255,255,255 178,178,178 185,185,185 254,254,254 255,255,255 251,251,251 255,255,255 255,255,255 255,255,255 243,243,243 253,253,253 255,255,255 234,234,234 254,254,254 244,244,244 255,255,255 255,255,255 253,253,253 250,250,250 207,207,207 229,229,229 196,196,196 255,255,255 186,186,186 255,255,255 254,254,254 243,243,243 253,253,253 255,255,255 240,240,240 249,249,249 255,255,255 241,241,241 255,255,255 245,245,245 179,179,179 254,254,254 255,255,255 201,201,201 246,246,246 242,242,242 255,255,255 255,255,255 247,247,247 185,185,185 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 252,252,252 251,251,251 254,254,254 255,255,255 250,250,250 172,172,172 238,238,238 247,247,247 250,250,250 246,246,246 203,203,203 199,199,199 252,252,252 249,249,249 243,243,243 247,247,247 251,251,251 255,255,255 252,252,252 242,242,242 248,248,248 248,248,248 255,255,255 255,255,255 236,236,236 241,241,241 254,254,254 251,251,251 178,178,178 222,222,222 208,208,208 235,235,235 192,192,192 229,229,229 255,255,255 248,248,248 251,251,251 243,243,243 255,255,255 255,255,255 231,231,231 251,251,251 255,255,255 254,254,254 197,197,197 255,255,255 231,231,231 196,196,196 255,255,255 255,255,255 254,254,254 249,249,249 250,250,250 193,193,193 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +241,241,241 255,255,255 244,244,244 253,253,253 255,255,255 255,255,255 170,170,170 221,221,221 191,191,191 184,184,184 198,198,198 198,198,198 171,171,171 255,255,255 255,255,255 255,255,255 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 250,250,250 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 250,250,250 193,193,193 255,255,255 218,218,218 255,255,255 205,205,205 255,255,255 246,246,246 255,255,255 255,255,255 222,222,222 255,255,255 255,255,255 250,250,250 255,255,255 241,241,241 255,255,255 199,199,199 249,249,249 255,255,255 171,171,171 240,240,240 255,255,255 255,255,255 255,255,255 255,255,255 194,194,194 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 250,250,250 255,255,255 253,253,253 236,236,236 0,0,0 12,12,12 239,239,239 243,243,243 244,244,244 255,255,255 0,0,0 0,0,0 255,255,255 5,5,5 0,0,0 255,255,255 244,244,244 242,242,242 255,255,255 0,0,0 0,0,0 247,247,247 6,6,6 0,0,0 0,0,0 0,0,0 9,9,9 0,0,0 10,10,10 250,250,250 255,255,255 0,0,0 6,6,6 6,6,6 1,1,1 3,3,3 0,0,0 210,210,210 176,176,176 178,178,178 189,189,189 190,190,190 11,11,11 0,0,0 0,0,0 0,0,0 241,241,241 227,227,227 255,255,255 248,248,248 245,245,245 236,236,236 250,250,250 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +252,252,252 255,255,255 225,225,225 255,255,255 255,255,255 9,9,9 0,0,0 255,255,255 255,255,255 245,245,245 255,255,255 3,3,3 0,0,0 250,250,250 0,0,0 0,0,0 250,250,250 255,255,255 252,252,252 244,244,244 6,6,6 7,7,7 255,255,255 246,246,246 251,251,251 245,245,245 255,255,255 234,234,234 11,11,11 6,6,6 254,254,254 247,247,247 8,8,8 0,0,0 230,230,230 255,255,255 255,255,255 4,4,4 0,0,0 255,255,255 255,255,255 255,255,255 5,5,5 0,0,0 255,255,255 255,255,255 12,12,12 10,10,10 155,155,155 250,250,250 245,245,245 255,255,255 253,253,253 255,255,255 187,187,187 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +246,246,246 255,255,255 255,255,255 242,242,242 242,242,242 0,0,0 0,0,0 247,247,247 255,255,255 252,252,252 233,233,233 11,11,11 20,20,20 255,255,255 0,0,0 5,5,5 245,245,245 250,250,250 238,238,238 255,255,255 0,0,0 0,0,0 255,255,255 245,245,245 255,255,255 254,254,254 249,249,249 255,255,255 4,4,4 0,0,0 255,255,255 246,246,246 2,2,2 0,0,0 255,255,255 245,245,245 238,238,238 196,196,196 6,6,6 0,0,0 250,250,250 0,0,0 10,10,10 255,255,255 247,247,247 241,241,241 178,178,178 6,6,6 19,19,19 203,203,203 195,195,195 196,196,196 192,192,192 220,220,220 185,185,185 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +242,242,242 255,255,255 239,239,239 244,244,244 255,255,255 255,255,255 13,13,13 1,1,1 240,240,240 255,255,255 15,15,15 0,0,0 192,192,192 252,252,252 0,0,0 13,13,13 250,250,250 255,255,255 255,255,255 255,255,255 0,0,0 27,27,27 181,181,181 201,201,201 185,185,185 192,192,192 189,189,189 12,12,12 0,0,0 180,180,180 203,203,203 185,185,185 6,6,6 0,0,0 185,185,185 215,215,215 198,198,198 179,179,179 1,1,1 0,0,0 195,195,195 2,2,2 0,0,0 255,255,255 251,251,251 252,252,252 232,232,232 0,0,0 0,0,0 250,250,250 243,243,243 255,255,255 246,246,246 244,244,244 197,197,197 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 236,236,236 255,255,255 255,255,255 235,235,235 255,255,255 0,0,0 1,1,1 255,255,255 246,246,246 0,0,0 4,4,4 201,201,201 251,251,251 20,20,20 0,0,0 252,252,252 6,6,6 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 251,251,251 255,255,255 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 244,244,244 255,255,255 0,0,0 4,4,4 252,252,252 250,250,250 246,246,246 255,255,255 8,8,8 0,0,0 255,255,255 0,0,0 8,8,8 245,245,245 255,255,255 248,248,248 176,176,176 7,7,7 0,0,0 255,255,255 234,234,234 255,255,255 255,255,255 239,239,239 195,195,195 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +185,185,185 186,186,186 194,194,194 204,204,204 203,203,203 185,185,185 3,3,3 3,3,3 183,183,183 190,190,190 4,4,4 0,0,0 199,199,199 237,237,237 14,14,14 0,0,0 244,244,244 12,12,12 0,0,0 253,253,253 11,11,11 0,0,0 236,236,236 255,255,255 244,244,244 8,8,8 0,0,0 255,255,255 255,255,255 248,248,248 255,255,255 248,248,248 2,2,2 0,0,0 255,255,255 250,250,250 255,255,255 254,254,254 0,0,0 2,2,2 245,245,245 0,0,0 4,4,4 243,243,243 255,255,255 246,246,246 197,197,197 0,0,0 0,0,0 255,255,255 244,244,244 255,255,255 255,255,255 244,244,244 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 254,254,254 255,255,255 239,239,239 230,230,230 255,255,255 229,229,229 1,1,1 4,4,4 14,14,14 1,1,1 247,247,247 195,195,195 255,255,255 0,0,0 0,0,0 255,255,255 0,0,0 0,0,0 254,254,254 0,0,0 14,14,14 255,255,255 255,255,255 16,16,16 0,0,0 255,255,255 255,255,255 237,237,237 255,255,255 239,239,239 255,255,255 6,6,6 3,3,3 224,224,224 253,253,253 255,255,255 243,243,243 10,10,10 0,0,0 255,255,255 8,8,8 5,5,5 255,255,255 255,255,255 237,237,237 197,197,197 3,3,3 13,13,13 255,255,255 252,252,252 244,244,244 241,241,241 255,255,255 201,201,201 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 247,247,247 252,252,252 246,246,246 255,255,255 255,255,255 248,248,248 0,0,0 0,0,0 1,1,1 0,0,0 249,249,249 181,181,181 244,244,244 16,16,16 5,5,5 5,5,5 3,3,3 14,14,14 8,8,8 0,0,0 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 250,250,250 253,253,253 255,255,255 244,244,244 252,252,252 0,0,0 6,6,6 255,255,255 241,241,241 255,255,255 242,242,242 8,8,8 1,1,1 228,228,228 6,6,6 3,3,3 237,237,237 249,249,249 255,255,255 172,172,172 11,11,11 0,0,0 217,217,217 255,255,255 255,255,255 248,248,248 255,255,255 190,190,190 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 253,253,253 241,241,241 242,242,242 242,242,242 252,252,252 255,255,255 4,4,4 11,11,11 167,167,167 214,214,214 207,207,207 235,235,235 0,0,0 8,8,8 0,0,0 253,253,253 248,248,248 10,10,10 3,3,3 4,4,4 245,245,245 0,0,0 9,9,9 218,218,218 249,249,249 255,255,255 251,251,251 248,248,248 255,255,255 244,244,244 10,10,10 3,3,3 232,232,232 255,255,255 255,255,255 5,5,5 0,0,0 255,255,255 255,255,255 194,194,194 0,0,0 8,8,8 255,255,255 241,241,241 14,14,14 0,0,0 250,250,250 255,255,255 253,253,253 250,250,250 247,247,247 255,255,255 189,189,189 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +242,242,242 185,185,185 194,194,194 199,199,199 186,186,186 216,216,216 185,185,185 176,176,176 0,0,0 0,0,0 193,193,193 249,249,249 187,187,187 199,199,199 0,0,0 0,0,0 211,211,211 199,199,199 194,194,194 185,185,185 2,2,2 0,0,0 255,255,255 0,0,0 7,7,7 13,13,13 10,10,10 0,0,0 0,0,0 17,17,17 247,247,247 255,255,255 0,0,0 0,0,0 6,6,6 0,0,0 0,0,0 0,0,0 255,255,255 250,250,250 245,245,245 183,183,183 255,255,255 0,0,0 0,0,0 15,15,15 0,0,0 247,247,247 244,244,244 249,249,249 247,247,247 255,255,255 249,249,249 250,250,250 181,181,181 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +248,248,248 200,200,200 249,249,249 247,247,247 238,238,238 246,246,246 255,255,255 255,255,255 255,255,255 240,240,240 191,191,191 255,255,255 193,193,193 255,255,255 255,255,255 250,250,250 244,244,244 191,191,191 255,255,255 238,238,238 255,255,255 207,207,207 234,234,234 255,255,255 239,239,239 255,255,255 243,243,243 255,255,255 252,252,252 245,245,245 243,243,243 250,250,250 234,234,234 191,191,191 255,255,255 252,252,252 255,255,255 255,255,255 251,251,251 248,248,248 248,248,248 179,179,179 223,223,223 174,174,174 183,183,183 189,189,189 182,182,182 253,253,253 255,255,255 251,251,251 239,239,239 250,250,250 253,253,253 255,255,255 192,192,192 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 191,191,191 244,244,244 247,247,247 255,255,255 240,240,240 255,255,255 242,242,242 249,249,249 249,249,249 208,208,208 241,241,241 189,189,189 249,249,249 253,253,253 249,249,249 255,255,255 202,202,202 255,255,255 255,255,255 225,225,225 200,200,200 197,197,197 188,188,188 192,192,192 178,178,178 190,190,190 192,192,192 199,199,199 186,186,186 208,208,208 199,199,199 207,207,207 198,198,198 224,224,224 245,245,245 243,243,243 252,252,252 253,253,253 255,255,255 253,253,253 214,214,214 215,215,215 255,255,255 253,253,253 252,252,252 195,195,195 251,251,251 244,244,244 255,255,255 255,255,255 255,255,255 243,243,243 249,249,249 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 165,165,165 255,255,255 255,255,255 247,247,247 249,249,249 255,255,255 255,255,255 255,255,255 249,249,249 179,179,179 255,255,255 197,197,197 227,227,227 255,255,255 244,244,244 252,252,252 190,190,190 236,236,236 251,251,251 255,255,255 245,245,245 237,237,237 255,255,255 250,250,250 208,208,208 241,241,241 255,255,255 255,255,255 232,232,232 255,255,255 252,252,252 255,255,255 238,238,238 255,255,255 255,255,255 253,253,253 251,251,251 254,254,254 255,255,255 255,255,255 180,180,180 255,255,255 255,255,255 255,255,255 242,242,242 200,200,200 248,248,248 255,255,255 255,255,255 246,246,246 254,254,254 255,255,255 255,255,255 197,197,197 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input14.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input14.jpg new file mode 100644 index 0000000..f3f4775 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input14.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input14.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input14.txt new file mode 100644 index 0000000..3e03418 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input14.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 254,254,254 246,246,246 255,255,255 241,241,241 255,255,255 209,209,209 250,250,250 255,255,255 253,253,253 241,241,241 194,194,194 199,199,199 246,246,246 255,255,255 249,249,249 255,255,255 253,253,253 252,252,252 255,255,255 252,252,252 251,251,251 255,255,255 247,247,247 237,237,237 255,255,255 255,255,255 240,240,240 255,255,255 202,202,202 224,224,224 199,199,199 255,255,255 192,192,192 234,234,234 255,255,255 250,250,250 248,248,248 255,255,255 250,250,250 251,251,251 254,254,254 255,255,255 255,255,255 241,241,241 197,197,197 255,255,255 250,250,250 193,193,193 252,252,252 249,249,249 253,253,253 255,255,255 247,247,247 182,182,182 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 251,251,251 252,252,252 255,255,255 255,255,255 232,232,232 175,175,175 247,247,247 237,237,237 255,255,255 255,255,255 179,179,179 190,190,190 255,255,255 253,253,253 252,252,252 243,243,243 255,255,255 255,255,255 234,234,234 255,255,255 255,255,255 239,239,239 255,255,255 255,255,255 255,255,255 248,248,248 255,255,255 233,233,233 160,160,160 237,237,237 203,203,203 234,234,234 180,180,180 255,255,255 253,253,253 239,239,239 255,255,255 241,241,241 251,251,251 255,255,255 242,242,242 244,244,244 255,255,255 247,247,247 203,203,203 241,241,241 255,255,255 187,187,187 255,255,255 252,252,252 255,255,255 252,252,252 246,246,246 191,191,191 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 255,255,255 249,249,249 224,224,224 255,255,255 255,255,255 187,187,187 218,218,218 186,186,186 194,194,194 185,185,185 182,182,182 184,184,184 255,255,255 253,253,253 247,247,247 252,252,252 255,255,255 234,234,234 255,255,255 242,242,242 250,250,250 253,253,253 251,251,251 253,253,253 242,242,242 252,252,252 246,246,246 255,255,255 198,198,198 234,234,234 235,235,235 255,255,255 199,199,199 234,234,234 255,255,255 255,255,255 240,240,240 242,242,242 255,255,255 255,255,255 242,242,242 255,255,255 248,248,248 255,255,255 193,193,193 255,255,255 250,250,250 186,186,186 255,255,255 227,227,227 255,255,255 255,255,255 248,248,248 197,197,197 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 241,241,241 254,254,254 255,255,255 239,239,239 3,3,3 0,0,0 244,244,244 249,249,249 255,255,255 249,249,249 13,13,13 10,10,10 255,255,255 240,240,240 255,255,255 1,1,1 9,9,9 6,6,6 0,0,0 0,0,0 255,255,255 255,255,255 246,246,246 0,0,0 6,6,6 5,5,5 0,0,0 0,0,0 3,3,3 255,255,255 255,255,255 2,2,2 0,0,0 12,12,12 0,0,0 3,3,3 8,8,8 10,10,10 0,0,0 167,167,167 10,10,10 0,0,0 0,0,0 0,0,0 0,0,0 0,0,0 0,0,0 0,0,0 250,250,250 255,255,255 255,255,255 225,225,225 254,254,254 204,204,204 239,239,239 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 245,245,245 251,251,251 255,255,255 248,248,248 2,2,2 0,0,0 255,255,255 255,255,255 240,240,240 255,255,255 0,0,0 0,0,0 255,255,255 231,231,231 8,8,8 0,0,0 235,235,235 242,242,242 255,255,255 5,5,5 0,0,0 237,237,237 1,1,1 6,6,6 236,236,236 255,255,255 238,238,238 254,254,254 3,3,3 0,0,0 253,253,253 239,239,239 255,255,255 253,253,253 4,4,4 0,0,0 202,202,202 242,242,242 247,247,247 255,255,255 249,249,249 255,255,255 241,241,241 255,255,255 255,255,255 238,238,238 8,8,8 5,5,5 242,242,242 238,238,238 255,255,255 255,255,255 255,255,255 183,183,183 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 255,255,255 255,255,255 253,253,253 250,250,250 4,4,4 0,0,0 250,250,250 255,255,255 244,244,244 255,255,255 0,0,0 5,5,5 255,255,255 14,14,14 0,0,0 255,255,255 255,255,255 247,247,247 255,255,255 247,247,247 234,234,234 255,255,255 0,0,0 3,3,3 255,255,255 237,237,237 255,255,255 255,255,255 211,211,211 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 1,1,1 0,0,0 214,214,214 248,248,248 252,252,252 238,238,238 255,255,255 242,242,242 242,242,242 255,255,255 237,237,237 202,202,202 1,1,1 5,5,5 211,211,211 192,192,192 172,172,172 186,186,186 218,218,218 178,178,178 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 255,255,255 254,254,254 254,254,254 251,251,251 9,9,9 5,5,5 248,248,248 249,249,249 246,246,246 253,253,253 6,6,6 0,0,0 255,255,255 0,0,0 0,0,0 245,245,245 255,255,255 255,255,255 255,255,255 255,255,255 170,170,170 222,222,222 0,0,0 0,0,0 184,184,184 205,205,205 192,192,192 175,175,175 171,171,171 205,205,205 179,179,179 203,203,203 171,171,171 176,176,176 0,0,0 8,8,8 177,177,177 187,187,187 187,187,187 200,200,200 195,195,195 255,255,255 255,255,255 242,242,242 243,243,243 0,0,0 4,4,4 228,228,228 255,255,255 236,236,236 255,255,255 255,255,255 245,245,245 176,176,176 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 255,255,255 249,249,249 255,255,255 245,245,245 0,0,0 0,0,0 255,255,255 0,0,0 7,7,7 251,251,251 0,0,0 3,3,3 248,248,248 5,5,5 6,6,6 255,255,255 255,255,255 243,243,243 248,248,248 255,255,255 195,195,195 247,247,247 255,255,255 4,4,4 0,0,0 0,0,0 9,9,9 0,0,0 4,4,4 245,245,245 252,252,252 247,247,247 208,208,208 255,255,255 0,0,0 0,0,0 255,255,255 245,245,245 255,255,255 254,254,254 192,192,192 255,255,255 235,235,235 255,255,255 9,9,9 4,4,4 248,248,248 255,255,255 255,255,255 246,246,246 255,255,255 246,246,246 246,246,246 204,204,204 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +202,202,202 184,184,184 189,189,189 210,210,210 193,193,193 0,0,0 10,10,10 251,251,251 0,0,0 10,10,10 197,197,197 0,0,0 0,0,0 247,247,247 0,0,0 6,6,6 251,251,251 251,251,251 255,255,255 0,0,0 3,3,3 3,3,3 250,250,250 255,255,255 255,255,255 251,251,251 254,254,254 253,253,253 251,251,251 0,0,0 8,8,8 244,244,244 250,250,250 193,193,193 255,255,255 0,0,0 0,0,0 255,255,255 237,237,237 250,250,250 255,255,255 179,179,179 255,255,255 248,248,248 0,0,0 12,12,12 192,192,192 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +235,235,235 255,255,255 236,236,236 223,223,223 255,255,255 0,0,0 0,0,0 255,255,255 24,24,24 0,0,0 237,237,237 12,12,12 3,3,3 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 247,247,247 255,255,255 0,0,0 12,12,12 241,241,241 247,247,247 250,250,250 254,254,254 247,247,247 255,255,255 255,255,255 11,11,11 0,0,0 255,255,255 251,251,251 189,189,189 231,231,231 0,0,0 0,0,0 246,246,246 255,255,255 255,255,255 252,252,252 196,196,196 241,241,241 15,15,15 0,0,0 248,248,248 188,188,188 250,250,250 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 245,245,245 252,252,252 255,255,255 255,255,255 2,2,2 0,0,0 0,0,0 0,0,0 0,0,0 10,10,10 5,5,5 0,0,0 255,255,255 9,9,9 0,0,0 255,255,255 239,239,239 249,249,249 255,255,255 4,4,4 0,0,0 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 241,241,241 254,254,254 0,0,0 20,20,20 248,248,248 255,255,255 191,191,191 244,244,244 12,12,12 3,3,3 249,249,249 249,249,249 251,251,251 244,244,244 194,194,194 12,12,12 0,0,0 255,255,255 255,255,255 185,185,185 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 250,250,250 255,255,255 236,236,236 232,232,232 1,1,1 0,0,0 8,8,8 194,194,194 197,197,197 0,0,0 0,0,0 9,9,9 235,235,235 246,246,246 0,0,0 0,0,0 255,255,255 249,249,249 242,242,242 0,0,0 13,13,13 255,255,255 0,0,0 0,0,0 255,255,255 242,242,242 255,255,255 239,239,239 0,0,0 15,15,15 240,240,240 253,253,253 168,168,168 251,251,251 0,0,0 0,0,0 255,255,255 242,242,242 253,253,253 252,252,252 3,3,3 2,2,2 245,245,245 255,255,255 255,255,255 194,194,194 239,239,239 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 193,193,193 189,189,189 202,202,202 204,204,204 7,7,7 9,9,9 167,167,167 189,189,189 191,191,191 176,176,176 8,8,8 6,6,6 194,194,194 200,200,200 181,181,181 6,6,6 1,1,1 20,20,20 0,0,0 1,1,1 181,181,181 222,222,222 255,255,255 5,5,5 0,0,0 0,0,0 2,2,2 0,0,0 1,1,1 255,255,255 252,252,252 255,255,255 199,199,199 248,248,248 4,4,4 0,0,0 255,255,255 255,255,255 253,253,253 253,253,253 0,0,0 0,0,0 255,255,255 252,252,252 249,249,249 200,200,200 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +238,238,238 180,180,180 244,244,244 239,239,239 234,234,234 252,252,252 255,255,255 255,255,255 255,255,255 240,240,240 205,205,205 255,255,255 161,161,161 255,255,255 249,249,249 248,248,248 246,246,246 192,192,192 240,240,240 255,255,255 254,254,254 202,202,202 255,255,255 239,239,239 247,247,247 255,255,255 241,241,241 255,255,255 254,254,254 253,253,253 255,255,255 251,251,251 248,248,248 189,189,189 249,249,249 254,254,254 255,255,255 255,255,255 235,235,235 255,255,255 255,255,255 177,177,177 207,207,207 173,173,173 179,179,179 200,200,200 172,172,172 248,248,248 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 190,190,190 254,254,254 255,255,255 255,255,255 245,245,245 236,236,236 255,255,255 244,244,244 255,255,255 182,182,182 248,248,248 211,211,211 252,252,252 255,255,255 247,247,247 255,255,255 205,205,205 255,255,255 240,240,240 238,238,238 213,213,213 182,182,182 187,187,187 198,198,198 163,163,163 212,212,212 196,196,196 195,195,195 176,176,176 195,195,195 192,192,192 184,184,184 213,213,213 236,236,236 242,242,242 255,255,255 255,255,255 255,255,255 238,238,238 251,251,251 208,208,208 243,243,243 255,255,255 255,255,255 255,255,255 174,174,174 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +248,248,248 181,181,181 252,252,252 255,255,255 250,250,250 254,254,254 255,255,255 253,253,253 255,255,255 241,241,241 203,203,203 244,244,244 206,206,206 232,232,232 251,251,251 254,254,254 247,247,247 191,191,191 254,254,254 245,245,245 255,255,255 239,239,239 249,249,249 255,255,255 235,235,235 234,234,234 231,231,231 247,247,247 255,255,255 251,251,251 249,249,249 255,255,255 254,254,254 255,255,255 254,254,254 245,245,245 255,255,255 242,242,242 255,255,255 255,255,255 251,251,251 186,186,186 255,255,255 253,253,253 255,255,255 252,252,252 203,203,203 241,241,241 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input15.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input15.jpg new file mode 100644 index 0000000..08effff Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input15.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input15.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input15.txt new file mode 100644 index 0000000..d002080 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input15.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +247,247,247 255,255,255 247,247,247 255,255,255 244,244,244 250,250,250 215,215,215 246,246,246 248,248,248 255,255,255 255,255,255 171,171,171 190,190,190 255,255,255 247,247,247 255,255,255 255,255,255 231,231,231 255,255,255 247,247,247 255,255,255 255,255,255 254,254,254 247,247,247 255,255,255 238,238,238 255,255,255 243,243,243 255,255,255 187,187,187 247,247,247 199,199,199 251,251,251 204,204,204 239,239,239 255,255,255 251,251,251 251,251,251 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 254,254,254 250,250,250 189,189,189 250,250,250 255,255,255 191,191,191 249,249,249 254,254,254 249,249,249 255,255,255 252,252,252 177,177,177 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 254,254,254 241,241,241 255,255,255 250,250,250 163,163,163 241,241,241 255,255,255 242,242,242 231,231,231 208,208,208 178,178,178 247,247,247 255,255,255 246,246,246 241,241,241 255,255,255 242,242,242 255,255,255 241,241,241 238,238,238 252,252,252 255,255,255 252,252,252 255,255,255 249,249,249 253,253,253 245,245,245 188,188,188 216,216,216 189,189,189 254,254,254 169,169,169 250,250,250 255,255,255 253,253,253 240,240,240 248,248,248 255,255,255 255,255,255 246,246,246 246,246,246 255,255,255 240,240,240 210,210,210 255,255,255 223,223,223 204,204,204 252,252,252 248,248,248 255,255,255 253,253,253 246,246,246 204,204,204 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 255,255,255 234,234,234 255,255,255 243,243,243 255,255,255 179,179,179 229,229,229 174,174,174 207,207,207 209,209,209 179,179,179 190,190,190 255,255,255 255,255,255 247,247,247 255,255,255 253,253,253 255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 253,253,253 236,236,236 255,255,255 255,255,255 246,246,246 176,176,176 248,248,248 246,246,246 250,250,250 207,207,207 255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 238,238,238 255,255,255 255,255,255 255,255,255 245,245,245 255,255,255 184,184,184 251,251,251 255,255,255 174,174,174 251,251,251 255,255,255 253,253,253 254,254,254 255,255,255 189,189,189 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 255,255,255 255,255,255 253,253,253 250,250,250 11,11,11 0,0,0 251,251,251 255,255,255 237,237,237 240,240,240 3,3,3 1,1,1 255,255,255 0,0,0 9,9,9 241,241,241 245,245,245 255,255,255 255,255,255 0,0,0 16,16,16 237,237,237 4,4,4 8,8,8 244,244,244 255,255,255 241,241,241 251,251,251 13,13,13 3,3,3 251,251,251 232,232,232 16,16,16 0,0,0 3,3,3 11,11,11 0,0,0 0,0,0 198,198,198 173,173,173 175,175,175 190,190,190 10,10,10 0,0,0 9,9,9 5,5,5 239,239,239 216,216,216 249,249,249 255,255,255 247,247,247 244,244,244 255,255,255 182,182,182 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 252,252,252 244,244,244 254,254,254 247,247,247 6,6,6 0,0,0 252,252,252 250,250,250 255,255,255 255,255,255 0,0,0 0,0,0 246,246,246 0,0,0 8,8,8 255,255,255 246,246,246 253,253,253 0,0,0 7,7,7 246,246,246 255,255,255 0,0,0 1,1,1 2,2,2 249,249,249 243,243,243 5,5,5 3,3,3 0,0,0 255,255,255 6,6,6 1,1,1 255,255,255 251,251,251 230,230,230 200,200,200 7,7,7 0,0,0 255,255,255 255,255,255 0,0,0 2,2,2 245,245,245 255,255,255 0,0,0 8,8,8 182,182,182 236,236,236 249,249,249 255,255,255 250,250,250 252,252,252 203,203,203 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 +236,236,236 252,252,252 255,255,255 254,254,254 255,255,255 255,255,255 2,2,2 0,0,0 249,249,249 250,250,250 0,0,0 12,12,12 185,185,185 255,255,255 11,11,11 0,0,0 254,254,254 245,245,245 5,5,5 0,0,0 242,242,242 250,250,250 252,252,252 7,7,7 0,0,0 0,0,0 7,7,7 8,8,8 0,0,0 0,0,0 12,12,12 246,246,246 3,3,3 0,0,0 252,252,252 255,255,255 247,247,247 214,214,214 240,240,240 247,247,247 235,235,235 1,1,1 3,3,3 235,235,235 255,255,255 242,242,242 196,196,196 1,1,1 0,0,0 227,227,227 191,191,191 166,166,166 198,198,198 200,200,200 194,194,194 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 227,227,227 255,255,255 249,249,249 231,231,231 200,200,200 10,10,10 5,5,5 0,0,0 17,17,17 254,254,254 180,180,180 255,255,255 0,0,0 0,0,0 252,252,252 3,3,3 0,0,0 255,255,255 255,255,255 187,187,187 199,199,199 0,0,0 6,6,6 177,177,177 11,11,11 0,0,0 194,194,194 11,11,11 0,0,0 204,204,204 4,4,4 8,8,8 196,196,196 198,198,198 195,195,195 163,163,163 210,210,210 189,189,189 185,185,185 199,199,199 241,241,241 255,255,255 251,251,251 249,249,249 206,206,206 0,0,0 0,0,0 253,253,253 252,252,252 236,236,236 255,255,255 255,255,255 194,194,194 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 241,241,241 255,255,255 251,251,251 249,249,249 255,255,255 186,186,186 252,252,252 0,0,0 9,9,9 242,242,242 246,246,246 204,204,204 249,249,249 10,10,10 0,0,0 0,0,0 10,10,10 245,245,245 245,245,245 255,255,255 186,186,186 250,250,250 3,3,3 0,0,0 255,255,255 0,0,0 6,6,6 255,255,255 0,0,0 0,0,0 247,247,247 244,244,244 0,0,0 3,3,3 0,0,0 13,13,13 4,4,4 0,0,0 254,254,254 255,255,255 185,185,185 247,247,247 255,255,255 234,234,234 255,255,255 0,0,0 4,4,4 255,255,255 247,247,247 247,247,247 255,255,255 245,245,245 247,247,247 192,192,192 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +193,193,193 178,178,178 199,199,199 209,209,209 190,190,190 185,185,185 215,215,215 249,249,249 0,0,0 7,7,7 185,185,185 183,183,183 208,208,208 249,249,249 6,6,6 0,0,0 4,4,4 0,0,0 255,255,255 255,255,255 251,251,251 197,197,197 250,250,250 0,0,0 0,0,0 255,255,255 0,0,0 2,2,2 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 187,187,187 255,255,255 251,251,251 233,233,233 255,255,255 0,0,0 3,3,3 247,247,247 203,203,203 253,253,253 254,254,254 255,255,255 0,0,0 3,3,3 249,249,249 255,255,255 248,248,248 255,255,255 255,255,255 234,234,234 253,253,253 198,198,198 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 235,235,235 251,251,251 245,245,245 255,255,255 223,223,223 1,1,1 0,0,0 0,0,0 0,0,0 249,249,249 180,180,180 255,255,255 0,0,0 3,3,3 253,253,253 0,0,0 0,0,0 243,243,243 255,255,255 190,190,190 244,244,244 0,0,0 0,0,0 255,255,255 255,255,255 238,238,238 253,253,253 0,0,0 0,0,0 251,251,251 253,253,253 178,178,178 239,239,239 255,255,255 255,255,255 252,252,252 0,0,0 0,0,0 255,255,255 178,178,178 255,255,255 240,240,240 9,9,9 0,0,0 197,197,197 255,255,255 245,245,245 250,250,250 239,239,239 255,255,255 255,255,255 255,255,255 184,184,184 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +238,238,238 247,247,247 255,255,255 250,250,250 255,255,255 255,255,255 0,0,0 1,1,1 190,190,190 255,255,255 3,3,3 0,0,0 209,209,209 244,244,244 15,15,15 0,0,0 252,252,252 255,255,255 18,18,18 0,0,0 251,251,251 191,191,191 255,255,255 0,0,0 9,9,9 240,240,240 255,255,255 249,249,249 255,255,255 13,13,13 0,0,0 255,255,255 255,255,255 183,183,183 255,255,255 255,255,255 241,241,241 242,242,242 1,1,1 2,2,2 242,242,242 183,183,183 243,243,243 13,13,13 0,0,0 255,255,255 196,196,196 248,248,248 247,247,247 255,255,255 255,255,255 247,247,247 254,254,254 246,246,246 189,189,189 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 255,255,255 247,247,247 235,235,235 231,231,231 0,0,0 16,16,16 248,248,248 202,202,202 179,179,179 162,162,162 9,9,9 1,1,1 236,236,236 0,0,0 7,7,7 240,240,240 247,247,247 255,255,255 8,8,8 16,16,16 185,185,185 255,255,255 3,3,3 2,2,2 243,243,243 243,243,243 252,252,252 254,254,254 0,0,0 0,0,0 244,244,244 0,0,0 7,7,7 240,240,240 252,252,252 251,251,251 255,255,255 6,6,6 0,0,0 255,255,255 201,201,201 0,0,0 10,10,10 255,255,255 239,239,239 195,195,195 255,255,255 252,252,252 244,244,244 235,235,235 255,255,255 248,248,248 238,238,238 212,212,212 243,243,243 255,255,255 255,255,255 255,255,255 255,255,255 +235,235,235 181,181,181 220,220,220 184,184,184 211,211,211 0,0,0 0,0,0 187,187,187 189,189,189 206,206,206 206,206,206 0,0,0 0,0,0 200,200,200 0,0,0 11,11,11 207,207,207 187,187,187 196,196,196 193,193,193 0,0,0 20,20,20 248,248,248 0,0,0 0,0,0 255,255,255 255,255,255 243,243,243 243,243,243 0,0,0 7,7,7 255,255,255 255,255,255 0,0,0 2,2,2 7,7,7 0,0,0 0,0,0 0,0,0 255,255,255 243,243,243 4,4,4 5,5,5 0,0,0 1,1,1 2,2,2 0,0,0 5,5,5 13,13,13 239,239,239 255,255,255 237,237,237 255,255,255 255,255,255 191,191,191 243,243,243 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 188,188,188 221,221,221 255,255,255 253,253,253 252,252,252 255,255,255 247,247,247 246,246,246 242,242,242 192,192,192 255,255,255 201,201,201 249,249,249 255,255,255 249,249,249 243,243,243 203,203,203 255,255,255 233,233,233 255,255,255 221,221,221 240,240,240 255,255,255 249,249,249 254,254,254 244,244,244 255,255,255 255,255,255 244,244,244 247,247,247 245,245,245 235,235,235 213,213,213 255,255,255 250,250,250 250,250,250 255,255,255 241,241,241 254,254,254 255,255,255 179,179,179 194,194,194 188,188,188 194,194,194 194,194,194 184,184,184 255,255,255 243,243,243 255,255,255 253,253,253 255,255,255 247,247,247 244,244,244 203,203,203 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +234,234,234 206,206,206 255,255,255 236,236,236 254,254,254 233,233,233 255,255,255 255,255,255 255,255,255 255,255,255 199,199,199 247,247,247 182,182,182 230,230,230 255,255,255 237,237,237 255,255,255 198,198,198 224,224,224 245,245,245 253,253,253 191,191,191 183,183,183 198,198,198 203,203,203 168,168,168 196,196,196 199,199,199 181,181,181 202,202,202 203,203,203 194,194,194 202,202,202 189,189,189 219,219,219 255,255,255 255,255,255 242,242,242 255,255,255 253,253,253 255,255,255 187,187,187 255,255,255 248,248,248 232,232,232 255,255,255 187,187,187 240,240,240 255,255,255 250,250,250 251,251,251 255,255,255 250,250,250 252,252,252 196,196,196 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 172,172,172 255,255,255 255,255,255 248,248,248 255,255,255 240,240,240 250,250,250 255,255,255 243,243,243 199,199,199 253,253,253 202,202,202 253,253,253 242,242,242 255,255,255 255,255,255 186,186,186 255,255,255 255,255,255 249,249,249 255,255,255 245,245,245 255,255,255 244,244,244 211,211,211 234,234,234 255,255,255 249,249,249 243,243,243 250,250,250 255,255,255 255,255,255 249,249,249 255,255,255 250,250,250 248,248,248 243,243,243 255,255,255 247,247,247 250,250,250 188,188,188 255,255,255 255,255,255 254,254,254 251,251,251 188,188,188 255,255,255 253,253,253 255,255,255 255,255,255 251,251,251 249,249,249 255,255,255 191,191,191 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input16.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input16.jpg new file mode 100644 index 0000000..215128d Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input16.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input16.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input16.txt new file mode 100644 index 0000000..67e056f --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input16.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +243,243,243 255,255,255 254,254,254 255,255,255 252,252,252 243,243,243 213,213,213 254,254,254 255,255,255 255,255,255 252,252,252 177,177,177 186,186,186 254,254,254 255,255,255 252,252,252 255,255,255 249,249,249 255,255,255 255,255,255 255,255,255 246,246,246 255,255,255 254,254,254 251,251,251 255,255,255 246,246,246 252,252,252 255,255,255 193,193,193 224,224,224 204,204,204 255,255,255 176,176,176 251,251,251 255,255,255 238,238,238 252,252,252 255,255,255 254,254,254 252,252,252 248,248,248 255,255,255 246,246,246 255,255,255 189,189,189 253,253,253 255,255,255 184,184,184 255,255,255 252,252,252 247,247,247 255,255,255 247,247,247 185,185,185 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 238,238,238 243,243,243 248,248,248 248,248,248 255,255,255 162,162,162 243,243,243 242,242,242 253,253,253 255,255,255 210,210,210 205,205,205 255,255,255 255,255,255 244,244,244 255,255,255 242,242,242 255,255,255 245,245,245 246,246,246 255,255,255 249,249,249 241,241,241 249,249,249 255,255,255 255,255,255 235,235,235 227,227,227 190,190,190 222,222,222 193,193,193 241,241,241 203,203,203 250,250,250 236,236,236 247,247,247 255,255,255 243,243,243 254,254,254 255,255,255 245,245,245 247,247,247 255,255,255 255,255,255 196,196,196 242,242,242 248,248,248 195,195,195 248,248,248 244,244,244 255,255,255 255,255,255 240,240,240 186,186,186 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 255,255,255 251,251,251 252,252,252 242,242,242 194,194,194 223,223,223 182,182,182 195,195,195 192,192,192 180,180,180 168,168,168 247,247,247 255,255,255 255,255,255 239,239,239 255,255,255 255,255,255 255,255,255 244,244,244 255,255,255 245,245,245 255,255,255 249,249,249 228,228,228 255,255,255 255,255,255 255,255,255 190,190,190 255,255,255 237,237,237 249,249,249 194,194,194 255,255,255 255,255,255 255,255,255 243,243,243 239,239,239 255,255,255 255,255,255 249,249,249 245,245,245 255,255,255 252,252,252 194,194,194 255,255,255 255,255,255 186,186,186 255,255,255 255,255,255 254,254,254 241,241,241 255,255,255 218,218,218 239,239,239 255,255,255 255,255,255 255,255,255 255,255,255 +250,250,250 251,251,251 231,231,231 255,255,255 245,245,245 255,255,255 172,172,172 245,245,245 3,3,3 13,13,13 255,255,255 254,254,254 204,204,204 255,255,255 0,0,0 0,0,0 0,0,0 5,5,5 0,0,0 6,6,6 233,233,233 238,238,238 255,255,255 236,236,236 246,246,246 23,23,23 0,0,0 5,5,5 0,0,0 190,190,190 242,242,242 255,255,255 14,14,14 3,3,3 176,176,176 186,186,186 191,191,191 191,191,191 0,0,0 0,0,0 174,174,174 9,9,9 22,22,22 0,0,0 7,7,7 0,0,0 0,0,0 249,249,249 200,200,200 247,247,247 248,248,248 255,255,255 254,254,254 236,236,236 192,192,192 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 255,255,255 255,255,255 243,243,243 255,255,255 200,200,200 0,0,0 0,0,0 0,0,0 244,244,244 250,250,250 191,191,191 255,255,255 0,0,0 11,11,11 245,245,245 255,255,255 255,255,255 0,0,0 17,17,17 255,255,255 237,237,237 255,255,255 13,13,13 0,0,0 253,253,253 255,255,255 0,0,0 5,5,5 255,255,255 253,253,253 0,0,0 0,0,0 255,255,255 255,255,255 247,247,247 0,0,0 36,36,36 247,247,247 255,255,255 0,0,0 8,8,8 247,247,247 246,246,246 255,255,255 9,9,9 1,1,1 186,186,186 252,252,252 233,233,233 242,242,242 255,255,255 255,255,255 187,187,187 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +252,252,252 240,240,240 243,243,243 251,251,251 255,255,255 249,249,249 6,6,6 13,13,13 8,8,8 0,0,0 255,255,255 250,250,250 186,186,186 255,255,255 0,0,0 6,6,6 255,255,255 238,238,238 244,244,244 254,254,254 0,0,0 0,0,0 255,255,255 10,10,10 0,0,0 246,246,246 255,255,255 254,254,254 242,242,242 0,0,0 0,0,0 250,250,250 0,0,0 0,0,0 255,255,255 255,255,255 0,0,0 7,7,7 233,233,233 252,252,252 240,240,240 0,0,0 13,13,13 249,249,249 247,247,247 226,226,226 192,192,192 0,0,0 7,7,7 180,180,180 211,211,211 178,178,178 180,180,180 206,206,206 181,181,181 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 255,255,255 255,255,255 241,241,241 255,255,255 254,254,254 173,173,173 249,249,249 0,0,0 10,10,10 239,239,239 255,255,255 197,197,197 241,241,241 15,15,15 0,0,0 255,255,255 249,249,249 241,241,241 255,255,255 0,0,0 16,16,16 208,208,208 174,174,174 190,190,190 178,178,178 197,197,197 189,189,189 193,193,193 14,14,14 8,8,8 193,193,193 0,0,0 8,8,8 180,180,180 11,11,11 0,0,0 170,170,170 212,212,212 184,184,184 201,201,201 9,9,9 0,0,0 253,253,253 255,255,255 255,255,255 5,5,5 0,0,0 225,225,225 255,255,255 241,241,241 251,251,251 255,255,255 252,252,252 184,184,184 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 248,248,248 255,255,255 237,237,237 255,255,255 215,215,215 243,243,243 3,3,3 0,0,0 255,255,255 253,253,253 198,198,198 255,255,255 4,4,4 0,0,0 243,243,243 255,255,255 255,255,255 246,246,246 10,10,10 0,0,0 255,255,255 255,255,255 254,254,254 255,255,255 237,237,237 255,255,255 0,0,0 0,0,0 255,255,255 244,244,244 0,0,0 0,0,0 10,10,10 0,0,0 255,255,255 248,248,248 255,255,255 252,252,252 255,255,255 0,0,0 0,0,0 8,8,8 0,0,0 1,1,1 4,4,4 254,254,254 255,255,255 255,255,255 239,239,239 252,252,252 249,249,249 244,244,244 199,199,199 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +196,196,196 192,192,192 180,180,180 193,193,193 194,194,194 181,181,181 210,210,210 255,255,255 3,3,3 0,0,0 192,192,192 192,192,192 188,188,188 253,253,253 2,2,2 2,2,2 252,252,252 248,248,248 255,255,255 248,248,248 0,0,0 2,2,2 252,252,252 252,252,252 246,246,246 255,255,255 247,247,247 22,22,22 1,1,1 252,252,252 251,251,251 254,254,254 3,3,3 3,3,3 0,0,0 0,0,0 255,255,255 250,250,250 252,252,252 255,255,255 255,255,255 2,2,2 0,0,0 249,249,249 255,255,255 244,244,244 13,13,13 0,0,0 255,255,255 253,253,253 250,250,250 255,255,255 244,244,244 255,255,255 184,184,184 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 252,252,252 254,254,254 255,255,255 255,255,255 254,254,254 231,231,231 253,253,253 4,4,4 0,0,0 248,248,248 252,252,252 194,194,194 254,254,254 0,0,0 0,0,0 248,248,248 255,255,255 237,237,237 255,255,255 0,0,0 8,8,8 242,242,242 255,255,255 255,255,255 246,246,246 11,11,11 0,0,0 251,251,251 254,254,254 243,243,243 255,255,255 0,0,0 0,0,0 255,255,255 12,12,12 0,0,0 254,254,254 253,253,253 246,246,246 248,248,248 0,0,0 0,0,0 255,255,255 255,255,255 240,240,240 177,177,177 5,5,5 0,0,0 255,255,255 255,255,255 238,238,238 255,255,255 255,255,255 185,185,185 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +248,248,248 255,255,255 245,245,245 241,241,241 247,247,247 255,255,255 243,243,243 255,255,255 0,0,0 0,0,0 255,255,255 243,243,243 199,199,199 244,244,244 5,5,5 25,25,25 255,255,255 247,247,247 245,245,245 252,252,252 30,30,30 0,0,0 255,255,255 251,251,251 253,253,253 2,2,2 0,0,0 255,255,255 255,255,255 252,252,252 255,255,255 252,252,252 14,14,14 0,0,0 255,255,255 241,241,241 2,2,2 21,21,21 255,255,255 249,249,249 246,246,246 1,1,1 15,15,15 230,230,230 249,249,249 255,255,255 218,218,218 0,0,0 14,14,14 255,255,255 253,253,253 246,246,246 255,255,255 243,243,243 198,198,198 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +238,238,238 255,255,255 239,239,239 255,255,255 243,243,243 236,236,236 251,251,251 252,252,252 7,7,7 5,5,5 172,172,172 219,219,219 182,182,182 244,244,244 0,0,0 0,0,0 248,248,248 255,255,255 255,255,255 0,0,0 0,0,0 202,202,202 250,250,250 253,253,253 0,0,0 0,0,0 255,255,255 248,248,248 218,218,218 255,255,255 255,255,255 244,244,244 0,0,0 0,0,0 255,255,255 255,255,255 249,249,249 0,0,0 0,0,0 255,255,255 255,255,255 0,0,0 5,5,5 255,255,255 246,246,246 255,255,255 0,0,0 0,0,0 242,242,242 251,251,251 248,248,248 255,255,255 248,248,248 252,252,252 194,194,194 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 158,158,158 213,213,213 181,181,181 190,190,190 213,213,213 10,10,10 0,0,0 0,0,0 0,0,0 11,11,11 0,0,0 210,210,210 191,191,191 11,11,11 0,0,0 2,2,2 0,0,0 0,0,0 23,23,23 207,207,207 169,169,169 248,248,248 4,4,4 0,0,0 4,4,4 6,6,6 0,0,0 20,20,20 1,1,1 0,0,0 255,255,255 6,6,6 0,0,0 248,248,248 255,255,255 248,248,248 255,255,255 0,0,0 5,5,5 253,253,253 0,0,0 8,8,8 0,0,0 8,8,8 9,9,9 0,0,0 255,255,255 255,255,255 247,247,247 255,255,255 249,249,249 255,255,255 255,255,255 179,179,179 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 196,196,196 242,242,242 247,247,247 247,247,247 255,255,255 242,242,242 255,255,255 244,244,244 255,255,255 196,196,196 252,252,252 190,190,190 255,255,255 234,234,234 255,255,255 251,251,251 204,204,204 232,232,232 241,241,241 250,250,250 230,230,230 250,250,250 252,252,252 255,255,255 242,242,242 245,245,245 255,255,255 250,250,250 236,236,236 248,248,248 254,254,254 242,242,242 179,179,179 252,252,252 255,255,255 255,255,255 236,236,236 255,255,255 235,235,235 252,252,252 186,186,186 206,206,206 188,188,188 175,175,175 197,197,197 164,164,164 255,255,255 237,237,237 253,253,253 255,255,255 250,250,250 255,255,255 253,253,253 193,193,193 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +245,245,245 196,196,196 255,255,255 255,255,255 251,251,251 235,235,235 255,255,255 249,249,249 255,255,255 255,255,255 180,180,180 255,255,255 184,184,184 255,255,255 255,255,255 249,249,249 255,255,255 195,195,195 251,251,251 255,255,255 227,227,227 172,172,172 215,215,215 177,177,177 200,200,200 174,174,174 183,183,183 196,196,196 202,202,202 195,195,195 213,213,213 189,189,189 197,197,197 197,197,197 255,255,255 246,246,246 255,255,255 253,253,253 255,255,255 255,255,255 248,248,248 197,197,197 249,249,249 255,255,255 255,255,255 239,239,239 213,213,213 245,245,245 255,255,255 254,254,254 252,252,252 255,255,255 249,249,249 237,237,237 206,206,206 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 186,186,186 245,245,245 255,255,255 255,255,255 250,250,250 255,255,255 236,236,236 246,246,246 255,255,255 190,190,190 251,251,251 207,207,207 231,231,231 255,255,255 246,246,246 246,246,246 183,183,183 255,255,255 253,253,253 255,255,255 255,255,255 224,224,224 255,255,255 243,243,243 224,224,224 229,229,229 255,255,255 249,249,249 239,239,239 255,255,255 255,255,255 250,250,250 255,255,255 245,245,245 245,245,245 255,255,255 252,252,252 238,238,238 255,255,255 255,255,255 176,176,176 255,255,255 251,251,251 245,245,245 255,255,255 187,187,187 252,252,252 252,252,252 245,245,245 255,255,255 245,245,245 255,255,255 255,255,255 189,189,189 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input17.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input17.jpg new file mode 100644 index 0000000..e3bcd41 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input17.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input17.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input17.txt new file mode 100644 index 0000000..b3d6f4c --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input17.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +254,254,254 255,255,255 245,245,245 255,255,255 249,249,249 255,255,255 204,204,204 248,248,248 243,243,243 255,255,255 246,246,246 189,189,189 207,207,207 255,255,255 251,251,251 252,252,252 255,255,255 244,244,244 255,255,255 249,249,249 255,255,255 243,243,243 255,255,255 255,255,255 253,253,253 250,250,250 255,255,255 255,255,255 255,255,255 196,196,196 247,247,247 196,196,196 255,255,255 200,200,200 246,246,246 250,250,250 248,248,248 255,255,255 255,255,255 255,255,255 249,249,249 255,255,255 241,241,241 255,255,255 245,245,245 179,179,179 254,254,254 255,255,255 201,201,201 246,246,246 242,242,242 255,255,255 255,255,255 247,247,247 185,185,185 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 241,241,241 255,255,255 228,228,228 255,255,255 237,237,237 183,183,183 245,245,245 255,255,255 242,242,242 255,255,255 187,187,187 172,172,172 255,255,255 242,242,242 255,255,255 255,255,255 255,255,255 238,238,238 255,255,255 255,255,255 248,248,248 255,255,255 242,242,242 244,244,244 255,255,255 238,238,238 255,255,255 223,223,223 188,188,188 231,231,231 188,188,188 243,243,243 177,177,177 255,255,255 250,250,250 250,250,250 255,255,255 237,237,237 250,250,250 255,255,255 231,231,231 251,251,251 255,255,255 254,254,254 197,197,197 255,255,255 231,231,231 196,196,196 255,255,255 255,255,255 254,254,254 249,249,249 250,250,250 193,193,193 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +250,250,250 255,255,255 255,255,255 245,245,245 255,255,255 255,255,255 161,161,161 221,221,221 193,193,193 198,198,198 181,181,181 190,190,190 197,197,197 255,255,255 255,255,255 235,235,235 241,241,241 228,228,228 255,255,255 254,254,254 230,230,230 255,255,255 255,255,255 253,253,253 255,255,255 255,255,255 243,243,243 255,255,255 255,255,255 192,192,192 244,244,244 231,231,231 251,251,251 214,214,214 247,247,247 255,255,255 253,253,253 247,247,247 255,255,255 254,254,254 255,255,255 250,250,250 255,255,255 241,241,241 255,255,255 199,199,199 249,249,249 255,255,255 171,171,171 240,240,240 255,255,255 255,255,255 255,255,255 255,255,255 194,194,194 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 238,238,238 245,245,245 249,249,249 255,255,255 190,190,190 11,11,11 0,0,0 9,9,9 8,8,8 230,230,230 204,204,204 243,243,243 221,221,221 255,255,255 255,255,255 14,14,14 0,0,0 249,249,249 253,253,253 255,255,255 254,254,254 0,0,0 0,0,0 0,0,0 5,5,5 4,4,4 0,0,0 189,189,189 251,251,251 255,255,255 5,5,5 0,0,0 197,197,197 203,203,203 193,193,193 171,171,171 4,4,4 0,0,0 178,178,178 189,189,189 190,190,190 11,11,11 0,0,0 0,0,0 0,0,0 241,241,241 227,227,227 255,255,255 248,248,248 245,245,245 236,236,236 250,250,250 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 255,255,255 255,255,255 255,255,255 244,244,244 255,255,255 0,0,0 0,0,0 239,239,239 253,253,253 16,16,16 0,0,0 196,196,196 255,255,255 246,246,246 255,255,255 0,0,0 0,0,0 0,0,0 0,0,0 255,255,255 242,242,242 245,245,245 20,20,20 3,3,3 243,243,243 255,255,255 245,245,245 0,0,0 0,0,0 255,255,255 233,233,233 14,14,14 0,0,0 255,255,255 245,245,245 231,231,231 223,223,223 0,0,0 9,9,9 255,255,255 255,255,255 5,5,5 0,0,0 255,255,255 255,255,255 12,12,12 10,10,10 155,155,155 250,250,250 245,245,245 255,255,255 253,253,253 255,255,255 187,187,187 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 246,246,246 240,240,240 254,254,254 255,255,255 10,10,10 0,0,0 255,255,255 255,255,255 239,239,239 255,255,255 0,0,0 1,1,1 233,233,233 248,248,248 0,0,0 3,3,3 253,253,253 255,255,255 0,0,0 0,0,0 250,250,250 247,247,247 9,9,9 0,0,0 248,248,248 255,255,255 234,234,234 255,255,255 2,2,2 0,0,0 255,255,255 0,0,0 3,3,3 246,246,246 255,255,255 251,251,251 207,207,207 2,2,2 0,0,0 250,250,250 0,0,0 10,10,10 255,255,255 247,247,247 241,241,241 178,178,178 6,6,6 19,19,19 203,203,203 195,195,195 196,196,196 192,192,192 220,220,220 185,185,185 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 255,255,255 254,254,254 247,247,247 242,242,242 208,208,208 244,244,244 245,245,245 255,255,255 238,238,238 3,3,3 2,2,2 255,255,255 0,0,0 11,11,11 255,255,255 254,254,254 254,254,254 254,254,254 0,0,0 9,9,9 196,196,196 0,0,0 0,0,0 207,207,207 173,173,173 193,193,193 5,5,5 0,0,0 197,197,197 178,178,178 1,1,1 2,2,2 196,196,196 197,197,197 200,200,200 176,176,176 8,8,8 6,6,6 195,195,195 2,2,2 0,0,0 255,255,255 251,251,251 252,252,252 232,232,232 0,0,0 0,0,0 250,250,250 243,243,243 255,255,255 246,246,246 244,244,244 197,197,197 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 +252,252,252 255,255,255 255,255,255 249,249,249 254,254,254 255,255,255 184,184,184 254,254,254 253,253,253 252,252,252 6,6,6 3,3,3 189,189,189 251,251,251 7,7,7 0,0,0 255,255,255 249,249,249 252,252,252 255,255,255 0,0,0 0,0,0 255,255,255 7,7,7 5,5,5 0,0,0 10,10,10 8,8,8 0,0,0 249,249,249 255,255,255 254,254,254 1,1,1 1,1,1 0,0,0 0,0,0 11,11,11 0,0,0 8,8,8 0,0,0 255,255,255 0,0,0 8,8,8 245,245,245 255,255,255 248,248,248 176,176,176 7,7,7 0,0,0 255,255,255 234,234,234 255,255,255 255,255,255 239,239,239 195,195,195 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +195,195,195 177,177,177 200,200,200 190,190,190 193,193,193 198,198,198 200,200,200 255,255,255 188,188,188 0,0,0 7,7,7 178,178,178 204,204,204 254,254,254 1,1,1 0,0,0 252,252,252 255,255,255 232,232,232 255,255,255 8,8,8 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 253,253,253 255,255,255 0,0,0 0,0,0 253,253,253 250,250,250 6,6,6 0,0,0 255,255,255 248,248,248 242,242,242 255,255,255 0,0,0 2,2,2 254,254,254 0,0,0 0,0,0 255,255,255 246,246,246 249,249,249 203,203,203 0,0,0 0,0,0 255,255,255 248,248,248 255,255,255 253,253,253 250,250,250 201,201,201 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 255,255,255 238,238,238 255,255,255 255,255,255 228,228,228 252,252,252 233,233,233 0,0,0 0,0,0 247,247,247 253,253,253 176,176,176 255,255,255 0,0,0 21,21,21 238,238,238 255,255,255 255,255,255 248,248,248 0,0,0 10,10,10 245,245,245 0,0,0 4,4,4 255,255,255 240,240,240 245,245,245 255,255,255 0,0,0 11,11,11 255,255,255 0,0,0 9,9,9 240,240,240 255,255,255 252,252,252 239,239,239 17,17,17 0,0,0 255,255,255 11,11,11 0,0,0 252,252,252 10,10,10 0,0,0 195,195,195 0,0,0 2,2,2 255,255,255 255,255,255 243,243,243 252,252,252 255,255,255 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 238,238,238 244,244,244 255,255,255 233,233,233 255,255,255 255,255,255 7,7,7 6,6,6 255,255,255 255,255,255 245,245,245 201,201,201 255,255,255 255,255,255 0,0,0 9,9,9 236,236,236 250,250,250 15,15,15 0,0,0 185,185,185 248,248,248 0,0,0 0,0,0 255,255,255 255,255,255 247,247,247 255,255,255 6,6,6 0,0,0 250,250,250 1,1,1 0,0,0 255,255,255 255,255,255 250,250,250 255,255,255 2,2,2 2,2,2 248,248,248 0,0,0 6,6,6 255,255,255 255,255,255 10,10,10 6,6,6 0,0,0 0,0,0 255,255,255 250,250,250 255,255,255 255,255,255 245,245,245 201,201,201 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 246,246,246 255,255,255 249,249,249 238,238,238 240,240,240 0,0,0 0,0,0 187,187,187 182,182,182 183,183,183 222,222,222 195,195,195 235,235,235 255,255,255 255,255,255 3,3,3 2,2,2 0,0,0 0,0,0 249,249,249 193,193,193 255,255,255 6,6,6 5,5,5 251,251,251 250,250,250 246,246,246 0,0,0 0,0,0 243,243,243 255,255,255 6,6,6 2,2,2 250,250,250 251,251,251 244,244,244 246,246,246 5,5,5 0,0,0 255,255,255 186,186,186 5,5,5 0,0,0 254,254,254 252,252,252 3,3,3 12,12,12 255,255,255 255,255,255 241,241,241 255,255,255 244,244,244 255,255,255 201,201,201 245,245,245 255,255,255 255,255,255 255,255,255 255,255,255 +245,245,245 186,186,186 203,203,203 188,188,188 213,213,213 5,5,5 0,0,0 4,4,4 0,0,0 5,5,5 0,0,0 0,0,0 3,3,3 175,175,175 191,191,191 179,179,179 194,194,194 0,0,0 0,0,0 194,194,194 191,191,191 181,181,181 250,250,250 0,0,0 0,0,0 17,17,17 4,4,4 0,0,0 8,8,8 255,255,255 255,255,255 250,250,250 5,5,5 0,0,0 255,255,255 255,255,255 255,255,255 255,255,255 0,0,0 0,0,0 248,248,248 190,190,190 255,255,255 0,0,0 5,5,5 15,15,15 0,0,0 246,246,246 0,0,0 248,248,248 255,255,255 255,255,255 255,255,255 239,239,239 191,191,191 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 198,198,198 235,235,235 238,238,238 248,248,248 241,241,241 252,252,252 250,250,250 255,255,255 247,247,247 196,196,196 255,255,255 195,195,195 255,255,255 255,255,255 255,255,255 255,255,255 206,206,206 247,247,247 243,243,243 254,254,254 230,230,230 230,230,230 252,252,252 255,255,255 226,226,226 255,255,255 247,247,247 233,233,233 255,255,255 252,252,252 235,235,235 227,227,227 209,209,209 243,243,243 242,242,242 243,243,243 255,255,255 246,246,246 255,255,255 255,255,255 164,164,164 192,192,192 213,213,213 183,183,183 183,183,183 188,188,188 253,253,253 255,255,255 252,252,252 255,255,255 255,255,255 245,245,245 255,255,255 191,191,191 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 200,200,200 251,251,251 255,255,255 250,250,250 245,245,245 255,255,255 255,255,255 255,255,255 237,237,237 206,206,206 243,243,243 188,188,188 255,255,255 234,234,234 243,243,243 231,231,231 217,217,217 244,244,244 255,255,255 234,234,234 188,188,188 183,183,183 203,203,203 210,210,210 153,153,153 203,203,203 197,197,197 213,213,213 179,179,179 199,199,199 207,207,207 205,205,205 202,202,202 239,239,239 255,255,255 255,255,255 255,255,255 247,247,247 246,246,246 251,251,251 197,197,197 255,255,255 244,244,244 255,255,255 250,250,250 208,208,208 250,250,250 252,252,252 255,255,255 250,250,250 255,255,255 250,250,250 243,243,243 203,203,203 245,245,245 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 173,173,173 251,251,251 255,255,255 255,255,255 252,252,252 255,255,255 243,243,243 255,255,255 251,251,251 190,190,190 255,255,255 201,201,201 234,234,234 255,255,255 254,254,254 255,255,255 190,190,190 255,255,255 253,253,253 255,255,255 255,255,255 248,248,248 248,248,248 236,236,236 230,230,230 230,230,230 255,255,255 253,253,253 236,236,236 255,255,255 248,248,248 255,255,255 247,247,247 250,250,250 255,255,255 251,251,251 251,251,251 255,255,255 255,255,255 249,249,249 196,196,196 252,252,252 249,249,249 250,250,250 255,255,255 170,170,170 255,255,255 254,254,254 253,253,253 255,255,255 252,252,252 250,250,250 255,255,255 191,191,191 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input18.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input18.jpg new file mode 100644 index 0000000..5cb6a60 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input18.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input18.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input18.txt new file mode 100644 index 0000000..ed494f7 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input18.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 252,252,252 247,247,247 255,255,255 254,254,254 255,255,255 198,198,198 249,249,249 252,252,252 255,255,255 255,255,255 179,179,179 195,195,195 248,248,248 255,255,255 254,254,254 255,255,255 244,244,244 255,255,255 249,249,249 255,255,255 243,243,243 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 255,255,255 249,249,249 200,200,200 228,228,228 203,203,203 255,255,255 185,185,185 253,253,253 254,254,254 253,253,253 245,245,245 255,255,255 255,255,255 255,255,255 244,244,244 255,255,255 255,255,255 247,247,247 190,190,190 255,255,255 250,250,250 193,193,193 252,252,252 249,249,249 253,253,253 255,255,255 247,247,247 182,182,182 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +246,246,246 255,255,255 255,255,255 238,238,238 251,251,251 250,250,250 167,167,167 255,255,255 247,247,247 255,255,255 246,246,246 201,201,201 206,206,206 247,247,247 255,255,255 241,241,241 255,255,255 255,255,255 238,238,238 255,255,255 255,255,255 248,248,248 255,255,255 242,242,242 236,236,236 255,255,255 237,237,237 246,246,246 254,254,254 180,180,180 219,219,219 192,192,192 227,227,227 190,190,190 252,252,252 246,246,246 254,254,254 255,255,255 255,255,255 238,238,238 250,250,250 255,255,255 243,243,243 250,250,250 251,251,251 198,198,198 255,255,255 242,242,242 187,187,187 255,255,255 252,252,252 255,255,255 252,252,252 246,246,246 191,191,191 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 240,240,240 246,246,246 255,255,255 255,255,255 255,255,255 172,172,172 219,219,219 183,183,183 187,187,187 196,196,196 174,174,174 166,166,166 255,255,255 255,255,255 242,242,242 241,241,241 228,228,228 255,255,255 254,254,254 230,230,230 255,255,255 255,255,255 253,253,253 255,255,255 245,245,245 246,246,246 255,255,255 248,248,248 180,180,180 255,255,255 234,234,234 255,255,255 204,204,204 251,251,251 251,251,251 255,255,255 244,244,244 241,241,241 255,255,255 255,255,255 255,255,255 226,226,226 255,255,255 255,255,255 172,172,172 253,253,253 255,255,255 186,186,186 255,255,255 227,227,227 255,255,255 255,255,255 248,248,248 197,197,197 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 249,249,249 255,255,255 255,255,255 237,237,237 236,236,236 206,206,206 0,0,0 15,15,15 0,0,0 5,5,5 255,255,255 203,203,203 250,250,250 226,226,226 255,255,255 255,255,255 14,14,14 0,0,0 249,249,249 253,253,253 255,255,255 254,254,254 0,0,0 5,5,5 233,233,233 255,255,255 231,231,231 250,250,250 12,12,12 0,0,0 255,255,255 221,221,221 181,181,181 222,222,222 0,0,0 0,0,0 202,202,202 175,175,175 192,192,192 172,172,172 7,7,7 8,8,8 193,193,193 197,197,197 208,208,208 255,255,255 0,0,0 0,0,0 250,250,250 255,255,255 255,255,255 225,225,225 254,254,254 204,204,204 239,239,239 255,255,255 255,255,255 255,255,255 255,255,255 +237,237,237 255,255,255 244,244,244 255,255,255 255,255,255 255,255,255 0,0,0 0,0,0 232,232,232 252,252,252 0,0,0 6,6,6 187,187,187 255,255,255 247,247,247 245,245,245 0,0,0 0,0,0 0,0,0 0,0,0 255,255,255 242,242,242 245,245,245 20,20,20 0,0,0 245,245,245 255,255,255 242,242,242 255,255,255 1,1,1 0,0,0 255,255,255 255,255,255 253,253,253 0,0,0 0,0,0 5,5,5 0,0,0 250,250,250 255,255,255 249,249,249 13,13,13 0,0,0 240,240,240 255,255,255 237,237,237 240,240,240 9,9,9 5,5,5 242,242,242 238,238,238 255,255,255 255,255,255 255,255,255 183,183,183 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 255,255,255 255,255,255 253,253,253 0,0,0 10,10,10 255,255,255 255,255,255 255,255,255 255,255,255 0,0,0 3,3,3 251,251,251 253,253,253 8,8,8 3,3,3 253,253,253 255,255,255 0,0,0 0,0,0 250,250,250 247,247,247 9,9,9 5,5,5 255,255,255 245,245,245 243,243,243 243,243,243 0,0,0 14,14,14 251,251,251 244,244,244 0,0,0 5,5,5 251,251,251 255,255,255 6,6,6 0,0,0 250,250,250 254,254,254 0,0,0 3,3,3 255,255,255 255,255,255 250,250,250 209,209,209 0,0,0 5,5,5 211,211,211 192,192,192 172,172,172 186,186,186 218,218,218 178,178,178 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 249,249,249 242,242,242 255,255,255 0,0,0 0,0,0 255,255,255 244,244,244 250,250,250 255,255,255 5,5,5 0,0,0 255,255,255 0,0,0 4,4,4 255,255,255 254,254,254 254,254,254 254,254,254 0,0,0 9,9,9 196,196,196 0,0,0 0,0,0 184,184,184 188,188,188 205,205,205 186,186,186 9,9,9 0,0,0 192,192,192 1,1,1 0,0,0 191,191,191 202,202,202 194,194,194 188,188,188 5,5,5 0,0,0 189,189,189 189,189,189 0,0,0 6,6,6 247,247,247 250,250,250 1,1,1 0,0,0 228,228,228 255,255,255 236,236,236 255,255,255 255,255,255 245,245,245 176,176,176 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 251,251,251 255,255,255 255,255,255 236,236,236 14,14,14 0,0,0 250,250,250 251,251,251 255,255,255 254,254,254 0,0,0 10,10,10 255,255,255 0,0,0 4,4,4 255,255,255 249,249,249 252,252,252 255,255,255 0,0,0 0,0,0 255,255,255 7,7,7 0,0,0 1,1,1 4,4,4 4,4,4 4,4,4 0,0,0 6,6,6 249,249,249 6,6,6 0,0,0 255,255,255 255,255,255 247,247,247 253,253,253 1,1,1 0,0,0 255,255,255 197,197,197 0,0,0 9,9,9 248,248,248 255,255,255 0,0,0 7,7,7 255,255,255 255,255,255 246,246,246 255,255,255 246,246,246 246,246,246 204,204,204 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +190,190,190 196,196,196 179,179,179 201,201,201 195,195,195 0,0,0 7,7,7 255,255,255 181,181,181 201,201,201 190,190,190 0,0,0 1,1,1 246,246,246 0,0,0 0,0,0 239,239,239 255,255,255 246,246,246 255,255,255 0,0,0 6,6,6 244,244,244 0,0,0 2,2,2 250,250,250 251,251,251 249,249,249 255,255,255 5,5,5 0,0,0 255,255,255 5,5,5 0,0,0 252,252,252 255,255,255 254,254,254 249,249,249 0,0,0 2,2,2 247,247,247 190,190,190 0,0,0 2,2,2 255,255,255 244,244,244 11,11,11 0,0,0 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 249,249,249 238,238,238 255,255,255 0,0,0 0,0,0 255,255,255 188,188,188 233,233,233 255,255,255 0,0,0 12,12,12 248,248,248 6,6,6 0,0,0 16,16,16 0,0,0 0,0,0 0,0,0 5,5,5 0,0,0 244,244,244 12,12,12 3,3,3 244,244,244 255,255,255 255,255,255 242,242,242 1,1,1 14,14,14 252,252,252 0,0,0 0,0,0 255,255,255 242,242,242 243,243,243 255,255,255 14,14,14 0,0,0 255,255,255 207,207,207 249,249,249 0,0,0 2,2,2 17,17,17 0,0,0 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 236,236,236 255,255,255 251,251,251 252,252,252 0,0,0 0,0,0 252,252,252 207,207,207 255,255,255 255,255,255 0,0,0 0,0,0 255,255,255 0,0,0 6,6,6 255,255,255 253,253,253 255,255,255 251,251,251 4,4,4 1,1,1 234,234,234 7,7,7 0,0,0 255,255,255 250,250,250 241,241,241 255,255,255 3,3,3 0,0,0 255,255,255 255,255,255 0,0,0 8,8,8 253,253,253 254,254,254 0,0,0 9,9,9 239,239,239 250,250,250 182,182,182 241,241,241 19,19,19 0,0,0 0,0,0 14,14,14 238,238,238 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 253,253,253 251,251,251 244,244,244 251,251,251 255,255,255 0,0,0 8,8,8 176,176,176 171,171,171 8,8,8 10,10,10 192,192,192 232,232,232 1,1,1 1,1,1 234,234,234 255,255,255 249,249,249 249,249,249 0,0,0 7,7,7 255,255,255 0,0,0 4,4,4 252,252,252 251,251,251 254,254,254 252,252,252 0,0,0 0,0,0 255,255,255 255,255,255 181,181,181 4,4,4 0,0,0 10,10,10 2,2,2 247,247,247 255,255,255 250,250,250 178,178,178 255,255,255 238,238,238 6,6,6 0,0,0 209,209,209 248,248,248 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +242,242,242 194,194,194 209,209,209 195,195,195 188,188,188 179,179,179 213,213,213 0,0,0 11,11,11 1,1,1 10,10,10 236,236,236 185,185,185 197,197,197 3,3,3 0,0,0 208,208,208 175,175,175 212,212,212 200,200,200 7,7,7 0,0,0 250,250,250 6,6,6 0,0,0 239,239,239 255,255,255 249,249,249 238,238,238 17,17,17 18,18,18 239,239,239 255,255,255 177,177,177 255,255,255 0,0,0 4,4,4 255,255,255 243,243,243 255,255,255 255,255,255 187,187,187 255,255,255 248,248,248 0,0,0 5,5,5 185,185,185 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 194,194,194 232,232,232 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 242,242,242 255,255,255 181,181,181 247,247,247 211,211,211 251,251,251 251,251,251 255,255,255 236,236,236 225,225,225 230,230,230 246,246,246 255,255,255 215,215,215 251,251,251 249,249,249 255,255,255 255,255,255 249,249,249 255,255,255 250,250,250 223,223,223 255,255,255 255,255,255 246,246,246 208,208,208 242,242,242 251,251,251 255,255,255 244,244,244 255,255,255 253,253,253 240,240,240 173,173,173 199,199,199 168,168,168 196,196,196 216,216,216 163,163,163 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 191,191,191 255,255,255 237,237,237 251,251,251 239,239,239 241,241,241 255,255,255 255,255,255 238,238,238 186,186,186 255,255,255 193,193,193 255,255,255 232,232,232 254,254,254 255,255,255 193,193,193 255,255,255 243,243,243 255,255,255 190,190,190 171,171,171 205,205,205 186,186,186 164,164,164 199,199,199 207,207,207 203,203,203 197,197,197 205,205,205 179,179,179 201,201,201 187,187,187 252,252,252 247,247,247 255,255,255 255,255,255 245,245,245 248,248,248 255,255,255 201,201,201 255,255,255 248,248,248 255,255,255 246,246,246 187,187,187 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 162,162,162 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 242,242,242 255,255,255 247,247,247 199,199,199 250,250,250 198,198,198 220,220,220 255,255,255 244,244,244 255,255,255 186,186,186 246,246,246 255,255,255 242,242,242 252,252,252 255,255,255 242,242,242 255,255,255 205,205,205 244,244,244 253,253,253 249,249,249 242,242,242 250,250,250 255,255,255 251,251,251 255,255,255 253,253,253 248,248,248 244,244,244 251,251,251 255,255,255 253,253,253 255,255,255 191,191,191 244,244,244 254,254,254 252,252,252 252,252,252 192,192,192 251,251,251 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input19.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input19.jpg new file mode 100644 index 0000000..382821e Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input19.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input19.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input19.txt new file mode 100644 index 0000000..2c88491 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input19.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 255,255,255 253,253,253 244,244,244 246,246,246 255,255,255 197,197,197 253,253,253 255,255,255 253,253,253 255,255,255 168,168,168 199,199,199 255,255,255 255,255,255 255,255,255 246,246,246 255,255,255 237,237,237 255,255,255 247,247,247 255,255,255 255,255,255 248,248,248 255,255,255 246,246,246 254,254,254 255,255,255 253,253,253 191,191,191 242,242,242 195,195,195 255,255,255 184,184,184 241,241,241 252,252,252 254,254,254 255,255,255 243,243,243 255,255,255 250,250,250 253,253,253 255,255,255 250,250,250 245,245,245 172,172,172 255,255,255 246,246,246 192,192,192 255,255,255 251,251,251 249,249,249 255,255,255 250,250,250 181,181,181 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 248,248,248 185,185,185 241,241,241 237,237,237 244,244,244 255,255,255 211,211,211 183,183,183 239,239,239 255,255,255 245,245,245 255,255,255 233,233,233 244,244,244 254,254,254 241,241,241 246,246,246 247,247,247 255,255,255 236,236,236 255,255,255 245,245,245 252,252,252 255,255,255 183,183,183 216,216,216 202,202,202 231,231,231 193,193,193 253,253,253 248,248,248 240,240,240 250,250,250 250,250,250 252,252,252 255,255,255 240,240,240 232,232,232 255,255,255 255,255,255 199,199,199 255,255,255 253,253,253 192,192,192 255,255,255 255,255,255 253,253,253 255,255,255 253,253,253 184,184,184 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 251,251,251 255,255,255 255,255,255 238,238,238 255,255,255 171,171,171 219,219,219 194,194,194 218,218,218 177,177,177 195,195,195 200,200,200 250,250,250 255,255,255 255,255,255 232,232,232 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 251,251,251 244,244,244 255,255,255 180,180,180 248,248,248 228,228,228 247,247,247 207,207,207 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 251,251,251 255,255,255 254,254,254 245,245,245 255,255,255 242,242,242 192,192,192 255,255,255 254,254,254 179,179,179 247,247,247 252,252,252 251,251,251 255,255,255 255,255,255 194,194,194 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 241,241,241 240,240,240 255,255,255 0,0,0 0,0,0 18,18,18 5,5,5 0,0,0 12,12,12 0,0,0 182,182,182 255,255,255 251,251,251 0,0,0 0,0,0 0,0,0 2,2,2 0,0,0 18,18,18 248,248,248 236,236,236 241,241,241 241,241,241 0,0,0 3,3,3 22,22,22 0,0,0 195,195,195 255,255,255 255,255,255 13,13,13 0,0,0 209,209,209 188,188,188 185,185,185 197,197,197 0,0,0 0,0,0 178,178,178 0,0,0 15,15,15 5,5,5 0,0,0 3,3,3 0,0,0 0,0,0 203,203,203 255,255,255 255,255,255 249,249,249 246,246,246 250,250,250 191,191,191 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 241,241,241 255,255,255 255,255,255 243,243,243 0,0,0 0,0,0 250,250,250 242,242,242 255,255,255 255,255,255 241,241,241 214,214,214 242,242,242 254,254,254 240,240,240 255,255,255 0,0,0 15,15,15 255,255,255 217,217,217 255,255,255 255,255,255 255,255,255 2,2,2 7,7,7 255,255,255 250,250,250 0,0,0 5,5,5 255,255,255 234,234,234 2,2,2 5,5,5 250,250,250 255,255,255 239,239,239 191,191,191 0,0,0 2,2,2 250,250,250 4,4,4 5,5,5 227,227,227 255,255,255 255,255,255 255,255,255 253,253,253 182,182,182 237,237,237 248,248,248 255,255,255 255,255,255 255,255,255 192,192,192 243,243,243 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 248,248,248 255,255,255 239,239,239 255,255,255 2,2,2 15,15,15 250,250,250 250,250,250 255,255,255 233,233,233 255,255,255 194,194,194 241,241,241 246,246,246 255,255,255 242,242,242 19,19,19 0,0,0 255,255,255 255,255,255 246,246,246 251,251,251 0,0,0 1,1,1 250,250,250 249,249,249 237,237,237 251,251,251 2,2,2 0,0,0 255,255,255 0,0,0 13,13,13 245,245,245 255,255,255 247,247,247 199,199,199 6,6,6 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 252,252,252 244,244,244 178,178,178 195,195,195 196,196,196 209,209,209 185,185,185 180,180,180 184,184,184 210,210,210 184,184,184 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 246,246,246 255,255,255 255,255,255 234,234,234 0,0,0 0,0,0 249,249,249 0,0,0 4,4,4 17,17,17 245,245,245 186,186,186 255,255,255 255,255,255 251,251,251 252,252,252 0,0,0 0,0,0 250,250,250 255,255,255 180,180,180 215,215,215 203,203,203 0,0,0 12,12,12 189,189,189 199,199,199 4,4,4 0,0,0 222,222,222 178,178,178 204,204,204 0,0,0 5,5,5 197,197,197 207,207,207 0,0,0 0,0,0 191,191,191 187,187,187 0,0,0 4,4,4 237,237,237 255,255,255 255,255,255 211,211,211 250,250,250 243,243,243 255,255,255 247,247,247 255,255,255 255,255,255 247,247,247 186,186,186 240,240,240 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 255,255,255 239,239,239 240,240,240 255,255,255 0,0,0 0,0,0 2,2,2 255,255,255 249,249,249 0,0,0 0,0,0 200,200,200 255,255,255 249,249,249 240,240,240 255,255,255 2,2,2 0,0,0 253,253,253 249,249,249 205,205,205 240,240,240 255,255,255 255,255,255 0,0,0 0,0,0 0,0,0 1,1,1 255,255,255 249,249,249 254,254,254 251,251,251 0,0,0 13,13,13 245,245,245 252,252,252 0,0,0 0,0,0 255,255,255 255,255,255 0,0,0 7,7,7 1,1,1 0,0,0 0,0,0 8,8,8 252,252,252 255,255,255 255,255,255 239,239,239 255,255,255 251,251,251 248,248,248 197,197,197 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +196,196,196 191,191,191 172,172,172 208,208,208 181,181,181 194,194,194 202,202,202 246,246,246 185,185,185 191,191,191 189,189,189 0,0,0 0,0,0 254,254,254 255,255,255 243,243,243 244,244,244 9,9,9 0,0,0 241,241,241 246,246,246 207,207,207 255,255,255 241,241,241 0,0,0 0,0,0 255,255,255 251,251,251 11,11,11 0,0,0 255,255,255 255,255,255 255,255,255 1,1,1 10,10,10 253,253,253 246,246,246 10,10,10 5,5,5 253,253,253 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 245,245,245 193,193,193 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 254,254,254 255,255,255 246,246,246 255,255,255 230,230,230 252,252,252 255,255,255 196,196,196 255,255,255 247,247,247 7,7,7 21,21,21 230,230,230 251,251,251 255,255,255 255,255,255 1,1,1 0,0,0 255,255,255 254,254,254 181,181,181 240,240,240 8,8,8 8,8,8 255,255,255 237,237,237 253,253,253 255,255,255 0,0,0 7,7,7 242,242,242 240,240,240 190,190,190 0,0,0 3,3,3 5,5,5 0,0,0 238,238,238 255,255,255 247,247,247 2,2,2 21,21,21 237,237,237 255,255,255 247,247,247 209,209,209 239,239,239 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +242,242,242 247,247,247 243,243,243 237,237,237 255,255,255 8,8,8 0,0,0 255,255,255 184,184,184 248,248,248 255,255,255 0,0,0 2,2,2 255,255,255 255,255,255 231,231,231 255,255,255 3,3,3 0,0,0 255,255,255 237,237,237 197,197,197 255,255,255 1,1,1 5,5,5 239,239,239 255,255,255 255,255,255 234,234,234 21,21,21 6,6,6 255,255,255 255,255,255 196,196,196 0,0,0 4,4,4 7,7,7 2,2,2 253,253,253 254,254,254 254,254,254 0,0,0 0,0,0 255,255,255 252,252,252 255,255,255 194,194,194 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 255,255,255 254,254,254 230,230,230 255,255,255 8,8,8 0,0,0 202,202,202 187,187,187 0,0,0 10,10,10 183,183,183 236,236,236 234,234,234 255,255,255 245,245,245 0,0,0 0,0,0 255,255,255 249,249,249 210,210,210 243,243,243 250,250,250 2,2,2 5,5,5 255,255,255 242,242,242 6,6,6 0,0,0 255,255,255 243,243,243 247,247,247 183,183,183 244,244,244 0,0,0 1,1,1 246,246,246 255,255,255 251,251,251 255,255,255 6,6,6 7,7,7 255,255,255 255,255,255 255,255,255 184,184,184 251,251,251 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +238,238,238 183,183,183 190,190,190 186,186,186 208,208,208 188,188,188 214,214,214 0,0,0 15,15,15 0,0,0 0,0,0 236,236,236 204,204,204 197,197,197 196,196,196 0,0,0 0,0,0 5,5,5 5,5,5 0,0,0 0,0,0 179,179,179 245,245,245 246,246,246 237,237,237 21,21,21 0,0,0 0,0,0 4,4,4 255,255,255 255,255,255 255,255,255 255,255,255 181,181,181 252,252,252 3,3,3 6,6,6 245,245,245 249,249,249 255,255,255 239,239,239 14,14,14 0,0,0 0,0,0 0,0,0 0,0,0 0,0,0 18,18,18 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 196,196,196 238,238,238 247,247,247 255,255,255 249,249,249 244,244,244 253,253,253 250,250,250 248,248,248 209,209,209 255,255,255 194,194,194 255,255,255 255,255,255 255,255,255 247,247,247 204,204,204 246,246,246 255,255,255 255,255,255 225,225,225 252,252,252 255,255,255 255,255,255 243,243,243 255,255,255 254,254,254 255,255,255 240,240,240 252,252,252 251,251,251 223,223,223 213,213,213 255,255,255 246,246,246 247,247,247 255,255,255 255,255,255 231,231,231 255,255,255 162,162,162 201,201,201 185,185,185 191,191,191 209,209,209 200,200,200 233,233,233 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 177,177,177 255,255,255 247,247,247 254,254,254 247,247,247 250,250,250 255,255,255 254,254,254 255,255,255 186,186,186 253,253,253 181,181,181 239,239,239 255,255,255 234,234,234 255,255,255 192,192,192 246,246,246 255,255,255 246,246,246 175,175,175 189,189,189 171,171,171 192,192,192 167,167,167 201,201,201 190,190,190 204,204,204 201,201,201 192,192,192 193,193,193 206,206,206 179,179,179 247,247,247 251,251,251 253,253,253 255,255,255 248,248,248 255,255,255 253,253,253 201,201,201 241,241,241 255,255,255 234,234,234 246,246,246 186,186,186 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 177,177,177 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 242,242,242 255,255,255 248,248,248 202,202,202 243,243,243 209,209,209 242,242,242 239,239,239 255,255,255 252,252,252 194,194,194 254,254,254 255,255,255 250,250,250 254,254,254 254,254,254 255,255,255 249,249,249 214,214,214 245,245,245 255,255,255 242,242,242 244,244,244 255,255,255 255,255,255 252,252,252 254,254,254 255,255,255 255,255,255 242,242,242 250,250,250 255,255,255 253,253,253 246,246,246 197,197,197 252,252,252 250,250,250 255,255,255 253,253,253 188,188,188 252,252,252 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input20.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input20.jpg new file mode 100644 index 0000000..a9f696d Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input20.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input20.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input20.txt new file mode 100644 index 0000000..da0a134 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input20.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +248,248,248 254,254,254 255,255,255 255,255,255 255,255,255 246,246,246 197,197,197 255,255,255 245,245,245 255,255,255 242,242,242 187,187,187 195,195,195 247,247,247 255,255,255 246,246,246 255,255,255 255,255,255 246,246,246 255,255,255 255,255,255 233,233,233 255,255,255 251,251,251 255,255,255 252,252,252 247,247,247 254,254,254 255,255,255 194,194,194 233,233,233 201,201,201 255,255,255 181,181,181 255,255,255 247,247,247 244,244,244 247,247,247 255,255,255 253,253,253 250,250,250 253,253,253 255,255,255 250,250,250 245,245,245 172,172,172 255,255,255 246,246,246 192,192,192 255,255,255 251,251,251 249,249,249 255,255,255 250,250,250 181,181,181 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 250,250,250 251,251,251 252,252,252 245,245,245 255,255,255 168,168,168 225,225,225 254,254,254 255,255,255 248,248,248 193,193,193 200,200,200 241,241,241 242,242,242 255,255,255 251,251,251 255,255,255 252,252,252 224,224,224 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 238,238,238 255,255,255 241,241,241 242,242,242 177,177,177 226,226,226 192,192,192 239,239,239 172,172,172 255,255,255 253,253,253 255,255,255 255,255,255 249,249,249 252,252,252 255,255,255 240,240,240 232,232,232 255,255,255 255,255,255 199,199,199 255,255,255 253,253,253 192,192,192 255,255,255 255,255,255 253,253,253 255,255,255 253,253,253 184,184,184 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 247,247,247 250,250,250 255,255,255 255,255,255 253,253,253 180,180,180 231,231,231 172,172,172 200,200,200 187,187,187 201,201,201 176,176,176 255,255,255 255,255,255 255,255,255 245,245,245 253,253,253 254,254,254 254,254,254 255,255,255 255,255,255 230,230,230 255,255,255 243,243,243 255,255,255 226,226,226 255,255,255 255,255,255 194,194,194 255,255,255 237,237,237 255,255,255 206,206,206 255,255,255 249,249,249 255,255,255 249,249,249 248,248,248 255,255,255 255,255,255 254,254,254 245,245,245 255,255,255 242,242,242 192,192,192 255,255,255 254,254,254 179,179,179 247,247,247 252,252,252 251,251,251 255,255,255 255,255,255 194,194,194 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 232,232,232 255,255,255 255,255,255 0,0,0 9,9,9 3,3,3 10,10,10 0,0,0 11,11,11 0,0,0 208,208,208 238,238,238 243,243,243 255,255,255 4,4,4 0,0,0 0,0,0 10,10,10 236,236,236 250,250,250 255,255,255 0,0,0 6,6,6 0,0,0 2,2,2 0,0,0 2,2,2 0,0,0 10,10,10 255,255,255 9,9,9 0,0,0 194,194,194 189,189,189 199,199,199 180,180,180 0,0,0 0,0,0 178,178,178 0,0,0 15,15,15 5,5,5 0,0,0 3,3,3 0,0,0 0,0,0 203,203,203 255,255,255 255,255,255 249,249,249 246,246,246 250,250,250 191,191,191 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 253,253,253 255,255,255 253,253,253 230,230,230 255,255,255 182,182,182 253,253,253 244,244,244 245,245,245 0,0,0 0,0,0 175,175,175 255,255,255 255,255,255 0,0,0 10,10,10 247,247,247 248,248,248 0,0,0 18,18,18 237,237,237 255,255,255 249,249,249 255,255,255 227,227,227 255,255,255 251,251,251 240,240,240 7,7,7 0,0,0 249,249,249 0,0,0 0,0,0 16,16,16 241,241,241 251,251,251 10,10,10 1,1,1 0,0,0 250,250,250 4,4,4 5,5,5 227,227,227 255,255,255 255,255,255 255,255,255 253,253,253 182,182,182 237,237,237 248,248,248 255,255,255 255,255,255 255,255,255 192,192,192 243,243,243 255,255,255 255,255,255 255,255,255 255,255,255 +252,252,252 245,245,245 254,254,254 255,255,255 255,255,255 255,255,255 190,190,190 253,253,253 252,252,252 255,255,255 7,7,7 3,3,3 197,197,197 255,255,255 0,0,0 5,5,5 248,248,248 251,251,251 255,255,255 247,247,247 0,0,0 5,5,5 236,236,236 253,253,253 250,250,250 255,255,255 249,249,249 255,255,255 245,245,245 3,3,3 12,12,12 253,253,253 0,0,0 0,0,0 0,0,0 1,1,1 3,3,3 0,0,0 1,1,1 3,3,3 255,255,255 0,0,0 0,0,0 255,255,255 252,252,252 244,244,244 178,178,178 195,195,195 196,196,196 209,209,209 185,185,185 180,180,180 184,184,184 210,210,210 184,184,184 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 255,255,255 255,255,255 249,249,249 234,234,234 255,255,255 193,193,193 255,255,255 251,251,251 0,0,0 0,0,0 252,252,252 196,196,196 234,234,234 1,1,1 0,0,0 250,250,250 255,255,255 247,247,247 255,255,255 5,5,5 7,7,7 210,210,210 178,178,178 187,187,187 195,195,195 177,177,177 185,185,185 0,0,0 1,1,1 191,191,191 196,196,196 9,9,9 0,0,0 205,205,205 0,0,0 0,0,0 195,195,195 0,0,0 0,0,0 187,187,187 0,0,0 4,4,4 237,237,237 255,255,255 255,255,255 211,211,211 250,250,250 243,243,243 255,255,255 247,247,247 255,255,255 255,255,255 247,247,247 186,186,186 240,240,240 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 255,255,255 253,253,253 254,254,254 255,255,255 239,239,239 204,204,204 248,248,248 3,3,3 2,2,2 255,255,255 231,231,231 196,196,196 255,255,255 255,255,255 1,1,1 0,0,0 255,255,255 247,247,247 0,0,0 0,0,0 3,3,3 240,240,240 255,255,255 253,253,253 249,249,249 255,255,255 4,4,4 0,0,0 255,255,255 255,255,255 247,247,247 0,0,0 11,11,11 241,241,241 15,15,15 0,0,0 236,236,236 20,20,20 0,0,0 255,255,255 0,0,0 7,7,7 1,1,1 0,0,0 0,0,0 8,8,8 252,252,252 255,255,255 255,255,255 239,239,239 255,255,255 251,251,251 248,248,248 197,197,197 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +182,182,182 214,214,214 177,177,177 189,189,189 211,211,211 180,180,180 210,210,210 0,0,0 1,1,1 193,193,193 194,194,194 187,187,187 192,192,192 252,252,252 255,255,255 249,249,249 0,0,0 10,10,10 0,0,0 255,255,255 0,0,0 0,0,0 238,238,238 255,255,255 255,255,255 247,247,247 6,6,6 1,1,1 255,255,255 232,232,232 255,255,255 252,252,252 4,4,4 0,0,0 255,255,255 1,1,1 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 245,245,245 193,193,193 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 242,242,242 255,255,255 250,250,250 252,252,252 252,252,252 0,0,0 10,10,10 199,199,199 247,247,247 254,254,254 244,244,244 181,181,181 247,247,247 255,255,255 247,247,247 250,250,250 254,254,254 255,255,255 234,234,234 33,33,33 0,0,0 239,239,239 255,255,255 250,250,250 15,15,15 0,0,0 255,255,255 255,255,255 255,255,255 235,235,235 255,255,255 3,3,3 0,0,0 255,255,255 251,251,251 246,246,246 255,255,255 0,0,0 0,0,0 247,247,247 2,2,2 21,21,21 237,237,237 255,255,255 247,247,247 209,209,209 239,239,239 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +237,237,237 255,255,255 240,240,240 236,236,236 255,255,255 12,12,12 12,12,12 250,250,250 189,189,189 255,255,255 255,255,255 247,247,247 205,205,205 249,249,249 248,248,248 0,0,0 255,255,255 248,248,248 247,247,247 252,252,252 0,0,0 2,2,2 255,255,255 242,242,242 12,12,12 0,0,0 255,255,255 255,255,255 240,240,240 255,255,255 255,255,255 255,255,255 5,5,5 0,0,0 253,253,253 252,252,252 248,248,248 255,255,255 3,3,3 6,6,6 254,254,254 0,0,0 0,0,0 255,255,255 252,252,252 255,255,255 194,194,194 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 223,223,223 255,255,255 255,255,255 235,235,235 0,0,0 0,0,0 246,246,246 192,192,192 198,198,198 148,148,148 215,215,215 191,191,191 255,255,255 255,255,255 11,11,11 0,0,0 255,255,255 255,255,255 0,0,0 12,12,12 207,207,207 244,244,244 0,0,0 0,0,0 248,248,248 252,252,252 245,245,245 250,250,250 255,255,255 245,245,245 255,255,255 0,0,0 15,15,15 243,243,243 255,255,255 255,255,255 239,239,239 18,18,18 0,0,0 255,255,255 6,6,6 7,7,7 255,255,255 255,255,255 255,255,255 184,184,184 251,251,251 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 178,178,178 202,202,202 188,188,188 197,197,197 17,17,17 4,4,4 4,4,4 0,0,0 0,0,0 19,19,19 4,4,4 201,201,201 186,186,186 176,176,176 176,176,176 0,0,0 0,0,0 0,0,0 0,0,0 184,184,184 186,186,186 250,250,250 9,9,9 0,0,0 255,255,255 246,246,246 243,243,243 255,255,255 248,248,248 255,255,255 244,244,244 8,8,8 0,0,0 250,250,250 254,254,254 248,248,248 246,246,246 1,1,1 1,1,1 239,239,239 14,14,14 0,0,0 0,0,0 0,0,0 0,0,0 0,0,0 18,18,18 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +250,250,250 209,209,209 228,228,228 247,247,247 239,239,239 250,250,250 245,245,245 255,255,255 255,255,255 255,255,255 201,201,201 235,235,235 192,192,192 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 245,245,245 255,255,255 255,255,255 205,205,205 254,254,254 237,237,237 252,252,252 231,231,231 255,255,255 255,255,255 235,235,235 255,255,255 244,244,244 255,255,255 221,221,221 219,219,219 255,255,255 243,243,243 244,244,244 255,255,255 255,255,255 253,253,253 255,255,255 162,162,162 201,201,201 185,185,185 191,191,191 209,209,209 200,200,200 233,233,233 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +250,250,250 182,182,182 255,255,255 242,242,242 255,255,255 233,233,233 255,255,255 255,255,255 253,253,253 255,255,255 166,166,166 255,255,255 193,193,193 233,233,233 255,255,255 243,243,243 239,239,239 203,203,203 252,252,252 254,254,254 237,237,237 174,174,174 211,211,211 193,193,193 210,210,210 159,159,159 197,197,197 204,204,204 198,198,198 183,183,183 208,208,208 185,185,185 211,211,211 193,193,193 228,228,228 254,254,254 255,255,255 253,253,253 239,239,239 253,253,253 253,253,253 201,201,201 241,241,241 255,255,255 234,234,234 246,246,246 186,186,186 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 180,180,180 255,255,255 255,255,255 246,246,246 255,255,255 255,255,255 235,235,235 244,244,244 255,255,255 196,196,196 246,246,246 204,204,204 237,237,237 254,254,254 252,252,252 255,255,255 187,187,187 255,255,255 248,248,248 255,255,255 255,255,255 240,240,240 255,255,255 241,241,241 212,212,212 243,243,243 254,254,254 252,252,252 250,250,250 249,249,249 255,255,255 251,251,251 252,252,252 251,251,251 255,255,255 250,250,250 252,252,252 255,255,255 251,251,251 246,246,246 197,197,197 252,252,252 250,250,250 255,255,255 253,253,253 188,188,188 252,252,252 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input21.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input21.jpg new file mode 100644 index 0000000..13393c7 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input21.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input21.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input21.txt new file mode 100644 index 0000000..43af950 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input21.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 252,252,252 247,247,247 255,255,255 254,254,254 255,255,255 198,198,198 249,249,249 255,255,255 253,253,253 251,251,251 192,192,192 199,199,199 248,248,248 255,255,255 252,252,252 253,253,253 249,249,249 249,249,249 255,255,255 255,255,255 255,255,255 252,252,252 255,255,255 255,255,255 249,249,249 251,251,251 255,255,255 248,248,248 196,196,196 238,238,238 195,195,195 255,255,255 196,196,196 245,245,245 249,249,249 255,255,255 241,241,241 248,248,248 255,255,255 255,255,255 244,244,244 255,255,255 255,255,255 247,247,247 190,190,190 255,255,255 250,250,250 193,193,193 252,252,252 249,249,249 253,253,253 255,255,255 247,247,247 182,182,182 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +246,246,246 255,255,255 255,255,255 238,238,238 251,251,251 250,250,250 167,167,167 255,255,255 244,244,244 239,239,239 255,255,255 191,191,191 195,195,195 245,245,245 249,249,249 252,252,252 255,255,255 255,255,255 251,251,251 249,249,249 239,239,239 248,248,248 245,245,245 255,255,255 240,240,240 255,255,255 244,244,244 231,231,231 255,255,255 177,177,177 234,234,234 186,186,186 245,245,245 183,183,183 255,255,255 242,242,242 244,244,244 255,255,255 251,251,251 248,248,248 250,250,250 255,255,255 243,243,243 250,250,250 251,251,251 198,198,198 255,255,255 242,242,242 187,187,187 255,255,255 252,252,252 255,255,255 252,252,252 246,246,246 191,191,191 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 240,240,240 246,246,246 255,255,255 255,255,255 255,255,255 172,172,172 219,219,219 188,188,188 200,200,200 200,200,200 172,172,172 199,199,199 255,255,255 253,253,253 255,255,255 242,242,242 255,255,255 255,255,255 254,254,254 245,245,245 255,255,255 255,255,255 255,255,255 249,249,249 255,255,255 255,255,255 255,255,255 250,250,250 186,186,186 238,238,238 243,243,243 255,255,255 191,191,191 246,246,246 255,255,255 254,254,254 248,248,248 252,252,252 255,255,255 255,255,255 255,255,255 226,226,226 255,255,255 255,255,255 172,172,172 253,253,253 255,255,255 186,186,186 255,255,255 227,227,227 255,255,255 255,255,255 248,248,248 197,197,197 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 249,249,249 255,255,255 255,255,255 237,237,237 236,236,236 206,206,206 0,0,0 4,4,4 10,10,10 0,0,0 3,3,3 187,187,187 255,255,255 0,0,0 0,0,0 247,247,247 255,255,255 251,251,251 254,254,254 242,242,242 254,254,254 244,244,244 222,222,222 255,255,255 0,0,0 3,3,3 0,0,0 0,0,0 203,203,203 251,251,251 255,255,255 228,228,228 207,207,207 1,1,1 10,10,10 0,0,0 0,0,0 203,203,203 181,181,181 172,172,172 7,7,7 8,8,8 193,193,193 197,197,197 208,208,208 255,255,255 0,0,0 0,0,0 250,250,250 255,255,255 255,255,255 225,225,225 254,254,254 204,204,204 239,239,239 255,255,255 255,255,255 255,255,255 255,255,255 +237,237,237 255,255,255 244,244,244 255,255,255 255,255,255 255,255,255 0,0,0 0,0,0 238,238,238 242,242,242 255,255,255 1,1,1 0,0,0 253,253,253 12,12,12 1,1,1 255,255,255 241,241,241 235,235,235 255,255,255 252,252,252 231,231,231 255,255,255 255,255,255 0,0,0 18,18,18 255,255,255 255,255,255 13,13,13 3,3,3 252,252,252 244,244,244 255,255,255 0,0,0 0,0,0 241,241,241 249,249,249 3,3,3 0,0,0 255,255,255 249,249,249 13,13,13 0,0,0 240,240,240 255,255,255 237,237,237 240,240,240 9,9,9 5,5,5 242,242,242 238,238,238 255,255,255 255,255,255 255,255,255 183,183,183 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 255,255,255 255,255,255 253,253,253 0,0,0 10,10,10 255,255,255 255,255,255 255,255,255 246,246,246 244,244,244 6,6,6 255,255,255 0,0,0 0,0,0 244,244,244 255,255,255 249,249,249 239,239,239 255,255,255 255,255,255 237,237,237 0,0,0 0,0,0 245,245,245 246,246,246 242,242,242 229,229,229 12,12,12 246,246,246 255,255,255 0,0,0 15,15,15 255,255,255 255,255,255 250,250,250 202,202,202 0,0,0 1,1,1 254,254,254 0,0,0 3,3,3 255,255,255 255,255,255 250,250,250 209,209,209 0,0,0 5,5,5 211,211,211 192,192,192 172,172,172 186,186,186 218,218,218 178,178,178 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 253,253,253 249,249,249 242,242,242 255,255,255 0,0,0 0,0,0 255,255,255 241,241,241 255,255,255 242,242,242 252,252,252 208,208,208 238,238,238 8,8,8 3,3,3 255,255,255 253,253,253 250,250,250 255,255,255 249,249,249 167,167,167 218,218,218 9,9,9 0,0,0 203,203,203 189,189,189 204,204,204 194,194,194 166,166,166 205,205,205 195,195,195 16,16,16 0,0,0 205,205,205 198,198,198 192,192,192 181,181,181 5,5,5 11,11,11 189,189,189 189,189,189 0,0,0 6,6,6 247,247,247 250,250,250 1,1,1 0,0,0 228,228,228 255,255,255 236,236,236 255,255,255 255,255,255 245,245,245 176,176,176 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 251,251,251 255,255,255 255,255,255 236,236,236 14,14,14 0,0,0 250,250,250 255,255,255 229,229,229 255,255,255 249,249,249 183,183,183 253,253,253 3,3,3 0,0,0 250,250,250 254,254,254 249,249,249 255,255,255 254,254,254 193,193,193 255,255,255 0,0,0 2,2,2 255,255,255 0,0,0 0,0,0 0,0,0 255,255,255 238,238,238 254,254,254 236,236,236 16,16,16 0,0,0 248,248,248 255,255,255 0,0,0 0,0,0 0,0,0 255,255,255 197,197,197 0,0,0 9,9,9 248,248,248 255,255,255 0,0,0 7,7,7 255,255,255 255,255,255 246,246,246 255,255,255 246,246,246 246,246,246 204,204,204 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +190,190,190 196,196,196 179,179,179 201,201,201 195,195,195 0,0,0 7,7,7 255,255,255 202,202,202 183,183,183 192,192,192 180,180,180 197,197,197 255,255,255 0,0,0 0,0,0 250,250,250 255,255,255 255,255,255 255,255,255 229,229,229 210,210,210 251,251,251 0,0,0 0,0,0 0,0,0 255,255,255 251,251,251 11,11,11 0,0,0 255,255,255 255,255,255 251,251,251 199,199,199 0,0,0 0,0,0 0,0,0 255,255,255 0,0,0 8,8,8 247,247,247 190,190,190 0,0,0 2,2,2 255,255,255 244,244,244 11,11,11 0,0,0 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 249,249,249 238,238,238 255,255,255 0,0,0 0,0,0 255,255,255 165,165,165 255,255,255 245,245,245 239,239,239 197,197,197 243,243,243 7,7,7 0,0,0 255,255,255 255,255,255 234,234,234 241,241,241 255,255,255 179,179,179 251,251,251 1,1,1 8,8,8 255,255,255 237,237,237 253,253,253 255,255,255 0,0,0 7,7,7 242,242,242 249,249,249 175,175,175 249,249,249 255,255,255 254,254,254 244,244,244 13,13,13 0,0,0 255,255,255 207,207,207 249,249,249 0,0,0 2,2,2 17,17,17 0,0,0 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 236,236,236 255,255,255 251,251,251 252,252,252 0,0,0 0,0,0 252,252,252 197,197,197 255,255,255 249,249,249 255,255,255 1,1,1 243,243,243 0,0,0 0,0,0 250,250,250 248,248,248 252,252,252 255,255,255 255,255,255 191,191,191 250,250,250 0,0,0 5,5,5 239,239,239 255,255,255 255,255,255 234,234,234 21,21,21 6,6,6 255,255,255 252,252,252 16,16,16 243,243,243 245,245,245 243,243,243 249,249,249 17,17,17 0,0,0 250,250,250 182,182,182 241,241,241 19,19,19 0,0,0 0,0,0 14,14,14 238,238,238 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 253,253,253 251,251,251 244,244,244 251,251,251 255,255,255 0,0,0 8,8,8 193,193,193 188,188,188 163,163,163 4,4,4 0,0,0 255,255,255 7,7,7 0,0,0 254,254,254 255,255,255 254,254,254 251,251,251 227,227,227 204,204,204 251,251,251 250,250,250 2,2,2 5,5,5 255,255,255 242,242,242 6,6,6 0,0,0 255,255,255 243,243,243 255,255,255 0,0,0 10,10,10 255,255,255 255,255,255 2,2,2 0,0,0 255,255,255 250,250,250 178,178,178 255,255,255 238,238,238 6,6,6 0,0,0 209,209,209 248,248,248 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +242,242,242 194,194,194 209,209,209 195,195,195 188,188,188 179,179,179 213,213,213 0,0,0 0,0,0 3,3,3 16,16,16 4,4,4 190,190,190 183,183,183 6,6,6 2,2,2 1,1,1 0,0,0 0,0,0 2,2,2 11,11,11 173,173,173 255,255,255 237,237,237 237,237,237 21,21,21 0,0,0 0,0,0 4,4,4 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 13,13,13 0,0,0 0,0,0 2,2,2 255,255,255 255,255,255 255,255,255 187,187,187 255,255,255 248,248,248 0,0,0 5,5,5 185,185,185 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 194,194,194 232,232,232 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 245,245,245 255,255,255 198,198,198 242,242,242 194,194,194 255,255,255 255,255,255 247,247,247 240,240,240 224,224,224 226,226,226 255,255,255 254,254,254 207,207,207 238,238,238 255,255,255 255,255,255 243,243,243 255,255,255 254,254,254 255,255,255 240,240,240 252,252,252 251,251,251 227,227,227 205,205,205 241,241,241 250,250,250 255,255,255 246,246,246 250,250,250 255,255,255 240,240,240 173,173,173 199,199,199 168,168,168 196,196,196 216,216,216 163,163,163 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 191,191,191 255,255,255 237,237,237 251,251,251 239,239,239 241,241,241 255,255,255 253,253,253 248,248,248 193,193,193 255,255,255 193,193,193 254,254,254 247,247,247 255,255,255 255,255,255 192,192,192 244,244,244 255,255,255 250,250,250 185,185,185 196,196,196 176,176,176 192,192,192 167,167,167 201,201,201 190,190,190 204,204,204 201,201,201 192,192,192 193,193,193 220,220,220 183,183,183 243,243,243 255,255,255 240,240,240 255,255,255 255,255,255 239,239,239 255,255,255 201,201,201 255,255,255 248,248,248 255,255,255 246,246,246 187,187,187 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 162,162,162 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 242,242,242 255,255,255 255,255,255 190,190,190 251,251,251 200,200,200 240,240,240 252,252,252 249,249,249 255,255,255 185,185,185 255,255,255 247,247,247 255,255,255 255,255,255 241,241,241 255,255,255 249,249,249 214,214,214 245,245,245 255,255,255 242,242,242 244,244,244 255,255,255 255,255,255 247,247,247 250,250,250 255,255,255 240,240,240 255,255,255 244,244,244 249,249,249 255,255,255 255,255,255 191,191,191 244,244,244 254,254,254 252,252,252 252,252,252 192,192,192 251,251,251 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input22.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input22.jpg new file mode 100644 index 0000000..abcd6da Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input22.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input22.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input22.txt new file mode 100644 index 0000000..9d8b91d --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input22.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +248,248,248 255,255,255 248,248,248 255,255,255 253,253,253 246,246,246 204,204,204 248,248,248 255,255,255 253,253,253 249,249,249 190,190,190 177,177,177 255,255,255 255,255,255 239,239,239 255,255,255 250,250,250 254,254,254 254,254,254 255,255,255 253,253,253 255,255,255 238,238,238 255,255,255 246,246,246 255,255,255 239,239,239 255,255,255 183,183,183 249,249,249 198,198,198 255,255,255 196,196,196 245,245,245 249,249,249 255,255,255 241,241,241 248,248,248 255,255,255 246,246,246 255,255,255 241,241,241 255,255,255 242,242,242 184,184,184 255,255,255 244,244,244 192,192,192 255,255,255 251,251,251 249,249,249 255,255,255 250,250,250 181,181,181 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 252,252,252 255,255,255 237,237,237 255,255,255 181,181,181 239,239,239 246,246,246 240,240,240 255,255,255 190,190,190 204,204,204 236,236,236 255,255,255 254,254,254 249,249,249 253,253,253 252,252,252 240,240,240 242,242,242 255,255,255 234,234,234 255,255,255 253,253,253 251,251,251 255,255,255 255,255,255 241,241,241 184,184,184 231,231,231 188,188,188 245,245,245 183,183,183 255,255,255 242,242,242 244,244,244 255,255,255 251,251,251 248,248,248 255,255,255 255,255,255 245,245,245 255,255,255 249,249,249 203,203,203 239,239,239 254,254,254 192,192,192 255,255,255 255,255,255 253,253,253 255,255,255 253,253,253 184,184,184 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 248,248,248 250,250,250 255,255,255 255,255,255 252,252,252 156,156,156 224,224,224 194,194,194 188,188,188 194,194,194 199,199,199 181,181,181 255,255,255 246,246,246 255,255,255 247,247,247 255,255,255 251,251,251 255,255,255 243,243,243 255,255,255 250,250,250 242,242,242 255,255,255 247,247,247 245,245,245 242,242,242 255,255,255 177,177,177 253,253,253 234,234,234 255,255,255 191,191,191 246,246,246 255,255,255 254,254,254 248,248,248 252,252,252 255,255,255 241,241,241 255,255,255 240,240,240 243,243,243 245,245,245 198,198,198 255,255,255 254,254,254 179,179,179 247,247,247 252,252,252 251,251,251 255,255,255 255,255,255 194,194,194 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 238,238,238 255,255,255 239,239,239 12,12,12 17,17,17 232,232,232 247,247,247 255,255,255 255,255,255 0,0,0 11,11,11 243,243,243 251,251,251 249,249,249 1,1,1 0,0,0 0,0,0 0,0,0 9,9,9 239,239,239 255,255,255 6,6,6 0,0,0 6,6,6 25,25,25 5,5,5 0,0,0 0,0,0 253,253,253 255,255,255 228,228,228 207,207,207 1,1,1 10,10,10 0,0,0 0,0,0 203,203,203 181,181,181 194,194,194 195,195,195 190,190,190 187,187,187 13,13,13 0,0,0 238,238,238 255,255,255 203,203,203 255,255,255 255,255,255 249,249,249 246,246,246 250,250,250 191,191,191 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 255,255,255 241,241,241 255,255,255 255,255,255 0,0,0 1,1,1 255,255,255 255,255,255 255,255,255 239,239,239 0,0,0 0,0,0 255,255,255 255,255,255 2,2,2 9,9,9 235,235,235 255,255,255 255,255,255 2,2,2 6,6,6 243,243,243 0,0,0 0,0,0 250,250,250 245,245,245 241,241,241 235,235,235 198,198,198 255,255,255 253,253,253 255,255,255 0,0,0 0,0,0 241,241,241 249,249,249 3,3,3 0,0,0 255,255,255 231,231,231 253,253,253 255,255,255 14,14,14 0,0,0 0,0,0 255,255,255 244,244,244 182,182,182 237,237,237 248,248,248 255,255,255 255,255,255 255,255,255 192,192,192 243,243,243 255,255,255 255,255,255 255,255,255 255,255,255 +241,241,241 255,255,255 251,251,251 245,245,245 247,247,247 23,23,23 0,0,0 245,245,245 243,243,243 249,249,249 255,255,255 0,0,0 0,0,0 255,255,255 0,0,0 0,0,0 246,246,246 255,255,255 234,234,234 249,249,249 251,251,251 0,0,0 255,255,255 0,0,0 0,0,0 250,250,250 251,251,251 254,254,254 255,255,255 215,215,215 239,239,239 245,245,245 0,0,0 15,15,15 255,255,255 255,255,255 250,250,250 202,202,202 0,0,0 1,1,1 255,255,255 249,249,249 0,0,0 0,0,0 2,2,2 4,4,4 203,203,203 182,182,182 196,196,196 209,209,209 185,185,185 180,180,180 184,184,184 210,210,210 184,184,184 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 249,249,249 252,252,252 255,255,255 250,250,250 1,1,1 13,13,13 247,247,247 255,255,255 244,244,244 247,247,247 0,0,0 17,17,17 255,255,255 0,0,0 10,10,10 255,255,255 239,239,239 255,255,255 255,255,255 255,255,255 183,183,183 202,202,202 9,9,9 0,0,0 178,178,178 202,202,202 178,178,178 192,192,192 182,182,182 176,176,176 222,222,222 16,16,16 0,0,0 205,205,205 198,198,198 192,192,192 181,181,181 5,5,5 11,11,11 199,199,199 172,172,172 255,255,255 255,255,255 0,0,0 17,17,17 187,187,187 255,255,255 243,243,243 255,255,255 247,247,247 255,255,255 255,255,255 247,247,247 186,186,186 240,240,240 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 255,255,255 255,255,255 245,245,245 255,255,255 0,0,0 0,0,0 7,7,7 0,0,0 6,6,6 0,0,0 4,4,4 0,0,0 252,252,252 4,4,4 0,0,0 255,255,255 255,255,255 255,255,255 239,239,239 254,254,254 206,206,206 241,241,241 2,2,2 0,0,0 9,9,9 0,0,0 3,3,3 2,2,2 251,251,251 255,255,255 233,233,233 236,236,236 16,16,16 0,0,0 248,248,248 255,255,255 0,0,0 0,0,0 0,0,0 252,252,252 212,212,212 248,248,248 253,253,253 4,4,4 0,0,0 187,187,187 251,251,251 255,255,255 255,255,255 239,239,239 255,255,255 251,251,251 248,248,248 197,197,197 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +199,199,199 186,186,186 181,181,181 198,198,198 194,194,194 0,0,0 7,7,7 251,251,251 197,197,197 184,184,184 193,193,193 0,0,0 9,9,9 250,250,250 5,5,5 4,4,4 255,255,255 253,253,253 255,255,255 249,249,249 247,247,247 197,197,197 243,243,243 2,2,2 0,0,0 255,255,255 255,255,255 252,252,252 254,254,254 255,255,255 246,246,246 255,255,255 251,251,251 199,199,199 0,0,0 0,0,0 0,0,0 255,255,255 0,0,0 8,8,8 255,255,255 204,204,204 236,236,236 255,255,255 0,0,0 0,0,0 207,207,207 250,250,250 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 254,254,254 253,253,253 255,255,255 251,251,251 0,0,0 0,0,0 255,255,255 181,181,181 255,255,255 255,255,255 0,0,0 0,0,0 255,255,255 0,0,0 0,0,0 250,250,250 254,254,254 253,253,253 250,250,250 255,255,255 192,192,192 249,249,249 0,0,0 21,21,21 253,253,253 251,251,251 254,254,254 253,253,253 245,245,245 247,247,247 255,255,255 249,249,249 175,175,175 249,249,249 255,255,255 254,254,254 244,244,244 13,13,13 0,0,0 251,251,251 179,179,179 255,255,255 251,251,251 0,0,0 10,10,10 182,182,182 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +239,239,239 255,255,255 254,254,254 224,224,224 255,255,255 20,20,20 0,0,0 241,241,241 199,199,199 253,253,253 255,255,255 5,5,5 5,5,5 238,238,238 18,18,18 0,0,0 255,255,255 247,247,247 244,244,244 246,246,246 253,253,253 10,10,10 255,255,255 0,0,0 0,0,0 240,240,240 255,255,255 255,255,255 253,253,253 250,250,250 255,255,255 246,246,246 252,252,252 16,16,16 243,243,243 245,245,245 243,243,243 249,249,249 17,17,17 0,0,0 248,248,248 204,204,204 244,244,244 249,249,249 11,11,11 0,0,0 187,187,187 236,236,236 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 239,239,239 255,255,255 244,244,244 252,252,252 0,0,0 0,0,0 255,255,255 197,197,197 180,180,180 172,172,172 0,0,0 1,1,1 248,248,248 247,247,247 8,8,8 4,4,4 255,255,255 255,255,255 255,255,255 0,0,0 0,0,0 255,255,255 16,16,16 0,0,0 255,255,255 242,242,242 255,255,255 239,239,239 255,255,255 242,242,242 255,255,255 255,255,255 0,0,0 10,10,10 255,255,255 255,255,255 2,2,2 0,0,0 255,255,255 253,253,253 191,191,191 255,255,255 253,253,253 0,0,0 3,3,3 208,208,208 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 178,178,178 213,213,213 189,189,189 183,183,183 0,0,0 7,7,7 173,173,173 204,204,204 188,188,188 208,208,208 0,0,0 0,0,0 190,190,190 176,176,176 184,184,184 0,0,0 6,6,6 0,0,0 0,0,0 4,4,4 180,180,180 249,249,249 0,0,0 4,4,4 0,0,0 16,16,16 0,0,0 0,0,0 21,21,21 252,252,252 245,245,245 255,255,255 195,195,195 13,13,13 0,0,0 0,0,0 2,2,2 255,255,255 255,255,255 255,255,255 175,175,175 5,5,5 0,0,0 5,5,5 0,0,0 2,2,2 0,0,0 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +252,252,252 186,186,186 248,248,248 230,230,230 255,255,255 248,248,248 255,255,255 255,255,255 255,255,255 234,234,234 197,197,197 249,249,249 211,211,211 255,255,255 255,255,255 255,255,255 255,255,255 199,199,199 242,242,242 253,253,253 255,255,255 212,212,212 245,245,245 255,255,255 253,253,253 246,246,246 247,247,247 255,255,255 245,245,245 234,234,234 255,255,255 250,250,250 227,227,227 205,205,205 241,241,241 250,250,250 255,255,255 246,246,246 250,250,250 255,255,255 255,255,255 162,162,162 205,205,205 180,180,180 171,171,171 213,213,213 178,178,178 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 179,179,179 255,255,255 255,255,255 255,255,255 237,237,237 253,253,253 254,254,254 254,254,254 255,255,255 182,182,182 249,249,249 192,192,192 239,239,239 248,248,248 238,238,238 229,229,229 206,206,206 255,255,255 246,246,246 251,251,251 193,193,193 191,191,191 177,177,177 192,192,192 181,181,181 185,185,185 201,201,201 188,188,188 208,208,208 199,199,199 186,186,186 220,220,220 183,183,183 243,243,243 255,255,255 240,240,240 255,255,255 255,255,255 239,239,239 251,251,251 192,192,192 255,255,255 255,255,255 254,254,254 250,250,250 190,190,190 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +251,251,251 177,177,177 255,255,255 255,255,255 242,242,242 255,255,255 255,255,255 240,240,240 252,252,252 252,252,252 191,191,191 255,255,255 201,201,201 235,235,235 255,255,255 255,255,255 255,255,255 170,170,170 255,255,255 255,255,255 238,238,238 255,255,255 249,249,249 255,255,255 248,248,248 214,214,214 235,235,235 255,255,255 243,243,243 253,253,253 237,237,237 255,255,255 247,247,247 250,250,250 255,255,255 240,240,240 255,255,255 244,244,244 249,249,249 255,255,255 255,255,255 195,195,195 248,248,248 249,249,249 255,255,255 253,253,253 182,182,182 254,254,254 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input23.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input23.jpg new file mode 100644 index 0000000..ab8bbd5 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input23.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input23.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input23.txt new file mode 100644 index 0000000..aaefdd5 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input23.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 254,254,254 246,246,246 255,255,255 241,241,241 255,255,255 209,209,209 250,250,250 255,255,255 255,255,255 246,246,246 184,184,184 196,196,196 247,247,247 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 252,252,252 243,243,243 255,255,255 254,254,254 247,247,247 244,244,244 255,255,255 255,255,255 245,245,245 255,255,255 206,206,206 229,229,229 201,201,201 255,255,255 184,184,184 246,246,246 255,255,255 242,242,242 248,248,248 255,255,255 249,249,249 255,255,255 244,244,244 255,255,255 255,255,255 247,247,247 190,190,190 255,255,255 250,250,250 193,193,193 252,252,252 249,249,249 253,253,253 255,255,255 247,247,247 182,182,182 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 251,251,251 252,252,252 255,255,255 255,255,255 232,232,232 175,175,175 247,247,247 238,238,238 253,253,253 255,255,255 182,182,182 192,192,192 255,255,255 255,255,255 236,236,236 255,255,255 242,242,242 255,255,255 239,239,239 255,255,255 232,232,232 242,242,242 255,255,255 255,255,255 243,243,243 249,249,249 255,255,255 237,237,237 177,177,177 227,227,227 195,195,195 249,249,249 184,184,184 255,255,255 247,247,247 233,233,233 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 243,243,243 250,250,250 251,251,251 198,198,198 255,255,255 242,242,242 187,187,187 255,255,255 252,252,252 255,255,255 252,252,252 246,246,246 191,191,191 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 255,255,255 249,249,249 224,224,224 255,255,255 255,255,255 187,187,187 218,218,218 195,195,195 191,191,191 202,202,202 187,187,187 200,200,200 253,253,253 235,235,235 255,255,255 244,244,244 255,255,255 255,255,255 255,255,255 242,242,242 255,255,255 255,255,255 249,249,249 253,253,253 255,255,255 247,247,247 255,255,255 252,252,252 197,197,197 255,255,255 235,235,235 245,245,245 215,215,215 217,217,217 255,255,255 255,255,255 232,232,232 255,255,255 240,240,240 255,255,255 255,255,255 226,226,226 255,255,255 255,255,255 172,172,172 253,253,253 255,255,255 186,186,186 255,255,255 227,227,227 255,255,255 255,255,255 248,248,248 197,197,197 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 241,241,241 254,254,254 255,255,255 239,239,239 3,3,3 0,0,0 244,244,244 249,249,249 248,248,248 255,255,255 0,0,0 0,0,0 249,249,249 20,20,20 0,0,0 6,6,6 1,1,1 0,0,0 4,4,4 0,0,0 232,232,232 255,255,255 0,0,0 0,0,0 225,225,225 255,255,255 255,255,255 254,254,254 184,184,184 240,240,240 255,255,255 2,2,2 0,0,0 199,199,199 194,194,194 193,193,193 182,182,182 11,11,11 0,0,0 172,172,172 7,7,7 8,8,8 193,193,193 197,197,197 208,208,208 255,255,255 0,0,0 0,0,0 250,250,250 255,255,255 255,255,255 225,225,225 254,254,254 204,204,204 239,239,239 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 245,245,245 251,251,251 255,255,255 248,248,248 2,2,2 0,0,0 255,255,255 244,244,244 255,255,255 237,237,237 0,0,0 4,4,4 255,255,255 0,0,0 0,0,0 241,241,241 254,254,254 251,251,251 242,242,242 255,255,255 255,255,255 245,245,245 13,13,13 4,4,4 255,255,255 255,255,255 240,240,240 247,247,247 207,207,207 245,245,245 253,253,253 0,0,0 3,3,3 255,255,255 255,255,255 242,242,242 200,200,200 0,0,0 8,8,8 249,249,249 13,13,13 0,0,0 240,240,240 255,255,255 237,237,237 240,240,240 9,9,9 5,5,5 242,242,242 238,238,238 255,255,255 255,255,255 255,255,255 183,183,183 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 255,255,255 255,255,255 253,253,253 250,250,250 4,4,4 0,0,0 250,250,250 245,245,245 246,246,246 255,255,255 0,0,0 0,0,0 255,255,255 0,0,0 22,22,22 255,255,255 242,242,242 255,255,255 254,254,254 236,236,236 227,227,227 255,255,255 0,0,0 0,0,0 237,237,237 255,255,255 255,255,255 238,238,238 213,213,213 255,255,255 246,246,246 255,255,255 0,0,0 10,10,10 245,245,245 242,242,242 0,0,0 3,3,3 253,253,253 254,254,254 0,0,0 3,3,3 255,255,255 255,255,255 250,250,250 209,209,209 0,0,0 5,5,5 211,211,211 192,192,192 172,172,172 186,186,186 218,218,218 178,178,178 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 255,255,255 254,254,254 254,254,254 251,251,251 9,9,9 5,5,5 248,248,248 255,255,255 237,237,237 255,255,255 4,4,4 9,9,9 243,243,243 7,7,7 0,0,0 250,250,250 255,255,255 249,249,249 253,253,253 255,255,255 190,190,190 211,211,211 0,0,0 8,8,8 202,202,202 182,182,182 192,192,192 184,184,184 187,187,187 202,202,202 184,184,184 192,192,192 175,175,175 0,0,0 0,0,0 4,4,4 14,14,14 208,208,208 173,173,173 189,189,189 189,189,189 0,0,0 6,6,6 247,247,247 250,250,250 1,1,1 0,0,0 228,228,228 255,255,255 236,236,236 255,255,255 255,255,255 245,245,245 176,176,176 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 255,255,255 249,249,249 255,255,255 245,245,245 0,0,0 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 1,1,1 2,2,2 254,254,254 8,8,8 0,0,0 0,0,0 12,12,12 0,0,0 1,1,1 255,255,255 200,200,200 236,236,236 8,8,8 0,0,0 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 243,243,243 255,255,255 252,252,252 198,198,198 255,255,255 8,8,8 1,1,1 247,247,247 238,238,238 255,255,255 255,255,255 197,197,197 0,0,0 9,9,9 248,248,248 255,255,255 0,0,0 7,7,7 255,255,255 255,255,255 246,246,246 255,255,255 246,246,246 246,246,246 204,204,204 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +202,202,202 184,184,184 189,189,189 210,210,210 193,193,193 0,0,0 10,10,10 251,251,251 0,0,0 2,2,2 192,192,192 0,0,0 0,0,0 255,255,255 0,0,0 0,0,0 255,255,255 247,247,247 246,246,246 255,255,255 236,236,236 198,198,198 255,255,255 0,0,0 0,0,0 255,255,255 255,255,255 252,252,252 254,254,254 255,255,255 246,246,246 255,255,255 255,255,255 189,189,189 255,255,255 0,0,0 1,1,1 255,255,255 249,249,249 255,255,255 247,247,247 190,190,190 0,0,0 2,2,2 255,255,255 244,244,244 11,11,11 0,0,0 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +235,235,235 255,255,255 236,236,236 223,223,223 255,255,255 0,0,0 0,0,0 255,255,255 10,10,10 0,0,0 245,245,245 22,22,22 11,11,11 253,253,253 2,2,2 0,0,0 240,240,240 255,255,255 255,255,255 236,236,236 250,250,250 190,190,190 247,247,247 14,14,14 21,21,21 253,253,253 251,251,251 254,254,254 253,253,253 245,245,245 247,247,247 255,255,255 245,245,245 180,180,180 0,0,0 3,3,3 6,6,6 3,3,3 244,244,244 255,255,255 255,255,255 207,207,207 249,249,249 0,0,0 2,2,2 17,17,17 0,0,0 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 245,245,245 252,252,252 255,255,255 255,255,255 2,2,2 0,0,0 0,0,0 0,0,0 0,0,0 5,5,5 0,0,0 0,0,0 246,246,246 18,18,18 1,1,1 255,255,255 241,241,241 251,251,251 255,255,255 255,255,255 196,196,196 255,255,255 0,0,0 0,0,0 240,240,240 255,255,255 255,255,255 253,253,253 250,250,250 255,255,255 246,246,246 255,255,255 0,0,0 5,5,5 248,248,248 236,236,236 0,0,0 20,20,20 246,246,246 250,250,250 182,182,182 241,241,241 19,19,19 0,0,0 0,0,0 14,14,14 238,238,238 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 250,250,250 255,255,255 236,236,236 232,232,232 1,1,1 0,0,0 8,8,8 191,191,191 194,194,194 0,0,0 19,19,19 11,11,11 233,233,233 6,6,6 0,0,0 255,255,255 255,255,255 255,255,255 244,244,244 234,234,234 198,198,198 254,254,254 9,9,9 0,0,0 255,255,255 242,242,242 255,255,255 239,239,239 255,255,255 242,242,242 255,255,255 7,7,7 0,0,0 250,250,250 255,255,255 255,255,255 250,250,250 5,5,5 0,0,0 250,250,250 178,178,178 255,255,255 238,238,238 6,6,6 0,0,0 209,209,209 248,248,248 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 193,193,193 189,189,189 202,202,202 204,204,204 7,7,7 9,9,9 167,167,167 196,196,196 202,202,202 182,182,182 0,0,0 3,3,3 193,193,193 12,12,12 0,0,0 4,4,4 0,0,0 3,3,3 0,0,0 17,17,17 167,167,167 255,255,255 0,0,0 4,4,4 0,0,0 16,16,16 0,0,0 0,0,0 21,21,21 252,252,252 245,245,245 0,0,0 0,0,0 251,251,251 248,248,248 237,237,237 250,250,250 10,10,10 0,0,0 255,255,255 187,187,187 255,255,255 248,248,248 0,0,0 5,5,5 185,185,185 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +238,238,238 180,180,180 244,244,244 239,239,239 234,234,234 252,252,252 255,255,255 255,255,255 252,252,252 252,252,252 213,213,213 245,245,245 213,213,213 238,238,238 255,255,255 255,255,255 249,249,249 216,216,216 225,225,225 255,255,255 252,252,252 212,212,212 243,243,243 255,255,255 253,253,253 246,246,246 247,247,247 255,255,255 245,245,245 234,234,234 255,255,255 250,250,250 229,229,229 220,220,220 250,250,250 255,255,255 255,255,255 255,255,255 247,247,247 250,250,250 240,240,240 173,173,173 199,199,199 168,168,168 196,196,196 216,216,216 163,163,163 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 190,190,190 254,254,254 255,255,255 255,255,255 245,245,245 236,236,236 255,255,255 252,252,252 246,246,246 198,198,198 255,255,255 160,160,160 255,255,255 242,242,242 242,242,242 242,242,242 200,200,200 255,255,255 255,255,255 235,235,235 197,197,197 192,192,192 189,189,189 192,192,192 181,181,181 185,185,185 201,201,201 188,188,188 208,208,208 199,199,199 186,186,186 210,210,210 165,165,165 252,252,252 239,239,239 255,255,255 255,255,255 226,226,226 255,255,255 255,255,255 201,201,201 255,255,255 248,248,248 255,255,255 246,246,246 187,187,187 255,255,255 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +248,248,248 181,181,181 252,252,252 255,255,255 250,250,250 254,254,254 255,255,255 253,253,253 253,253,253 253,253,253 192,192,192 250,250,250 215,215,215 226,226,226 255,255,255 255,255,255 255,255,255 176,176,176 255,255,255 248,248,248 255,255,255 251,251,251 251,251,251 249,249,249 248,248,248 214,214,214 235,235,235 255,255,255 243,243,243 253,253,253 237,237,237 255,255,255 253,253,253 255,255,255 255,255,255 237,237,237 255,255,255 244,244,244 255,255,255 248,248,248 255,255,255 191,191,191 244,244,244 254,254,254 252,252,252 252,252,252 192,192,192 251,251,251 254,254,254 255,255,255 251,251,251 255,255,255 250,250,250 255,255,255 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input24.jpg b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input24.jpg new file mode 100644 index 0000000..2bf5c14 Binary files /dev/null and b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input24.jpg differ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input24.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input24.txt new file mode 100644 index 0000000..67eae0c --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/input/input24.txt @@ -0,0 +1,31 @@ +30 60 +255,255,255 250,250,250 254,254,254 250,250,250 254,254,254 255,255,255 253,253,253 254,254,254 255,255,255 255,255,255 255,255,255 250,250,250 255,255,255 249,249,249 255,255,255 253,253,253 254,254,254 233,233,233 255,255,255 249,249,249 255,255,255 239,239,239 195,195,195 247,247,247 245,245,245 249,249,249 252,252,252 247,247,247 254,254,254 255,255,255 246,246,246 254,254,254 255,255,255 178,178,178 203,203,203 192,192,192 187,187,187 195,195,195 190,190,190 189,189,189 193,193,193 196,196,196 188,188,188 186,186,186 201,201,201 180,180,180 255,255,255 255,255,255 240,240,240 255,255,255 250,250,250 255,255,255 255,255,255 247,247,247 252,252,252 248,248,248 245,245,245 255,255,255 242,242,242 251,251,251 +255,255,255 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 255,255,255 248,248,248 255,255,255 250,250,250 253,253,253 250,250,250 251,251,251 250,250,250 250,250,250 255,255,255 255,255,255 242,242,242 249,249,249 255,255,255 255,255,255 187,187,187 252,252,252 255,255,255 255,255,255 255,255,255 245,245,245 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 196,196,196 245,245,245 249,249,249 247,247,247 255,255,255 250,250,250 250,250,250 249,249,249 254,254,254 252,252,252 252,252,252 252,252,252 203,203,203 255,255,255 247,247,247 255,255,255 248,248,248 247,247,247 245,245,245 251,251,251 250,250,250 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 243,243,243 +251,251,251 247,247,247 251,251,251 250,250,250 252,252,252 255,255,255 240,240,240 255,255,255 248,248,248 255,255,255 253,253,253 255,255,255 251,251,251 255,255,255 253,253,253 255,255,255 237,237,237 255,255,255 249,249,249 251,251,251 251,251,251 251,251,251 179,179,179 255,255,255 254,254,254 253,253,253 251,251,251 253,253,253 253,253,253 250,250,250 251,251,251 253,253,253 243,243,243 192,192,192 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 254,254,254 195,195,195 251,251,251 249,249,249 240,240,240 185,185,185 207,207,207 191,191,191 195,195,195 192,192,192 195,195,195 190,190,190 184,184,184 195,195,195 255,255,255 252,252,252 +195,195,195 191,191,191 195,195,195 195,195,195 194,194,194 198,198,198 170,170,170 198,198,198 188,188,188 195,195,195 188,188,188 172,172,172 184,184,184 196,196,196 183,183,183 188,188,188 184,184,184 191,191,191 204,204,204 182,182,182 196,196,196 198,198,198 192,192,192 255,255,255 255,255,255 247,247,247 243,243,243 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 250,250,250 196,196,196 253,253,253 255,255,255 248,248,248 250,250,250 248,248,248 253,253,253 253,253,253 247,247,247 244,244,244 251,251,251 248,248,248 189,189,189 253,253,253 255,255,255 255,255,255 189,189,189 253,253,253 244,244,244 253,253,253 252,252,252 253,253,253 246,246,246 242,242,242 191,191,191 255,255,255 236,236,236 +253,253,253 249,249,249 251,251,251 252,252,252 247,247,247 251,251,251 209,209,209 250,250,250 255,255,255 255,255,255 255,255,255 210,210,210 255,255,255 255,255,255 252,252,252 251,251,251 255,255,255 238,238,238 255,255,255 250,250,250 241,241,241 249,249,249 248,248,248 255,255,255 186,186,186 189,189,189 187,187,187 198,198,198 190,190,190 185,185,185 199,199,199 180,180,180 255,255,255 199,199,199 251,251,251 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 255,255,255 191,191,191 248,248,248 255,255,255 249,249,249 176,176,176 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 180,180,180 252,252,252 247,247,247 +255,255,255 253,253,253 254,254,254 255,255,255 248,248,248 253,253,253 197,197,197 251,251,251 249,249,249 240,240,240 251,251,251 188,188,188 253,253,253 255,255,255 255,255,255 255,255,255 252,252,252 237,237,237 247,247,247 255,255,255 188,188,188 210,210,210 193,193,193 183,183,183 198,198,198 244,244,244 255,255,255 255,255,255 244,244,244 253,253,253 255,255,255 186,186,186 250,250,250 191,191,191 245,245,245 252,252,252 251,251,251 255,255,255 251,251,251 252,252,252 255,255,255 251,251,251 247,247,247 255,255,255 252,252,252 192,192,192 251,251,251 255,255,255 255,255,255 191,191,191 255,255,255 255,255,255 244,244,244 247,247,247 244,244,244 245,245,245 251,251,251 188,188,188 255,255,255 255,255,255 +255,255,255 253,253,253 253,253,253 255,255,255 248,248,248 254,254,254 189,189,189 253,253,253 254,254,254 254,254,254 255,255,255 193,193,193 245,245,245 254,254,254 244,244,244 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 195,195,195 235,235,235 249,249,249 255,255,255 191,191,191 240,240,240 254,254,254 255,255,255 243,243,243 254,254,254 255,255,255 187,187,187 253,253,253 196,196,196 253,253,253 255,255,255 255,255,255 255,255,255 250,250,250 251,251,251 255,255,255 253,253,253 249,249,249 253,253,253 252,252,252 194,194,194 249,249,249 247,247,247 250,250,250 203,203,203 249,249,249 253,253,253 242,242,242 255,255,255 255,255,255 255,255,255 255,255,255 192,192,192 201,201,201 186,186,186 +255,255,255 252,252,252 253,253,253 255,255,255 249,249,249 255,255,255 187,187,187 255,255,255 250,250,250 255,255,255 252,252,252 179,179,179 200,200,200 209,209,209 179,179,179 197,197,197 179,179,179 185,185,185 199,199,199 191,191,191 192,192,192 199,199,199 197,197,197 187,187,187 186,186,186 197,197,197 185,185,185 195,195,195 182,182,182 195,195,195 238,238,238 198,198,198 248,248,248 194,194,194 251,251,251 255,255,255 251,251,251 255,255,255 252,252,252 255,255,255 249,249,249 254,254,254 255,255,255 255,255,255 252,252,252 178,178,178 208,208,208 186,186,186 206,206,206 169,169,169 194,194,194 200,200,200 183,183,183 195,195,195 186,186,186 183,183,183 187,187,187 193,193,193 247,247,247 255,255,255 +255,255,255 254,254,254 246,246,246 255,255,255 241,241,241 255,255,255 209,209,209 250,250,250 255,255,255 250,250,250 251,251,251 188,188,188 193,193,193 249,249,249 255,255,255 250,250,250 245,245,245 255,255,255 255,255,255 241,241,241 255,255,255 252,252,252 255,255,255 255,255,255 251,251,251 249,249,249 255,255,255 255,255,255 250,250,250 200,200,200 239,239,239 194,194,194 254,254,254 186,186,186 245,245,245 251,251,251 244,244,244 255,255,255 249,249,249 252,252,252 249,249,249 255,255,255 241,241,241 255,255,255 245,245,245 179,179,179 254,254,254 255,255,255 201,201,201 246,246,246 242,242,242 255,255,255 255,255,255 247,247,247 185,185,185 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 251,251,251 252,252,252 255,255,255 255,255,255 232,232,232 175,175,175 247,247,247 232,232,232 255,255,255 255,255,255 194,194,194 193,193,193 255,255,255 255,255,255 245,245,245 255,255,255 248,248,248 248,248,248 254,254,254 238,238,238 255,255,255 255,255,255 244,244,244 255,255,255 251,251,251 236,236,236 246,246,246 250,250,250 187,187,187 224,224,224 185,185,185 244,244,244 182,182,182 255,255,255 255,255,255 243,243,243 230,230,230 255,255,255 249,249,249 255,255,255 231,231,231 251,251,251 255,255,255 254,254,254 197,197,197 255,255,255 231,231,231 196,196,196 255,255,255 255,255,255 254,254,254 249,249,249 250,250,250 193,193,193 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +244,244,244 255,255,255 249,249,249 224,224,224 255,255,255 255,255,255 187,187,187 218,218,218 193,193,193 205,205,205 175,175,175 175,175,175 196,196,196 254,254,254 230,230,230 255,255,255 238,238,238 252,252,252 248,248,248 255,255,255 255,255,255 252,252,252 239,239,239 255,255,255 239,239,239 255,255,255 255,255,255 255,255,255 255,255,255 188,188,188 252,252,252 241,241,241 249,249,249 205,205,205 239,239,239 244,244,244 252,252,252 255,255,255 238,238,238 255,255,255 255,255,255 250,250,250 255,255,255 241,241,241 255,255,255 199,199,199 249,249,249 255,255,255 171,171,171 240,240,240 255,255,255 255,255,255 255,255,255 255,255,255 194,194,194 249,249,249 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 241,241,241 254,254,254 255,255,255 239,239,239 3,3,3 0,0,0 244,244,244 243,243,243 255,255,255 255,255,255 8,8,8 0,0,0 247,247,247 14,14,14 0,0,0 244,244,244 255,255,255 252,252,252 250,250,250 0,0,0 0,0,0 255,255,255 0,0,0 6,6,6 238,238,238 242,242,242 249,249,249 255,255,255 0,0,0 0,0,0 255,255,255 2,2,2 8,8,8 0,0,0 17,17,17 12,12,12 0,0,0 12,12,12 0,0,0 178,178,178 189,189,189 190,190,190 11,11,11 0,0,0 0,0,0 0,0,0 241,241,241 227,227,227 255,255,255 248,248,248 245,245,245 236,236,236 250,250,250 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 245,245,245 251,251,251 255,255,255 248,248,248 2,2,2 0,0,0 255,255,255 249,249,249 251,251,251 241,241,241 0,0,0 0,0,0 255,255,255 1,1,1 0,0,0 255,255,255 243,243,243 232,232,232 255,255,255 0,0,0 3,3,3 255,255,255 0,0,0 0,0,0 252,252,252 255,255,255 236,236,236 250,250,250 0,0,0 4,4,4 255,255,255 12,12,12 0,0,0 255,255,255 248,248,248 228,228,228 201,201,201 254,254,254 249,249,249 255,255,255 255,255,255 5,5,5 0,0,0 255,255,255 255,255,255 12,12,12 10,10,10 155,155,155 250,250,250 245,245,245 255,255,255 253,253,253 255,255,255 187,187,187 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 255,255,255 255,255,255 253,253,253 250,250,250 4,4,4 0,0,0 250,250,250 255,255,255 242,242,242 255,255,255 3,3,3 0,0,0 255,255,255 0,0,0 6,6,6 237,237,237 255,255,255 233,233,233 255,255,255 0,0,0 12,12,12 241,241,241 0,0,0 9,9,9 248,248,248 255,255,255 234,234,234 253,253,253 4,4,4 0,0,0 251,251,251 0,0,0 0,0,0 255,255,255 255,255,255 246,246,246 205,205,205 255,255,255 243,243,243 250,250,250 0,0,0 10,10,10 255,255,255 247,247,247 241,241,241 178,178,178 6,6,6 19,19,19 203,203,203 195,195,195 196,196,196 192,192,192 220,220,220 185,185,185 251,251,251 255,255,255 255,255,255 255,255,255 255,255,255 +247,247,247 255,255,255 254,254,254 254,254,254 251,251,251 9,9,9 5,5,5 248,248,248 243,243,243 255,255,255 240,240,240 15,15,15 8,8,8 242,242,242 8,8,8 7,7,7 255,255,255 241,241,241 255,255,255 249,249,249 8,8,8 0,0,0 213,213,213 194,194,194 1,1,1 0,0,0 191,191,191 209,209,209 3,3,3 3,3,3 213,213,213 182,182,182 1,1,1 7,7,7 182,182,182 190,190,190 199,199,199 181,181,181 188,188,188 188,188,188 195,195,195 2,2,2 0,0,0 255,255,255 251,251,251 252,252,252 232,232,232 0,0,0 0,0,0 250,250,250 243,243,243 255,255,255 246,246,246 244,244,244 197,197,197 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 255,255,255 249,249,249 255,255,255 245,245,245 0,0,0 0,0,0 255,255,255 255,255,255 253,253,253 255,255,255 0,0,0 0,0,0 255,255,255 0,0,0 0,0,0 4,4,4 0,0,0 4,4,4 11,11,11 0,0,0 0,0,0 254,254,254 255,255,255 1,1,1 10,10,10 253,253,253 250,250,250 0,0,0 0,0,0 239,239,239 255,255,255 4,4,4 0,0,0 5,5,5 0,0,0 14,14,14 0,0,0 254,254,254 251,251,251 255,255,255 0,0,0 8,8,8 245,245,245 255,255,255 248,248,248 176,176,176 7,7,7 0,0,0 255,255,255 234,234,234 255,255,255 255,255,255 239,239,239 195,195,195 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +190,190,190 196,196,196 179,179,179 201,201,201 195,195,195 0,0,0 7,7,7 255,255,255 181,181,181 201,201,201 190,190,190 0,0,0 1,1,1 246,246,246 0,0,0 0,0,0 252,252,252 255,255,255 254,254,254 248,248,248 0,0,0 0,0,0 255,255,255 249,249,249 0,0,0 7,7,7 240,240,240 252,252,252 6,6,6 10,10,10 239,239,239 255,255,255 0,0,0 6,6,6 246,246,246 255,255,255 248,248,248 253,253,253 255,255,255 251,251,251 245,245,245 0,0,0 4,4,4 243,243,243 255,255,255 246,246,246 197,197,197 0,0,0 0,0,0 255,255,255 244,244,244 255,255,255 255,255,255 244,244,244 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 255,255,255 249,249,249 238,238,238 255,255,255 0,0,0 0,0,0 255,255,255 188,188,188 233,233,233 255,255,255 0,0,0 12,12,12 248,248,248 6,6,6 0,0,0 245,245,245 255,255,255 237,237,237 255,255,255 17,17,17 0,0,0 241,241,241 253,253,253 255,255,255 0,0,0 13,13,13 0,0,0 0,0,0 250,250,250 248,248,248 249,249,249 2,2,2 0,0,0 240,240,240 252,252,252 245,245,245 254,254,254 255,255,255 250,250,250 255,255,255 8,8,8 5,5,5 255,255,255 255,255,255 237,237,237 197,197,197 3,3,3 13,13,13 255,255,255 252,252,252 244,244,244 241,241,241 255,255,255 201,201,201 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 236,236,236 255,255,255 251,251,251 252,252,252 0,0,0 0,0,0 252,252,252 207,207,207 255,255,255 255,255,255 0,0,0 0,0,0 255,255,255 0,0,0 6,6,6 255,255,255 255,255,255 233,233,233 250,250,250 0,0,0 0,0,0 248,248,248 255,255,255 250,250,250 13,13,13 0,0,0 12,12,12 3,3,3 243,243,243 255,255,255 251,251,251 10,10,10 0,0,0 255,255,255 255,255,255 249,249,249 251,251,251 255,255,255 248,248,248 228,228,228 6,6,6 3,3,3 237,237,237 249,249,249 255,255,255 172,172,172 11,11,11 0,0,0 217,217,217 255,255,255 255,255,255 248,248,248 255,255,255 190,190,190 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 +249,249,249 253,253,253 251,251,251 244,244,244 251,251,251 255,255,255 0,0,0 8,8,8 176,176,176 171,171,171 8,8,8 10,10,10 192,192,192 232,232,232 1,1,1 1,1,1 251,251,251 250,250,250 255,255,255 255,255,255 2,2,2 8,8,8 255,255,255 238,238,238 247,247,247 255,255,255 0,0,0 2,2,2 242,242,242 255,255,255 242,242,242 245,245,245 0,0,0 0,0,0 253,253,253 252,252,252 245,245,245 246,246,246 255,255,255 255,255,255 255,255,255 194,194,194 0,0,0 8,8,8 255,255,255 241,241,241 14,14,14 0,0,0 250,250,250 255,255,255 253,253,253 250,250,250 247,247,247 255,255,255 189,189,189 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +242,242,242 194,194,194 209,209,209 195,195,195 188,188,188 179,179,179 213,213,213 0,0,0 11,11,11 1,1,1 10,10,10 236,236,236 185,185,185 197,197,197 3,3,3 0,0,0 185,185,185 183,183,183 215,215,215 170,170,170 2,2,2 0,0,0 234,234,234 255,255,255 255,255,255 239,239,239 13,13,13 0,0,0 244,244,244 255,255,255 255,255,255 255,255,255 4,4,4 8,8,8 240,240,240 252,252,252 255,255,255 255,255,255 255,255,255 247,247,247 245,245,245 183,183,183 255,255,255 0,0,0 0,0,0 15,15,15 0,0,0 247,247,247 244,244,244 249,249,249 247,247,247 255,255,255 249,249,249 250,250,250 181,181,181 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 194,194,194 232,232,232 246,246,246 255,255,255 255,255,255 255,255,255 255,255,255 242,242,242 255,255,255 181,181,181 247,247,247 211,211,211 251,251,251 251,251,251 255,255,255 255,255,255 218,218,218 237,237,237 244,244,244 255,255,255 216,216,216 255,255,255 249,249,249 237,237,237 249,249,249 255,255,255 249,249,249 255,255,255 240,240,240 240,240,240 255,255,255 233,233,233 188,188,188 255,255,255 244,244,244 244,244,244 248,248,248 255,255,255 253,253,253 248,248,248 179,179,179 223,223,223 174,174,174 183,183,183 189,189,189 182,182,182 253,253,253 255,255,255 251,251,251 239,239,239 250,250,250 253,253,253 255,255,255 192,192,192 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 +253,253,253 191,191,191 255,255,255 237,237,237 251,251,251 239,239,239 241,241,241 255,255,255 255,255,255 238,238,238 186,186,186 255,255,255 193,193,193 255,255,255 232,232,232 254,254,254 245,245,245 199,199,199 253,253,253 247,247,247 247,247,247 186,186,186 178,178,178 205,205,205 212,212,212 177,177,177 188,188,188 200,200,200 184,184,184 188,188,188 205,205,205 200,200,200 200,200,200 187,187,187 240,240,240 241,241,241 255,255,255 255,255,255 255,255,255 241,241,241 253,253,253 214,214,214 215,215,215 255,255,255 253,253,253 252,252,252 195,195,195 251,251,251 244,244,244 255,255,255 255,255,255 255,255,255 243,243,243 249,249,249 193,193,193 254,254,254 255,255,255 255,255,255 255,255,255 255,255,255 +255,255,255 162,162,162 255,255,255 255,255,255 252,252,252 252,252,252 255,255,255 242,242,242 255,255,255 247,247,247 199,199,199 250,250,250 198,198,198 220,220,220 255,255,255 244,244,244 255,255,255 176,176,176 255,255,255 255,255,255 249,249,249 255,255,255 255,255,255 245,245,245 239,239,239 210,210,210 243,243,243 253,253,253 255,255,255 248,248,248 252,252,252 251,251,251 254,254,254 253,253,253 255,255,255 249,249,249 251,251,251 246,246,246 255,255,255 255,255,255 255,255,255 180,180,180 255,255,255 255,255,255 255,255,255 242,242,242 200,200,200 248,248,248 255,255,255 255,255,255 246,246,246 254,254,254 255,255,255 255,255,255 197,197,197 247,247,247 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 248,248,248 255,255,255 179,179,179 250,250,250 183,183,183 255,255,255 250,250,250 255,255,255 255,255,255 192,192,192 250,250,250 255,255,255 246,246,246 253,253,253 255,255,255 255,255,255 255,255,255 206,206,206 180,180,180 191,191,191 194,194,194 193,193,193 186,186,186 190,190,190 195,195,195 185,185,185 190,190,190 201,201,201 189,189,189 190,190,190 179,179,179 204,204,204 187,187,187 200,200,200 245,245,245 255,255,255 255,255,255 245,245,245 200,200,200 187,187,187 187,187,187 193,193,193 197,197,197 195,195,195 192,192,192 200,200,200 188,188,188 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 253,253,253 255,255,255 191,191,191 255,255,255 195,195,195 255,255,255 249,249,249 252,252,252 249,249,249 189,189,189 250,250,250 255,255,255 252,252,252 255,255,255 253,253,253 252,252,252 243,243,243 235,235,235 253,253,253 255,255,255 246,246,246 246,246,246 249,249,249 255,255,255 255,255,255 250,250,250 255,255,255 255,255,255 251,251,251 255,255,255 242,242,242 255,255,255 253,253,253 246,246,246 255,255,255 253,253,253 253,253,253 255,255,255 246,246,246 253,253,253 254,254,254 252,252,252 249,249,249 248,248,248 247,247,247 243,243,243 205,205,205 252,252,252 252,252,252 252,252,252 252,252,252 252,252,252 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 253,253,253 184,184,184 253,253,253 189,189,189 251,251,251 241,241,241 245,245,245 250,250,250 194,194,194 252,252,252 255,255,255 254,254,254 255,255,255 251,251,251 249,249,249 255,255,255 246,246,246 255,255,255 250,250,250 244,244,244 255,255,255 255,255,255 248,248,248 252,252,252 249,249,249 250,250,250 254,254,254 237,237,237 255,255,255 252,252,252 255,255,255 255,255,255 250,250,250 254,254,254 246,246,246 246,246,246 254,254,254 250,250,250 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 250,250,250 203,203,203 240,240,240 254,254,254 254,254,254 254,254,254 254,254,254 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 190,190,190 255,255,255 196,196,196 255,255,255 254,254,254 255,255,255 255,255,255 202,202,202 252,252,252 252,252,252 251,251,251 255,255,255 250,250,250 254,254,254 237,237,237 189,189,189 197,197,197 181,181,181 187,187,187 205,205,205 201,201,201 180,180,180 186,186,186 192,192,192 196,196,196 203,203,203 186,186,186 246,246,246 253,253,253 255,255,255 246,246,246 248,248,248 255,255,255 255,255,255 255,255,255 255,255,255 248,248,248 246,246,246 243,243,243 250,250,250 255,255,255 253,253,253 249,249,249 246,246,246 208,208,208 253,253,253 255,255,255 255,255,255 255,255,255 255,255,255 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 255,255,255 255,255,255 195,195,195 254,254,254 196,196,196 243,243,243 242,242,242 247,247,247 241,241,241 198,198,198 249,249,249 249,249,249 252,252,252 255,255,255 248,248,248 255,255,255 251,251,251 206,206,206 255,255,255 255,255,255 254,254,254 252,252,252 255,255,255 255,255,255 255,255,255 255,255,255 255,255,255 246,246,246 195,195,195 249,249,249 251,251,251 252,252,252 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 254,254,254 255,255,255 255,255,255 255,255,255 252,252,252 248,248,248 203,203,203 241,241,241 253,253,253 253,253,253 253,253,253 253,253,253 +254,254,254 193,193,193 255,255,255 250,250,250 255,255,255 251,251,251 255,255,255 254,254,254 244,244,244 246,246,246 189,189,189 243,243,243 182,182,182 211,211,211 201,201,201 199,199,199 212,212,212 185,185,185 247,247,247 250,250,250 255,255,255 255,255,255 245,245,245 254,254,254 233,233,233 178,178,178 252,252,252 255,255,255 254,254,254 238,238,238 245,245,245 255,255,255 233,233,233 248,248,248 252,252,252 251,251,251 191,191,191 252,252,252 254,254,254 253,253,253 253,253,253 255,255,255 244,244,244 247,247,247 247,247,247 244,244,244 255,255,255 253,253,253 255,255,255 254,254,254 247,247,247 248,248,248 255,255,255 250,250,250 185,185,185 200,200,200 196,196,196 196,196,196 196,196,196 196,196,196 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output00.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output00.txt new file mode 100644 index 0000000..a1d68a8 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output00.txt @@ -0,0 +1 @@ +EGYK4 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output01.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output01.txt new file mode 100644 index 0000000..716a65f --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output01.txt @@ -0,0 +1 @@ +GRC35 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output02.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output02.txt new file mode 100644 index 0000000..97755f5 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output02.txt @@ -0,0 +1 @@ +6O5W1 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output03.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output03.txt new file mode 100644 index 0000000..67b38cc --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output03.txt @@ -0,0 +1 @@ +J627C diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output04.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output04.txt new file mode 100644 index 0000000..9455128 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output04.txt @@ -0,0 +1 @@ +VLI2C diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output05.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output05.txt new file mode 100644 index 0000000..6ad9a00 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output05.txt @@ -0,0 +1 @@ +O1R7Q diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output06.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output06.txt new file mode 100644 index 0000000..023fa0c --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output06.txt @@ -0,0 +1 @@ +OYTAD diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output07.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output07.txt new file mode 100644 index 0000000..6942a52 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output07.txt @@ -0,0 +1 @@ +ZRMQU diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output08.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output08.txt new file mode 100644 index 0000000..2c6f27b --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output08.txt @@ -0,0 +1 @@ +N9DQS diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output09.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output09.txt new file mode 100644 index 0000000..09b84a0 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output09.txt @@ -0,0 +1 @@ +ZGJS3 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output10.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output10.txt new file mode 100644 index 0000000..482e781 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output10.txt @@ -0,0 +1 @@ +GZMBA diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output11.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output11.txt new file mode 100644 index 0000000..cb3e85b --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output11.txt @@ -0,0 +1 @@ +J14DM diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output12.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output12.txt new file mode 100644 index 0000000..abee004 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output12.txt @@ -0,0 +1 @@ +PQ9AE diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output13.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output13.txt new file mode 100644 index 0000000..1424d32 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output13.txt @@ -0,0 +1 @@ +VWZDO diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output14.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output14.txt new file mode 100644 index 0000000..7f68ee5 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output14.txt @@ -0,0 +1 @@ +WGST7 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output15.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output15.txt new file mode 100644 index 0000000..eddebd6 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output15.txt @@ -0,0 +1 @@ +XKMS2 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output16.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output16.txt new file mode 100644 index 0000000..8b51c0c --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output16.txt @@ -0,0 +1 @@ +1D2KB diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output17.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output17.txt new file mode 100644 index 0000000..5378e0c --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output17.txt @@ -0,0 +1 @@ +20BHQ diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output18.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output18.txt new file mode 100644 index 0000000..40856c6 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output18.txt @@ -0,0 +1 @@ +OAH0V diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output19.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output19.txt new file mode 100644 index 0000000..c420d70 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output19.txt @@ -0,0 +1 @@ +5I8VE diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output20.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output20.txt new file mode 100644 index 0000000..d53f349 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output20.txt @@ -0,0 +1 @@ +Z97ME diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output21.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output21.txt new file mode 100644 index 0000000..16dfd0b --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output21.txt @@ -0,0 +1 @@ +CL69V diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output22.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output22.txt new file mode 100644 index 0000000..b17bf04 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output22.txt @@ -0,0 +1 @@ +HCE91 diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output23.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output23.txt new file mode 100644 index 0000000..0eb579b --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output23.txt @@ -0,0 +1 @@ +WELXV diff --git a/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output24.txt b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output24.txt new file mode 100644 index 0000000..1880e6e --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/sampleCaptchas/output/output24.txt @@ -0,0 +1 @@ +UHVFO diff --git a/hackerrank/AI/Digital-Image-Analysis/test-the-captcha/input.txt b/hackerrank/AI/Digital-Image-Analysis/test-the-captcha/input.txt new file mode 100644 index 0000000..f708d80 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/test-the-captcha/input.txt @@ -0,0 +1 @@ +[255.0, 250.0, 254.0, 250.0, 254.0, 255.0, 253.0, 254.0, 255.0, 255.0, 255.0, 250.0, 255.0, 249.0, 255.0, 253.0, 254.0, 233.0, 255.0, 249.0, 255.0, 239.0, 195.0, 247.0, 245.0, 249.0, 252.0, 247.0, 254.0, 255.0, 246.0, 254.0, 255.0, 178.0, 203.0, 192.0, 187.0, 195.0, 190.0, 189.0, 193.0, 196.0, 188.0, 186.0, 201.0, 180.0, 255.0, 255.0, 240.0, 255.0, 250.0, 255.0, 255.0, 247.0, 252.0, 248.0, 245.0, 255.0, 242.0, 251.0, 255.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 255.0, 248.0, 255.0, 250.0, 253.0, 250.0, 251.0, 250.0, 250.0, 255.0, 255.0, 242.0, 249.0, 255.0, 255.0, 187.0, 252.0, 255.0, 255.0, 255.0, 245.0, 249.0, 255.0, 255.0, 255.0, 255.0, 196.0, 245.0, 249.0, 247.0, 255.0, 250.0, 250.0, 249.0, 254.0, 252.0, 252.0, 252.0, 203.0, 255.0, 247.0, 255.0, 248.0, 247.0, 245.0, 251.0, 250.0, 255.0, 255.0, 255.0, 252.0, 248.0, 243.0, 251.0, 247.0, 251.0, 250.0, 252.0, 255.0, 240.0, 255.0, 248.0, 255.0, 253.0, 255.0, 251.0, 255.0, 253.0, 255.0, 237.0, 255.0, 249.0, 251.0, 251.0, 251.0, 179.0, 255.0, 254.0, 253.0, 251.0, 253.0, 253.0, 250.0, 251.0, 253.0, 243.0, 192.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 195.0, 251.0, 249.0, 240.0, 185.0, 207.0, 191.0, 195.0, 192.0, 195.0, 190.0, 184.0, 195.0, 255.0, 252.0, 195.0, 191.0, 195.0, 195.0, 194.0, 198.0, 170.0, 198.0, 188.0, 195.0, 188.0, 172.0, 184.0, 196.0, 183.0, 188.0, 184.0, 191.0, 204.0, 182.0, 196.0, 198.0, 192.0, 255.0, 255.0, 247.0, 243.0, 255.0, 255.0, 244.0, 253.0, 255.0, 250.0, 196.0, 253.0, 255.0, 248.0, 250.0, 248.0, 253.0, 253.0, 247.0, 244.0, 251.0, 248.0, 189.0, 253.0, 255.0, 255.0, 189.0, 253.0, 244.0, 253.0, 252.0, 253.0, 246.0, 242.0, 191.0, 255.0, 236.0, 253.0, 249.0, 251.0, 252.0, 247.0, 251.0, 209.0, 250.0, 255.0, 255.0, 255.0, 210.0, 255.0, 255.0, 252.0, 251.0, 255.0, 238.0, 255.0, 250.0, 241.0, 249.0, 248.0, 255.0, 186.0, 189.0, 187.0, 198.0, 190.0, 185.0, 199.0, 180.0, 255.0, 199.0, 251.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 252.0, 252.0, 255.0, 255.0, 191.0, 248.0, 255.0, 249.0, 176.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 180.0, 252.0, 247.0, 255.0, 253.0, 254.0, 255.0, 248.0, 253.0, 197.0, 251.0, 249.0, 240.0, 251.0, 188.0, 253.0, 255.0, 255.0, 255.0, 252.0, 237.0, 247.0, 255.0, 188.0, 210.0, 193.0, 183.0, 198.0, 244.0, 255.0, 255.0, 244.0, 253.0, 255.0, 186.0, 250.0, 191.0, 245.0, 252.0, 251.0, 255.0, 251.0, 252.0, 255.0, 251.0, 247.0, 255.0, 252.0, 192.0, 251.0, 255.0, 255.0, 191.0, 255.0, 255.0, 244.0, 247.0, 244.0, 245.0, 251.0, 188.0, 255.0, 255.0, 255.0, 253.0, 253.0, 255.0, 248.0, 254.0, 189.0, 253.0, 254.0, 254.0, 255.0, 193.0, 245.0, 254.0, 244.0, 255.0, 255.0, 255.0, 255.0, 255.0, 195.0, 235.0, 249.0, 255.0, 191.0, 240.0, 254.0, 255.0, 243.0, 254.0, 255.0, 187.0, 253.0, 196.0, 253.0, 255.0, 255.0, 255.0, 250.0, 251.0, 255.0, 253.0, 249.0, 253.0, 252.0, 194.0, 249.0, 247.0, 250.0, 203.0, 249.0, 253.0, 242.0, 255.0, 255.0, 255.0, 255.0, 192.0, 201.0, 186.0, 255.0, 252.0, 253.0, 255.0, 249.0, 255.0, 187.0, 255.0, 250.0, 255.0, 252.0, 179.0, 200.0, 209.0, 179.0, 197.0, 179.0, 185.0, 199.0, 191.0, 192.0, 199.0, 197.0, 187.0, 186.0, 197.0, 185.0, 195.0, 182.0, 195.0, 238.0, 198.0, 248.0, 194.0, 251.0, 255.0, 251.0, 255.0, 252.0, 255.0, 249.0, 254.0, 255.0, 255.0, 252.0, 178.0, 208.0, 186.0, 206.0, 169.0, 194.0, 200.0, 183.0, 195.0, 186.0, 183.0, 187.0, 193.0, 247.0, 255.0, 255.0, 255.0, 253.0, 244.0, 246.0, 255.0, 197.0, 253.0, 254.0, 255.0, 255.0, 181.0, 194.0, 253.0, 255.0, 249.0, 239.0, 255.0, 255.0, 245.0, 255.0, 247.0, 255.0, 255.0, 255.0, 255.0, 254.0, 241.0, 255.0, 193.0, 232.0, 199.0, 255.0, 176.0, 251.0, 255.0, 238.0, 252.0, 255.0, 254.0, 255.0, 249.0, 255.0, 245.0, 253.0, 188.0, 251.0, 255.0, 192.0, 255.0, 251.0, 249.0, 255.0, 250.0, 181.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 245.0, 249.0, 255.0, 255.0, 248.0, 185.0, 241.0, 235.0, 255.0, 246.0, 200.0, 193.0, 245.0, 246.0, 255.0, 255.0, 232.0, 255.0, 253.0, 242.0, 255.0, 246.0, 255.0, 255.0, 223.0, 255.0, 255.0, 241.0, 183.0, 236.0, 191.0, 241.0, 203.0, 250.0, 236.0, 247.0, 255.0, 243.0, 254.0, 248.0, 255.0, 249.0, 255.0, 253.0, 192.0, 250.0, 245.0, 192.0, 255.0, 255.0, 253.0, 255.0, 253.0, 184.0, 252.0, 255.0, 255.0, 255.0, 255.0, 244.0, 251.0, 255.0, 255.0, 238.0, 255.0, 171.0, 219.0, 197.0, 198.0, 174.0, 209.0, 195.0, 252.0, 255.0, 249.0, 246.0, 255.0, 231.0, 255.0, 242.0, 246.0, 255.0, 248.0, 249.0, 255.0, 255.0, 249.0, 245.0, 179.0, 255.0, 228.0, 249.0, 194.0, 255.0, 255.0, 255.0, 243.0, 239.0, 255.0, 255.0, 238.0, 255.0, 255.0, 231.0, 207.0, 255.0, 254.0, 179.0, 247.0, 252.0, 251.0, 255.0, 255.0, 194.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 241.0, 240.0, 255.0, 0.0, 0.0, 18.0, 0.0, 3.0, 18.0, 0.0, 197.0, 244.0, 229.0, 250.0, 0.0, 0.0, 18.0, 6.0, 0.0, 247.0, 255.0, 3.0, 12.0, 218.0, 255.0, 240.0, 255.0, 18.0, 0.0, 255.0, 14.0, 3.0, 176.0, 186.0, 191.0, 191.0, 0.0, 0.0, 170.0, 200.0, 188.0, 196.0, 216.0, 170.0, 0.0, 0.0, 203.0, 255.0, 255.0, 249.0, 246.0, 250.0, 191.0, 251.0, 255.0, 255.0, 255.0, 255.0, 247.0, 241.0, 255.0, 255.0, 243.0, 0.0, 0.0, 250.0, 248.0, 248.0, 237.0, 250.0, 188.0, 255.0, 255.0, 10.0, 0.0, 254.0, 234.0, 242.0, 13.0, 13.0, 245.0, 0.0, 0.0, 246.0, 255.0, 242.0, 254.0, 0.0, 0.0, 255.0, 0.0, 0.0, 255.0, 255.0, 247.0, 0.0, 36.0, 247.0, 255.0, 251.0, 239.0, 245.0, 248.0, 12.0, 2.0, 13.0, 182.0, 237.0, 248.0, 255.0, 255.0, 255.0, 192.0, 243.0, 255.0, 255.0, 255.0, 255.0, 253.0, 248.0, 255.0, 239.0, 255.0, 2.0, 15.0, 250.0, 255.0, 245.0, 255.0, 255.0, 173.0, 255.0, 0.0, 0.0, 255.0, 255.0, 247.0, 255.0, 247.0, 236.0, 249.0, 247.0, 0.0, 19.0, 247.0, 250.0, 1.0, 13.0, 250.0, 252.0, 0.0, 0.0, 255.0, 255.0, 0.0, 7.0, 233.0, 252.0, 239.0, 234.0, 255.0, 240.0, 0.0, 0.0, 0.0, 0.0, 196.0, 209.0, 185.0, 180.0, 184.0, 210.0, 184.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 246.0, 255.0, 255.0, 234.0, 0.0, 0.0, 249.0, 255.0, 231.0, 255.0, 243.0, 178.0, 255.0, 25.0, 0.0, 253.0, 230.0, 251.0, 255.0, 255.0, 189.0, 206.0, 188.0, 200.0, 0.0, 19.0, 0.0, 2.0, 159.0, 203.0, 191.0, 0.0, 8.0, 180.0, 11.0, 0.0, 170.0, 212.0, 184.0, 192.0, 194.0, 239.0, 10.0, 10.0, 255.0, 0.0, 10.0, 243.0, 255.0, 247.0, 255.0, 255.0, 247.0, 186.0, 240.0, 255.0, 255.0, 255.0, 255.0, 251.0, 255.0, 239.0, 240.0, 255.0, 0.0, 0.0, 2.0, 0.0, 10.0, 0.0, 235.0, 213.0, 250.0, 0.0, 6.0, 251.0, 255.0, 255.0, 235.0, 255.0, 192.0, 243.0, 255.0, 251.0, 255.0, 0.0, 8.0, 255.0, 255.0, 250.0, 247.0, 0.0, 0.0, 10.0, 0.0, 255.0, 248.0, 255.0, 252.0, 255.0, 197.0, 6.0, 0.0, 252.0, 255.0, 0.0, 0.0, 255.0, 255.0, 239.0, 255.0, 251.0, 248.0, 197.0, 255.0, 255.0, 255.0, 255.0, 255.0, 191.0, 192.0, 194.0, 198.0, 195.0, 4.0, 2.0, 247.0, 179.0, 207.0, 184.0, 182.0, 220.0, 219.0, 15.0, 0.0, 243.0, 255.0, 243.0, 0.0, 5.0, 0.0, 247.0, 255.0, 247.0, 255.0, 0.0, 0.0, 255.0, 246.0, 236.0, 255.0, 3.0, 3.0, 0.0, 0.0, 255.0, 250.0, 252.0, 255.0, 255.0, 0.0, 0.0, 255.0, 241.0, 254.0, 18.0, 0.0, 249.0, 255.0, 246.0, 255.0, 255.0, 251.0, 210.0, 244.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 239.0, 240.0, 246.0, 8.0, 1.0, 255.0, 199.0, 232.0, 251.0, 255.0, 184.0, 255.0, 0.0, 0.0, 255.0, 234.0, 255.0, 255.0, 3.0, 11.0, 228.0, 255.0, 255.0, 239.0, 0.0, 4.0, 250.0, 254.0, 255.0, 251.0, 0.0, 0.0, 255.0, 12.0, 0.0, 254.0, 253.0, 246.0, 252.0, 5.0, 18.0, 0.0, 13.0, 0.0, 0.0, 21.0, 2.0, 233.0, 255.0, 235.0, 252.0, 251.0, 183.0, 255.0, 255.0, 255.0, 255.0, 255.0, 238.0, 254.0, 255.0, 255.0, 255.0, 0.0, 0.0, 253.0, 195.0, 255.0, 255.0, 253.0, 185.0, 244.0, 14.0, 0.0, 254.0, 245.0, 253.0, 244.0, 0.0, 0.0, 255.0, 255.0, 255.0, 255.0, 1.0, 0.0, 255.0, 246.0, 249.0, 248.0, 14.0, 0.0, 255.0, 241.0, 2.0, 21.0, 255.0, 249.0, 251.0, 196.0, 236.0, 255.0, 243.0, 253.0, 8.0, 0.0, 255.0, 255.0, 247.0, 255.0, 249.0, 252.0, 211.0, 239.0, 255.0, 255.0, 255.0, 255.0, 255.0, 248.0, 249.0, 240.0, 245.0, 5.0, 31.0, 233.0, 190.0, 202.0, 179.0, 203.0, 197.0, 239.0, 255.0, 0.0, 6.0, 255.0, 255.0, 255.0, 13.0, 0.0, 255.0, 248.0, 236.0, 243.0, 0.0, 8.0, 241.0, 252.0, 255.0, 255.0, 0.0, 0.0, 255.0, 255.0, 249.0, 0.0, 0.0, 255.0, 247.0, 194.0, 255.0, 252.0, 255.0, 242.0, 1.0, 0.0, 243.0, 250.0, 242.0, 255.0, 255.0, 244.0, 194.0, 255.0, 255.0, 255.0, 255.0, 255.0, 239.0, 186.0, 203.0, 190.0, 188.0, 2.0, 0.0, 8.0, 0.0, 0.0, 0.0, 8.0, 193.0, 197.0, 159.0, 197.0, 0.0, 0.0, 0.0, 8.0, 0.0, 170.0, 250.0, 255.0, 255.0, 255.0, 6.0, 0.0, 244.0, 255.0, 247.0, 255.0, 6.0, 0.0, 248.0, 255.0, 248.0, 255.0, 0.0, 5.0, 255.0, 185.0, 238.0, 255.0, 251.0, 254.0, 9.0, 5.0, 247.0, 255.0, 248.0, 232.0, 255.0, 255.0, 182.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 188.0, 238.0, 243.0, 255.0, 239.0, 255.0, 255.0, 253.0, 250.0, 215.0, 248.0, 204.0, 247.0, 255.0, 249.0, 255.0, 212.0, 251.0, 248.0, 255.0, 212.0, 255.0, 241.0, 240.0, 255.0, 236.0, 255.0, 255.0, 236.0, 255.0, 240.0, 242.0, 179.0, 252.0, 255.0, 255.0, 236.0, 255.0, 235.0, 249.0, 171.0, 222.0, 187.0, 164.0, 217.0, 159.0, 255.0, 252.0, 236.0, 254.0, 255.0, 246.0, 247.0, 197.0, 247.0, 255.0, 255.0, 255.0, 255.0, 255.0, 181.0, 255.0, 251.0, 245.0, 242.0, 255.0, 244.0, 255.0, 255.0, 177.0, 240.0, 200.0, 255.0, 241.0, 244.0, 241.0, 201.0, 255.0, 243.0, 242.0, 176.0, 181.0, 192.0, 200.0, 182.0, 186.0, 204.0, 198.0, 193.0, 198.0, 194.0, 197.0, 197.0, 255.0, 246.0, 255.0, 253.0, 255.0, 255.0, 255.0, 195.0, 250.0, 251.0, 245.0, 255.0, 186.0, 253.0, 255.0, 255.0, 249.0, 242.0, 242.0, 255.0, 202.0, 247.0, 255.0, 255.0, 255.0, 255.0, 255.0, 179.0, 255.0, 255.0, 250.0, 255.0, 255.0, 246.0, 248.0, 250.0, 205.0, 249.0, 201.0, 227.0, 255.0, 254.0, 255.0, 173.0, 255.0, 255.0, 254.0, 255.0, 255.0, 252.0, 244.0, 211.0, 240.0, 255.0, 243.0, 251.0, 250.0, 255.0, 250.0, 255.0, 245.0, 245.0, 255.0, 252.0, 238.0, 255.0, 252.0, 191.0, 247.0, 254.0, 255.0, 250.0, 179.0, 255.0, 253.0, 251.0, 255.0, 255.0, 249.0, 247.0, 185.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 248.0, 255.0, 179.0, 250.0, 183.0, 255.0, 250.0, 255.0, 255.0, 192.0, 250.0, 255.0, 246.0, 253.0, 255.0, 255.0, 255.0, 206.0, 180.0, 191.0, 194.0, 193.0, 186.0, 190.0, 195.0, 185.0, 190.0, 201.0, 189.0, 190.0, 179.0, 204.0, 187.0, 200.0, 245.0, 255.0, 255.0, 245.0, 200.0, 187.0, 187.0, 193.0, 197.0, 195.0, 192.0, 200.0, 188.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 253.0, 255.0, 191.0, 255.0, 195.0, 255.0, 249.0, 252.0, 249.0, 189.0, 250.0, 255.0, 252.0, 255.0, 253.0, 252.0, 243.0, 235.0, 253.0, 255.0, 246.0, 246.0, 249.0, 255.0, 255.0, 250.0, 255.0, 255.0, 251.0, 255.0, 242.0, 255.0, 253.0, 246.0, 255.0, 253.0, 253.0, 255.0, 246.0, 253.0, 254.0, 252.0, 249.0, 248.0, 247.0, 243.0, 205.0, 252.0, 252.0, 252.0, 252.0, 252.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 253.0, 184.0, 253.0, 189.0, 251.0, 241.0, 245.0, 250.0, 194.0, 252.0, 255.0, 254.0, 255.0, 251.0, 249.0, 255.0, 246.0, 255.0, 250.0, 244.0, 255.0, 255.0, 248.0, 252.0, 249.0, 250.0, 254.0, 237.0, 255.0, 252.0, 255.0, 255.0, 250.0, 254.0, 246.0, 246.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 250.0, 203.0, 240.0, 254.0, 254.0, 254.0, 254.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 190.0, 255.0, 196.0, 255.0, 254.0, 255.0, 255.0, 202.0, 252.0, 252.0, 251.0, 255.0, 250.0, 254.0, 237.0, 189.0, 197.0, 181.0, 187.0, 205.0, 201.0, 180.0, 186.0, 192.0, 196.0, 203.0, 186.0, 246.0, 253.0, 255.0, 246.0, 248.0, 255.0, 255.0, 255.0, 255.0, 248.0, 246.0, 243.0, 250.0, 255.0, 253.0, 249.0, 246.0, 208.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 195.0, 254.0, 196.0, 243.0, 242.0, 247.0, 241.0, 198.0, 249.0, 249.0, 252.0, 255.0, 248.0, 255.0, 251.0, 206.0, 255.0, 255.0, 254.0, 252.0, 255.0, 255.0, 255.0, 255.0, 255.0, 246.0, 195.0, 249.0, 251.0, 252.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 255.0, 252.0, 248.0, 203.0, 241.0, 253.0, 253.0, 253.0, 253.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 246.0, 189.0, 243.0, 182.0, 211.0, 201.0, 199.0, 212.0, 185.0, 247.0, 250.0, 255.0, 255.0, 245.0, 254.0, 233.0, 178.0, 252.0, 255.0, 254.0, 238.0, 245.0, 255.0, 233.0, 248.0, 252.0, 251.0, 191.0, 252.0, 254.0, 253.0, 253.0, 255.0, 244.0, 247.0, 247.0, 244.0, 255.0, 253.0, 255.0, 254.0, 247.0, 248.0, 255.0, 250.0, 185.0, 200.0, 196.0, 196.0, 196.0, 196.0],[255.0, 250.0, 254.0, 250.0, 254.0, 255.0, 253.0, 254.0, 255.0, 255.0, 255.0, 250.0, 255.0, 249.0, 255.0, 253.0, 254.0, 233.0, 255.0, 249.0, 255.0, 239.0, 195.0, 247.0, 245.0, 249.0, 252.0, 247.0, 254.0, 255.0, 246.0, 254.0, 255.0, 178.0, 203.0, 192.0, 187.0, 195.0, 190.0, 189.0, 193.0, 196.0, 188.0, 186.0, 201.0, 180.0, 255.0, 255.0, 240.0, 255.0, 250.0, 255.0, 255.0, 247.0, 252.0, 248.0, 245.0, 255.0, 242.0, 251.0, 255.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 255.0, 248.0, 255.0, 250.0, 253.0, 250.0, 251.0, 250.0, 250.0, 255.0, 255.0, 242.0, 249.0, 255.0, 255.0, 187.0, 252.0, 255.0, 255.0, 255.0, 245.0, 249.0, 255.0, 255.0, 255.0, 255.0, 196.0, 245.0, 249.0, 247.0, 255.0, 250.0, 250.0, 249.0, 254.0, 252.0, 252.0, 252.0, 203.0, 255.0, 247.0, 255.0, 248.0, 247.0, 245.0, 251.0, 250.0, 255.0, 255.0, 255.0, 252.0, 248.0, 243.0, 251.0, 247.0, 251.0, 250.0, 252.0, 255.0, 240.0, 255.0, 248.0, 255.0, 253.0, 255.0, 251.0, 255.0, 253.0, 255.0, 237.0, 255.0, 249.0, 251.0, 251.0, 251.0, 179.0, 255.0, 254.0, 253.0, 251.0, 253.0, 253.0, 250.0, 251.0, 253.0, 243.0, 192.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 195.0, 251.0, 249.0, 240.0, 185.0, 207.0, 191.0, 195.0, 192.0, 195.0, 190.0, 184.0, 195.0, 255.0, 252.0, 195.0, 191.0, 195.0, 195.0, 194.0, 198.0, 170.0, 198.0, 188.0, 195.0, 188.0, 172.0, 184.0, 196.0, 183.0, 188.0, 184.0, 191.0, 204.0, 182.0, 196.0, 198.0, 192.0, 255.0, 255.0, 247.0, 243.0, 255.0, 255.0, 244.0, 253.0, 255.0, 250.0, 196.0, 253.0, 255.0, 248.0, 250.0, 248.0, 253.0, 253.0, 247.0, 244.0, 251.0, 248.0, 189.0, 253.0, 255.0, 255.0, 189.0, 253.0, 244.0, 253.0, 252.0, 253.0, 246.0, 242.0, 191.0, 255.0, 236.0, 253.0, 249.0, 251.0, 252.0, 247.0, 251.0, 209.0, 250.0, 255.0, 255.0, 255.0, 210.0, 255.0, 255.0, 252.0, 251.0, 255.0, 238.0, 255.0, 250.0, 241.0, 249.0, 248.0, 255.0, 186.0, 189.0, 187.0, 198.0, 190.0, 185.0, 199.0, 180.0, 255.0, 199.0, 251.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 252.0, 252.0, 255.0, 255.0, 191.0, 248.0, 255.0, 249.0, 176.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 180.0, 252.0, 247.0, 255.0, 253.0, 254.0, 255.0, 248.0, 253.0, 197.0, 251.0, 249.0, 240.0, 251.0, 188.0, 253.0, 255.0, 255.0, 255.0, 252.0, 237.0, 247.0, 255.0, 188.0, 210.0, 193.0, 183.0, 198.0, 244.0, 255.0, 255.0, 244.0, 253.0, 255.0, 186.0, 250.0, 191.0, 245.0, 252.0, 251.0, 255.0, 251.0, 252.0, 255.0, 251.0, 247.0, 255.0, 252.0, 192.0, 251.0, 255.0, 255.0, 191.0, 255.0, 255.0, 244.0, 247.0, 244.0, 245.0, 251.0, 188.0, 255.0, 255.0, 255.0, 253.0, 253.0, 255.0, 248.0, 254.0, 189.0, 253.0, 254.0, 254.0, 255.0, 193.0, 245.0, 254.0, 244.0, 255.0, 255.0, 255.0, 255.0, 255.0, 195.0, 235.0, 249.0, 255.0, 191.0, 240.0, 254.0, 255.0, 243.0, 254.0, 255.0, 187.0, 253.0, 196.0, 253.0, 255.0, 255.0, 255.0, 250.0, 251.0, 255.0, 253.0, 249.0, 253.0, 252.0, 194.0, 249.0, 247.0, 250.0, 203.0, 249.0, 253.0, 242.0, 255.0, 255.0, 255.0, 255.0, 192.0, 201.0, 186.0, 255.0, 252.0, 253.0, 255.0, 249.0, 255.0, 187.0, 255.0, 250.0, 255.0, 252.0, 179.0, 200.0, 209.0, 179.0, 197.0, 179.0, 185.0, 199.0, 191.0, 192.0, 199.0, 197.0, 187.0, 186.0, 197.0, 185.0, 195.0, 182.0, 195.0, 238.0, 198.0, 248.0, 194.0, 251.0, 255.0, 251.0, 255.0, 252.0, 255.0, 249.0, 254.0, 255.0, 255.0, 252.0, 178.0, 208.0, 186.0, 206.0, 169.0, 194.0, 200.0, 183.0, 195.0, 186.0, 183.0, 187.0, 193.0, 247.0, 255.0, 255.0, 252.0, 247.0, 255.0, 254.0, 255.0, 198.0, 249.0, 251.0, 251.0, 255.0, 189.0, 182.0, 255.0, 247.0, 255.0, 252.0, 255.0, 247.0, 255.0, 255.0, 248.0, 255.0, 247.0, 255.0, 248.0, 248.0, 255.0, 250.0, 196.0, 253.0, 194.0, 250.0, 213.0, 227.0, 255.0, 243.0, 255.0, 244.0, 252.0, 255.0, 249.0, 255.0, 248.0, 255.0, 180.0, 249.0, 255.0, 192.0, 255.0, 251.0, 249.0, 255.0, 250.0, 181.0, 254.0, 255.0, 255.0, 255.0, 255.0, 246.0, 255.0, 255.0, 238.0, 251.0, 250.0, 167.0, 255.0, 238.0, 255.0, 241.0, 190.0, 201.0, 249.0, 255.0, 230.0, 255.0, 242.0, 254.0, 251.0, 247.0, 248.0, 255.0, 255.0, 250.0, 255.0, 247.0, 243.0, 249.0, 191.0, 187.0, 201.0, 234.0, 166.0, 255.0, 248.0, 251.0, 255.0, 255.0, 255.0, 255.0, 249.0, 251.0, 250.0, 240.0, 202.0, 255.0, 238.0, 192.0, 255.0, 255.0, 253.0, 255.0, 253.0, 184.0, 252.0, 255.0, 255.0, 255.0, 255.0, 255.0, 240.0, 246.0, 255.0, 255.0, 255.0, 172.0, 219.0, 207.0, 167.0, 212.0, 177.0, 192.0, 249.0, 241.0, 255.0, 248.0, 255.0, 241.0, 255.0, 240.0, 255.0, 255.0, 245.0, 255.0, 253.0, 241.0, 255.0, 249.0, 183.0, 255.0, 243.0, 255.0, 212.0, 235.0, 255.0, 249.0, 249.0, 247.0, 246.0, 243.0, 255.0, 235.0, 255.0, 255.0, 202.0, 255.0, 255.0, 179.0, 247.0, 252.0, 251.0, 255.0, 255.0, 194.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 249.0, 255.0, 255.0, 237.0, 236.0, 206.0, 0.0, 0.0, 8.0, 16.0, 8.0, 176.0, 248.0, 1.0, 0.0, 0.0, 4.0, 5.0, 0.0, 1.0, 243.0, 255.0, 244.0, 252.0, 2.0, 0.0, 7.0, 0.0, 2.0, 253.0, 241.0, 218.0, 0.0, 12.0, 0.0, 0.0, 10.0, 184.0, 197.0, 187.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 203.0, 255.0, 255.0, 249.0, 246.0, 250.0, 191.0, 251.0, 255.0, 255.0, 255.0, 255.0, 237.0, 255.0, 244.0, 255.0, 255.0, 255.0, 0.0, 0.0, 246.0, 246.0, 246.0, 0.0, 0.0, 255.0, 9.0, 5.0, 246.0, 255.0, 236.0, 244.0, 4.0, 12.0, 248.0, 249.0, 4.0, 1.0, 250.0, 244.0, 255.0, 0.0, 0.0, 255.0, 27.0, 0.0, 255.0, 255.0, 240.0, 0.0, 5.0, 253.0, 252.0, 19.0, 0.0, 241.0, 255.0, 255.0, 250.0, 255.0, 182.0, 237.0, 248.0, 255.0, 255.0, 255.0, 192.0, 243.0, 255.0, 255.0, 255.0, 255.0, 255.0, 253.0, 255.0, 255.0, 253.0, 0.0, 10.0, 255.0, 255.0, 255.0, 255.0, 244.0, 200.0, 254.0, 0.0, 0.0, 255.0, 237.0, 255.0, 253.0, 7.0, 0.0, 236.0, 25.0, 0.0, 255.0, 255.0, 239.0, 251.0, 229.0, 0.0, 246.0, 235.0, 238.0, 255.0, 255.0, 240.0, 197.0, 0.0, 0.0, 254.0, 0.0, 0.0, 242.0, 238.0, 255.0, 184.0, 186.0, 196.0, 209.0, 185.0, 180.0, 184.0, 210.0, 184.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 253.0, 249.0, 242.0, 255.0, 0.0, 0.0, 255.0, 255.0, 217.0, 255.0, 255.0, 186.0, 255.0, 10.0, 0.0, 238.0, 255.0, 255.0, 246.0, 21.0, 0.0, 221.0, 0.0, 0.0, 187.0, 195.0, 191.0, 189.0, 169.0, 175.0, 224.0, 209.0, 183.0, 186.0, 203.0, 188.0, 5.0, 15.0, 184.0, 192.0, 0.0, 10.0, 255.0, 0.0, 0.0, 9.0, 253.0, 243.0, 255.0, 247.0, 255.0, 255.0, 247.0, 186.0, 240.0, 255.0, 255.0, 255.0, 255.0, 255.0, 251.0, 255.0, 255.0, 236.0, 14.0, 0.0, 250.0, 253.0, 255.0, 255.0, 235.0, 198.0, 249.0, 0.0, 0.0, 3.0, 7.0, 0.0, 6.0, 0.0, 194.0, 240.0, 18.0, 2.0, 244.0, 255.0, 248.0, 255.0, 255.0, 255.0, 233.0, 250.0, 200.0, 255.0, 0.0, 2.0, 7.0, 247.0, 252.0, 255.0, 0.0, 3.0, 0.0, 252.0, 255.0, 0.0, 8.0, 255.0, 255.0, 239.0, 255.0, 251.0, 248.0, 197.0, 255.0, 255.0, 255.0, 255.0, 255.0, 190.0, 196.0, 179.0, 201.0, 195.0, 0.0, 7.0, 255.0, 187.0, 178.0, 11.0, 0.0, 4.0, 255.0, 0.0, 7.0, 0.0, 0.0, 0.0, 255.0, 244.0, 210.0, 238.0, 0.0, 10.0, 246.0, 255.0, 255.0, 245.0, 247.0, 255.0, 246.0, 242.0, 199.0, 255.0, 255.0, 253.0, 0.0, 0.0, 255.0, 255.0, 192.0, 244.0, 255.0, 255.0, 255.0, 190.0, 4.0, 0.0, 255.0, 244.0, 255.0, 255.0, 244.0, 188.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 249.0, 238.0, 255.0, 0.0, 0.0, 255.0, 189.0, 255.0, 246.0, 18.0, 0.0, 255.0, 6.0, 0.0, 255.0, 255.0, 7.0, 2.0, 254.0, 178.0, 249.0, 5.0, 0.0, 255.0, 232.0, 254.0, 255.0, 243.0, 252.0, 255.0, 255.0, 183.0, 244.0, 244.0, 235.0, 255.0, 0.0, 0.0, 255.0, 179.0, 255.0, 236.0, 251.0, 254.0, 190.0, 0.0, 13.0, 255.0, 252.0, 244.0, 241.0, 255.0, 201.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 236.0, 255.0, 251.0, 252.0, 0.0, 0.0, 252.0, 186.0, 239.0, 255.0, 0.0, 12.0, 255.0, 0.0, 0.0, 242.0, 246.0, 255.0, 0.0, 0.0, 193.0, 255.0, 0.0, 7.0, 255.0, 255.0, 244.0, 248.0, 255.0, 0.0, 255.0, 253.0, 176.0, 255.0, 255.0, 255.0, 241.0, 3.0, 12.0, 234.0, 27.0, 6.0, 255.0, 254.0, 255.0, 173.0, 8.0, 0.0, 217.0, 255.0, 255.0, 248.0, 255.0, 190.0, 246.0, 255.0, 255.0, 255.0, 255.0, 249.0, 253.0, 251.0, 244.0, 251.0, 255.0, 0.0, 8.0, 197.0, 202.0, 173.0, 1.0, 0.0, 240.0, 1.0, 3.0, 255.0, 255.0, 248.0, 255.0, 10.0, 0.0, 252.0, 255.0, 0.0, 3.0, 255.0, 255.0, 240.0, 6.0, 11.0, 245.0, 0.0, 10.0, 255.0, 231.0, 253.0, 6.0, 0.0, 248.0, 255.0, 190.0, 0.0, 0.0, 255.0, 252.0, 13.0, 0.0, 250.0, 255.0, 253.0, 250.0, 247.0, 255.0, 189.0, 254.0, 255.0, 255.0, 255.0, 255.0, 242.0, 194.0, 209.0, 195.0, 188.0, 179.0, 213.0, 0.0, 0.0, 0.0, 0.0, 0.0, 207.0, 195.0, 0.0, 10.0, 188.0, 180.0, 200.0, 186.0, 0.0, 6.0, 255.0, 241.0, 255.0, 4.0, 0.0, 5.0, 6.0, 1.0, 233.0, 255.0, 250.0, 11.0, 0.0, 7.0, 6.0, 0.0, 255.0, 255.0, 255.0, 165.0, 255.0, 14.0, 0.0, 0.0, 0.0, 246.0, 244.0, 249.0, 247.0, 255.0, 249.0, 250.0, 181.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 194.0, 232.0, 246.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 202.0, 255.0, 187.0, 255.0, 255.0, 252.0, 253.0, 203.0, 255.0, 255.0, 255.0, 203.0, 247.0, 245.0, 245.0, 240.0, 255.0, 255.0, 250.0, 255.0, 255.0, 235.0, 238.0, 186.0, 249.0, 255.0, 250.0, 248.0, 255.0, 230.0, 237.0, 199.0, 187.0, 186.0, 183.0, 188.0, 188.0, 254.0, 255.0, 251.0, 239.0, 250.0, 253.0, 255.0, 192.0, 248.0, 255.0, 255.0, 255.0, 255.0, 253.0, 191.0, 255.0, 237.0, 251.0, 239.0, 241.0, 255.0, 249.0, 230.0, 186.0, 255.0, 181.0, 229.0, 255.0, 244.0, 255.0, 180.0, 251.0, 234.0, 251.0, 212.0, 161.0, 215.0, 206.0, 184.0, 170.0, 198.0, 199.0, 183.0, 194.0, 205.0, 199.0, 214.0, 233.0, 247.0, 255.0, 249.0, 254.0, 255.0, 255.0, 185.0, 246.0, 255.0, 255.0, 245.0, 191.0, 255.0, 244.0, 255.0, 255.0, 255.0, 243.0, 249.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 162.0, 255.0, 255.0, 252.0, 252.0, 255.0, 242.0, 255.0, 254.0, 201.0, 241.0, 203.0, 242.0, 255.0, 244.0, 254.0, 196.0, 255.0, 255.0, 252.0, 249.0, 253.0, 244.0, 241.0, 207.0, 245.0, 255.0, 255.0, 242.0, 249.0, 255.0, 255.0, 236.0, 255.0, 255.0, 236.0, 255.0, 255.0, 251.0, 248.0, 191.0, 255.0, 246.0, 255.0, 246.0, 194.0, 246.0, 255.0, 255.0, 246.0, 254.0, 255.0, 255.0, 197.0, 247.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 248.0, 255.0, 179.0, 250.0, 183.0, 255.0, 250.0, 255.0, 255.0, 192.0, 250.0, 255.0, 246.0, 253.0, 255.0, 255.0, 255.0, 206.0, 180.0, 191.0, 194.0, 193.0, 186.0, 190.0, 195.0, 185.0, 190.0, 201.0, 189.0, 190.0, 179.0, 204.0, 187.0, 200.0, 245.0, 255.0, 255.0, 245.0, 200.0, 187.0, 187.0, 193.0, 197.0, 195.0, 192.0, 200.0, 188.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 253.0, 255.0, 191.0, 255.0, 195.0, 255.0, 249.0, 252.0, 249.0, 189.0, 250.0, 255.0, 252.0, 255.0, 253.0, 252.0, 243.0, 235.0, 253.0, 255.0, 246.0, 246.0, 249.0, 255.0, 255.0, 250.0, 255.0, 255.0, 251.0, 255.0, 242.0, 255.0, 253.0, 246.0, 255.0, 253.0, 253.0, 255.0, 246.0, 253.0, 254.0, 252.0, 249.0, 248.0, 247.0, 243.0, 205.0, 252.0, 252.0, 252.0, 252.0, 252.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 253.0, 184.0, 253.0, 189.0, 251.0, 241.0, 245.0, 250.0, 194.0, 252.0, 255.0, 254.0, 255.0, 251.0, 249.0, 255.0, 246.0, 255.0, 250.0, 244.0, 255.0, 255.0, 248.0, 252.0, 249.0, 250.0, 254.0, 237.0, 255.0, 252.0, 255.0, 255.0, 250.0, 254.0, 246.0, 246.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 250.0, 203.0, 240.0, 254.0, 254.0, 254.0, 254.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 190.0, 255.0, 196.0, 255.0, 254.0, 255.0, 255.0, 202.0, 252.0, 252.0, 251.0, 255.0, 250.0, 254.0, 237.0, 189.0, 197.0, 181.0, 187.0, 205.0, 201.0, 180.0, 186.0, 192.0, 196.0, 203.0, 186.0, 246.0, 253.0, 255.0, 246.0, 248.0, 255.0, 255.0, 255.0, 255.0, 248.0, 246.0, 243.0, 250.0, 255.0, 253.0, 249.0, 246.0, 208.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 195.0, 254.0, 196.0, 243.0, 242.0, 247.0, 241.0, 198.0, 249.0, 249.0, 252.0, 255.0, 248.0, 255.0, 251.0, 206.0, 255.0, 255.0, 254.0, 252.0, 255.0, 255.0, 255.0, 255.0, 255.0, 246.0, 195.0, 249.0, 251.0, 252.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 255.0, 252.0, 248.0, 203.0, 241.0, 253.0, 253.0, 253.0, 253.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 246.0, 189.0, 243.0, 182.0, 211.0, 201.0, 199.0, 212.0, 185.0, 247.0, 250.0, 255.0, 255.0, 245.0, 254.0, 233.0, 178.0, 252.0, 255.0, 254.0, 238.0, 245.0, 255.0, 233.0, 248.0, 252.0, 251.0, 191.0, 252.0, 254.0, 253.0, 253.0, 255.0, 244.0, 247.0, 247.0, 244.0, 255.0, 253.0, 255.0, 254.0, 247.0, 248.0, 255.0, 250.0, 185.0, 200.0, 196.0, 196.0, 196.0, 196.0],[255.0, 250.0, 254.0, 250.0, 254.0, 255.0, 253.0, 254.0, 255.0, 255.0, 255.0, 250.0, 255.0, 249.0, 255.0, 253.0, 254.0, 233.0, 255.0, 249.0, 255.0, 239.0, 195.0, 247.0, 245.0, 249.0, 252.0, 247.0, 254.0, 255.0, 246.0, 254.0, 255.0, 178.0, 203.0, 192.0, 187.0, 195.0, 190.0, 189.0, 193.0, 196.0, 188.0, 186.0, 201.0, 180.0, 255.0, 255.0, 240.0, 255.0, 250.0, 255.0, 255.0, 247.0, 252.0, 248.0, 245.0, 255.0, 242.0, 251.0, 255.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 255.0, 248.0, 255.0, 250.0, 253.0, 250.0, 251.0, 250.0, 250.0, 255.0, 255.0, 242.0, 249.0, 255.0, 255.0, 187.0, 252.0, 255.0, 255.0, 255.0, 245.0, 249.0, 255.0, 255.0, 255.0, 255.0, 196.0, 245.0, 249.0, 247.0, 255.0, 250.0, 250.0, 249.0, 254.0, 252.0, 252.0, 252.0, 203.0, 255.0, 247.0, 255.0, 248.0, 247.0, 245.0, 251.0, 250.0, 255.0, 255.0, 255.0, 252.0, 248.0, 243.0, 251.0, 247.0, 251.0, 250.0, 252.0, 255.0, 240.0, 255.0, 248.0, 255.0, 253.0, 255.0, 251.0, 255.0, 253.0, 255.0, 237.0, 255.0, 249.0, 251.0, 251.0, 251.0, 179.0, 255.0, 254.0, 253.0, 251.0, 253.0, 253.0, 250.0, 251.0, 253.0, 243.0, 192.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 195.0, 251.0, 249.0, 240.0, 185.0, 207.0, 191.0, 195.0, 192.0, 195.0, 190.0, 184.0, 195.0, 255.0, 252.0, 195.0, 191.0, 195.0, 195.0, 194.0, 198.0, 170.0, 198.0, 188.0, 195.0, 188.0, 172.0, 184.0, 196.0, 183.0, 188.0, 184.0, 191.0, 204.0, 182.0, 196.0, 198.0, 192.0, 255.0, 255.0, 247.0, 243.0, 255.0, 255.0, 244.0, 253.0, 255.0, 250.0, 196.0, 253.0, 255.0, 248.0, 250.0, 248.0, 253.0, 253.0, 247.0, 244.0, 251.0, 248.0, 189.0, 253.0, 255.0, 255.0, 189.0, 253.0, 244.0, 253.0, 252.0, 253.0, 246.0, 242.0, 191.0, 255.0, 236.0, 253.0, 249.0, 251.0, 252.0, 247.0, 251.0, 209.0, 250.0, 255.0, 255.0, 255.0, 210.0, 255.0, 255.0, 252.0, 251.0, 255.0, 238.0, 255.0, 250.0, 241.0, 249.0, 248.0, 255.0, 186.0, 189.0, 187.0, 198.0, 190.0, 185.0, 199.0, 180.0, 255.0, 199.0, 251.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 252.0, 252.0, 255.0, 255.0, 191.0, 248.0, 255.0, 249.0, 176.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 180.0, 252.0, 247.0, 255.0, 253.0, 254.0, 255.0, 248.0, 253.0, 197.0, 251.0, 249.0, 240.0, 251.0, 188.0, 253.0, 255.0, 255.0, 255.0, 252.0, 237.0, 247.0, 255.0, 188.0, 210.0, 193.0, 183.0, 198.0, 244.0, 255.0, 255.0, 244.0, 253.0, 255.0, 186.0, 250.0, 191.0, 245.0, 252.0, 251.0, 255.0, 251.0, 252.0, 255.0, 251.0, 247.0, 255.0, 252.0, 192.0, 251.0, 255.0, 255.0, 191.0, 255.0, 255.0, 244.0, 247.0, 244.0, 245.0, 251.0, 188.0, 255.0, 255.0, 255.0, 253.0, 253.0, 255.0, 248.0, 254.0, 189.0, 253.0, 254.0, 254.0, 255.0, 193.0, 245.0, 254.0, 244.0, 255.0, 255.0, 255.0, 255.0, 255.0, 195.0, 235.0, 249.0, 255.0, 191.0, 240.0, 254.0, 255.0, 243.0, 254.0, 255.0, 187.0, 253.0, 196.0, 253.0, 255.0, 255.0, 255.0, 250.0, 251.0, 255.0, 253.0, 249.0, 253.0, 252.0, 194.0, 249.0, 247.0, 250.0, 203.0, 249.0, 253.0, 242.0, 255.0, 255.0, 255.0, 255.0, 192.0, 201.0, 186.0, 255.0, 252.0, 253.0, 255.0, 249.0, 255.0, 187.0, 255.0, 250.0, 255.0, 252.0, 179.0, 200.0, 209.0, 179.0, 197.0, 179.0, 185.0, 199.0, 191.0, 192.0, 199.0, 197.0, 187.0, 186.0, 197.0, 185.0, 195.0, 182.0, 195.0, 238.0, 198.0, 248.0, 194.0, 251.0, 255.0, 251.0, 255.0, 252.0, 255.0, 249.0, 254.0, 255.0, 255.0, 252.0, 178.0, 208.0, 186.0, 206.0, 169.0, 194.0, 200.0, 183.0, 195.0, 186.0, 183.0, 187.0, 193.0, 247.0, 255.0, 255.0, 252.0, 247.0, 255.0, 254.0, 255.0, 198.0, 249.0, 253.0, 255.0, 244.0, 194.0, 192.0, 255.0, 245.0, 255.0, 255.0, 247.0, 255.0, 255.0, 255.0, 253.0, 255.0, 255.0, 251.0, 255.0, 245.0, 255.0, 254.0, 192.0, 242.0, 195.0, 252.0, 202.0, 241.0, 248.0, 246.0, 253.0, 255.0, 255.0, 246.0, 255.0, 241.0, 255.0, 242.0, 184.0, 255.0, 244.0, 192.0, 255.0, 251.0, 249.0, 255.0, 250.0, 181.0, 254.0, 255.0, 255.0, 255.0, 255.0, 246.0, 255.0, 255.0, 238.0, 251.0, 250.0, 167.0, 255.0, 232.0, 255.0, 246.0, 197.0, 183.0, 255.0, 255.0, 236.0, 253.0, 255.0, 240.0, 255.0, 251.0, 253.0, 253.0, 249.0, 238.0, 247.0, 244.0, 247.0, 255.0, 170.0, 215.0, 200.0, 252.0, 164.0, 255.0, 255.0, 255.0, 255.0, 226.0, 255.0, 255.0, 255.0, 245.0, 255.0, 249.0, 203.0, 239.0, 254.0, 192.0, 255.0, 255.0, 253.0, 255.0, 253.0, 184.0, 252.0, 255.0, 255.0, 255.0, 255.0, 255.0, 240.0, 246.0, 255.0, 255.0, 255.0, 172.0, 219.0, 195.0, 196.0, 186.0, 184.0, 192.0, 255.0, 249.0, 255.0, 249.0, 251.0, 255.0, 235.0, 242.0, 255.0, 251.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 185.0, 250.0, 234.0, 245.0, 212.0, 251.0, 242.0, 240.0, 252.0, 255.0, 249.0, 241.0, 255.0, 240.0, 243.0, 245.0, 198.0, 255.0, 254.0, 179.0, 247.0, 252.0, 251.0, 255.0, 255.0, 194.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 249.0, 255.0, 255.0, 237.0, 236.0, 206.0, 0.0, 6.0, 0.0, 17.0, 250.0, 196.0, 239.0, 251.0, 247.0, 0.0, 0.0, 4.0, 0.0, 254.0, 255.0, 247.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 11.0, 237.0, 255.0, 10.0, 0.0, 195.0, 210.0, 200.0, 170.0, 9.0, 3.0, 194.0, 195.0, 190.0, 187.0, 13.0, 0.0, 238.0, 255.0, 203.0, 255.0, 255.0, 249.0, 246.0, 250.0, 191.0, 251.0, 255.0, 255.0, 255.0, 255.0, 237.0, 255.0, 244.0, 255.0, 255.0, 255.0, 0.0, 0.0, 250.0, 249.0, 0.0, 0.0, 191.0, 255.0, 249.0, 0.0, 0.0, 255.0, 243.0, 8.0, 0.0, 255.0, 255.0, 0.0, 7.0, 245.0, 255.0, 253.0, 241.0, 191.0, 255.0, 245.0, 0.0, 11.0, 241.0, 255.0, 240.0, 197.0, 9.0, 0.0, 231.0, 253.0, 255.0, 14.0, 0.0, 0.0, 255.0, 244.0, 182.0, 237.0, 248.0, 255.0, 255.0, 255.0, 192.0, 243.0, 255.0, 255.0, 255.0, 255.0, 255.0, 253.0, 255.0, 255.0, 253.0, 0.0, 10.0, 255.0, 254.0, 255.0, 255.0, 13.0, 198.0, 241.0, 0.0, 0.0, 255.0, 232.0, 252.0, 247.0, 0.0, 14.0, 245.0, 0.0, 3.0, 232.0, 255.0, 250.0, 255.0, 183.0, 255.0, 252.0, 0.0, 1.0, 248.0, 252.0, 243.0, 209.0, 0.0, 0.0, 255.0, 249.0, 0.0, 0.0, 2.0, 4.0, 203.0, 182.0, 196.0, 209.0, 185.0, 180.0, 184.0, 210.0, 184.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 253.0, 249.0, 242.0, 255.0, 0.0, 0.0, 255.0, 252.0, 248.0, 242.0, 252.0, 171.0, 255.0, 8.0, 15.0, 250.0, 252.0, 255.0, 255.0, 12.0, 0.0, 193.0, 17.0, 0.0, 197.0, 6.0, 0.0, 0.0, 202.0, 191.0, 196.0, 0.0, 0.0, 201.0, 202.0, 205.0, 179.0, 3.0, 2.0, 199.0, 172.0, 255.0, 255.0, 0.0, 17.0, 187.0, 255.0, 243.0, 255.0, 247.0, 255.0, 255.0, 247.0, 186.0, 240.0, 255.0, 255.0, 255.0, 255.0, 255.0, 251.0, 255.0, 255.0, 236.0, 14.0, 0.0, 250.0, 0.0, 8.0, 5.0, 238.0, 217.0, 253.0, 0.0, 0.0, 255.0, 255.0, 252.0, 246.0, 4.0, 0.0, 255.0, 0.0, 1.0, 6.0, 246.0, 255.0, 1.0, 0.0, 255.0, 245.0, 6.0, 0.0, 255.0, 0.0, 8.0, 250.0, 0.0, 1.0, 252.0, 212.0, 248.0, 253.0, 4.0, 0.0, 187.0, 251.0, 255.0, 255.0, 239.0, 255.0, 251.0, 248.0, 197.0, 255.0, 255.0, 255.0, 255.0, 255.0, 197.0, 196.0, 181.0, 194.0, 196.0, 2.0, 1.0, 2.0, 189.0, 196.0, 0.0, 0.0, 195.0, 253.0, 0.0, 1.0, 255.0, 255.0, 248.0, 245.0, 0.0, 0.0, 255.0, 244.0, 254.0, 251.0, 245.0, 255.0, 250.0, 2.0, 12.0, 242.0, 5.0, 0.0, 255.0, 0.0, 0.0, 255.0, 0.0, 1.0, 255.0, 204.0, 236.0, 255.0, 0.0, 0.0, 207.0, 250.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 246.0, 250.0, 255.0, 238.0, 255.0, 0.0, 0.0, 250.0, 191.0, 238.0, 255.0, 22.0, 0.0, 255.0, 0.0, 0.0, 251.0, 242.0, 255.0, 255.0, 0.0, 4.0, 235.0, 255.0, 255.0, 255.0, 255.0, 252.0, 247.0, 0.0, 0.0, 255.0, 0.0, 1.0, 249.0, 8.0, 2.0, 248.0, 8.0, 0.0, 251.0, 179.0, 255.0, 251.0, 0.0, 10.0, 182.0, 255.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 248.0, 254.0, 246.0, 247.0, 0.0, 2.0, 255.0, 189.0, 255.0, 255.0, 0.0, 3.0, 255.0, 0.0, 2.0, 239.0, 255.0, 251.0, 236.0, 3.0, 3.0, 255.0, 0.0, 0.0, 255.0, 245.0, 255.0, 255.0, 22.0, 0.0, 255.0, 0.0, 4.0, 1.0, 1.0, 0.0, 2.0, 15.0, 0.0, 248.0, 204.0, 244.0, 249.0, 11.0, 0.0, 187.0, 236.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 236.0, 255.0, 253.0, 249.0, 241.0, 255.0, 8.0, 0.0, 200.0, 179.0, 0.0, 0.0, 202.0, 249.0, 249.0, 13.0, 0.0, 252.0, 248.0, 19.0, 0.0, 195.0, 255.0, 255.0, 1.0, 9.0, 250.0, 244.0, 0.0, 0.0, 255.0, 251.0, 13.0, 0.0, 0.0, 248.0, 241.0, 0.0, 0.0, 5.0, 253.0, 191.0, 255.0, 253.0, 0.0, 3.0, 208.0, 255.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 179.0, 204.0, 174.0, 207.0, 209.0, 198.0, 0.0, 0.0, 4.0, 7.0, 253.0, 192.0, 179.0, 186.0, 173.0, 5.0, 3.0, 0.0, 0.0, 196.0, 191.0, 244.0, 255.0, 255.0, 0.0, 14.0, 0.0, 3.0, 255.0, 252.0, 255.0, 0.0, 7.0, 244.0, 255.0, 255.0, 240.0, 11.0, 0.0, 255.0, 175.0, 5.0, 0.0, 5.0, 0.0, 2.0, 0.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 183.0, 245.0, 254.0, 255.0, 240.0, 251.0, 255.0, 251.0, 255.0, 181.0, 241.0, 203.0, 248.0, 255.0, 255.0, 248.0, 215.0, 228.0, 254.0, 255.0, 202.0, 245.0, 247.0, 246.0, 249.0, 252.0, 251.0, 255.0, 225.0, 255.0, 241.0, 228.0, 213.0, 252.0, 243.0, 244.0, 255.0, 250.0, 255.0, 255.0, 162.0, 205.0, 180.0, 171.0, 213.0, 178.0, 255.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 251.0, 198.0, 243.0, 255.0, 248.0, 235.0, 255.0, 238.0, 250.0, 238.0, 199.0, 252.0, 187.0, 255.0, 243.0, 248.0, 242.0, 189.0, 255.0, 243.0, 240.0, 179.0, 205.0, 194.0, 197.0, 170.0, 194.0, 208.0, 182.0, 207.0, 201.0, 195.0, 206.0, 193.0, 237.0, 255.0, 255.0, 255.0, 239.0, 248.0, 251.0, 192.0, 255.0, 255.0, 254.0, 250.0, 190.0, 255.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 187.0, 241.0, 255.0, 250.0, 255.0, 247.0, 255.0, 255.0, 255.0, 190.0, 248.0, 202.0, 232.0, 255.0, 246.0, 255.0, 190.0, 248.0, 253.0, 255.0, 255.0, 234.0, 255.0, 253.0, 212.0, 238.0, 248.0, 255.0, 237.0, 245.0, 255.0, 254.0, 252.0, 244.0, 252.0, 247.0, 245.0, 255.0, 254.0, 255.0, 195.0, 248.0, 249.0, 255.0, 253.0, 182.0, 254.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 248.0, 255.0, 179.0, 250.0, 183.0, 255.0, 250.0, 255.0, 255.0, 192.0, 250.0, 255.0, 246.0, 253.0, 255.0, 255.0, 255.0, 206.0, 180.0, 191.0, 194.0, 193.0, 186.0, 190.0, 195.0, 185.0, 190.0, 201.0, 189.0, 190.0, 179.0, 204.0, 187.0, 200.0, 245.0, 255.0, 255.0, 245.0, 200.0, 187.0, 187.0, 193.0, 197.0, 195.0, 192.0, 200.0, 188.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 253.0, 255.0, 191.0, 255.0, 195.0, 255.0, 249.0, 252.0, 249.0, 189.0, 250.0, 255.0, 252.0, 255.0, 253.0, 252.0, 243.0, 235.0, 253.0, 255.0, 246.0, 246.0, 249.0, 255.0, 255.0, 250.0, 255.0, 255.0, 251.0, 255.0, 242.0, 255.0, 253.0, 246.0, 255.0, 253.0, 253.0, 255.0, 246.0, 253.0, 254.0, 252.0, 249.0, 248.0, 247.0, 243.0, 205.0, 252.0, 252.0, 252.0, 252.0, 252.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 253.0, 184.0, 253.0, 189.0, 251.0, 241.0, 245.0, 250.0, 194.0, 252.0, 255.0, 254.0, 255.0, 251.0, 249.0, 255.0, 246.0, 255.0, 250.0, 244.0, 255.0, 255.0, 248.0, 252.0, 249.0, 250.0, 254.0, 237.0, 255.0, 252.0, 255.0, 255.0, 250.0, 254.0, 246.0, 246.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 250.0, 203.0, 240.0, 254.0, 254.0, 254.0, 254.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 190.0, 255.0, 196.0, 255.0, 254.0, 255.0, 255.0, 202.0, 252.0, 252.0, 251.0, 255.0, 250.0, 254.0, 237.0, 189.0, 197.0, 181.0, 187.0, 205.0, 201.0, 180.0, 186.0, 192.0, 196.0, 203.0, 186.0, 246.0, 253.0, 255.0, 246.0, 248.0, 255.0, 255.0, 255.0, 255.0, 248.0, 246.0, 243.0, 250.0, 255.0, 253.0, 249.0, 246.0, 208.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 195.0, 254.0, 196.0, 243.0, 242.0, 247.0, 241.0, 198.0, 249.0, 249.0, 252.0, 255.0, 248.0, 255.0, 251.0, 206.0, 255.0, 255.0, 254.0, 252.0, 255.0, 255.0, 255.0, 255.0, 255.0, 246.0, 195.0, 249.0, 251.0, 252.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 255.0, 252.0, 248.0, 203.0, 241.0, 253.0, 253.0, 253.0, 253.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 246.0, 189.0, 243.0, 182.0, 211.0, 201.0, 199.0, 212.0, 185.0, 247.0, 250.0, 255.0, 255.0, 245.0, 254.0, 233.0, 178.0, 252.0, 255.0, 254.0, 238.0, 245.0, 255.0, 233.0, 248.0, 252.0, 251.0, 191.0, 252.0, 254.0, 253.0, 253.0, 255.0, 244.0, 247.0, 247.0, 244.0, 255.0, 253.0, 255.0, 254.0, 247.0, 248.0, 255.0, 250.0, 185.0, 200.0, 196.0, 196.0, 196.0, 196.0],[255.0, 250.0, 254.0, 250.0, 254.0, 255.0, 253.0, 254.0, 255.0, 255.0, 255.0, 250.0, 255.0, 249.0, 255.0, 253.0, 254.0, 233.0, 255.0, 249.0, 255.0, 239.0, 195.0, 247.0, 245.0, 249.0, 252.0, 247.0, 254.0, 255.0, 246.0, 254.0, 255.0, 178.0, 203.0, 192.0, 187.0, 195.0, 190.0, 189.0, 193.0, 196.0, 188.0, 186.0, 201.0, 180.0, 255.0, 255.0, 240.0, 255.0, 250.0, 255.0, 255.0, 247.0, 252.0, 248.0, 245.0, 255.0, 242.0, 251.0, 255.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 255.0, 248.0, 255.0, 250.0, 253.0, 250.0, 251.0, 250.0, 250.0, 255.0, 255.0, 242.0, 249.0, 255.0, 255.0, 187.0, 252.0, 255.0, 255.0, 255.0, 245.0, 249.0, 255.0, 255.0, 255.0, 255.0, 196.0, 245.0, 249.0, 247.0, 255.0, 250.0, 250.0, 249.0, 254.0, 252.0, 252.0, 252.0, 203.0, 255.0, 247.0, 255.0, 248.0, 247.0, 245.0, 251.0, 250.0, 255.0, 255.0, 255.0, 252.0, 248.0, 243.0, 251.0, 247.0, 251.0, 250.0, 252.0, 255.0, 240.0, 255.0, 248.0, 255.0, 253.0, 255.0, 251.0, 255.0, 253.0, 255.0, 237.0, 255.0, 249.0, 251.0, 251.0, 251.0, 179.0, 255.0, 254.0, 253.0, 251.0, 253.0, 253.0, 250.0, 251.0, 253.0, 243.0, 192.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 195.0, 251.0, 249.0, 240.0, 185.0, 207.0, 191.0, 195.0, 192.0, 195.0, 190.0, 184.0, 195.0, 255.0, 252.0, 195.0, 191.0, 195.0, 195.0, 194.0, 198.0, 170.0, 198.0, 188.0, 195.0, 188.0, 172.0, 184.0, 196.0, 183.0, 188.0, 184.0, 191.0, 204.0, 182.0, 196.0, 198.0, 192.0, 255.0, 255.0, 247.0, 243.0, 255.0, 255.0, 244.0, 253.0, 255.0, 250.0, 196.0, 253.0, 255.0, 248.0, 250.0, 248.0, 253.0, 253.0, 247.0, 244.0, 251.0, 248.0, 189.0, 253.0, 255.0, 255.0, 189.0, 253.0, 244.0, 253.0, 252.0, 253.0, 246.0, 242.0, 191.0, 255.0, 236.0, 253.0, 249.0, 251.0, 252.0, 247.0, 251.0, 209.0, 250.0, 255.0, 255.0, 255.0, 210.0, 255.0, 255.0, 252.0, 251.0, 255.0, 238.0, 255.0, 250.0, 241.0, 249.0, 248.0, 255.0, 186.0, 189.0, 187.0, 198.0, 190.0, 185.0, 199.0, 180.0, 255.0, 199.0, 251.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 252.0, 252.0, 255.0, 255.0, 191.0, 248.0, 255.0, 249.0, 176.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 180.0, 252.0, 247.0, 255.0, 253.0, 254.0, 255.0, 248.0, 253.0, 197.0, 251.0, 249.0, 240.0, 251.0, 188.0, 253.0, 255.0, 255.0, 255.0, 252.0, 237.0, 247.0, 255.0, 188.0, 210.0, 193.0, 183.0, 198.0, 244.0, 255.0, 255.0, 244.0, 253.0, 255.0, 186.0, 250.0, 191.0, 245.0, 252.0, 251.0, 255.0, 251.0, 252.0, 255.0, 251.0, 247.0, 255.0, 252.0, 192.0, 251.0, 255.0, 255.0, 191.0, 255.0, 255.0, 244.0, 247.0, 244.0, 245.0, 251.0, 188.0, 255.0, 255.0, 255.0, 253.0, 253.0, 255.0, 248.0, 254.0, 189.0, 253.0, 254.0, 254.0, 255.0, 193.0, 245.0, 254.0, 244.0, 255.0, 255.0, 255.0, 255.0, 255.0, 195.0, 235.0, 249.0, 255.0, 191.0, 240.0, 254.0, 255.0, 243.0, 254.0, 255.0, 187.0, 253.0, 196.0, 253.0, 255.0, 255.0, 255.0, 250.0, 251.0, 255.0, 253.0, 249.0, 253.0, 252.0, 194.0, 249.0, 247.0, 250.0, 203.0, 249.0, 253.0, 242.0, 255.0, 255.0, 255.0, 255.0, 192.0, 201.0, 186.0, 255.0, 252.0, 253.0, 255.0, 249.0, 255.0, 187.0, 255.0, 250.0, 255.0, 252.0, 179.0, 200.0, 209.0, 179.0, 197.0, 179.0, 185.0, 199.0, 191.0, 192.0, 199.0, 197.0, 187.0, 186.0, 197.0, 185.0, 195.0, 182.0, 195.0, 238.0, 198.0, 248.0, 194.0, 251.0, 255.0, 251.0, 255.0, 252.0, 255.0, 249.0, 254.0, 255.0, 255.0, 252.0, 178.0, 208.0, 186.0, 206.0, 169.0, 194.0, 200.0, 183.0, 195.0, 186.0, 183.0, 187.0, 193.0, 247.0, 255.0, 255.0, 255.0, 250.0, 255.0, 250.0, 255.0, 198.0, 255.0, 249.0, 255.0, 254.0, 185.0, 191.0, 255.0, 250.0, 254.0, 255.0, 239.0, 255.0, 255.0, 255.0, 254.0, 250.0, 255.0, 251.0, 255.0, 246.0, 252.0, 255.0, 193.0, 224.0, 204.0, 254.0, 186.0, 247.0, 250.0, 250.0, 240.0, 255.0, 244.0, 255.0, 254.0, 253.0, 247.0, 255.0, 198.0, 255.0, 247.0, 189.0, 255.0, 249.0, 253.0, 255.0, 242.0, 184.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 254.0, 251.0, 255.0, 255.0, 255.0, 182.0, 234.0, 255.0, 244.0, 249.0, 183.0, 203.0, 253.0, 236.0, 255.0, 254.0, 255.0, 255.0, 229.0, 246.0, 255.0, 236.0, 255.0, 249.0, 255.0, 255.0, 235.0, 227.0, 190.0, 222.0, 193.0, 246.0, 181.0, 248.0, 255.0, 244.0, 255.0, 249.0, 255.0, 255.0, 242.0, 244.0, 255.0, 247.0, 194.0, 242.0, 255.0, 196.0, 255.0, 255.0, 249.0, 255.0, 255.0, 196.0, 244.0, 255.0, 255.0, 255.0, 255.0, 255.0, 253.0, 249.0, 255.0, 255.0, 254.0, 175.0, 222.0, 187.0, 194.0, 196.0, 207.0, 167.0, 255.0, 255.0, 249.0, 253.0, 241.0, 247.0, 255.0, 255.0, 235.0, 255.0, 253.0, 249.0, 228.0, 255.0, 255.0, 255.0, 190.0, 255.0, 237.0, 255.0, 191.0, 250.0, 245.0, 255.0, 252.0, 236.0, 240.0, 242.0, 255.0, 248.0, 255.0, 247.0, 188.0, 255.0, 239.0, 184.0, 238.0, 255.0, 255.0, 255.0, 251.0, 192.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 249.0, 255.0, 252.0, 255.0, 186.0, 240.0, 0.0, 0.0, 0.0, 8.0, 183.0, 248.0, 239.0, 255.0, 3.0, 0.0, 7.0, 0.0, 255.0, 248.0, 245.0, 237.0, 246.0, 23.0, 0.0, 5.0, 0.0, 190.0, 242.0, 255.0, 0.0, 6.0, 21.0, 0.0, 0.0, 3.0, 10.0, 2.0, 193.0, 177.0, 194.0, 0.0, 0.0, 1.0, 0.0, 0.0, 201.0, 255.0, 251.0, 245.0, 252.0, 244.0, 192.0, 253.0, 255.0, 255.0, 255.0, 255.0, 253.0, 255.0, 252.0, 255.0, 250.0, 255.0, 194.0, 255.0, 234.0, 255.0, 0.0, 1.0, 211.0, 255.0, 243.0, 7.0, 1.0, 251.0, 250.0, 0.0, 0.0, 255.0, 255.0, 255.0, 13.0, 0.0, 253.0, 255.0, 0.0, 5.0, 255.0, 253.0, 244.0, 255.0, 228.0, 255.0, 249.0, 196.0, 0.0, 1.0, 255.0, 254.0, 0.0, 14.0, 248.0, 253.0, 254.0, 17.0, 7.0, 231.0, 254.0, 249.0, 255.0, 255.0, 206.0, 234.0, 255.0, 255.0, 255.0, 255.0, 247.0, 254.0, 255.0, 255.0, 252.0, 254.0, 192.0, 255.0, 255.0, 255.0, 0.0, 11.0, 175.0, 231.0, 0.0, 2.0, 250.0, 252.0, 244.0, 255.0, 0.0, 245.0, 238.0, 0.0, 0.0, 246.0, 255.0, 254.0, 242.0, 0.0, 0.0, 250.0, 255.0, 236.0, 254.0, 255.0, 229.0, 198.0, 5.0, 0.0, 245.0, 1.0, 8.0, 248.0, 255.0, 242.0, 204.0, 162.0, 0.0, 195.0, 196.0, 181.0, 195.0, 197.0, 188.0, 255.0, 255.0, 255.0, 255.0, 255.0, 250.0, 254.0, 254.0, 255.0, 252.0, 255.0, 191.0, 252.0, 255.0, 216.0, 0.0, 0.0, 205.0, 255.0, 9.0, 0.0, 255.0, 244.0, 247.0, 252.0, 255.0, 180.0, 234.0, 191.0, 190.0, 178.0, 197.0, 189.0, 193.0, 14.0, 8.0, 193.0, 187.0, 167.0, 201.0, 220.0, 191.0, 13.0, 0.0, 193.0, 175.0, 17.0, 0.0, 245.0, 255.0, 254.0, 205.0, 255.0, 248.0, 255.0, 241.0, 245.0, 255.0, 249.0, 181.0, 247.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 248.0, 253.0, 250.0, 255.0, 195.0, 255.0, 251.0, 255.0, 5.0, 0.0, 181.0, 244.0, 3.0, 0.0, 255.0, 0.0, 11.0, 3.0, 244.0, 200.0, 236.0, 255.0, 254.0, 255.0, 237.0, 255.0, 0.0, 0.0, 255.0, 244.0, 255.0, 204.0, 254.0, 249.0, 1.0, 0.0, 255.0, 254.0, 255.0, 0.0, 0.0, 255.0, 255.0, 242.0, 186.0, 252.0, 254.0, 238.0, 251.0, 255.0, 247.0, 255.0, 187.0, 255.0, 255.0, 255.0, 255.0, 255.0, 191.0, 197.0, 184.0, 199.0, 186.0, 188.0, 205.0, 248.0, 177.0, 198.0, 0.0, 6.0, 195.0, 245.0, 8.0, 0.0, 0.0, 255.0, 254.0, 1.0, 0.0, 198.0, 244.0, 250.0, 246.0, 255.0, 247.0, 22.0, 1.0, 252.0, 251.0, 254.0, 254.0, 190.0, 255.0, 2.0, 0.0, 255.0, 245.0, 255.0, 255.0, 0.0, 3.0, 244.0, 255.0, 242.0, 191.0, 255.0, 255.0, 242.0, 255.0, 243.0, 255.0, 242.0, 189.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 247.0, 253.0, 240.0, 255.0, 242.0, 247.0, 255.0, 202.0, 241.0, 0.0, 0.0, 186.0, 255.0, 1.0, 5.0, 255.0, 252.0, 246.0, 246.0, 6.0, 14.0, 235.0, 255.0, 255.0, 246.0, 11.0, 0.0, 251.0, 254.0, 243.0, 255.0, 255.0, 172.0, 0.0, 6.0, 240.0, 255.0, 248.0, 245.0, 255.0, 0.0, 4.0, 255.0, 248.0, 250.0, 206.0, 240.0, 255.0, 255.0, 241.0, 248.0, 253.0, 255.0, 207.0, 239.0, 255.0, 255.0, 255.0, 255.0, 247.0, 245.0, 252.0, 249.0, 248.0, 255.0, 0.0, 255.0, 196.0, 250.0, 3.0, 8.0, 204.0, 228.0, 0.0, 3.0, 242.0, 255.0, 255.0, 255.0, 8.0, 0.0, 247.0, 251.0, 253.0, 2.0, 0.0, 255.0, 255.0, 252.0, 255.0, 252.0, 239.0, 29.0, 0.0, 255.0, 255.0, 243.0, 244.0, 255.0, 234.0, 9.0, 0.0, 255.0, 249.0, 240.0, 191.0, 255.0, 0.0, 243.0, 255.0, 255.0, 251.0, 252.0, 191.0, 255.0, 255.0, 255.0, 255.0, 255.0, 252.0, 249.0, 255.0, 250.0, 236.0, 244.0, 10.0, 13.0, 187.0, 13.0, 0.0, 203.0, 197.0, 243.0, 255.0, 0.0, 3.0, 255.0, 245.0, 11.0, 0.0, 209.0, 255.0, 254.0, 0.0, 0.0, 255.0, 248.0, 218.0, 255.0, 255.0, 244.0, 4.0, 0.0, 255.0, 250.0, 255.0, 253.0, 255.0, 239.0, 255.0, 189.0, 10.0, 0.0, 254.0, 255.0, 202.0, 0.0, 2.0, 255.0, 254.0, 243.0, 255.0, 255.0, 186.0, 255.0, 255.0, 255.0, 255.0, 255.0, 232.0, 191.0, 209.0, 186.0, 205.0, 200.0, 192.0, 0.0, 0.0, 1.0, 180.0, 255.0, 188.0, 202.0, 168.0, 187.0, 0.0, 0.0, 4.0, 0.0, 191.0, 180.0, 254.0, 0.0, 0.0, 4.0, 6.0, 0.0, 20.0, 1.0, 0.0, 255.0, 13.0, 0.0, 243.0, 255.0, 234.0, 255.0, 255.0, 252.0, 255.0, 180.0, 255.0, 1.0, 3.0, 0.0, 0.0, 0.0, 241.0, 255.0, 245.0, 255.0, 255.0, 255.0, 193.0, 250.0, 255.0, 255.0, 255.0, 255.0, 255.0, 192.0, 249.0, 227.0, 252.0, 255.0, 245.0, 255.0, 240.0, 253.0, 195.0, 250.0, 199.0, 251.0, 246.0, 255.0, 251.0, 224.0, 238.0, 248.0, 252.0, 220.0, 255.0, 255.0, 255.0, 242.0, 245.0, 255.0, 250.0, 236.0, 248.0, 254.0, 230.0, 196.0, 255.0, 254.0, 255.0, 254.0, 249.0, 250.0, 234.0, 184.0, 205.0, 174.0, 175.0, 207.0, 178.0, 255.0, 255.0, 242.0, 255.0, 255.0, 255.0, 247.0, 182.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 176.0, 255.0, 249.0, 255.0, 247.0, 244.0, 255.0, 248.0, 255.0, 181.0, 244.0, 196.0, 254.0, 249.0, 254.0, 249.0, 183.0, 241.0, 255.0, 248.0, 191.0, 161.0, 185.0, 200.0, 174.0, 183.0, 196.0, 202.0, 195.0, 213.0, 189.0, 203.0, 202.0, 245.0, 241.0, 252.0, 255.0, 241.0, 255.0, 255.0, 182.0, 250.0, 255.0, 255.0, 244.0, 188.0, 255.0, 247.0, 254.0, 255.0, 237.0, 255.0, 255.0, 184.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 187.0, 253.0, 255.0, 254.0, 254.0, 251.0, 248.0, 255.0, 238.0, 190.0, 255.0, 192.0, 234.0, 255.0, 240.0, 255.0, 162.0, 255.0, 242.0, 245.0, 255.0, 255.0, 255.0, 243.0, 224.0, 229.0, 255.0, 249.0, 239.0, 255.0, 255.0, 252.0, 247.0, 249.0, 253.0, 255.0, 255.0, 243.0, 255.0, 247.0, 190.0, 255.0, 250.0, 246.0, 255.0, 180.0, 249.0, 255.0, 244.0, 252.0, 255.0, 246.0, 255.0, 196.0, 248.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 248.0, 255.0, 179.0, 250.0, 183.0, 255.0, 250.0, 255.0, 255.0, 192.0, 250.0, 255.0, 246.0, 253.0, 255.0, 255.0, 255.0, 206.0, 180.0, 191.0, 194.0, 193.0, 186.0, 190.0, 195.0, 185.0, 190.0, 201.0, 189.0, 190.0, 179.0, 204.0, 187.0, 200.0, 245.0, 255.0, 255.0, 245.0, 200.0, 187.0, 187.0, 193.0, 197.0, 195.0, 192.0, 200.0, 188.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 253.0, 255.0, 191.0, 255.0, 195.0, 255.0, 249.0, 252.0, 249.0, 189.0, 250.0, 255.0, 252.0, 255.0, 253.0, 252.0, 243.0, 235.0, 253.0, 255.0, 246.0, 246.0, 249.0, 255.0, 255.0, 250.0, 255.0, 255.0, 251.0, 255.0, 242.0, 255.0, 253.0, 246.0, 255.0, 253.0, 253.0, 255.0, 246.0, 253.0, 254.0, 252.0, 249.0, 248.0, 247.0, 243.0, 205.0, 252.0, 252.0, 252.0, 252.0, 252.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 253.0, 184.0, 253.0, 189.0, 251.0, 241.0, 245.0, 250.0, 194.0, 252.0, 255.0, 254.0, 255.0, 251.0, 249.0, 255.0, 246.0, 255.0, 250.0, 244.0, 255.0, 255.0, 248.0, 252.0, 249.0, 250.0, 254.0, 237.0, 255.0, 252.0, 255.0, 255.0, 250.0, 254.0, 246.0, 246.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 250.0, 203.0, 240.0, 254.0, 254.0, 254.0, 254.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 190.0, 255.0, 196.0, 255.0, 254.0, 255.0, 255.0, 202.0, 252.0, 252.0, 251.0, 255.0, 250.0, 254.0, 237.0, 189.0, 197.0, 181.0, 187.0, 205.0, 201.0, 180.0, 186.0, 192.0, 196.0, 203.0, 186.0, 246.0, 253.0, 255.0, 246.0, 248.0, 255.0, 255.0, 255.0, 255.0, 248.0, 246.0, 243.0, 250.0, 255.0, 253.0, 249.0, 246.0, 208.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 195.0, 254.0, 196.0, 243.0, 242.0, 247.0, 241.0, 198.0, 249.0, 249.0, 252.0, 255.0, 248.0, 255.0, 251.0, 206.0, 255.0, 255.0, 254.0, 252.0, 255.0, 255.0, 255.0, 255.0, 255.0, 246.0, 195.0, 249.0, 251.0, 252.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 255.0, 252.0, 248.0, 203.0, 241.0, 253.0, 253.0, 253.0, 253.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 246.0, 189.0, 243.0, 182.0, 211.0, 201.0, 199.0, 212.0, 185.0, 247.0, 250.0, 255.0, 255.0, 245.0, 254.0, 233.0, 178.0, 252.0, 255.0, 254.0, 238.0, 245.0, 255.0, 233.0, 248.0, 252.0, 251.0, 191.0, 252.0, 254.0, 253.0, 253.0, 255.0, 244.0, 247.0, 247.0, 244.0, 255.0, 253.0, 255.0, 254.0, 247.0, 248.0, 255.0, 250.0, 185.0, 200.0, 196.0, 196.0, 196.0, 196.0], \ No newline at end of file diff --git a/hackerrank/AI/Digital-Image-Analysis/test-the-captcha/output.txt b/hackerrank/AI/Digital-Image-Analysis/test-the-captcha/output.txt new file mode 100644 index 0000000..e3b62b9 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/test-the-captcha/output.txt @@ -0,0 +1 @@ +['EGYK4', 'GRC35', '6O5W1', 'J627C'] \ No newline at end of file diff --git a/hackerrank/AI/Digital-Image-Analysis/test-the-captcha/teste.py b/hackerrank/AI/Digital-Image-Analysis/test-the-captcha/teste.py new file mode 100644 index 0000000..91dce5d --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/test-the-captcha/teste.py @@ -0,0 +1,37 @@ +import os + +directory = '/home/murillo/anaconda3/git/Hackerrank-Artificial-Intelligence/Digital-Image-Analysis/sampleCaptchas/input' +limit = 4 + +with open("input.txt", "w") as w: + start = 1 + for f in sorted(os.listdir(directory)): + if start <= limit: + if os.path.isfile(os.path.join(directory, f)): + filename = "{}/{}".format(directory, f) + print(filename) + if os.path.splitext(filename)[1][1:] in 'txt': + with open(filename, "r") as f: + next(f) + pixels = [] + for line in f: + for item in line.split(" "): + vals = [int(val) for val in item.split(",")] + pixels.append(sum(vals)/len(vals)) + w.write(str(pixels) + ",") + start = start + 1 + +directory = '/home/murillo/anaconda3/git/Hackerrank-Artificial-Intelligence/Digital-Image-Analysis/sampleCaptchas/output' +with open("output.txt", "w") as w: + pixels = [] + start = 1 + for f in sorted(os.listdir(directory)): + if start <= limit: + if os.path.isfile(os.path.join(directory, f)): + filename = "{}/{}".format(directory, f) + print(filename) + if os.path.splitext(filename)[1][1:] in 'txt': + with open(filename, "r") as f: + pixels.append(f.readline().strip()) + start = start + 1 + w.write(str(pixels)) \ No newline at end of file diff --git a/hackerrank/AI/Digital-Image-Analysis/test-the-captcha/the-captcha-cracker-final.py b/hackerrank/AI/Digital-Image-Analysis/test-the-captcha/the-captcha-cracker-final.py new file mode 100644 index 0000000..6ab93b4 --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/test-the-captcha/the-captcha-cracker-final.py @@ -0,0 +1,29 @@ +# Import libraries +import os +import sys +import numpy as np +from sklearn.linear_model import LogisticRegression +warnings.filterwarnings("ignore", category=DeprecationWarning) +val_input = [[255.0, 250.0, 254.0, 250.0, 254.0, 255.0, 253.0, 254.0, 255.0, 255.0, 255.0, 250.0, 255.0, 249.0, 255.0, 253.0, 254.0, 233.0, 255.0, 249.0, 255.0, 239.0, 195.0, 247.0, 245.0, 249.0, 252.0, 247.0, 254.0, 255.0, 246.0, 254.0, 255.0, 178.0, 203.0, 192.0, 187.0, 195.0, 190.0, 189.0, 193.0, 196.0, 188.0, 186.0, 201.0, 180.0, 255.0, 255.0, 240.0, 255.0, 250.0, 255.0, 255.0, 247.0, 252.0, 248.0, 245.0, 255.0, 242.0, 251.0, 255.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 255.0, 248.0, 255.0, 250.0, 253.0, 250.0, 251.0, 250.0, 250.0, 255.0, 255.0, 242.0, 249.0, 255.0, 255.0, 187.0, 252.0, 255.0, 255.0, 255.0, 245.0, 249.0, 255.0, 255.0, 255.0, 255.0, 196.0, 245.0, 249.0, 247.0, 255.0, 250.0, 250.0, 249.0, 254.0, 252.0, 252.0, 252.0, 203.0, 255.0, 247.0, 255.0, 248.0, 247.0, 245.0, 251.0, 250.0, 255.0, 255.0, 255.0, 252.0, 248.0, 243.0, 251.0, 247.0, 251.0, 250.0, 252.0, 255.0, 240.0, 255.0, 248.0, 255.0, 253.0, 255.0, 251.0, 255.0, 253.0, 255.0, 237.0, 255.0, 249.0, 251.0, 251.0, 251.0, 179.0, 255.0, 254.0, 253.0, 251.0, 253.0, 253.0, 250.0, 251.0, 253.0, 243.0, 192.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 195.0, 251.0, 249.0, 240.0, 185.0, 207.0, 191.0, 195.0, 192.0, 195.0, 190.0, 184.0, 195.0, 255.0, 252.0, 195.0, 191.0, 195.0, 195.0, 194.0, 198.0, 170.0, 198.0, 188.0, 195.0, 188.0, 172.0, 184.0, 196.0, 183.0, 188.0, 184.0, 191.0, 204.0, 182.0, 196.0, 198.0, 192.0, 255.0, 255.0, 247.0, 243.0, 255.0, 255.0, 244.0, 253.0, 255.0, 250.0, 196.0, 253.0, 255.0, 248.0, 250.0, 248.0, 253.0, 253.0, 247.0, 244.0, 251.0, 248.0, 189.0, 253.0, 255.0, 255.0, 189.0, 253.0, 244.0, 253.0, 252.0, 253.0, 246.0, 242.0, 191.0, 255.0, 236.0, 253.0, 249.0, 251.0, 252.0, 247.0, 251.0, 209.0, 250.0, 255.0, 255.0, 255.0, 210.0, 255.0, 255.0, 252.0, 251.0, 255.0, 238.0, 255.0, 250.0, 241.0, 249.0, 248.0, 255.0, 186.0, 189.0, 187.0, 198.0, 190.0, 185.0, 199.0, 180.0, 255.0, 199.0, 251.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 252.0, 252.0, 255.0, 255.0, 191.0, 248.0, 255.0, 249.0, 176.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 180.0, 252.0, 247.0, 255.0, 253.0, 254.0, 255.0, 248.0, 253.0, 197.0, 251.0, 249.0, 240.0, 251.0, 188.0, 253.0, 255.0, 255.0, 255.0, 252.0, 237.0, 247.0, 255.0, 188.0, 210.0, 193.0, 183.0, 198.0, 244.0, 255.0, 255.0, 244.0, 253.0, 255.0, 186.0, 250.0, 191.0, 245.0, 252.0, 251.0, 255.0, 251.0, 252.0, 255.0, 251.0, 247.0, 255.0, 252.0, 192.0, 251.0, 255.0, 255.0, 191.0, 255.0, 255.0, 244.0, 247.0, 244.0, 245.0, 251.0, 188.0, 255.0, 255.0, 255.0, 253.0, 253.0, 255.0, 248.0, 254.0, 189.0, 253.0, 254.0, 254.0, 255.0, 193.0, 245.0, 254.0, 244.0, 255.0, 255.0, 255.0, 255.0, 255.0, 195.0, 235.0, 249.0, 255.0, 191.0, 240.0, 254.0, 255.0, 243.0, 254.0, 255.0, 187.0, 253.0, 196.0, 253.0, 255.0, 255.0, 255.0, 250.0, 251.0, 255.0, 253.0, 249.0, 253.0, 252.0, 194.0, 249.0, 247.0, 250.0, 203.0, 249.0, 253.0, 242.0, 255.0, 255.0, 255.0, 255.0, 192.0, 201.0, 186.0, 255.0, 252.0, 253.0, 255.0, 249.0, 255.0, 187.0, 255.0, 250.0, 255.0, 252.0, 179.0, 200.0, 209.0, 179.0, 197.0, 179.0, 185.0, 199.0, 191.0, 192.0, 199.0, 197.0, 187.0, 186.0, 197.0, 185.0, 195.0, 182.0, 195.0, 238.0, 198.0, 248.0, 194.0, 251.0, 255.0, 251.0, 255.0, 252.0, 255.0, 249.0, 254.0, 255.0, 255.0, 252.0, 178.0, 208.0, 186.0, 206.0, 169.0, 194.0, 200.0, 183.0, 195.0, 186.0, 183.0, 187.0, 193.0, 247.0, 255.0, 255.0, 255.0, 253.0, 244.0, 246.0, 255.0, 197.0, 253.0, 254.0, 255.0, 255.0, 181.0, 194.0, 253.0, 255.0, 249.0, 239.0, 255.0, 255.0, 245.0, 255.0, 247.0, 255.0, 255.0, 255.0, 255.0, 254.0, 241.0, 255.0, 193.0, 232.0, 199.0, 255.0, 176.0, 251.0, 255.0, 238.0, 252.0, 255.0, 254.0, 255.0, 249.0, 255.0, 245.0, 253.0, 188.0, 251.0, 255.0, 192.0, 255.0, 251.0, 249.0, 255.0, 250.0, 181.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 245.0, 249.0, 255.0, 255.0, 248.0, 185.0, 241.0, 235.0, 255.0, 246.0, 200.0, 193.0, 245.0, 246.0, 255.0, 255.0, 232.0, 255.0, 253.0, 242.0, 255.0, 246.0, 255.0, 255.0, 223.0, 255.0, 255.0, 241.0, 183.0, 236.0, 191.0, 241.0, 203.0, 250.0, 236.0, 247.0, 255.0, 243.0, 254.0, 248.0, 255.0, 249.0, 255.0, 253.0, 192.0, 250.0, 245.0, 192.0, 255.0, 255.0, 253.0, 255.0, 253.0, 184.0, 252.0, 255.0, 255.0, 255.0, 255.0, 244.0, 251.0, 255.0, 255.0, 238.0, 255.0, 171.0, 219.0, 197.0, 198.0, 174.0, 209.0, 195.0, 252.0, 255.0, 249.0, 246.0, 255.0, 231.0, 255.0, 242.0, 246.0, 255.0, 248.0, 249.0, 255.0, 255.0, 249.0, 245.0, 179.0, 255.0, 228.0, 249.0, 194.0, 255.0, 255.0, 255.0, 243.0, 239.0, 255.0, 255.0, 238.0, 255.0, 255.0, 231.0, 207.0, 255.0, 254.0, 179.0, 247.0, 252.0, 251.0, 255.0, 255.0, 194.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 241.0, 240.0, 255.0, 0.0, 0.0, 18.0, 0.0, 3.0, 18.0, 0.0, 197.0, 244.0, 229.0, 250.0, 0.0, 0.0, 18.0, 6.0, 0.0, 247.0, 255.0, 3.0, 12.0, 218.0, 255.0, 240.0, 255.0, 18.0, 0.0, 255.0, 14.0, 3.0, 176.0, 186.0, 191.0, 191.0, 0.0, 0.0, 170.0, 200.0, 188.0, 196.0, 216.0, 170.0, 0.0, 0.0, 203.0, 255.0, 255.0, 249.0, 246.0, 250.0, 191.0, 251.0, 255.0, 255.0, 255.0, 255.0, 247.0, 241.0, 255.0, 255.0, 243.0, 0.0, 0.0, 250.0, 248.0, 248.0, 237.0, 250.0, 188.0, 255.0, 255.0, 10.0, 0.0, 254.0, 234.0, 242.0, 13.0, 13.0, 245.0, 0.0, 0.0, 246.0, 255.0, 242.0, 254.0, 0.0, 0.0, 255.0, 0.0, 0.0, 255.0, 255.0, 247.0, 0.0, 36.0, 247.0, 255.0, 251.0, 239.0, 245.0, 248.0, 12.0, 2.0, 13.0, 182.0, 237.0, 248.0, 255.0, 255.0, 255.0, 192.0, 243.0, 255.0, 255.0, 255.0, 255.0, 253.0, 248.0, 255.0, 239.0, 255.0, 2.0, 15.0, 250.0, 255.0, 245.0, 255.0, 255.0, 173.0, 255.0, 0.0, 0.0, 255.0, 255.0, 247.0, 255.0, 247.0, 236.0, 249.0, 247.0, 0.0, 19.0, 247.0, 250.0, 1.0, 13.0, 250.0, 252.0, 0.0, 0.0, 255.0, 255.0, 0.0, 7.0, 233.0, 252.0, 239.0, 234.0, 255.0, 240.0, 0.0, 0.0, 0.0, 0.0, 196.0, 209.0, 185.0, 180.0, 184.0, 210.0, 184.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 246.0, 255.0, 255.0, 234.0, 0.0, 0.0, 249.0, 255.0, 231.0, 255.0, 243.0, 178.0, 255.0, 25.0, 0.0, 253.0, 230.0, 251.0, 255.0, 255.0, 189.0, 206.0, 188.0, 200.0, 0.0, 19.0, 0.0, 2.0, 159.0, 203.0, 191.0, 0.0, 8.0, 180.0, 11.0, 0.0, 170.0, 212.0, 184.0, 192.0, 194.0, 239.0, 10.0, 10.0, 255.0, 0.0, 10.0, 243.0, 255.0, 247.0, 255.0, 255.0, 247.0, 186.0, 240.0, 255.0, 255.0, 255.0, 255.0, 251.0, 255.0, 239.0, 240.0, 255.0, 0.0, 0.0, 2.0, 0.0, 10.0, 0.0, 235.0, 213.0, 250.0, 0.0, 6.0, 251.0, 255.0, 255.0, 235.0, 255.0, 192.0, 243.0, 255.0, 251.0, 255.0, 0.0, 8.0, 255.0, 255.0, 250.0, 247.0, 0.0, 0.0, 10.0, 0.0, 255.0, 248.0, 255.0, 252.0, 255.0, 197.0, 6.0, 0.0, 252.0, 255.0, 0.0, 0.0, 255.0, 255.0, 239.0, 255.0, 251.0, 248.0, 197.0, 255.0, 255.0, 255.0, 255.0, 255.0, 191.0, 192.0, 194.0, 198.0, 195.0, 4.0, 2.0, 247.0, 179.0, 207.0, 184.0, 182.0, 220.0, 219.0, 15.0, 0.0, 243.0, 255.0, 243.0, 0.0, 5.0, 0.0, 247.0, 255.0, 247.0, 255.0, 0.0, 0.0, 255.0, 246.0, 236.0, 255.0, 3.0, 3.0, 0.0, 0.0, 255.0, 250.0, 252.0, 255.0, 255.0, 0.0, 0.0, 255.0, 241.0, 254.0, 18.0, 0.0, 249.0, 255.0, 246.0, 255.0, 255.0, 251.0, 210.0, 244.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 239.0, 240.0, 246.0, 8.0, 1.0, 255.0, 199.0, 232.0, 251.0, 255.0, 184.0, 255.0, 0.0, 0.0, 255.0, 234.0, 255.0, 255.0, 3.0, 11.0, 228.0, 255.0, 255.0, 239.0, 0.0, 4.0, 250.0, 254.0, 255.0, 251.0, 0.0, 0.0, 255.0, 12.0, 0.0, 254.0, 253.0, 246.0, 252.0, 5.0, 18.0, 0.0, 13.0, 0.0, 0.0, 21.0, 2.0, 233.0, 255.0, 235.0, 252.0, 251.0, 183.0, 255.0, 255.0, 255.0, 255.0, 255.0, 238.0, 254.0, 255.0, 255.0, 255.0, 0.0, 0.0, 253.0, 195.0, 255.0, 255.0, 253.0, 185.0, 244.0, 14.0, 0.0, 254.0, 245.0, 253.0, 244.0, 0.0, 0.0, 255.0, 255.0, 255.0, 255.0, 1.0, 0.0, 255.0, 246.0, 249.0, 248.0, 14.0, 0.0, 255.0, 241.0, 2.0, 21.0, 255.0, 249.0, 251.0, 196.0, 236.0, 255.0, 243.0, 253.0, 8.0, 0.0, 255.0, 255.0, 247.0, 255.0, 249.0, 252.0, 211.0, 239.0, 255.0, 255.0, 255.0, 255.0, 255.0, 248.0, 249.0, 240.0, 245.0, 5.0, 31.0, 233.0, 190.0, 202.0, 179.0, 203.0, 197.0, 239.0, 255.0, 0.0, 6.0, 255.0, 255.0, 255.0, 13.0, 0.0, 255.0, 248.0, 236.0, 243.0, 0.0, 8.0, 241.0, 252.0, 255.0, 255.0, 0.0, 0.0, 255.0, 255.0, 249.0, 0.0, 0.0, 255.0, 247.0, 194.0, 255.0, 252.0, 255.0, 242.0, 1.0, 0.0, 243.0, 250.0, 242.0, 255.0, 255.0, 244.0, 194.0, 255.0, 255.0, 255.0, 255.0, 255.0, 239.0, 186.0, 203.0, 190.0, 188.0, 2.0, 0.0, 8.0, 0.0, 0.0, 0.0, 8.0, 193.0, 197.0, 159.0, 197.0, 0.0, 0.0, 0.0, 8.0, 0.0, 170.0, 250.0, 255.0, 255.0, 255.0, 6.0, 0.0, 244.0, 255.0, 247.0, 255.0, 6.0, 0.0, 248.0, 255.0, 248.0, 255.0, 0.0, 5.0, 255.0, 185.0, 238.0, 255.0, 251.0, 254.0, 9.0, 5.0, 247.0, 255.0, 248.0, 232.0, 255.0, 255.0, 182.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 188.0, 238.0, 243.0, 255.0, 239.0, 255.0, 255.0, 253.0, 250.0, 215.0, 248.0, 204.0, 247.0, 255.0, 249.0, 255.0, 212.0, 251.0, 248.0, 255.0, 212.0, 255.0, 241.0, 240.0, 255.0, 236.0, 255.0, 255.0, 236.0, 255.0, 240.0, 242.0, 179.0, 252.0, 255.0, 255.0, 236.0, 255.0, 235.0, 249.0, 171.0, 222.0, 187.0, 164.0, 217.0, 159.0, 255.0, 252.0, 236.0, 254.0, 255.0, 246.0, 247.0, 197.0, 247.0, 255.0, 255.0, 255.0, 255.0, 255.0, 181.0, 255.0, 251.0, 245.0, 242.0, 255.0, 244.0, 255.0, 255.0, 177.0, 240.0, 200.0, 255.0, 241.0, 244.0, 241.0, 201.0, 255.0, 243.0, 242.0, 176.0, 181.0, 192.0, 200.0, 182.0, 186.0, 204.0, 198.0, 193.0, 198.0, 194.0, 197.0, 197.0, 255.0, 246.0, 255.0, 253.0, 255.0, 255.0, 255.0, 195.0, 250.0, 251.0, 245.0, 255.0, 186.0, 253.0, 255.0, 255.0, 249.0, 242.0, 242.0, 255.0, 202.0, 247.0, 255.0, 255.0, 255.0, 255.0, 255.0, 179.0, 255.0, 255.0, 250.0, 255.0, 255.0, 246.0, 248.0, 250.0, 205.0, 249.0, 201.0, 227.0, 255.0, 254.0, 255.0, 173.0, 255.0, 255.0, 254.0, 255.0, 255.0, 252.0, 244.0, 211.0, 240.0, 255.0, 243.0, 251.0, 250.0, 255.0, 250.0, 255.0, 245.0, 245.0, 255.0, 252.0, 238.0, 255.0, 252.0, 191.0, 247.0, 254.0, 255.0, 250.0, 179.0, 255.0, 253.0, 251.0, 255.0, 255.0, 249.0, 247.0, 185.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 248.0, 255.0, 179.0, 250.0, 183.0, 255.0, 250.0, 255.0, 255.0, 192.0, 250.0, 255.0, 246.0, 253.0, 255.0, 255.0, 255.0, 206.0, 180.0, 191.0, 194.0, 193.0, 186.0, 190.0, 195.0, 185.0, 190.0, 201.0, 189.0, 190.0, 179.0, 204.0, 187.0, 200.0, 245.0, 255.0, 255.0, 245.0, 200.0, 187.0, 187.0, 193.0, 197.0, 195.0, 192.0, 200.0, 188.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 253.0, 255.0, 191.0, 255.0, 195.0, 255.0, 249.0, 252.0, 249.0, 189.0, 250.0, 255.0, 252.0, 255.0, 253.0, 252.0, 243.0, 235.0, 253.0, 255.0, 246.0, 246.0, 249.0, 255.0, 255.0, 250.0, 255.0, 255.0, 251.0, 255.0, 242.0, 255.0, 253.0, 246.0, 255.0, 253.0, 253.0, 255.0, 246.0, 253.0, 254.0, 252.0, 249.0, 248.0, 247.0, 243.0, 205.0, 252.0, 252.0, 252.0, 252.0, 252.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 253.0, 184.0, 253.0, 189.0, 251.0, 241.0, 245.0, 250.0, 194.0, 252.0, 255.0, 254.0, 255.0, 251.0, 249.0, 255.0, 246.0, 255.0, 250.0, 244.0, 255.0, 255.0, 248.0, 252.0, 249.0, 250.0, 254.0, 237.0, 255.0, 252.0, 255.0, 255.0, 250.0, 254.0, 246.0, 246.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 250.0, 203.0, 240.0, 254.0, 254.0, 254.0, 254.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 190.0, 255.0, 196.0, 255.0, 254.0, 255.0, 255.0, 202.0, 252.0, 252.0, 251.0, 255.0, 250.0, 254.0, 237.0, 189.0, 197.0, 181.0, 187.0, 205.0, 201.0, 180.0, 186.0, 192.0, 196.0, 203.0, 186.0, 246.0, 253.0, 255.0, 246.0, 248.0, 255.0, 255.0, 255.0, 255.0, 248.0, 246.0, 243.0, 250.0, 255.0, 253.0, 249.0, 246.0, 208.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 195.0, 254.0, 196.0, 243.0, 242.0, 247.0, 241.0, 198.0, 249.0, 249.0, 252.0, 255.0, 248.0, 255.0, 251.0, 206.0, 255.0, 255.0, 254.0, 252.0, 255.0, 255.0, 255.0, 255.0, 255.0, 246.0, 195.0, 249.0, 251.0, 252.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 255.0, 252.0, 248.0, 203.0, 241.0, 253.0, 253.0, 253.0, 253.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 246.0, 189.0, 243.0, 182.0, 211.0, 201.0, 199.0, 212.0, 185.0, 247.0, 250.0, 255.0, 255.0, 245.0, 254.0, 233.0, 178.0, 252.0, 255.0, 254.0, 238.0, 245.0, 255.0, 233.0, 248.0, 252.0, 251.0, 191.0, 252.0, 254.0, 253.0, 253.0, 255.0, 244.0, 247.0, 247.0, 244.0, 255.0, 253.0, 255.0, 254.0, 247.0, 248.0, 255.0, 250.0, 185.0, 200.0, 196.0, 196.0, 196.0, 196.0],[255.0, 250.0, 254.0, 250.0, 254.0, 255.0, 253.0, 254.0, 255.0, 255.0, 255.0, 250.0, 255.0, 249.0, 255.0, 253.0, 254.0, 233.0, 255.0, 249.0, 255.0, 239.0, 195.0, 247.0, 245.0, 249.0, 252.0, 247.0, 254.0, 255.0, 246.0, 254.0, 255.0, 178.0, 203.0, 192.0, 187.0, 195.0, 190.0, 189.0, 193.0, 196.0, 188.0, 186.0, 201.0, 180.0, 255.0, 255.0, 240.0, 255.0, 250.0, 255.0, 255.0, 247.0, 252.0, 248.0, 245.0, 255.0, 242.0, 251.0, 255.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 255.0, 248.0, 255.0, 250.0, 253.0, 250.0, 251.0, 250.0, 250.0, 255.0, 255.0, 242.0, 249.0, 255.0, 255.0, 187.0, 252.0, 255.0, 255.0, 255.0, 245.0, 249.0, 255.0, 255.0, 255.0, 255.0, 196.0, 245.0, 249.0, 247.0, 255.0, 250.0, 250.0, 249.0, 254.0, 252.0, 252.0, 252.0, 203.0, 255.0, 247.0, 255.0, 248.0, 247.0, 245.0, 251.0, 250.0, 255.0, 255.0, 255.0, 252.0, 248.0, 243.0, 251.0, 247.0, 251.0, 250.0, 252.0, 255.0, 240.0, 255.0, 248.0, 255.0, 253.0, 255.0, 251.0, 255.0, 253.0, 255.0, 237.0, 255.0, 249.0, 251.0, 251.0, 251.0, 179.0, 255.0, 254.0, 253.0, 251.0, 253.0, 253.0, 250.0, 251.0, 253.0, 243.0, 192.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 195.0, 251.0, 249.0, 240.0, 185.0, 207.0, 191.0, 195.0, 192.0, 195.0, 190.0, 184.0, 195.0, 255.0, 252.0, 195.0, 191.0, 195.0, 195.0, 194.0, 198.0, 170.0, 198.0, 188.0, 195.0, 188.0, 172.0, 184.0, 196.0, 183.0, 188.0, 184.0, 191.0, 204.0, 182.0, 196.0, 198.0, 192.0, 255.0, 255.0, 247.0, 243.0, 255.0, 255.0, 244.0, 253.0, 255.0, 250.0, 196.0, 253.0, 255.0, 248.0, 250.0, 248.0, 253.0, 253.0, 247.0, 244.0, 251.0, 248.0, 189.0, 253.0, 255.0, 255.0, 189.0, 253.0, 244.0, 253.0, 252.0, 253.0, 246.0, 242.0, 191.0, 255.0, 236.0, 253.0, 249.0, 251.0, 252.0, 247.0, 251.0, 209.0, 250.0, 255.0, 255.0, 255.0, 210.0, 255.0, 255.0, 252.0, 251.0, 255.0, 238.0, 255.0, 250.0, 241.0, 249.0, 248.0, 255.0, 186.0, 189.0, 187.0, 198.0, 190.0, 185.0, 199.0, 180.0, 255.0, 199.0, 251.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 252.0, 252.0, 255.0, 255.0, 191.0, 248.0, 255.0, 249.0, 176.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 180.0, 252.0, 247.0, 255.0, 253.0, 254.0, 255.0, 248.0, 253.0, 197.0, 251.0, 249.0, 240.0, 251.0, 188.0, 253.0, 255.0, 255.0, 255.0, 252.0, 237.0, 247.0, 255.0, 188.0, 210.0, 193.0, 183.0, 198.0, 244.0, 255.0, 255.0, 244.0, 253.0, 255.0, 186.0, 250.0, 191.0, 245.0, 252.0, 251.0, 255.0, 251.0, 252.0, 255.0, 251.0, 247.0, 255.0, 252.0, 192.0, 251.0, 255.0, 255.0, 191.0, 255.0, 255.0, 244.0, 247.0, 244.0, 245.0, 251.0, 188.0, 255.0, 255.0, 255.0, 253.0, 253.0, 255.0, 248.0, 254.0, 189.0, 253.0, 254.0, 254.0, 255.0, 193.0, 245.0, 254.0, 244.0, 255.0, 255.0, 255.0, 255.0, 255.0, 195.0, 235.0, 249.0, 255.0, 191.0, 240.0, 254.0, 255.0, 243.0, 254.0, 255.0, 187.0, 253.0, 196.0, 253.0, 255.0, 255.0, 255.0, 250.0, 251.0, 255.0, 253.0, 249.0, 253.0, 252.0, 194.0, 249.0, 247.0, 250.0, 203.0, 249.0, 253.0, 242.0, 255.0, 255.0, 255.0, 255.0, 192.0, 201.0, 186.0, 255.0, 252.0, 253.0, 255.0, 249.0, 255.0, 187.0, 255.0, 250.0, 255.0, 252.0, 179.0, 200.0, 209.0, 179.0, 197.0, 179.0, 185.0, 199.0, 191.0, 192.0, 199.0, 197.0, 187.0, 186.0, 197.0, 185.0, 195.0, 182.0, 195.0, 238.0, 198.0, 248.0, 194.0, 251.0, 255.0, 251.0, 255.0, 252.0, 255.0, 249.0, 254.0, 255.0, 255.0, 252.0, 178.0, 208.0, 186.0, 206.0, 169.0, 194.0, 200.0, 183.0, 195.0, 186.0, 183.0, 187.0, 193.0, 247.0, 255.0, 255.0, 252.0, 247.0, 255.0, 254.0, 255.0, 198.0, 249.0, 251.0, 251.0, 255.0, 189.0, 182.0, 255.0, 247.0, 255.0, 252.0, 255.0, 247.0, 255.0, 255.0, 248.0, 255.0, 247.0, 255.0, 248.0, 248.0, 255.0, 250.0, 196.0, 253.0, 194.0, 250.0, 213.0, 227.0, 255.0, 243.0, 255.0, 244.0, 252.0, 255.0, 249.0, 255.0, 248.0, 255.0, 180.0, 249.0, 255.0, 192.0, 255.0, 251.0, 249.0, 255.0, 250.0, 181.0, 254.0, 255.0, 255.0, 255.0, 255.0, 246.0, 255.0, 255.0, 238.0, 251.0, 250.0, 167.0, 255.0, 238.0, 255.0, 241.0, 190.0, 201.0, 249.0, 255.0, 230.0, 255.0, 242.0, 254.0, 251.0, 247.0, 248.0, 255.0, 255.0, 250.0, 255.0, 247.0, 243.0, 249.0, 191.0, 187.0, 201.0, 234.0, 166.0, 255.0, 248.0, 251.0, 255.0, 255.0, 255.0, 255.0, 249.0, 251.0, 250.0, 240.0, 202.0, 255.0, 238.0, 192.0, 255.0, 255.0, 253.0, 255.0, 253.0, 184.0, 252.0, 255.0, 255.0, 255.0, 255.0, 255.0, 240.0, 246.0, 255.0, 255.0, 255.0, 172.0, 219.0, 207.0, 167.0, 212.0, 177.0, 192.0, 249.0, 241.0, 255.0, 248.0, 255.0, 241.0, 255.0, 240.0, 255.0, 255.0, 245.0, 255.0, 253.0, 241.0, 255.0, 249.0, 183.0, 255.0, 243.0, 255.0, 212.0, 235.0, 255.0, 249.0, 249.0, 247.0, 246.0, 243.0, 255.0, 235.0, 255.0, 255.0, 202.0, 255.0, 255.0, 179.0, 247.0, 252.0, 251.0, 255.0, 255.0, 194.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 249.0, 255.0, 255.0, 237.0, 236.0, 206.0, 0.0, 0.0, 8.0, 16.0, 8.0, 176.0, 248.0, 1.0, 0.0, 0.0, 4.0, 5.0, 0.0, 1.0, 243.0, 255.0, 244.0, 252.0, 2.0, 0.0, 7.0, 0.0, 2.0, 253.0, 241.0, 218.0, 0.0, 12.0, 0.0, 0.0, 10.0, 184.0, 197.0, 187.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 203.0, 255.0, 255.0, 249.0, 246.0, 250.0, 191.0, 251.0, 255.0, 255.0, 255.0, 255.0, 237.0, 255.0, 244.0, 255.0, 255.0, 255.0, 0.0, 0.0, 246.0, 246.0, 246.0, 0.0, 0.0, 255.0, 9.0, 5.0, 246.0, 255.0, 236.0, 244.0, 4.0, 12.0, 248.0, 249.0, 4.0, 1.0, 250.0, 244.0, 255.0, 0.0, 0.0, 255.0, 27.0, 0.0, 255.0, 255.0, 240.0, 0.0, 5.0, 253.0, 252.0, 19.0, 0.0, 241.0, 255.0, 255.0, 250.0, 255.0, 182.0, 237.0, 248.0, 255.0, 255.0, 255.0, 192.0, 243.0, 255.0, 255.0, 255.0, 255.0, 255.0, 253.0, 255.0, 255.0, 253.0, 0.0, 10.0, 255.0, 255.0, 255.0, 255.0, 244.0, 200.0, 254.0, 0.0, 0.0, 255.0, 237.0, 255.0, 253.0, 7.0, 0.0, 236.0, 25.0, 0.0, 255.0, 255.0, 239.0, 251.0, 229.0, 0.0, 246.0, 235.0, 238.0, 255.0, 255.0, 240.0, 197.0, 0.0, 0.0, 254.0, 0.0, 0.0, 242.0, 238.0, 255.0, 184.0, 186.0, 196.0, 209.0, 185.0, 180.0, 184.0, 210.0, 184.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 253.0, 249.0, 242.0, 255.0, 0.0, 0.0, 255.0, 255.0, 217.0, 255.0, 255.0, 186.0, 255.0, 10.0, 0.0, 238.0, 255.0, 255.0, 246.0, 21.0, 0.0, 221.0, 0.0, 0.0, 187.0, 195.0, 191.0, 189.0, 169.0, 175.0, 224.0, 209.0, 183.0, 186.0, 203.0, 188.0, 5.0, 15.0, 184.0, 192.0, 0.0, 10.0, 255.0, 0.0, 0.0, 9.0, 253.0, 243.0, 255.0, 247.0, 255.0, 255.0, 247.0, 186.0, 240.0, 255.0, 255.0, 255.0, 255.0, 255.0, 251.0, 255.0, 255.0, 236.0, 14.0, 0.0, 250.0, 253.0, 255.0, 255.0, 235.0, 198.0, 249.0, 0.0, 0.0, 3.0, 7.0, 0.0, 6.0, 0.0, 194.0, 240.0, 18.0, 2.0, 244.0, 255.0, 248.0, 255.0, 255.0, 255.0, 233.0, 250.0, 200.0, 255.0, 0.0, 2.0, 7.0, 247.0, 252.0, 255.0, 0.0, 3.0, 0.0, 252.0, 255.0, 0.0, 8.0, 255.0, 255.0, 239.0, 255.0, 251.0, 248.0, 197.0, 255.0, 255.0, 255.0, 255.0, 255.0, 190.0, 196.0, 179.0, 201.0, 195.0, 0.0, 7.0, 255.0, 187.0, 178.0, 11.0, 0.0, 4.0, 255.0, 0.0, 7.0, 0.0, 0.0, 0.0, 255.0, 244.0, 210.0, 238.0, 0.0, 10.0, 246.0, 255.0, 255.0, 245.0, 247.0, 255.0, 246.0, 242.0, 199.0, 255.0, 255.0, 253.0, 0.0, 0.0, 255.0, 255.0, 192.0, 244.0, 255.0, 255.0, 255.0, 190.0, 4.0, 0.0, 255.0, 244.0, 255.0, 255.0, 244.0, 188.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 249.0, 238.0, 255.0, 0.0, 0.0, 255.0, 189.0, 255.0, 246.0, 18.0, 0.0, 255.0, 6.0, 0.0, 255.0, 255.0, 7.0, 2.0, 254.0, 178.0, 249.0, 5.0, 0.0, 255.0, 232.0, 254.0, 255.0, 243.0, 252.0, 255.0, 255.0, 183.0, 244.0, 244.0, 235.0, 255.0, 0.0, 0.0, 255.0, 179.0, 255.0, 236.0, 251.0, 254.0, 190.0, 0.0, 13.0, 255.0, 252.0, 244.0, 241.0, 255.0, 201.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 236.0, 255.0, 251.0, 252.0, 0.0, 0.0, 252.0, 186.0, 239.0, 255.0, 0.0, 12.0, 255.0, 0.0, 0.0, 242.0, 246.0, 255.0, 0.0, 0.0, 193.0, 255.0, 0.0, 7.0, 255.0, 255.0, 244.0, 248.0, 255.0, 0.0, 255.0, 253.0, 176.0, 255.0, 255.0, 255.0, 241.0, 3.0, 12.0, 234.0, 27.0, 6.0, 255.0, 254.0, 255.0, 173.0, 8.0, 0.0, 217.0, 255.0, 255.0, 248.0, 255.0, 190.0, 246.0, 255.0, 255.0, 255.0, 255.0, 249.0, 253.0, 251.0, 244.0, 251.0, 255.0, 0.0, 8.0, 197.0, 202.0, 173.0, 1.0, 0.0, 240.0, 1.0, 3.0, 255.0, 255.0, 248.0, 255.0, 10.0, 0.0, 252.0, 255.0, 0.0, 3.0, 255.0, 255.0, 240.0, 6.0, 11.0, 245.0, 0.0, 10.0, 255.0, 231.0, 253.0, 6.0, 0.0, 248.0, 255.0, 190.0, 0.0, 0.0, 255.0, 252.0, 13.0, 0.0, 250.0, 255.0, 253.0, 250.0, 247.0, 255.0, 189.0, 254.0, 255.0, 255.0, 255.0, 255.0, 242.0, 194.0, 209.0, 195.0, 188.0, 179.0, 213.0, 0.0, 0.0, 0.0, 0.0, 0.0, 207.0, 195.0, 0.0, 10.0, 188.0, 180.0, 200.0, 186.0, 0.0, 6.0, 255.0, 241.0, 255.0, 4.0, 0.0, 5.0, 6.0, 1.0, 233.0, 255.0, 250.0, 11.0, 0.0, 7.0, 6.0, 0.0, 255.0, 255.0, 255.0, 165.0, 255.0, 14.0, 0.0, 0.0, 0.0, 246.0, 244.0, 249.0, 247.0, 255.0, 249.0, 250.0, 181.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 194.0, 232.0, 246.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 202.0, 255.0, 187.0, 255.0, 255.0, 252.0, 253.0, 203.0, 255.0, 255.0, 255.0, 203.0, 247.0, 245.0, 245.0, 240.0, 255.0, 255.0, 250.0, 255.0, 255.0, 235.0, 238.0, 186.0, 249.0, 255.0, 250.0, 248.0, 255.0, 230.0, 237.0, 199.0, 187.0, 186.0, 183.0, 188.0, 188.0, 254.0, 255.0, 251.0, 239.0, 250.0, 253.0, 255.0, 192.0, 248.0, 255.0, 255.0, 255.0, 255.0, 253.0, 191.0, 255.0, 237.0, 251.0, 239.0, 241.0, 255.0, 249.0, 230.0, 186.0, 255.0, 181.0, 229.0, 255.0, 244.0, 255.0, 180.0, 251.0, 234.0, 251.0, 212.0, 161.0, 215.0, 206.0, 184.0, 170.0, 198.0, 199.0, 183.0, 194.0, 205.0, 199.0, 214.0, 233.0, 247.0, 255.0, 249.0, 254.0, 255.0, 255.0, 185.0, 246.0, 255.0, 255.0, 245.0, 191.0, 255.0, 244.0, 255.0, 255.0, 255.0, 243.0, 249.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 162.0, 255.0, 255.0, 252.0, 252.0, 255.0, 242.0, 255.0, 254.0, 201.0, 241.0, 203.0, 242.0, 255.0, 244.0, 254.0, 196.0, 255.0, 255.0, 252.0, 249.0, 253.0, 244.0, 241.0, 207.0, 245.0, 255.0, 255.0, 242.0, 249.0, 255.0, 255.0, 236.0, 255.0, 255.0, 236.0, 255.0, 255.0, 251.0, 248.0, 191.0, 255.0, 246.0, 255.0, 246.0, 194.0, 246.0, 255.0, 255.0, 246.0, 254.0, 255.0, 255.0, 197.0, 247.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 248.0, 255.0, 179.0, 250.0, 183.0, 255.0, 250.0, 255.0, 255.0, 192.0, 250.0, 255.0, 246.0, 253.0, 255.0, 255.0, 255.0, 206.0, 180.0, 191.0, 194.0, 193.0, 186.0, 190.0, 195.0, 185.0, 190.0, 201.0, 189.0, 190.0, 179.0, 204.0, 187.0, 200.0, 245.0, 255.0, 255.0, 245.0, 200.0, 187.0, 187.0, 193.0, 197.0, 195.0, 192.0, 200.0, 188.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 253.0, 255.0, 191.0, 255.0, 195.0, 255.0, 249.0, 252.0, 249.0, 189.0, 250.0, 255.0, 252.0, 255.0, 253.0, 252.0, 243.0, 235.0, 253.0, 255.0, 246.0, 246.0, 249.0, 255.0, 255.0, 250.0, 255.0, 255.0, 251.0, 255.0, 242.0, 255.0, 253.0, 246.0, 255.0, 253.0, 253.0, 255.0, 246.0, 253.0, 254.0, 252.0, 249.0, 248.0, 247.0, 243.0, 205.0, 252.0, 252.0, 252.0, 252.0, 252.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 253.0, 184.0, 253.0, 189.0, 251.0, 241.0, 245.0, 250.0, 194.0, 252.0, 255.0, 254.0, 255.0, 251.0, 249.0, 255.0, 246.0, 255.0, 250.0, 244.0, 255.0, 255.0, 248.0, 252.0, 249.0, 250.0, 254.0, 237.0, 255.0, 252.0, 255.0, 255.0, 250.0, 254.0, 246.0, 246.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 250.0, 203.0, 240.0, 254.0, 254.0, 254.0, 254.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 190.0, 255.0, 196.0, 255.0, 254.0, 255.0, 255.0, 202.0, 252.0, 252.0, 251.0, 255.0, 250.0, 254.0, 237.0, 189.0, 197.0, 181.0, 187.0, 205.0, 201.0, 180.0, 186.0, 192.0, 196.0, 203.0, 186.0, 246.0, 253.0, 255.0, 246.0, 248.0, 255.0, 255.0, 255.0, 255.0, 248.0, 246.0, 243.0, 250.0, 255.0, 253.0, 249.0, 246.0, 208.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 195.0, 254.0, 196.0, 243.0, 242.0, 247.0, 241.0, 198.0, 249.0, 249.0, 252.0, 255.0, 248.0, 255.0, 251.0, 206.0, 255.0, 255.0, 254.0, 252.0, 255.0, 255.0, 255.0, 255.0, 255.0, 246.0, 195.0, 249.0, 251.0, 252.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 255.0, 252.0, 248.0, 203.0, 241.0, 253.0, 253.0, 253.0, 253.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 246.0, 189.0, 243.0, 182.0, 211.0, 201.0, 199.0, 212.0, 185.0, 247.0, 250.0, 255.0, 255.0, 245.0, 254.0, 233.0, 178.0, 252.0, 255.0, 254.0, 238.0, 245.0, 255.0, 233.0, 248.0, 252.0, 251.0, 191.0, 252.0, 254.0, 253.0, 253.0, 255.0, 244.0, 247.0, 247.0, 244.0, 255.0, 253.0, 255.0, 254.0, 247.0, 248.0, 255.0, 250.0, 185.0, 200.0, 196.0, 196.0, 196.0, 196.0],[255.0, 250.0, 254.0, 250.0, 254.0, 255.0, 253.0, 254.0, 255.0, 255.0, 255.0, 250.0, 255.0, 249.0, 255.0, 253.0, 254.0, 233.0, 255.0, 249.0, 255.0, 239.0, 195.0, 247.0, 245.0, 249.0, 252.0, 247.0, 254.0, 255.0, 246.0, 254.0, 255.0, 178.0, 203.0, 192.0, 187.0, 195.0, 190.0, 189.0, 193.0, 196.0, 188.0, 186.0, 201.0, 180.0, 255.0, 255.0, 240.0, 255.0, 250.0, 255.0, 255.0, 247.0, 252.0, 248.0, 245.0, 255.0, 242.0, 251.0, 255.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 255.0, 248.0, 255.0, 250.0, 253.0, 250.0, 251.0, 250.0, 250.0, 255.0, 255.0, 242.0, 249.0, 255.0, 255.0, 187.0, 252.0, 255.0, 255.0, 255.0, 245.0, 249.0, 255.0, 255.0, 255.0, 255.0, 196.0, 245.0, 249.0, 247.0, 255.0, 250.0, 250.0, 249.0, 254.0, 252.0, 252.0, 252.0, 203.0, 255.0, 247.0, 255.0, 248.0, 247.0, 245.0, 251.0, 250.0, 255.0, 255.0, 255.0, 252.0, 248.0, 243.0, 251.0, 247.0, 251.0, 250.0, 252.0, 255.0, 240.0, 255.0, 248.0, 255.0, 253.0, 255.0, 251.0, 255.0, 253.0, 255.0, 237.0, 255.0, 249.0, 251.0, 251.0, 251.0, 179.0, 255.0, 254.0, 253.0, 251.0, 253.0, 253.0, 250.0, 251.0, 253.0, 243.0, 192.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 195.0, 251.0, 249.0, 240.0, 185.0, 207.0, 191.0, 195.0, 192.0, 195.0, 190.0, 184.0, 195.0, 255.0, 252.0, 195.0, 191.0, 195.0, 195.0, 194.0, 198.0, 170.0, 198.0, 188.0, 195.0, 188.0, 172.0, 184.0, 196.0, 183.0, 188.0, 184.0, 191.0, 204.0, 182.0, 196.0, 198.0, 192.0, 255.0, 255.0, 247.0, 243.0, 255.0, 255.0, 244.0, 253.0, 255.0, 250.0, 196.0, 253.0, 255.0, 248.0, 250.0, 248.0, 253.0, 253.0, 247.0, 244.0, 251.0, 248.0, 189.0, 253.0, 255.0, 255.0, 189.0, 253.0, 244.0, 253.0, 252.0, 253.0, 246.0, 242.0, 191.0, 255.0, 236.0, 253.0, 249.0, 251.0, 252.0, 247.0, 251.0, 209.0, 250.0, 255.0, 255.0, 255.0, 210.0, 255.0, 255.0, 252.0, 251.0, 255.0, 238.0, 255.0, 250.0, 241.0, 249.0, 248.0, 255.0, 186.0, 189.0, 187.0, 198.0, 190.0, 185.0, 199.0, 180.0, 255.0, 199.0, 251.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 252.0, 252.0, 255.0, 255.0, 191.0, 248.0, 255.0, 249.0, 176.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 180.0, 252.0, 247.0, 255.0, 253.0, 254.0, 255.0, 248.0, 253.0, 197.0, 251.0, 249.0, 240.0, 251.0, 188.0, 253.0, 255.0, 255.0, 255.0, 252.0, 237.0, 247.0, 255.0, 188.0, 210.0, 193.0, 183.0, 198.0, 244.0, 255.0, 255.0, 244.0, 253.0, 255.0, 186.0, 250.0, 191.0, 245.0, 252.0, 251.0, 255.0, 251.0, 252.0, 255.0, 251.0, 247.0, 255.0, 252.0, 192.0, 251.0, 255.0, 255.0, 191.0, 255.0, 255.0, 244.0, 247.0, 244.0, 245.0, 251.0, 188.0, 255.0, 255.0, 255.0, 253.0, 253.0, 255.0, 248.0, 254.0, 189.0, 253.0, 254.0, 254.0, 255.0, 193.0, 245.0, 254.0, 244.0, 255.0, 255.0, 255.0, 255.0, 255.0, 195.0, 235.0, 249.0, 255.0, 191.0, 240.0, 254.0, 255.0, 243.0, 254.0, 255.0, 187.0, 253.0, 196.0, 253.0, 255.0, 255.0, 255.0, 250.0, 251.0, 255.0, 253.0, 249.0, 253.0, 252.0, 194.0, 249.0, 247.0, 250.0, 203.0, 249.0, 253.0, 242.0, 255.0, 255.0, 255.0, 255.0, 192.0, 201.0, 186.0, 255.0, 252.0, 253.0, 255.0, 249.0, 255.0, 187.0, 255.0, 250.0, 255.0, 252.0, 179.0, 200.0, 209.0, 179.0, 197.0, 179.0, 185.0, 199.0, 191.0, 192.0, 199.0, 197.0, 187.0, 186.0, 197.0, 185.0, 195.0, 182.0, 195.0, 238.0, 198.0, 248.0, 194.0, 251.0, 255.0, 251.0, 255.0, 252.0, 255.0, 249.0, 254.0, 255.0, 255.0, 252.0, 178.0, 208.0, 186.0, 206.0, 169.0, 194.0, 200.0, 183.0, 195.0, 186.0, 183.0, 187.0, 193.0, 247.0, 255.0, 255.0, 252.0, 247.0, 255.0, 254.0, 255.0, 198.0, 249.0, 253.0, 255.0, 244.0, 194.0, 192.0, 255.0, 245.0, 255.0, 255.0, 247.0, 255.0, 255.0, 255.0, 253.0, 255.0, 255.0, 251.0, 255.0, 245.0, 255.0, 254.0, 192.0, 242.0, 195.0, 252.0, 202.0, 241.0, 248.0, 246.0, 253.0, 255.0, 255.0, 246.0, 255.0, 241.0, 255.0, 242.0, 184.0, 255.0, 244.0, 192.0, 255.0, 251.0, 249.0, 255.0, 250.0, 181.0, 254.0, 255.0, 255.0, 255.0, 255.0, 246.0, 255.0, 255.0, 238.0, 251.0, 250.0, 167.0, 255.0, 232.0, 255.0, 246.0, 197.0, 183.0, 255.0, 255.0, 236.0, 253.0, 255.0, 240.0, 255.0, 251.0, 253.0, 253.0, 249.0, 238.0, 247.0, 244.0, 247.0, 255.0, 170.0, 215.0, 200.0, 252.0, 164.0, 255.0, 255.0, 255.0, 255.0, 226.0, 255.0, 255.0, 255.0, 245.0, 255.0, 249.0, 203.0, 239.0, 254.0, 192.0, 255.0, 255.0, 253.0, 255.0, 253.0, 184.0, 252.0, 255.0, 255.0, 255.0, 255.0, 255.0, 240.0, 246.0, 255.0, 255.0, 255.0, 172.0, 219.0, 195.0, 196.0, 186.0, 184.0, 192.0, 255.0, 249.0, 255.0, 249.0, 251.0, 255.0, 235.0, 242.0, 255.0, 251.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 185.0, 250.0, 234.0, 245.0, 212.0, 251.0, 242.0, 240.0, 252.0, 255.0, 249.0, 241.0, 255.0, 240.0, 243.0, 245.0, 198.0, 255.0, 254.0, 179.0, 247.0, 252.0, 251.0, 255.0, 255.0, 194.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 249.0, 255.0, 255.0, 237.0, 236.0, 206.0, 0.0, 6.0, 0.0, 17.0, 250.0, 196.0, 239.0, 251.0, 247.0, 0.0, 0.0, 4.0, 0.0, 254.0, 255.0, 247.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 11.0, 237.0, 255.0, 10.0, 0.0, 195.0, 210.0, 200.0, 170.0, 9.0, 3.0, 194.0, 195.0, 190.0, 187.0, 13.0, 0.0, 238.0, 255.0, 203.0, 255.0, 255.0, 249.0, 246.0, 250.0, 191.0, 251.0, 255.0, 255.0, 255.0, 255.0, 237.0, 255.0, 244.0, 255.0, 255.0, 255.0, 0.0, 0.0, 250.0, 249.0, 0.0, 0.0, 191.0, 255.0, 249.0, 0.0, 0.0, 255.0, 243.0, 8.0, 0.0, 255.0, 255.0, 0.0, 7.0, 245.0, 255.0, 253.0, 241.0, 191.0, 255.0, 245.0, 0.0, 11.0, 241.0, 255.0, 240.0, 197.0, 9.0, 0.0, 231.0, 253.0, 255.0, 14.0, 0.0, 0.0, 255.0, 244.0, 182.0, 237.0, 248.0, 255.0, 255.0, 255.0, 192.0, 243.0, 255.0, 255.0, 255.0, 255.0, 255.0, 253.0, 255.0, 255.0, 253.0, 0.0, 10.0, 255.0, 254.0, 255.0, 255.0, 13.0, 198.0, 241.0, 0.0, 0.0, 255.0, 232.0, 252.0, 247.0, 0.0, 14.0, 245.0, 0.0, 3.0, 232.0, 255.0, 250.0, 255.0, 183.0, 255.0, 252.0, 0.0, 1.0, 248.0, 252.0, 243.0, 209.0, 0.0, 0.0, 255.0, 249.0, 0.0, 0.0, 2.0, 4.0, 203.0, 182.0, 196.0, 209.0, 185.0, 180.0, 184.0, 210.0, 184.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 253.0, 249.0, 242.0, 255.0, 0.0, 0.0, 255.0, 252.0, 248.0, 242.0, 252.0, 171.0, 255.0, 8.0, 15.0, 250.0, 252.0, 255.0, 255.0, 12.0, 0.0, 193.0, 17.0, 0.0, 197.0, 6.0, 0.0, 0.0, 202.0, 191.0, 196.0, 0.0, 0.0, 201.0, 202.0, 205.0, 179.0, 3.0, 2.0, 199.0, 172.0, 255.0, 255.0, 0.0, 17.0, 187.0, 255.0, 243.0, 255.0, 247.0, 255.0, 255.0, 247.0, 186.0, 240.0, 255.0, 255.0, 255.0, 255.0, 255.0, 251.0, 255.0, 255.0, 236.0, 14.0, 0.0, 250.0, 0.0, 8.0, 5.0, 238.0, 217.0, 253.0, 0.0, 0.0, 255.0, 255.0, 252.0, 246.0, 4.0, 0.0, 255.0, 0.0, 1.0, 6.0, 246.0, 255.0, 1.0, 0.0, 255.0, 245.0, 6.0, 0.0, 255.0, 0.0, 8.0, 250.0, 0.0, 1.0, 252.0, 212.0, 248.0, 253.0, 4.0, 0.0, 187.0, 251.0, 255.0, 255.0, 239.0, 255.0, 251.0, 248.0, 197.0, 255.0, 255.0, 255.0, 255.0, 255.0, 197.0, 196.0, 181.0, 194.0, 196.0, 2.0, 1.0, 2.0, 189.0, 196.0, 0.0, 0.0, 195.0, 253.0, 0.0, 1.0, 255.0, 255.0, 248.0, 245.0, 0.0, 0.0, 255.0, 244.0, 254.0, 251.0, 245.0, 255.0, 250.0, 2.0, 12.0, 242.0, 5.0, 0.0, 255.0, 0.0, 0.0, 255.0, 0.0, 1.0, 255.0, 204.0, 236.0, 255.0, 0.0, 0.0, 207.0, 250.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 246.0, 250.0, 255.0, 238.0, 255.0, 0.0, 0.0, 250.0, 191.0, 238.0, 255.0, 22.0, 0.0, 255.0, 0.0, 0.0, 251.0, 242.0, 255.0, 255.0, 0.0, 4.0, 235.0, 255.0, 255.0, 255.0, 255.0, 252.0, 247.0, 0.0, 0.0, 255.0, 0.0, 1.0, 249.0, 8.0, 2.0, 248.0, 8.0, 0.0, 251.0, 179.0, 255.0, 251.0, 0.0, 10.0, 182.0, 255.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 248.0, 254.0, 246.0, 247.0, 0.0, 2.0, 255.0, 189.0, 255.0, 255.0, 0.0, 3.0, 255.0, 0.0, 2.0, 239.0, 255.0, 251.0, 236.0, 3.0, 3.0, 255.0, 0.0, 0.0, 255.0, 245.0, 255.0, 255.0, 22.0, 0.0, 255.0, 0.0, 4.0, 1.0, 1.0, 0.0, 2.0, 15.0, 0.0, 248.0, 204.0, 244.0, 249.0, 11.0, 0.0, 187.0, 236.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 236.0, 255.0, 253.0, 249.0, 241.0, 255.0, 8.0, 0.0, 200.0, 179.0, 0.0, 0.0, 202.0, 249.0, 249.0, 13.0, 0.0, 252.0, 248.0, 19.0, 0.0, 195.0, 255.0, 255.0, 1.0, 9.0, 250.0, 244.0, 0.0, 0.0, 255.0, 251.0, 13.0, 0.0, 0.0, 248.0, 241.0, 0.0, 0.0, 5.0, 253.0, 191.0, 255.0, 253.0, 0.0, 3.0, 208.0, 255.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 179.0, 204.0, 174.0, 207.0, 209.0, 198.0, 0.0, 0.0, 4.0, 7.0, 253.0, 192.0, 179.0, 186.0, 173.0, 5.0, 3.0, 0.0, 0.0, 196.0, 191.0, 244.0, 255.0, 255.0, 0.0, 14.0, 0.0, 3.0, 255.0, 252.0, 255.0, 0.0, 7.0, 244.0, 255.0, 255.0, 240.0, 11.0, 0.0, 255.0, 175.0, 5.0, 0.0, 5.0, 0.0, 2.0, 0.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 183.0, 245.0, 254.0, 255.0, 240.0, 251.0, 255.0, 251.0, 255.0, 181.0, 241.0, 203.0, 248.0, 255.0, 255.0, 248.0, 215.0, 228.0, 254.0, 255.0, 202.0, 245.0, 247.0, 246.0, 249.0, 252.0, 251.0, 255.0, 225.0, 255.0, 241.0, 228.0, 213.0, 252.0, 243.0, 244.0, 255.0, 250.0, 255.0, 255.0, 162.0, 205.0, 180.0, 171.0, 213.0, 178.0, 255.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 251.0, 198.0, 243.0, 255.0, 248.0, 235.0, 255.0, 238.0, 250.0, 238.0, 199.0, 252.0, 187.0, 255.0, 243.0, 248.0, 242.0, 189.0, 255.0, 243.0, 240.0, 179.0, 205.0, 194.0, 197.0, 170.0, 194.0, 208.0, 182.0, 207.0, 201.0, 195.0, 206.0, 193.0, 237.0, 255.0, 255.0, 255.0, 239.0, 248.0, 251.0, 192.0, 255.0, 255.0, 254.0, 250.0, 190.0, 255.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 187.0, 241.0, 255.0, 250.0, 255.0, 247.0, 255.0, 255.0, 255.0, 190.0, 248.0, 202.0, 232.0, 255.0, 246.0, 255.0, 190.0, 248.0, 253.0, 255.0, 255.0, 234.0, 255.0, 253.0, 212.0, 238.0, 248.0, 255.0, 237.0, 245.0, 255.0, 254.0, 252.0, 244.0, 252.0, 247.0, 245.0, 255.0, 254.0, 255.0, 195.0, 248.0, 249.0, 255.0, 253.0, 182.0, 254.0, 254.0, 255.0, 251.0, 255.0, 250.0, 255.0, 193.0, 254.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 248.0, 255.0, 179.0, 250.0, 183.0, 255.0, 250.0, 255.0, 255.0, 192.0, 250.0, 255.0, 246.0, 253.0, 255.0, 255.0, 255.0, 206.0, 180.0, 191.0, 194.0, 193.0, 186.0, 190.0, 195.0, 185.0, 190.0, 201.0, 189.0, 190.0, 179.0, 204.0, 187.0, 200.0, 245.0, 255.0, 255.0, 245.0, 200.0, 187.0, 187.0, 193.0, 197.0, 195.0, 192.0, 200.0, 188.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 253.0, 255.0, 191.0, 255.0, 195.0, 255.0, 249.0, 252.0, 249.0, 189.0, 250.0, 255.0, 252.0, 255.0, 253.0, 252.0, 243.0, 235.0, 253.0, 255.0, 246.0, 246.0, 249.0, 255.0, 255.0, 250.0, 255.0, 255.0, 251.0, 255.0, 242.0, 255.0, 253.0, 246.0, 255.0, 253.0, 253.0, 255.0, 246.0, 253.0, 254.0, 252.0, 249.0, 248.0, 247.0, 243.0, 205.0, 252.0, 252.0, 252.0, 252.0, 252.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 253.0, 184.0, 253.0, 189.0, 251.0, 241.0, 245.0, 250.0, 194.0, 252.0, 255.0, 254.0, 255.0, 251.0, 249.0, 255.0, 246.0, 255.0, 250.0, 244.0, 255.0, 255.0, 248.0, 252.0, 249.0, 250.0, 254.0, 237.0, 255.0, 252.0, 255.0, 255.0, 250.0, 254.0, 246.0, 246.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 250.0, 203.0, 240.0, 254.0, 254.0, 254.0, 254.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 190.0, 255.0, 196.0, 255.0, 254.0, 255.0, 255.0, 202.0, 252.0, 252.0, 251.0, 255.0, 250.0, 254.0, 237.0, 189.0, 197.0, 181.0, 187.0, 205.0, 201.0, 180.0, 186.0, 192.0, 196.0, 203.0, 186.0, 246.0, 253.0, 255.0, 246.0, 248.0, 255.0, 255.0, 255.0, 255.0, 248.0, 246.0, 243.0, 250.0, 255.0, 253.0, 249.0, 246.0, 208.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 195.0, 254.0, 196.0, 243.0, 242.0, 247.0, 241.0, 198.0, 249.0, 249.0, 252.0, 255.0, 248.0, 255.0, 251.0, 206.0, 255.0, 255.0, 254.0, 252.0, 255.0, 255.0, 255.0, 255.0, 255.0, 246.0, 195.0, 249.0, 251.0, 252.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 255.0, 252.0, 248.0, 203.0, 241.0, 253.0, 253.0, 253.0, 253.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 246.0, 189.0, 243.0, 182.0, 211.0, 201.0, 199.0, 212.0, 185.0, 247.0, 250.0, 255.0, 255.0, 245.0, 254.0, 233.0, 178.0, 252.0, 255.0, 254.0, 238.0, 245.0, 255.0, 233.0, 248.0, 252.0, 251.0, 191.0, 252.0, 254.0, 253.0, 253.0, 255.0, 244.0, 247.0, 247.0, 244.0, 255.0, 253.0, 255.0, 254.0, 247.0, 248.0, 255.0, 250.0, 185.0, 200.0, 196.0, 196.0, 196.0, 196.0],[255.0, 250.0, 254.0, 250.0, 254.0, 255.0, 253.0, 254.0, 255.0, 255.0, 255.0, 250.0, 255.0, 249.0, 255.0, 253.0, 254.0, 233.0, 255.0, 249.0, 255.0, 239.0, 195.0, 247.0, 245.0, 249.0, 252.0, 247.0, 254.0, 255.0, 246.0, 254.0, 255.0, 178.0, 203.0, 192.0, 187.0, 195.0, 190.0, 189.0, 193.0, 196.0, 188.0, 186.0, 201.0, 180.0, 255.0, 255.0, 240.0, 255.0, 250.0, 255.0, 255.0, 247.0, 252.0, 248.0, 245.0, 255.0, 242.0, 251.0, 255.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 255.0, 248.0, 255.0, 250.0, 253.0, 250.0, 251.0, 250.0, 250.0, 255.0, 255.0, 242.0, 249.0, 255.0, 255.0, 187.0, 252.0, 255.0, 255.0, 255.0, 245.0, 249.0, 255.0, 255.0, 255.0, 255.0, 196.0, 245.0, 249.0, 247.0, 255.0, 250.0, 250.0, 249.0, 254.0, 252.0, 252.0, 252.0, 203.0, 255.0, 247.0, 255.0, 248.0, 247.0, 245.0, 251.0, 250.0, 255.0, 255.0, 255.0, 252.0, 248.0, 243.0, 251.0, 247.0, 251.0, 250.0, 252.0, 255.0, 240.0, 255.0, 248.0, 255.0, 253.0, 255.0, 251.0, 255.0, 253.0, 255.0, 237.0, 255.0, 249.0, 251.0, 251.0, 251.0, 179.0, 255.0, 254.0, 253.0, 251.0, 253.0, 253.0, 250.0, 251.0, 253.0, 243.0, 192.0, 254.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 195.0, 251.0, 249.0, 240.0, 185.0, 207.0, 191.0, 195.0, 192.0, 195.0, 190.0, 184.0, 195.0, 255.0, 252.0, 195.0, 191.0, 195.0, 195.0, 194.0, 198.0, 170.0, 198.0, 188.0, 195.0, 188.0, 172.0, 184.0, 196.0, 183.0, 188.0, 184.0, 191.0, 204.0, 182.0, 196.0, 198.0, 192.0, 255.0, 255.0, 247.0, 243.0, 255.0, 255.0, 244.0, 253.0, 255.0, 250.0, 196.0, 253.0, 255.0, 248.0, 250.0, 248.0, 253.0, 253.0, 247.0, 244.0, 251.0, 248.0, 189.0, 253.0, 255.0, 255.0, 189.0, 253.0, 244.0, 253.0, 252.0, 253.0, 246.0, 242.0, 191.0, 255.0, 236.0, 253.0, 249.0, 251.0, 252.0, 247.0, 251.0, 209.0, 250.0, 255.0, 255.0, 255.0, 210.0, 255.0, 255.0, 252.0, 251.0, 255.0, 238.0, 255.0, 250.0, 241.0, 249.0, 248.0, 255.0, 186.0, 189.0, 187.0, 198.0, 190.0, 185.0, 199.0, 180.0, 255.0, 199.0, 251.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 252.0, 252.0, 255.0, 255.0, 191.0, 248.0, 255.0, 249.0, 176.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 180.0, 252.0, 247.0, 255.0, 253.0, 254.0, 255.0, 248.0, 253.0, 197.0, 251.0, 249.0, 240.0, 251.0, 188.0, 253.0, 255.0, 255.0, 255.0, 252.0, 237.0, 247.0, 255.0, 188.0, 210.0, 193.0, 183.0, 198.0, 244.0, 255.0, 255.0, 244.0, 253.0, 255.0, 186.0, 250.0, 191.0, 245.0, 252.0, 251.0, 255.0, 251.0, 252.0, 255.0, 251.0, 247.0, 255.0, 252.0, 192.0, 251.0, 255.0, 255.0, 191.0, 255.0, 255.0, 244.0, 247.0, 244.0, 245.0, 251.0, 188.0, 255.0, 255.0, 255.0, 253.0, 253.0, 255.0, 248.0, 254.0, 189.0, 253.0, 254.0, 254.0, 255.0, 193.0, 245.0, 254.0, 244.0, 255.0, 255.0, 255.0, 255.0, 255.0, 195.0, 235.0, 249.0, 255.0, 191.0, 240.0, 254.0, 255.0, 243.0, 254.0, 255.0, 187.0, 253.0, 196.0, 253.0, 255.0, 255.0, 255.0, 250.0, 251.0, 255.0, 253.0, 249.0, 253.0, 252.0, 194.0, 249.0, 247.0, 250.0, 203.0, 249.0, 253.0, 242.0, 255.0, 255.0, 255.0, 255.0, 192.0, 201.0, 186.0, 255.0, 252.0, 253.0, 255.0, 249.0, 255.0, 187.0, 255.0, 250.0, 255.0, 252.0, 179.0, 200.0, 209.0, 179.0, 197.0, 179.0, 185.0, 199.0, 191.0, 192.0, 199.0, 197.0, 187.0, 186.0, 197.0, 185.0, 195.0, 182.0, 195.0, 238.0, 198.0, 248.0, 194.0, 251.0, 255.0, 251.0, 255.0, 252.0, 255.0, 249.0, 254.0, 255.0, 255.0, 252.0, 178.0, 208.0, 186.0, 206.0, 169.0, 194.0, 200.0, 183.0, 195.0, 186.0, 183.0, 187.0, 193.0, 247.0, 255.0, 255.0, 255.0, 250.0, 255.0, 250.0, 255.0, 198.0, 255.0, 249.0, 255.0, 254.0, 185.0, 191.0, 255.0, 250.0, 254.0, 255.0, 239.0, 255.0, 255.0, 255.0, 254.0, 250.0, 255.0, 251.0, 255.0, 246.0, 252.0, 255.0, 193.0, 224.0, 204.0, 254.0, 186.0, 247.0, 250.0, 250.0, 240.0, 255.0, 244.0, 255.0, 254.0, 253.0, 247.0, 255.0, 198.0, 255.0, 247.0, 189.0, 255.0, 249.0, 253.0, 255.0, 242.0, 184.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 254.0, 251.0, 255.0, 255.0, 255.0, 182.0, 234.0, 255.0, 244.0, 249.0, 183.0, 203.0, 253.0, 236.0, 255.0, 254.0, 255.0, 255.0, 229.0, 246.0, 255.0, 236.0, 255.0, 249.0, 255.0, 255.0, 235.0, 227.0, 190.0, 222.0, 193.0, 246.0, 181.0, 248.0, 255.0, 244.0, 255.0, 249.0, 255.0, 255.0, 242.0, 244.0, 255.0, 247.0, 194.0, 242.0, 255.0, 196.0, 255.0, 255.0, 249.0, 255.0, 255.0, 196.0, 244.0, 255.0, 255.0, 255.0, 255.0, 255.0, 253.0, 249.0, 255.0, 255.0, 254.0, 175.0, 222.0, 187.0, 194.0, 196.0, 207.0, 167.0, 255.0, 255.0, 249.0, 253.0, 241.0, 247.0, 255.0, 255.0, 235.0, 255.0, 253.0, 249.0, 228.0, 255.0, 255.0, 255.0, 190.0, 255.0, 237.0, 255.0, 191.0, 250.0, 245.0, 255.0, 252.0, 236.0, 240.0, 242.0, 255.0, 248.0, 255.0, 247.0, 188.0, 255.0, 239.0, 184.0, 238.0, 255.0, 255.0, 255.0, 251.0, 192.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 249.0, 255.0, 252.0, 255.0, 186.0, 240.0, 0.0, 0.0, 0.0, 8.0, 183.0, 248.0, 239.0, 255.0, 3.0, 0.0, 7.0, 0.0, 255.0, 248.0, 245.0, 237.0, 246.0, 23.0, 0.0, 5.0, 0.0, 190.0, 242.0, 255.0, 0.0, 6.0, 21.0, 0.0, 0.0, 3.0, 10.0, 2.0, 193.0, 177.0, 194.0, 0.0, 0.0, 1.0, 0.0, 0.0, 201.0, 255.0, 251.0, 245.0, 252.0, 244.0, 192.0, 253.0, 255.0, 255.0, 255.0, 255.0, 253.0, 255.0, 252.0, 255.0, 250.0, 255.0, 194.0, 255.0, 234.0, 255.0, 0.0, 1.0, 211.0, 255.0, 243.0, 7.0, 1.0, 251.0, 250.0, 0.0, 0.0, 255.0, 255.0, 255.0, 13.0, 0.0, 253.0, 255.0, 0.0, 5.0, 255.0, 253.0, 244.0, 255.0, 228.0, 255.0, 249.0, 196.0, 0.0, 1.0, 255.0, 254.0, 0.0, 14.0, 248.0, 253.0, 254.0, 17.0, 7.0, 231.0, 254.0, 249.0, 255.0, 255.0, 206.0, 234.0, 255.0, 255.0, 255.0, 255.0, 247.0, 254.0, 255.0, 255.0, 252.0, 254.0, 192.0, 255.0, 255.0, 255.0, 0.0, 11.0, 175.0, 231.0, 0.0, 2.0, 250.0, 252.0, 244.0, 255.0, 0.0, 245.0, 238.0, 0.0, 0.0, 246.0, 255.0, 254.0, 242.0, 0.0, 0.0, 250.0, 255.0, 236.0, 254.0, 255.0, 229.0, 198.0, 5.0, 0.0, 245.0, 1.0, 8.0, 248.0, 255.0, 242.0, 204.0, 162.0, 0.0, 195.0, 196.0, 181.0, 195.0, 197.0, 188.0, 255.0, 255.0, 255.0, 255.0, 255.0, 250.0, 254.0, 254.0, 255.0, 252.0, 255.0, 191.0, 252.0, 255.0, 216.0, 0.0, 0.0, 205.0, 255.0, 9.0, 0.0, 255.0, 244.0, 247.0, 252.0, 255.0, 180.0, 234.0, 191.0, 190.0, 178.0, 197.0, 189.0, 193.0, 14.0, 8.0, 193.0, 187.0, 167.0, 201.0, 220.0, 191.0, 13.0, 0.0, 193.0, 175.0, 17.0, 0.0, 245.0, 255.0, 254.0, 205.0, 255.0, 248.0, 255.0, 241.0, 245.0, 255.0, 249.0, 181.0, 247.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 248.0, 253.0, 250.0, 255.0, 195.0, 255.0, 251.0, 255.0, 5.0, 0.0, 181.0, 244.0, 3.0, 0.0, 255.0, 0.0, 11.0, 3.0, 244.0, 200.0, 236.0, 255.0, 254.0, 255.0, 237.0, 255.0, 0.0, 0.0, 255.0, 244.0, 255.0, 204.0, 254.0, 249.0, 1.0, 0.0, 255.0, 254.0, 255.0, 0.0, 0.0, 255.0, 255.0, 242.0, 186.0, 252.0, 254.0, 238.0, 251.0, 255.0, 247.0, 255.0, 187.0, 255.0, 255.0, 255.0, 255.0, 255.0, 191.0, 197.0, 184.0, 199.0, 186.0, 188.0, 205.0, 248.0, 177.0, 198.0, 0.0, 6.0, 195.0, 245.0, 8.0, 0.0, 0.0, 255.0, 254.0, 1.0, 0.0, 198.0, 244.0, 250.0, 246.0, 255.0, 247.0, 22.0, 1.0, 252.0, 251.0, 254.0, 254.0, 190.0, 255.0, 2.0, 0.0, 255.0, 245.0, 255.0, 255.0, 0.0, 3.0, 244.0, 255.0, 242.0, 191.0, 255.0, 255.0, 242.0, 255.0, 243.0, 255.0, 242.0, 189.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 247.0, 253.0, 240.0, 255.0, 242.0, 247.0, 255.0, 202.0, 241.0, 0.0, 0.0, 186.0, 255.0, 1.0, 5.0, 255.0, 252.0, 246.0, 246.0, 6.0, 14.0, 235.0, 255.0, 255.0, 246.0, 11.0, 0.0, 251.0, 254.0, 243.0, 255.0, 255.0, 172.0, 0.0, 6.0, 240.0, 255.0, 248.0, 245.0, 255.0, 0.0, 4.0, 255.0, 248.0, 250.0, 206.0, 240.0, 255.0, 255.0, 241.0, 248.0, 253.0, 255.0, 207.0, 239.0, 255.0, 255.0, 255.0, 255.0, 247.0, 245.0, 252.0, 249.0, 248.0, 255.0, 0.0, 255.0, 196.0, 250.0, 3.0, 8.0, 204.0, 228.0, 0.0, 3.0, 242.0, 255.0, 255.0, 255.0, 8.0, 0.0, 247.0, 251.0, 253.0, 2.0, 0.0, 255.0, 255.0, 252.0, 255.0, 252.0, 239.0, 29.0, 0.0, 255.0, 255.0, 243.0, 244.0, 255.0, 234.0, 9.0, 0.0, 255.0, 249.0, 240.0, 191.0, 255.0, 0.0, 243.0, 255.0, 255.0, 251.0, 252.0, 191.0, 255.0, 255.0, 255.0, 255.0, 255.0, 252.0, 249.0, 255.0, 250.0, 236.0, 244.0, 10.0, 13.0, 187.0, 13.0, 0.0, 203.0, 197.0, 243.0, 255.0, 0.0, 3.0, 255.0, 245.0, 11.0, 0.0, 209.0, 255.0, 254.0, 0.0, 0.0, 255.0, 248.0, 218.0, 255.0, 255.0, 244.0, 4.0, 0.0, 255.0, 250.0, 255.0, 253.0, 255.0, 239.0, 255.0, 189.0, 10.0, 0.0, 254.0, 255.0, 202.0, 0.0, 2.0, 255.0, 254.0, 243.0, 255.0, 255.0, 186.0, 255.0, 255.0, 255.0, 255.0, 255.0, 232.0, 191.0, 209.0, 186.0, 205.0, 200.0, 192.0, 0.0, 0.0, 1.0, 180.0, 255.0, 188.0, 202.0, 168.0, 187.0, 0.0, 0.0, 4.0, 0.0, 191.0, 180.0, 254.0, 0.0, 0.0, 4.0, 6.0, 0.0, 20.0, 1.0, 0.0, 255.0, 13.0, 0.0, 243.0, 255.0, 234.0, 255.0, 255.0, 252.0, 255.0, 180.0, 255.0, 1.0, 3.0, 0.0, 0.0, 0.0, 241.0, 255.0, 245.0, 255.0, 255.0, 255.0, 193.0, 250.0, 255.0, 255.0, 255.0, 255.0, 255.0, 192.0, 249.0, 227.0, 252.0, 255.0, 245.0, 255.0, 240.0, 253.0, 195.0, 250.0, 199.0, 251.0, 246.0, 255.0, 251.0, 224.0, 238.0, 248.0, 252.0, 220.0, 255.0, 255.0, 255.0, 242.0, 245.0, 255.0, 250.0, 236.0, 248.0, 254.0, 230.0, 196.0, 255.0, 254.0, 255.0, 254.0, 249.0, 250.0, 234.0, 184.0, 205.0, 174.0, 175.0, 207.0, 178.0, 255.0, 255.0, 242.0, 255.0, 255.0, 255.0, 247.0, 182.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 176.0, 255.0, 249.0, 255.0, 247.0, 244.0, 255.0, 248.0, 255.0, 181.0, 244.0, 196.0, 254.0, 249.0, 254.0, 249.0, 183.0, 241.0, 255.0, 248.0, 191.0, 161.0, 185.0, 200.0, 174.0, 183.0, 196.0, 202.0, 195.0, 213.0, 189.0, 203.0, 202.0, 245.0, 241.0, 252.0, 255.0, 241.0, 255.0, 255.0, 182.0, 250.0, 255.0, 255.0, 244.0, 188.0, 255.0, 247.0, 254.0, 255.0, 237.0, 255.0, 255.0, 184.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 187.0, 253.0, 255.0, 254.0, 254.0, 251.0, 248.0, 255.0, 238.0, 190.0, 255.0, 192.0, 234.0, 255.0, 240.0, 255.0, 162.0, 255.0, 242.0, 245.0, 255.0, 255.0, 255.0, 243.0, 224.0, 229.0, 255.0, 249.0, 239.0, 255.0, 255.0, 252.0, 247.0, 249.0, 253.0, 255.0, 255.0, 243.0, 255.0, 247.0, 190.0, 255.0, 250.0, 246.0, 255.0, 180.0, 249.0, 255.0, 244.0, 252.0, 255.0, 246.0, 255.0, 196.0, 248.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 248.0, 255.0, 179.0, 250.0, 183.0, 255.0, 250.0, 255.0, 255.0, 192.0, 250.0, 255.0, 246.0, 253.0, 255.0, 255.0, 255.0, 206.0, 180.0, 191.0, 194.0, 193.0, 186.0, 190.0, 195.0, 185.0, 190.0, 201.0, 189.0, 190.0, 179.0, 204.0, 187.0, 200.0, 245.0, 255.0, 255.0, 245.0, 200.0, 187.0, 187.0, 193.0, 197.0, 195.0, 192.0, 200.0, 188.0, 255.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 253.0, 255.0, 191.0, 255.0, 195.0, 255.0, 249.0, 252.0, 249.0, 189.0, 250.0, 255.0, 252.0, 255.0, 253.0, 252.0, 243.0, 235.0, 253.0, 255.0, 246.0, 246.0, 249.0, 255.0, 255.0, 250.0, 255.0, 255.0, 251.0, 255.0, 242.0, 255.0, 253.0, 246.0, 255.0, 253.0, 253.0, 255.0, 246.0, 253.0, 254.0, 252.0, 249.0, 248.0, 247.0, 243.0, 205.0, 252.0, 252.0, 252.0, 252.0, 252.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 253.0, 184.0, 253.0, 189.0, 251.0, 241.0, 245.0, 250.0, 194.0, 252.0, 255.0, 254.0, 255.0, 251.0, 249.0, 255.0, 246.0, 255.0, 250.0, 244.0, 255.0, 255.0, 248.0, 252.0, 249.0, 250.0, 254.0, 237.0, 255.0, 252.0, 255.0, 255.0, 250.0, 254.0, 246.0, 246.0, 254.0, 250.0, 255.0, 255.0, 255.0, 255.0, 255.0, 255.0, 250.0, 203.0, 240.0, 254.0, 254.0, 254.0, 254.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 190.0, 255.0, 196.0, 255.0, 254.0, 255.0, 255.0, 202.0, 252.0, 252.0, 251.0, 255.0, 250.0, 254.0, 237.0, 189.0, 197.0, 181.0, 187.0, 205.0, 201.0, 180.0, 186.0, 192.0, 196.0, 203.0, 186.0, 246.0, 253.0, 255.0, 246.0, 248.0, 255.0, 255.0, 255.0, 255.0, 248.0, 246.0, 243.0, 250.0, 255.0, 253.0, 249.0, 246.0, 208.0, 253.0, 255.0, 255.0, 255.0, 255.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 255.0, 255.0, 195.0, 254.0, 196.0, 243.0, 242.0, 247.0, 241.0, 198.0, 249.0, 249.0, 252.0, 255.0, 248.0, 255.0, 251.0, 206.0, 255.0, 255.0, 254.0, 252.0, 255.0, 255.0, 255.0, 255.0, 255.0, 246.0, 195.0, 249.0, 251.0, 252.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 254.0, 255.0, 255.0, 255.0, 252.0, 248.0, 203.0, 241.0, 253.0, 253.0, 253.0, 253.0, 254.0, 193.0, 255.0, 250.0, 255.0, 251.0, 255.0, 254.0, 244.0, 246.0, 189.0, 243.0, 182.0, 211.0, 201.0, 199.0, 212.0, 185.0, 247.0, 250.0, 255.0, 255.0, 245.0, 254.0, 233.0, 178.0, 252.0, 255.0, 254.0, 238.0, 245.0, 255.0, 233.0, 248.0, 252.0, 251.0, 191.0, 252.0, 254.0, 253.0, 253.0, 255.0, 244.0, 247.0, 247.0, 244.0, 255.0, 253.0, 255.0, 254.0, 247.0, 248.0, 255.0, 250.0, 185.0, 200.0, 196.0, 196.0, 196.0, 196.0]] +val_output = ['EGYK4', 'GRC35', '6O5W1', 'J627C'] +def getData(): + inputs = [] + labels = [] + for i in range(len(val_input)): + labels.append(val_output[i]) + inputs.append(val_input[i]) + return np.array(inputs), np.array(labels) +# Read the captchas +input_data, output_data = getData() +# Create the classifier model +clf = LogisticRegression() +clf.fit(input_data, output_data) +# Set new captcha +image = [] +row, col = map(int,input().split(' ')) +for i in range(row): + line = input() + for item in line.split(" "): + vals = [int(val) for val in item.split(",")] + image.append(sum(vals)/len(vals)) +print(clf.predict(image)[0]) \ No newline at end of file diff --git a/hackerrank/AI/Digital-Image-Analysis/the-captcha-cracker.py b/hackerrank/AI/Digital-Image-Analysis/the-captcha-cracker.py new file mode 100644 index 0000000..1add2ce --- /dev/null +++ b/hackerrank/AI/Digital-Image-Analysis/the-captcha-cracker.py @@ -0,0 +1,49 @@ +import os +import sys +import numpy as np +from sklearn.linear_model import LogisticRegression +import warnings +warnings.filterwarnings("ignore", category=DeprecationWarning) + + +def getInput(directory, filename_input): + pixels = [] + with open(directory + "/input/" + filename_input, "r") as f: + next(f) + for line in f: + for item in line.split(" "): + vals = [int(val) for val in item.split(",")] + pixels.append(sum(vals)/len(vals)) + return pixels + + +def getOutput(directory, filename_input): + label = "output" + str(filename_input[5:].split(".")[0]) + ".txt" + with open(directory + "/output/" + label, "r") as f: + return f.read().strip() + + +def getData(directory_name): + inputs = [] + labels = [] + for root, dirs, files in os.walk(directory_name + "/input", topdown=False): + files = [f for f in files if f.endswith(".txt")] + for item in files: + filename = os.path.join(root, item) + labels.append(getOutput(directory_name, item)) + inputs.append(getInput(directory_name, item)) + return np.array(inputs), np.array(labels) + + +directory = sys.path[0] + "/sampleCaptchas" +input_data, output_data = getData(directory) +clf = LogisticRegression() +clf.fit(input_data, output_data) +image = [] +row, col = map(int, input().split(' ')) +for i in range(row): + line = input() + for item in line.split(" "): + vals = [int(val) for val in item.split(",")] + image.append(sum(vals)/len(vals)) +print(clf.predict(image)[0]) diff --git a/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-1.py b/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-1.py new file mode 100644 index 0000000..6d873e2 --- /dev/null +++ b/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-1.py @@ -0,0 +1,8 @@ +probability = 1/6 +values = 6 +result = 0 +for i in range(1, values + 1): + for j in range(1, values + 1): + if (i + j) <= 9: + result += probability ** 2 +print (result) \ No newline at end of file diff --git a/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-2.py b/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-2.py new file mode 100644 index 0000000..4eef722 --- /dev/null +++ b/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-2.py @@ -0,0 +1,8 @@ +probability = 1/6 +values = 6 +result = 0 +for i in range(1, values + 1): + for j in range(1, values + 1): + if i != j and (i + j) == 6: + result += probability ** 2 +print (result) \ No newline at end of file diff --git a/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-3.py b/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-3.py new file mode 100644 index 0000000..f401711 --- /dev/null +++ b/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-3.py @@ -0,0 +1,10 @@ +x_prob_red = 4/7 +x_prob_black = 3/7 +y_prob_red = 5/9 +y_prob_black = 4/9 +z_prob_red = 1/2 +z_prob_black = 1/2 +first_combination = x_prob_red * y_prob_red * z_prob_black +second_combination = x_prob_black * y_prob_red * z_prob_red +third_combination = x_prob_red * y_prob_black * z_prob_red +print(first_combination + second_combination + third_combination) diff --git a/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-4.py b/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-4.py new file mode 100644 index 0000000..1e4352f --- /dev/null +++ b/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-4.py @@ -0,0 +1,4 @@ +first_combination = (5/9) * (7/10) * (3/9) +second_combination = (5/9) * (3/10) * (7/9) +third_combination = (4/9) * (7/10) * (6/9) +print(first_combination + second_combination + third_combination) diff --git a/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-5.py b/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-5.py new file mode 100644 index 0000000..a93511c --- /dev/null +++ b/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-5.py @@ -0,0 +1 @@ +print (2/9) \ No newline at end of file diff --git a/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-6.py b/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-6.py new file mode 100644 index 0000000..1d9c61e --- /dev/null +++ b/hackerrank/AI/Probability-Statistics-Foundations/basic-probability-puzzles-6.py @@ -0,0 +1 @@ +print ((6/14 * 5/9) + (7/14 * 4/9)) \ No newline at end of file diff --git a/hackerrank/AI/Statistics-and-Machine-Learning/basic-statistics-warmup.py b/hackerrank/AI/Statistics-and-Machine-Learning/basic-statistics-warmup.py new file mode 100644 index 0000000..2a93d09 --- /dev/null +++ b/hackerrank/AI/Statistics-and-Machine-Learning/basic-statistics-warmup.py @@ -0,0 +1,24 @@ +import numpy as np +import math as m +import statistics as stpy +from scipy import stats + + +def mean_confidence_interval(length, mean, stdev): + return 1.96 * (stdev / m.sqrt(length)) + + +total = int(input()) +numbers = list(map(int, input().split())) +mean = np.mean(numbers) +median = np.median(numbers) +mode = int(stats.mode(numbers)[0]) +stdev = stpy.pstdev(numbers) +confidence_interval = mean_confidence_interval(total, mean, stdev) +min_confidence = round(mean - confidence_interval, 1) +max_confidence = round(mean + confidence_interval, 1) +print(round(mean, 1)) +print(round(median, 1)) +print(mode) +print(round(stdev, 1)) +print("{} {}".format(min_confidence, max_confidence)) diff --git a/hackerrank/AI/Statistics-and-Machine-Learning/computing-the-correlation.py b/hackerrank/AI/Statistics-and-Machine-Learning/computing-the-correlation.py new file mode 100644 index 0000000..5998e26 --- /dev/null +++ b/hackerrank/AI/Statistics-and-Machine-Learning/computing-the-correlation.py @@ -0,0 +1,31 @@ +import math as m + + +def pearson(first_data, second_data, n): + sum_firt_data = sum(first_data) + sum_second_data = sum(second_data) + sum_data = sum([x*y for x, y in zip(first_data, second_data)]) + sum_first_data_squared = sum([x**2 for x in first_data]) + sum_first_data_mult_squared = sum_firt_data ** 2 + sum_secon_data_squared = sum([y**2 for y in second_data]) + sum_secon_data_mult_squared = sum_second_data ** 2 + numerator = (n * sum_data) - (sum_firt_data * sum_second_data) + den_first_data = m.sqrt( + (n * sum_first_data_squared) - sum_first_data_mult_squared) + den_second_data = m.sqrt( + (n * sum_secon_data_squared) - sum_secon_data_mult_squared) + return round(numerator / (den_first_data * den_second_data), 2) + + +n = int(input()) +mathematics = [] +physics = [] +chemistry = [] +for i in range(n): + elements = list(map(float, input().split())) + mathematics.append(elements[0]) + physics.append(elements[1]) + chemistry.append(elements[2]) +print(pearson(mathematics, physics, float(n))) +print(pearson(physics, chemistry, float(n))) +print(pearson(mathematics, chemistry, float(n))) diff --git a/hackerrank/AI/Statistics-and-Machine-Learning/correlation-and-regression-lines-rec-1.py b/hackerrank/AI/Statistics-and-Machine-Learning/correlation-and-regression-lines-rec-1.py new file mode 100644 index 0000000..d64a436 --- /dev/null +++ b/hackerrank/AI/Statistics-and-Machine-Learning/correlation-and-regression-lines-rec-1.py @@ -0,0 +1,31 @@ +import math as m + + +def mean(data): + return sum(data) / len(data) + + +def var(data): + sum = 0 + for i in range(len(data)): + sum = sum + (data[i] - mean(data)) ** 2 + return sum + + +def cov(dt1, dt2): + sum = 0 + for i in range(len(dt1)): + sum += (dt1[i] - mean(dt1)) * (dt2[i] - mean(dt2)) + return sum + + +physics = [15.0, 12.0, 8.0, 8.0, 7.0, 7.0, 7.0, 6.0, 5.0, 3.0] +history = [10.0, 25.0, 17.0, 11.0, 13.0, 17.0, 20.0, 13.0, 9.0, 15.0] +mean_physics = mean(physics) +mean_history = mean(history) +var_physics = var(physics) +var_history = var(history) +cov = cov(physics, history) +std = m.sqrt(var_physics * var_history) +r = cov / std +print(round(r, 3)) diff --git a/hackerrank/AI/Statistics-and-Machine-Learning/correlation-and-regression-lines-rec-2.py b/hackerrank/AI/Statistics-and-Machine-Learning/correlation-and-regression-lines-rec-2.py new file mode 100644 index 0000000..0f41bc2 --- /dev/null +++ b/hackerrank/AI/Statistics-and-Machine-Learning/correlation-and-regression-lines-rec-2.py @@ -0,0 +1,14 @@ +def mean(data): + return sum(data) / len(data) + + +physics = [15.0, 12.0, 8.0, 8.0, 7.0, 7.0, 7.0, 6.0, 5.0, 3.0] +history = [10.0, 25.0, 17.0, 11.0, 13.0, 17.0, 20.0, 13.0, 9.0, 15.0] +mean_physics = mean(physics) +mean_history = mean(history) +var_physics = sum([(p - mean_physics) ** 2 for p in physics]) +sum_phy_his = 0 +for i in range(len(physics)): + sum_phy_his += (physics[i] - mean_physics) * (history[i] - mean_history) +slope = sum_phy_his / var_physics +print(round(slope, 3)) diff --git a/hackerrank/AI/Statistics-and-Machine-Learning/correlation-and-regression-lines-rec-3.py b/hackerrank/AI/Statistics-and-Machine-Learning/correlation-and-regression-lines-rec-3.py new file mode 100644 index 0000000..958e5c3 --- /dev/null +++ b/hackerrank/AI/Statistics-and-Machine-Learning/correlation-and-regression-lines-rec-3.py @@ -0,0 +1,16 @@ +def mean(data): + return sum(data) / len(data) + + +physics = [15.0, 12.0, 8.0, 8.0, 7.0, 7.0, 7.0, 6.0, 5.0, 3.0] +history = [10.0, 25.0, 17.0, 11.0, 13.0, 17.0, 20.0, 13.0, 9.0, 15.0] +mean_physics = mean(physics) +mean_history = mean(history) +var_physics = sum([(p - mean_physics) ** 2 for p in physics]) +sum_phy_his = 0 +for i in range(len(physics)): + sum_phy_his += (physics[i] - mean_physics) * (history[i] - mean_history) +b = sum_phy_his / var_physics +a = mean_history - b * mean_physics +result = b * 10 + a +print(round(result, 1)) diff --git a/hackerrank/AI/Statistics-and-Machine-Learning/correlation-and-regression-lines-rec-4.py b/hackerrank/AI/Statistics-and-Machine-Learning/correlation-and-regression-lines-rec-4.py new file mode 100644 index 0000000..a8a03ca --- /dev/null +++ b/hackerrank/AI/Statistics-and-Machine-Learning/correlation-and-regression-lines-rec-4.py @@ -0,0 +1,3 @@ +y = 7 +val_x = (9 * y + 107) / 20 +print(round(val_x, 1)) diff --git a/hackerrank/AI/Statistics-and-Machine-Learning/dataset/trainingdata.txt b/hackerrank/AI/Statistics-and-Machine-Learning/dataset/trainingdata.txt new file mode 100644 index 0000000..98b35db --- /dev/null +++ b/hackerrank/AI/Statistics-and-Machine-Learning/dataset/trainingdata.txt @@ -0,0 +1,100 @@ +2.81,5.62 +7.14,8.00 +2.72,5.44 +3.87,7.74 +1.90,3.80 +7.82,8.00 +7.02,8.00 +5.50,8.00 +9.15,8.00 +4.87,8.00 +8.08,8.00 +5.58,8.00 +9.13,8.00 +0.14,0.28 +2.00,4.00 +5.47,8.00 +0.80,1.60 +4.37,8.00 +5.31,8.00 +0.00,0.00 +1.78,3.56 +3.45,6.90 +6.13,8.00 +3.53,7.06 +4.61,8.00 +1.76,3.52 +6.39,8.00 +0.02,0.04 +9.69,8.00 +5.33,8.00 +6.37,8.00 +5.55,8.00 +7.80,8.00 +2.06,4.12 +7.79,8.00 +2.24,4.48 +9.71,8.00 +1.11,2.22 +8.38,8.00 +2.33,4.66 +1.83,3.66 +5.94,8.00 +9.20,8.00 +1.14,2.28 +4.15,8.00 +8.43,8.00 +5.68,8.00 +8.21,8.00 +1.75,3.50 +2.16,4.32 +4.93,8.00 +5.75,8.00 +1.26,2.52 +3.97,7.94 +4.39,8.00 +7.53,8.00 +1.98,3.96 +1.66,3.32 +2.04,4.08 +11.72,8.00 +4.64,8.00 +4.71,8.00 +3.77,7.54 +9.33,8.00 +1.83,3.66 +2.15,4.30 +1.58,3.16 +9.29,8.00 +1.27,2.54 +8.49,8.00 +5.39,8.00 +3.47,6.94 +6.48,8.00 +4.11,8.00 +1.85,3.70 +8.79,8.00 +0.13,0.26 +1.44,2.88 +5.96,8.00 +3.42,6.84 +1.89,3.78 +1.98,3.96 +5.26,8.00 +0.39,0.78 +6.05,8.00 +1.99,3.98 +1.58,3.16 +3.99,7.98 +4.35,8.00 +6.71,8.00 +2.58,5.16 +7.37,8.00 +5.77,8.00 +3.97,7.94 +3.65,7.30 +4.38,8.00 +8.06,8.00 +8.05,8.00 +1.10,2.20 +6.65,8.00 \ No newline at end of file diff --git a/hackerrank/AI/Statistics-and-Machine-Learning/laptop-battery-life.py b/hackerrank/AI/Statistics-and-Machine-Learning/laptop-battery-life.py new file mode 100644 index 0000000..4c12063 --- /dev/null +++ b/hackerrank/AI/Statistics-and-Machine-Learning/laptop-battery-life.py @@ -0,0 +1,20 @@ +import sys +import pandas as pd +from sklearn import linear_model +import matplotlib.pyplot as plt +dataset = pd.read_csv('dataset/trainingdata.txt', header=None) +plt.plot(dataset.iloc[:, 0], dataset.iloc[:, 1], 'ro') +plt.ylabel('Laptob Battery Life') +plt.show() +dataset = dataset[dataset.iloc[:, 1] < 8] +dataset.insert(0, len(dataset.columns), 0) +X = dataset.iloc[:, 0:2].as_matrix() +Y = dataset.iloc[:, 2].as_matrix() +model = linear_model.LinearRegression() +model.fit(X, Y) +timeCharged = float(input().strip()) +result = model.predict([[0, timeCharged]]) +if result[0] > 8: + print(8.0) +else: + print(round(result[0], 2)) diff --git a/hackerrank/AI/Statistics-and-Machine-Learning/multiple-linear-regression-predicting-house-prices.py b/hackerrank/AI/Statistics-and-Machine-Learning/multiple-linear-regression-predicting-house-prices.py new file mode 100644 index 0000000..97da585 --- /dev/null +++ b/hackerrank/AI/Statistics-and-Machine-Learning/multiple-linear-regression-predicting-house-prices.py @@ -0,0 +1,27 @@ +from sklearn import linear_model +features, rows = map(int, input().split()) +X, Y = [], [] +for i in range(rows): + x = [0] + elements = list(map(float, input().split())) + for j in range(len(elements)): + if j < features: + x.append(elements[j]) + else: + Y.append(elements[j]) + X.append(x) +model = linear_model.LinearRegression() +model.fit(X, Y) +a = model.intercept_ +b = model.coef_ +new_rows = int(input()) +new_X = [] +for i in range(new_rows): + x = [0] + elements = list(map(float, input().split())) + for j in range(len(elements)): + x.append(elements[j]) + new_X.append(x) +result = model.predict(new_X) +for i in range(len(result)): + print(round(result[i], 2)) diff --git a/hackerrank/AI/Statistics-and-Machine-Learning/polynomial-regression-office-prices.py b/hackerrank/AI/Statistics-and-Machine-Learning/polynomial-regression-office-prices.py new file mode 100644 index 0000000..9bbcf68 --- /dev/null +++ b/hackerrank/AI/Statistics-and-Machine-Learning/polynomial-regression-office-prices.py @@ -0,0 +1,28 @@ +from sklearn import linear_model +from sklearn.preprocessing import PolynomialFeatures +import numpy as np +features, rows = map(int, input().split()) +X, Y = [], [] +for i in range(rows): + x = [0] + elements = list(map(float, input().split())) + for j in range(len(elements)): + if j < features: + x.append(elements[j]) + else: + Y.append(elements[j]) + X.append(x) +poly = PolynomialFeatures(degree=3) +model = linear_model.LinearRegression() +model.fit(poly.fit_transform(np.array(X)), Y) +new_rows = int(input()) +new_X = [] +for i in range(new_rows): + x = [0] + elements = list(map(float, input().split())) + for j in range(len(elements)): + x.append(elements[j]) + new_X.append(x) +result = model.predict(poly.fit_transform(np.array(new_X))) +for i in range(len(result)): + print(round(result[i], 2)) diff --git a/hackerrank/Algorithms/Warmup/A Very Big Sum/Solution.java b/hackerrank/Algorithms/Warmup/A Very Big Sum/Solution.java new file mode 100644 index 0000000..792d998 --- /dev/null +++ b/hackerrank/Algorithms/Warmup/A Very Big Sum/Solution.java @@ -0,0 +1,27 @@ +import java.math.BigInteger; +import java.util.Scanner; + +public class Solution { + + public static BigInteger aVeryBigSum(long[] array) { + BigInteger sum = BigInteger.ZERO; + for (long n : array) { + sum = sum.add(BigInteger.valueOf(n)); + } + return sum; + } + + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + int n = in.nextInt(); + long[] array = new long[n]; + for (int i = 0; i < n; i++) { + array[i] = in.nextLong(); + } + in.close(); + + BigInteger result = aVeryBigSum(array); + System.out.println(result); + } + +} diff --git a/hackerrank/Algorithms/Warmup/Birthday Cake Candles/Solution.java b/hackerrank/Algorithms/Warmup/Birthday Cake Candles/Solution.java new file mode 100644 index 0000000..0b69278 --- /dev/null +++ b/hackerrank/Algorithms/Warmup/Birthday Cake Candles/Solution.java @@ -0,0 +1,33 @@ +import java.util.Scanner; + +public class Solution { + + public static int birthdayCakeCandles(int[] array) { + int max = Integer.MIN_VALUE; + int maxOccurences = 0; + + for (int n : array) { + if (n > max) { + max = n; + maxOccurences = 1; + } else if (n == max) { + maxOccurences++; + } + } + + return maxOccurences; + } + + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + int n = in.nextInt(); + int[] array = new int[n]; + for (int i = 0; i < n; i++) { + array[i] = in.nextInt(); + } + in.close(); + + System.out.println(birthdayCakeCandles(array)); + } + +} diff --git a/hackerrank/Algorithms/Warmup/Compare the Triplets/Solution.java b/hackerrank/Algorithms/Warmup/Compare the Triplets/Solution.java new file mode 100644 index 0000000..97c7b1e --- /dev/null +++ b/hackerrank/Algorithms/Warmup/Compare the Triplets/Solution.java @@ -0,0 +1,45 @@ +import java.util.Scanner; + +public class Solution { + + public static int[] compareTriplets(int[] a, int[] b) { + int[] scores = new int[2]; + + for (int i = 0; i < a.length; i++) { + int diff = a[i] - b[i]; + + if (diff > 0) { + scores[0]++; + } else if (diff < 0) { + scores[1]++; + } + } + + return scores; + } + + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + + String[] aStrings = in.nextLine().split(" "); + int[] a = new int[aStrings.length]; + for (int i = 0; i < a.length; i++) { + a[i] = Integer.parseInt(aStrings[i]); + } + + String[] bStrings = in.nextLine().split(" "); + int[] b = new int[bStrings.length]; + for (int i = 0; i < b.length; i++) { + b[i] = Integer.parseInt(bStrings[i]); + } + + in.close(); + + int[] scores = compareTriplets(a, b); + for (int i : scores) { + System.out.print(i + " "); + } + System.out.println(); + } + +} diff --git a/hackerrank/Algorithms/Warmup/Diagonal Difference/Solution.java b/hackerrank/Algorithms/Warmup/Diagonal Difference/Solution.java new file mode 100644 index 0000000..ed98f79 --- /dev/null +++ b/hackerrank/Algorithms/Warmup/Diagonal Difference/Solution.java @@ -0,0 +1,33 @@ +import java.util.Scanner; + +public class Solution { + + public static int diagonalDifference(int[][] array) { + int primaryDiagSum = 0; + int secondaryDiagSum = 0; + + for (int i = 0; i < array.length; i++) { + primaryDiagSum += array[i][i]; + secondaryDiagSum += array[i][array.length - 1 - i]; + } + return Math.abs(primaryDiagSum - secondaryDiagSum); + } + + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + + int n = in.nextInt(); + int[][] array = new int[n][n]; + + for (int i = 0; i < n; i++) { + for (int j = 0; j < n; j++) { + array[i][j] = in.nextInt(); + } + } + in.close(); + + int result = diagonalDifference(array); + System.out.println(result); + } + +} diff --git a/hackerrank/Algorithms/Warmup/Mini-Max Sum/Solution.java b/hackerrank/Algorithms/Warmup/Mini-Max Sum/Solution.java new file mode 100644 index 0000000..6918d17 --- /dev/null +++ b/hackerrank/Algorithms/Warmup/Mini-Max Sum/Solution.java @@ -0,0 +1,39 @@ +import java.util.Scanner; +import java.util.Arrays; + +public class Solution { + + public static void miniMaxSum(int[] array) { + int min = Integer.MAX_VALUE; + int max = Integer.MIN_VALUE; + long sum = 0; + + for (int n : array) { + sum += n; + if (n < min) { + min = n; + } + if (n > max) { + max = n; + } + } + + long minSum = sum - max; + long maxSum = sum - min; + System.out.println(minSum + " " + maxSum); + } + + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + String[] inputStrings = in.nextLine().split(" "); + in.close(); + + int[] array = new int[5]; + for (int i = 0; i < 5; i++) { + array[i] = Integer.parseInt(inputStrings[i]); + } + + miniMaxSum(array); + } + +} diff --git a/hackerrank/Algorithms/Warmup/Plus Minus/Solution.java b/hackerrank/Algorithms/Warmup/Plus Minus/Solution.java new file mode 100644 index 0000000..d05b348 --- /dev/null +++ b/hackerrank/Algorithms/Warmup/Plus Minus/Solution.java @@ -0,0 +1,38 @@ +import java.util.Scanner; + +class Solution { + + public static void plusMinus(int[] array) { + int countPositive = 0; + int countZero = 0; + int countNegative = 0; + + for (int n : array) { + if (n > 0) { + countPositive++; + } else if (n < 0) { + countNegative++; + } else { + countZero++; + } + } + + System.out.printf("%.6f\n%.6f\n%.6f\n", + (double) countPositive / array.length, + (double) countNegative / array.length, + (double) countZero / array.length); + } + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int n = scanner.nextInt(); + int[] array = new int[n]; + for (int i = 0; i < n; i++) { + array[i] = scanner.nextInt(); + } + scanner.close(); + + plusMinus(array); + } + +} diff --git a/hackerrank/Algorithms/Warmup/Simple Array Sum/Solution.java b/hackerrank/Algorithms/Warmup/Simple Array Sum/Solution.java new file mode 100644 index 0000000..d90ebf0 --- /dev/null +++ b/hackerrank/Algorithms/Warmup/Simple Array Sum/Solution.java @@ -0,0 +1,25 @@ +import java.util.Scanner; + +public class Solution { + + public static int arraySum(int[] arr) { + int sum = 0; + for (int i : arr) { + sum += i; + } + return sum; + } + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int n = scanner.nextInt(); + int[] arr = new int[n]; + for (int i = 0; i < n; i++) { + arr[i] = scanner.nextInt(); + } + scanner.close(); + + int result = arraySum(arr); + System.out.println(result); + } +} diff --git a/hackerrank/Algorithms/Warmup/Solve Me First/Solution.java b/hackerrank/Algorithms/Warmup/Solve Me First/Solution.java new file mode 100644 index 0000000..827844c --- /dev/null +++ b/hackerrank/Algorithms/Warmup/Solve Me First/Solution.java @@ -0,0 +1,16 @@ +import java.util.Scanner; + +public class Solution { + + public static int add(int a, int b) { + return a + b; + } + + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + int a = in.nextInt(); + int b = in.nextInt(); + int sum = add(a, b); + System.out.println(sum); + } +} diff --git a/hackerrank/Algorithms/Warmup/Staircase/Solution.java b/hackerrank/Algorithms/Warmup/Staircase/Solution.java new file mode 100644 index 0000000..82506ed --- /dev/null +++ b/hackerrank/Algorithms/Warmup/Staircase/Solution.java @@ -0,0 +1,20 @@ +import java.util.Scanner; + +public class Solution { + + public static void staircase(int n) { + StringBuilder string = new StringBuilder(); + for (int i = 0; i < n; i++) { + string.append("#"); + System.out.printf("%" + n + "s\n", string); + } + } + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + int n = scanner.nextInt(); + scanner.close(); + staircase(n); + } + +} diff --git a/hackerrank/Algorithms/Warmup/Time Conversion/Solution.java b/hackerrank/Algorithms/Warmup/Time Conversion/Solution.java new file mode 100644 index 0000000..2e0077b --- /dev/null +++ b/hackerrank/Algorithms/Warmup/Time Conversion/Solution.java @@ -0,0 +1,31 @@ +import java.util.Scanner; + +public class Solution { + + public static String timeConversion(String str) { + String[] split = str.split(":"); + String hh = split[0]; + String mm = split[1]; + String ss = split[2].substring(0, 2); + boolean isAM = split[2].substring(2).equals("AM"); + + int hour = Integer.parseInt(hh); + if (isAM && hour == 12) { + hour = 0; + } else if (!isAM && hour != 12) { + hour += 12; + } + hh = String.format("%02d", hour); + + return String.format("%s:%s:%s", hh, mm, ss); + } + + public static void main(String[] args) { + Scanner in = new Scanner(System.in); + String inputString = in.nextLine(); + in.close(); + + System.out.println(timeConversion(inputString)); + } + +} diff --git a/hackerrank/Linux/Arrays/Concatenate an array with itself.sh b/hackerrank/Linux/Arrays/Concatenate an array with itself.sh new file mode 100644 index 0000000..06a1af5 --- /dev/null +++ b/hackerrank/Linux/Arrays/Concatenate an array with itself.sh @@ -0,0 +1,4 @@ +#Given a list of countries, each on a new line, your task is to read them into an array. Then, concatenate the array with itself (twice) - so that you have a total of three repetitions of the original array - and then display the entire concatenated array, with a space between each of the countries' names +arr=($(cat)) +arr=("${arr[@]}" "${arr[@]}" "${arr[@]}") +echo ${arr[@]} \ No newline at end of file diff --git a/hackerrank/Linux/Arrays/Count the number of elements in an Array.sh b/hackerrank/Linux/Arrays/Count the number of elements in an Array.sh new file mode 100644 index 0000000..4041229 --- /dev/null +++ b/hackerrank/Linux/Arrays/Count the number of elements in an Array.sh @@ -0,0 +1,3 @@ +#Given a list of countries, each on a new line, your task is to read them into an array and then display the count of elements in that array. +arr=($(cat)) +echo ${#arr[@]} diff --git a/hackerrank/Linux/Arrays/Display an element of an array.sh b/hackerrank/Linux/Arrays/Display an element of an array.sh new file mode 100644 index 0000000..3aaf727 --- /dev/null +++ b/hackerrank/Linux/Arrays/Display an element of an array.sh @@ -0,0 +1,3 @@ +# Given a list of countries, each on a new line, your task is to read them into an array and then display the element indexed at . Note that indexing starts from 0. +arr=($(cat)) +echo ${arr[3]} diff --git a/hackerrank/Linux/Arrays/Filter an Array with Patterns.sh b/hackerrank/Linux/Arrays/Filter an Array with Patterns.sh new file mode 100644 index 0000000..c241156 --- /dev/null +++ b/hackerrank/Linux/Arrays/Filter an Array with Patterns.sh @@ -0,0 +1,3 @@ +# You are given a list of countries, each on a new line. Your task is to read them into an array and then filter out (remove) all the names containing the letter 'a' or 'A'. +arr=($(cat)) +echo ${arr[@]/*[aA]*/} diff --git a/hackerrank/Linux/Arrays/Lonely Integer - Bash!.sh b/hackerrank/Linux/Arrays/Lonely Integer - Bash!.sh new file mode 100644 index 0000000..a8a7686 --- /dev/null +++ b/hackerrank/Linux/Arrays/Lonely Integer - Bash!.sh @@ -0,0 +1,4 @@ +#There are N integers in an array A. All but one integer occur in pairs. Your task is to find the number that occurs only once +read +arr=($(cat)) +echo "${arr[@]}" | tr ' ' '\n' |sort | uniq -u | tr '\n' ' ' diff --git a/hackerrank/Linux/Arrays/Read in an Array.sh b/hackerrank/Linux/Arrays/Read in an Array.sh new file mode 100644 index 0000000..0cac651 --- /dev/null +++ b/hackerrank/Linux/Arrays/Read in an Array.sh @@ -0,0 +1,7 @@ +#Given a list of countries, each on a new line, your task is to read them into an array and then display the entire array, with a space between each of the countries' names. +while read line +do + arr=(${arr[@]} $line) +done + +echo ${arr[@]} \ No newline at end of file diff --git a/hackerrank/Linux/Arrays/Remove the First Capital Letter from Each Element.sh b/hackerrank/Linux/Arrays/Remove the First Capital Letter from Each Element.sh new file mode 100644 index 0000000..2b9557e --- /dev/null +++ b/hackerrank/Linux/Arrays/Remove the First Capital Letter from Each Element.sh @@ -0,0 +1,3 @@ +#You are given a list of countries, each on a new line. Your task is to read them into an array and then transform them in the following way:The first capital letter (if present) in each element of the array should be replaced with a dot ('.'). Then, display the entire array with a space between each country's names. +arr=($(cat)) +echo ${arr[@]/[A-Z]/.} diff --git a/hackerrank/Linux/Arrays/Slice an Array.sh b/hackerrank/Linux/Arrays/Slice an Array.sh new file mode 100644 index 0000000..505bf6a --- /dev/null +++ b/hackerrank/Linux/Arrays/Slice an Array.sh @@ -0,0 +1,3 @@ +# Given a list of countries, each on a new line, your task is to read them into an array. Then slice the array and display only the elements lying between positions 3 and 7, both inclusive. Indexing starts from from 0. +arr=($(cat)) +echo ${arr[@]:3:5} \ No newline at end of file diff --git a/hackerrank/Linux/Arrays/concatenateArray.sh b/hackerrank/Linux/Arrays/concatenateArray.sh new file mode 100644 index 0000000..1d40980 --- /dev/null +++ b/hackerrank/Linux/Arrays/concatenateArray.sh @@ -0,0 +1,4 @@ +readarray cName +concArr=("${cName[@]}" "${cName[@]}" "${cName[@]}") + +echo ${concArr[@]} diff --git a/hackerrank/Linux/Arrays/elementArray.sh b/hackerrank/Linux/Arrays/elementArray.sh new file mode 100644 index 0000000..4c07616 --- /dev/null +++ b/hackerrank/Linux/Arrays/elementArray.sh @@ -0,0 +1,2 @@ +readarray cName +echo ${cName[3]} diff --git a/hackerrank/Linux/Arrays/filterArray.sh b/hackerrank/Linux/Arrays/filterArray.sh new file mode 100644 index 0000000..56c9e00 --- /dev/null +++ b/hackerrank/Linux/Arrays/filterArray.sh @@ -0,0 +1,2 @@ +readarray cName +echo ${cName[@]/*[aA]*/} diff --git a/hackerrank/Linux/Arrays/lengthArray.sh b/hackerrank/Linux/Arrays/lengthArray.sh new file mode 100644 index 0000000..59f3143 --- /dev/null +++ b/hackerrank/Linux/Arrays/lengthArray.sh @@ -0,0 +1,3 @@ +readarray cName +echo ${#cName[@]} + diff --git a/hackerrank/Linux/Arrays/lonelyIntArray.sh b/hackerrank/Linux/Arrays/lonelyIntArray.sh new file mode 100644 index 0000000..acf8698 --- /dev/null +++ b/hackerrank/Linux/Arrays/lonelyIntArray.sh @@ -0,0 +1,5 @@ +read +numArr=($(cat)) + +numArr=${numArr[*]} +echo $((${numArr// /^})) diff --git a/hackerrank/Linux/Arrays/readArray.sh b/hackerrank/Linux/Arrays/readArray.sh new file mode 100644 index 0000000..1a41b32 --- /dev/null +++ b/hackerrank/Linux/Arrays/readArray.sh @@ -0,0 +1,3 @@ +readarray cName +echo ${cName[@]} + diff --git a/hackerrank/Linux/Arrays/removeCapitalArray.sh b/hackerrank/Linux/Arrays/removeCapitalArray.sh new file mode 100644 index 0000000..af751fc --- /dev/null +++ b/hackerrank/Linux/Arrays/removeCapitalArray.sh @@ -0,0 +1,2 @@ +readarray cName +echo ${cName[@]/[A-Z]/.} diff --git a/hackerrank/Linux/Arrays/sliceArray.sh b/hackerrank/Linux/Arrays/sliceArray.sh new file mode 100644 index 0000000..ed76ba9 --- /dev/null +++ b/hackerrank/Linux/Arrays/sliceArray.sh @@ -0,0 +1,2 @@ +readarray cName +echo ${cName[@]:3:5} diff --git a/hackerrank/Linux/Bash/A Personalized Echo.sh b/hackerrank/Linux/Bash/A Personalized Echo.sh new file mode 100644 index 0000000..91ec707 --- /dev/null +++ b/hackerrank/Linux/Bash/A Personalized Echo.sh @@ -0,0 +1,3 @@ +#!/bin/bash +read name +echo "Welcome $name" \ No newline at end of file diff --git a/hackerrank/Linux/Bash/Arithmetic Operations.sh b/hackerrank/Linux/Bash/Arithmetic Operations.sh new file mode 100644 index 0000000..857a63b --- /dev/null +++ b/hackerrank/Linux/Bash/Arithmetic Operations.sh @@ -0,0 +1,2 @@ +read x +printf "%.3f\n" `echo "$x" | bc -l` \ No newline at end of file diff --git a/hackerrank/Linux/Bash/Comparing Numbers.sh b/hackerrank/Linux/Bash/Comparing Numbers.sh new file mode 100644 index 0000000..b333cdd --- /dev/null +++ b/hackerrank/Linux/Bash/Comparing Numbers.sh @@ -0,0 +1,17 @@ +#!/bin/bash +read X +read Y +if (( $X > $Y )) +then + echo "X is greater than Y" +fi + +if (( $X == $Y)) +then + echo "X is equal to Y" +fi + +if(( $X < $Y)) +then + echo "X is less than Y" +fi \ No newline at end of file diff --git a/hackerrank/Linux/Bash/Compute the average.sh b/hackerrank/Linux/Bash/Compute the average.sh new file mode 100644 index 0000000..9393bc9 --- /dev/null +++ b/hackerrank/Linux/Bash/Compute the average.sh @@ -0,0 +1,12 @@ +#!/bin/bash +#Easier way is to do using for loop +read num +ctr=$num +sum=0 +while [ $ctr -gt 0 ] +do + read x + sum=$((sum + x)) + ctr=$((ctr - 1)) +done +printf "%.3f\n" `echo "$sum/$num" | bc -l` \ No newline at end of file diff --git a/hackerrank/Linux/Bash/Getting started with conditionals.sh b/hackerrank/Linux/Bash/Getting started with conditionals.sh new file mode 100644 index 0000000..26360b7 --- /dev/null +++ b/hackerrank/Linux/Bash/Getting started with conditionals.sh @@ -0,0 +1,9 @@ +#!/bin/bash +read word +if [[($word == 'y') || ($word == 'Y')]] +then + echo "YES" + elif [[($word == 'n') || ($word == 'N')]] + then + echo "NO" +fi diff --git a/hackerrank/Linux/Bash/Let's Echo.sh b/hackerrank/Linux/Bash/Let's Echo.sh new file mode 100644 index 0000000..8c2d72c --- /dev/null +++ b/hackerrank/Linux/Bash/Let's Echo.sh @@ -0,0 +1 @@ +echo "HELLO" \ No newline at end of file diff --git a/hackerrank/Linux/Bash/Looping and Skipping.sh b/hackerrank/Linux/Bash/Looping and Skipping.sh new file mode 100644 index 0000000..3524da4 --- /dev/null +++ b/hackerrank/Linux/Bash/Looping and Skipping.sh @@ -0,0 +1,5 @@ +#!/bin/bash +for i in {1..99..2} +do + echo $i +done \ No newline at end of file diff --git a/hackerrank/Linux/Bash/Looping with Numbers.sh b/hackerrank/Linux/Bash/Looping with Numbers.sh new file mode 100644 index 0000000..32f757f --- /dev/null +++ b/hackerrank/Linux/Bash/Looping with Numbers.sh @@ -0,0 +1,5 @@ +#!/bin/bash +for i in {1..50} +do + echo $i +done \ No newline at end of file diff --git a/hackerrank/Linux/Bash/More on Conditionals.sh b/hackerrank/Linux/Bash/More on Conditionals.sh new file mode 100644 index 0000000..60f1263 --- /dev/null +++ b/hackerrank/Linux/Bash/More on Conditionals.sh @@ -0,0 +1,13 @@ +#!/bin/bash +read x +read y +read z +if ((($x == $y) && ($y == $z))) + then + echo "EQUILATERAL" +elif ((($x == $y) || ($x == $z) || ($y == $z))) + then + echo "ISOSCELES" +else + echo "SCALENE" +fi \ No newline at end of file diff --git a/hackerrank/Linux/Bash/The World of Numbers.sh b/hackerrank/Linux/Bash/The World of Numbers.sh new file mode 100644 index 0000000..24f5435 --- /dev/null +++ b/hackerrank/Linux/Bash/The World of Numbers.sh @@ -0,0 +1,7 @@ +#!/bin/bash +read X +read Y +echo $((X+Y)) +echo $((X-Y)) +echo $((X*Y)) +echo $((X/Y)) \ No newline at end of file diff --git a/hackerrank/Linux/Bash/avg.sh b/hackerrank/Linux/Bash/avg.sh new file mode 100644 index 0000000..6021f67 --- /dev/null +++ b/hackerrank/Linux/Bash/avg.sh @@ -0,0 +1,9 @@ +read n +sum=0 +for (( i=1 ; i<=$n ; i++ )) +do + read a + let "sum+=$a" + +done +printf "%.3f" $(echo $sum/$n | bc -l) \ No newline at end of file diff --git a/hackerrank/Linux/Bash/compNums.sh b/hackerrank/Linux/Bash/compNums.sh new file mode 100644 index 0000000..f436234 --- /dev/null +++ b/hackerrank/Linux/Bash/compNums.sh @@ -0,0 +1,11 @@ +read x +read y +if [ $x -gt $y ] +then + echo "X is greater than Y" +elif [ $x -lt $y ] +then + echo "X is less than Y" +else + echo "X is equal to Y" +fi \ No newline at end of file diff --git a/hackerrank/Linux/Bash/conditionals.sh b/hackerrank/Linux/Bash/conditionals.sh new file mode 100644 index 0000000..9f52118 --- /dev/null +++ b/hackerrank/Linux/Bash/conditionals.sh @@ -0,0 +1,8 @@ +read ch +if [ $ch = "Y" ] || [ $ch = "y" ] +then + echo "YES" +else + echo "NO" +fi + diff --git a/hackerrank/Linux/Bash/letsEcho.sh b/hackerrank/Linux/Bash/letsEcho.sh new file mode 100644 index 0000000..b69484a --- /dev/null +++ b/hackerrank/Linux/Bash/letsEcho.sh @@ -0,0 +1 @@ +echo HELLO diff --git a/hackerrank/Linux/Bash/loopNum.sh b/hackerrank/Linux/Bash/loopNum.sh new file mode 100644 index 0000000..1c4494f --- /dev/null +++ b/hackerrank/Linux/Bash/loopNum.sh @@ -0,0 +1,4 @@ +for i in {1..50..1} +do +echo $i +done diff --git a/hackerrank/Linux/Bash/loopSkip.sh b/hackerrank/Linux/Bash/loopSkip.sh new file mode 100644 index 0000000..db48535 --- /dev/null +++ b/hackerrank/Linux/Bash/loopSkip.sh @@ -0,0 +1,4 @@ +for i in {1..100..2} +do +echo $i +done diff --git a/hackerrank/Linux/Bash/mathExpr.sh b/hackerrank/Linux/Bash/mathExpr.sh new file mode 100644 index 0000000..98ca99b --- /dev/null +++ b/hackerrank/Linux/Bash/mathExpr.sh @@ -0,0 +1,3 @@ +read word +value=` echo "$word " | bc -l ` +echo $(printf %.3f $value) \ No newline at end of file diff --git a/hackerrank/Linux/Bash/numWorld.sh b/hackerrank/Linux/Bash/numWorld.sh new file mode 100644 index 0000000..cf3ee04 --- /dev/null +++ b/hackerrank/Linux/Bash/numWorld.sh @@ -0,0 +1,6 @@ +read a +read b +echo $a + $b | bc +echo $a - $b | bc +echo $a \* $b | bc +echo $a / $b | bc diff --git a/hackerrank/Linux/Bash/personalizedEcho.sh b/hackerrank/Linux/Bash/personalizedEcho.sh new file mode 100644 index 0000000..8a45f01 --- /dev/null +++ b/hackerrank/Linux/Bash/personalizedEcho.sh @@ -0,0 +1,2 @@ +read name +echo "Welcome $name" diff --git a/hackerrank/Linux/Bash/triangle.sh b/hackerrank/Linux/Bash/triangle.sh new file mode 100644 index 0000000..06ca993 --- /dev/null +++ b/hackerrank/Linux/Bash/triangle.sh @@ -0,0 +1,11 @@ +read x +read y +read z + +if [[ x -ne z ]] && [[ x -ne y ]] && [[ y -ne z ]]; then + echo SCALENE +elif [[ x -eq z ]] && [[ x -eq y ]] && [[ y -eq z ]]; then + echo EQUILATERAL +else + echo ISOSCELES +fi diff --git a/hackerrank/Linux/Grep-Sed-Awk/'Grep' #1.sh b/hackerrank/Linux/Grep-Sed-Awk/'Grep' #1.sh new file mode 100644 index 0000000..c0e888b --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/'Grep' #1.sh @@ -0,0 +1,3 @@ +#Output only those lines that contain the word 'the'. The search should be case sensitive. The relative ordering of the lines in the output should be the same as it was in the input. +grep -w "the" + diff --git a/hackerrank/Linux/Grep-Sed-Awk/'Grep' #2.sh b/hackerrank/Linux/Grep-Sed-Awk/'Grep' #2.sh new file mode 100644 index 0000000..db4a12c --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/'Grep' #2.sh @@ -0,0 +1,3 @@ +# Output only those lines that contain the word 'the'. The search should NOT be case sensitive. The relative ordering of the lines in the output should be the same as it was in the input. + +grep -iw "the" diff --git a/hackerrank/Linux/Grep-Sed-Awk/'Grep' #3.sh b/hackerrank/Linux/Grep-Sed-Awk/'Grep' #3.sh new file mode 100644 index 0000000..40db82d --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/'Grep' #3.sh @@ -0,0 +1,3 @@ +# Only display those lines that do NOT contain the word 'that'. The relative ordering of the lines should be the same as it was in the input file. + +grep -iv "that" diff --git a/hackerrank/Linux/Grep-Sed-Awk/'Grep' - B.sh b/hackerrank/Linux/Grep-Sed-Awk/'Grep' - B.sh new file mode 100644 index 0000000..178fad6 --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/'Grep' - B.sh @@ -0,0 +1 @@ +grep '\([0-9]\) *\1' \ No newline at end of file diff --git a/hackerrank/Linux/Grep-Sed-Awk/'Grep' -A.sh b/hackerrank/Linux/Grep-Sed-Awk/'Grep' -A.sh new file mode 100644 index 0000000..60afbec --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/'Grep' -A.sh @@ -0,0 +1,7 @@ +#We retain only those lines which have at least one of the following words: +# the +# that +# then +# those +grep -iwe "the\|that\|then\|those" + diff --git a/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #1.sh b/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #1.sh new file mode 100644 index 0000000..f9ccc7d --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #1.sh @@ -0,0 +1 @@ +sed -e 's/the /this /1' \ No newline at end of file diff --git a/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #2.sh b/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #2.sh new file mode 100644 index 0000000..da21572 --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #2.sh @@ -0,0 +1 @@ +sed -e 's/thy /your /gI' diff --git a/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #3.sh b/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #3.sh new file mode 100644 index 0000000..866f83c --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #3.sh @@ -0,0 +1 @@ +sed -e 's/thy/{&}/gI' \ No newline at end of file diff --git a/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #4.sh b/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #4.sh new file mode 100644 index 0000000..3bd2988 --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #4.sh @@ -0,0 +1 @@ +sed -r 's/[0-9]{4}[ ]/**** /g' \ No newline at end of file diff --git a/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #5.sh b/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #5.sh new file mode 100644 index 0000000..4a5be52 --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/'Sed' command #5.sh @@ -0,0 +1 @@ +sed -E 's/([0-9]{4}) ([0-9]{4}) ([0-9]{4}) ([0-9]{4})/\4 \3 \2 \1 /g' \ No newline at end of file diff --git a/hackerrank/Linux/Grep-Sed-Awk/awk1.sh b/hackerrank/Linux/Grep-Sed-Awk/awk1.sh new file mode 100644 index 0000000..2830ac7 --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/awk1.sh @@ -0,0 +1 @@ +awk '{if ($4 == "") print "Not all scores are available for",$1;}' diff --git a/hackerrank/Linux/Grep-Sed-Awk/awk2.sh b/hackerrank/Linux/Grep-Sed-Awk/awk2.sh new file mode 100644 index 0000000..ed8b2e9 --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/awk2.sh @@ -0,0 +1 @@ +awk {'if ($2>50 && $3>50 && $4>50) print $1,": Pass"; else print $1,": Fail"'} diff --git a/hackerrank/Linux/Grep-Sed-Awk/awk3.sh b/hackerrank/Linux/Grep-Sed-Awk/awk3.sh new file mode 100644 index 0000000..f071225 --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/awk3.sh @@ -0,0 +1,10 @@ +awk {' +avg=($2+$3+$4)/3; +printf "%c %d %d %d : ", $1,$2,$3,$4; +if (avg<50) +print "FAIL"; +else if (avg<80) +print "B"; +else +print "A"; +'} diff --git a/hackerrank/Linux/Grep-Sed-Awk/awk4.sh b/hackerrank/Linux/Grep-Sed-Awk/awk4.sh new file mode 100644 index 0000000..360f640 --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/awk4.sh @@ -0,0 +1,3 @@ +awk '{ +printf (NR%2==0) ? $0 "\n" : $0";" +}' diff --git a/hackerrank/Linux/Grep-Sed-Awk/grep1.sh b/hackerrank/Linux/Grep-Sed-Awk/grep1.sh new file mode 100644 index 0000000..549f88e --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/grep1.sh @@ -0,0 +1 @@ +grep -w 'the' diff --git a/hackerrank/Linux/Grep-Sed-Awk/grep2.sh b/hackerrank/Linux/Grep-Sed-Awk/grep2.sh new file mode 100644 index 0000000..9a04864 --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/grep2.sh @@ -0,0 +1 @@ +grep -iw 'the' diff --git a/hackerrank/Linux/Grep-Sed-Awk/grep3.sh b/hackerrank/Linux/Grep-Sed-Awk/grep3.sh new file mode 100644 index 0000000..d33041a --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/grep3.sh @@ -0,0 +1 @@ +grep -vwi 'that' diff --git a/hackerrank/Linux/Grep-Sed-Awk/grepA.sh b/hackerrank/Linux/Grep-Sed-Awk/grepA.sh new file mode 100644 index 0000000..9675a08 --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/grepA.sh @@ -0,0 +1 @@ +grep -wi 'the\|that\|then\|those' diff --git a/hackerrank/Linux/Grep-Sed-Awk/grepB.sh b/hackerrank/Linux/Grep-Sed-Awk/grepB.sh new file mode 100644 index 0000000..64f29ff --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/grepB.sh @@ -0,0 +1 @@ +grep '\([0-9]\) *\1' diff --git a/hackerrank/Linux/Grep-Sed-Awk/sed1.sh b/hackerrank/Linux/Grep-Sed-Awk/sed1.sh new file mode 100644 index 0000000..8bc91a1 --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/sed1.sh @@ -0,0 +1 @@ +sed 's/\bthe\b/this/' diff --git a/hackerrank/Linux/Grep-Sed-Awk/sed2.sh b/hackerrank/Linux/Grep-Sed-Awk/sed2.sh new file mode 100644 index 0000000..31be89a --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/sed2.sh @@ -0,0 +1 @@ +sed 's/thy/your/ig' diff --git a/hackerrank/Linux/Grep-Sed-Awk/sed3.sh b/hackerrank/Linux/Grep-Sed-Awk/sed3.sh new file mode 100644 index 0000000..9afe84c --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/sed3.sh @@ -0,0 +1 @@ +sed 's/thy/{&}/ig' diff --git a/hackerrank/Linux/Grep-Sed-Awk/sed4.sh b/hackerrank/Linux/Grep-Sed-Awk/sed4.sh new file mode 100644 index 0000000..5763399 --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/sed4.sh @@ -0,0 +1 @@ +sed 's/[0-9]\+ /**** /g' diff --git a/hackerrank/Linux/Grep-Sed-Awk/sed5.sh b/hackerrank/Linux/Grep-Sed-Awk/sed5.sh new file mode 100644 index 0000000..288e6b1 --- /dev/null +++ b/hackerrank/Linux/Grep-Sed-Awk/sed5.sh @@ -0,0 +1 @@ +sed -r 's/(.+ )(.+ )(.+ )(....)/\4 \3\2\1/' diff --git a/hackerrank/Linux/Text-Processing/'Tr' Command #1.sh b/hackerrank/Linux/Text-Processing/'Tr' Command #1.sh new file mode 100644 index 0000000..938fcd2 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/'Tr' Command #1.sh @@ -0,0 +1,2 @@ +#Output the text with all parentheses () replaced with box brackets []. +tr "()" "[]" diff --git a/hackerrank/Linux/Text-Processing/'Tr' Command #2.sh b/hackerrank/Linux/Text-Processing/'Tr' Command #2.sh new file mode 100644 index 0000000..d130146 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/'Tr' Command #2.sh @@ -0,0 +1,2 @@ +#In a given fragment of text, delete all the lowercase characters a - z. +tr -d "a-z" \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/'Tr' Command #3.sh b/hackerrank/Linux/Text-Processing/'Tr' Command #3.sh new file mode 100644 index 0000000..f3073a1 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/'Tr' Command #3.sh @@ -0,0 +1,2 @@ +#Replace all sequences of multiple spaces with just one space. +tr -s ' ' diff --git a/hackerrank/Linux/Text-Processing/'Uniq' Command #1.sh b/hackerrank/Linux/Text-Processing/'Uniq' Command #1.sh new file mode 100644 index 0000000..9c63057 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/'Uniq' Command #1.sh @@ -0,0 +1,2 @@ +#Given a text file, remove the consecutive repetitions of any line. +uniq \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/'Uniq' Command #2.sh b/hackerrank/Linux/Text-Processing/'Uniq' Command #2.sh new file mode 100644 index 0000000..6f52abf --- /dev/null +++ b/hackerrank/Linux/Text-Processing/'Uniq' Command #2.sh @@ -0,0 +1,2 @@ +#Given a text file, count the number of times each line repeats itself. Only consider consecutive repetitions. Display the space separated count and line, respectively. There shouldn't be any leading or trailing spaces. Please note that the uniq -c command by itself will generate the output in a different format than the one expected here. +uniq -c | cut -c7- \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/'Uniq' Command #3.sh b/hackerrank/Linux/Text-Processing/'Uniq' Command #3.sh new file mode 100644 index 0000000..23539b1 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/'Uniq' Command #3.sh @@ -0,0 +1,2 @@ +#compare consecutive lines in a case insensitive manner. So, if a line X is followed by case variants, the output should count all of them as the same (but display only the form X in the second column). +uniq -i -c | cut -c7- \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/'Uniq' Command #4.sh b/hackerrank/Linux/Text-Processing/'Uniq' Command #4.sh new file mode 100644 index 0000000..0dd2c80 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/'Uniq' Command #4.sh @@ -0,0 +1,2 @@ +#Given a text file, display only those lines which are not followed or preceded by identical replications. +uniq -u \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Cut #1.sh b/hackerrank/Linux/Text-Processing/Cut #1.sh new file mode 100644 index 0000000..40b16bf --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Cut #1.sh @@ -0,0 +1,2 @@ +# print the 3rd character from each line as a new line of output. +cut -c 3 \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Cut #2.sh b/hackerrank/Linux/Text-Processing/Cut #2.sh new file mode 100644 index 0000000..26c0cd0 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Cut #2.sh @@ -0,0 +1,3 @@ +#Display the 2nd and 7th character from each line of text. + +cut -c 2,7 \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Cut #3.sh b/hackerrank/Linux/Text-Processing/Cut #3.sh new file mode 100644 index 0000000..1f13ce8 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Cut #3.sh @@ -0,0 +1,2 @@ +# Display a range of characters starting at the 2nd position of a string and ending at the 7th position (both positions included) +cut -c 2-7 \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Cut #4 .sh b/hackerrank/Linux/Text-Processing/Cut #4 .sh new file mode 100644 index 0000000..aea7e59 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Cut #4 .sh @@ -0,0 +1,3 @@ +#Display the first four characters from each line of text. +cut -c -4 + diff --git a/hackerrank/Linux/Text-Processing/Cut #5.sh b/hackerrank/Linux/Text-Processing/Cut #5.sh new file mode 100644 index 0000000..5b587f2 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Cut #5.sh @@ -0,0 +1,2 @@ +#Given a tab delimited file with several columns (tsv format) print the first three fields. +cut -f 1-3 \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Cut #6.sh b/hackerrank/Linux/Text-Processing/Cut #6.sh new file mode 100644 index 0000000..01fad61 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Cut #6.sh @@ -0,0 +1,2 @@ +#Print the characters from thirteenth position to the end. +cut -c 13- \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Cut #7.sh b/hackerrank/Linux/Text-Processing/Cut #7.sh new file mode 100644 index 0000000..4d33198 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Cut #7.sh @@ -0,0 +1,2 @@ +# For each input sentence, identify and display its fourth word. Assume that the space (' ') is the only delimiter between words. +cut -d " " -f 4 \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Cut #8.sh b/hackerrank/Linux/Text-Processing/Cut #8.sh new file mode 100644 index 0000000..21c3746 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Cut #8.sh @@ -0,0 +1,3 @@ +#The output should contain N lines. For each input sentence, identify and display its first three words. Assume that the space (' ') is the only delimiter between words. +cut -d " " -f 1-3 + diff --git a/hackerrank/Linux/Text-Processing/Cut #9.sh b/hackerrank/Linux/Text-Processing/Cut #9.sh new file mode 100644 index 0000000..0b68821 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Cut #9.sh @@ -0,0 +1,3 @@ +#For each line in the input, print the fields from second fields to last field. +cut -f 2- + diff --git a/hackerrank/Linux/Text-Processing/Head of a Text File #1.sh b/hackerrank/Linux/Text-Processing/Head of a Text File #1.sh new file mode 100644 index 0000000..43cb14d --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Head of a Text File #1.sh @@ -0,0 +1,3 @@ +#Output the first 20 lines of the given text file. +head -20 + diff --git a/hackerrank/Linux/Text-Processing/Head of a Text File #2.sh b/hackerrank/Linux/Text-Processing/Head of a Text File #2.sh new file mode 100644 index 0000000..1e089d1 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Head of a Text File #2.sh @@ -0,0 +1,3 @@ +#Output the first 20 characters of the text file +head -c 20 + diff --git a/hackerrank/Linux/Text-Processing/Middle of a Text File.sh b/hackerrank/Linux/Text-Processing/Middle of a Text File.sh new file mode 100644 index 0000000..82677c0 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Middle of a Text File.sh @@ -0,0 +1,2 @@ +#Display the lines (from line number 12 to 22, both inclusive) for the input file. +head -22 | tail -11 \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Paste - 1.sh b/hackerrank/Linux/Text-Processing/Paste - 1.sh new file mode 100644 index 0000000..3539a85 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Paste - 1.sh @@ -0,0 +1,2 @@ +# Replace the newlines in the input file with semicolons +paste -d";" -s \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Paste - 2.sh b/hackerrank/Linux/Text-Processing/Paste - 2.sh new file mode 100644 index 0000000..be8f494 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Paste - 2.sh @@ -0,0 +1,2 @@ +#Restructure the file so that three consecutive rows are folded into one line and are separated by semicolons. +paste -d ";" - - - \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Paste - 3.sh b/hackerrank/Linux/Text-Processing/Paste - 3.sh new file mode 100644 index 0000000..31dcc4b --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Paste - 3.sh @@ -0,0 +1,4 @@ +# The delimiter between consecutive rows of data has been transformed from the newline to a tab. +# Previous solution: paste -s -d"\\t" +# The delimiter option is not necessary as tab is the delimiter of paste by default +paste -s \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Paste - 4.sh b/hackerrank/Linux/Text-Processing/Paste - 4.sh new file mode 100644 index 0000000..bb0a349 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Paste - 4.sh @@ -0,0 +1,2 @@ +# Restructure the file in such a way, that every group of three consecutive rows are folded into one, and separated by tab. +paste - - - \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Sort Command #1.sh b/hackerrank/Linux/Text-Processing/Sort Command #1.sh new file mode 100644 index 0000000..ebdfb07 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Sort Command #1.sh @@ -0,0 +1,2 @@ +#Output the text file with the lines reordered in lexicographical order. +sort \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Sort Command #2.sh b/hackerrank/Linux/Text-Processing/Sort Command #2.sh new file mode 100644 index 0000000..ec317b4 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Sort Command #2.sh @@ -0,0 +1,2 @@ +#Output the text file with the lines reordered in reverse lexicographical order. +sort -r \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Sort Command #3.sh b/hackerrank/Linux/Text-Processing/Sort Command #3.sh new file mode 100644 index 0000000..11f6346 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Sort Command #3.sh @@ -0,0 +1,2 @@ +#Output the text file with the lines reordered in numerically ascending order. +sort -n \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Sort Command #4.sh b/hackerrank/Linux/Text-Processing/Sort Command #4.sh new file mode 100644 index 0000000..235022c --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Sort Command #4.sh @@ -0,0 +1,3 @@ +#The text file, with lines re-ordered in descending order (numerically). +sort -n -r + diff --git a/hackerrank/Linux/Text-Processing/Sort Command #5.sh b/hackerrank/Linux/Text-Processing/Sort Command #5.sh new file mode 100644 index 0000000..36b4e60 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Sort Command #5.sh @@ -0,0 +1,2 @@ +#Rearrange the rows of the table in descending order of the values for the average temperature in January (i.e, the mean temperature value provided in the second column) in a tab seperated file. +sort -k2 -n -r -t$'\t' \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Sort command #6.sh b/hackerrank/Linux/Text-Processing/Sort command #6.sh new file mode 100644 index 0000000..d5d19c7 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Sort command #6.sh @@ -0,0 +1,3 @@ +#The data has been sorted in ascending order of the average monthly temperature in January (i.e, the second column) in a tsv file +sort -n -k2 -t$'\t' + diff --git a/hackerrank/Linux/Text-Processing/Sort command #7.sh b/hackerrank/Linux/Text-Processing/Sort command #7.sh new file mode 100644 index 0000000..189c39d --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Sort command #7.sh @@ -0,0 +1,3 @@ +#The data has been sorted in descending order of the average monthly temperature in January (i.e, the second column). +sort -k2 -n -r -t '|' + diff --git a/hackerrank/Linux/Text-Processing/Tail of a Text File #1.sh b/hackerrank/Linux/Text-Processing/Tail of a Text File #1.sh new file mode 100644 index 0000000..f31ba2a --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Tail of a Text File #1.sh @@ -0,0 +1,2 @@ +#Output the last 20 lines of the text file. +tail -20 \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/Tail of a Text File #2.sh b/hackerrank/Linux/Text-Processing/Tail of a Text File #2.sh new file mode 100644 index 0000000..b2641fa --- /dev/null +++ b/hackerrank/Linux/Text-Processing/Tail of a Text File #2.sh @@ -0,0 +1,2 @@ +#Display the last 20 characters of an input file. +tail -c 20 \ No newline at end of file diff --git a/hackerrank/Linux/Text-Processing/cut1.sh b/hackerrank/Linux/Text-Processing/cut1.sh new file mode 100644 index 0000000..b7ad343 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/cut1.sh @@ -0,0 +1,4 @@ +while read x +do +echo $x | cut -c3 - +done diff --git a/hackerrank/Linux/Text-Processing/cut2.sh b/hackerrank/Linux/Text-Processing/cut2.sh new file mode 100644 index 0000000..f3ba325 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/cut2.sh @@ -0,0 +1,5 @@ +while read x +do +echo $x | cut -c2,7 +done + diff --git a/hackerrank/Linux/Text-Processing/cut3.sh b/hackerrank/Linux/Text-Processing/cut3.sh new file mode 100644 index 0000000..0956ecd --- /dev/null +++ b/hackerrank/Linux/Text-Processing/cut3.sh @@ -0,0 +1,4 @@ +while read x +do +echo $x | cut -b 2-7 +done diff --git a/hackerrank/Linux/Text-Processing/cut4.sh b/hackerrank/Linux/Text-Processing/cut4.sh new file mode 100644 index 0000000..2656b02 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/cut4.sh @@ -0,0 +1,5 @@ +while read x +do +echo $x | cut -b 1-4 +done + diff --git a/hackerrank/Linux/Text-Processing/cut5.sh b/hackerrank/Linux/Text-Processing/cut5.sh new file mode 100644 index 0000000..b437178 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/cut5.sh @@ -0,0 +1,2 @@ +cut -f 1-3 + diff --git a/hackerrank/Linux/Text-Processing/cut6.sh b/hackerrank/Linux/Text-Processing/cut6.sh new file mode 100644 index 0000000..a6c997f --- /dev/null +++ b/hackerrank/Linux/Text-Processing/cut6.sh @@ -0,0 +1 @@ +cut -b 13- diff --git a/hackerrank/Linux/Text-Processing/cut7.sh b/hackerrank/Linux/Text-Processing/cut7.sh new file mode 100644 index 0000000..fb20a6a --- /dev/null +++ b/hackerrank/Linux/Text-Processing/cut7.sh @@ -0,0 +1 @@ +cut -d " " -f 4 diff --git a/hackerrank/Linux/Text-Processing/cut8.sh b/hackerrank/Linux/Text-Processing/cut8.sh new file mode 100644 index 0000000..1aba606 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/cut8.sh @@ -0,0 +1 @@ +cut -d " " -f 1-3 diff --git a/hackerrank/Linux/Text-Processing/cut9.sh b/hackerrank/Linux/Text-Processing/cut9.sh new file mode 100644 index 0000000..b620340 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/cut9.sh @@ -0,0 +1 @@ +cut -f2- diff --git a/hackerrank/Linux/Text-Processing/head1.sh b/hackerrank/Linux/Text-Processing/head1.sh new file mode 100644 index 0000000..25a7b9b --- /dev/null +++ b/hackerrank/Linux/Text-Processing/head1.sh @@ -0,0 +1 @@ +head -n 20 diff --git a/hackerrank/Linux/Text-Processing/head2.sh b/hackerrank/Linux/Text-Processing/head2.sh new file mode 100644 index 0000000..6a5bc05 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/head2.sh @@ -0,0 +1 @@ +head -c 20 diff --git a/hackerrank/Linux/Text-Processing/middle.sh b/hackerrank/Linux/Text-Processing/middle.sh new file mode 100644 index 0000000..783a46b --- /dev/null +++ b/hackerrank/Linux/Text-Processing/middle.sh @@ -0,0 +1 @@ +head -n 22 | tail -n 11 diff --git a/hackerrank/Linux/Text-Processing/paste1.sh b/hackerrank/Linux/Text-Processing/paste1.sh new file mode 100644 index 0000000..4c5ce83 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/paste1.sh @@ -0,0 +1 @@ +paste -sd ';' diff --git a/hackerrank/Linux/Text-Processing/paste2.sh b/hackerrank/Linux/Text-Processing/paste2.sh new file mode 100644 index 0000000..236866c --- /dev/null +++ b/hackerrank/Linux/Text-Processing/paste2.sh @@ -0,0 +1 @@ +paste - - - -d ';' diff --git a/hackerrank/Linux/Text-Processing/paste3.sh b/hackerrank/Linux/Text-Processing/paste3.sh new file mode 100644 index 0000000..bc97006 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/paste3.sh @@ -0,0 +1 @@ +paste -s diff --git a/hackerrank/Linux/Text-Processing/paste4.sh b/hackerrank/Linux/Text-Processing/paste4.sh new file mode 100644 index 0000000..f29d929 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/paste4.sh @@ -0,0 +1 @@ +paste - - - diff --git a/hackerrank/Linux/Text-Processing/sort1.sh b/hackerrank/Linux/Text-Processing/sort1.sh new file mode 100644 index 0000000..ff6c75e --- /dev/null +++ b/hackerrank/Linux/Text-Processing/sort1.sh @@ -0,0 +1 @@ +sort diff --git a/hackerrank/Linux/Text-Processing/sort2.sh b/hackerrank/Linux/Text-Processing/sort2.sh new file mode 100644 index 0000000..18bb5cd --- /dev/null +++ b/hackerrank/Linux/Text-Processing/sort2.sh @@ -0,0 +1 @@ +sort -r diff --git a/hackerrank/Linux/Text-Processing/sort3.sh b/hackerrank/Linux/Text-Processing/sort3.sh new file mode 100644 index 0000000..d7c46e0 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/sort3.sh @@ -0,0 +1 @@ +sort -n diff --git a/hackerrank/Linux/Text-Processing/sort4.sh b/hackerrank/Linux/Text-Processing/sort4.sh new file mode 100644 index 0000000..a7d48be --- /dev/null +++ b/hackerrank/Linux/Text-Processing/sort4.sh @@ -0,0 +1 @@ +sort -n -r diff --git a/hackerrank/Linux/Text-Processing/sort5.sh b/hackerrank/Linux/Text-Processing/sort5.sh new file mode 100644 index 0000000..4a234ff --- /dev/null +++ b/hackerrank/Linux/Text-Processing/sort5.sh @@ -0,0 +1 @@ +sort -t$'\t' -k2 -rn diff --git a/hackerrank/Linux/Text-Processing/sort6.sh b/hackerrank/Linux/Text-Processing/sort6.sh new file mode 100644 index 0000000..728cbb9 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/sort6.sh @@ -0,0 +1 @@ +sort -t$'\t' -k2 -n diff --git a/hackerrank/Linux/Text-Processing/sort7.sh b/hackerrank/Linux/Text-Processing/sort7.sh new file mode 100644 index 0000000..a2c05d9 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/sort7.sh @@ -0,0 +1 @@ +sort -t '|' -k2 -rn diff --git a/hackerrank/Linux/Text-Processing/tail1.sh b/hackerrank/Linux/Text-Processing/tail1.sh new file mode 100644 index 0000000..5e17561 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/tail1.sh @@ -0,0 +1 @@ +tail -n 20 diff --git a/hackerrank/Linux/Text-Processing/tail2.sh b/hackerrank/Linux/Text-Processing/tail2.sh new file mode 100644 index 0000000..99e56cc --- /dev/null +++ b/hackerrank/Linux/Text-Processing/tail2.sh @@ -0,0 +1 @@ +tail -c 20 diff --git a/hackerrank/Linux/Text-Processing/tr1.sh b/hackerrank/Linux/Text-Processing/tr1.sh new file mode 100644 index 0000000..30daeed --- /dev/null +++ b/hackerrank/Linux/Text-Processing/tr1.sh @@ -0,0 +1 @@ +tr '()' '[]' diff --git a/hackerrank/Linux/Text-Processing/tr2.sh b/hackerrank/Linux/Text-Processing/tr2.sh new file mode 100644 index 0000000..622716d --- /dev/null +++ b/hackerrank/Linux/Text-Processing/tr2.sh @@ -0,0 +1 @@ +tr -d 'a-z' diff --git a/hackerrank/Linux/Text-Processing/tr3.sh b/hackerrank/Linux/Text-Processing/tr3.sh new file mode 100644 index 0000000..34dffe7 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/tr3.sh @@ -0,0 +1 @@ +tr -s ' ' diff --git a/hackerrank/Linux/Text-Processing/uniq1.sh b/hackerrank/Linux/Text-Processing/uniq1.sh new file mode 100644 index 0000000..4531133 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/uniq1.sh @@ -0,0 +1 @@ +uniq diff --git a/hackerrank/Linux/Text-Processing/uniq2.sh b/hackerrank/Linux/Text-Processing/uniq2.sh new file mode 100644 index 0000000..87f35fd --- /dev/null +++ b/hackerrank/Linux/Text-Processing/uniq2.sh @@ -0,0 +1 @@ +uniq -c | cut -b7- diff --git a/hackerrank/Linux/Text-Processing/uniq3.sh b/hackerrank/Linux/Text-Processing/uniq3.sh new file mode 100644 index 0000000..f8babc6 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/uniq3.sh @@ -0,0 +1 @@ +uniq -i -c | tr -s ' ' | cut -b 2- diff --git a/hackerrank/Linux/Text-Processing/uniq4.sh b/hackerrank/Linux/Text-Processing/uniq4.sh new file mode 100644 index 0000000..522bf45 --- /dev/null +++ b/hackerrank/Linux/Text-Processing/uniq4.sh @@ -0,0 +1 @@ +uniq -u diff --git a/hackerrank/Project Euler/#1_CPP b/hackerrank/Project Euler/#1_CPP deleted file mode 100644 index 82b8404..0000000 --- a/hackerrank/Project Euler/#1_CPP +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; - - -int main(){ - long int t; - cin >> t; - for(int a0 = 0; a0 < t; a0++){ - long int n; - cin >> n; - long long int sum = 0; - long int n1 = 0,n2 = 0,n3 = 0; - n1 = (n - 1)/3; - sum += 3 * n1 * (n1 + 1)/2; - n2 = (n - 1)/5; - sum += 5 * n2 * (n2 + 1)/2; - n3 = (n - 1)/15; - sum -= 15 * n3 * (n3 + 1)/2; - cout << sum << '\n'; - } - return 0; -} - diff --git a/hackerrank/ProjectEuler/Solpy/.vscode/settings.json b/hackerrank/ProjectEuler/Solpy/.vscode/settings.json new file mode 100644 index 0000000..1507357 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "functional": "cpp" + } +} \ No newline at end of file diff --git a/hackerrank/ProjectEuler/Solpy/03_largest_prime.py b/hackerrank/ProjectEuler/Solpy/03_largest_prime.py new file mode 100644 index 0000000..a658aea --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/03_largest_prime.py @@ -0,0 +1,36 @@ +#!/usr/bin/python3 +#import ipdb +#import helper + +def isPrime(x): + x=int(x) + if x<2: + return False + for i in range(2,int(x**.5)+1): + if x%i ==0 : + return False + return True + +def factors(x): + x=int(x) + fact=1 + for i in range(1,int(x**.5)+1): + if x%i==0: + f=int(x/i) + if isPrime(i) and fact99 ): + return True + return False + +def nextPalandrom(x): + x_int=int(x) + x_new=x_int-1 + while(True): + if str(x_new)[::-1]==str(x_new): + return str(x_new) + else: + x_new-=1 + + + +n=int(input()) +testdata=[] +for i in range(n): + testdata.append(input()) + +for i in range(n): + if isPaliandrome(testdata[i]) and isMultiple(testdata[i]): + print(testdata[i]) + else: + x_new=nextPalandrom(testdata[i]) + while(True): + if isMultiple(x_new): + print(x_new) + break + else: + x_new=nextPalandrom(x_new) + + diff --git a/hackerrank/ProjectEuler/Solpy/06_sumdiff.py b/hackerrank/ProjectEuler/Solpy/06_sumdiff.py new file mode 100644 index 0000000..0b0c99e --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/06_sumdiff.py @@ -0,0 +1,9 @@ +#!/usr/bin/python3 + + +m=int(input()) +for k in range(m): + n=int(input()) + sq=int((n*(n+1)*(2*n+1)/6)) + su=int(n*(n+1)/2)**2 + print(su-sq) diff --git a/hackerrank/ProjectEuler/Solpy/07_nth_prime.py b/hackerrank/ProjectEuler/Solpy/07_nth_prime.py new file mode 100644 index 0000000..1aeb86a --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/07_nth_prime.py @@ -0,0 +1,21 @@ +def isPrime(x): + x = int(x) + for i in range(2, int(x**.5)+1): + if x % i == 0: + return False + return True + + +n = int(input()) +data = {} +data[1] = 2 +num = 2 +for i in range(1, 10001): + while(not isPrime(num)): + num += 1 + data[i] = num + num += 1 +for k in range(n): + testdata = input() + i = int(testdata) + print(data[i]) diff --git a/hackerrank/ProjectEuler/Solpy/08_large_pdt.py b/hackerrank/ProjectEuler/Solpy/08_large_pdt.py new file mode 100644 index 0000000..871af59 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/08_large_pdt.py @@ -0,0 +1,14 @@ +n = int(input()) +for i in range(n): + pdt = 0 + N, K = input().split() + K_int = int(K) + N_int = int(N) + Num = input() + for p in range(N_int-K_int): + val = 1 + for w in range(K_int): + val *= int(Num[p+w]) + if val > pdt: + pdt = val + print(pdt) diff --git a/hackerrank/ProjectEuler/Solpy/09_pythgore_triplet.py b/hackerrank/ProjectEuler/Solpy/09_pythgore_triplet.py new file mode 100644 index 0000000..09ff4ce --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/09_pythgore_triplet.py @@ -0,0 +1,17 @@ +n=int(input()) + +for i in range(n): + #N=int(testdata[i]) + N=int(input()) + result=-1 + for c in range(1,int(N/2)): + for b in range(int((N-c)/2),N-c): + a=N-b-c + if a>b or a<0: + continue + elif (a*a+b*b==c*c): + result=max(a*b*c,result) + print(result) + + + diff --git a/hackerrank/ProjectEuler/Solpy/10_nth_prime_sum.py b/hackerrank/ProjectEuler/Solpy/10_nth_prime_sum.py new file mode 100644 index 0000000..5f45e3e --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/10_nth_prime_sum.py @@ -0,0 +1,3 @@ +for i in range(int(input())): + primelist = lambda n : [x for x in range(2, n+1) if not 0 in [x % z for z in range(2, int(x**0.5+1))]] + print(primelist(int(input()))) \ No newline at end of file diff --git a/hackerrank/ProjectEuler/Solpy/11_matrix.py b/hackerrank/ProjectEuler/Solpy/11_matrix.py new file mode 100644 index 0000000..ab878b2 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/11_matrix.py @@ -0,0 +1,31 @@ +data = [] +for i in range(20): + data.append(input().split()) +ans = 0 +for r in range(len(data)): + i = 0 + while ((i+3) < len(data[0])): + pdt = int(data[r][i])*int(data[r][i+1]) * \ + int(data[r][i+2])*int(data[r][i+3]) + if pdt > ans: + ans = pdt + if (r+3) < len(data): + pdt = int(data[r][i])*int(data[r+1][i+1]) * \ + int(data[r+2][i+2])*int(data[r+3][i+3]) + if pdt > ans: + ans = pdt + if (r-3) > -1: + pdt = int(data[r][i])*int(data[r-1][i+1]) * \ + int(data[r-2][i+2])*int(data[r-3][i+3]) + if pdt > ans: + ans = pdt + i += 1 +for c in range(len(data[0])): + i = 0 + while ((i+3) < len(data)): + pdt = int(data[i][c])*int(data[i+1][c]) * \ + int(data[i+2][c])*int(data[i+3][c]) + if pdt > ans: + ans = pdt + i += 1 +print(ans) diff --git a/hackerrank/ProjectEuler/Solpy/12_sum_factor.py b/hackerrank/ProjectEuler/Solpy/12_sum_factor.py new file mode 100644 index 0000000..d596f96 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/12_sum_factor.py @@ -0,0 +1,36 @@ +count_dict = [ + (1, 1), + (2, 2), + (4, 3), + (6, 7), + (9, 8), + (16, 15), + (18, 24), + (20, 32), + (24, 35), + (36, 63), + (40, 80), + (48, 104), + (90, 224), + (112, 384), + (128, 560), + (144, 935), + (162, 1224), + (168, 1664), + (192, 1728), + (240, 2015), + (320, 2079), + (480, 5984), + (576, 12375), + (648, 14399), + (768, 21735), + (1024, 41040)] + + +for i in range(int(input())): + N = int(input()) + for tup in count_dict: + x, t = tup + if x > N: + print(int((t*(t+1))/2)) + break diff --git a/hackerrank/ProjectEuler/Solpy/13_large_sum.py b/hackerrank/ProjectEuler/Solpy/13_large_sum.py new file mode 100644 index 0000000..53d279a --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/13_large_sum.py @@ -0,0 +1,4 @@ +ans=0 +for i in range(int(input())): + ans+=int(input()) +print(str(ans)[0:10]) diff --git a/hackerrank/ProjectEuler/Solpy/14_longest_sequence.py b/hackerrank/ProjectEuler/Solpy/14_longest_sequence.py new file mode 100644 index 0000000..d551b29 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/14_longest_sequence.py @@ -0,0 +1,10 @@ +ans_ar = [2, 3, 6, 7, 9, 18, 19, 25, 27, 54, 55, 73, 97, 129, 171, 231, 235, 313, 327, 649, 654, 655, 667, 703, 871, 1161, 2223, 2322, 2323, 2463, 2919, 3711, 6171, 10971, 13255, 17647, 17673, 23529, + 26623, 34239, 35497, 35655, 52527, 77031, 106239, 142587, 156159, 216367, 230631, 410011, 511935, 626331, 837799, 1117065, 1126015, 1501353, 1564063, 1723519, 2298025, 3064033, 3542887, 3732423] +for i in range(int(input())): + N = int(input()) + for x in ans_ar: + if x <= N: + ans = x + else: + break + print(ans) diff --git a/hackerrank/ProjectEuler/Solpy/15_grid_path.py b/hackerrank/ProjectEuler/Solpy/15_grid_path.py new file mode 100644 index 0000000..20d7bc8 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/15_grid_path.py @@ -0,0 +1,3 @@ +from math import factorial as f +def p(n,m) : return f(n+m) // ( f(n) * f(m) ) +for _ in range(int(input())) : print(p(*map(int, input().split()))%1000000007) \ No newline at end of file diff --git a/hackerrank/ProjectEuler/Solpy/16_sum_digit.py b/hackerrank/ProjectEuler/Solpy/16_sum_digit.py new file mode 100644 index 0000000..ee5079d --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/16_sum_digit.py @@ -0,0 +1,6 @@ +for _ in range(int(input())): + st=str(2**(int(input()))) + s=0 + for j in range(len(st)): + s+=int(st[j]) + print(s) diff --git a/hackerrank/ProjectEuler/Solpy/17_count_num.py b/hackerrank/ProjectEuler/Solpy/17_count_num.py new file mode 100644 index 0000000..db0404a --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/17_count_num.py @@ -0,0 +1,104 @@ +num={} +ten={} +num['0'] ='' +num['1'] ='One' +num['2'] ='Two' +num['3'] ='Three' +num['4'] ='Four' +num['5'] ='Five' +num['6'] ='Six' +num['7'] ='Seven' +num['8'] ='Eight' +num['9'] ='Nine' +num['10'] ='Ten' +num['11'] ='Eleven' +num['12'] ='Twelve' +num['13'] ='Thirteen' +num['14'] ='Fourteen' +num['15'] ='Fifteen' +num['16'] ='Sixteen' +num['17'] ='Seventeen' +num['18'] ='Eighteen' +num['19'] ='Eineteen' +ten['2'] ='Twenty' +ten['3'] ='Thirty' +ten['4'] ='Forty' +ten['5'] ='Fifty' +ten['6'] ='Sixty' +ten['7'] ='Seventy' +ten['8'] ='Eighty' +ten['9'] ='Ninety' + +for i in range(int(input())): + N=input() + ans='' + l=len(N) + if l<2: + if N=='0': + print("Zero") + else: + print(num[N]) + else: + + if int(N[-2])<2: + ans=num[str(int(N[-2:]))]+" "+ans + else: + ans=ten[N[-2]]+" "+num[N[-1]]+" "+ans + if l>2: + if int(N[-3])>0: + ans=num[N[-3]]+" Hundred "+ans + if l>3: + if int(N[-4])>0: + ans="Thousand "+ans + if l==4: + ans=num[N[-4]]+" "+ans + if l>4: + if N[-4]=='0' and int(N[-5])>0: + ans="Thousand "+ans + if int(N[-5])<2: + ans=num[str(int(N[-5:-3]))]+" "+ans + else: + ans=ten[N[-5]]+" "+num[N[-4]]+" "+ans + if l>5: + if N[-4]=='0' and N[-5]=='0' and int(N[-6])>0: + ans="Thousand "+ans + if int(N[-6])>0: + ans=num[N[-6]]+" Hundred "+ans + if l>6: + if int(N[-7])>0: + ans="Million "+ans + if l==7: + ans=num[N[-7]]+" "+ans + if l>7: + if N[-7]=='0' and int(N[-8])>0: + ans="Million "+ans + if int(N[-8])<2: + ans=num[str(int(N[-8:-6]))]+" "+ans + else: + ans=ten[N[-8]]+" "+num[N[-7]]+" "+ans + if l>8: + if N[-7]=='0' and N[-8]=='0' and int(N[-9])>0: + ans="Thousand "+ans + if int(N[-9])>0: + ans=num[N[-9]]+" Hundred "+ans + if l>9: + if int(N[-10])>0: + ans="Billion "+ans + if l==10: + ans=num[N[-10]]+" "+ans + if l>10: + if N[-10]=='0' and int(N[-11])>0: + ans="Billion "+ans + if int(N[-11])<2: + ans=num[str(int(N[-11:-9]))]+" "+ans + else: + ans=ten[N[-11]]+" "+num[N[-10]]+" "+ans + if l>11: + if N[-11]=='0' and N[-10]=='0': + ans="Billion "+ans + if int(N[-12])>0: + ans=num[N[-12]]+" Hundred "+ans + + ans_ar=ans.split() + print(" ".join(ans_ar)) + diff --git a/hackerrank/ProjectEuler/Solpy/18and67_max_path_sum.py b/hackerrank/ProjectEuler/Solpy/18and67_max_path_sum.py new file mode 100644 index 0000000..edbd8f3 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/18and67_max_path_sum.py @@ -0,0 +1,12 @@ +for _ in range(int(input())): + n = int(input()) + s = [] + for i in range(n): + s.append(list(map(int, input().split()))) + + row = n-2 + while row >= 0: + for i in range(len(s[row])): + s[row][i] += max(s[row+1][i], s[row+1][i+1]) + row -= 1 + print(s[0][0]) \ No newline at end of file diff --git a/hackerrank/ProjectEuler/Solpy/19_count_sunday.py b/hackerrank/ProjectEuler/Solpy/19_count_sunday.py new file mode 100644 index 0000000..55912d0 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/19_count_sunday.py @@ -0,0 +1,64 @@ +_days_in_month=[31,28,31,30,31,30,31,31,30,31,30,31] + +def is_leap(year): + return (year %4 ==0 and year %100 !=0) or (year % 400 ==0) + +def days_in_month(month,year): + if month==1: + return _days_in_month[1]+(1 if is_leap(year) else 0) + else: + return _days_in_month[month] + +def days_from_2000_to_2400(): + day=5 + num_sunday=0 + for year in range(2000,2400): + day=(day+days_in_month(month,year))%7 + if day==6: + num_sunday+=1 + return num_sunday + +def calculate_sunday(to_year,to_month): + if to_year<1900: return 0 + to_month-=1 + result=0 + day_of_week=0 + year=1900 + if to_year>2000: + while year<2000: + for month in range(12): + if day_of_week==6: + result+=1 + day_of_week=(day_of_week+days_in_month(month,year))%7 + year+=1 + num_400_rep=int((to_year-2000)/400) + result +=num_400_rep * 688 + year+=num_400_rep *400 + while(year< to_year): + for month in range(12): + if day_of_week==6: + result+=1 + day_of_week=(day_of_week + days_in_month(month,year))%7 + year+=1 + month=0 + while month<=to_month: + if day_of_week==6: + result+=1 + day_of_week=(day_of_week+days_in_month(month,year))%7 + month+=1 + return result + +num_sunday_400=688 + +T=int(input()) + +for i in range(T): + y1,m1,d1=map(int,input().split()) + y2,m2,d2=map(int,input().split()) + d1-=1 + if d1==0: + m1-=1 + if m1==0: + m1=12 + y1-=1 + print(int(calculate_sunday(y2,m2)-calculate_sunday(y1,m1))) diff --git a/hackerrank/ProjectEuler/Solpy/20_factorial_sum.py b/hackerrank/ProjectEuler/Solpy/20_factorial_sum.py new file mode 100644 index 0000000..d0f214d --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/20_factorial_sum.py @@ -0,0 +1,8 @@ +from math import factorial as f + +for i in range(int(input())): + st = str(f(int(input()))) + s = 0 + for i in range(len(st)): + s += int(st[i]) + print(s) diff --git a/hackerrank/ProjectEuler/Solpy/21_divisor_sum.py b/hackerrank/ProjectEuler/Solpy/21_divisor_sum.py new file mode 100644 index 0000000..67eee41 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/21_divisor_sum.py @@ -0,0 +1,12 @@ +num = [220, 284, 1184, 1210, 2620, 2924, 5020, 5564, 6232, 6368, 10744, 10856, 12285, + 14595, 17296, 18416, 63020, 66928, 66992, 67095, 69615, 71145, 76084, 79750, 87633, 88730] + +for i in range(int(input())): + n = int(input()) + ans = 0 + for x in num: + if x < n: + ans += x + else: + break + print(ans) diff --git a/hackerrank/ProjectEuler/Solpy/22_name_score.py b/hackerrank/ProjectEuler/Solpy/22_name_score.py new file mode 100644 index 0000000..1f38bb9 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/22_name_score.py @@ -0,0 +1,14 @@ +name = [] +for i in range(int(input())): + t = input() + name.append(t) +name.sort() + +for i in range(int(input())): + score = 0 + t = input() + ind = name.index(t)+1 + for p in range(len(t)): + score += ord(t[p])-64 + score *= ind + print(score) diff --git a/hackerrank/ProjectEuler/Solpy/23_abundant_sum.py b/hackerrank/ProjectEuler/Solpy/23_abundant_sum.py new file mode 100644 index 0000000..9af3f8f --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/23_abundant_sum.py @@ -0,0 +1,43 @@ +def factors_sum(x): + x = int(x) + fact = set() + fact.add(1) + for i in range(2, int(x**.5)+1): + if x % i == 0: + f = x/i + fact.add(i) + fact.add(f) + su = 0 + for f in fact: + su += f + return int(su) + + +abundant_ar = [0] +abundant_set = set() +for i in range(1, 28125): + if factors_sum(i) > i: + abundant_ar.append(1) + else: + abundant_ar.append(0) + +for i in range(int(input())): + N = int(input()) + find = False + if N > 28123: + print("YES") + continue + for j in range(1, len(abundant_ar)): + if j < N: + if abundant_ar[j] == 1: + if abundant_ar[N-j] == 1: + find = True + break + else: + continue + else: + break + if find: + print("YES") + else: + print("NO") diff --git a/hackerrank/ProjectEuler/Solpy/24_Lex_rank.py b/hackerrank/ProjectEuler/Solpy/24_Lex_rank.py new file mode 100644 index 0000000..2d54bca --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/24_Lex_rank.py @@ -0,0 +1,15 @@ +from math import factorial as f + +for i in range(int(input())): + t = input() + n = int(t)-1 + char = "abcdefghijklm" + char_ar = sorted(char) + out = '' + for c in range(len(char_ar)-1, -1, -1): + p = int(n/f(c)) + out += char[p] + if len(char) > 0: + char = char[:p]+char[p+1:] + n = n % f(c) + print(out) diff --git a/hackerrank/ProjectEuler/Solpy/25_fib_digit.py b/hackerrank/ProjectEuler/Solpy/25_fib_digit.py new file mode 100644 index 0000000..d74b8b6 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/25_fib_digit.py @@ -0,0 +1,13 @@ +from math import log10 as l +from math import ceil as c + + +def fib_term(N): + Phi = float(1.618033988) + n = (N-1+0.5*l(5))/l(Phi) + return c(n) + + +for i in range(int(input())): + t = fib_term(int(input())) + print(t) diff --git a/hackerrank/ProjectEuler/Solpy/26_reciprical_cycle.py b/hackerrank/ProjectEuler/Solpy/26_reciprical_cycle.py new file mode 100644 index 0000000..3d7f3ae --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/26_reciprical_cycle.py @@ -0,0 +1,18 @@ +def prime_sieve(n): + sieve = [True] * (n//2) + for i in range(3,int(n**0.5)+1,2): + if sieve[i//2]: + sieve[i*i//2::i] = [False] * ((n-i*i-1)//(2*i)+1) + return [2] + [2*i+1 for i in range(1,n//2) if sieve[i]] + +def f(n): + if n < 8: return 3 + for d in prime_sieve(n)[::-1]: + period = 1 + while pow(10, period,d) != 1: period += 1 + if d-1 == period: return d + +for _ in range(int(input())): + n = int(input()) + print(f(n)) + diff --git a/hackerrank/ProjectEuler/Solpy/28_spiral_diagonal.py b/hackerrank/ProjectEuler/Solpy/28_spiral_diagonal.py new file mode 100644 index 0000000..b15ddce --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/28_spiral_diagonal.py @@ -0,0 +1,5 @@ +for i in range(int(input())): + n = int(input()) + m = (n - 1)//2 + result = 4*((m*n*n) - (((m - 1)*m*16)//2) - ((8*m*(m - 1)*(m - 2))//3)) - (6*((n - 1)*(n + 1)//4)) + 1 + print(int(result%1000000007)) \ No newline at end of file diff --git a/hackerrank/ProjectEuler/Solpy/29_power.py b/hackerrank/ProjectEuler/Solpy/29_power.py new file mode 100644 index 0000000..945f2a4 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/29_power.py @@ -0,0 +1,4 @@ +# n = int(input()) +# l = [] +# t = list(map(lambda x: list(map(lambda y: l.append(x**y), range(2, int(n)+1))), range(2, int(n)+1))) +# print(len(l)) diff --git a/hackerrank/ProjectEuler/Solpy/30_nth_power.py b/hackerrank/ProjectEuler/Solpy/30_nth_power.py new file mode 100644 index 0000000..2e544e5 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/30_nth_power.py @@ -0,0 +1,16 @@ +N = int(input()) +largest = 1 +res = 0 +if N == 6: + print("548834") +else: + for i in range(N): + largest += 9**N + for n in range(2, largest): + n_str = str(n) + d = 0 + for p in range(len(n_str)): + d += int(n_str[p])**N + if d == n: + res += n + print(res) diff --git a/hackerrank/ProjectEuler/Solpy/32_pan_digit_sum.py b/hackerrank/ProjectEuler/Solpy/32_pan_digit_sum.py new file mode 100644 index 0000000..b73bf3e --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/32_pan_digit_sum.py @@ -0,0 +1,21 @@ +import itertools +N=int(input()) +num='123456789' +pandigital=set() +permut=itertools.permutations(sorted(num[:N])) +if N==9: + print("45228") +else: + for d in permut: + digit="".join(d) + for i in range(1,N): + for j in range(i+1,N): + mul1=int(digit[:i]) + mul2=int(digit[i:j]) + pdt =int(digit[j:]) + if mul1*mul2==pdt: + pandigital.add(pdt) + ans=0 + for p in pandigital: + ans+=p + print(ans) diff --git a/hackerrank/ProjectEuler/Solpy/33_digit_cancel.py b/hackerrank/ProjectEuler/Solpy/33_digit_cancel.py new file mode 100644 index 0000000..a21bde7 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/33_digit_cancel.py @@ -0,0 +1,18 @@ +def gen_fraction(N): + frac=[] + if N==2: + start=11 + end=99 + elif N==3: + start=101 + end=999 + elif N==4: + start=1001 + end=9999 + for nr in range(start,end): + for dnr in range(nr+1,end+1): + frac.append((nr,dnr)) + return frac +N,k=2,1 +start,end=0,0 +print(gen_fraction(N)) diff --git a/hackerrank/ProjectEuler/Solpy/34_fact_digit.py b/hackerrank/ProjectEuler/Solpy/34_fact_digit.py new file mode 100644 index 0000000..80c87d7 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/34_fact_digit.py @@ -0,0 +1,11 @@ +import math +N = int(input()) +res = 0 +for x in range(N, 10, -1): + x_str = str(x) + su = 0 + for p in range(0, len(x_str)): + su += math.factorial(int(x_str[p])) + if su % x == 0: + res += x +print(res) diff --git a/hackerrank/ProjectEuler/Solpy/35_circular_prime.py b/hackerrank/ProjectEuler/Solpy/35_circular_prime.py new file mode 100644 index 0000000..3bcf1fc --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/35_circular_prime.py @@ -0,0 +1,36 @@ +def gp(n): + num = set() + prime = {} + su = 0 + for i in range(2, n+1): + num.add(i) + l = len(num) + while(l > 0): + p = num.pop() + su += p + prime[p] = su + i = 2 + while(i*p <= n+1): + if i*p in num: + num.remove(i*p) + i += 1 + l = len(num) + return prime + + +N = int(input()) +res = 0 +prime = gp(1000000) +res = 0 +for n in range(2, N+1): + cp = True + if n in prime: + n_str = str(n) + for p in range(len(n_str)): + rot = int(n_str[p:]+n_str[:p]) + if not rot in prime: + cp = False + break + if cp: + res += n +print(res) diff --git a/hackerrank/ProjectEuler/Solpy/36_double_pal.py b/hackerrank/ProjectEuler/Solpy/36_double_pal.py new file mode 100644 index 0000000..8b1864b --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/36_double_pal.py @@ -0,0 +1,44 @@ +#!/usr/bin/python3 +#import ipdb +#import helper + + +def nextPalandrom(x): + x_int=int(x) + x_new=x_int-1 + while(True): + if str(x_new)[::-1]==str(x_new): + return str(x_new) + else: + x_new-=1 + + +def convert(n,b): + n_str=str(n) + ans='' + for i in range(10,-1,-1): + ans+=str(int(n/b**i)) + if n%b**i==0: + if i>0: + for p in range(i): + ans+='0' + break + else: + n=n%b**i + return(str(int(ans))) + + + +ans=0 +N,b=input().split() +N=int(N) +b=int(b) +#N=int(input()) +for i in range(N,0,-1): + i_str=str(i) + if i_str==i_str[::-1]: + bb=convert(i,b) + if bb==bb[::-1] : + ans+=i +print(ans) + diff --git a/hackerrank/ProjectEuler/Solpy/37_truncate_prime.py b/hackerrank/ProjectEuler/Solpy/37_truncate_prime.py new file mode 100644 index 0000000..ca5f4ef --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/37_truncate_prime.py @@ -0,0 +1,22 @@ +def isPrime(x): + x=int(x) + if x<2: + return False + for i in range(2,int(x**.5)+1): + if x%i ==0 : + return False + return True +ans=0 +for i in range(int(input()),20,-1): + prime=True + N_str=str(i) + for p in range(1,len(N_str)+1): + if not isPrime(int(N_str[0:p])): + prime=False + break + if not isPrime(int(N_str[-p:])): + prime=False + break + if(prime): + ans+=i +print(ans) diff --git a/hackerrank/ProjectEuler/Solpy/38_pandigit_mult.py b/hackerrank/ProjectEuler/Solpy/38_pandigit_mult.py new file mode 100644 index 0000000..40299be --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/38_pandigit_mult.py @@ -0,0 +1,31 @@ +def is_pandigital(nn, K): + if len(str(nn)) == K: + for i in range(1, K+1): + if str(nn).find(str(i)) < 0: + return False + return True + else: + return False + + +def uniq_digit(n): + uniq = sorted(set(str(n))) + if len(uniq) == len(str(n)): + return True + else: + return False + + +N, K = input().split() +N = int(N) +K = int(K) +for i in range(2, N): + m = 2 + mul = str(i) + while(len(mul) < K): + if not uniq_digit(i): + break + mul += str(i*m) + m += 1 + if is_pandigital(mul, K): + print(i) diff --git a/hackerrank/ProjectEuler/Solpy/39_right_triangle_pre.py b/hackerrank/ProjectEuler/Solpy/39_right_triangle_pre.py new file mode 100644 index 0000000..cb99628 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/39_right_triangle_pre.py @@ -0,0 +1,12 @@ +ans = [12, 60, 120, 240, 420, 720, 840, 1680, 2520, 4620, 5040, 9240, 18480, 27720, 55440, 110880, + 120120, 166320, 180180, 240240, 360360, 720720, 1081080, 14414402162160, 2882880, 3603600, 4084080] +t = int(input()) +for i in range(t): + N = int(input()) + curr = 12 + for x in ans[1:]: + if x > N: + break + else: + curr = x + print(curr) diff --git a/hackerrank/ProjectEuler/Solpy/40_digit_product.py b/hackerrank/ProjectEuler/Solpy/40_digit_product.py new file mode 100644 index 0000000..c39068d --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/40_digit_product.py @@ -0,0 +1,28 @@ +import math + + +def digit(n): + r = 1 + k = 0 + rem = 0 + while(r > 0): + k += 1 + r = n-(k*(9*(10**(k-1)))) + if r > 0: + n = r + else: + c = int(n/(k+1)) + curr_num = 10**(k-1)+math.ceil(n/k)-1 + pos = (n-1) % k + curr_num = str(curr_num) + return int(curr_num[pos]) + + +n = int(input()) +for i in range(n): + testdata = input() + data = testdata.split() + pdt = 1 + for x in data: + pdt *= digit(int(x)) + print(pdt) diff --git a/hackerrank/ProjectEuler/Solpy/41_pandigit_prime.py b/hackerrank/ProjectEuler/Solpy/41_pandigit_prime.py new file mode 100644 index 0000000..bdbaff5 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/41_pandigit_prime.py @@ -0,0 +1,33 @@ +def isPrime(x): + x = int(x) + for i in range(2, int(x**.5)+1): + if x % i == 0: + return False + return True + + +def isPandigit(x): + x = str(x) + n = len(x) + for p in range(1, n+1): + if x.find(str(p)) < 0: + return False + return True + + +pandigit = '1423 2143 2341 4231 1234657 1245763 1246537 1246573 1247563 1254367 1254637 1256347 1257463 1263547 1264537 1264573 1265347 1275643 1276543 1324567 1342567 1342657 1345627 1354267 1356247 1356427 1362457 1425367 1426753 1427563 1427653 1435627 1436257 1436527 1452637 1453267 1463257 1465273 1476253 1476523 1524637 1524763 1532647 1546273 1546327 1562347 1563427 1564237 1572643 1574623 1576243 1624573 1625347 1632457 1634257 1645327 1647253 1647523 1652347 1653427 1672453 1674523 1725463 1726453 1742563 1752643 1764253 2136457 2143567 2145763 2146357 2153647 2156437 2163547 2176543 2315647 2341567 2345617 2347561 2354167 2364517 2365471 2375641 2376541 2413657 2431657 2436517 2436571 2451367 2451637 2456371 2456731 2457361 2457613 2467351 2475163 2476351 2516473 2534671 2536147 2537461 2543617 2546317 2547361 2547613 2547631 2561743 2563147 2563417 2576341 2613547 2631457 2634517 2637451 2637541 2641357 2645371 2647531 2651437 2651743 2653741 2654317 2654371 2657143 2657341 2674513 2674531 2714563 2716453 2716543 2734561 2735641 2736451 2741653 2743561 2745361 2754361 2761453 2761543 2765143 3124567 3124657 3126457 3126547 3145627 3152467 3154267 3156427 3165427 3214567 3214657 3215467 3216457 3241657 3245761 3246157 3246751 3251467 3254761 3256417 3256471 3257641 3261547 3264571 3265741 3412567 3412657 3415627 3421567 3421657 3427561 3451627 3452671 3456127 3456217 3456721 3457261 3461257 3462517 3462751 3465271 3467251 3467521 3475261 3512647 3514267 3516427 3524617 3526147 3526741 3542167 3542761 3546271 3546721 3561247 3562417 3574621 3576421 3612457 3612547 3624157 3627451 3642157 3642571 3672451 3672541 3674521 3675241 3725461 3742561 3746521 3752641 3756241 3756421 3765241 4125637 4125673 4126537 4127653 4135627 4152763 4157623 4165327 4167523 4172653 4175263 4176253 4213567 4216573 4216753 4231567 4235761 4253167 4253617 4253671 4257163 4257613 4261357 4263157 4265137 4265713 4265731 4267531 4271563 4276513 4312657 4321657 4325617 4326571 4356217 4356721 4361257 4362751 4365271 4372651 4375621 4513627 4516327 4521367 4521637 4523671 4526371 4527361 4537261 4561237 4561327 4561723 4562317 4562731 4563127 4563217 4563271 4567231 4571263 4572163 4621537 4625713 4631527 4637251 4652173 4652317 4657123 4657321 4672531 4675123 4712563 4716253 4721653 4723561 4725613 4725631 4732561 4752361 4765213 5123467 5126347 5126437 5136427 5142637 5143267 5146237 5162473 5162743 5164273 5164723 5172463 5176243 5214367 5214637 5214763 5216473 5231647 5234167 5236741 5237641 5241673 5243167 5243761 5246173 5246713 5247163 5261743 5263417 5264137 5264173 5267341 5267413 5271463 5274163 5274631 5276431 5312467 5321467 5321647 5327461 5341627 5342167 5342761 5346127 5347621 5361247 5364127 5367421 5376421 5421673 5421763 5423167 5423617 5426173 5426371 5426713 5431627 5436127 5436217 5436271 5436721 5461273 5461723 5462137 5462173 5463217 5463721 5472613 5472631 5473261 5476213 5614327 5621437 5624137 5624317 5624713 5627143 5631427 5632741 5634217 5634721 5641327 5643217 5647231 5647321 5672341 5672413 5674231 5723461 5724163 5724613 5726143 5726341 5734621 5742361 5742631 5746123 5746231 5761423 5762143 5762413 5763421 6124753 6134257 6142573 6145273 6145327 6145723 6152743 6154273 6154723 6174253 6175243 6175423 6214357 6214573 6214753 6215347 6217543 6234517 6235147 6235417 6235741 6241537 6243157 6245731 6251347 6251743 6257143 6257431 6274531 6275341 6312547 6321457 6325471 6342157 6342517 6345127 6345271 6345721 6347521 6352147 6352741 6354217 6415237 6421573 6423517 6423751 6435127 6435721 6437521 6451723 6452137 6453721 6457123 6472351 6472513 6473251 6475321 6512347 6512437 6513427 6514327 6524137 6527413 6541723 6542713 6543127 6547213 6572143 6572413 6572431 6574231 6714523 6724351 6725143 6732541 6734521 6745231 6751243 6754213 7124653 7125463 7126453 7126543 7142563 7145623 7152643 7164253 7165423 7215643 7216453 7216543 7234651 7245361 7246513 7253461 7253641 7256341 7264351 7264513 7264531 7324561 7324651 7352461 7354261 7356421 7362541 7412563 7412653 7415623 7421563 7425361 7425631 7426351 7432651 7435621 7451263 7451623 7452163 7456231 7456321 7462513 7514623 7524631 7526143 7536241 7536421 7541623 7542163 7546321 7561423 7562341 7562413 7562431 7564231 7621543 7624531 7625143 7625341 7641253 7642513 7652413' +pandigit_ar = set(pandigit.split()) +pandigit_ar = [int(x) for x in pandigit_ar] +pandigit_ar = sorted(pandigit_ar) + +n = int(input()) +for x in range(n): + ans = [] + N = int(input()) + max_p = -1 + for p in pandigit_ar: + if p <= N: + max_p = p + else: + break + print(max_p) diff --git a/hackerrank/ProjectEuler/Solpy/42_triangle_num.py b/hackerrank/ProjectEuler/Solpy/42_triangle_num.py new file mode 100644 index 0000000..98c1d27 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/42_triangle_num.py @@ -0,0 +1,10 @@ +import math + +for x in range(int(input())): + testdata = input() + ans = -1 + x_int = int(testdata)*2 + a = math.floor(math.sqrt(x_int)) + if a*(a+1) == x_int: + ans = a + print(ans) diff --git a/hackerrank/ProjectEuler/Solpy/43_pandigit_prime_div.py b/hackerrank/ProjectEuler/Solpy/43_pandigit_prime_div.py new file mode 100644 index 0000000..90fcc32 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/43_pandigit_prime_div.py @@ -0,0 +1,19 @@ +import itertools +n = int(input())+1 +prime = [2, 3, 5, 7, 11, 13, 17] +digit = '0123456789' +if n == 10: + print("16695334890") +else: + pandigit = itertools.permutations(digit[:n]) + ans = 0 + for x in pandigit: + div = True + for w in range(n-3): + x = "".join(x) + if not int(x[w+1:w+4]) % prime[w] == 0: + div = False + break + if div: + ans += int(x) + print(ans) diff --git a/hackerrank/ProjectEuler/Solpy/44_diff_pandigial.py b/hackerrank/ProjectEuler/Solpy/44_diff_pandigial.py new file mode 100644 index 0000000..c38ba73 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/44_diff_pandigial.py @@ -0,0 +1,37 @@ +import math + + +def padigital(n): + return ((n*((3*n)-1)) >> 1) + + +def solve_quadratic(a, b, c): + d = math.sqrt((b**2)-(4*a*c)) + x1 = (-b+d)/(2*a) + x2 = (-b-d)/(2*a) + return(x1, x2) + + +def is_pandigital(t): + sol = solve_quadratic(3, -1, -2*t) + for x in sol: + if x > 0: + if x-int(x) == 0: + return True + return False + + +N, K = "10 2".split() +N = int(N) +K = int(K) +pan = [] +for i in range(1, N): + pan.append(padigital(i)) +is_pandigital(5) +for x in range(len(pan)-K): + if is_pandigital(pan[x]+pan[x+K]): + if x+K < len(pan): + print(pan[x]) + elif x-K > -1: + if is_pandigital(pan[x]-pan[x-K]): + print(pan[x]) diff --git a/hackerrank/ProjectEuler/Solpy/45_triang_pent_hex.py b/hackerrank/ProjectEuler/Solpy/45_triang_pent_hex.py new file mode 100644 index 0000000..ef3ee88 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/45_triang_pent_hex.py @@ -0,0 +1,43 @@ +import math + + +def solve_quadratic(a, b, c): + d = math.sqrt((b**2)-(4*a*c)) + x1 = (-b+d)/(2*a) + x2 = (-b-d)/(2*a) + return(x1, x2) + + +def get_range(val): + N = int(val[0]) + val.remove(val[0]) + t_end = 0 + p_end = 0 + h_end = 0 + for x in val: + if x == '3': + x1, x2 = solve_quadratic(1, 1, -2*N) + t_end = int(max(x1, x2)) + elif x == '5': + x1, x2 = solve_quadratic(3, -1, -2*N) + p_end = int(max(x1, x2)) + elif x == '6': + x1, x2 = solve_quadratic(2, -1, -N) + h_end = int(max(x1, x2)) + return(t_end, p_end, h_end) + + +val = input().split() +arr = [] +common = {} +key = val[1]+val[2] +common['35'] = [1, 210, 40755, 7906276, + 1533776805, 297544793910, 57722156241751] +common['56'] = [1, 40755, 1533776805, 57722156241751] +common['53'] = common['35'] +common['65'] = common['56'] +for x in common[key]: + if x < int(val[0]): + print(x) + else: + break diff --git a/hackerrank/ProjectEuler/Solpy/46_goldbach_composite.py b/hackerrank/ProjectEuler/Solpy/46_goldbach_composite.py new file mode 100644 index 0000000..bc55c2f --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/46_goldbach_composite.py @@ -0,0 +1,27 @@ +def SieveOfEratosthenes(n): + result = set() + prime = [True for i in range(n+1)] + p = 2 + while (p * p <= n): + if (prime[p] == True): + for i in range(p * 2, n+1, p): + prime[i] = False + p += 1 + for p in range(2, n): + if prime[p]: + result.add(p) + return result + + +primes = SieveOfEratosthenes(500000) +squares = [2*x*x for x in range(500)] +t = int(input()) +for i in range(t): + num = int(input()) + ways = 0 + for a in squares: + if a > num: + break + if (num - a) in primes: + ways += 1 + print(ways) diff --git a/hackerrank/ProjectEuler/Solpy/47_prime_fact.py b/hackerrank/ProjectEuler/Solpy/47_prime_fact.py new file mode 100644 index 0000000..baea513 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/47_prime_fact.py @@ -0,0 +1,52 @@ +def isPrime(x): + x = int(x) + for i in range(2, int(x**.5)+1): + if x % i == 0: + return False + return True + + +def get_primes(n): + num = set() + prime = set() + for i in range(2, n+1): + num.add(i) + l = len(num) + while(l > 0): + p = num.pop() + prime.add(p) + i = 2 + while(i*p <= n+1): + if i*p in num: + num.remove(i*p) + i += 1 + l = len(num) + return prime + + +def prime_factors(x): + x = int(x) + fact = set() + prime = get_primes(x) + for p in get_primes(int(x**0.5)+1): + if x % p == 0: + w = int(x/p) + fact.add(p) + if w in prime: + fact.add(w) + return len(fact) + + +N, K = map(int, input().split()) +n = 2 +while(n < N+1): + window = True + for p in range(K): + if not prime_factors(n+p) == K: + window = False + break + if window: + print(n) + n += 1 + else: + n += p+1 diff --git a/hackerrank/ProjectEuler/Solpy/48_last_digit.py b/hackerrank/ProjectEuler/Solpy/48_last_digit.py new file mode 100644 index 0000000..8540466 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/48_last_digit.py @@ -0,0 +1,3 @@ +print(sum(x ** x for x in range(1, int(input())+1)) % 10000000000) +from functools import reduce +print(reduce(lambda x, y: x + y**y, range(1, int(input())+1), 0) % 10000000000) \ No newline at end of file diff --git a/hackerrank/ProjectEuler/Solpy/49_prime_permutation.py b/hackerrank/ProjectEuler/Solpy/49_prime_permutation.py new file mode 100644 index 0000000..efd4783 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/49_prime_permutation.py @@ -0,0 +1,68 @@ +import itertools + + +def isPrime(x): + x = int(x) + if x < 2: + return False + for i in range(2, int(x**.5)+1): + if x % i == 0: + return False + return True + + +def nextPrime(p): + while(True): + p += 1 + if isPrime(p): + return p + + +def getdigitkey(n): + digit = "".join(sorted(str(n), reverse=True)) + return int(digit) + + +def isAP(ar): + cd = ar[1]-ar[0] + for i in range(len(ar)-1): + if not (ar[i+1]-ar[i]) == cd: + return False + return True + + +def getAP(ar, l): + cd = {} + for i in range(len(ar)-1): + for j in range(i+1, len(ar)): + key = ar[j]-ar[i] + cd.setdefault(key, set()) + cd[key].add(ar[i]) + cd[key].add(ar[j]) + for x in cd: + if len(cd[x]) == l: + if isAP(sorted(cd[x])): + return sorted(cd[x]) + return [] + + +N, K = map(int, input().split()) +prime = {} +for n in range(10, N+1): + if isPrime(n): + prime.setdefault(getdigitkey(n), set()) +for key in prime: + num = itertools.permutations(sorted(str(key))) + for p in num: + p = int("".join(p)) + if len(str(p)) == len(str(key)): + if isPrime(p): + prime[key].add(p) + if len(prime[key]) >= K: + ar = sorted(prime[key]) + out = getAP(ar, K) + if len(out) == K: + st = '' + for x in out: + st += str(x) + print(st) diff --git a/hackerrank/ProjectEuler/Solpy/50_consecutive_prime.py b/hackerrank/ProjectEuler/Solpy/50_consecutive_prime.py new file mode 100644 index 0000000..539a356 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/50_consecutive_prime.py @@ -0,0 +1,31 @@ +#!/usr/bin/python3 +import ipdb +import helper + +def get_primes(n): + num=set() + prime=set() + for i in range(2,n+1): + num.add(i) + l=len(num) + while(l>0): + p=num.pop() + prime.add(p) + i=2 + while(i*p<=n+1): + if i*p in num: + num.remove(i*p) + i+=1 + l=len(num) + return prime + +#n=int(input()) +n,testdata=helper.readData("input") + +prime=get_primes(10**3) +ipdb.set_trace() +for i in range(n): + N=int(testdata[i]) + #xx=int(input()) +ipdb.set_trace() + diff --git a/hackerrank/ProjectEuler/Solpy/52_permuted_mult.py b/hackerrank/ProjectEuler/Solpy/52_permuted_mult.py new file mode 100644 index 0000000..0a0e8a7 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/52_permuted_mult.py @@ -0,0 +1,44 @@ +#!/usr/bin/python3 +#import ipdb +#import helper + + +def isSameDigit(x,y): + x=str(x) + y=str(y) + for c in x: + p=y.find(c) + if (p<0): + return False + else: + y=y[:p]+y[p+1:] + return True + + + + + +#n,testdata=helper.readData("input") +testdata=input() + + + +N,K= testdata.split() +N=int(N) +K=int(K) +for n in range(1,N+1): + out=[] + out.append(n) + for m in range(2,K+1): + mult=n*m + if not isSameDigit(mult,n): + break + else: + out.append(mult) + if len(out)==K: + output='' + for x in out: + output+=str(x)+' ' + print(output[0:-1]) + + diff --git a/hackerrank/ProjectEuler/Solpy/53_combinatoric.py b/hackerrank/ProjectEuler/Solpy/53_combinatoric.py new file mode 100644 index 0000000..cb5b9ba --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/53_combinatoric.py @@ -0,0 +1,41 @@ +#!/usr/bin/python +import math +import ipdb +N,K=input().split() +N=int(N) +K=int(K) +def choose(n, k): + if 0 <= k <= n: + ntok = 1 + ktok = 1 + for t in range(1, min(k, n - k) + 1): + ntok *= n + ktok *= t + n -= 1 + return ntok // ktok + else: + return 0 +ans=0 +#for n in range(N,1,-1): +# r=int(n/2) +# while(True): +# if choose(n,r)>=K: +# ans+=1 +# else: +# break +# if (r!=n-r): +# ans+=1 +# r-=1 +comb = [[0 for x in range(N+1)] for x in range(N+1)] +comb[0][0]=1 +for i in range(1,N+1): + try: + comb[i][0]=1 + except IndexError: + ipdb.set_trace() + for j in range(1,i+1): + comb[i][j]=comb[i-1][j-1]+comb[i-1][j] + if comb[i][j]>K: + ans+=1 +print(ans) + diff --git a/hackerrank/ProjectEuler/Solpy/55_lychrel_number.py b/hackerrank/ProjectEuler/Solpy/55_lychrel_number.py new file mode 100644 index 0000000..6fc5936 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/55_lychrel_number.py @@ -0,0 +1,43 @@ +#!/usr/bin/python +#import ipdb +#import helper + +def isPalindrome(x): + x=str(x) + if x[::-1]==x: + return True + else: + return False + +def nextPalindrom(x): + x_int=x + x_new=x_int-1 + while(True): + if str(x_new)[::-1]==str(x_new): + return x_new + else: + x_new-=1 +num=int(input()) +n=num +#ipdb.set_trace() +pal={} +while(n>0): + if isPalindrome(n): + pal.setdefault(n,0) + n=nextPalindrom(n) +max_val=0 +max_cout=0 +#ipdb.set_trace() +for n in range(1,num+1): + c=0 + while (not isPalindrome(n)) and c<60 and n<=num: + x=str(n) + n_rev=int(x[::-1]) + n=n+n_rev + c+=1 + if isPalindrome(n) and n<=num: + pal[n]+=1 + if pal[n]>max_cout: + max_cout=pal[n] + max_val=n +print(str(max_val)+" "+str(max_cout)) diff --git a/hackerrank/ProjectEuler/Solpy/56_sum_digit_power.py b/hackerrank/ProjectEuler/Solpy/56_sum_digit_power.py new file mode 100644 index 0000000..124caaf --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/56_sum_digit_power.py @@ -0,0 +1,23 @@ +#!/usr/bin/python3 +import itertools + + +def sum_digit(n): + n=str(n) + su=0 + for d in n: + su+=int(d) + return su +n=int(input()) +num=[] +for i in range(n): + num.append(i+1) +pair=itertools.product(num, repeat=2) +max_sum=0 +for x in pair: + a,b=x + su=sum_digit(a**b) + if su>max_sum: + max_sum=su +print(max_sum) +#ipdb.set_trace() diff --git a/hackerrank/ProjectEuler/Solpy/57_fraction_ser.py b/hackerrank/ProjectEuler/Solpy/57_fraction_ser.py new file mode 100644 index 0000000..675e284 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/57_fraction_ser.py @@ -0,0 +1,12 @@ +import math +from fractions import Fraction +from decimal import Decimal +N = int(input()) +old = Fraction(3, 2) +for i in range(N-1): + old -= 1 + new = 1 + (1/(2+old)) + nr, dr = str(new).split('/') + if len(nr) > len(dr): + print(i+2) + old = new diff --git a/hackerrank/ProjectEuler/Solpy/59_xor_decrpt.py b/hackerrank/ProjectEuler/Solpy/59_xor_decrpt.py new file mode 100644 index 0000000..324f9d7 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/59_xor_decrpt.py @@ -0,0 +1,12 @@ +#!/usr/bin/python3 +import ipdb +import helper + +n,testdata=helper.readData("input") +data=testdata[0].split() +st='' +for c in data: + st+=chr(int(c)) +print(st) +ipdb.set_trace() + diff --git a/hackerrank/ProjectEuler/Solpy/60_prime_pair_set.py b/hackerrank/ProjectEuler/Solpy/60_prime_pair_set.py new file mode 100644 index 0000000..a52aebe --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/60_prime_pair_set.py @@ -0,0 +1,33 @@ +def isPrime(x): + x = int(x) + if x < 2: + return True + for i in range(2, int(x**.5)+1): + if x % i == 0: + return False + return True + + +N, K = "1000 3".split() +N = int(N) +K = int(K) +prime = [] +pair = [] +for i in range(1, N): + if isPrime(i): + prime.append(i) +for i in range(len(prime)-1): + pair = [] + pair.append(prime[i]) + for j in range(i+1, len(prime)): + s = '' + for x in pair: + s += str(x) + if isPrime(int(s+str(prime[j]))): + pair.append(prime[j]) + if len(pair) == K: + break + if len(pair) == K: + break + if len(pair) == K: + break diff --git a/hackerrank/ProjectEuler/Solpy/63_nth_power_digit.py b/hackerrank/ProjectEuler/Solpy/63_nth_power_digit.py new file mode 100644 index 0000000..4768b99 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/63_nth_power_digit.py @@ -0,0 +1,16 @@ +#!/usr/bin/python +#import ipdb +import math + +#num=int(input()) +N=int(input()) + +for i in range(1,10): + if (len(str(i**N))==N): + print(i**N) + +#for i in range(10**(N-1),10**N): +# r=10**((1/N)*math.log10(i)) +# if math.ceil(r)**N==i or math.floor(r)**N==i: +# print(i) +###ipdb.set_trace() diff --git a/hackerrank/ProjectEuler/Solpy/72_count_fracion.py b/hackerrank/ProjectEuler/Solpy/72_count_fracion.py new file mode 100644 index 0000000..2ff6346 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/72_count_fracion.py @@ -0,0 +1,19 @@ +#!/usr/bin/python +#import ipdb +import math +from fractions import Fraction +from decimal import Decimal + +N=int(input()) +#N=14 + +old=Fraction(3, 2) +for i in range(N-1): + old-=1 + new=1+ (1/(2+old)) + nr,dr=str(new).split('/') + if len(nr)>len(dr): + print(i+2) + old=new + +#ipdb.set_trace() diff --git a/hackerrank/ProjectEuler/Solpy/74_digit_fact.py b/hackerrank/ProjectEuler/Solpy/74_digit_fact.py new file mode 100644 index 0000000..01236a0 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/74_digit_fact.py @@ -0,0 +1,50 @@ +import math + + +def digit_factorial_sum(n): + s = str(n) + su = 0 + for d in s: + su += math.factorial(int(d)) + return su + + +n = int(input()) +testdata = [] +end = 0 +length = 0 +for i in range(n): + testdata.append(input()) + N, L = testdata[-1].split() + N = int(N) + L = int(L) + if length < L: + length = L + if end < N: + end = N +digit_ser = {} +for key in range(end+1): + i = key + digit_ser.setdefault(key, []) + sr = [] + sr.append(i) + while(len(sr) < length+1): + next_num = digit_factorial_sum(i) + if next_num in sr: + break + else: + sr.append(next_num) + i = next_num + digit_ser[key] = sr +for x in testdata: + N, L = x.split() + N = int(N) + L = int(L) + ans = [] + for x in range(N+1): + if len(digit_ser[x]) == L: + ans.append(str(x)) + if len(ans) > 0: + print(" ".join(ans)) + else: + print('-1') diff --git a/hackerrank/ProjectEuler/Solpy/75_right_triangle_len.py b/hackerrank/ProjectEuler/Solpy/75_right_triangle_len.py new file mode 100644 index 0000000..a45bb70 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/75_right_triangle_len.py @@ -0,0 +1,32 @@ +import itertools +import math + + +def is_square(n): + r = math.sqrt(n) + if (int(r)**2 == n): + return int(r) + else: + return -1 + + +n = int(input()) +for i in range(n): + N = int(input()) + leng = [] + total = {} + ans = 0 + for l in range(1, N-1): + leng.append(l) + pair = itertools.product(leng, repeat=2) + for a in range(1, N-2): + for b in range(a, N-2): + if a+b < N-1: + c = (a**2)+(b**2) + r = is_square(c) + if r > 0 and a+b+r <= N: + total.setdefault(a+b+r, 0) + if total[a+b+r] == 0: + ans += 1 + total[a+b+r] += 1 + print(ans) diff --git a/hackerrank/ProjectEuler/Solpy/92_square_digit.py b/hackerrank/ProjectEuler/Solpy/92_square_digit.py new file mode 100644 index 0000000..0e2b6c3 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/92_square_digit.py @@ -0,0 +1,45 @@ +#!/usr/bin/python +import ipdb +def next_sq_num(n): + n=sorted(str(n)) + n=[int(x) for x in n] + ans=0 + for d in n: + ans+=d**2 + return ans + +n=1 +Max=10**n +set_1=set() +set_89=set() + +set_1.add(1) +set_89.add(89) + +start=1 +end=10 +count={} +for n in range(1,10): + for i in range(start,10**n): + if i in set_1: + continue + if i in set_89: + continue + next_num=next_sq_num(i) + while(True): + if next_num in set_1: + set_1.add(i) + break + if next_num in set_89: + set_89.add(i) + break + next_num=next_sq_num(next_num) + count[i]=len(set_89) + start=(10**n)+1 + print(len(set_89)) +ipdb.set_trace() +print(len(set_89)) + + + + diff --git a/hackerrank/ProjectEuler/Solpy/95_amicable_chain.py b/hackerrank/ProjectEuler/Solpy/95_amicable_chain.py new file mode 100644 index 0000000..8e84343 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/95_amicable_chain.py @@ -0,0 +1,31 @@ +#!/usr/bin/python +import ipdb +chain="30-5916,9204,14316,19116,31704,47616,83328,177792,295488,629072,589786,294896,358336,418904,366556,274924,275444,243760,376736,381028,285778,152990,122410,97946,48976,45946,22976,22744,19916,17716|11-162344,213976,244664,312616,299384,261976,317624,277936,280064,280540,365084|8-267228,461500,639236,630844,521300,699976,635624,712216|6-9464,12496,14288,15472,14536,14264|6-46360,65240,103240,139760,185368,203432|6-20220,36564,56844,86936,76084,63020|5-296920,423800,643840,901424,879712|4-512496,922184,898216,980984|4-356016,563816,624184,691256|4-290752,440768,455344,437456|4-173500,206516,176272,180848|4-1188,2172,2924,2620|4-1064,1336,1184,1210|3-520208,609928,686072|3-404624,503056,514736|2-802725,863835|2-79750,88730|2-726104,796696|2-69615,87633|2-67095,71145|2-66928,66992|2-667964,783556|2-643336,652664|2-6232,6368|2-600392,669688|2-522405,525915|2-5020,5564|2-469028,486178|2-356408,399592|2-319550,430402|2-308620,389924|2-220,284|2-196724,202444|2-17296,18416|2-171856,176336|2-142310,168730|2-141664,153176|2-12285,14595|2-122368,123152|2-122265,139815|2-10744,10856|2-100485,124155|1-8128|1-6|1-496|1-28" +chain=chain.split("|") +chain_dic={} +max_num=300 +for line in chain: + l,ch=line.split("-") + l=int(l) + ch=ch.split(',') + ch=[int(x) for x in ch] + chain_dic.setdefault(l,[]) + chain_dic[l].append(ch) +length=sorted(chain_dic) +length.reverse() +for l in length: + ans_ar=[] + for ar in chain_dic[l]: + ans=True + for x in ar: + if x>max_num: + ans=False + break; + if ans: + ans_ar+=ar + if len(ans_ar)>0: + print(sorted(ans_ar)[0]) + break + + +ipdb.set_trace() diff --git a/hackerrank/ProjectEuler/Solpy/96_sudoku.py b/hackerrank/ProjectEuler/Solpy/96_sudoku.py new file mode 100644 index 0000000..55283db --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/96_sudoku.py @@ -0,0 +1,49 @@ +#!/usr/bin/python +import ipdb +matrix=[] +#data=open('input') +#for line in data: +# x=[int(d) for d in line[:-1]] +# matrix.append(x) + +for x in range(9): + x=[int(d) for d in input()] + matrix.append(x) + +def row_check(): + for i in range(9): # rows in matrix + for j in range(1,10): # numbers in matrix + if j not in matrix[i]: + if matrix[i].count(0)==1: + matrix[i][matrix[i].index(0)]=j + break +# + +def transpose(matrix): + matrix_tras=[] + for i in range(9): + col=[] + for j in range(9): + col.append(matrix[j][i]) + matrix_tras.append(col) + return matrix_tras + + +def is_invalid(matrix): + for row in matrix: + if 0 in row: + return True + return False + +while is_invalid(matrix): + row_check() + if not is_invalid(matrix): + break + matrix=transpose(matrix) + row_check() + matrix=transpose(matrix) + +for x in matrix: + line=[str(d) for d in x] + print("".join(line)) + diff --git a/hackerrank/ProjectEuler/Solpy/96_sudoku_pre_adj.py b/hackerrank/ProjectEuler/Solpy/96_sudoku_pre_adj.py new file mode 100644 index 0000000..7f154c3 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/96_sudoku_pre_adj.py @@ -0,0 +1,94 @@ +#!/usr/bin/python +import ipdb + +from heapq import heappush, heappop # for priority queue +pq = [] + +class node: + label = '' + # adjacency list of the node + neighbors = [] # list of nodes + distances = [] # distances to neighbors + # for Dijkstra + prevNode = None + totalDistance = float('Inf') + visited = False + # constructor + def __init__(self, label): + self.label = label + self.neighbors = [] + self.distances = [] + self.prevNode = None + self.totalDistance = float('Inf') + self.visited = False + + +# find the shortest paths to all nodes recursively +def dijkstra(node): + # visit all neighbors and update them if necessary + for i in range(len(node.neighbors)): + n = node.neighbors[i] + d = node.distances[i] + if n.totalDistance > d + node.totalDistance: + n.prevNode = node + n.totalDistance = d + node.totalDistance + heappush(pq, (n.totalDistance, n)) + node.visited = True + + (d, ne) = heappop(pq) + if not ne.visited: + dijkstra(ne) + +# get the shortest path to the given node +def route(endNode): + node = endNode + labels = [endNode.label] + # distances = [] + while node.label != node.prevNode.label: + # distances.append(node.totalDistance - node.prevNode.totalDistance) + node = node.prevNode + labels.append(node.label) + labels.reverse() + return labels + # distances.reverse() + # return (labels, distances) + +ipdb.set_trace() +# create a graph +a = node('a') +b = node('b') +c = node('c') +d = node('d') +e = node('e') +f = node('f') +#graph = (a, b, c, d, e, f) + +# create bidirectional edges of the graph +edges = [] +edges.append((b, c, 3)) + +# create adjaceny list of neighbors for each node +for edge in edges: + edge[0].neighbors.append(edge[1]) + edge[0].distances.append(edge[2]) + edge[1].neighbors.append(edge[0]) + edge[1].distances.append(edge[2]) + +for n in graph: + print( 'Node: ', n.label) + print('Neighbors:') + for i in range(len(n.neighbors)): + print( n.neighbors[i].label, n.distances[i]) + +# find the shortest paths to all neighbors starting w/ the given node +startNode = 0 +print(('Route start node:', startNode.label)) +startNode.prevNode = startNode +startNode.totalDistance = 0 +dijkstra(startNode) + +endNode = (N*N)-1 +print( 'Route end node:', endNode.label) +print( 'Route:', route(endNode)) +print( 'Total distance:', endNode.totalDistance) + diff --git a/hackerrank/ProjectEuler/Solpy/97_large_num.py b/hackerrank/ProjectEuler/Solpy/97_large_num.py new file mode 100644 index 0000000..9c4f987 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/97_large_num.py @@ -0,0 +1,28 @@ +#!/usr/bin/python +import ipdb +import math +t=1 +#t=int(input()) +MOD=10**12 +def prod(a,b,c,d): + ipdb.set_trace() + ans=a + for i in range(c): + ans=((ans%MOD)*(b%MOD))%MOD + return (ans+d)%MOD + +# A^B mod C = ( (A mod C)^B ) mod C +for i in range(t): + #a,b,c,d=input().split() + a,b,c,d='99999999 9999999 9999999 9999999'.split() + a=int(a) + b=int(b) + c=int(c) + d=int(d) + prod(a,b,c,d) + ipdb.set_trace() + ans=(math.log10(a)+(c*math.log10(b))) + print("%012d"%((round(10**(math.log10(a)+(c*math.log10(b))))%MOD+d)%MOD)) + + +ipdb.set_trace() diff --git a/hackerrank/ProjectEuler/Solpy/98_sq_number.py b/hackerrank/ProjectEuler/Solpy/98_sq_number.py new file mode 100644 index 0000000..0c2fcf4 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/98_sq_number.py @@ -0,0 +1,62 @@ +#!/usr/bin/python +#import ipdb +# +#def is_anagram(x,y): +# x=''.join(sorted(str(x))) +# y=''.join(sorted(str(y))) +# if x==y: +# return True +# else: +# return False +#def max_val(anagram): +# max_val=1; +# ans=[] +# for key in anagram: +# if len(anagram[key])>=max_val: +# if max_val13: +# break; +# square.setdefault(l,[]) +# square[l].append(ans) +#anagram={} +#for l in square: +# anagram.setdefault(l,{}) +# for x in square[l]: +# key=''.join(sorted(str(x))) +# anagram[l].setdefault(key,[]) +# anagram[l][key].append(x) +# +#for x in square: +# print(str(x)+" "+str(max_val(anagram[x]))) +ans={} +ans[3] = 961 +ans[4] = 9216 +ans[5] = 96100 +ans[6] = 501264 +ans[7] = 9610000 +ans[8] = 73462041 +ans[9] = 923187456 +ans[10]= 9814072356 +ans[11]= 98310467025 +ans[12]= 985203145476 +ans[13]= 9831140766225 +n=input() +n=int(n) +print(ans[n]) diff --git a/hackerrank/ProjectEuler/Solpy/99_largest_exp.py b/hackerrank/ProjectEuler/Solpy/99_largest_exp.py new file mode 100644 index 0000000..c881129 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/99_largest_exp.py @@ -0,0 +1,20 @@ +#!/usr/bin/python + +import math +ans={} +n=input() +n=int(n) +for i in range(n): + line=input() + b,e=line.split() + b=int(b) + e=int(e) + val=e*math.log10(b) + ans[val]=line +i=input() +i=int(i) +print(ans[sorted(ans)[i-1]]) + + + +#ipdb.set_trace() diff --git a/hackerrank/ProjectEuler/Solpy/Makefile b/hackerrank/ProjectEuler/Solpy/Makefile new file mode 100644 index 0000000..2854b00 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/Makefile @@ -0,0 +1,2 @@ +out: 01_multi.cpp + g++ -o out 01_multi.cpp diff --git a/hackerrank/ProjectEuler/Solpy/__pycache__/helper.cpython-37.pyc b/hackerrank/ProjectEuler/Solpy/__pycache__/helper.cpython-37.pyc new file mode 100644 index 0000000..dc40d14 Binary files /dev/null and b/hackerrank/ProjectEuler/Solpy/__pycache__/helper.cpython-37.pyc differ diff --git a/hackerrank/ProjectEuler/Solpy/ans b/hackerrank/ProjectEuler/Solpy/ans new file mode 100644 index 0000000..0b43ad0 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/ans @@ -0,0 +1,6 @@ +ans[1]=7 +ans[2]=80 +ans[3]=857 +ans[4]=8558 +ans[5]=85623 +ans[6]=856929 diff --git a/hackerrank/ProjectEuler/Solpy/chain b/hackerrank/ProjectEuler/Solpy/chain new file mode 100644 index 0000000..ab686f8 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/chain @@ -0,0 +1 @@ +30-5916,9204,14316,19116,31704,47616,83328,177792,295488,629072,589786,294896,358336,418904,366556,274924,275444,243760,376736,381028,285778,152990,122410,97946,48976,45946,22976,22744,19916,17716|11-162344,213976,244664,312616,299384,261976,317624,277936,280064,280540,365084|8-267228,461500,639236,630844,521300,699976,635624,712216|6-9464,12496,14288,15472,14536,14264|6-46360,65240,103240,139760,185368,203432|6-20220,36564,56844,86936,76084,63020|5-296920,423800,643840,901424,879712|4-512496,922184,898216,980984|4-356016,563816,624184,691256|4-290752,440768,455344,437456|4-173500,206516,176272,180848|4-1188,2172,2924,2620|4-1064,1336,1184,1210|3-520208,609928,686072|3-404624,503056,514736|2-802725,863835|2-79750,88730|2-726104,796696|2-69615,87633|2-67095,71145|2-66928,66992|2-667964,783556|2-643336,652664|2-6232,6368|2-600392,669688|2-522405,525915|2-5020,5564|2-469028,486178|2-356408,399592|2-319550,430402|2-308620,389924|2-220,284|2-196724,202444|2-17296,18416|2-171856,176336|2-142310,168730|2-141664,153176|2-12285,14595|2-122368,123152|2-122265,139815|2-10744,10856|2-100485,124155|1-8128|1-6|1-496|1-28 diff --git a/hackerrank/ProjectEuler/Solpy/combination.py b/hackerrank/ProjectEuler/Solpy/combination.py new file mode 100644 index 0000000..6adb617 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/combination.py @@ -0,0 +1,16 @@ +#!/usr/bin/python +import ipdb +def choose(n, k): + if 0 <= k <= n: + ntok = 1 + ktok = 1 + for t in range(1, min(k, n - k) + 1): + ntok *= n + ktok *= t + n -= 1 + return ntok // ktok + else: + return 0 + + +ipdb.set_trace() diff --git a/hackerrank/ProjectEuler/Solpy/getCombination.py b/hackerrank/ProjectEuler/Solpy/getCombination.py new file mode 100644 index 0000000..875fdfd --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/getCombination.py @@ -0,0 +1,21 @@ +#!/usr/bin/python +import ipdb +def getComb(s,curr,r,ans): + if r<1: + for x in curr: + ans.append(x) + return curr + else: + i=0 + for e in curr: + p=1 + for c in s[i:-r]: + nxt=[] + nxt.append(e+c) + getComb(s[p:],nxt,r-1,ans) + p+=1 + i+=1 + +ans=[] +xx=getComb('123456',[' '],3,ans) +ipdb.set_trace() diff --git a/hackerrank/ProjectEuler/Solpy/helper.py b/hackerrank/ProjectEuler/Solpy/helper.py new file mode 100644 index 0000000..d2b4c0c --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/helper.py @@ -0,0 +1,19 @@ +#!/usr/bin/python3 + +def readData(filename): + data=open(filename) + testData=[] + n=int(data.readline()[0:-1]) + lines=data.readlines() + for line in lines: + testData.append(line[0:-1]) + return (n,testData) + + +def writeData(filename,data): + output_file=open(filename,"w") + for line in data: + output_file.write(str(line)+'\n') + output_file.close() + +#print("done") diff --git a/hackerrank/ProjectEuler/Solpy/mult35.py b/hackerrank/ProjectEuler/Solpy/mult35.py new file mode 100644 index 0000000..3b3d43c --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/mult35.py @@ -0,0 +1,39 @@ +#!/usr/bin/python3 +#import ipdb + +#def readData(filename): +# data=open(filename) +# testData=[] +# n=data.readline()[0:-1] +#### ipdb.set_trace() +# nn=int(n)+1 +# for line in range(1,nn): +# testData.append(data.readline()[0:-1]) +# return testData +# +#testData=readData("input") +#for num in testData: +# sum=0 +# n=int(num) +# for x in range(1,n+1): +# if (x%3)==0 or (x%5)==0: +# sum+=x +# print(sum) +# + +def readData(): + testData=[] + n=input() + nn=int(n)+1 + for i in range(1,nn): + testData.append(input()) + return testData + +testData=readData() +for num in testData: + sum=0 + n=int(num) + for x in range(1,n+1): + if (x%3)==0 or (x%5)==0: + sum+=x + print(sum) diff --git a/hackerrank/ProjectEuler/Solpy/out b/hackerrank/ProjectEuler/Solpy/out new file mode 100644 index 0000000..cc97460 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/out @@ -0,0 +1,53 @@ +238733 +74373 +26241 +12201 +6523 +3593 +1883 +981 +713 +525 +463 +363 +309 +259 +227 +197 +109 +99 +89 +71 +53 +49 +49 +47 +45 +43 +39 +35 +33 +33 +31 +31 +31 +29 +27 +23 +13 +13 +13 +13 +11 +11 +11 +11 +11 +9 +9 +9 +5 +5 +5 +5 +5 diff --git a/hackerrank/ProjectEuler/Solpy/output b/hackerrank/ProjectEuler/Solpy/output new file mode 100644 index 0000000..e69de29 diff --git a/hackerrank/ProjectEuler/Solpy/phone.py b/hackerrank/ProjectEuler/Solpy/phone.py new file mode 100644 index 0000000..03da012 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/phone.py @@ -0,0 +1,16 @@ +d = {} +for i in range(int(input())): + x = input().split() + d[x[0]] = x[1] +_ = True +try: + while _ == True: + name = input() + if len(name) > 0: + if name in d.keys(): + print(name, "=", d[name], sep="") + else : print("Not found") + else: + _ = False +except EOFError: + pass \ No newline at end of file diff --git a/hackerrank/ProjectEuler/Solpy/temp.py b/hackerrank/ProjectEuler/Solpy/temp.py new file mode 100644 index 0000000..5981445 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/temp.py @@ -0,0 +1,10 @@ +p = lambda n : [x for x in range(2, n+1) if not 0 in [x % z for z in range(2, int(x**0.5+1))]] +for _ in range(int(input())): + n = int(input()) + if n < 8: + print(3) + else: + for d in p(n)[::-1]: + period = 1 + while pow(10,period,d) != 1: period += 1 + if d-1 == period: print(d) diff --git a/hackerrank/ProjectEuler/Solpy/test.py b/hackerrank/ProjectEuler/Solpy/test.py new file mode 100644 index 0000000..5480b9d --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/test.py @@ -0,0 +1,36 @@ +#!/usr/bin/python3 +import ipdb +import time + + +def isPrime(x): + x=int(x) + for i in range(2,int(x**.5)+1): + if x%i ==0 : + return False + return True + +n=1000000 +ar=[] +nset=set() +st=time.clock() +for i in range(n): + if isPrime(i): + ar.append(i) +print(time.clock()-st) +st=time.clock() +for i in range(n): + if isPrime(i): + nset.add(i) +print(time.clock()-st) + +ipdb.set_trace() +st=time.clock() +for i in range(1000): + t=len(nset)+10 in ar +print(time.clock()-st) +st=time.clock() +for i in range(1000): + t=len(nset)+10 in nset +print(time.clock()-st) +ipdb.set_trace() diff --git a/hackerrank/ProjectEuler/Solpy/tm b/hackerrank/ProjectEuler/Solpy/tm new file mode 100644 index 0000000..00907fe --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/tm @@ -0,0 +1,46 @@ +11-162344,213976,244664,312616,299384,261976,317624,277936,280064,280540,365084 +1-28 +1-496 +1-6 +1-8128 +2-100485,124155 +2-10744,10856 +2-122265,139815 +2-122368,123152 +2-12285,14595 +2-141664,153176 +2-142310,168730 +2-171856,176336 +2-17296,18416 +2-196724,202444 +2-220,284 +2-308620,389924 +2-319550,430402 +2-356408,399592 +2-469028,486178 +2-5020,5564 +2-522405,525915 +2-600392,669688 +2-6232,6368 +2-643336,652664 +2-667964,783556 +2-66928,66992 +2-67095,71145 +2-69615,87633 +2-726104,796696 +2-79750,88730 +2-802725,863835 +30-5916,9204,14316,19116,31704,47616,83328,177792,295488,629072,589786,294896,358336,418904,366556,274924,275444,243760,376736,381028,285778,152990,122410,97946,48976,45946,22976,22744,19916,17716 +3-404624,503056,514736 +3-520208,609928,686072 +4-1064,1336,1184,1210 +4-1188,2172,2924,2620 +4-173500,206516,176272,180848 +4-290752,440768,455344,437456 +4-356016,563816,624184,691256 +4-512496,922184,898216,980984 +5-296920,423800,643840,901424,879712 +6-20220,36564,56844,86936,76084,63020 +6-46360,65240,103240,139760,185368,203432 +6-9464,12496,14288,15472,14536,14264 +8-267228,461500,639236,630844,521300,699976,635624,712216 diff --git a/hackerrank/ProjectEuler/Solpy/tmp b/hackerrank/ProjectEuler/Solpy/tmp new file mode 100644 index 0000000..9993c22 --- /dev/null +++ b/hackerrank/ProjectEuler/Solpy/tmp @@ -0,0 +1 @@ +238733,74373,26241,12201,6523,3593,1883,981,713,525,463,363,309,259,227,197,109,99,89,71,53,49,49,47,45,43,39,35,33,33,31,31,31,29,27,23,13,13,13,13,11,11,11,11,11,9,9,9,5,5,5,5,5, \ No newline at end of file diff --git a/hackerrank/ProjectEuler/solcpp/.vscode/c_cpp_properties.json b/hackerrank/ProjectEuler/solcpp/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..1df4412 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/.vscode/c_cpp_properties.json @@ -0,0 +1,17 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "intelliSenseMode": "msvc-x64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/hackerrank/ProjectEuler/solcpp/26_reciprical_cycle.cpp b/hackerrank/ProjectEuler/solcpp/26_reciprical_cycle.cpp new file mode 100644 index 0000000..37009fd --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/26_reciprical_cycle.cpp @@ -0,0 +1,44 @@ +#include +#include +using namespace std; + +int cycle_len(int dnr){ + int seen_rem[dnr]; + for (int i=0;imax_len){ + max_len=curr; + max_num=i; + } + longest_cycle[i]=max_num; + } + while(T--){ + scanf("%d",&N); + printf("%d\n",longest_cycle[N-1]); + } + //cout< +#include +#include +#include +using namespace std; + +bool is_prime(int p) +{ + if (p < 2) + return false; + for (int i = 2; i * i <= p; i++) + { + if ((p % i) == 0) + return false; + } + return true; +} +int main() +{ + int N, max_count = 0, besta, bestb; + scanf("%d", &N); + for (int b = 2; b <= N; b++) + { + if (!(is_prime(b))) + continue; + for (int a = -b; a <= N; a++) + { + int count = 0; + for (int n = 0;; ++n) + { + int p = (n * n) + (a * n) + b; + if (is_prime(p)) + count++; + else + break; + } + if (count > max_count) + { + max_count = count; + besta = a; + bestb = b; + } + } + } + printf("%d %d\n", besta, bestb); +} diff --git a/hackerrank/ProjectEuler/solcpp/28_spiral_diagonal.cpp b/hackerrank/ProjectEuler/solcpp/28_spiral_diagonal.cpp new file mode 100644 index 0000000..4fd1d18 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/28_spiral_diagonal.cpp @@ -0,0 +1,32 @@ + +#include +#include +#include +#include + +using namespace std; +long long sum_sq(long long n) +{ + long long MOD = 1000000007; + return ((n % MOD * (2 * n + 1) % MOD * (2 * n - 1) % MOD * (1 / 3)) / 3); +} + +long long sum_even(long long n) +{ + return n * (n - 1); +} + +int main() +{ + int T; + long long MOD = 1000000007; + cin>>T; + while (T--) + { + long long N; + cin>>N; + N = long((N + 1) / 2); + cout<<(4 * sum_sq(N) - 6 * sum_even(N) - 3) % 1000000007<<'/n'; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/29_power.cpp b/hackerrank/ProjectEuler/solcpp/29_power.cpp new file mode 100644 index 0000000..2920048 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/29_power.cpp @@ -0,0 +1,52 @@ +#include +#include +#include +#include +#include +#include +using namespace std; + +typedef long long ll; + +const int MAXN = 3e6 + 100; + +int mark[MAXN]; + +ll a[50]; + +int main() +{ + int n; + scanf("%d", &n); + int x = log2(n * 1.0); + for (int i = 1; i <= x; i++) + { + ll sum = 0, t = 2 * i; + for (int j = 1; j < n; j++) + { + if (!mark[t]) + { + sum++; + mark[t] = 1; + } + t = t + i; + } + a[i] = sum; + } + memset(mark, 0, sizeof mark); + ll ans = 0; + for (ll i = 2; i <= n; i++) + { + if (!mark[i]) + { + double t = log(n * 1.0) / log(i * 1.0); + int tt = (int)(t + 0.00001); + for (ll j = 1; j <= tt; j++) + ans += a[j]; + for (ll j = i * i; j <= n; j = j * i) + mark[j] = 1; + } + } + cout << ans << endl; + return 0; +} \ No newline at end of file diff --git a/hackerrank/ProjectEuler/solcpp/31_coin_sum.cpp b/hackerrank/ProjectEuler/solcpp/31_coin_sum.cpp new file mode 100644 index 0000000..3d572fa --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/31_coin_sum.cpp @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#define tr(container, it) \ + for (typeof(container.begin()) it = container.begin(); it != container.end(); it++) +using namespace std; + +int main() +{ + int coin[] = {1, 2, 5, 10, 20, 50, 100, 200}; + long long MOD = 1000000000 + 7; + vector dp(100007, 0); + dp[0] = 1; + for (int c = 0; c < 8; c++) + { + for (long long v = coin[c]; v < 100007; v++) + dp[v] = (dp[v] + dp[v - coin[c]]) % MOD; + } + int t = 1; + cin >> t; + while (t--) + { + long long N = 10; + cin >> N; + cout << dp[N] << endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/33_digit_cancel.cpp b/hackerrank/ProjectEuler/solcpp/33_digit_cancel.cpp new file mode 100644 index 0000000..994ae47 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/33_digit_cancel.cpp @@ -0,0 +1,109 @@ +#include +#include +#include +#include + +std::string n2s(unsigned int x, unsigned int digits) +{ + std::string res; + while (digits-- > 0) + { + auto digit = x % 10; + res += char(digit + '0'); + x /= 10; + } + std::reverse(res.begin(), res.end()); + return res; +} + +unsigned int str2num(const std::string &str) +{ + unsigned int res = 0; + for (auto s : str) + { + res *= 10; + res += s - '0'; + } + return res; +} + +unsigned int merge(const std::string &strFill, const std::string &mask) +{ + auto iteFill = strFill.begin(); + unsigned int res = 0; + for (auto m : mask) + { + res *= 10; + if (m == '.') + res += *iteFill++ - '0'; + else + res += m - '0'; + } + return res; +} + +int main() +{ + unsigned int digits; + unsigned int cancel; + std::cin >> digits >> cancel; + auto keep = digits - cancel; + + const unsigned int Tens[] = {1, 10, 100, 1000, 10000}; + unsigned int sumN = 0; + unsigned int sumD = 0; + + std::unordered_set used; + + for (unsigned int d = 1; d < Tens[keep]; d++) + for (unsigned int n = 1; n < d; n++) + { + auto strN = n2s(n, keep); + auto strD = n2s(d, keep); + + for (auto insert = Tens[cancel - 1]; insert < Tens[cancel]; insert++) + { + auto strInsert = n2s(insert, cancel); + + bool isAscending = true; + for (size_t i = 1; i < strInsert.size(); i++) + if (strInsert[i - 1] > strInsert[i]) + { + isAscending = false; + break; + } + if (!isAscending) + continue; + + strInsert.insert(0, keep, '.'); + + auto strInsertN = strInsert; + do + { + auto newN = merge(strN, strInsertN); + + if (newN < Tens[digits - 1]) + continue; + + auto strInsertD = strInsert; + do + { + auto newD = merge(strD, strInsertD); + if (newN * d == newD * n) + { + auto id = newN * 10000 + newD; + if (used.count(id) == 0) + { + sumN += newN; + sumD += newD; + + used.insert(id); + } + } + } while (std::next_permutation(strInsertD.begin(), strInsertD.end())); + } while (std::next_permutation(strInsertN.begin(), strInsertN.end())); + } + } + std::cout << sumN << " " << sumD << std::endl; + return 0; +} \ No newline at end of file diff --git a/hackerrank/ProjectEuler/solcpp/44_diff_pandigial.cpp b/hackerrank/ProjectEuler/solcpp/44_diff_pandigial.cpp new file mode 100644 index 0000000..02b90e7 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/44_diff_pandigial.cpp @@ -0,0 +1,38 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#define tr(container, it) \ +for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) + using namespace std; + +void get_pandigit(vector &v, long n){ + for(long i=1;i v; + v.push_back(0); + scanf("%ld %ld",&n,&k); + get_pandigit(v,n); + set s(v.begin(),v.end()); + set ans; + for(long i=1;i0){ + if(s.find(v[i]+v[i-k])!=s.end()) + ans.insert(v[i]); + if(s.find(v[i]-v[i-k])!=s.end()) + ans.insert(v[i]); + + } + } + for(set::iterator it=ans.begin();it!=ans.end();it++) + cout<<*it< +#include +#include +#include +#include +#include +#include +#include +#define tr(container, it) \ +for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) +using namespace std; +void get_prime(vector &prime){ + for (long long i=2;i*i &prime){ + if (n<2) + return false; + if (n>1000005){ + for (long long i=2;i*i<=n;i++){ + if (n%i) + continue; + else + return false; + } + return true; + } + else + return prime[n]; +} + +int main() { + long long M=1000000+7; + vector prime(M,1); + prime[0]=prime[1]=0; + get_prime(prime); + bool prime_val; + int t=1; + cin>>t; + while(t--){ + long long N=100,len=1,max_len=0,max_val=0; + long long start=2,stop=3,s=0; + cin>>N; + while(!isprime(start,prime)) + start++; + while(!isprime(stop,prime)) + stop++; + s=stop+start; + while(s<=N){ + len++; + if (isprime(s,prime)){ + if (len>max_len){ + max_len=len; + max_val=s; + } + } + stop++; + while(!isprime(stop,prime)) + stop++; + s+=stop; + if (s>N){ + start++; + while(!isprime(start,prime)) + start++; + stop=start+1; + while(!isprime(stop,prime)) + stop++; + s=stop+start; + len=1; + } + } + cout< +#include +#include +#include +#include +#include +#include +#include +#define tr(container, it) \ +for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) +using namespace std; + +void get_primes(vector &prime){ + for (long long i=2;i digit(10,0); + while(n){ + digit[n%10]++; + n=n/10; + } + + tr(digit,it) + if(*it>=K) + return true; + return false; +} +long long vector_to_num(vector &digit){ + long long n=0; + tr(digit,i){ + n*=10; + n+=*i; + } + return n; +} + +bool set_mask(int N, int K,int L,long long n,vector &prime){ + vector ar(N-K,true); + vector digit; + while(n){ + digit.push_back(n%10); + n/=10; + + } + reverse(digit.begin(),digit.end()); + //tr(digit,i) + //cout<<*i; + //cout<<"\n number\n"; + while(K--) + ar.push_back(false); + sort(ar.begin(),ar.end()); + vector new_num(N,0); + vector prime_num; + long long t; + int count=0; + do{ + prime_num.clear(); + for(int d=0;d<10;d++){ + for(int i=0;i=L){ + sort(prime_num.begin(),prime_num.end()); + for(int i=0;i>N; + int K=2; + int L=7; + vector prime(pow(10,N),1); + prime[0]=0; + prime[1]=0; + get_primes(prime); + int n=0; + for(long long i=pow(10,N-1);i +#include +#include +#include +#include +#include +#include +#include +#include +#define tr(container, it) \ +for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) +using namespace std; + +vector split(string s){ + vector v; + stringstream ss(s); + string buf; + while (ss >> buf) + v.push_back(buf); + return v; +} + +int main() { + vector card; + string s; + int t; + cin>>t; + t=1; + getline(cin,s); + while(t--){ + getline(cin,s); + card=split(s); + } + for (int i=0;i < card.size();i++) + cout< +#include +#include +#include +#include +#include +#include +#include +#define tr(container, it) \ +for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) +using namespace std; + + +bool ispal(int n){ + bool pal=true; + vector digit; + while((n/10)>0){ + digit.push_back(n%10); + n=(int)n/10; + } + digit.push_back(n%10); + for ( int i=0;i>n; + //vector pal_num(n+1,0); + map pal_num; + int max_pal=0; + bool point=false; + int max_pal_count=0; + for(int i=1;i<=n;i++){ + if (i==89) + point=!point; + long long p=i; + int iter=1; + while(!ispal(p) and iter<60){ + iter++; + p=next_pal(p); + } + + if (pal_num.find(p)==pal_num.end()) + pal_num[p]=0; + pal_num[p]++; + if (pal_num[p]>max_pal_count){ + max_pal_count=pal_num[p]; + max_pal=p; + } + } + cout< +#include +#include +#include +#include +#include +#include +#include +#include +#define tr(container, it) \ +for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) +using namespace std; +bool isprime(long long n){ + if (n<2) + return false; + for (long long i=2;i*i<=n;i++){ + if (n%i) + continue; + else + return false; + } + return true; + + +} + +void get_prime(vector &prime){ + for (long long i=2;i*i get_diagonals(int n){ + vector diagonals; + diagonals.push_back(pow(n,2)); + diagonals.push_back(pow(n,2)-n+1); + diagonals.push_back(pow(n,2)-2*n+2); + diagonals.push_back(pow(n,2)-3*n+3); + return diagonals; +} + +int main() { + vector dia; + vector prime(10000007,1); + prime[0]=prime[1]=0; + int N=60,d=1,c=0; + float P=100.0f; + int curr_min=100; + long long pre_size; + for(N=60;N>7;N--){ + //get_prime(prime); + pre_size=1; + d=1; + c=0; + while(P>N){ + d+=2; + dia=get_diagonals(d); + for(int i=0;i +#include +#include +#include +#include +#include +#include +#include +#include +#define tr(container, it) \ +for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) +using namespace std; + + +int main() { + int ans[]={238733,74373,26241,12201,6523,3593,1883,981,713,525,463,363,309,259,227,197,109,99,89,71,53,49,49,47,45,43,39,35,33,33,31,31,31,29,27,23,13,13,13,13,11,11,11,11,11,9,9,9,5,5,5,5,5}; + int n; + cin>>n; + cout< +#include +#include +#include +#include +#include +#include +#include +#include +#define tr(container, it) \ +for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) +using namespace std; + +void get_valid(vector &valid_char){ + for (int i=48;i<58;i++) + valid_char[i]=1; + for (int i=97;i<123;i++) + valid_char[i]=1; + for (int i=65;i<91;i++) + valid_char[i]=1; + valid_char[40]=1; + valid_char[41]=1; + valid_char[33]=1; + valid_char[32]=1; + valid_char[39]=1; + valid_char[58]=1; + valid_char[59]=1; + valid_char[44]=1; + valid_char[45]=1; + valid_char[46]=1; + valid_char[63]=1; +} + +bool valid_pos(vector &valid_char,vector &input_num,int pos,int ch){ + bool valid=true; + for(int i=0;i num; + vector valid_char(123,0); + get_valid(valid_char); + int t; + char a,b,c; + cin>>n; + while(n--){ + scanf("%d",&t); + num.push_back(t); + } + bool end=true; + end=false; + for (int first=97;first<123;first++){ + if(!end){ + if (!valid_pos(valid_char,num,0,first)) + continue; + a=first; + for (int sec=97;sec<123;sec++){ + if(!end){ + if (!valid_pos(valid_char,num,1,sec)) + continue; + b=sec; + for (int thr=97;thr<123;thr++){ + if(!end){ + if (!valid_pos(valid_char,num,2,thr)) + continue; + else{ + c=thr; + end=true; + break; + } + }else + break; + } + } + else + break; + } + } + else + break; + } + cout< +#include +#include +#include +#include +#include +#include +#include +#include +#define tr(container, it) \ +for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) +using namespace std; + +bool is_cyclic(vector &num){ + int n=num.size(); + vector start(n),end(n),ans(n); + for (int i=0;i0)&&(j!=c)){ + start[j]=0; + end[c]=0; + k++; + c=j; + break; + } + } + } + if (k!=n) + return false; + else + return true; + +} +bool is_next_cycle(int a,int b){ + if(((a/100)==(b%100))||((b/100)==(a%100))) + return true; + return false; +} + +int polygon_num(int p, int n){ + switch(p){ + case 3: + return(n*(n+1)/2); + case 4: + return(n*n); + case 5: + return(n*(3*n-1)/2); + case 6: + return(n*(2*n-1)); + case 7: + return(n*(5*n-3)/2); + case 8: + return(n*(3*n-2)); + } +} + +void permut(vector &p){ + sort(p.begin(),p.end()); + do{ + + tr(p,i) + cout<<*i<<","; + cout<>m; + vector p(m); + for(int i=0;i<3;i++){ + int t; + scanf("%d",&t); + p[i]=t; + } + set ans; + sort(p.begin(),p.end()); + do{ + vector< vector > poly(3); + for(int i=0;i<3;i++){ + int v=0,n=1; + v=polygon_num(p[i],n); + while(v<10000){ + poly[i].push_back(v); + n++; + v=polygon_num(p[i],n); + } + } + + for(int i=0;i9999)) + continue; + for(int j=0;j9999)) + continue; + if(is_next_cycle(poly[0][i],poly[1][j])){ + for(int k=0;k9999)) + continue; + vector tmp; + tmp.push_back(poly[0][i]); + tmp.push_back(poly[2][k]); + tmp.push_back(poly[1][j]); + if((is_cyclic(tmp) && (i!=j)&&(j!=k)&&(i!=k))){ + ans.insert(poly[0][i]+poly[1][j]+poly[2][k]); + b++; + } + } + } + } + } + + tr(p,i) + cout<<*i<<","; + for(set::iterator i =ans.begin();i!=ans.end();i++) + cout<<*i< +#include +#include +using namespace std; +int main(){ + int n; + scanf("%d",&n); + while(n--){ + int r; + scanf("%d",&r); + int data[r][r]; + for (int i=0;i0){ + if (j==0) + left=0; + else + left=data[i-1][j-1]; + if(i==j) + right=0; + else + right=data[i-1][j]; + //cout< +#include +#include +#include +#include +#include +#include +#include +#define tr(container, it) \ +for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) +using namespace std; + + +int main() { + int max_num=100; + int coin[max_num]; + for (int i=0;idp(max_num,0); + dp[0]=1; + for(int c=0;c>t; + while(t--){ + long long N=6; + cin>>N; + cout< +#include +#include +#include +#include +#include +#include +#include +#define tr(container, it) \ +for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) +using namespace std; + + +int main() { + int coin[]={2, 3, 5, 7, 11,13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73,79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139,149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211,223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281,283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367,373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443,449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523,541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613,617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691,701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787,797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877,881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971,977, 983, 991, 997}; + vector dp(1007,0); + dp[0]=1; + for(int c=0;c<8;c++){ + for(long long v=coin[c];v<1007;v++) + dp[v]=(dp[v]+dp[v-coin[c]]); + } + int t=1; + cin>>t; + while(t--){ + long long N=10; + cin>>N; + cout< +#include +#include +#include +#include +#include +#include +#include +#include +#define tr(container, it) \ +for(typeof(container.begin()) it = container.begin(); it != container.end(); it++) +using namespace std; + + +void get_fact_sum(vector &fact_sum,long long Max){ + for (long long i=3;i > &chain, vector fact_sum,long long Max){ + long long next,start; + bool is_present; + for (long long i=6;i tmp; + next=i; + while(true){ + is_present=find(tmp.begin(),tmp.end(),next)!=tmp.end(); + if (is_present){ + chain.push_back(tmp); + tr(tmp,i) + fact_sum[*i]=0; + break; + } + tmp.push_back(next); + next=fact_sum[next]; + if ((next>Max)||(next<2)) + break; + } + + } +} + +int main() { + long long Max=1000007; + vector fact_sum(Max,1); + vector< vector > chain(Max); + long long max_chain=0; + fact_sum[0]=fact_sum[1]=0; + get_fact_sum(fact_sum,Max); + get_chain(chain,fact_sum,Max); + for (long long c=0;c0){ + cout<max_chain){ + max_chain=c; + } + for (long long i=0;i +#include + +using namespace std; + +int ComputeFactorial(int number) { + int fact = 0; + + for (int j = 1; j <= number; j++) { + fact = fact * j; + } + + return fact; +} + +double ComputeSeriesValue(double x, int n) { + double seriesValue = 0.0; + double xpow = 1; + + for (int k = 0; k <= n; k++) { + seriesValue += xpow / ComputeFactorial(k); + xpow = xpow * x; + } + + return seriesValue; +} + +int main() { + cout << "This program is used to compute the value of the following series : " << endl; + + cout << "(x^0)/0! + (x^1)/1! + (x^2)/2! + (x^3)/3! + (x^4)/4! + ........ + (x^n)/n! " << endl; + + cout << "Please enter the value of x : " ; + + double x; + cin >> x; + + int n; + cout << endl << "Please enter an integer value for n : " ; + cin >> n; + cout << endl; + + double seriesValue = ComputeSeriesValue(x, n); + cout << "The value of the series for the values entered is " + << seriesValue << endl; + + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0001.cpp b/hackerrank/ProjectEuler/solcpp/euler-0001.cpp new file mode 100644 index 0000000..5dff487 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0001.cpp @@ -0,0 +1,21 @@ +#include +unsigned long long sum(unsigned long long x) +{ + return x * (x + 1) / 2; +} +int main() +{ + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned long long last; + std::cin >> last; + last--; + auto sumThree = 3 * sum(last / 3); + auto sumFive = 5 * sum(last / 5); + auto sumFifteen = 15 * sum(last / 15); + std::cout << (sumThree + sumFive - sumFifteen) << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0002.cpp b/hackerrank/ProjectEuler/solcpp/euler-0002.cpp new file mode 100644 index 0000000..ff34b9c --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0002.cpp @@ -0,0 +1,24 @@ +#include +int main() +{ + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned long long last; + std::cin >> last; + unsigned long long sum = 0; + unsigned long long a = 1; + unsigned long long b = 2; + while (b <= last) + { + if (b % 2 == 0) + sum += b; + auto next = a + b; + a = b; + b = next; + } + std::cout << sum << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0003.cpp b/hackerrank/ProjectEuler/solcpp/euler-0003.cpp new file mode 100644 index 0000000..81aea75 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0003.cpp @@ -0,0 +1,16 @@ +#include +int main() +{ + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned long long x; + std::cin >> x; + for (unsigned long long factor = 2; factor * factor <= x; factor++) + while (x % factor == 0 && x != factor) + x /= factor; + std::cout << x << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0004.cpp b/hackerrank/ProjectEuler/solcpp/euler-0004.cpp new file mode 100644 index 0000000..ea21642 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0004.cpp @@ -0,0 +1,37 @@ +#include +unsigned int makePalindrome(unsigned int x) +{ + unsigned int result = x * 1000; + result += x / 100; + result += ((x / 10) % 10) * 10; + result += (x % 10) * 100; + return result; +} +int main() +{ + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int maximum; + std::cin >> maximum; + bool found = false; + for (auto upper3 = maximum / 1000; upper3 >= 100 && !found; upper3--) + { + auto palindrome = makePalindrome(upper3); + if (palindrome >= maximum) + continue; + for (unsigned int i = 100; i * i <= palindrome; i++) + if (palindrome % i == 0) + { + auto other = palindrome / i; + if (other < 100 || other > 999) + continue; + std::cout << palindrome << std::endl; + found = true; + break; + } + } + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0005.cpp b/hackerrank/ProjectEuler/solcpp/euler-0005.cpp new file mode 100644 index 0000000..bda0004 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0005.cpp @@ -0,0 +1,30 @@ +#include +unsigned long long gcd(unsigned long long a, unsigned long long b) +{ + while (a != 0) + { + unsigned long long c = a; + a = b % a; + b = c; + } + return b; +} +unsigned long long lcm(unsigned long long a, unsigned long long b) +{ + return a * (b / gcd(a, b)); +} +int main() +{ + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int x; + std::cin >> x; + unsigned long long result = 1; + for (unsigned int i = 2; i <= x; i++) + result = lcm(result, i); + std::cout << result << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0006.cpp b/hackerrank/ProjectEuler/solcpp/euler-0006.cpp new file mode 100644 index 0000000..d211b5b --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0006.cpp @@ -0,0 +1,21 @@ +#include +int main() +{ + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned long long x; + std::cin >> x; + unsigned long long sum = 0; + unsigned long long sumSquared = 0; + for (unsigned long long i = 1; i <= x; i++) + { + sum += i; + sumSquared += i*i; + } + unsigned long long squaredSum = sum * sum; + std::cout << (squaredSum - sumSquared) << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0007.cpp b/hackerrank/ProjectEuler/solcpp/euler-0007.cpp new file mode 100644 index 0000000..7608133 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0007.cpp @@ -0,0 +1,37 @@ +#include +#include +int main() +{ + std::vector primes; + primes.reserve(10001); + primes.push_back(2); + for (unsigned int x = 3; primes.size() <= 10000; x += 2) + { + bool isPrime = true; + for (auto p : primes) + { + if (x % p == 0) + { + isPrime = false; + break; + } + if (p*p > x) + break; + } + if (isPrime) + primes.push_back(x); + } + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int x; + std::cin >> x; + x--; + if (x < primes.size()) + std::cout << primes[x] << std::endl; + else + std::cout << "ERROR" << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0008.cpp b/hackerrank/ProjectEuler/solcpp/euler-0008.cpp new file mode 100644 index 0000000..39fb433 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0008.cpp @@ -0,0 +1,25 @@ +#include +#include +int main() +{ + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int length; + unsigned int span; + std::string number; + std::cin >> length >> span >> number; + unsigned long long best = 0; + for (int start = 0; start + span < length; start++) + { + unsigned long long current = 1; + for (unsigned int i = 0; i < span; i++) + current *= number[start + i] - '0'; + if (best < current) + best = current; + } + std::cout << best << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0009.cpp b/hackerrank/ProjectEuler/solcpp/euler-0009.cpp new file mode 100644 index 0000000..e96fa48 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0009.cpp @@ -0,0 +1,31 @@ +#include +#include +#include +int main() +{ + const int MaxPerimeter = 3000; + const int NoSolution = -1; + std::vector cache(MaxPerimeter + 1, NoSolution); + for (int a = 1; a < MaxPerimeter; a++) + for (int b = a + 1; b < MaxPerimeter - a; b++) + { + int c2 = a*a + b*b; + int c = sqrt(c2); + if (c*c != c2) + continue; + int sum = a + b + c; + if (sum > MaxPerimeter) + break; + if (cache[sum] < a*b*c) + cache[sum] = a*b*c; + } + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int n; + std::cin >> n; + std::cout << cache[n] << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0010.cpp b/hackerrank/ProjectEuler/solcpp/euler-0010.cpp new file mode 100644 index 0000000..6f35c29 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0010.cpp @@ -0,0 +1,43 @@ +#include +#include +#include +int main() +{ + const unsigned int MaxPrime = 2000000; + std::vector primes; + primes.push_back(2); + for (unsigned int i = 3; i <= MaxPrime; i += 2) + { + bool isPrime = true; + for (auto p : primes) + { + if (p*p > i) + break; + if (i % p == 0) + { + isPrime = false; + break; + } + } + if (isPrime) + primes.push_back(i); + } + std::map sums; + unsigned long long sum = 0; + for (auto p : primes) + { + sum += p; + sums[p] = sum; + } + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int x; + std::cin >> x; + auto i = sums.upper_bound(x); + i--; + std::cout << i->second << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0011.cpp b/hackerrank/ProjectEuler/solcpp/euler-0011.cpp new file mode 100644 index 0000000..dc70553 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0011.cpp @@ -0,0 +1,40 @@ +#include +int main() +{ + const unsigned int Size = 20; + unsigned int matrix[Size][Size]; + for (unsigned int y = 0; y < Size; y++) + for (unsigned int x = 0; x < Size; x++) + std::cin >> matrix[x][y]; + unsigned int best = 0; + for (unsigned int y = 0; y < Size; y++) + for (unsigned int x = 0; x < Size; x++) + { + if (x + 3 < Size) + { + unsigned int current = matrix[x][y] * matrix[x+1][y] * matrix[x+2][y] * matrix[x+3][y]; + if (best < current) + best = current; + } + if (y + 3 < Size) + { + unsigned int current = matrix[x][y] * matrix[x][y+1] * matrix[x][y+2] * matrix[x][y+3]; + if (best < current) + best = current; + } + if (x + 3 < Size && y + 3 < Size) + { + unsigned int current = matrix[x][y] * matrix[x+1][y+1] * matrix[x+2][y+2] * matrix[x+3][y+3]; + if (best < current) + best = current; + } + if (x + 3 < Size && y >= 3) + { + unsigned int current = matrix[x][y] * matrix[x+1][y-1] * matrix[x+2][y-2] * matrix[x+3][y-3]; + if (best < current) + best = current; + } + } + std::cout << best << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0012.cpp b/hackerrank/ProjectEuler/solcpp/euler-0012.cpp new file mode 100644 index 0000000..06547c0 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0012.cpp @@ -0,0 +1,38 @@ +#include +#include +int main() +{ + const unsigned int MaxDivisors = 1000; + std::vector smallest; + smallest.push_back(0); + unsigned int index = 0; + unsigned int triangle = 0; + while (smallest.size() < MaxDivisors) + { + index++; + triangle += index; + if (smallest.size() > 300 && triangle % 10 != 0) + continue; + unsigned int divisors = 0; + unsigned int i = 1; + while (i*i < triangle) + { + if (triangle % i == 0) + divisors += 2; + i++; + } + if (i*i == triangle) + divisors++; + while (smallest.size() <= divisors) + smallest.push_back(triangle); + } + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int minDivisors; + std::cin >> minDivisors; + std::cout << smallest[minDivisors + 1] << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0013.cpp b/hackerrank/ProjectEuler/solcpp/euler-0013.cpp new file mode 100644 index 0000000..439728c --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0013.cpp @@ -0,0 +1,37 @@ +#include +#include +#include +int main() +{ + const unsigned int MinDigits = 50 + 10; + std::vector sum(MinDigits, 0); + unsigned int numbers = 100; +#ifndef ORIGINAL + std::cin >> numbers; +#endif + while (numbers--) + { + std::string strAdd; + std::cin >> strAdd; + std::vector add; + for (auto i = strAdd.rbegin(); i != strAdd.rend(); i++) + add.push_back(*i - '0'); + add.resize(sum.size(), 0); + for (unsigned int i = 0; i < add.size(); i++) + { + sum[i] += add[i]; + if (sum[i] >= 10) + { + sum[i + 1]++; + sum[i] -= 10; + } + } + } + auto i = sum.rbegin(); + while (*i == 0) + i++; + unsigned int numDigits = 10; + while (numDigits-- > 0) + std::cout << *i++; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0014.cpp b/hackerrank/ProjectEuler/solcpp/euler-0014.cpp new file mode 100644 index 0000000..963bba9 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0014.cpp @@ -0,0 +1,45 @@ +#include +#include +#include +const size_t MaxN = 5000000 + 2; +const int Unknown = -1; +std::vector cache(MaxN, Unknown); +unsigned short steps(unsigned long long x) +{ + if (x == 1) + return 1; + if (x < cache.size() && cache[x] != Unknown) + return cache[x]; + long long next; + if (x % 2 == 0) + next = x / 2; + else + next = 3 * x + 1; + auto result = 1 + steps(next); + if (x < cache.size()) + cache[x] = result; + return result; +} +int main() +{ + std::map longest; + unsigned int maxTested = 1; + longest[maxTested] = 1; + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int x; + std::cin >> x; + for (; maxTested <= x; maxTested++) + { + auto length = steps(maxTested); + if (length >= longest.rbegin()->second) + longest[maxTested] = length; + } + auto best = longest.upper_bound(x); + best--; + std::cout << best->first << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0015.cpp b/hackerrank/ProjectEuler/solcpp/euler-0015.cpp new file mode 100644 index 0000000..7ba8de9 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0015.cpp @@ -0,0 +1,47 @@ +#include +#include +#include +#include +int main() +{ + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int width, height; + std::cin >> width >> height; + const unsigned long long Unknown = 0; + std::vector> grid(width + 1); + for (auto& column : grid) + column.resize(height + 1, Unknown); + grid[width][height] = 1; + std::deque> next; + next.push_back(std::make_pair(width - 1, height)); + next.push_back(std::make_pair(width, height - 1)); + while (!next.empty()) + { + auto current = next.front(); + next.pop_front(); + auto x = current.first; + auto y = current.second; + if (grid[x][y] != Unknown) + continue; + unsigned long long routes = 0; + if (x < width) + routes += grid[x + 1][y]; + if (y < height) + routes += grid[x][y + 1]; +#define ORIGINAL +#ifndef ORIGINAL + routes %= 1000000007; +#endif + grid[x][y] = routes; + if (x > 0) + next.push_back(std::make_pair(x - 1, y)); + if (y > 0) + next.push_back(std::make_pair(x, y - 1)); + } + std::cout << grid[0][0] << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0016.cpp b/hackerrank/ProjectEuler/solcpp/euler-0016.cpp new file mode 100644 index 0000000..e10fa4a --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0016.cpp @@ -0,0 +1,41 @@ +#include +#include +typedef std::vector Digits; +int main() +{ + std::vector cache; + cache.push_back({ 1 }); + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int exponent; + std::cin >> exponent; + for (unsigned int current = cache.size(); current <= exponent; current++) + { + auto power = cache.back(); + unsigned int carry = 0; + for (auto& i : power) + { + i = 2 * i + carry; + if (i >= 10) + { + i -= 10; + carry = 1; + } + else + { + carry = 0; + } + } + if (carry != 0) + power.push_back(carry); + cache.push_back(power); + } + unsigned int sum = 0; + for (auto i : cache[exponent]) + sum += i; + std::cout << sum << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0017.cpp b/hackerrank/ProjectEuler/solcpp/euler-0017.cpp new file mode 100644 index 0000000..3e3e997 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0017.cpp @@ -0,0 +1,114 @@ +#include +#include +std::string convert(unsigned long long x) +{ +#ifdef ORIGINAL + const std::string Gap = " And "; + const std::string ConnectTensAndOnes = "-"; +#else + const std::string Gap = " "; + const std::string ConnectTensAndOnes = " "; +#endif + switch(x) + { + case 0: return "Zero"; + case 1: return "One"; + case 2: return "Two"; + case 3: return "Three"; + case 4: return "Four"; + case 5: return "Five"; + case 6: return "Six"; + case 7: return "Seven"; + case 8: return "Eight"; + case 9: return "Nine"; + case 10: return "Ten"; + case 11: return "Eleven"; + case 12: return "Twelve"; + case 13: return "Thirteen"; + case 14: return "Fourteen"; + case 15: return "Fifteen"; + case 16: return "Sixteen"; + case 17: return "Seventeen"; + case 18: return "Eighteen"; + case 19: return "Nineteen"; + default: break; + } + if (x >= 20 && x < 100) + { + auto ones = x % 10; + auto tens = x / 10; + auto strOnes = (ones != 0) ? ConnectTensAndOnes + convert(ones) : ""; + switch (tens) + { + case 2: return "Twenty" + strOnes; + case 3: return "Thirty" + strOnes; + case 4: return "Forty" + strOnes; + case 5: return "Fifty" + strOnes; + case 6: return "Sixty" + strOnes; + case 7: return "Seventy" + strOnes; + case 8: return "Eighty" + strOnes; + case 9: return "Ninety" + strOnes; + default: break; + } + } + if (x >= 100 && x < 1000) + { + auto onesAndTens = x % 100; + auto hundreds = x / 100; + auto strOnesAndTens = (onesAndTens != 0) ? Gap + convert(onesAndTens) : ""; + return convert(hundreds) + " Hundred" + strOnesAndTens; + } + if (x >= 1000 && x < 1000000) + { + auto low = x % 1000; + auto high = x / 1000; + auto strLow = (low != 0) ? Gap + convert(low) : ""; + return convert(high) + " Thousand" + strLow; + } + if (x >= 1000000 && x < 1000000000) + { + auto low = x % 1000000; + auto high = x / 1000000; + auto strLow = (low != 0) ? Gap + convert(low) : ""; + return convert(high) + " Million" + strLow; + } + if (x >= 1000000000 && x < 1000000000000ULL) + { + auto low = x % 1000000000; + auto high = x / 1000000000; + auto strLow = (low != 0) ? Gap + convert(low) : ""; + return convert(high) + " Billion" + strLow; + } + if (x >= 1000000000000ULL && x < 1000000000000000ULL) + { + auto low = x % 1000000000000ULL; + auto high = x / 1000000000000ULL; + auto strLow = (low != 0) ? Gap + convert(low) : ""; + return convert(high) + " Trillion" + strLow; + } + return "?"; +} +int main() +{ +#ifdef ORIGINAL + unsigned int sum = 0; + for (unsigned int i = 1; i <= 1000; i++) + { + auto name = convert(i); + for (auto c : name) + if (std::isalpha(c)) + sum++; + } + std::cout << sum << std::endl; +#else + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned long long x; + std::cin >> x; + std::cout << convert(x) << std::endl; + } +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0018.cpp b/hackerrank/ProjectEuler/solcpp/euler-0018.cpp new file mode 100644 index 0000000..79f3a00 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0018.cpp @@ -0,0 +1,40 @@ +#include +#include +#include +int main() +{ + unsigned int tests = 1; +#ifndef ORIGINAL + std::cin >> tests; +#endif + while (tests--) + { + unsigned int numRows = 15; +#ifndef ORIGINAL + std::cin >> numRows; +#endif + std::vector last(1); + std::cin >> last[0]; + for (unsigned int row = 1; row < numRows; row++) + { + unsigned int numElements = row + 1; + std::vector current; + for (unsigned int column = 0; column < numElements; column++) + { + unsigned int x; + std::cin >> x; + unsigned int leftParent = 0; + if (column > 0) + leftParent = last[column - 1]; + unsigned int rightParent = 0; + if (column < last.size()) + rightParent = last[column]; + unsigned int sum = x + std::max(leftParent, rightParent); + current.push_back(sum); + } + last = current; + } + std::cout << *std::max_element(last.begin(), last.end()) << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0019.cpp b/hackerrank/ProjectEuler/solcpp/euler-0019.cpp new file mode 100644 index 0000000..6ce6dbe --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0019.cpp @@ -0,0 +1,63 @@ +#include +const unsigned int Sunday = 1; +unsigned int getWeekday(unsigned long long year, unsigned int month, unsigned int day) +{ + if (month <= 2) + { + month += 12; + year--; + } + return (day + + 13 * (month + 1) / 5 + + year + year / 4 - year / 100 + year / 400) + % 7; +} +int main() +{ + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned long long year1, year2; + unsigned int month1, month2, day1, day2; + std::cin >> year1 >> month1 >> day1; + std::cin >> year2 >> month2 >> day2; + if (year2 < year1 || (year2 == year1 && month2 < month1)) + { + std::swap(year1, year2); + std::swap(month1, month2); + } + unsigned long long currentYear = year1; + unsigned int currentMonth = month1; + if (day1 > 1) + { + currentMonth++; + if (currentMonth > 12) + { + currentMonth -= 12; + currentYear++; + } + } + unsigned int sum = 0; + while (currentYear + 2800 < year2) + { + currentYear += 2800; + sum += 4816; + } + while (currentMonth < month2 || currentYear < year2) + { + if (getWeekday(currentYear, currentMonth, 1) == Sunday) + sum++; + currentMonth++; + if (currentMonth > 12) + { + currentMonth -= 12; + currentYear++; + } + } + if (getWeekday(currentYear, currentMonth, 1) == Sunday) + sum++; + std::cout << sum << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0020.cpp b/hackerrank/ProjectEuler/solcpp/euler-0020.cpp new file mode 100644 index 0000000..dde7678 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0020.cpp @@ -0,0 +1,44 @@ +#include +#include +typedef std::vector Digits; +Digits factorial(unsigned int maxFactor) +{ + Digits result = { 1 }; + result.reserve(2568); + for (unsigned int factor = 2; factor <= maxFactor; factor++) + { + unsigned int carry = 0; + for (auto& digit : result) + { + digit = digit * factor + carry; + if (digit >= 10) + { + carry = digit / 10; + digit %= 10; + } + else + carry = 0; + } + while (carry != 0) + { + result.push_back(carry % 10); + carry /= 10; + } + } + return result; +} +int main() +{ + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int number; + std::cin >> number; + unsigned int sum = 0; + for (auto i : factorial(number)) + sum += i; + std::cout << sum << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0021.cpp b/hackerrank/ProjectEuler/solcpp/euler-0021.cpp new file mode 100644 index 0000000..45deb44 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0021.cpp @@ -0,0 +1,45 @@ +#include +#include +unsigned int getSum(unsigned int x) +{ + unsigned int divisorSum = 1; + for (unsigned int divisor = 2; divisor * divisor <= x; divisor++) + if (x % divisor == 0) + { + divisorSum += divisor; + auto otherDivisor = x / divisor; + if (otherDivisor != divisor) + divisorSum += otherDivisor; + } + return divisorSum; +} +int main() +{ + std::set amicables; + const unsigned int MaxAmicable = 100000; + for (unsigned int i = 2; i <= MaxAmicable; i++) + { + auto sibling = getSum(i); + if (i == getSum(sibling) && i != sibling) + { + amicables.insert(i); + amicables.insert(sibling); + } + } + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int x; + std::cin >> x; + unsigned int sum = 0; + for (auto i : amicables) + { + if (i > x) + break; + sum += i; + } + std::cout << sum << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0022.cpp b/hackerrank/ProjectEuler/solcpp/euler-0022.cpp new file mode 100644 index 0000000..6e518f7 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0022.cpp @@ -0,0 +1,71 @@ +#include +#include +#include +#include +std::string readName() +{ + std::string result; + while (true) + { + char c = std::cin.get(); + if (!std::cin) + break; + if (c == '"') + continue; + if (c == ',') + break; + result += c; + } + return result; +} +int main() +{ + std::set names; +#ifdef ORIGINAL + while (true) + { + auto name = readName(); + if (name.empty()) + break; + names.insert(name); + } +#else + unsigned int numNames; + std::cin >> numNames; + while (numNames--) + { + std::string name; + std::cin >> name; + names.insert(name); + } +#endif + std::map sorted; + unsigned int pos = 1; + for (auto name : names) + sorted[name] = pos++; +#ifdef ORIGINAL + unsigned int sum = 0; + for (auto name : sorted) + { + unsigned int value = 0; + for (auto c : name.first) + value += c - 'A' + 1; + sum += value * name.second; + } + std::cout << sum << std::endl; +#else + unsigned int queries; + std::cin >> queries; + while (queries--) + { + std::string name; + std::cin >> name; + unsigned int value = 0; + for (auto c : name) + value += c - 'A' + 1; + value *= sorted[name]; + std::cout << value << std::endl; + } +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0023.cpp b/hackerrank/ProjectEuler/solcpp/euler-0023.cpp new file mode 100644 index 0000000..fb8f0d0 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0023.cpp @@ -0,0 +1,57 @@ +#include +#include +const unsigned int EverythingsASumFromHere = 28124; +std::set abundant; +unsigned int getSum(unsigned int x) +{ + unsigned int divisorSum = 1; + for (unsigned int divisor = 2; divisor * divisor <= x; divisor++) + if (x % divisor == 0) + { + divisorSum += divisor; + unsigned int otherDivisor = x / divisor; + if (otherDivisor != divisor) + divisorSum += otherDivisor; + } + return divisorSum; +} +bool isAbundantSum(unsigned int x) +{ + if (x >= EverythingsASumFromHere) + return true; + for (auto i : abundant) + { + if (i >= x) + return false; + unsigned int other = x - i; + if (abundant.count(other) == 0) + continue; + return true; + } + return false; +} +int main() +{ + for (unsigned int i = 1; i < EverythingsASumFromHere; i++) + if (getSum(i) > i) + abundant.insert(i); +#ifdef ORIGINAL + unsigned long long sum = 0; + for (unsigned int i = 0; i < EverythingsASumFromHere; i++) + { + if (!isAbundantSum(i)) + sum += i; + } + std::cout << sum << std::endl; +#else + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int x; + std::cin >> x; + std::cout << (isAbundantSum(x) ? "YES" : "NO") << std::endl; + } +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0024.cpp b/hackerrank/ProjectEuler/solcpp/euler-0024.cpp new file mode 100644 index 0000000..cbd5ca5 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0024.cpp @@ -0,0 +1,38 @@ +#include +#include +#include +int main() +{ +#ifdef ORIGINAL + unsigned int numPermutation = 1000000; + std::string current = "0123456789"; + while (--numPermutation) + std::next_permutation(current.begin(), current.end()); + std::cout << current << std::endl; +#else + const std::string abc = "abcdefghijklm"; + unsigned int tests; + std::cin >> tests; + while (tests--) + { + const unsigned long long factorials[13+1] = + { 1,1,2,6,24,120,720,5040,40320,362880,3628800,39916800,479001600,6227020800 }; + unsigned long long x; + std::cin >> x; + x %= factorials[abc.size()]; + x--; + auto remain = abc; + std::string result; + while (!remain.empty()) + { + auto currentFactorial = factorials[remain.size() - 1]; + auto pos = x / currentFactorial; + result += remain[pos]; + remain.erase(pos, 1); + x %= currentFactorial; + } + std::cout << result << std::endl; + } +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0025.cpp b/hackerrank/ProjectEuler/solcpp/euler-0025.cpp new file mode 100644 index 0000000..77c7886 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0025.cpp @@ -0,0 +1,53 @@ +#include +#include +typedef std::vector Digits; +const unsigned int MaxDigits = 5000; +Digits add(const Digits& a, const Digits& b) +{ + Digits result = b; + unsigned int carry = 0; + for (unsigned int i = 0; i < result.size(); i++) + { + if (i < a.size()) + result[i] += a[i]; + result[i] += carry; + if (result[i] >= 10) + { + carry = 1; + result[i] -= 10; + } + else + carry = 0; + } + if (carry != 0) + result.push_back(carry); + return result; +} +int main() +{ + std::vector cache = { 0, 1 }; + cache.reserve(MaxDigits); + Digits a = { 1 }; + Digits b = { 1 }; + unsigned int fiboIndex = 2; + while (cache.size() <= MaxDigits) + { + fiboIndex++; + auto next = add(a, b); + a = std::move(b); + b = std::move(next); + auto numDigits = b.size(); + auto largestKnown = cache.size() - 1; + if (largestKnown < numDigits) + cache.push_back(fiboIndex); + } + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int numDigits; + std::cin >> numDigits; + std::cout << cache[numDigits] << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0026.cpp b/hackerrank/ProjectEuler/solcpp/euler-0026.cpp new file mode 100644 index 0000000..e95d156 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0026.cpp @@ -0,0 +1,48 @@ +#include +#include +unsigned int cycleLength(unsigned int x) +{ + if (x == 0) + return 0; + const unsigned int NotSeenYet = 0; + std::vector lastPos(x, NotSeenYet); + unsigned int position = 1; + unsigned int dividend = 1; + while (true) + { + unsigned int remainder = dividend % x; + if (remainder == 0) + return 0; + if (lastPos[remainder] != NotSeenYet) + return position - lastPos[remainder]; + lastPos[remainder] = position; + position++; + dividend = remainder * 10; + } +} +int main() +{ + const unsigned int MaxDenominator = 10000; + std::vector cache = { 0 }; + unsigned int longestDenominator = 0; + unsigned int longestCycle = 0; + for (unsigned int denominator = 1; denominator <= MaxDenominator; denominator++) + { + auto length = cycleLength(denominator); + if (longestCycle < length) + { + longestCycle = length; + longestDenominator = denominator; + } + cache.push_back(longestDenominator); + } + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int x; + std::cin >> x; + std::cout << cache[x - 1] << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0027.cpp b/hackerrank/ProjectEuler/solcpp/euler-0027.cpp new file mode 100644 index 0000000..a93a5d3 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0027.cpp @@ -0,0 +1,40 @@ +#include +bool isPrime(int x) +{ + if (x <= 1) + return false; + for (int factor = 2; factor*factor <= x; factor++) + if (x % factor == 0) + return false; + return true; +} +int main() +{ + int limit; + std::cin >> limit; + if (limit < 0) + limit = -limit; + unsigned int consecutive = 0; + int bestA = 0; + int bestB = 0; + for (int a = -limit; a <= +limit; a++) + for (int b = -limit; b <= +limit; b++) + { + unsigned int length = 0; + while (isPrime(length * length + a * length + b)) + length++; + if (consecutive < length) + { + consecutive = length; + bestA = a; + bestB = b; + } + } +#define ORIGINAL +#ifdef ORIGINAL + std::cout << (bestA * bestB) << std::endl; +#else + std::cout << bestA << " " << bestB << std::endl; +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0028.cpp b/hackerrank/ProjectEuler/solcpp/euler-0028.cpp new file mode 100644 index 0000000..9bc6880 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0028.cpp @@ -0,0 +1,43 @@ +#include +unsigned int powmod(unsigned long long base, unsigned int exponent, unsigned int modulo) +{ + unsigned long long result = 1; + while (exponent > 0) + { + if (exponent % 2 == 1) + { + result = (result * base) % modulo; + exponent--; + } + else + { + base = (base * base) % modulo; + exponent /= 2; + } + } + return result; +} +unsigned int inverseModulo(unsigned int a, unsigned int modulo) +{ + return powmod(a, modulo - 2, modulo); +} +int main() +{ + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned long long n; + std::cin >> n; + unsigned long long sum = 1; + unsigned long long x = n / 2; + const unsigned int Modulo = 1000000007; + x %= Modulo; + unsigned long long sharedTerm = (2*x * (x + 1)) % Modulo; + unsigned long long sum1 = ((4 * sharedTerm * (2*x + 1)) % Modulo) * inverseModulo(3, Modulo); + unsigned long long sum2 = sharedTerm + 4*x + 1; + sum = (sum1 % Modulo + sum2 % Modulo) % Modulo; + std::cout << sum << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0029.cpp b/hackerrank/ProjectEuler/solcpp/euler-0029.cpp new file mode 100644 index 0000000..27cd106 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0029.cpp @@ -0,0 +1,45 @@ +#include +#include +int main() +{ + unsigned int maxExponent; + std::cin >> maxExponent; + const unsigned int MaxBasePower = 16; + std::vector minExponent((maxExponent+1)*MaxBasePower); + for (unsigned int i = 1; i <= MaxBasePower; i++) + for (unsigned int j = 1; j <= maxExponent; j++) + if (minExponent[i*j] == 0) + minExponent[i*j] = i; + std::vector base(maxExponent + 1, 0); + unsigned int repeated = 0; + for (unsigned int x = 2; x <= maxExponent; x++) + { + auto parent = base[x]; + if (parent == 0) + { + auto power = x * x; + while (power <= maxExponent) + { + base[power] = x; + power *= x; + } + continue; + } + unsigned int exponent = 0; + auto reduce = x; + while (reduce > 1) + { + reduce /= parent; + exponent++; + } + for (unsigned int y = 2; y <= maxExponent; y++) + { + if (minExponent[y * exponent] < exponent) + repeated++; + } + } + unsigned long long all = maxExponent - 1; + auto result = all*all - repeated; + std::cout << result << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0030.cpp b/hackerrank/ProjectEuler/solcpp/euler-0030.cpp new file mode 100644 index 0000000..fd93d7c --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0030.cpp @@ -0,0 +1,25 @@ +#include +int main() +{ + unsigned int exponent; + std::cin >> exponent; + unsigned int sum = 0; + for (unsigned int i = 2; i <= 7*9*9*9*9*9*9; i++) + { + unsigned int thisSum = 0; + unsigned int reduce = i; + while (reduce > 0) + { + unsigned int digit = reduce % 10; + reduce /= 10; + unsigned int power = 1; + for (unsigned int j = 1; j <= exponent; j++) + power *= digit; + thisSum += power; + } + if (thisSum == i) + sum += i; + } + std::cout << sum << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0031.cpp b/hackerrank/ProjectEuler/solcpp/euler-0031.cpp new file mode 100644 index 0000000..4505083 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0031.cpp @@ -0,0 +1,38 @@ +#include +#include +const unsigned int NumCoins = 8; +const unsigned int Coins[NumCoins] = { 1,2,5,10,20,50,100,200 }; +typedef std::vector Combinations; +int main() +{ + std::vector history; + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int total; + std::cin >> total; + for (unsigned int cents = history.size(); cents <= total; cents++) + { + Combinations ways(NumCoins); + ways[0] = 1; + for (size_t i = 1; i < ways.size(); i++) + { + ways[i] = ways[i - 1]; + auto currentCoin = Coins[i]; + if (cents >= currentCoin) + { + auto remaining = cents - currentCoin; + ways[i] += history[remaining][i]; + } + ways[i] %= 1000000007; + } + history.push_back(ways); + } + auto result = history[total]; + auto combinations = result.back(); + combinations %= 1000000007; + std::cout << combinations << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0032.cpp b/hackerrank/ProjectEuler/solcpp/euler-0032.cpp new file mode 100644 index 0000000..13d0ae8 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0032.cpp @@ -0,0 +1,48 @@ +#include +#include +#include +#include +int main() +{ + unsigned int maxDigit; + std::cin >> maxDigit; + std::vector digits = { 1,2,3,4,5,6,7,8,9 }; + digits.resize(maxDigit); + std::set valid; + do + { + for (unsigned int lenA = 1; lenA < maxDigit; lenA++) + for (unsigned int lenB = 1; lenB < maxDigit - lenA; lenB++) + { + unsigned int lenC = maxDigit - lenA - lenB; + if (lenC < lenA || lenC < lenB) + break; + unsigned int pos = 0; + unsigned int a = 0; + for (unsigned int i = 1; i <= lenA; i++) + { + a *= 10; + a += digits[pos++]; + } + unsigned int b = 0; + for (unsigned int i = 1; i <= lenB; i++) + { + b *= 10; + b += digits[pos++]; + } + unsigned int c = 0; + for (unsigned int i = 1; i <= lenC; i++) + { + c *= 10; + c += digits[pos++]; + } + if (a*b == c) + valid.insert(c); + } + } while (std::next_permutation(digits.begin(), digits.end())); + unsigned int sum = 0; + for (auto x : valid) + sum += x; + std::cout << sum << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0033.cpp b/hackerrank/ProjectEuler/solcpp/euler-0033.cpp new file mode 100644 index 0000000..d1cf1da --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0033.cpp @@ -0,0 +1,123 @@ +#include +#include +#include +#include +std::string num2str(unsigned int x, unsigned int digits) +{ + std::string result; + while (digits-- > 0) + { + auto digit = x % 10; + result += char(digit + '0'); + x /= 10; + } + std::reverse(result.begin(), result.end()); + return result; +} +unsigned int str2num(const std::string& str) +{ + unsigned int result = 0; + for (auto s : str) + { + result *= 10; + result += s - '0'; + } + return result; +} +unsigned int merge(const std::string& strFill, const std::string& mask) +{ + auto iteFill = strFill.begin(); + unsigned int result = 0; + for (auto m : mask) + { + result *= 10; + if (m == '.') + result += *iteFill++ - '0'; + else + result += m - '0'; + } + return result; +} +int main() +{ +#ifdef ORIGINAL + unsigned int multD = 1; + unsigned int multN = 1; + for (unsigned int d = 10; d <= 99; d++) + for (unsigned int n = 10; n < d; n++) + for (unsigned int cancel = 1; cancel <= 9; cancel++) + { + auto lowN = n % 10; + auto lowD = d % 10; + auto highN = n / 10; + auto highD = d / 10; + if (highD == cancel && lowN == cancel && lowD * n == highN * d) + { + multN *= n; + multD *= d; + } + } + for (unsigned int i = 2; i <= multN; i++) + while (multN % i == 0 && multD % i == 0) + { + multN /= i; + multD /= i; + } + std::cout << multD << std::endl; + return 0; +#endif + unsigned int digits; + unsigned int cancel; + std::cin >> digits >> cancel; + auto keep = digits - cancel; + const unsigned int Tens[] = { 1, 10, 100, 1000, 10000 }; + unsigned int sumN = 0; + unsigned int sumD = 0; + std::unordered_set used; + for (unsigned int d = 1; d < Tens[keep]; d++) + for (unsigned int n = 1; n < d; n++) + { + auto strN = num2str(n, keep); + auto strD = num2str(d, keep); + for (auto insert = Tens[cancel - 1]; insert < Tens[cancel]; insert++) + { + auto strInsert = num2str(insert, cancel); + bool isAscending = true; + for (size_t i = 1; i < strInsert.size(); i++) + if (strInsert[i - 1] > strInsert[i]) + { + isAscending = false; + break; + } + if (!isAscending) + continue; + strInsert.insert(0, keep, '.'); + auto strInsertN = strInsert; + do + { + auto newN = merge(strN, strInsertN); + if (newN < Tens[digits - 1]) + continue; + auto strInsertD = strInsert; + do + { + auto newD = merge(strD, strInsertD); + if (newN * d == newD * n) + { + auto id = newN * 10000 + newD; + if (used.count(id) == 0) + { + sumN += newN; + sumD += newD; + used.insert(id); + } + } + } + while (std::next_permutation(strInsertD.begin(), strInsertD.end())); + } + while (std::next_permutation(strInsertN.begin(), strInsertN.end())); + } + } + std::cout << sumN << " " << sumD << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0034.cpp b/hackerrank/ProjectEuler/solcpp/euler-0034.cpp new file mode 100644 index 0000000..83a797f --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0034.cpp @@ -0,0 +1,28 @@ +#include +int main() +{ + const unsigned int factorials[] = { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880 }; + unsigned int limit; + std::cin >> limit; + unsigned int result = 0; + for (unsigned int i = 10; i < limit; i++) + { + unsigned int sum = 0; + unsigned int x = i; + while (x > 0) + { + sum += factorials[x % 10]; + x /= 10; + } +#define ORIGINAL +#ifdef ORIGINAL + if (sum == i) + result += i; +#else + if (sum % i == 0) + result += i; +#endif + } + std::cout << result << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0035.cpp b/hackerrank/ProjectEuler/solcpp/euler-0035.cpp new file mode 100644 index 0000000..fc13ee1 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0035.cpp @@ -0,0 +1,51 @@ +#include +#include +int main() +{ + unsigned int n; + std::cin >> n; + std::set primes; + primes.insert(2); + for (unsigned int i = 3; i <= n; i += 2) + { + bool isPrime = true; + for (auto x : primes) + { + if (i % x == 0) + { + isPrime = false; + break; + } + if (x*x > i) + break; + } + if (isPrime) + primes.insert(i); + } + unsigned int sum = 0; + for (auto x : primes) + { + unsigned int shift = 1; + while (x > shift * 10) + shift *= 10; + auto rotated = x; + do + { + auto digit = rotated % 10; + rotated /= 10; + rotated += digit * shift; + if (primes.count(rotated) == 0) + break; + } while (rotated != x); +#define ORIGINAL +#ifdef ORIGINAL + if (rotated == x) + sum++; +#else + if (rotated == x) + sum += x; +#endif + } + std::cout << sum << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0036.cpp b/hackerrank/ProjectEuler/solcpp/euler-0036.cpp new file mode 100644 index 0000000..70a08fc --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0036.cpp @@ -0,0 +1,32 @@ +#include +#include +#include +std::string num2str(unsigned int x, unsigned int base) +{ + std::string result; + while (x > 0) + { + auto digit = x % base; + x /= base; + result.insert(0, 1, char(digit + '0')); + } + return result; +} +bool isPalindrome(const std::string& s) +{ + auto other = s; + std::reverse(other.begin(), other.end()); + return other == s; +} +int main() +{ + unsigned int limit, base; + std::cin >> limit >> base; + unsigned int sum = 0; + for (unsigned int x = 1; x < limit; x++) + if (isPalindrome(num2str(x, 10)) && + isPalindrome(num2str(x, base))) + sum += x; + std::cout << sum << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0037.cpp b/hackerrank/ProjectEuler/solcpp/euler-0037.cpp new file mode 100644 index 0000000..365bbff --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0037.cpp @@ -0,0 +1,49 @@ +#include +#include +int main() +{ + unsigned int n; + std::cin >> n; + std::set primes; + primes.insert(2); + primes.insert(3); + primes.insert(5); + primes.insert(7); + unsigned int sum = 0; + for (unsigned int i = 11; i < n; i += 2) + { + bool isPrime = true; + for (auto p : primes) + { + if (p*p > i) + break; + if (i % p == 0) + { + isPrime = false; + break; + } + } + if (!isPrime) + continue; + primes.insert(i); + auto right = i; + while (right > 0 && primes.count(right) != 0) + right /= 10; + if (right != 0) + continue; + auto left = i; + unsigned int factor = 1; + while (factor * 10 <= left) + factor *= 10; + while (left > 0 && primes.count(left) != 0) + { + left %= factor; + factor /= 10; + } + if (left != 0) + continue; + sum += i; + } + std::cout << sum << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0038.cpp b/hackerrank/ProjectEuler/solcpp/euler-0038.cpp new file mode 100644 index 0000000..f8180af --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0038.cpp @@ -0,0 +1,51 @@ +#include +int main() +{ + unsigned int maxFactor, maxDigit; + std::cin >> maxFactor >> maxDigit; + unsigned int bitsAll = 0; + for (unsigned int i = 1; i <= maxDigit; i++) + bitsAll |= 1 << i; +#define ORIGINAL +#ifdef ORIGINAL + unsigned int largest = 0; +#endif + for (unsigned int i = 2; i <= maxFactor; i++) + { + unsigned int pandigital = 0; + unsigned int multiplier = 1; + unsigned int bitsUsed = 0; + while (bitsUsed < bitsAll) + { + unsigned int product = i * multiplier; + while (product > 0) + { + unsigned int digit = product % 10; + product /= 10; + pandigital *= 10; + unsigned int bitMask = 1 << digit; + if (digit == 0 || (bitsUsed & bitMask) != 0) + { + bitsUsed = bitsAll + 1; + break; + } + bitsUsed |= bitMask; + } + pandigital += i * multiplier; + multiplier++; + } + if (bitsUsed == bitsAll) + { +#ifdef ORIGINAL + if (largest < pandigital) + largest = pandigital; +#else + std::cout << i << std::endl; +#endif + } + } +#ifdef ORIGINAL + std::cout << largest << std::endl; +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0039.cpp b/hackerrank/ProjectEuler/solcpp/euler-0039.cpp new file mode 100644 index 0000000..f526c0c --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0039.cpp @@ -0,0 +1,58 @@ +#include +#include +#include +unsigned int gcd(unsigned int a, unsigned int b) +{ + while (a != 0) + { + unsigned int c = a; + a = b % a; + b = c; + } + return b; +} +int main() +{ + const unsigned int MaxPerimeter = 5000000; + std::vector count(MaxPerimeter + 1, 0); + for (unsigned long long m = 1; 2*m*m < MaxPerimeter; m++) + for (unsigned long long n = 1; n < m; n++) + { + if (m % 2 == 1 && n % 2 == 1) + continue; + if (gcd(m, n) > 1) + continue; + unsigned int k = 1; + while (true) + { + auto a = k * (m*m - n*n); + auto b = k * 2*m*n; + auto c = k * (m*m + n*n); + k++; + auto perimeter = a + b + c; + if (perimeter > MaxPerimeter) + break; + count[perimeter]++; + } + } + unsigned long long bestCount = 0; + std::set best; + best.insert(0); + for (unsigned int i = 0; i < count.size(); i++) + if (bestCount < count[i]) + { + bestCount = count[i]; + best.insert(i); + } + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int maxPerimeter; + std::cin >> maxPerimeter; + auto i = best.upper_bound(maxPerimeter); + i--; + std::cout << *i << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0040.cpp b/hackerrank/ProjectEuler/solcpp/euler-0040.cpp new file mode 100644 index 0000000..5eb5355 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0040.cpp @@ -0,0 +1,51 @@ +#include +#include +unsigned int getDigit(unsigned long long pos) +{ + unsigned int digits = 1; + unsigned long long range = 9; + unsigned long long first = 1; + unsigned long long skip = 0; + while (skip + digits*range < pos) + { + skip += digits*range; + digits++; + range *= 10; + first *= 10; + } + while (range > 9) + { + while (skip + digits*range < pos) + { + skip += digits*range; + first += range; + } + range /= 10; + } + while (skip + digits < pos) + { + first++; + skip += digits; + } + pos -= skip; + pos--; + auto s = std::to_string(first); + return s[pos] - '0'; +} +int main() +{ + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int product = 1; + for (unsigned int i = 0; i < 7; i++) + { + unsigned long long pos; + std::cin >> pos; + product *= getDigit(pos); + } + std::cout << product << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0041.cpp b/hackerrank/ProjectEuler/solcpp/euler-0041.cpp new file mode 100644 index 0000000..a811f6f --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0041.cpp @@ -0,0 +1,63 @@ +#include +#include +#include +int main() +{ + std::set smallPrimes; + smallPrimes.insert(2); + for (unsigned int i = 3; i*i <= 987654321; i += 2) + { + bool isPrime = true; + for (auto p : smallPrimes) + { + if (p*p > i) + break; + if (i % p == 0) + { + isPrime = false; + break; + } + } + if (isPrime) + smallPrimes.insert(i); + } + std::set panPrimes; + for (unsigned int digits = 2; digits <= 9; digits++) + { + std::string strNumber = "123456789"; + strNumber.erase(digits); + do + { + unsigned int number = std::stoi(strNumber); + bool isPrime = true; + for (auto p : smallPrimes) + { + if (p*p > number) + break; + if (number % p == 0) + { + isPrime = false; + break; + } + } + if (isPrime) + panPrimes.insert(number); + } while (std::next_permutation(strNumber.begin(), strNumber.end())); + } + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int limit; + std::cin >> limit; + auto i = panPrimes.upper_bound(limit); + if (i == panPrimes.begin()) + { + std::cout << "-1" << std::endl; + continue; + } + i--; + std::cout << *i << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0042.cpp b/hackerrank/ProjectEuler/solcpp/euler-0042.cpp new file mode 100644 index 0000000..cff46d4 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0042.cpp @@ -0,0 +1,57 @@ +#include +#include +#include +const int NoTriangle = 0; +int getTriangle(unsigned long long x) +{ + unsigned long long n = sqrt(2*x); + unsigned long long check = n * (n + 1) / 2; + if (x == check) + return n; + else + return NoTriangle; +} +std::string readWord() +{ + std::string result; + while (true) + { + char c = std::cin.get(); + if (!std::cin) + break; + if (c == '"') + continue; + if (c == ',') + break; + result += c; + } + return result; +} +int main() +{ +#ifdef ORIGINAL + unsigned int triangleWords = 0; + while (true) + { + auto word = readWord(); + if (word.empty()) + break; + unsigned int sum = 0; + for (auto c : word) + sum += c - 'A' + 1; + if (getTriangle(sum) != NoTriangle) + triangleWords++; + } + std::cout << triangleWords << std::endl; +#else + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned long long x; + std::cin >> x; + std::cout << getTriangle(x) << std::endl; + } +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0043.cpp b/hackerrank/ProjectEuler/solcpp/euler-0043.cpp new file mode 100644 index 0000000..59b3fb8 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0043.cpp @@ -0,0 +1,51 @@ +#include +#include +#include +unsigned long long str2num(const std::string& x) +{ + unsigned long long result = 0; + for (auto c : x) + { + result *= 10 + result += c - '0'; // was ASCII + } + return result; +} +int main() +{ + // available digits + std::string pan = "0123456789"; // unlike other problems, zero is allowed this time + // remove a few digits if test case requires this + unsigned int maxDigit; + std::cin >> maxDigit; + pan.erase(maxDigit + 1); + // all divisors + const unsigned int primes[] = { 2,3,5,7,11,13,17 }; + // result + unsigned long long sum = 0; + // look at all permutations + do + { + // let's assume it's a great number ;-) + bool ok = true; + // check each 3-digit substring for divisibility + for (unsigned int i = 0; i + 2 < maxDigit; i++) + { + // check pan[1..3] against primes[0], + // check pan[2..4] against primes[1], + // check pan[3..5] against primes[2] ... + std::string check = pan.substr(i + 1, 3); + if (str2num(check) % primes[i] != 0) + { + // nope ... + ok = false; + break; + } + } + // passed all tests, it's great indeed ! + if (ok) + sum += str2num(pan); + } while (std::next_permutation(pan.begin(), pan.end())); + std::cout << sum << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0044.cpp b/hackerrank/ProjectEuler/solcpp/euler-0044.cpp new file mode 100644 index 0000000..0a715ef --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0044.cpp @@ -0,0 +1,52 @@ +#include +#include +bool isPentagonal(unsigned long long x) +{ + unsigned long long n = (1 + sqrt(24*x + 1)) / 6; + auto p_n = n * (3 * n - 1) / 2; + return p_n == x; +} +int main() +{ +#ifdef ORIGINAL + const unsigned int HugeNumber = 999999999; + unsigned int best = HugeNumber; + unsigned int n = 2; + unsigned int last = 1; + while (best == HugeNumber) + { + auto p_n = n * (3 * n - 1) / 2; + if (p_n - last > best) + break; + for (unsigned int distance = 1; distance < n; distance++) + { + auto x = n - distance; + auto p_x = x * (3 * x - 1) / 2; + auto sum = p_n + p_x; + auto difference = p_n - p_x; + if (difference > best) + break; + if (isPentagonal(sum) && isPentagonal(difference)) + best = difference; + } + last = p_n; + n++; + } + std::cout << best << std::endl; +#else + unsigned int maxIndex; + unsigned int distance; + std::cin >> maxIndex >> distance; + for (unsigned long long n = distance + 1; n <= maxIndex; n++) + { + auto p_n = n * (3 * n - 1) / 2; + auto x = n - distance; + auto p_x = x * (3 * x - 1) / 2; + auto sum = p_n + p_x; + auto difference = p_n - p_x; + if (isPentagonal(sum) || isPentagonal(difference)) + std::cout << p_n << std::endl; + } +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0045.cpp b/hackerrank/ProjectEuler/solcpp/euler-0045.cpp new file mode 100644 index 0000000..9eabd43 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0045.cpp @@ -0,0 +1,55 @@ +#include +#include +bool isTriangular(unsigned long long x) +{ + unsigned long long n = sqrt(2*x); + unsigned long long check = n * (n + 1) / 2; + return (x == check); +} +bool isPentagonal(unsigned long long x) +{ + unsigned long long n = (1 + sqrt(24*x + 1)) / 6; + auto p_n = n * (3 * n - 1) / 2; + return p_n == x; +} +int main() +{ +#ifdef ORIGINAL + for (unsigned int i = 144; ; i++) + { + unsigned int hexagonal = i * (2*i - 1); + if (isPentagonal(hexagonal)) + { + std::cout << hexagonal << std::endl; + return 0; + } + } +#else + unsigned long long limit; + unsigned int a, b; + std::cin >> limit >> a >> b; + if (a == 3 && b == 5) + { + for (unsigned long long i = 1; ; i++) + { + auto pentagonal = i * (3*i - 1) / 2; + if (pentagonal >= limit) + break; + if (isTriangular(pentagonal)) + std::cout << pentagonal << std::endl; + } + } + if (a == 5 && b == 6) + { + for (unsigned long long i = 1; ; i++) + { + auto hexagonal = i * (2*i - 1); + if (hexagonal >= limit) + break; + if (isPentagonal(hexagonal)) + std::cout << hexagonal << std::endl; + } + } +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0046.cpp b/hackerrank/ProjectEuler/solcpp/euler-0046.cpp new file mode 100644 index 0000000..4f7b5fd --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0046.cpp @@ -0,0 +1,63 @@ +#include +#include +int main() +{ + const unsigned int MaxPrime = 500000; + std::set primes; + primes.insert(2); + for (unsigned int i = 3; i < MaxPrime; i += 2) + { + bool isPrime = true; + for (auto p : primes) + { + if (p*p > i) + break; + if (i % p == 0) + { + isPrime = false; + break; + } + } + if (isPrime) + primes.insert(i); + } +#ifdef ORIGINAL + for (unsigned int i = 9; i <= MaxPrime; i += 2) + { + if (primes.count(i) != 0) + continue; + bool refuteConjecture = true; + for (unsigned int j = 1; 2*j*j < i; j++) + { + auto check = i - 2*j*j; + if (primes.count(check) != 0) + { + refuteConjecture = false; + break; + } + } + if (refuteConjecture) + { + std::cout << i << std::endl; + break; + } + } +#else + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int i; + std::cin >> i; + unsigned int solutions = 0; + for (unsigned int j = 1; 2*j*j < i; j++) + { + unsigned int check = i - 2*j*j; + if (primes.count(check) != 0) + solutions++; + } + std::cout << solutions << std::endl; + } +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0047.cpp b/hackerrank/ProjectEuler/solcpp/euler-0047.cpp new file mode 100644 index 0000000..d947909 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0047.cpp @@ -0,0 +1,29 @@ +#include +#include +int main() +{ + unsigned int maxNumber = 500000; + unsigned int consecutive = 4; + std::cin >> maxNumber >> consecutive; + maxNumber += consecutive - 1; + std::vector primeFactors(maxNumber + 1, 0); + for (unsigned int i = 2; i <= maxNumber; i++) + if (primeFactors[i] == 0) + for (unsigned int j = i; j <= maxNumber; j += i) + primeFactors[j]++; + unsigned int currentRun = 0; + for (unsigned int i = 2; i <= maxNumber; i++) + { + if (primeFactors[i] == consecutive) + { + currentRun++; + if (currentRun >= consecutive) + std::cout << (i - consecutive + 1) << std::endl; + } + else + { + currentRun = 0; + } + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0048.cpp b/hackerrank/ProjectEuler/solcpp/euler-0048.cpp new file mode 100644 index 0000000..96f66ba --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0048.cpp @@ -0,0 +1,71 @@ +#include +unsigned long long mulmodBitwise(unsigned long long a, unsigned long long b, unsigned long long modulo) +{ + a %= modulo; + b %= modulo; + if (a <= 0xFFFFFFF && b <= 0xFFFFFFF) + return (a * b) % modulo; + if (b > a) + std::swap(a, b); + unsigned long long result = 0; + while (a > 0 && b > 0) + { + if (b & 1) + { + result += a; + result %= modulo; + } + a <<= 1; + a %= modulo; + b >>= 1; + } + return result; +} +unsigned long long mulmod(unsigned long long a, unsigned long long b, unsigned long long modulo) +{ + a %= modulo; + b %= modulo; + if (a <= 0xFFFFFFF && b <= 0xFFFFFFF) + return (a * b) % modulo; + unsigned int leadingZeroes = 0; + unsigned long long m = modulo; + while ((m & 0x8000000000000000ULL) == 0) + { + leadingZeroes++; + m <<= 1; + } + unsigned long long mask = (1 << leadingZeroes) - 1; + unsigned long long result = 0; + while (a > 0 && b > 0) + { + result += (b & mask) * a; + result %= modulo; + b >>= leadingZeroes; + a <<= leadingZeroes; + a %= modulo; + } + return result; +} +unsigned long long powmod(unsigned long long base, unsigned long long exponent, unsigned long long modulo) +{ + unsigned long long result = 1; + while (exponent > 0) + { + if (exponent & 1) + result = mulmod(result, base, modulo); + base = mulmod(base, base, modulo); + exponent >>= 1; + } + return result; +} +int main() +{ + unsigned int x; + std::cin >> x; + const unsigned long long TenDigits = 10000000000ULL; + unsigned long long sum = 0; + for (unsigned int i = 1; i <= x; i++) + sum += powmod(i, i, TenDigits); + std::cout << (sum % TenDigits) << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0049.cpp b/hackerrank/ProjectEuler/solcpp/euler-0049.cpp new file mode 100644 index 0000000..5346f2b --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0049.cpp @@ -0,0 +1,118 @@ +#include +#include +#include +#include +#include +unsigned long long fingerprint(unsigned int x) +{ + unsigned long long result = 0; + while (x > 0) + { + auto digit = x % 10; + x /= 10; + unsigned long long pos = 1; + for (unsigned int i = 1; i <= digit; i++) + pos *= 10; + result += pos; + } + return result; +} +int main() +{ + unsigned int limit = 10000; + unsigned int sequenceLength = 4; + std::cin >> limit >> sequenceLength; + std::set primes; + primes.insert(2); + for (unsigned int i = 3; i < 1000000; i += 2) + { + bool isPrime = true; + for (auto p : primes) + { + if (p*p > i) + break; + if (i % p == 0) + { + isPrime = false; + break; + } + } + if (isPrime) + primes.insert(i); + } + std::map fingerprints; + for (auto p : primes) + fingerprints[fingerprint(p)]++; + std::map> result; + for (auto p : primes) + { + if (p < 1000) + continue; + if (p >= limit) + break; + if (fingerprints[fingerprint(p)] < 3) + continue; + std::string digits = std::to_string(p); + std::sort(digits.begin(), digits.end()); + std::set candidates; + do + { + if (digits[0] == '0') + continue; + unsigned int permuted = std::stoi(digits); + if (primes.count(permuted) == 0) + continue; + if (permuted < p) + break; + candidates.insert(permuted); + } while (std::next_permutation(digits.begin(), digits.end())); + if (candidates.size() < sequenceLength) + continue; + std::map> differences; + for (auto bigger : candidates) + for (auto smaller : candidates) + { + if (smaller >= bigger) + break; + differences[bigger - smaller].insert(bigger); + differences[bigger - smaller].insert(smaller); + } + for (auto d : differences) + { + if (d.second.size() < sequenceLength) + continue; + auto diff = d.first; + auto all = d.second; + for (auto start : all) + { + if (start >= limit) + continue; + unsigned int followers = 0; + unsigned int next = start + diff; + while (all.count(next) != 0) + { + followers++; + next += diff; + } + if (followers >= sequenceLength - 1) + { + auto next = start + diff; + std::string s = std::to_string(start); + for (unsigned int printMe = 1; printMe < sequenceLength; printMe++) + { + s += std::to_string(next); + next += diff; + } + result[s.size()].insert(s); + } + } + } + } + for (auto length : result) + for (auto x : length.second) +#ifdef ORIGINAL + if (x != "148748178147") +#endif + std::cout << x << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0050.cpp b/hackerrank/ProjectEuler/solcpp/euler-0050.cpp new file mode 100644 index 0000000..56f6110 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0050.cpp @@ -0,0 +1,168 @@ +#include +#include +unsigned long long mulmod(unsigned long long a, unsigned long long b, unsigned long long modulo) +{ + if (a <= 0xFFFFFFF && b <= 0xFFFFFFF) + return (a * b) % modulo; + unsigned long long result = 0; + unsigned long long factor = a % modulo; + while (b > 0) + { + if (b & 1) + { + result += factor; + if (result >= modulo) + result %= modulo; + } + factor <<= 1; + if (factor >= modulo) + factor %= modulo; + b >>= 1; + } + return result; +} +unsigned long long powmod(unsigned long long base, unsigned long long exponent, unsigned long long modulo) +{ + unsigned long long result = 1; + while (exponent > 0) + { + if (exponent & 1) + result = mulmod(result, base, modulo); + base = mulmod(base, base, modulo); + exponent >>= 1; + } + return result; +} +bool isPrime(unsigned long long p) +{ + const unsigned int bitmaskPrimes2to31 = (1 << 2) | (1 << 3) | (1 << 5) | (1 << 7) | + (1 << 11) | (1 << 13) | (1 << 17) | (1 << 19) | + (1 << 23) | (1 << 29); + if (p < 31) + return (bitmaskPrimes2to31 & (1 << p)) != 0; + if (p % 2 == 0 || p % 3 == 0 || p % 5 == 0 || p % 7 == 0 || + p % 11 == 0 || p % 13 == 0 || p % 17 == 0) + return false; + if (p < 17*19) + return true; + const unsigned int STOP = 0; + const unsigned int TestAgainst1[] = { 377687, STOP }; + const unsigned int TestAgainst2[] = { 31, 73, STOP }; + const unsigned int TestAgainst3[] = { 2, 7, 61, STOP }; + const unsigned int TestAgainst4[] = { 2, 13, 23, 1662803, STOP }; + const unsigned int TestAgainst7[] = { 2, 325, 9375, 28178, 450775, 9780504, 1795265022, STOP }; + const unsigned int* testAgainst = TestAgainst7; + if (p < 5329) + testAgainst = TestAgainst1; + else if (p < 9080191) + testAgainst = TestAgainst2; + else if (p < 4759123141ULL) + testAgainst = TestAgainst3; + else if (p < 1122004669633ULL) + testAgainst = TestAgainst4; + auto d = p - 1; + d >>= 1; + unsigned int shift = 0; + while ((d & 1) == 0) + { + shift++; + d >>= 1; + } + do + { + auto x = powmod(*testAgainst++, d, p); + if (x == 1 || x == p - 1) + continue; + bool maybePrime = false; + for (unsigned int r = 0; r < shift; r++) + { + x = powmod(x, 2, p); + if (x == 1) + return false; + if (x == p - 1) + { + maybePrime = true; + break; + } + } + if (!maybePrime) + return false; + } while (*testAgainst != STOP); + return true; +} +std::vector primes; +std::vector primeSum; +void morePrimes(unsigned int num) +{ + if (primes.empty()) + { + primes .reserve(400000); + primeSum.reserve(400000); + primes.push_back(2); + primes.push_back(3); + primeSum.push_back(2); + } + for (auto i = primes.back() + 2; primes.size() <= num; i += 2) + { + bool isPrime = true; + for (auto x : primes) + { + if (x*x > i) + break; + if (i % x == 0) + { + isPrime = false; + break; + } + } + if (isPrime) + primes.push_back(i); + } + for (auto i = primeSum.size(); i < primes.size(); i++) + primeSum.push_back(primeSum.back() + primes[i]); +} +int main() +{ + const unsigned int PrimesPerBatch = 10000; + morePrimes(PrimesPerBatch); + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned long long last = 1000000; + std::cin >> last; + unsigned long long best = 2; + unsigned int maxLength = 0; + unsigned int start = 0; + while (primes[start] <= 131 && primes[start] <= last) + { + unsigned long long subtract = 0; + if (start > 0) + subtract = primeSum[start - 1]; + unsigned int pos = start + maxLength; + while (primeSum[pos] - subtract <= last) + { + pos++; + if (pos + 100 >= primes.size()) + morePrimes(primes.size() + PrimesPerBatch); + } + pos--; + while (pos - start > maxLength) + { + unsigned long long sum = primeSum[pos] - subtract; + if (isPrime(sum)) + { + maxLength = pos - start; + best = sum; + break; + } + pos--; + } + start++; + } + if (best >= 2) + maxLength++; + std::cout << best << " " << maxLength << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0051.cpp b/hackerrank/ProjectEuler/solcpp/euler-0051.cpp new file mode 100644 index 0000000..fd65a22 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0051.cpp @@ -0,0 +1,76 @@ +#include +#include +#include +#include +unsigned int maxDigits = 7; +unsigned int replace = 3; +unsigned int siblings = 7; +std::map> matches; +unsigned int smallestPrime = 99999999; +void match(unsigned int number, std::string& regex, unsigned int digit, unsigned int howOften, unsigned int startPos = 0) +{ + char asciiDigit = digit + '0'; + for (unsigned int i = startPos; i < maxDigits; i++) + { + if (regex[i] != asciiDigit) + continue; + if (i == 0 && asciiDigit == '0') + continue; + regex[i] = '.'; + if (howOften == 1) + { + auto& addTo = matches[regex]; + addTo.push_back(number); + if (addTo.size() >= siblings && addTo.front() < smallestPrime) + smallestPrime = addTo.front(); + } + else + { + match(number, regex, digit, howOften - 1, i + 1); + } + regex[i] = asciiDigit; + } +} +int main() +{ + std::cin >> maxDigits >> replace >> siblings; + unsigned int minNumber = 1; + for (unsigned int i = 1; i < maxDigits; i++) + minNumber *= 10; + unsigned int maxNumber = minNumber * 10 - 1; + std::vector primes(maxNumber, true); + primes[0] = primes[1] = false; + for (unsigned int i = 2; i*i <= maxNumber; i++) + if (primes[i]) + for (unsigned j = 2*i; j <= maxNumber; j += i) + primes[j] = false; + for (unsigned int i = minNumber; i <= maxNumber; i++) + if (primes[i]) + { + auto strNum = std::to_string(i); + for (unsigned int digit = 0; digit <= 9; digit++) + match(i, strNum, digit, replace); + if (maxDigits == 7) + { + if (replace == 1 && i > 2000000) + break; + if (replace == 2 && i > 3000000) + break; + } + } + std::string minimum; + for (auto m : matches) + { + if (m.second.size() < siblings) + continue; + if (m.second.front() != smallestPrime) + continue; + std::string s; + for (unsigned i = 0; i < siblings; i++) + s += std::to_string(m.second[i]) + " "; + if (minimum > s || minimum.empty()) + minimum = s; + } + std::cout << minimum << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0052.cpp b/hackerrank/ProjectEuler/solcpp/euler-0052.cpp new file mode 100644 index 0000000..54a725c --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0052.cpp @@ -0,0 +1,44 @@ +#include +unsigned long long fingerprint(unsigned int x) +{ + unsigned long long result = 0; + while (x > 0) + { + auto digit = x % 10; + x /= 10; + unsigned long long pos = 1; + for (unsigned int i = 1; i <= digit; i++) + pos *= 10; + result += pos; + } + return result; +} +int main() +{ + unsigned int maxNumber = 1000000; + unsigned int maxMultiple = 6; + ; + std::cin >> maxNumber >> maxMultiple; + for (unsigned int i = 1; i <= maxNumber; i++) + { + auto id = fingerprint(i); + bool found = true; + for (unsigned int multiple = 2; multiple <= maxMultiple; multiple++) + if (id != fingerprint(i * multiple)) + { + found = false; + break; + } + if (found) + { +#ifdef ORIGINAL + std::cout << i << std::endl; + return 0; +#endif + for (unsigned int multiple = 1; multiple <= maxMultiple; multiple++) + std::cout << (i * multiple) << " "; + std::cout << std::endl; + } + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0053.cpp b/hackerrank/ProjectEuler/solcpp/euler-0053.cpp new file mode 100644 index 0000000..22b0725 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0053.cpp @@ -0,0 +1,28 @@ +#include +#include +int main() +{ + unsigned int maxN = 100; + unsigned long long maxNumber = 1000000; + std::cin >> maxN >> maxNumber; + unsigned int bigNumbers = 0; + std::vector> combinations(maxN + 1); + for (unsigned int n = 0; n <= maxN; n++) + { + combinations[n].resize(n + 1, 0); + combinations[n][0] = combinations[n][n] = 1; + } + for (unsigned int n = 1; n <= maxN; n++) + for (unsigned int k = 1; k < n; k++) + { + auto sum = combinations[n - 1][k - 1] + combinations[n - 1][k]; + if (sum > maxNumber) + { + sum = maxNumber + 1; + bigNumbers++; + } + combinations[n][k] = sum; + } + std::cout << bigNumbers << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0054.cpp b/hackerrank/ProjectEuler/solcpp/euler-0054.cpp new file mode 100644 index 0000000..192f94c --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0054.cpp @@ -0,0 +1,188 @@ +#include +#include +const unsigned long long Card2 = 1ULL << 0; +const unsigned long long Card3 = 1ULL << 1; +const unsigned long long Card4 = 1ULL << 2; +const unsigned long long Card5 = 1ULL << 3; +const unsigned long long Card6 = 1ULL << 4; +const unsigned long long Card7 = 1ULL << 5; +const unsigned long long Card8 = 1ULL << 6; +const unsigned long long Card9 = 1ULL << 7; +const unsigned long long CardT = 1ULL << 8; +const unsigned long long CardJ = 1ULL << 9; +const unsigned long long CardQ = 1ULL << 10; +const unsigned long long CardK = 1ULL << 11; +const unsigned long long CardA = 1ULL << 12; +unsigned long long cardMask(const std::string& card) +{ + unsigned long long result = 0; + switch (card[0]) + { + case '2': result = Card2; break; + case '3': result = Card3; break; + case '4': result = Card4; break; + case '5': result = Card5; break; + case '6': result = Card6; break; + case '7': result = Card7; break; + case '8': result = Card8; break; + case '9': result = Card9; break; + case 'T': result = CardT; break; + case 'J': result = CardJ; break; + case 'Q': result = CardQ; break; + case 'K': result = CardK; break; + case 'A': result = CardA; break; + default: break; + } + switch (card[1]) + { + case 'D': break; + case 'H': result <<= 13; break; + case 'S': result <<= 26; break; + case 'C': result <<= 39; break; + default: break; + } + return result; +} +unsigned long long rank(unsigned long long hand) +{ + const auto Suit = (1LL << 13) - 1; + auto colorless = (hand | (hand >> 13) | (hand >> 26) | (hand >> 39)) & Suit; + unsigned int straight = 0; + if (colorless == (CardT | CardJ | CardQ | CardK | CardA)) straight = 1; + if (colorless == (Card9 | CardT | CardJ | CardQ | CardK)) straight = 2; + if (colorless == (Card8 | Card9 | CardT | CardJ | CardQ)) straight = 3; + if (colorless == (Card7 | Card8 | Card9 | CardT | CardJ)) straight = 4; + if (colorless == (Card6 | Card7 | Card8 | Card9 | CardT)) straight = 5; + if (colorless == (Card5 | Card6 | Card7 | Card8 | Card9)) straight = 6; + if (colorless == (Card4 | Card5 | Card6 | Card7 | Card8)) straight = 7; + if (colorless == (Card3 | Card4 | Card5 | Card6 | Card7)) straight = 8; + if (colorless == (Card2 | Card3 | Card4 | Card5 | Card6)) straight = 9; + if (colorless == (CardA | Card2 | Card3 | Card4 | Card5)) straight = 10; + unsigned int count[13] = { 0,0,0,0,0,0,0,0,0,0,0,0,0 }; + for (unsigned int i = 0; i < 13; i++) + { + if (hand & (1ULL << i)) + count[i]++; + if (hand & (1ULL << (i+13))) + count[i]++; + if (hand & (1ULL << (i+26))) + count[i]++; + if (hand & (1ULL << (i+39))) + count[i]++; + } + bool isFlush = (hand == colorless) || + (hand == (colorless << 13)) || + (hand == (colorless << 26)) || + (hand == (colorless << 39)); + const unsigned long long GroupSize = 10000000000ULL; + unsigned long long result = 0; + if (isFlush && straight > 0) + return result + straight; + result += GroupSize; + for (unsigned int i = 0; i < 13; i++) + if (count[i] == 4) + for (unsigned int j = 0; j < 13; j++) + if (count[j] == 1) + return result + (13 - i) * 100 + (13 - j); + result += GroupSize; + for (unsigned int i = 0; i < 13; i++) + if (count[i] == 3) + for (unsigned int j = 0; j < 13; j++) + if (count[j] == 2) + return result + (13 - i) * 100 + (13 - j); + result += GroupSize; + if (isFlush) + { + unsigned long long value = 0; + for (int i = 12; i >= 0; i--) + if (count[i] == 1) + { + value *= 100; + value += 13 - i; + } + return result + value; + } + result += GroupSize; + if (straight > 0) + return result + straight; + result += GroupSize; + for (unsigned int i = 0; i < 13; i++) + if (count[i] == 3) + { + unsigned long long value = 13 - i; + for (int j = 12; j >= 0; j--) + if (count[j] == 1) + { + value *= 100; + value += 13 - j; + } + return result + value; + } + result += GroupSize; + unsigned int numPairs = 0; + for (unsigned int i = 0; i < 13; i++) + if (count[i] == 2) + numPairs++; + if (numPairs > 0) + { + unsigned long long value = 0; + for (int i = 12; i >= 0; i--) + if (count[i] == 2) + { + value *= 100; + value += 13 - i; + } + for (int i = 12; i >= 0; i--) + if (count[i] == 1) + { + value *= 100; + value += 13 - i; + } + if (numPairs == 1) + result += GroupSize; + return result + value; + } + result += 2 * GroupSize; + unsigned long long value = 0; + for (int i = 12; i >= 0; i--) + if (count[i] == 1) + { + value *= 100; + value += 13 - i; + } + return result + value; +} +int main() +{ + unsigned int tests = 1000; +#ifdef ORIGINAL + unsigned int won1 = 0; + unsigned int won2 = 0; +#else + std::cin >> tests; +#endif + while (tests--) + { + std::string cards1[5], cards2[5]; + std::cin >> cards1[0] >> cards1[1] >> cards1[2] >> cards1[3] >> cards1[4]; + std::cin >> cards2[0] >> cards2[1] >> cards2[2] >> cards2[3] >> cards2[4]; + auto player1 = cardMask(cards1[0]) | cardMask(cards1[1]) | cardMask(cards1[2]) | + cardMask(cards1[3]) | cardMask(cards1[4]); + auto player2 = cardMask(cards2[0]) | cardMask(cards2[1]) | cardMask(cards2[2]) | + cardMask(cards2[3]) | cardMask(cards2[4]); + auto rank1 = rank(player1); + auto rank2 = rank(player2); +#ifdef ORIGINAL + if (rank1 < rank2) + won1++; + if (rank1 > rank2) + won2++; +#else + std::cout << "Player " << (rank1 < rank2 ? "1" : "2") << std::endl; +#endif + } +#ifdef ORIGINAL + std::cout << won1 << std::endl; +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0055.cpp b/hackerrank/ProjectEuler/solcpp/euler-0055.cpp new file mode 100644 index 0000000..7279c7f --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0055.cpp @@ -0,0 +1,78 @@ +#include +#include +#include +#include +typedef std::vector BigNumber; +std::map finalNumber; +bool isLychrel(unsigned int x, unsigned int maxIterations) +{ + BigNumber number; + while (x > 0) + { + number.push_back(x % 10); + x /= 10; + } + for (unsigned int iteration = 0; iteration < maxIterations; iteration++) + { + auto reverse = number; + std::reverse(reverse.begin(), reverse.end()); +#ifdef ORIGINAL + if (iteration > 0) +#endif + if (number == reverse) + { + finalNumber[number]++; + return false; + } + auto sum = number; + unsigned int carry = 0; + for (size_t digit = 0; digit < number.size(); digit++) + { + sum[digit] += reverse[digit] + carry; + if (sum[digit] >= 10) + { + sum[digit] -= 10; + carry = 1; + } + else + { + carry = 0; + } + } + if (carry > 0) + sum.push_back(carry); + number = std::move(sum); + } + return true; +} +int main() +{ +#ifdef ORIGINAL + unsigned int iterations = 50; +#else + unsigned int iterations = 60; +#endif + unsigned int maxNumber = 10000; + std::cin >> maxNumber; + unsigned int count = 0; + for (unsigned int i = 0; i <= maxNumber; i++) + if (isLychrel(i, iterations)) + count++; +#ifdef ORIGINAL + std::cout << count << std::endl; +#else + unsigned int bestCount = 0; + BigNumber bestNumber; + for (auto f : finalNumber) + if (bestCount < f.second) + { + bestCount = f.second; + bestNumber = f.first; + } + std::reverse(bestNumber.begin(), bestNumber.end()); + for (auto digit : bestNumber) + std::cout << digit; + std::cout << " " << bestCount << std::endl; +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0056.cpp b/hackerrank/ProjectEuler/solcpp/euler-0056.cpp new file mode 100644 index 0000000..fdb1306 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0056.cpp @@ -0,0 +1,52 @@ +#include +#include +struct BigNum : public std::vector +{ + static const unsigned int MaxDigit = 10; + BigNum(unsigned long long x = 0) + { + do + { + push_back(x % MaxDigit); + x /= MaxDigit; + } while (x > 0); + } + BigNum operator*(unsigned int factor) const + { + unsigned long long carry = 0; + auto result = *this; + for (auto &i : result) + { + carry += i * (unsigned long long)factor; + i = carry % MaxDigit; + carry /= MaxDigit; + } + while (carry > 0) + { + result.push_back(carry % MaxDigit); + carry /= MaxDigit; + } + return result; + } +}; +int main() +{ + unsigned int maximum = 100; + std::cin >> maximum; + unsigned int maxSum = 1; + for (unsigned int base = 1; base <= maximum; base++) + { + BigNum power = 1; + for (unsigned int exponent = 1; exponent <= maximum; exponent++) + { + unsigned int sum = 0; + for (auto digit : power) + sum += digit; + if (maxSum < sum) + maxSum = sum; + power = power * base; + } + } + std::cout << maxSum << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0057.cpp b/hackerrank/ProjectEuler/solcpp/euler-0057.cpp new file mode 100644 index 0000000..67dedff --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0057.cpp @@ -0,0 +1,72 @@ +#include +#include +struct BigNum : public std::vector +{ + static const unsigned int MaxDigit = 10; + BigNum(unsigned long long x = 0) + { + do + { + push_back(x % MaxDigit); + x /= MaxDigit; + } while (x > 0); + } + BigNum operator+(const BigNum& other) const + { + auto result = *this; + if (result.size() < other.size()) + result.resize(other.size(), 0); + unsigned int carry = 0; + for (size_t i = 0; i < result.size(); i++) + { + carry += result[i]; + if (i < other.size()) + carry += other[i]; + else + if (carry == 0) + return result; + if (carry < MaxDigit) + { + result[i] = carry; + carry = 0; + } + else + { + result[i] = carry - MaxDigit; + carry = 1; + } + } + if (carry > 0) + result.push_back(carry); + return result; + } +}; +#define ORIGINAL +int main() +{ + unsigned int iterations = 1000; + std::cin >> iterations; + BigNum a = 1; + BigNum b = 1; + unsigned int count = 0; + for (unsigned int i = 0; i <= iterations; i++) + { + if (a.size() > b.size()) + { +#ifdef ORIGINAL + count++; +#else + std::cout << i << std::endl; +#endif + } + auto twoB = b + b; + auto nextA = a + twoB; + auto nextB = b + a; + a = std::move(nextA); + b = std::move(nextB); + } +#ifdef ORIGINAL + std::cout << count << std::endl; +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0058.cpp b/hackerrank/ProjectEuler/solcpp/euler-0058.cpp new file mode 100644 index 0000000..6eb17f2 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0058.cpp @@ -0,0 +1,122 @@ +#include +unsigned long long mulmod(unsigned long long a, unsigned long long b, unsigned long long modulo) +{ +#ifdef __GNUC__ + return ((unsigned __int128)a * b) % modulo; +#endif + a %= modulo; + b %= modulo; + if (a <= 0xFFFFFFF && b <= 0xFFFFFFF) + return (a * b) % modulo; + if (b > a) + std::swap(a, b); + unsigned long long result = 0; + while (a > 0 && b > 0) + { + if (b & 1) + { + result += a; + if (result >= modulo) + result -= modulo; + } + a <<= 1; + if (a >= modulo) + a -= modulo; + b >>= 1; + } + return result; +} +unsigned long long powmod(unsigned long long base, unsigned long long exponent, unsigned long long modulo) +{ + unsigned long long result = 1; + while (exponent > 0) + { + if (exponent & 1) + result = mulmod(result, base, modulo); + base = mulmod(base, base, modulo); + exponent >>= 1; + } + return result; +} +bool isPrime(unsigned long long p) +{ + const unsigned int bitmaskPrimes2to31 = (1 << 2) | (1 << 3) | (1 << 5) | (1 << 7) | + (1 << 11) | (1 << 13) | (1 << 17) | (1 << 19) | + (1 << 23) | (1 << 29); + if (p < 31) + return (bitmaskPrimes2to31 & (1 << p)) != 0; + if (p % 2 == 0 || p % 3 == 0 || p % 5 == 0 || p % 7 == 0 || + p % 11 == 0 || p % 13 == 0 || p % 17 == 0) + return false; + if (p < 17*19) + return true; + const unsigned int STOP = 0; + const unsigned int TestAgainst1[] = { 377687, STOP }; + const unsigned int TestAgainst2[] = { 31, 73, STOP }; + const unsigned int TestAgainst3[] = { 2, 7, 61, STOP }; + const unsigned int TestAgainst4[] = { 2, 13, 23, 1662803, STOP }; + const unsigned int TestAgainst7[] = { 2, 325, 9375, 28178, 450775, 9780504, 1795265022, STOP }; + const unsigned int* testAgainst = TestAgainst7; + if (p < 5329) + testAgainst = TestAgainst1; + else if (p < 9080191) + testAgainst = TestAgainst2; + else if (p < 4759123141ULL) + testAgainst = TestAgainst3; + else if (p < 1122004669633ULL) + testAgainst = TestAgainst4; + auto d = p - 1; + d >>= 1; + unsigned int shift = 0; + while ((d & 1) == 0) + { + shift++; + d >>= 1; + } + do + { + auto x = powmod(*testAgainst++, d, p); + if (x == 1 || x == p - 1) + continue; + bool maybePrime = false; + for (unsigned int r = 0; r < shift; r++) + { + x = powmod(x, 2, p); + if (x == 1) + return false; + if (x == p - 1) + { + maybePrime = true; + break; + } + } + if (!maybePrime) + return false; + } while (*testAgainst != STOP); + return true; +} +int main() +{ + unsigned int percentage = 10; + std::cin >> percentage; + unsigned long long numPrimes = 0; + unsigned long long sideLength = 1; + unsigned long long diagonals = 1; + do + { + sideLength += 2; + diagonals += 4; + unsigned long long lowerRight = sideLength * sideLength; + unsigned long long lowerLeft = lowerRight - (sideLength - 1); + unsigned long long upperLeft = lowerLeft - (sideLength - 1); + unsigned long long upperRight = upperLeft - (sideLength - 1); + if (isPrime(lowerLeft) != 0) + numPrimes++; + if (isPrime(upperLeft) != 0) + numPrimes++; + if (isPrime(upperRight) != 0) + numPrimes++; + } while (numPrimes * 100 / diagonals >= percentage); + std::cout << sideLength << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0059.cpp b/hackerrank/ProjectEuler/solcpp/euler-0059.cpp new file mode 100644 index 0000000..64192a9 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0059.cpp @@ -0,0 +1,65 @@ +#include +#include +int main() +{ + std::vector encrypted; +#ifdef ORIGINAL + while (true) + { + unsigned int current; + std::cin >> current; + if (!std::cin) + break; + encrypted.push_back(current); + std::cin.get(); + } +#else + unsigned int size; + std::cin >> size; + encrypted.clear(); + while (size--) + { + unsigned int current; + std::cin >> current; + encrypted.push_back(current); + } +#endif + for (unsigned char i = 'a'; i <= 'z'; i++) + for (unsigned char j = 'a'; j <= 'z'; j++) + for (unsigned char k = 'a'; k <= 'z'; k++) + { + const unsigned char key[] = { i, j, k }; + std::vector decoded; + for (size_t pos = 0; pos < encrypted.size(); pos++) + decoded.push_back(encrypted[pos] ^ key[pos % 3]); + bool valid = true; + for (auto d : decoded) + { + valid = (d >= '0' && d <= '9'); + valid |= (d >= 'a' && d <= 'z'); + valid |= (d >= 'A' && d <= 'Z'); + valid |= (d == ' ' || d == ',' || d == '.' || d == '?' || d == '!'); + valid |= (d == ';' || d == '-' || d == '\''); + valid |= (d == '(' || d == ')'); + if (!valid) + break; + } + if (!valid) + continue; +#ifdef SHOW_DECODED + for (auto d : decoded) + std::cout << d; + std::cout << std::endl; +#endif +#ifdef ORIGINAL + unsigned int asciiSum = 0; + for (auto d : decoded) + asciiSum += d; + std::cout << asciiSum << std::endl; + return 0; +#else + std::cout << i << j << k << std::endl; +#endif + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0060.cpp b/hackerrank/ProjectEuler/solcpp/euler-0060.cpp new file mode 100644 index 0000000..62baf98 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0060.cpp @@ -0,0 +1,206 @@ +#include +#include +#include +std::vector sums; +unsigned long long mulmod(unsigned long long a, unsigned long long b, unsigned long long modulo) +{ +#ifdef __GNUC__ + return ((unsigned __int128)a * b) % modulo; +#endif + a %= modulo; + b %= modulo; + if (a <= 0xFFFFFFF && b <= 0xFFFFFFF) + return (a * b) % modulo; + if (b > a) + std::swap(a, b); + unsigned long long result = 0; + while (a > 0 && b > 0) + { + if (b & 1) + { + result += a; + if (result >= modulo) + result -= modulo; + } + a <<= 1; + if (a >= modulo) + a -= modulo; + b >>= 1; + } + return result; +} +unsigned long long powmod(unsigned long long base, unsigned long long exponent, unsigned long long modulo) +{ + unsigned long long result = 1; + while (exponent > 0) + { + if (exponent & 1) + result = mulmod(result, base, modulo); + base = mulmod(base, base, modulo); + exponent >>= 1; + } + return result; +} +bool isPrime(unsigned long long p) +{ + const unsigned int bitmaskPrimes2to31 = (1 << 2) | (1 << 3) | (1 << 5) | (1 << 7) | + (1 << 11) | (1 << 13) | (1 << 17) | (1 << 19) | + (1 << 23) | (1 << 29); + if (p < 31) + return (bitmaskPrimes2to31 & (1 << p)) != 0; + if (p % 2 == 0 || p % 3 == 0 || p % 5 == 0 || p % 7 == 0 || + p % 11 == 0 || p % 13 == 0 || p % 17 == 0) + return false; + if (p < 17 * 19) + return true; + const unsigned int STOP = 0; + const unsigned int TestAgainst1[] = {377687, STOP}; + const unsigned int TestAgainst2[] = {31, 73, STOP}; + const unsigned int TestAgainst3[] = {2, 7, 61, STOP}; + const unsigned int TestAgainst4[] = {2, 13, 23, 1662803, STOP}; + const unsigned int TestAgainst7[] = {2, 325, 9375, 28178, 450775, 9780504, 1795265022, STOP}; + const unsigned int *testAgainst = TestAgainst7; + if (p < 5329) + testAgainst = TestAgainst1; + else if (p < 9080191) + testAgainst = TestAgainst2; + else if (p < 4759123141ULL) + testAgainst = TestAgainst3; + else if (p < 1122004669633ULL) + testAgainst = TestAgainst4; + auto d = p - 1; + d >>= 1; + unsigned int shift = 0; + while ((d & 1) == 0) + { + shift++; + d >>= 1; + } + do + { + auto x = powmod(*testAgainst++, d, p); + if (x == 1 || x == p - 1) + continue; + bool maybePrime = false; + for (unsigned int r = 0; r < shift; r++) + { + x = powmod(x, 2, p); + if (x == 1) + return false; + if (x == p - 1) + { + maybePrime = true; + break; + } + } + if (!maybePrime) + return false; + } while (*testAgainst != STOP); + return true; +} +unsigned long long merge(unsigned long long a, unsigned long long b) +{ + unsigned long long shift = 10; + while (shift <= b) + shift *= 10; + return a * shift + b; +} +bool match(unsigned long long a, unsigned long long b) +{ + return isPrime(merge(a, b)) && isPrime(merge(b, a)); +} +void checkTriple(unsigned int first, const std::vector &candidates) +{ + for (size_t index2 = 0; index2 < candidates.size(); index2++) + for (size_t index3 = index2 + 1; index3 < candidates.size(); index3++) + if (match(candidates[index2], candidates[index3])) + { + auto sum = first + candidates[index2] + candidates[index3]; + sums.push_back(sum); + } +} +void checkQuadruple(unsigned int first, const std::vector &candidates) +{ + for (size_t index2 = 0; index2 < candidates.size(); index2++) + for (size_t index3 = index2 + 1; index3 < candidates.size(); index3++) + { + if (!match(candidates[index2], candidates[index3])) + continue; + for (size_t index4 = index3 + 1; index4 < candidates.size(); index4++) + if (match(candidates[index2], candidates[index4]) && + match(candidates[index3], candidates[index4])) + { + auto sum = first + candidates[index2] + candidates[index3] + candidates[index4]; + sums.push_back(sum); + } + } +} +void checkQuintuple(unsigned int first, const std::vector &candidates) +{ + for (size_t index2 = 0; index2 < candidates.size(); index2++) + for (size_t index3 = index2 + 1; index3 < candidates.size(); index3++) + { + if (!match(candidates[index2], candidates[index3])) + continue; + for (size_t index4 = index3 + 1; index4 < candidates.size(); index4++) + { + if (!match(candidates[index2], candidates[index4]) || + !match(candidates[index3], candidates[index4])) + continue; + for (size_t index5 = index4 + 1; index5 < candidates.size(); index5++) + if (match(candidates[index2], candidates[index5]) && + match(candidates[index3], candidates[index5]) && + match(candidates[index4], candidates[index5])) + { + auto sum = first + candidates[index2] + candidates[index3] + + candidates[index4] + candidates[index5]; + sums.push_back(sum); + } + } + } +} +int main() +{ + unsigned int maxPrime = 20000; + unsigned int size = 5; + std::cin >> maxPrime >> size; + std::vector primes; + for (unsigned int i = 3; i < maxPrime; i += 2) + { + bool isPrime = true; + for (auto p : primes) + { + if (p * p > i) + break; + if (i % p == 0) + { + isPrime = false; + break; + } + } + if (isPrime) + primes.push_back(i); + } + for (size_t i = 0; i < primes.size(); i++) + { + auto smallPrime = primes[i]; + if (smallPrime == 5) + continue; + std::vector candidates; + for (size_t j = i + 1; j < primes.size(); j++) + { + auto largePrime = primes[j]; + if (match(smallPrime, largePrime)) + candidates.push_back(largePrime); + } + if (size == 3) + checkTriple(smallPrime, candidates); + else if (size == 4) + checkQuadruple(smallPrime, candidates); + else + checkQuintuple(smallPrime, candidates); + } + std::sort(sums.begin(), sums.end()); + for (auto s : sums) + std::cout << s << std::endl; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0061.cpp b/hackerrank/ProjectEuler/solcpp/euler-0061.cpp new file mode 100644 index 0000000..9e28950 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0061.cpp @@ -0,0 +1,103 @@ +#include +#include +#include +std::set results; +const unsigned int Limit = 10000; +std::vector all(Limit, 0); +unsigned int finalMask = 0; +void add(unsigned int x, unsigned int category) +{ + if (x < 1000 || x >= 10000) + return; + auto bit = 1 << category; + all[x] |= bit & finalMask; +} +void deeper(std::vector& sequence, unsigned int mask = 0) +{ + unsigned int from = 1000; + unsigned int to = 10000; + if (!sequence.empty()) + { + auto lowerTwoDigits = sequence.back() % 100; + from = lowerTwoDigits * 100; + to = from + 100; + } + for (auto next = from; next < to; next++) + { + auto categories = all[next]; + if (categories == 0) + continue; + bool isUnique = true; + for (auto x : sequence) + if (x == next) + { + isUnique = false; + break; + } + if (!isUnique) + continue; + for (auto j = 3; j <= 8; j++) + { + auto thisCategory = 1 << j; + if ((categories & thisCategory) == 0) + continue; + if ((mask & thisCategory) != 0) + continue; + auto nextMask = mask | thisCategory; + if (nextMask == finalMask) + { + auto first = sequence.front(); + auto lowerTwoDigits = next % 100; + auto upperTwoDigits = first / 100; + if (lowerTwoDigits == upperTwoDigits) + { + auto sum = next; + for (auto x : sequence) + sum += x; + results.insert(sum); + } + } + else + { + sequence.push_back(next); + deeper(sequence, nextMask); + sequence.pop_back(); + } + } + } +} +int main() +{ + unsigned int numSets; + std::cin >> numSets; + for (unsigned int i = 0; i < numSets; i++) + { + unsigned int x; + std::cin >> x; + finalMask |= 1 << x; + } + unsigned int n = 1; + while (true) + { + auto triangle = n * (n + 1) / 2; + if (triangle >= 10000) + break; + add(triangle, 3); + auto square = n * n; + add(square, 4); + auto pentagon = n * (3 * n - 1) / 2; + add(pentagon, 5); + auto hexagon = n * (2 * n - 1); + add(hexagon, 6); + auto heptagon = n * (5 * n - 3) / 2; + add(heptagon, 7); + auto octagon = n * (3 * n - 2); + add(octagon, 8); + n++; + } + std::vector sequence; + deeper(sequence); + for (auto x : results) + std::cout << x << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0062.cpp b/hackerrank/ProjectEuler/solcpp/euler-0062.cpp new file mode 100644 index 0000000..16bc520 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0062.cpp @@ -0,0 +1,35 @@ +#include +#include +#include +#include +unsigned long long fingerprint(unsigned long long x) +{ + unsigned long long result = 0; + while (x > 0) + { + auto digit = x % 10; + x /= 10; + const auto BitsPerDigit = 6; + result += 1ULL << (BitsPerDigit * digit); + } + return result; +} +int main() +{ + unsigned int maxCube = 10000; + unsigned int numPermutations = 5; + std::cin >> maxCube >> numPermutations; + std::map> matches; + for (unsigned int i = 1; i < maxCube; i++) + { + auto cube = (unsigned long long)i * i * i; + matches[fingerprint(cube)].push_back(i); + } + std::set smallest; + for (auto m : matches) + if (m.second.size() == numPermutations) + smallest.insert(m.second.front()); + for (auto s : smallest) + std::cout << (s*s*s) << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0063.cpp b/hackerrank/ProjectEuler/solcpp/euler-0063.cpp new file mode 100644 index 0000000..3ed999f --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0063.cpp @@ -0,0 +1,43 @@ +#include +unsigned int check(unsigned int digits) +{ + unsigned int count = 0; +#ifdef ORIGINAL +typedef double Number; +#else +typedef unsigned long long Number; +#endif + Number to = 1; + for (unsigned int i = 1; i <= digits; i++) + to *= 10; + Number from = to / 10; + to--; + for (unsigned int base = 1; base <= 9; base++) + { + Number power = base; + for (unsigned int i = 1; i < digits && power <= to; i++) + power *= base; + if (power >= from && power <= to) + { + count++; +#ifndef ORIGINAL + std::cout << std::fixed << power << std::endl; +#endif + } + } + return count; +} +int main() +{ +#ifdef ORIGINAL + unsigned int count = 0; + for (unsigned int digits = 1; digits <= 21; digits++) + count += check(digits); + std::cout << count << std::endl; +#else + unsigned int digits = 9; + std::cin >> digits; + check(digits); +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0064.cpp b/hackerrank/ProjectEuler/solcpp/euler-0064.cpp new file mode 100644 index 0000000..0b2c184 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0064.cpp @@ -0,0 +1,34 @@ +#include +#include +unsigned int getPeriodLength(unsigned int x) +{ + unsigned int root = sqrt(x); + if (root * root == x) + return 0; + unsigned int a = root; + unsigned int numerator = 0; + unsigned int denominator = 1; + unsigned int period = 0; + while (a != 2 * root) + { + numerator = denominator * a - numerator; + denominator = (x - numerator * numerator) / denominator; + a = (root + numerator) / denominator; + period++; + } + return period; +} +int main() +{ + unsigned int last; + std::cin >> last; + unsigned int numOdd = 0; + for (unsigned int i = 2; i <= last; i++) + { + unsigned int period = getPeriodLength(i); + if (period % 2 == 1) + numOdd++; + } + std::cout << numOdd << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0065.cpp b/hackerrank/ProjectEuler/solcpp/euler-0065.cpp new file mode 100644 index 0000000..20b8d66 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0065.cpp @@ -0,0 +1,89 @@ +#include +#include +struct BigNum : public std::vector +{ + static const unsigned int MaxDigit = 1000000000; + BigNum(unsigned long long x = 0) + { + do + { + push_back(x % MaxDigit); + x /= MaxDigit; + } while (x > 0); + } + BigNum operator+(const BigNum& other) const + { + auto result = *this; + if (result.size() < other.size()) + result.resize(other.size(), 0); + unsigned int carry = 0; + for (size_t i = 0; i < result.size(); i++) + { + carry += result[i]; + if (i < other.size()) + carry += other[i]; + else + if (carry == 0) + return result; + if (carry < MaxDigit) + { + result[i] = carry; + carry = 0; + } + else + { + result[i] = carry - MaxDigit; + carry = 1; + } + } + if (carry > 0) + result.push_back(carry); + return result; + } + BigNum operator*(unsigned int factor) const + { + unsigned long long carry = 0; + auto result = *this; + for (auto& i : result) + { + carry += i * (unsigned long long)factor; + i = carry % MaxDigit; + carry /= MaxDigit; + } + while (carry > 0) + { + result.push_back(carry % MaxDigit); + carry /= MaxDigit; + } + return result; + } +}; +int main() +{ + unsigned int lastIndex; + std::cin >> lastIndex; + BigNum numerators[3] = { 0, + 1, + 2 }; + for (unsigned int index = 2; index <= lastIndex; index++) + { + unsigned int fractionNumber = 1; + if (index % 3 == 0) + fractionNumber = (index / 3) * 2; + numerators[0] = std::move(numerators[1]); + numerators[1] = std::move(numerators[2]); + if (fractionNumber == 1) + numerators[2] = numerators[0] + numerators[1]; + else + numerators[2] = numerators[0] + numerators[1] * fractionNumber; + } + unsigned int sum = 0; + for (auto x : numerators[2]) + while (x > 0) + { + sum += x % 10; + x /= 10; + } + std::cout << sum << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0066.cpp b/hackerrank/ProjectEuler/solcpp/euler-0066.cpp new file mode 100644 index 0000000..9d86f9a --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0066.cpp @@ -0,0 +1,136 @@ +#include +#include +#include +struct BigNum : public std::vector +{ + static const unsigned int MaxDigit = 1000000000; + BigNum(unsigned long long x = 0) + { + do + { + push_back(x % MaxDigit); + x /= MaxDigit; + } while (x > 0); + } + BigNum operator+(const BigNum& other) const + { + auto result = *this; + if (result.size() < other.size()) + result.resize(other.size(), 0); + unsigned int carry = 0; + for (size_t i = 0; i < result.size(); i++) + { + carry += result[i]; + if (i < other.size()) + carry += other[i]; + else + if (carry == 0) + return result; + if (carry < MaxDigit) + { + result[i] = carry; + carry = 0; + } + else + { + result[i] = carry - MaxDigit; + carry = 1; + } + } + if (carry > 0) + result.push_back(carry); + return result; + } + BigNum operator*(unsigned int factor) const + { + if (factor == 0) + return 0; + if (factor == 1) + return *this; + if (factor == MaxDigit) + { + auto result = *this; + result.insert(result.begin(), 0); + return result; + } + if (factor > MaxDigit) + return *this * BigNum(factor); + unsigned long long carry = 0; + auto result = *this; + for (auto& i : result) + { + carry += i * (unsigned long long)factor; + i = carry % MaxDigit; + carry /= MaxDigit; + } + while (carry > 0) + { + result.push_back(carry % MaxDigit); + carry /= MaxDigit; + } + return result; + } + BigNum operator*(const BigNum& other) const + { + BigNum result = 0; + for (int i = (int)other.size() - 1; i >= 0; i--) + result = result * MaxDigit + (*this * other[i]); + return result; + } + bool operator<(const BigNum& other) const + { + if (size() < other.size()) + return true; + if (size() > other.size()) + return false; + for (int i = (int)size() - 1; i >= 0; i--) + { + if (operator[](i) < other[i]) + return true; + if (operator[](i) > other[i]) + return false; + } + return false; + } +}; +int main() +{ + unsigned int limit = 1000; + std::cin >> limit; + unsigned int bestD = 2; + BigNum bestX = 3; + for (unsigned int d = 3; d <= limit; d++) + { + unsigned int root = sqrt(d); + if (root * root == d) + continue; + unsigned int a = root; + unsigned int numerator = 0; + unsigned int denominator = 1; + BigNum x[3] = { 0, 1, root }; + BigNum y[3] = { 0, 0, 1 }; + while (true) + { + numerator = denominator * a - numerator; + denominator = (d - numerator * numerator) / denominator; + a = (root + numerator) / denominator; + x[0] = std::move(x[1]); + x[1] = std::move(x[2]); + x[2] = x[1] * a + x[0]; + y[0] = std::move(y[1]); + y[1] = std::move(y[2]); + y[2] = y[1] * a + y[0]; + auto leftSide = x[2] * x[2]; + auto rightSide = y[2] * y[2] * d + 1; + if (leftSide == rightSide) + break; + } + if (bestX < x[2]) + { + bestX = x[2]; + bestD = d; + } + } + std::cout << bestD << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0067.cpp b/hackerrank/ProjectEuler/solcpp/euler-0067.cpp new file mode 100644 index 0000000..d32fe97 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0067.cpp @@ -0,0 +1,40 @@ +#include +#include +#include +int main() +{ + unsigned int tests = 1; + unsigned int numRows = 100; +#ifndef ORIGINAL + std::cin >> tests; +#endif + while (tests--) + { +#ifndef ORIGINAL + std::cin >> numRows; +#endif + std::vector last(1); + std::cin >> last[0]; + for (unsigned int row = 1; row < numRows; row++) + { + unsigned int numElements = row + 1; + std::vector current; + for (unsigned int column = 0; column < numElements; column++) + { + unsigned int x; + std::cin >> x; + unsigned int leftParent = 0; + if (column > 0) + leftParent = last[column - 1]; + unsigned int rightParent = 0; + if (column < last.size()) + rightParent = last[column]; + unsigned int sum = x + std::max(leftParent, rightParent); + current.push_back(sum); + } + last = current; + } + std::cout << *std::max_element(last.begin(), last.end()) << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0068.cpp b/hackerrank/ProjectEuler/solcpp/euler-0068.cpp new file mode 100644 index 0000000..94bd29d --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0068.cpp @@ -0,0 +1,60 @@ +#include +#include +#include +#include +std::set result; +unsigned int size; +unsigned int tripletSum; +void fillLine(unsigned int pos, std::vector inner, std::vector outer, unsigned int used) +{ + if (pos == size - 1) + { + outer[size - 1] = tripletSum - (inner[0] + inner[size - 1]); + unsigned int mask = 1 << outer[size - 1]; + if ((used & mask) != 0) + return; + for (auto x : outer) + if (x < outer[0]) + return; + std::string id; + for (unsigned int i = 0; i < size; i++) + id += std::to_string(outer[i]) + std::to_string(inner[i]) + std::to_string(inner[(i + 1) % size]); + result.insert(id); + return; + } + for (unsigned int i = 1; i <= 2*size; i++) + { + unsigned int innerMask = 1 << i; + if ((innerMask & used) != 0) + continue; + inner[pos + 1] = i; + unsigned int nextUsed = used | innerMask; + outer[pos] = tripletSum - (inner[pos] + i); + unsigned int outerMask = 1 << outer[pos]; + if ((nextUsed & outerMask) != 0) + continue; + nextUsed |= outerMask; + fillLine(pos + 1, inner, outer, nextUsed); + } +} +int main() +{ + std::cin >> size >> tripletSum; + std::vector inner(size); + std::vector outer(size); + unsigned int allowed = 0; + for (unsigned int i = 1; i <= 2 * size; i++) + allowed |= 1 << i; + allowed = ~allowed; + for (unsigned int i = 1; i <= 2*size; i++) + { + inner[0] = i; + fillLine(0, inner, outer, allowed | (1 << i)); + } +#ifdef ORIGINAL + std::cout << *result.rbegin() << std::endl; +#else + for (auto r : result) + std::cout << r << std::endl; +#endif +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0069.cpp b/hackerrank/ProjectEuler/solcpp/euler-0069.cpp new file mode 100644 index 0000000..2965c7d --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0069.cpp @@ -0,0 +1,21 @@ +#include +int main() +{ + const unsigned int primes[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 57 }; + unsigned int tts; + std::cin >> tts; + while (tts--) + { + unsigned long long lim; + std::cin >> lim; + unsigned long long bestPosition = 1; + for (auto p : primes) + { + if (bestPosition >= (lim + p - 1) / p) + break; + bestPosition *= p; + } + std::cout << bestPosition << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0070.cpp b/hackerrank/ProjectEuler/solcpp/euler-0070.cpp new file mode 100644 index 0000000..05112a4 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0070.cpp @@ -0,0 +1,80 @@ +#include +#include +std::vector primes; +unsigned int phi(unsigned int x, double MinQ) +{ + auto res = x; + auto red = x; + for (auto p : primes) + { + if (p*p > red) + break; + if (red % p != 0) + continue; + do + { + red /= p; + } while (red % p == 0); + res -= res / p; + if (res * MinQ < x) + return res; + } + if (res == x) + return x - 1; + if (red > 1) + return res - res / red; + else + return res; +} +unsigned long long fingerprint(unsigned int x) +{ + unsigned long long res = 0; + while (x > 0) + { + auto digit = x % 10; + x /= 10; + unsigned long long shift = 1; + for (unsigned int i = 0; i < digit; i++) + shift *= 10; + res += shift; + } + return res; +} +int main() +{ + unsigned int last; + std::cin >> last; + primes.push_back(2); + for (unsigned int i = 3; i*i < last; i += 2) + { + bool isPrime = true; + for (auto p : primes) + { + if (p*p > i) + break; + if (i % p == 0) + { + isPrime = false; + break; + } + } + if (isPrime) + primes.push_back(i); + } + unsigned int bestNumber = 2; + double MinQ = 999999; + for (unsigned int n = 3; n < last; n++) + { + auto phi_n = phi(n, MinQ); + double quotient = n / double(phi_n); + if (MinQ <= quotient) + continue; + if (fingerprint(phi_n) == fingerprint(n)) + { + MinQ = quotient; + bestNumber = n; + } + } + std::cout << bestNumber << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0071.cpp b/hackerrank/ProjectEuler/solcpp/euler-0071.cpp new file mode 100644 index 0000000..b4973bc --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0071.cpp @@ -0,0 +1,72 @@ +#include +template +void multiply(T a, T b, T& resH, T& resL) +{ + const T Shift = 4 * sizeof(a); + const T Mask = T(~0) >> Shift; + auto a_high = a >> Shift; + auto a_low = a & Mask; + auto b_high = b >> Shift; + auto b_low = b & Mask; + auto c_0 = a_low * b_low; + auto c_1a = a_high * b_low; + auto c_1b = a_low * b_high; + auto c_2 = a_high * b_high; + auto k = ((c_0 >> Shift) + (c_1a & Mask) + (c_1b & Mask)) >> Shift; + resH = c_2 + (c_1a >> Shift) + (c_1b >> Shift) + k; + resL = c_0 + (c_1a << Shift) + (c_1b << Shift); +} +bool isLess(unsigned long long a, unsigned long long b, unsigned long long c, unsigned long long d) +{ + unsigned long long r1H, r1L; + unsigned long long r2H, r2L; + multiply(a, d, r1H, r1L); + multiply(c, b, r2H, r2L); + if (r1H < r2H) + return true; + if (r1H > r2H) + return false; + return (r1L < r2L); +} +int main() +{ + unsigned int tts = 1; + std::cin >> tts; + while (tts--) + { + unsigned int a = 3; + unsigned int b = 7; + unsigned long long lim = 1000000; + std::cin >> a >> b >> lim; + unsigned long long leftN = 0; + unsigned long long leftD = 1; + unsigned long long rightN = 1; + unsigned long long rightD = 1; + while (leftD + rightD <= lim) + { + auto mediantN = leftN + rightN; + auto mediantD = leftD + rightD; + if (isLess(mediantN, mediantD, a, b)) + { + leftN = mediantN; + leftD = mediantD; + } + else + { + rightN = mediantN; + rightD = mediantD; + if (rightN == a && rightD == b) + break; + } + } + if (lim >= leftD + rightD) + { + auto difference = lim - (leftD + rightD); + auto repeat = 1 + difference / rightD; + leftN += repeat * rightN; + leftD += repeat * rightD; + } + std::cout << leftN << " " << leftD << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0072.cpp b/hackerrank/ProjectEuler/solcpp/euler-0072.cpp new file mode 100644 index 0000000..92a1994 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0072.cpp @@ -0,0 +1,25 @@ +#include +#include +int main() +{ + unsigned int lim = 1000000; + std::vector phi(lim + 1); + for (size_t i = 0; i < phi.size(); i++) + phi[i] = i; + for (unsigned int i = 2; i <= lim; i++) + { + if (phi[i] == i) + for (unsigned int k = 1; k * i <= lim; k++) + phi[k * i] -= phi[k * i] / i; + } + std::vector sums(phi.size(), 0); + for (unsigned int i = 2; i <= lim; i++) + sums[i] = sums[i - 1] + phi[i]; + unsigned int tests = 1; + std::cin >> tests; + while (tests--) + { + std::cin >> lim; + std::cout << sums[lim] << std::endl; + } +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0073.cpp b/hackerrank/ProjectEuler/solcpp/euler-0073.cpp new file mode 100644 index 0000000..55a6ce3 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0073.cpp @@ -0,0 +1,50 @@ +#include +#include +unsigned int maxD = 12000; +unsigned int recursion(unsigned int fromD, unsigned int toD) +{ + auto medD = fromD + toD; + if (medD > maxD) + return 0; + return 1 + recursion(fromD, medD) + recursion(medD, toD); +} +unsigned int iteration(unsigned int fromD, unsigned int toD) +{ + auto d = fromD + toD; + while (d + fromD <= maxD) + d += fromD; + auto prevD = fromD; + unsigned int count = 0; + while (d != toD) + { + auto nextD = maxD - (maxD + prevD) % d; + prevD = d; + d = nextD; + count++; + } + return count; +} +unsigned int rank(unsigned int n, unsigned int d) +{ + std::vector data(maxD + 1); + for (unsigned int i = 0; i < data.size(); i++) + data[i] = i * n / d; + for (unsigned int i = 1; i < data.size(); i++) + for (unsigned int j = 2*i; j < data.size(); j += i) + data[j] -= data[i]; + unsigned int sum = 0; + for (auto x : data) + sum += x; + return sum; +} +int main() +{ + unsigned int toD = 2; +#ifndef ORIGINAL + std::cin >> toD >> maxD; +#endif + auto fromD = toD + 1; + auto result = rank(1, toD) - rank(1, fromD) - 1; + std::cout << result << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0074.cpp b/hackerrank/ProjectEuler/solcpp/euler-0074.cpp new file mode 100644 index 0000000..1889442 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0074.cpp @@ -0,0 +1,77 @@ +#include +#include +#include +#include +unsigned long long fingerprintFactorial(unsigned int x) +{ + unsigned long long result = 0; + while (x > 0) + { + unsigned int digit = x % 10; + x /= 10; + if (digit == 1) + digit = 0; + unsigned long long shift = 1; + for (unsigned int i = 0; i < digit; i++) + shift *= 10; + result += shift; + } + return result; +} +int main() +{ + std::map cache; + cache[fingerprintFactorial(145)] = 1 + 1; + cache[fingerprintFactorial(169)] = 3 + 1; + unsigned int tests = 1; + std::cin >> tests; + while (tests--) + { + unsigned int limit = 1000000; + unsigned int loopLength = 60; + std::cin >> limit >> loopLength; + unsigned int result = 0; + for (unsigned int i = 0; i <= limit; i++) + { + unsigned long long id = fingerprintFactorial(i); + if (cache.count(id) == 0) + { + std::vector loop; + unsigned int x = i; + while (std::find(loop.begin(), loop.end(), x) == loop.end() && loop.size() <= loopLength) + { + loop.push_back(x); + unsigned int facSum = 0; + do + { + const unsigned int fac[10] = { 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880 }; + facSum += fac[x % 10]; + x /= 10; + } while (x > 0); + x = facSum; + } + cache[id] = loop.size(); + } + bool match = (cache[id] == loopLength); + if (i == 145) + match = (loopLength == 1); + if (i == 169 || i == 1454 || i == 363601) + match = (loopLength == 3); + if (i == 871 || i == 872 || i == 45361 || i == 45362) + match = (loopLength == 2); + if (match) + result++; +#ifndef ORIGINAL + if (match) + std::cout << i << " "; +#endif + } +#ifdef ORIGINAL + std::cout << result << std::endl; +#else + if (result == 0) + std::cout << "-1"; + std::cout << std::endl; +#endif + } +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0075.cpp b/hackerrank/ProjectEuler/solcpp/euler-0075.cpp new file mode 100644 index 0000000..d1d330f --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0075.cpp @@ -0,0 +1,52 @@ +#include +#include +#include +#include +template +T gcd(T a, T b) +{ + while (a != 0) + { + T c = a; + a = b % a; + b = c; + } + return b; +} +int main() +{ + const unsigned int MaxLength = 5 * 1000 * 1000; + std::vector combinations(MaxLength, 0); + for (unsigned int m = 2; m < sqrt(MaxLength); m++) + for (unsigned int n = 1; n < m; n++) + { + if ((m + n) % 2 != 1) + continue; + if (gcd(m, n) != 1) + continue; + auto a = m*m - n*n; + auto b = 2*m*n; + auto c = m*m + n*n; + auto sum = a + b + c; + unsigned int k = 1; + while (k*sum <= MaxLength) + { + combinations[k*sum]++; + k++; + } + } + std::vector once; + for (size_t i = 0; i < combinations.size(); i++) + if (combinations[i] == 1) + once.push_back(i); + unsigned int tests = 1; + std::cin >> tests; + while (tests--) + { + unsigned int limit = 1500000; + std::cin >> limit; + auto pos = std::upper_bound(once.begin(), once.end(), limit); + auto result = std::distance(once.begin(), pos); + std::cout << result << std::endl; + } +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0076.cpp b/hackerrank/ProjectEuler/solcpp/euler-0076.cpp new file mode 100644 index 0000000..1b0c373 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0076.cpp @@ -0,0 +1,38 @@ +#include +#include +typedef std::vector combinations; +int main() +{ + const unsigned int MaxNumber = 1000; + std::vector history; + unsigned int tests = 1; + std::cin >> tests; + while (tests--) + { + unsigned int x = 100; + std::cin >> x; + for (unsigned int j = history.size(); j <= x; j++) + { + combinations ways(MaxNumber, 0); + ways[0] = 1; + for (unsigned int i = 1; i < MaxNumber; i++) + { + ways[i] = ways[i - 1]; + auto current = i + 1; + if (j >= current) + { + auto remaining = j - current; + ways[i] += history[remaining][i]; + } + ways[i] %= 1000000007; + } + history.push_back(ways); + } + auto result = history[x]; + auto combinations = result.back(); + combinations--; + combinations %= 1000000007; + std::cout << combinations << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0077.cpp b/hackerrank/ProjectEuler/solcpp/euler-0077.cpp new file mode 100644 index 0000000..1992cc3 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0077.cpp @@ -0,0 +1,46 @@ +#include +#include +int main() +{ + const unsigned int MaxNumber = 1000; + std::vector combinations(MaxNumber + 1, 0); + combinations[0] = 1; + std::vector primes; + for (unsigned int i = 2; i <= MaxNumber; i++) + { + bool isPrime = true; + for (auto p : primes) + { + if (p*p > i) + break; + if (i % p == 0) + { + isPrime = false; + break; + } + } + if (!isPrime) + continue; + primes.push_back(i); + for (unsigned int pos = 0; pos <= MaxNumber - i; pos++) + combinations[pos + i] += combinations[pos]; + } +#ifdef ORIGINAL + for (size_t i = 0; i < combinations.size(); i++) + if (combinations[i] > 5000) + { + std::cout << i << std::endl; + break; + } +#else + unsigned int tests = 1; + std::cin >> tests; + while (tests--) + { + unsigned int n; + std::cin >> n; + std::cout << combinations[n] << std::endl; + } +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0078.cpp b/hackerrank/ProjectEuler/solcpp/euler-0078.cpp new file mode 100644 index 0000000..b70ff67 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0078.cpp @@ -0,0 +1,52 @@ +#include +#include +int main() +{ + std::vector partitions; + partitions.push_back(1); +#ifdef ORIGINAL + const long long modulo = 1000000; +#else + const long long modulo = 1000000007; + unsigned int tests = 1; + std::cin >> tests; + while (tests--) +#endif + { + unsigned int limit = 100000; +#ifndef ORIGINAL + std::cin >> limit; +#endif + for (unsigned int n = partitions.size(); n <= limit; n++) + { + long long sum = 0; + for (unsigned int i = 0; ; i++) + { + int alternate = 1 + (i / 2); + if (i % 2 == 1) + alternate = -alternate; + unsigned int offset = alternate * (3 * alternate - 1) / 2; + if (n < offset) + break; + if (i % 4 < 2) + sum += partitions[n - offset]; + else + sum -= partitions[n - offset]; + sum %= modulo; + } + if (sum < 0) + sum += modulo; +#ifdef ORIGINAL + if (sum == 0) + break; +#endif + partitions.push_back(sum); + } +#ifdef ORIGINAL + std::cout << partitions.size() << std::endl; +#else + std::cout << partitions[limit] << std::endl; +#endif + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0079.cpp b/hackerrank/ProjectEuler/solcpp/euler-0079.cpp new file mode 100644 index 0000000..887eb53 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0079.cpp @@ -0,0 +1,39 @@ +#include +#include +#include +#include +int main() +{ + unsigned int logins = 50; +#ifndef ORIGINAL + std::cin >> logins; +#endif + std::map> previous; + while (logins--) + { + std::string line; + std::cin >> line; + previous[line[0]]; + for (unsigned int i = 1; i < line.size(); i++) + previous[line[i]].insert(line[i - 1]); + } + std::string result; + while (!previous.empty()) + { + auto emptySet = previous.begin(); + while (emptySet != previous.end() && !emptySet->second.empty()) + emptySet++; + if (emptySet == previous.end()) + { + result = "SMTH WRONG"; + break; + } + auto current = emptySet->first; + result += current; + previous.erase(current); + for (auto& p : previous) + p.second.erase(current); + } + std::cout << result << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0080.cpp b/hackerrank/ProjectEuler/solcpp/euler-0080.cpp new file mode 100644 index 0000000..03675d9 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0080.cpp @@ -0,0 +1,234 @@ +#include +#include +struct BigNum : public std::vector +{ + static const unsigned int MaxDigit = 1000000000; + BigNum(unsigned long long x = 0) + { + do + { + push_back(x % MaxDigit); + x /= MaxDigit; + } while (x > 0); + } + void operator+=(unsigned int other) + { + unsigned int carry = other; + for (size_t i = 0; i < size(); i++) + { + carry += operator[](i); + if (carry == 0) + return; + if (carry < MaxDigit) + { + operator[](i) = carry; + carry = 0; + } + else + { + operator[](i) = carry % MaxDigit; + carry = carry / MaxDigit; + } + } + while (carry > 0) + { + push_back(carry % MaxDigit); + carry /= MaxDigit; + } + } + void operator+=(const BigNum& other) + { + if (size() < other.size()) + resize(other.size(), 0); + unsigned int carry = 0; + for (size_t i = 0; i < size(); i++) + { + carry += operator[](i); + if (i < other.size()) + carry += other[i]; + else + if (carry == 0) + return; + if (carry < MaxDigit) + { + operator[](i) = carry; + carry = 0; + } + else + { + operator[](i) = carry - MaxDigit; + carry = 1; + } + } + if (carry > 0) + push_back(carry); + } + void operator-=(const BigNum& other) + { + int borrow = 0; + for (size_t i = 0; i < size(); i++) + { + int diff = (int)operator[](i) - borrow; + if (i < other.size()) + diff -= other[i]; + else + if (borrow == 0) + break; + if (diff < 0) + { + borrow = 1; + diff += MaxDigit; + } + else + borrow = 0; + operator[](i) = diff; + } + while (size() > 1 && back() == 0) + pop_back(); + } + void operator*=(unsigned int factor) + { + if (factor == 0) + { + clear(); + push_back(0); + return; + } + if (factor == 1) + return; + if (factor == MaxDigit) + { + if (size() > 1 || operator[](0) > 0) + insert(begin(), 0); + return; + } + unsigned long long carry = 0; + for (auto& i : *this) + { + carry += i * (unsigned long long)factor; + i = carry % MaxDigit; + carry /= MaxDigit; + } + while (carry > 0) + { + push_back(carry % MaxDigit); + carry /= MaxDigit; + } + } + BigNum operator*(const BigNum& other) const + { + if (size() < other.size()) + return other * *this; + BigNum result = 0; + result.reserve(size() + other.size()); + for (int i = (int)other.size() - 1; i >= 0; i--) + { + BigNum temp = *this; + temp *= other[i]; + result *= MaxDigit; + result += temp; + } + return result; + } + bool operator<(const BigNum& other) const + { + if (size() < other.size()) + return true; + if (size() > other.size()) + return false; + for (int i = (int)size() - 1; i >= 0; i--) + { + if (operator[](i) < other[i]) + return true; + if (operator[](i) > other[i]) + return false; + } + return false; + } + std::string toString() const + { + std::string result; + for (auto x : *this) + { + for (unsigned int shift = 1; shift < MaxDigit; shift *= 10) + { + auto digit = (x / shift) % 10; + result.insert(0, 1, (char)digit + '0'); + } + } + while (result.size() > 1 && result.front() == '0') + result.erase(0, 1); + return result; + } +}; +BigNum jarvis(unsigned int x, const BigNum& precision) +{ + static const BigNum Fortyfive = 45; + BigNum a = x * 5; + BigNum b = 5; + a.reserve(precision.size()); + b.reserve(precision.size()); + while (b < precision) + { + if (!(a < b)) + { + a -= b; + b += 10; + } + else + { + a *= 100; + b *= 10; + b -= Fortyfive; + } + } + return b; +} +unsigned int countDigits(const BigNum& x, unsigned int numDigits) +{ + unsigned int sum = 0; + for (auto i : x.toString().substr(0, numDigits)) + sum += i - '0'; + return sum; +} +int main() +{ + unsigned int maxNumber = 100; + unsigned int digits = 100; + std::cin >> maxNumber >> digits; + const unsigned int ExtraDigits = 15; + BigNum precision = 10; + for (unsigned int i = 1; i < digits + ExtraDigits; i++) + precision *= 10; + std::vector roots(maxNumber + 1, 0); + unsigned int sum = 0; + for (unsigned int i = 1; i <= maxNumber; i++) + { + unsigned int intSqrt = 1; + while (intSqrt * intSqrt < i) + intSqrt++; + if (intSqrt * intSqrt == i) + { + roots[i] = precision * intSqrt; + continue; + } + auto factor = intSqrt - 1; + while (i % factor != 0) + factor--; + if (factor > 1) + { + auto& current = roots[i] = roots[i / factor] * roots[factor]; + if (current.size() > roots[i - 1].size()) + current.erase(current.begin(), current.begin() + (current.size() - roots[i - 1].size())); + while (current < roots[i - 1]) + current *= 10; + } + else + { + roots[i] = jarvis(i, precision); + } + sum += countDigits(roots[i], digits); + } + std::cout << sum << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0081.cpp b/hackerrank/ProjectEuler/solcpp/euler-0081.cpp new file mode 100644 index 0000000..daf690f --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0081.cpp @@ -0,0 +1,70 @@ +#include +#include +#include +typedef std::vector> Matrix; +struct Cell +{ + unsigned int x, y; + unsigned long long weight; + Cell(unsigned int x_, unsigned int y_, unsigned long long weight_) + : x(x_), y(y_), weight(weight_) {} + bool operator<(const Cell& cell) const + { + return weight > cell.weight; + } +}; +unsigned long long search(const Matrix& matrix) +{ + const auto size = matrix.size(); + std::vector> processed(matrix.size()); + for (auto& row : processed) + row.resize(matrix.size(), false); + std::priority_queue next; + next.push(Cell(0, 0, matrix[0][0])); + while (!next.empty()) + { + Cell cell = next.top(); + next.pop(); + if (processed[cell.y][cell.x]) + continue; + processed[cell.y][cell.x] = true; + if (cell.x == size - 1 && cell.y == size - 1) + return cell.weight; + if (cell.x + 1 < size) + next.push(Cell(cell.x + 1, cell.y, cell.weight + matrix[cell.y][cell.x + 1])); + if (cell.y + 1 < size) + next.push(Cell(cell.x, cell.y + 1, cell.weight + matrix[cell.y + 1][cell.x])); + } + return -1; +} +int main() +{ + unsigned int size = 80; +#ifndef ORIGINAL + std::cin >> size; +#endif + Matrix matrix(size); + for (auto& row : matrix) + { + row.resize(size); + for (auto& cell : row) + { +#ifdef ORIGINAL + cell = 0; + while (std::cin) + { + char c; + std::cin.get(c); + if (c < '0' || c > '9') + break; + cell *= 10; + cell += c - '0'; + } +#else + std::cin >> cell; +#endif + } + } + std::cout << search(matrix) << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0082.cpp b/hackerrank/ProjectEuler/solcpp/euler-0082.cpp new file mode 100644 index 0000000..6afba5c --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0082.cpp @@ -0,0 +1,73 @@ +#include +#include +#include +typedef std::vector> Matrix; +struct Cell +{ + unsigned int x, y; + unsigned long long weight; + Cell(unsigned int x_, unsigned int y_, unsigned long long weight_) + : x(x_), y(y_), weight(weight_) {} + bool operator<(const Cell& cell) const + { + return weight > cell.weight; + } +}; +unsigned long long search(const Matrix& matrix) +{ + const auto size = matrix.size(); + std::vector> processed(matrix.size()); + for (auto& row : processed) + row.resize(matrix.size(), false); + std::priority_queue next; + for (unsigned int i = 0; i < size; i++) + next.push(Cell(0, i, matrix[i][0])); + while (!next.empty()) + { + Cell cell = next.top(); + next.pop(); + if (processed[cell.y][cell.x]) + continue; + processed[cell.y][cell.x] = true; + if (cell.x == size - 1) + return cell.weight; + if (cell.x + 1 < size) + next.push(Cell(cell.x + 1, cell.y, cell.weight + matrix[cell.y][cell.x + 1])); + if (cell.y + 1 < size) + next.push(Cell(cell.x, cell.y + 1, cell.weight + matrix[cell.y + 1][cell.x])); + if (cell.y > 0) + next.push(Cell(cell.x, cell.y - 1, cell.weight + matrix[cell.y - 1][cell.x])); + } + return -1; +} +int main() +{ + unsigned int size = 80; +#ifndef ORIGINAL + std::cin >> size; +#endif + Matrix matrix(size); + for (auto& row : matrix) + { + row.resize(size); + for (auto& cell : row) + { +#ifdef ORIGINAL + cell = 0; + while (std::cin) + { + char c; + std::cin.get(c); + if (c < '0' || c > '9') + break; + cell *= 10; + cell += c - '0'; + } +#else + std::cin >> cell; +#endif + } + } + std::cout << search(matrix) << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0083.cpp b/hackerrank/ProjectEuler/solcpp/euler-0083.cpp new file mode 100644 index 0000000..6eb21dc --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0083.cpp @@ -0,0 +1,74 @@ +#include +#include +#include +typedef std::vector> Matrix; +struct Cell +{ + unsigned int x, y; + unsigned long long weight; + Cell(unsigned int x_, unsigned int y_, unsigned long long weight_) + : x(x_), y(y_), weight(weight_) {} + bool operator<(const Cell &cell) const + { + return weight > cell.weight; + } +}; +unsigned long long search(const Matrix &matrix) +{ + const auto size = matrix.size(); + std::vector> processed(matrix.size()); + for (auto &row : processed) + row.resize(matrix.size(), false); + std::priority_queue next; + next.push(Cell(0, 0, matrix[0][0])); + while (!next.empty()) + { + Cell cell = next.top(); + next.pop(); + if (processed[cell.y][cell.x]) + continue; + processed[cell.y][cell.x] = true; + if (cell.x == size - 1 && cell.y == size - 1) + return cell.weight; + if (cell.x + 1 < size) + next.push(Cell(cell.x + 1, cell.y, cell.weight + matrix[cell.y][cell.x + 1])); + if (cell.y + 1 < size) + next.push(Cell(cell.x, cell.y + 1, cell.weight + matrix[cell.y + 1][cell.x])); + if (cell.y > 0) + next.push(Cell(cell.x, cell.y - 1, cell.weight + matrix[cell.y - 1][cell.x])); + if (cell.x > 0) + next.push(Cell(cell.x - 1, cell.y, cell.weight + matrix[cell.y][cell.x - 1])); + } + return -1; +} +int main() +{ + unsigned int size = 80; +#ifndef ORIGINAL + std::cin >> size; +#endif + Matrix matrix(size); + for (auto &row : matrix) + { + row.resize(size); + for (auto &cell : row) + { +#ifdef ORIGINAL + cell = 0; + while (std::cin) + { + char c; + std::cin.get(c); + if (c < '0' || c > '9') + break; + cell *= 10; + cell += c - '0'; + } +#else + std::cin >> cell; +#endif + } + } + std::cout << search(matrix) << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0084.cpp b/hackerrank/ProjectEuler/solcpp/euler-0084.cpp new file mode 100644 index 0000000..a435adc --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0084.cpp @@ -0,0 +1,109 @@ +#include +#include +#include +#include +#include +#include +int main() +{ + unsigned int diceSize = 4; + std::cin >> diceSize; + unsigned int showFields = 3; + std::cin >> showFields; + const unsigned int Rolls = 1000000; + srand(0); + const unsigned int NumFields = 40; + const unsigned int Go = 0; + const unsigned int Jail = 10; + const unsigned int GoToJail = 30; + const unsigned int Community [3] = { 2, 17, 33 }; + const unsigned int Chance [3] = { 7, 22, 36 }; + const unsigned int NextRailway[3] = { 15, 25, 5 }; + const unsigned int NextUtility[3] = { 12, 28, 12 }; + std::vector chance, community; + for (unsigned int i = 0; i < 16; i++) + { + chance .push_back(i); + community.push_back(i); + } + std::random_shuffle(chance.begin(), chance.end()); + std::random_shuffle(community.begin(), community.end()); + unsigned int current = Go; + unsigned int doubles = 0; + std::vector count(NumFields, 0); + for (unsigned int rolls = 0; rolls < Rolls; rolls++) + { + unsigned int dice1 = (rand() % diceSize) + 1; + unsigned int dice2 = (rand() % diceSize) + 1; + unsigned int next = (current + dice1 + dice2) % NumFields; + if (dice1 == dice2) + doubles++; + else + doubles = 0; + if (doubles == 3) + { + next = Jail; + doubles = 0; + } + if (next == Chance[0] || next == Chance[1] || next == Chance[2]) + { + int id = 0; + if (next == Chance[1]) + id = 1; + if (next == Chance[2]) + id = 2; + switch (chance.front()) + { + case 0: next = Go; break; + case 1: next = Jail; break; + case 2: next = 11; break; + case 3: next = 24; break; + case 4: next = 39; break; + case 5: next = 5; break; + case 6: next = (next + NumFields - 3) % NumFields; break; + case 7: + case 8: next = NextRailway[id]; break; + case 9: next = NextUtility[id]; break; + default: break; + } + std::rotate(chance.begin(), chance.begin() + 1, chance.end()); + } + if (next == Community[0] || next == Community[1] || next == Community[2]) + { + switch (community.front()) + { + case 0: next = Go; break; + case 1: next = Jail; break; + default: break; + } + std::rotate(community.begin(), community.begin() + 1, community.end()); + } + if (next == GoToJail) + next = Jail; + count[next]++; + current = next; + } + unsigned long long sum = 0; + for (auto x : count) + sum += x; + std::multimap sorted; + for (unsigned int i = 0; i < count.size(); i++) + sorted.insert(std::make_pair(count[i] * 100.0 / sum, i)); + std::vector result; + for (auto x : sorted) + result.push_back(x.second); + auto i = result.rbegin(); +#define ORIGINAL +#ifdef ORIGINAL + for (unsigned int j = 0; j < showFields; j++) + std::cout << std::setw(2) << std::setfill('0') << *i++; +#else + const char* names[] = { "GO", "A1", "CC1", "A2", "T1", "R1", "B1", "CH1", "B2", "B3", + "JAIL", "C1", "U1", "C2", "C3", "R2", "D1", "CC2", "D2", "D3", + "FP", "E1", "CH2", "E2", "E3", "R3", "F1", "F2", "U2", "F3", + "G2J", "G1", "G2", "CC3", "G3", "R4", "CH3", "H1", "T2", "H2" }; + for (unsigned int j = 0; j < showFields; j++) + std::cout << names[*i++] << " "; +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0085.cpp b/hackerrank/ProjectEuler/solcpp/euler-0085.cpp new file mode 100644 index 0000000..055f81b --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0085.cpp @@ -0,0 +1,37 @@ +#include +#include +int main() +{ + unsigned int tests = 1; + std::cin >> tests; + while (tests--) + { + unsigned int target = 2000000; + std::cin >> target; + unsigned int root = sqrt(target); + unsigned int bestRectangles = 0; + unsigned int bestArea = 0; + for (unsigned int x = 1; x <= root + 1; x++) + { + unsigned int y = x; + unsigned int rectangles = 0; + do + { + unsigned int area = x * y; + rectangles = x * (x + 1) * y * (y + 1) / 4; + if (abs(bestRectangles - target) > abs(rectangles - target)) + { + bestRectangles = rectangles; + bestArea = area; + } + if (abs(bestRectangles - target) == abs(rectangles - target) && bestArea < area) + bestArea = area; + y++; + } while (rectangles < target); + if (y == x + 1) + break; + } + std::cout << bestArea << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0086.cpp b/hackerrank/ProjectEuler/solcpp/euler-0086.cpp new file mode 100644 index 0000000..eceac56 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0086.cpp @@ -0,0 +1,80 @@ +#include +#include +#include +unsigned int combinations(unsigned int a, unsigned int b_c) +{ + if (2*a < b_c) + return 0; + if (a >= b_c) + return b_c / 2; + return a - (b_c - 1) / 2; +} +unsigned long long countSingle(unsigned int a) +{ + unsigned long long sum = 0; + for (unsigned int b_c = 1; b_c <= 2 * a; b_c++) + { + auto diagonalSquared = a * a + b_c * b_c; + unsigned int root = sqrt(diagonalSquared); + if (root * root == diagonalSquared) + sum += combinations(a, b_c); + } + return sum; +} +unsigned int gcd(unsigned int x, unsigned int y) +{ + while (x != 0) + { + auto temp = x; + x = y % x; + y = temp; + } + return y; +} +std::vector countAll(unsigned int limit) +{ + std::vector solutions(limit + 1, 0); + for (unsigned int m = 1; m <= sqrt(2*limit); m++) + for (unsigned int n = 1; n < m; n++) + { + if (m % 2 == n % 2) + continue; + if (gcd(m, n) != 1) + continue; + auto x = m*m - n*n; + auto y = 2*m*n; + for (unsigned int k = 1; k*x <= limit; k++) + solutions[k*x] += combinations(k*x, k*y); + for (unsigned int k = 1; k*y <= limit; k++) + solutions[k*y] += combinations(k*y, k*x); + } + return solutions; +} +int main() +{ +#ifdef ORIGINAL + unsigned int sum = 0; + unsigned int a = 0; + while (sum <= 1000000) + sum += countSingle(++a); + std::cout << a << std::endl; +#else + auto solutions = countAll(1000000); + std::vector total; + unsigned long long sum = 0; + for (auto i : solutions) + { + sum += i; + total.push_back(sum); + } + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned int maxA; + std::cin >> maxA; + std::cout << total[maxA] << std::endl; + } +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0087.cpp b/hackerrank/ProjectEuler/solcpp/euler-0087.cpp new file mode 100644 index 0000000..ef33825 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0087.cpp @@ -0,0 +1,51 @@ +#include +#include +#include +int main() +{ + const unsigned int MaxLimit = 100 * 1000 * 1000; + std::vector primes; + primes.push_back(2); + for (unsigned int i = 3; i*i < MaxLimit; i += 2) + { + bool isPrime = true; + for (auto p : primes) + { + if (p*p > i) + break; + if (i % p == 0) + { + isPrime = false; + break; + } + } + if (isPrime) + primes.push_back(i); + } + std::vector sums; + for (auto a : primes) + for (auto b : primes) + for (auto c : primes) + { + auto a2 = a*a; + auto b3 = (unsigned long long)b*b*b; + auto c4 = (unsigned long long)c*c*c*c; + auto sum = a2 + b3 + c4; + if (sum > MaxLimit) + break; + sums.push_back(sum); + } + std::sort(sums.begin(), sums.end()); + auto last = std::unique(sums.begin(), sums.end()); + unsigned int tests = 1; + std::cin >> tests; + while (tests--) + { + unsigned int limit = MaxLimit; + std::cin >> limit; + auto pos = std::upper_bound(sums.begin(), last, limit); + auto num = std::distance(sums.begin(), pos); + std::cout << num << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0088.cpp b/hackerrank/ProjectEuler/solcpp/euler-0088.cpp new file mode 100644 index 0000000..cb41f08 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0088.cpp @@ -0,0 +1,54 @@ +#include +#include +const unsigned int Limit = 200000; +std::vector minK(Limit, 9999999); +bool valid(unsigned int n, unsigned int k) +{ + if (k >= minK.size()) + return false; + if (minK[k] > n) + { + minK[k] = n; + return true; + } + return false; +} +unsigned int getMinK(unsigned int n, unsigned int product, unsigned int sum, + unsigned int depth = 1, unsigned int minFactor = 2) +{ + if (product == 1) + return valid(n, depth + sum - 1) ? 1 : 0; + unsigned int result = 0; + if (depth > 1) + { + if (product == sum) + return valid(n, depth) ? 1 : 0; + if (valid(n, depth + sum - product)) + result++; + } + for (unsigned int i = minFactor; i*i <= product; i++) + if (product % i == 0) + result += getMinK(n, product / i, sum - i, depth + 1, i); + return result; +} +int main() +{ + unsigned int limit; + std::cin >> limit; + minK.resize(limit + 1); + unsigned int n = 4; + unsigned int sum = 0; + unsigned int todo = limit - 1; + while (todo > 0) + { + unsigned int found = getMinK(n, n, n); + if (found > 0) + { + todo -= found; + sum += n; + } + n++; + } + std::cout << sum << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0089.cpp b/hackerrank/ProjectEuler/solcpp/euler-0089.cpp new file mode 100644 index 0000000..51672dc --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0089.cpp @@ -0,0 +1,76 @@ +#include +#include +unsigned int roman2number(const std::string& roman) +{ + unsigned int result = 0; + unsigned int last = 0; + bool subtract = false; + for (auto i = roman.rbegin(); i != roman.rend(); i++) + { + unsigned int current = 0; + switch (*i) + { + case 'M': current = 1000; break; + case 'D': current = 500; break; + case 'C': current = 100; break; + case 'L': current = 50; break; + case 'X': current = 10; break; + case 'V': current = 5; break; + case 'I': current = 1; break; + } + if (current < last) + { + subtract = true; + last = current; + } + else if (current > last) + { + subtract = false; + last = current; + } + if (subtract) + result -= current; + else + result += current; + } + return result; +} +std::string number2roman(unsigned int number) +{ + const unsigned int NumRules = 13; + const unsigned int rules[NumRules] = + { 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 }; + const char* action[NumRules] = + { "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" }; + std::string result; + for (unsigned int i = 0; i < NumRules; i++) + while (number >= rules[i]) + { + number -= rules[i]; + result += action[i]; + } + return result; +} +int main() +{ + unsigned int saved = 0; + unsigned int tests = 1000; +#ifndef ORIGINAL + std::cin >> tests; +#endif + while (tests--) + { + std::string roman; + std::cin >> roman; + auto number = roman2number(roman); + auto optimized = number2roman(number); + saved += roman.size() - optimized.size(); +#ifndef ORIGINAL + std::cout << optimized << std::endl; +#endif + } +#ifdef ORIGINAL + std::cout << saved << std::endl; +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0090.cpp b/hackerrank/ProjectEuler/solcpp/euler-0090.cpp new file mode 100644 index 0000000..d9dfa5b --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0090.cpp @@ -0,0 +1,141 @@ +#include +#include +#include +typedef std::vector Dice; +const Dice Sides = { 0,1,2,3,4,5,6,7,8,9 }; +const unsigned int Skip = 0; +const unsigned int Take = 1; +const std::vector Initial = { Skip,Skip,Skip,Skip, Take,Take,Take,Take,Take,Take }; +const std::vector Unused = { Take }; +int main() +{ + unsigned int dices = 2; + unsigned int limit = 9; + std::cin >> limit >> dices; + const unsigned int AllDices = 3; + unsigned int maxSquare = 0; + std::vector squares; + for (unsigned int i = 1; i <= limit; i++) + { + auto reduce = i*i; + maxSquare = reduce; + std::vector digits; + for (unsigned int j = 0; j < AllDices; j++) + { + auto digit = reduce % 10; + reduce /= 10; + if (digit == 9) + digit = 6; + digits.push_back(digit); + } + std::sort(digits.begin(), digits.end()); + auto sortedSquare = digits[0] * 100 + digits[1] * 10 + digits[2]; + if (std::find(squares.begin(), squares.end(), sortedSquare) == squares.end()) + squares.push_back(sortedSquare); + } + unsigned int valid = 0; + Dice dice1, dice2, dice3; + auto open = squares; + auto permutationDice1 = Initial; + auto permutationDice2 = Initial; + auto permutationDice3 = Initial; + do + { + dice1.clear(); + for (size_t i = 0; i < permutationDice1.size(); i++) + if (permutationDice1[i] == Take) + dice1.push_back(Sides[i]); + permutationDice2 = (dices >= 2 ? permutationDice1 : Unused); + do + { + dice2.clear(); + for (size_t i = 0; i < permutationDice2.size(); i++) + if (permutationDice2[i] == Take) + dice2.push_back(Sides[i]); + if (maxSquare >= 100) + { + if (std::count(dice1.begin(), dice1.end(), 0) + + std::count(dice2.begin(), dice2.end(), 0) < 1) + continue; + } + if (maxSquare >= 144) + { + if (std::count(dice1.begin(), dice1.end(), 4) + + std::count(dice2.begin(), dice2.end(), 4) < 1) + continue; + } + permutationDice3 = (dices == 3 ? permutationDice2 : Unused); + do + { + dice3.clear(); + for (size_t i = 0; i < permutationDice3.size(); i++) + if (permutationDice3[i] == Take) + dice3.push_back(Sides[i]); + unsigned int frequency[10] = { 0,0,0,0,0, 0,0,0,0,0 }; + for (auto x : dice1) + frequency[x]++; + for (auto x : dice2) + frequency[x]++; + for (auto x : dice3) + frequency[x]++; + if (frequency[1] < 1) + continue; + if (maxSquare >= 4 && frequency[4] < 1) + continue; + if (maxSquare >= 25 && frequency[2] < 1) + continue; + if (maxSquare >= 25 && frequency[5] < 1) + continue; + if (maxSquare >= 36 && frequency[3] < 1) + continue; + if (maxSquare >= 81 && frequency[8] < 1) + continue; + if (maxSquare >= 100 && frequency[0] < 2) + continue; + if (maxSquare >= 144 && frequency[4] < 2) + continue; + std::vector matches; + for (auto one : dice1) + { + if (one == 9) + one = 6; + for (auto two : dice2) + { + if (two == 9) + two = 6; + for (auto three : dice3) + { + if (three == 9) + three = 6; + unsigned int current[AllDices] = { one, two, three }; + if (current[0] > current[1]) + std::swap(current[0], current[1]); + if (current[1] > current[2]) + std::swap(current[1], current[2]); + if (current[0] > current[1]) + std::swap(current[0], current[1]); + auto sortedSquare = 100 * current[0] + 10 * current[1] + current[2]; + auto match = std::find(squares.begin(), squares.end(), sortedSquare); + if (match != squares.end()) + matches.push_back(sortedSquare); + } + } + } + if (matches.size() < squares.size()) + continue; + std::sort(matches.begin(), matches.end()); + auto last = std::unique(matches.begin(), matches.end()); + open = squares; + for (auto m = matches.begin(); m != last; m++) + { + auto match = std::find(open.begin(), open.end(), *m); + open.erase(match); + } + if (open.empty()) + valid++; + } while (std::next_permutation(permutationDice3.begin(), permutationDice3.end())); + } while (std::next_permutation(permutationDice2.begin(), permutationDice2.end())); + } while (std::next_permutation(permutationDice1.begin(), permutationDice1.end())); + std::cout << valid; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0091.cpp b/hackerrank/ProjectEuler/solcpp/euler-0091.cpp new file mode 100644 index 0000000..cbb1f0d --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0091.cpp @@ -0,0 +1,49 @@ +#include +#include +unsigned int gcd(unsigned int a, unsigned int b) +{ + while (a != 0) + { + unsigned int c = a; + a = b % a; + b = c; + } + return b; +} +int main() +{ + unsigned int size = 50; + std::cin >> size; + unsigned int result = size*size; + result += size*size; + result += size*size; + for (unsigned int p_x = 1; p_x <= size; p_x++) + for (unsigned int p_y = 1; p_y <= p_x; p_y++) + { + unsigned int factor = gcd(p_x, p_y); + unsigned int deltaX = p_x / factor; + unsigned int deltaY = p_y / factor; + unsigned int found = 0; + int q_x = p_x - deltaY; + int q_y = p_y + deltaX; + while (q_x >= 0 && q_y <= (int)size) + { + found++; + q_x -= deltaY; + q_y += deltaX; + } + q_x = p_x + deltaY; + q_y = p_y - deltaX; + while (q_y >= 0 && q_x <= (int)size) + { + found++; + q_x += deltaY; + q_y -= deltaX; + } + if (p_x != p_y) + found *= 2; + result += found; + } + std::cout << result << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0092.cpp b/hackerrank/ProjectEuler/solcpp/euler-0092.cpp new file mode 100644 index 0000000..f781287 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0092.cpp @@ -0,0 +1,48 @@ +#include +bool becomes89(unsigned int x) +{ + do + { + unsigned int squareDigitSum = 0; + auto reduce = x; + while (reduce > 0) + { + auto digit = reduce % 10; + reduce /= 10; + squareDigitSum += digit * digit; + } + if (squareDigitSum == 89) + return true; + if (squareDigitSum == 1) + return false; + x = squareDigitSum; + } while (true); +} +int main() +{ + unsigned int digits = 7; + std::cin >> digits; + const unsigned int Modulo = 1000000007; + unsigned int sums[200*9*9 + 1] = { 0 }; + for (unsigned int first = 0; first <= 9; first++) + sums[first * first]++; + for (unsigned int length = 2; length <= digits; length++) + for (unsigned int sum = length*9*9; sum > 0; sum--) + for (unsigned int high = 1; high <= 9; high++) + { + auto square = high * high; + if (square > sum) + break; + sums[sum] += sums[sum - square]; + sums[sum] %= Modulo; + } + unsigned int count89 = 0; + for (unsigned int i = 1; i <= digits*9*9; i++) + if (becomes89(i)) + { + count89 += sums[i]; + count89 %= Modulo; + } + std::cout << count89 << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0093.cpp b/hackerrank/ProjectEuler/solcpp/euler-0093.cpp new file mode 100644 index 0000000..1dfbcea --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0093.cpp @@ -0,0 +1,83 @@ +#include +#include +#include +const double Epsilon = 0.00001; +void eval(const std::vector& numbers, std::vector& used) +{ + if (numbers.size() == 1) + { + auto result = numbers.front() + Epsilon; + if (fmod(result, 1) > 10*Epsilon) + return; + int index = int(result + Epsilon); + if (index >= 0 && index < (int)used.size()) + used[index] = true; + return; + } + auto next = numbers; + for (size_t i = 0; i < numbers.size(); i++) + for (size_t j = i + 1; j < numbers.size(); j++) + { + double a = numbers[i]; + double b = numbers[j]; + next = numbers; + next.erase(next.begin() + j); + next.erase(next.begin() + i); + next.push_back(a + b); + eval(next, used); + next.back() = a - b; + eval(next, used); + next.back() = b - a; + eval(next, used); + next.back() = a * b; + eval(next, used); + if (b != 0) + { + next.back() = a / b; + eval(next, used); + } + if (a != 0) + { + next.back() = b / a; + eval(next, used); + } + } +} +unsigned int getSequenceLength(const std::vector& numbers) +{ + std::vector used(1000, false); + eval(numbers, used); + unsigned int result = 0; + while (used[result + 1]) + result++; + return result; +} +int main() +{ +#define ORIGINAL +#ifdef ORIGINAL + unsigned int longestSequence = 0; + unsigned int longestDigits = 0; + for (unsigned int a = 1; a <= 6; a++) + for (unsigned int b = a+1; b <= 7; b++) + for (unsigned int c = b+1; c <= 8; c++) + for (unsigned int d = c+1; d <= 9; d++) + { + auto sequenceLength = getSequenceLength({ double(a), double(b), double(c), double(d) }); + if (longestSequence < sequenceLength) + { + longestSequence = sequenceLength; + longestDigits = a * 1000 + b * 100 + c * 10 + d; + } + } + std::cout << longestDigits << std::endl; +#else + unsigned int numDigits; + std::cin >> numDigits; + std::vector numbers(numDigits); + for (auto& x : numbers) + std::cin >> x; + std::cout << getSequenceLength(numbers); +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0094.cpp b/hackerrank/ProjectEuler/solcpp/euler-0094.cpp new file mode 100644 index 0000000..4f4fed5 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0094.cpp @@ -0,0 +1,65 @@ +#include +#include +#include +std::vector solutions; +bool isValidTriangle(unsigned long long oneSide, unsigned long long twoSides) +{ + unsigned long long check = 4 * twoSides * twoSides - oneSide * oneSide; + unsigned long long root = sqrt(check); + return root * root == check; +} +unsigned long long findMore(unsigned long long perimeter, unsigned long long limit) +{ + while (perimeter <= limit + 3) + { + auto twoSides = perimeter / 3; + auto oneSide = twoSides - 1; + if (isValidTriangle(oneSide, twoSides)) + solutions.push_back(perimeter - 1); + oneSide = twoSides + 1; + if (isValidTriangle(oneSide, twoSides)) + solutions.push_back(perimeter + 1); + perimeter += 3; + } + return perimeter; +} +unsigned long long sequence(unsigned long long limit) +{ + unsigned long long plusOne [] = { 1, 5 }; + unsigned long long minusOne[] = { 1, 17 }; + solutions.clear(); + solutions.push_back(3 * plusOne [1] + 1); + solutions.push_back(3 * minusOne[1] - 1); + while (solutions.back() <= limit + 3) + { + unsigned long long nextPlusOne = 14 * plusOne [1] - plusOne [0] - 4; + unsigned long long nextMinusOne = 14 * minusOne[1] - minusOne[0] + 4; + plusOne [0] = plusOne [1]; + plusOne [1] = nextPlusOne; + minusOne[0] = minusOne[1]; + minusOne[1] = nextMinusOne; + solutions.push_back(3 * nextPlusOne + 1); + solutions.push_back(3 * nextMinusOne - 1); + } + return solutions.back(); +} +int main() +{ + solutions.push_back(16); + unsigned long long perimeter = 18; + unsigned int tests = 1; + std::cin >> tests; + while (tests--) + { + unsigned long long limit = 1000000000; + std::cin >> limit; + while (perimeter <= limit + 3) + perimeter = sequence(limit); + unsigned long long sum = 0; + for (auto x : solutions) + if (x <= limit) + sum += x; + std::cout << sum << std::endl; + } + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0095.cpp b/hackerrank/ProjectEuler/solcpp/euler-0095.cpp new file mode 100644 index 0000000..cde67fa --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0095.cpp @@ -0,0 +1,88 @@ +#include +#include +int main() +{ + unsigned int limit; + std::cin >> limit; + std::vector primes; + primes.push_back(2); + for (unsigned int i = 3; i <= limit; i += 2) + { + bool isPrime = true; + for (auto p : primes) + { + if (p*p > i) + break; + if (i % p == 0) + { + isPrime = false; + break; + } + } + if (isPrime) + primes.push_back(i); + } + std::vector divsum(limit + 1, 0); + for (unsigned int i = 2; i <= limit; i++) + { + unsigned int sum = 1; + unsigned int reduce = i; + for (auto p : primes) + { + if (p*p > reduce) + break; + unsigned int factor = 1; + while (reduce % p == 0) + { + reduce /= p; + factor *= p; + factor++; + } + sum *= factor; + } + if (reduce > 1 && reduce < i) + sum *= reduce + 1; + if (sum > 1) + sum -= i; + divsum[i] = sum; + } + unsigned int longestChain = 0; + unsigned int smallestMember = limit; + for (unsigned int i = 1; i <= limit; i++) + { + static std::vector chain; + chain.clear(); + chain.push_back(i); + while (true) + { + unsigned int add = divsum[chain.back()]; + chain.push_back(add); + if (add == i) + break; + if (add < i) + break; + if (add > limit) + break; + bool isLoop = false; + for (size_t j = 1; j < chain.size() - 1; j++) + if (add == chain[j]) + { + isLoop = true; + break; + } + if (isLoop) + break; + } + if (chain.back() != i) + continue; + if (chain.size() < longestChain) + continue; + if (longestChain < chain.size()) + { + longestChain = chain.size(); + smallestMember = chain.front(); + } + } + std::cout << smallestMember << std::endl; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0096.cpp b/hackerrank/ProjectEuler/solcpp/euler-0096.cpp new file mode 100644 index 0000000..66c2655 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0096.cpp @@ -0,0 +1,76 @@ +#include +#include +typedef unsigned int Board[9][9]; +const unsigned int Empty = 0; +bool solve(Board& board) +{ + for (unsigned int y = 0; y < 9; y++) + for (unsigned int x = 0; x < 9; x++) + { + if (board[x][y] != Empty) + continue; + bool available[9+1] = { false, true, true, true, true, true, true, true, true, true }; + for (unsigned int i = 0; i < 9; i++) + { + if (board[i][y] != Empty) + available[board[i][y]] = false; + if (board[x][i] != Empty) + available[board[x][i]] = false; + } + unsigned int rx = (x / 3) * 3; + unsigned int ry = (y / 3) * 3; + for (unsigned int i = 0; i < 3; i++) + for (unsigned int j = 0; j < 3; j++) + if (board[i + rx][j + ry] != Empty) + available[board[i + rx][j + ry]] = false; + for (unsigned int i = 1; i <= 9; i++) + if (available[i]) + { + board[x][y] = i; + if (solve(board)) + return true; + } + board[x][y] = Empty; + return false; + } + return true; +} +int main() +{ +#ifdef ORIGINAL + unsigned int tests = 50; + unsigned int sum = 0; +#else + unsigned int tests = 1; +#endif + while (tests--) + { +#ifdef ORIGINAL + std::string dummy; + std::cin >> dummy >> dummy; +#endif + Board board; + for (unsigned int y = 0; y < 9; y++) + { + std::string line; + std::cin >> line; + for (unsigned int x = 0; x < 9; x++) + board[x][y] = line[x] - '0'; + } + solve(board); +#ifdef ORIGINAL + sum += 100 * board[0][0] + 10 * board[1][0] + board[2][0]; +#else + for (unsigned int y = 0; y < 9; y++) + { + for (unsigned int x = 0; x < 9; x++) + std::cout << board[x][y]; + std::cout << std::endl; + } +#endif + } +#ifdef ORIGINAL + std::cout << sum; +#endif + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0097.cpp b/hackerrank/ProjectEuler/solcpp/euler-0097.cpp new file mode 100644 index 0000000..3ba9ec8 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0097.cpp @@ -0,0 +1,38 @@ +#include +#include +typedef unsigned __int128 BigNum; +#ifdef ORIGINAL +const unsigned int Digits = 10; +const BigNum Modulo = 10000000000ULL; +#else +const unsigned int Digits = 12; +const BigNum Modulo = 1000000000000ULL; +#endif +BigNum powmod(BigNum base, unsigned int exponent, BigNum modulo) +{ + BigNum result = 1; + while (exponent > 0) + { + if (exponent & 1) + result = (result * base) % modulo; + base = (base * base) % modulo; + exponent >>= 1; + } + return result; +} +int main() +{ + unsigned long long sum = 0; + unsigned int tests = 1; + std::cin >> tests; + while (tests--) + { + unsigned long long factor, base, exponent, add; + std::cin >> factor >> base >> exponent >> add; + unsigned long long result = (powmod(base, exponent, Modulo) * factor + add) % Modulo; + sum += result; + sum %= Modulo; + } + std::cout << std::setfill('0') << std::setw(Digits) << sum; + return 0; +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0098.cpp b/hackerrank/ProjectEuler/solcpp/euler-0098.cpp new file mode 100644 index 0000000..d2e1c68 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0098.cpp @@ -0,0 +1,169 @@ +#include +#include +#include +#include +#include +#include +#include +unsigned long long fingerprint(unsigned long long x) +{ + unsigned long long result = 0; + while (x > 0) + { + auto digit = x % 10; + x /= 10; + result += 1LL << (4 * digit); + } + return result; +} +#ifdef ORIGINAL +std::string readWord() +{ + std::string result; + while (true) + { + char c = std::cin.get(); + if (!std::cin) + break; + if (c == '"') + continue; + if (c == ',') + break; + result += c; + } + return result; +} +unsigned long long match(const std::string& a, const std::string& b, const std::vector& squares) +{ + unsigned long long result = 0; + for (auto i : squares) + for (auto j : squares) + { + if (i == j) + continue; + auto replaceA = std::to_string(i); + auto replaceB = std::to_string(j); + std::map replaceTable; + bool valid = true; + for (size_t k = 0; k < replaceA.size(); k++) + { + char original = replaceA[k]; + if (replaceTable.count(original) != 0 && + replaceTable[original] != a[k]) + valid = false; + replaceTable[original] = a[k]; + } + std::set used; + for (auto x : replaceTable) + { + if (used.count(x.second) != 0) + valid = false; + used.insert(x.second); + } + if (!valid) + continue; + std::string aa; + for (auto x : replaceA) + aa += replaceTable[x]; + if (aa != a) + continue; + std::string bb; + for (auto x : replaceB) + bb += replaceTable[x]; + if (bb != b) + continue; + if (result < i) + result = i; + if (result < j) + result = j; + } + return result; +} +int main() +{ + std::map> anagrams; + while (true) + { + auto word = readWord(); + if (word.empty()) + break; + auto sorted = word; + std::sort(sorted.begin(), sorted.end()); + anagrams[sorted].push_back(word); + } + size_t maxDigits = 0; + for (auto i : anagrams) + if (i.second.size() > 1) + if (maxDigits < i.second.front().size()) + maxDigits = i.second.front().size(); + unsigned long long maxNumber = 1; + for (size_t i = 0; i < maxDigits; i++) + maxNumber *= 10; + std::map> permutations; + std::map> fingerprintLength; + unsigned long long base = 1; + while (base*base <= maxNumber) + { + auto square = base*base; + auto id = fingerprint(square); + permutations[id].push_back(square); + auto numDigits = log10(square - 1) + 1; + fingerprintLength[numDigits].insert(id); + base++; + } + unsigned long long result = 0; + for (auto i : anagrams) + { + auto pairs = i.second; + if (pairs.size() == 1) + continue; + auto length = pairs.front().size(); + for (size_t i = 0; i < pairs.size(); i++) + for (size_t j = i + 1; j < pairs.size(); j++) + { + for (auto id : fingerprintLength[length]) + { + auto best = match(pairs[i], pairs[j], permutations[id]); + if (result < best) + result = best; + } + } + } + std::cout << result << std::endl; +} +#else +int main() +{ + unsigned int digits; + std::cin >> digits; + unsigned long long minNumber = 1; + for (unsigned int i = 1; i < digits; i++) + minNumber *= 10; + unsigned long long maxNumber = minNumber * 10 - 1; + unsigned long long base = sqrt(minNumber); + if (base*base < minNumber) + base++; + std::map> permutations; + while (base*base <= maxNumber) + { + auto square = base*base; + permutations[fingerprint(square)].push_back(square); + base++; + } + size_t bestCount = 0; + unsigned long long highestSquare = 0; + for (auto p : permutations) + { + auto size = p.second.size(); + auto high = p.second.back(); + if (bestCount == size && highestSquare < high) + highestSquare = high; + if (bestCount < size) + { + bestCount = size; + highestSquare = high; + } + } + std::cout << highestSquare << std::endl; +} +#endif diff --git a/hackerrank/ProjectEuler/solcpp/euler-0099.cpp b/hackerrank/ProjectEuler/solcpp/euler-0099.cpp new file mode 100644 index 0000000..5fa1795 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0099.cpp @@ -0,0 +1,38 @@ +#include +#include +#include +#define ORIGINAL +int main() +{ +#ifdef ORIGINAL + std::map data; + for (unsigned int i = 1; i <= 1000; i++) + { + unsigned int base, exponent; + char comma; + std::cin >> base >> comma >> exponent; + data[exponent * log(base)] = i; + } + std::cout << data.rbegin()->second << std::endl; + return 0; +#else + unsigned int numbers; + std::cin >> numbers; + std::map> data; + for (unsigned int i = 1; i <= numbers; i++) + { + unsigned int base, exponent; + std::cin >> base >> exponent; + data[exponent * log(base)] = std::make_pair(base, exponent); + } + unsigned int pos; + std::cin >> pos; + auto i = data.begin(); + std::advance(i, pos - 1); + auto result = i->second; + auto base = result.first; + auto exponent = result.second; + std::cout << base << " " << exponent << std::endl; + return 0; +#endif +} diff --git a/hackerrank/ProjectEuler/solcpp/euler-0100.cpp b/hackerrank/ProjectEuler/solcpp/euler-0100.cpp new file mode 100644 index 0000000..907b608 --- /dev/null +++ b/hackerrank/ProjectEuler/solcpp/euler-0100.cpp @@ -0,0 +1,57 @@ +#include +#include +int main() +{ + unsigned int tests; + std::cin >> tests; + while (tests--) + { + unsigned long long minimum = 1000000000000ULL; + unsigned long long p = 1; + unsigned long long q = 2; + std::cin >> p >> q >> minimum; + unsigned long long blue = 0; + unsigned long long red = 0; + if (p == 1 && q == 2) + { + blue = 15; + red = 6; + while (blue + red < minimum) + { + red = 2 * blue + red - 1; + blue += 2 * red; + } +#ifdef ORIGINAL + std::cout << blue << std::endl; +#else + std::cout << blue << " " << (red + blue) << std::endl; +#endif + continue; + } + bool found = false; + for (blue = 2; blue < 100000; blue++) + { + unsigned long long b2 = blue * (blue - 1); + b2 *= q; + if (b2 % p != 0) + continue; + unsigned long long sum2 = b2 / p; + unsigned long long sum = std::sqrt(sum2) + 1; + if (sum * (sum - 1) != sum2) + continue; + red = sum - blue; + if (blue + red >= minimum) + { + found = true; + break; + } + } + if (!found) + { + std::cout << "No solution" << std::endl; + continue; + } + std::cout << blue << " " << (red + blue) << std::endl; + } + return 0; +} diff --git a/hackerrank/SQL/Advanced Join/Placements/solution.sql b/hackerrank/SQL/Advanced Join/Placements/solution.sql new file mode 100644 index 0000000..5588f66 --- /dev/null +++ b/hackerrank/SQL/Advanced Join/Placements/solution.sql @@ -0,0 +1,12 @@ +SELECT Name + FROM Students s + INNER JOIN Friends f + ON s.ID = f.ID + + INNER JOIN Packages sp + ON s.ID = sp.ID + + INNER JOIN Packages fp + ON f.Friend_ID = fp.ID + WHERE fp.Salary > sp.Salary + ORDER BY fp.Salary; diff --git a/hackerrank/SQL/Advanced Select/Binary Tree Nodes/solution.sql b/hackerrank/SQL/Advanced Select/Binary Tree Nodes/solution.sql new file mode 100644 index 0000000..4ec7dbb --- /dev/null +++ b/hackerrank/SQL/Advanced Select/Binary Tree Nodes/solution.sql @@ -0,0 +1,8 @@ +SELECT N, + CASE + WHEN P IS NULL THEN 'Root' + WHEN N IN (SELECT P FROM BST) THEN 'Inner' + ELSE 'Leaf' + END + FROM BST + ORDER BY N; diff --git a/hackerrank/SQL/Advanced Select/The PADS/solution.sql b/hackerrank/SQL/Advanced Select/The PADS/solution.sql new file mode 100644 index 0000000..183c416 --- /dev/null +++ b/hackerrank/SQL/Advanced Select/The PADS/solution.sql @@ -0,0 +1,9 @@ +SELECT CONCAT(Name, '(', LEFT(Occupation, 1), ')') AS 'Name(Profession)' + FROM OCCUPATIONS + ORDER BY Name; + +SELECT CONCAT('There are a total of ', COUNT(*), ' ', LOWER(Occupation), 's.') + FROM OCCUPATIONS + GROUP BY Occupation + ORDER BY COUNT(*), + Occupation; diff --git a/hackerrank/SQL/Advanced Select/Type of Triangle/solution.sql b/hackerrank/SQL/Advanced Select/Type of Triangle/solution.sql new file mode 100644 index 0000000..8ab4efb --- /dev/null +++ b/hackerrank/SQL/Advanced Select/Type of Triangle/solution.sql @@ -0,0 +1,15 @@ +SELECT CASE WHEN A + B <= C + OR A + C <= B + OR B + C <= A + THEN 'Not A Triangle' + WHEN A = B + AND A = C + AND B = C + THEN 'Equilateral' + WHEN A = B + OR A = C + OR B = C + THEN 'Isosceles' + ELSE 'Scalene' + END + FROM TRIANGLES; diff --git a/hackerrank/SQL/Aggregation/Average Population/solution.sql b/hackerrank/SQL/Aggregation/Average Population/solution.sql new file mode 100644 index 0000000..2a875c7 --- /dev/null +++ b/hackerrank/SQL/Aggregation/Average Population/solution.sql @@ -0,0 +1,2 @@ +SELECT FLOOR(AVG(POPULATION)) + FROM CITY; diff --git a/hackerrank/SQL/Aggregation/Japan Population/solution.sql b/hackerrank/SQL/Aggregation/Japan Population/solution.sql new file mode 100644 index 0000000..a7304fd --- /dev/null +++ b/hackerrank/SQL/Aggregation/Japan Population/solution.sql @@ -0,0 +1,3 @@ +SELECT SUM(POPULATION) + FROM CITY + WHERE COUNTRYCODE = 'JPN'; diff --git a/hackerrank/SQL/Aggregation/Population Density Difference/solution.sql b/hackerrank/SQL/Aggregation/Population Density Difference/solution.sql new file mode 100644 index 0000000..cea0eeb --- /dev/null +++ b/hackerrank/SQL/Aggregation/Population Density Difference/solution.sql @@ -0,0 +1,2 @@ +SELECT MAX(POPULATION) - MIN(POPULATION) + FROM CITY; diff --git a/hackerrank/SQL/Aggregation/Revising Aggregations - Averages/solution.sql b/hackerrank/SQL/Aggregation/Revising Aggregations - Averages/solution.sql new file mode 100644 index 0000000..88323ee --- /dev/null +++ b/hackerrank/SQL/Aggregation/Revising Aggregations - Averages/solution.sql @@ -0,0 +1,3 @@ +SELECT AVG(POPULATION) + FROM CITY + WHERE DISTRICT = 'California'; \ No newline at end of file diff --git a/hackerrank/SQL/Aggregation/Revising Aggregations - The Count Function/solution.sql b/hackerrank/SQL/Aggregation/Revising Aggregations - The Count Function/solution.sql new file mode 100644 index 0000000..400d3da --- /dev/null +++ b/hackerrank/SQL/Aggregation/Revising Aggregations - The Count Function/solution.sql @@ -0,0 +1,3 @@ +SELECT COUNT(*) + FROM CITY + WHERE POPULATION > 100000; diff --git a/hackerrank/SQL/Aggregation/Revising Aggregations - The Sum Function/solution.sql b/hackerrank/SQL/Aggregation/Revising Aggregations - The Sum Function/solution.sql new file mode 100644 index 0000000..bff1d58 --- /dev/null +++ b/hackerrank/SQL/Aggregation/Revising Aggregations - The Sum Function/solution.sql @@ -0,0 +1,3 @@ +SELECT SUM(POPULATION) + FROM CITY + WHERE DISTRICT = 'California'; diff --git a/hackerrank/SQL/Aggregation/The Blunder/solution.sql b/hackerrank/SQL/Aggregation/The Blunder/solution.sql new file mode 100644 index 0000000..d202d01 --- /dev/null +++ b/hackerrank/SQL/Aggregation/The Blunder/solution.sql @@ -0,0 +1,2 @@ +SELECT CEIL(AVG(Salary) - AVG(REPLACE(Salary, '0', ''))) + FROM EMPLOYEES; diff --git a/hackerrank/SQL/Aggregation/Top Earners/solution.sql b/hackerrank/SQL/Aggregation/Top Earners/solution.sql new file mode 100644 index 0000000..8d8418b --- /dev/null +++ b/hackerrank/SQL/Aggregation/Top Earners/solution.sql @@ -0,0 +1,6 @@ +SELECT salary * months AS total_earnings, + COUNT(*) + FROM Employee + GROUP BY total_earnings + ORDER BY total_earnings DESC + LIMIT 1; diff --git a/hackerrank/SQL/Aggregation/Weather Observation Station 13/solution.sql b/hackerrank/SQL/Aggregation/Weather Observation Station 13/solution.sql new file mode 100644 index 0000000..c0fb326 --- /dev/null +++ b/hackerrank/SQL/Aggregation/Weather Observation Station 13/solution.sql @@ -0,0 +1,3 @@ +SELECT TRUNCATE(SUM(LAT_N), 4) + FROM STATION + WHERE LAT_N BETWEEN 38.7880 AND 137.2345; diff --git a/hackerrank/SQL/Aggregation/Weather Observation Station 14/solution.sql b/hackerrank/SQL/Aggregation/Weather Observation Station 14/solution.sql new file mode 100644 index 0000000..8cfd0b6 --- /dev/null +++ b/hackerrank/SQL/Aggregation/Weather Observation Station 14/solution.sql @@ -0,0 +1,3 @@ +SELECT TRUNCATE(MAX(LAT_N), 4) + FROM STATION + WHERE LAT_N < 137.2345; diff --git a/hackerrank/SQL/Aggregation/Weather Observation Station 15/solution.sql b/hackerrank/SQL/Aggregation/Weather Observation Station 15/solution.sql new file mode 100644 index 0000000..d6a2621 --- /dev/null +++ b/hackerrank/SQL/Aggregation/Weather Observation Station 15/solution.sql @@ -0,0 +1,5 @@ +SELECT ROUND(LONG_W, 4) + FROM STATION + WHERE LAT_N < 137.2345 + ORDER BY LAT_N DESC + LIMIT 1; diff --git a/hackerrank/SQL/Aggregation/Weather Observation Station 16/solution.sql b/hackerrank/SQL/Aggregation/Weather Observation Station 16/solution.sql new file mode 100644 index 0000000..023f567 --- /dev/null +++ b/hackerrank/SQL/Aggregation/Weather Observation Station 16/solution.sql @@ -0,0 +1,3 @@ +SELECT ROUND(MIN(LAT_N), 4) + FROM STATION + WHERE LAT_N > 38.7780; diff --git a/hackerrank/SQL/Aggregation/Weather Observation Station 17/solution.sql b/hackerrank/SQL/Aggregation/Weather Observation Station 17/solution.sql new file mode 100644 index 0000000..62fdc7a --- /dev/null +++ b/hackerrank/SQL/Aggregation/Weather Observation Station 17/solution.sql @@ -0,0 +1,5 @@ +SELECT ROUND(LONG_W, 4) + FROM STATION + WHERE LAT_N > 38.7780 + ORDER BY LAT_N + LIMIT 1; diff --git a/hackerrank/SQL/Aggregation/Weather Observation Station 18/solution.sql b/hackerrank/SQL/Aggregation/Weather Observation Station 18/solution.sql new file mode 100644 index 0000000..44293d4 --- /dev/null +++ b/hackerrank/SQL/Aggregation/Weather Observation Station 18/solution.sql @@ -0,0 +1,2 @@ +SELECT ROUND(ABS(MIN(LAT_N) - MAX(LAT_N)) + ABS(MIN(LONG_W) - MAX(LONG_W)), 4) + FROM STATION; diff --git a/hackerrank/SQL/Aggregation/Weather Observation Station 19/solution.sql b/hackerrank/SQL/Aggregation/Weather Observation Station 19/solution.sql new file mode 100644 index 0000000..95e7f98 --- /dev/null +++ b/hackerrank/SQL/Aggregation/Weather Observation Station 19/solution.sql @@ -0,0 +1,3 @@ +SELECT ROUND(SQRT(POW(MAX(LAT_N) - MIN(LAT_N), 2) + + POW(MAX(LONG_W) - MIN(LONG_W), 2)), 4) + FROM STATION; diff --git a/hackerrank/SQL/Aggregation/Weather Observation Station 2/solution.sql b/hackerrank/SQL/Aggregation/Weather Observation Station 2/solution.sql new file mode 100644 index 0000000..52558a1 --- /dev/null +++ b/hackerrank/SQL/Aggregation/Weather Observation Station 2/solution.sql @@ -0,0 +1,3 @@ +SELECT ROUND(SUM(LAT_N), 2), + ROUND(SUM(LONG_W), 2) + FROM STATION; diff --git a/hackerrank/SQL/Aggregation/Weather Observation Station 20/solution.sql b/hackerrank/SQL/Aggregation/Weather Observation Station 20/solution.sql new file mode 100644 index 0000000..675a90e --- /dev/null +++ b/hackerrank/SQL/Aggregation/Weather Observation Station 20/solution.sql @@ -0,0 +1,4 @@ +SELECT ROUND(S.LAT_N, 4) + FROM STATION S + WHERE (SELECT COUNT(LAT_N) FROM STATION WHERE LAT_N < S.LAT_N) + = (SELECT COUNT(LAT_N) FROM STATION WHERE LAT_N > S.LAT_N); diff --git a/hackerrank/SQL/Basic Join/African Cities/solution.sql b/hackerrank/SQL/Basic Join/African Cities/solution.sql new file mode 100644 index 0000000..208abfe --- /dev/null +++ b/hackerrank/SQL/Basic Join/African Cities/solution.sql @@ -0,0 +1,5 @@ +SELECT CITY.NAME + FROM CITY + INNER JOIN COUNTRY + ON CITY.COUNTRYCODE = COUNTRY.CODE + WHERE COUNTRY.CONTINENT = 'Africa'; diff --git a/hackerrank/SQL/Basic Join/Asian Population/solution.sql b/hackerrank/SQL/Basic Join/Asian Population/solution.sql new file mode 100644 index 0000000..07b8d30 --- /dev/null +++ b/hackerrank/SQL/Basic Join/Asian Population/solution.sql @@ -0,0 +1,5 @@ +SELECT SUM(CITY.POPULATION) + FROM CITY + INNER JOIN COUNTRY + ON CITY.COUNTRYCODE = COUNTRY.CODE + WHERE COUNTRY.CONTINENT = 'Asia'; diff --git a/hackerrank/SQL/Basic Join/Average Population of Each Continent/solution.sql b/hackerrank/SQL/Basic Join/Average Population of Each Continent/solution.sql new file mode 100644 index 0000000..67cf114 --- /dev/null +++ b/hackerrank/SQL/Basic Join/Average Population of Each Continent/solution.sql @@ -0,0 +1,6 @@ +SELECT COUNTRY.CONTINENT, + FLOOR(AVG(CITY.POPULATION)) + FROM CITY + INNER JOIN COUNTRY + ON CITY.COUNTRYCODE = COUNTRY.CODE + GROUP BY COUNTRY.CONTINENT; diff --git a/hackerrank/SQL/Basic Join/Top Competitors/solution.sql b/hackerrank/SQL/Basic Join/Top Competitors/solution.sql new file mode 100644 index 0000000..ee2bef9 --- /dev/null +++ b/hackerrank/SQL/Basic Join/Top Competitors/solution.sql @@ -0,0 +1,17 @@ +SELECT h.hacker_id, + h.name + FROM Hackers h + INNER JOIN Submissions s + ON h.hacker_id = s.hacker_id + + INNER JOIN Challenges c + ON s.challenge_id = c.challenge_id + + INNER JOIN Difficulty d + ON c.difficulty_level = d.difficulty_level + WHERE s.score = d.score + GROUP BY h.hacker_id, + h.name +HAVING COUNT(s.hacker_id) > 1 + ORDER BY COUNT(s.hacker_id) DESC, + hacker_id; diff --git a/hackerrank/SQL/Basic Select/Employee Names/solution.sql b/hackerrank/SQL/Basic Select/Employee Names/solution.sql new file mode 100644 index 0000000..db5d3bd --- /dev/null +++ b/hackerrank/SQL/Basic Select/Employee Names/solution.sql @@ -0,0 +1,3 @@ +SELECT Name + FROM Employee + ORDER BY Name; diff --git a/hackerrank/SQL/Basic Select/Employee Salaries/solution.sql b/hackerrank/SQL/Basic Select/Employee Salaries/solution.sql new file mode 100644 index 0000000..dfe0637 --- /dev/null +++ b/hackerrank/SQL/Basic Select/Employee Salaries/solution.sql @@ -0,0 +1,5 @@ +SELECT name + FROM Employee + WHERE salary > 2000 + AND months < 10 + ORDER BY employee_id; diff --git a/hackerrank/SQL/Basic Select/Higher Than 75 Marks/solution.sql b/hackerrank/SQL/Basic Select/Higher Than 75 Marks/solution.sql new file mode 100644 index 0000000..57389b2 --- /dev/null +++ b/hackerrank/SQL/Basic Select/Higher Than 75 Marks/solution.sql @@ -0,0 +1,5 @@ +SELECT Name + FROM STUDENTS + WHERE Marks > 75 + ORDER BY RIGHT(Name, 3), + ID; diff --git a/hackerrank/SQL/Basic Select/Japanese Cities' Attributes/solution.sql b/hackerrank/SQL/Basic Select/Japanese Cities' Attributes/solution.sql new file mode 100644 index 0000000..bb3a1fe --- /dev/null +++ b/hackerrank/SQL/Basic Select/Japanese Cities' Attributes/solution.sql @@ -0,0 +1,3 @@ +SELECT * + FROM CITY + WHERE COUNTRYCODE = 'JPN'; diff --git a/hackerrank/SQL/Basic Select/Japanese Cities' Names/solution.sql b/hackerrank/SQL/Basic Select/Japanese Cities' Names/solution.sql new file mode 100644 index 0000000..31b256f --- /dev/null +++ b/hackerrank/SQL/Basic Select/Japanese Cities' Names/solution.sql @@ -0,0 +1,3 @@ +SELECT NAME + FROM CITY + WHERE COUNTRYCODE = 'JPN'; diff --git a/hackerrank/SQL/Basic Select/Revising the Select Query I/solution.sql b/hackerrank/SQL/Basic Select/Revising the Select Query I/solution.sql new file mode 100644 index 0000000..d1e9ae0 --- /dev/null +++ b/hackerrank/SQL/Basic Select/Revising the Select Query I/solution.sql @@ -0,0 +1,4 @@ +SELECT * + FROM CITY + WHERE POPULATION > 100000 + AND COUNTRYCODE = 'USA'; diff --git a/hackerrank/SQL/Basic Select/Revising the Select Query II/solution.sql b/hackerrank/SQL/Basic Select/Revising the Select Query II/solution.sql new file mode 100644 index 0000000..a68b085 --- /dev/null +++ b/hackerrank/SQL/Basic Select/Revising the Select Query II/solution.sql @@ -0,0 +1,4 @@ +SELECT NAME + FROM CITY + WHERE POPULATION > 120000 + AND COUNTRYCODE = 'USA'; diff --git a/hackerrank/SQL/Basic Select/Select All/solution.sql b/hackerrank/SQL/Basic Select/Select All/solution.sql new file mode 100644 index 0000000..3b25ab5 --- /dev/null +++ b/hackerrank/SQL/Basic Select/Select All/solution.sql @@ -0,0 +1,2 @@ +SELECT * + FROM CITY; diff --git a/hackerrank/SQL/Basic Select/Select By ID/solution.sql b/hackerrank/SQL/Basic Select/Select By ID/solution.sql new file mode 100644 index 0000000..311da95 --- /dev/null +++ b/hackerrank/SQL/Basic Select/Select By ID/solution.sql @@ -0,0 +1,3 @@ +SELECT * + FROM CITY + WHERE ID = 1661; diff --git a/hackerrank/SQL/Basic Select/Weather Observation Station 1/solution.sql b/hackerrank/SQL/Basic Select/Weather Observation Station 1/solution.sql new file mode 100644 index 0000000..65dec1a --- /dev/null +++ b/hackerrank/SQL/Basic Select/Weather Observation Station 1/solution.sql @@ -0,0 +1,2 @@ +SELECT CITY, STATE + FROM STATION; diff --git a/hackerrank/SQL/Basic Select/Weather Observation Station 10/solution.sql b/hackerrank/SQL/Basic Select/Weather Observation Station 10/solution.sql new file mode 100644 index 0000000..10a8329 --- /dev/null +++ b/hackerrank/SQL/Basic Select/Weather Observation Station 10/solution.sql @@ -0,0 +1,3 @@ +SELECT DISTINCT CITY + FROM STATION + WHERE CITY REGEXP '[^aeiou]$'; diff --git a/hackerrank/SQL/Basic Select/Weather Observation Station 11/solution.sql b/hackerrank/SQL/Basic Select/Weather Observation Station 11/solution.sql new file mode 100644 index 0000000..bf00ba0 --- /dev/null +++ b/hackerrank/SQL/Basic Select/Weather Observation Station 11/solution.sql @@ -0,0 +1,3 @@ +SELECT DISTINCT CITY + FROM STATION + WHERE CITY REGEXP '^[^aeiou]|[^aeiou]$'; diff --git a/hackerrank/SQL/Basic Select/Weather Observation Station 12/solution.sql b/hackerrank/SQL/Basic Select/Weather Observation Station 12/solution.sql new file mode 100644 index 0000000..9c5bea8 --- /dev/null +++ b/hackerrank/SQL/Basic Select/Weather Observation Station 12/solution.sql @@ -0,0 +1,3 @@ +SELECT DISTINCT CITY + FROM STATION + WHERE CITY REGEXP '^[^aeiou].*[^aeiou]$'; diff --git a/hackerrank/SQL/Basic Select/Weather Observation Station 3/solution.sql b/hackerrank/SQL/Basic Select/Weather Observation Station 3/solution.sql new file mode 100644 index 0000000..10d4951 --- /dev/null +++ b/hackerrank/SQL/Basic Select/Weather Observation Station 3/solution.sql @@ -0,0 +1,4 @@ +SELECT DISTINCT CITY + FROM STATION + WHERE ID % 2 = 0 + ORDER BY CITY; diff --git a/hackerrank/SQL/Basic Select/Weather Observation Station 4/solution.sql b/hackerrank/SQL/Basic Select/Weather Observation Station 4/solution.sql new file mode 100644 index 0000000..681e1a9 --- /dev/null +++ b/hackerrank/SQL/Basic Select/Weather Observation Station 4/solution.sql @@ -0,0 +1,2 @@ +SELECT COUNT(CITY) - COUNT(DISTINCT CITY) + FROM STATION; diff --git a/hackerrank/SQL/Basic Select/Weather Observation Station 5/solution.sql b/hackerrank/SQL/Basic Select/Weather Observation Station 5/solution.sql new file mode 100644 index 0000000..5378bfb --- /dev/null +++ b/hackerrank/SQL/Basic Select/Weather Observation Station 5/solution.sql @@ -0,0 +1,13 @@ +SELECT CITY, + LENGTH(CITY) + FROM STATION + ORDER BY LENGTH(CITY) ASC, + CITY ASC + LIMIT 1; + +SELECT CITY, + LENGTH(CITY) + FROM STATION + ORDER BY LENGTH(CITY) DESC, + CITY ASC + LIMIT 1; diff --git a/hackerrank/SQL/Basic Select/Weather Observation Station 6/solution.sql b/hackerrank/SQL/Basic Select/Weather Observation Station 6/solution.sql new file mode 100644 index 0000000..dae4f07 --- /dev/null +++ b/hackerrank/SQL/Basic Select/Weather Observation Station 6/solution.sql @@ -0,0 +1,3 @@ +SELECT DISTINCT CITY + FROM STATION + WHERE CITY REGEXP '^[a,e,i,o,u]'; diff --git a/hackerrank/SQL/Basic Select/Weather Observation Station 7/solution.sql b/hackerrank/SQL/Basic Select/Weather Observation Station 7/solution.sql new file mode 100644 index 0000000..d8faf29 --- /dev/null +++ b/hackerrank/SQL/Basic Select/Weather Observation Station 7/solution.sql @@ -0,0 +1,3 @@ +SELECT DISTINCT CITY + FROM STATION + WHERE CITY REGEXP '[a,e,i,o,u]$'; diff --git a/hackerrank/SQL/Basic Select/Weather Observation Station 8/solution.sql b/hackerrank/SQL/Basic Select/Weather Observation Station 8/solution.sql new file mode 100644 index 0000000..272cb3f --- /dev/null +++ b/hackerrank/SQL/Basic Select/Weather Observation Station 8/solution.sql @@ -0,0 +1,3 @@ +SELECT DISTINCT CITY + FROM STATION + WHERE CITY REGEXP '^[a,e,i,o,u].*[a,e,i,o,u]$'; diff --git a/hackerrank/SQL/Basic Select/Weather Observation Station 9/solution.sql b/hackerrank/SQL/Basic Select/Weather Observation Station 9/solution.sql new file mode 100644 index 0000000..c5ef66b --- /dev/null +++ b/hackerrank/SQL/Basic Select/Weather Observation Station 9/solution.sql @@ -0,0 +1,3 @@ +SELECT DISTINCT CITY + FROM STATION + WHERE CITY REGEXP '^[^a,e,i,o,u]';