Problem:
﻿Score: 100 points

Problem Statement

In AtCoder city, there are five antennas standing in a straight line. They are called Antenna A, B, C, D and E from west to east, and their coordinates are a, b, c, d and e, respectively.

Two antennas can communicate directly if the distance between them is k or less, and they cannot if the distance is greater than k.

Determine if there exists a pair of antennas that cannot communicate directly.

Here, assume that the distance between two antennas at coordinates p and q (p < q) is q - p.

Constraints

a, b, c, d, e and k are integers between 0 and 123 (inclusive).

a < b < c < d < e

Input

Input is given from Standard Input in the following format:

a
b
c
d
e
k

Output

Print :( if there exists a pair of antennas that cannot communicate directly, and print Yay! if there is no such pair.

Sample Input 1

1
2
4
8
9
15

Sample Output 1

Yay!

In this case, there is no pair of antennas that cannot communicate directly, because:

the distance between A and B is 2 - 1 = 1

the distance between A and C is 4 - 1 = 3

the distance between A and D is 8 - 1 = 7

the distance between A and E is 9 - 1 = 8

the distance between B and C is 4 - 2 = 2

the distance between B and D is 8 - 2 = 6

the distance between B and E is 9 - 2 = 7

the distance between C and D is 8 - 4 = 4

the distance between C and E is 9 - 4 = 5

the distance between D and E is 9 - 8 = 1

and none of them is greater than 15. Thus, the correct output is Yay!.

Sample Input 2

15
18
26
35
36
18

Sample Output 2

:(

In this case, the distance between antennas A and D is 35 - 15 = 20 and exceeds 18, so they cannot communicate directly.
Thus, the correct output is :(.

Solution in JavaScript (node.js v5.12) (judge verdict: Accepted)

parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"Focm":[function(require,module,exports) {
var n={};!function(t){"use strict";(n["Control.Apply"]=n["Control.Apply"]||{}).arrayApply=function(n){return function(t){for(var r=n.length,a=t.length,o=new Array(r*a),e=0,i=0;i<r;i++)for(var u=n[i],c=0;c<a;c++)o[e++]=u(t[c]);return o}}}(),function(n){"use strict";var t=function(n){this.compose=n},r=new t(function(n){return function(t){return function(r){return n(t(r))}}});n.compose=function(n){return n.compose},n.Semigroupoid=t,n.semigroupoidFn=r}(n["Control.Semigroupoid"]=n["Control.Semigroupoid"]||{}),function(t){"use strict";var r=n["Control.Semigroupoid"],a=function(n,t){this.Semigroupoid0=n,this.identity=t},o=new a(function(){return r.semigroupoidFn},function(n){return n});t.Category=a,t.identity=function(n){return n.identity},t.categoryFn=o}(n["Control.Category"]=n["Control.Category"]||{}),function(t){"use strict";(n["Data.Boolean"]=n["Data.Boolean"]||{}).otherwise=!0}(),function(t){"use strict";n["Control.Category"],n["Data.Boolean"],n["Data.Ord"],n["Data.Ring"];t.flip=function(n){return function(t){return function(r){return n(r)(t)}}},t.const=function(n){return function(t){return n}}}(n["Data.Function"]=n["Data.Function"]||{}),function(t){"use strict";(n["Data.Functor"]=n["Data.Functor"]||{}).arrayMap=function(n){return function(t){for(var r=t.length,a=new Array(r),o=0;o<r;o++)a[o]=n(t[o]);return a}}}(),function(t){"use strict";var r=n["Data.Functor"],a=(n["Control.Semigroupoid"],n["Data.Function"],n["Data.Unit"],function(n){this.map=n}),o=new a(r.arrayMap);t.Functor=a,t.map=function(n){return n.map},t.functorArray=o}(n["Data.Functor"]=n["Data.Functor"]||{}),function(t){"use strict";var r=n["Control.Apply"],a=(n["Control.Category"],n["Data.Function"],n["Data.Functor"]),o=function(n,t){this.Functor0=n,this.apply=t},e=new o(function(){return a.functorArray},r.arrayApply);t.Apply=o,t.apply=function(n){return n.apply},t.applyArray=e}(n["Control.Apply"]=n["Control.Apply"]||{}),function(t){"use strict";var r=n["Control.Apply"],a=(n["Data.Functor"],n["Data.Unit"],function(n,t){this.Apply0=n,this.pure=t}),o=new a(function(){return r.applyArray},function(n){return[n]});t.Applicative=a,t.pure=function(n){return n.pure},t.applicativeArray=o}(n["Control.Applicative"]=n["Control.Applicative"]||{}),function(t){"use strict";(n["Control.Bind"]=n["Control.Bind"]||{}).arrayBind=function(n){return function(t){for(var r=[],a=0,o=n.length;a<o;a++)Array.prototype.push.apply(r,t(n[a]));return r}}}(),function(t){"use strict";var r=n["Control.Bind"],a=(n["Control.Applicative"],n["Control.Apply"]),o=(n["Control.Category"],n["Data.Function"],n["Data.Functor"],n["Data.Unit"],function(n,t){this.Apply0=n,this.bind=t}),e=new o(function(){return a.applyArray},r.arrayBind);t.Bind=o,t.bind=function(n){return n.bind},t.bindArray=e}(n["Control.Bind"]=n["Control.Bind"]||{}),function(n){"use strict";n.length=function(n){return n.length},n.indexImpl=function(n){return function(t){return function(r){return function(a){return a<0||a>=r.length?t:n(r[a])}}}},n.slice=function(n){return function(t){return function(r){return r.slice(n,t)}}}}(n["Data.Array"]=n["Data.Array"]||{}),function(n){"use strict";n.foldrArray=function(n){return function(t){return function(r){for(var a=t,o=r.length-1;o>=0;o--)a=n(r[o])(a);return a}}},n.foldlArray=function(n){return function(t){return function(r){for(var a=t,o=r.length,e=0;e<o;e++)a=n(a)(r[e]);return a}}}}(n["Data.Foldable"]=n["Data.Foldable"]||{}),function(t){"use strict";n["Data.Semigroup"],n["Data.Symbol"],n["Data.Unit"],n["Data.Void"],n["Record.Unsafe"],n["Type.Data.RowList"];t.append=function(n){return n.append}}(n["Data.Semigroup"]=n["Data.Semigroup"]||{}),function(t){"use strict";n["Data.Boolean"],n["Data.Eq"],n["Data.EuclideanRing"],n["Data.Ord"],n["Data.Ordering"],n["Data.Semigroup"],n["Data.Symbol"],n["Data.Unit"],n["Record.Unsafe"],n["Type.Data.RowList"];t.mempty=function(n){return n.mempty}}(n["Data.Monoid"]=n["Data.Monoid"]||{}),function(t){"use strict";n["Data.Show"],n["Data.Symbol"],n["Record.Unsafe"],n["Type.Data.RowList"];t.Show=function(n){this.show=n},t.show=function(n){return n.show}}(n["Data.Show"]=n["Data.Show"]||{}),function(t){"use strict";n["Control.Alt"],n["Control.Alternative"],n["Control.Applicative"];var r=n["Control.Apply"],a=(n["Control.Bind"],n["Control.Category"],n["Control.Extend"],n["Control.Monad"],n["Control.MonadZero"],n["Control.Plus"],n["Data.Bounded"],n["Data.Eq"],n["Data.Function"]),o=n["Data.Functor"],e=(n["Data.Functor.Invariant"],n["Data.Monoid"],n["Data.Ord"],n["Data.Ordering"],n["Data.Semigroup"],n["Data.Show"],n["Data.Unit"],n.Prelude,function(){function n(){}return n.value=new n,n}()),i=function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}(),u=function(n){return function(t){return function(r){if(r instanceof e)return n;if(r instanceof i)return t(r.value0);throw new Error("Failed pattern match at Data.Maybe (line 217, column 1 - line 217, column 51): "+[n.constructor.name,t.constructor.name,r.constructor.name])}}},c=u(!1)(a.const(!0)),l=new o.Functor(function(n){return function(t){return t instanceof i?new i(n(t.value0)):e.value}}),f=new r.Apply(function(){return l},function(n){return function(t){if(n instanceof i)return o.map(l)(n.value0)(t);if(n instanceof e)return e.value;throw new Error("Failed pattern match at Data.Maybe (line 67, column 1 - line 67, column 35): "+[n.constructor.name,t.constructor.name])}});t.Nothing=e,t.Just=i,t.maybe=u,t.isJust=c,t.functorMaybe=l,t.applyMaybe=f}(n["Data.Maybe"]=n["Data.Maybe"]||{}),function(t){"use strict";var r=n["Data.Foldable"],a=(n["Control.Alt"],n["Control.Applicative"],n["Control.Apply"],n["Control.Bind"],n["Control.Category"],n["Control.Plus"],n["Control.Semigroupoid"],n["Data.Eq"],n["Data.Function"],n["Data.Functor"],n["Data.HeytingAlgebra"],n["Data.Maybe"]),o=(n["Data.Maybe.First"],n["Data.Maybe.Last"],n["Data.Monoid"]),e=(n["Data.Monoid.Additive"],n["Data.Monoid.Conj"],n["Data.Monoid.Disj"],n["Data.Monoid.Dual"],n["Data.Monoid.Endo"],n["Data.Monoid.Multiplicative"],n["Data.Newtype"],n["Data.Ord"],n["Data.Ordering"],n["Data.Semigroup"]),i=(n["Data.Semiring"],n["Data.Unit"],n.Prelude,function(n,t,r){this.foldMap=n,this.foldl=t,this.foldr=r}),u=function(n){return n.foldr},c=function(n){return n.foldl},l=function(n){return function(t){return function(r){return u(n)(function(n){return function(a){return e.append(t.Semigroup0())(r(n))(a)}})(o.mempty(t))}}},f=new i(function(n){return l(f)(n)},r.foldlArray,r.foldrArray);t.Foldable=i,t.foldr=u,t.foldl=c,t.foldMap=function(n){return n.foldMap},t.foldMapDefaultR=l,t.find=function(n){return function(t){return c(n)(function(n){return function(r){return n instanceof a.Nothing&&t(r)?new a.Just(r):n}})(a.Nothing.value)}},t.foldableArray=f}(n["Data.Foldable"]=n["Data.Foldable"]||{}),function(t){"use strict";(n["Partial.Unsafe"]=n["Partial.Unsafe"]||{}).unsafePartial=function(n){return n()}}(),function(t){"use strict";(n["Partial"]=n["Partial"]||{}).crashWith=function(){return function(n){throw new Error(n)}}}(),function(t){"use strict";var r=n.Partial;t.crashWith=r.crashWith}(n.Partial=n.Partial||{}),function(t){"use strict";var r=n["Partial.Unsafe"],a=n.Partial;t.unsafeCrashWith=function(n){return r.unsafePartial(function(t){return a.crashWith(t)(n)})}}(n["Partial.Unsafe"]=n["Partial.Unsafe"]||{}),function(t){"use strict";(n["Unsafe.Coerce"]=n["Unsafe.Coerce"]||{}).unsafeCoerce=function(n){return n}}(),function(t){"use strict";var r=n["Unsafe.Coerce"];t.unsafeCoerce=r.unsafeCoerce}(n["Unsafe.Coerce"]=n["Unsafe.Coerce"]||{}),function(t){"use strict";var r=n["Data.Array"],a=(n["Control.Alt"],n["Control.Alternative"],n["Control.Applicative"],n["Control.Apply"]),o=n["Control.Bind"],e=(n["Control.Category"],n["Control.Lazy"],n["Control.Monad.Rec.Class"],n["Control.Monad.ST"],n["Control.Monad.ST.Internal"],n["Control.Semigroupoid"],n["Data.Array.NonEmpty.Internal"],n["Data.Array.ST"],n["Data.Array.ST.Iterator"],n["Data.Boolean"]),i=(n["Data.Eq"],n["Data.Foldable"],n["Data.Function"]),u=n["Data.Functor"],c=(n["Data.HeytingAlgebra"],n["Data.Maybe"]),l=(n["Data.Ord"],n["Data.Ordering"],n["Data.Ring"],n["Data.Semigroup"],n["Data.Semiring"],n["Data.Traversable"],n["Data.Tuple"],n["Data.Unfoldable"],n["Partial.Unsafe"],n.Prelude,n["Unsafe.Coerce"],function(n){return[n]}),f=function(n){if(function(n){return 0===r.length(n)}(n))return c.Nothing.value;if(e.otherwise)return new c.Just(r.slice(0)(r.length(n)-1|0)(n));throw new Error("Failed pattern match at Data.Array (line 323, column 1 - line 323, column 45): "+[n.constructor.name])},s=r.indexImpl(c.Just.create)(c.Nothing.value),d=function(n){return s(n)(r.length(n)-1|0)},D=i.flip(o.bind(o.bindArray));t.singleton=l,t.last=d,t.init=f,t.unsnoc=function(n){return a.apply(c.applyMaybe)(u.map(c.functorMaybe)(function(n){return function(t){return{init:n,last:t}}})(f(n)))(d(n))},t.index=s,t.concatMap=D,t.mapMaybe=function(n){return D(function(t){return c.maybe([])(l)(n(t))})}}(n["Data.Array"]=n["Data.Array"]||{}),function(t){"use strict";n["Control.Alt"];var r=n["Control.Applicative"],a=n["Control.Apply"],o=n["Control.Bind"],e=(n["Control.Extend"],n["Control.Monad"],n["Control.Semigroupoid"],n["Data.Bifoldable"],n["Data.Bifunctor"],n["Data.Bitraversable"],n["Data.Bounded"],n["Data.Eq"],n["Data.Foldable"],n["Data.FoldableWithIndex"],n["Data.Function"],n["Data.Functor"]),i=(n["Data.Functor.Invariant"],n["Data.FunctorWithIndex"],n["Data.Maybe"]),u=(n["Data.Monoid"],n["Data.Ord"],n["Data.Ordering"],n["Data.Semigroup"],n["Data.Show"],n["Data.Traversable"],n["Data.TraversableWithIndex"],n["Data.Unit"],n.Prelude,function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}()),c=function(){function n(n){this.value0=n}return n.create=function(t){return new n(t)},n}(),l=new e.Functor(function(n){return function(t){if(t instanceof u)return new u(t.value0);if(t instanceof c)return new c(n(t.value0));throw new Error("Failed pattern match at Data.Either (line 38, column 8 - line 38, column 52): "+[t.constructor.name])}}),f=function(n){return function(t){return function(r){if(r instanceof u)return n(r.value0);if(r instanceof c)return t(r.value0);throw new Error("Failed pattern match at Data.Either (line 238, column 1 - line 238, column 64): "+[n.constructor.name,t.constructor.name,r.constructor.name])}}},s=new a.Apply(function(){return l},function(n){return function(t){if(n instanceof u)return new u(n.value0);if(n instanceof c)return e.map(l)(n.value0)(t);throw new Error("Failed pattern match at Data.Either (line 82, column 1 - line 82, column 41): "+[n.constructor.name,t.constructor.name])}}),d=new o.Bind(function(){return s},f(function(n){return function(t){return new u(n)}})(function(n){return function(t){return t(n)}})),D=new r.Applicative(function(){return s},c.create);t.Left=u,t.Right=c,t.either=f,t.note=function(n){return i.maybe(new u(n))(c.create)},t.functorEither=l,t.applyEither=s,t.applicativeEither=D,t.bindEither=d}(n["Data.Either"]=n["Data.Either"]||{}),function(t){"use strict";(n["Data.Int"]=n["Data.Int"]||{}).fromStringAsImpl=function(n){return function(t){return function(r){var a;a=r<11?"[0-"+(r-1).toString()+"]":11===r?"[0-9a]":"[0-9a-"+String.fromCharCode(86+r)+"]";var o=new RegExp("^[\\+\\-]?"+a+"+$","i");return function(a){if(o.test(a)){var e=parseInt(a,r);return(0|e)===e?n(e):t}return t}}}}}(),function(t){"use strict";var r=n["Data.Int"],a=(n["Control.Category"],n["Control.Semigroupoid"],n["Data.Boolean"],n["Data.Bounded"],n["Data.CommutativeRing"],n["Data.DivisionRing"],n["Data.Eq"],n["Data.EuclideanRing"],n["Data.HeytingAlgebra"],n["Data.Int.Bits"],n["Data.Maybe"]),o=(n["Data.Ord"],n["Data.Ordering"],n["Data.Ring"],n["Data.Semiring"],n["Data.Show"],n.Global,n.Math,n.Prelude,r.fromStringAsImpl(a.Just.create)(a.Nothing.value)),e=o(10);t.fromString=e,t.fromStringAs=o}(n["Data.Int"]=n["Data.Int"]||{}),function(n){"use strict";n.split=function(n){return function(t){return t.split(n)}},n.trim=function(n){return n.trim()}}(n["Data.String.Common"]=n["Data.String.Common"]||{}),function(t){"use strict";var r=n["Data.String.Common"];n["Data.Eq"],n["Data.Ordering"],n["Data.String.Pattern"],n.Prelude;t.split=r.split,t.trim=r.trim}(n["Data.String.Common"]=n["Data.String.Common"]||{}),function(t){"use strict";var r=n["Control.Applicative"],a=n["Control.Bind"],o=n["Control.Category"],e=n["Data.Array"],i=n["Data.Either"],u=n["Data.Foldable"],c=n["Data.Int"],l=n["Data.Maybe"],f=(n["Data.Ord"],n["Data.Ring"],n["Data.String"],n["Data.String.Common"]),s=(n["Data.String.Pattern"],n["Partial.Unsafe"]);n.Prelude;t.solve=function(n){var t=function(n){var t=e.mapMaybe(c.fromString)(f.split("\n")(f.trim(n)));return a.bind(i.bindEither)(i.note("unsnoc")(e.unsnoc(t)))(function(n){return r.pure(i.applicativeEither)(l.isJust(u.find(u.foldableArray)(o.identity(o.categoryFn))(a.bind(a.bindArray)(n.init)(function(t){return a.bind(a.bindArray)(n.init)(function(a){return r.pure(r.applicativeArray)((t-a|0)>n.last)})})))?":(":"Yay!")})}(n);if(t instanceof i.Left)return s.unsafeCrashWith(t.value0);if(t instanceof i.Right)return t.value0;throw new Error("Failed pattern match at AtCoder.ABC123.A (line 17, column 3 - line 19, column 24): "+[t.constructor.name])}}(n["AtCoder.ABC123.A"]=n["AtCoder.ABC123.A"]||{}),function(t){"use strict";(n["Effect.Console"]=n["Effect.Console"]||{}).log=function(n){return function(){return console.log(n),{}}}}(),function(t){"use strict";var r=n["Effect.Console"];n["Data.Show"],n["Data.Unit"],n.Effect;t.log=r.log}(n["Effect.Console"]=n["Effect.Console"]||{}),function(t){"use strict";n["Node.Encoding"];var r=n["Data.Show"],a=(n.Prelude,function(){function n(){}return n.value=new n,n}()),o=function(){function n(){}return n.value=new n,n}(),e=function(){function n(){}return n.value=new n,n}(),i=function(){function n(){}return n.value=new n,n}(),u=function(){function n(){}return n.value=new n,n}(),c=function(){function n(){}return n.value=new n,n}(),l=function(){function n(){}return n.value=new n,n}(),f=function(){function n(){}return n.value=new n,n}(),s=new r.Show(function(n){if(n instanceof a)return"ASCII";if(n instanceof o)return"UTF8";if(n instanceof e)return"UTF16LE";if(n instanceof i)return"UCS2";if(n instanceof u)return"Base64";if(n instanceof c)return"Latin1";if(n instanceof l)return"Binary";if(n instanceof f)return"Hex";throw new Error("Failed pattern match at Node.Encoding (line 19, column 1 - line 19, column 39): "+[n.constructor.name])});t.ASCII=a,t.UTF8=o,t.UTF16LE=e,t.UCS2=i,t.Base64=u,t.Latin1=c,t.Binary=l,t.Hex=f,t.showEncoding=s}(n["Node.Encoding"]=n["Node.Encoding"]||{}),function(t){"use strict";(n["Node.FS.Internal"]=n["Node.FS.Internal"]||{}).unsafeRequireFS=require("fs")}(),function(t){"use strict";var r=n["Node.FS.Internal"],a=(n.Effect,n.Prelude,n["Unsafe.Coerce"].unsafeCoerce);t.mkEffect=a,t.unsafeRequireFS=r.unsafeRequireFS}(n["Node.FS.Internal"]=n["Node.FS.Internal"]||{}),function(t){"use strict";n["Control.Bind"],n["Control.Semigroupoid"],n["Data.DateTime"],n["Data.DateTime.Instant"],n["Data.EuclideanRing"],n["Data.Function"],n["Data.Function.Uncurried"],n["Data.Functor"],n["Data.Int"],n["Data.Maybe"],n["Data.Nullable"];var r=n["Data.Show"],a=(n["Data.Time.Duration"],n.Effect,n["Node.Buffer"],n["Node.Encoding"]),o=(n["Node.FS"],n["Node.FS.Internal"]),e=(n["Node.FS.Perms"],n["Node.FS.Stats"],n["Node.Path"],n.Prelude,o.unsafeRequireFS);t.readTextFile=function(n){return function(t){return o.mkEffect(function(o){return e.readFileSync(t,{encoding:r.show(a.showEncoding)(n)})})}}}(n["Node.FS.Sync"]=n["Node.FS.Sync"]||{}),function(t){"use strict";var r=n["AtCoder.ABC123.A"],a=(n["Control.Applicative"],n["Control.Bind"],n.Effect,n["Effect.Console"]),o=n["Node.Encoding"],e=n["Node.FS.Sync"];n.Prelude;t.main=function(){var n=e.readTextFile(o.UTF8.value)("/dev/stdin")(),t=r.solve(n);return a.log(t)()}}(n.Main=n.Main||{}),n.Main.main();
},{}]},{},["Focm"], null)