{"source_code": "var readline = require('readline');\r\nvar rl = readline.createInterface({\r\n input: process.stdin,\r\n output: process.stdout,\r\n terminal: false\r\n});\r\n\r\nlet ls = [];\r\n\r\nfunction solve(){\r\n const len = parseInt(ls[0]);\r\n for (let i = 1; i <= len; i++){\r\n console.log(Math.pow(2, parseInt(ls[i])) - 1);\r\n }\r\n}\r\n\r\nrl.on('line', (l) => ls.push(`${l}`));\r\nrl.on('close', () => solve());", "src_uid": "d5e66e34601cad6d78c3f02898fa09f4"} {"source_code": "MOD = 1000000000+7;\n\nfunction main() {\n\tvar n = +readline();\n\tvar answer = 1;\n\tfor (var i = 0; i < n*3; i++) {\n\t\tanswer *= 3;\n\t\tanswer %= MOD;\n\t}\n\t// 2..\n\t// 1 2 3\n\tb = 1;\n\tfor (var i =0; i < n; i++)\n\t{\n\t\tb *= 7\n\t\tb %= MOD;\n\t}\n\tanswer = (MOD + answer - b);\n\tanswer %= MOD;\n\n\t// 3 2 1\n\t//answer -= 3;\n\n\twrite(answer);\n}\n\nmain();", "src_uid": "eae87ec16c284f324d86b7e65fda093c"} {"source_code": "/*! bignumber.js v5.0.0 https://github.com/MikeMcl/bignumber.js/LICENCE */\n\"use strict\";var BigNumber,isNumeric=/^-?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i,mathceil=Math.ceil,mathfloor=Math.floor,notBool=\" not a boolean or binary digit\",roundingMode=\"rounding mode\",tooManyDigits=\"number type has more than 15 significant digits\",ALPHABET=\"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_\",BASE=1e14,LOG_BASE=14,MAX_SAFE_INTEGER=9007199254740991,POWS_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],SQRT_BASE=1e7,MAX=1e9;function constructorFactory(e){var n,t,r=0,o=m.prototype,i=new m(1),u=20,l=4,s=-7,c=21,f=-1e7,a=1e7,h=!0,g=b,A=!1,E=1,p=0,S={decimalSeparator:\".\",groupSeparator:\",\",groupSize:3,secondaryGroupSize:0,fractionGroupSeparator:\" \",fractionGroupSize:0};function m(e,n){var o,i,s,c,A,E,p=this;if(!(p instanceof m))return new m(e,n);if(null!=n&&g(n,2,64,r,\"base\")){if(n|=0,E=e+\"\",10==n)return p=new m(e instanceof m?e:E),M(p,u+p.e+1,l);if((c=\"number\"==typeof e)&&0*e!=0||!new RegExp(\"^-?\"+(o=\"[\"+ALPHABET.slice(0,n)+\"]+\")+\"(?:\\\\.\"+o+\")?$\",n<37?\"i\":\"\").test(E))return t(p,E,c,n);c?(p.s=1/e<0?(E=E.slice(1),-1):1,h&&E.replace(/^0\\.0*|\\./,\"\").length>15&&T(r,tooManyDigits,e),c=!1):p.s=45===E.charCodeAt(0)?(E=E.slice(1),-1):1,E=_(E,10,n,p.s)}else{if(e instanceof m)return p.s=e.s,p.e=e.e,p.c=(e=e.c)?e.slice():e,void(r=0);if((c=\"number\"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(i=0,s=e;s>=10;s/=10,i++);return p.e=i,p.c=[e],void(r=0)}E=e+\"\"}else{if(!isNumeric.test(E=e+\"\"))return t(p,E,c);p.s=45===E.charCodeAt(0)?(E=E.slice(1),-1):1}}for((i=E.indexOf(\".\"))>-1&&(E=E.replace(\".\",\"\")),(s=E.search(/e/i))>0?(i<0&&(i=s),i+=+E.slice(s+1),E=E.substring(0,s)):i<0&&(i=E.length),s=0;48===E.charCodeAt(s);s++);for(A=E.length;48===E.charCodeAt(--A););if(E=E.slice(s,A+1),E)if(A=E.length,c&&h&&A>15&&(e>MAX_SAFE_INTEGER||e!==mathfloor(e))&&T(r,tooManyDigits,p.s*e),i=i-s-1,i>a)p.c=p.e=null;else if(i=0&&(c=p,p=0,e=e.replace(\".\",\"\"),g=new m(r),a=g.pow(e.length-A),p=c,g.c=toBaseOut(toFixedPoint(coeffToString(a.c),a.e),10,t),g.e=g.c.length),h=toBaseOut(e,r,t),s=c=h.length;0==h[--c];h.pop());if(!h[0])return\"0\";if(A<0?--s:(a.c=h,a.e=s,a.s=o,a=n(a,g,E,S,t),h=a.c,f=a.r,s=a.e),i=s+E+1,A=h[i],c=t/2,f=f||i<0||null!=h[i+1],f=S<4?(null!=A||f)&&(0==S||S==(a.s<0?3:2)):A>c||A==c&&(4==S||f||6==S&&1&h[i-1]||S==(a.s<0?8:7)),i<1||!h[0])e=f?toFixedPoint(\"1\",-E):\"0\";else{if(h.length=i,f)for(--t;++h[--i]>t;)h[i]=0,i||(++s,h=[1].concat(h));for(c=h.length;!h[--c];);for(A=0,e=\"\";A<=c;e+=ALPHABET.charAt(h[A++]));e=toFixedPoint(e,s)}return e}function O(e,n,t,r){var o,i,u,c,f;if(t=null!=t&&g(t,0,8,r,roundingMode)?0|t:l,!e.c)return e.toString();if(o=e.c[0],u=e.e,null==n)f=coeffToString(e.c),f=19==r||24==r&&u<=s?toExponential(f,u):toFixedPoint(f,u);else if(e=M(new m(e),n,t),i=e.e,f=coeffToString(e.c),c=f.length,19==r||24==r&&(n<=i||i<=s)){for(;cc){if(--n>0)for(f+=\".\";n--;f+=\"0\");}else if(n+=i-c,n>0)for(i+1==c&&(f+=\".\");n--;f+=\"0\");return e.s<0&&o?\"-\"+f:f}function N(e,n){var t,r,o=0;for(isArray(e[0])&&(e=e[0]),t=new m(e[0]);++ot||e!=truncate(e))&&T(r,(o||\"decimal places\")+(et?\" out of range\":\" not an integer\"),e),!0}function w(e,n,t){var r=1,o=n.length;for(;!n[--o];n.pop());for(o=n[0];o>=10;o/=10,r++);return(t=r+t*LOG_BASE-1)>a?e.c=e.e=null:t=10;l/=10,o++);if(i=n-o,i<0)i+=LOG_BASE,u=n,s=g[c=0],h=s/A[o-u-1]%10|0;else if(c=mathceil((i+1)/LOG_BASE),c>=g.length){if(!r)break e;for(;g.length<=c;g.push(0));s=h=0,o=1,i%=LOG_BASE,u=i-LOG_BASE+1}else{for(s=l=g[c],o=1;l>=10;l/=10,o++);i%=LOG_BASE,u=i-LOG_BASE+o,h=u<0?0:s/A[o-u-1]%10|0}if(r=r||n<0||null!=g[c+1]||(u<0?s:s%A[o-u-1]),r=t<4?(h||r)&&(0==t||t==(e.s<0?3:2)):h>5||5==h&&(4==t||r||6==t&&(i>0?u>0?s/A[o-u]:0:g[c-1])%10&1||t==(e.s<0?8:7)),n<1||!g[0])return g.length=0,r?(n-=e.e+1,g[0]=A[(LOG_BASE-n%LOG_BASE)%LOG_BASE],e.e=-n||0):g[0]=e.e=0,e;if(0==i?(g.length=c,l=1,c--):(g.length=c+1,l=A[LOG_BASE-i],g[c]=u>0?mathfloor(s/A[o-u]%A[u])*l:0),r)for(;;){if(0==c){for(i=1,u=g[0];u>=10;u/=10,i++);for(u=g[0]+=l,l=1;u>=10;u/=10,l++);i!=l&&(e.e++,g[0]==BASE&&(g[0]=1));break}if(g[c]+=l,g[c]!=BASE)break;g[c--]=0,l=1}for(i=g.length;0===g[--i];g.pop());}e.e>a?e.c=e.e=null:e.et)return null!=(e=i[t++])};return d(n=\"DECIMAL_PLACES\")&&g(e,0,MAX,2,n)&&(u=0|e),o[n]=u,d(n=\"ROUNDING_MODE\")&&g(e,0,8,2,n)&&(l=0|e),o[n]=l,d(n=\"EXPONENTIAL_AT\")&&(isArray(e)?g(e[0],-MAX,0,2,n)&&g(e[1],0,MAX,2,n)&&(s=0|e[0],c=0|e[1]):g(e,-MAX,MAX,2,n)&&(s=-(c=0|(e<0?-e:e)))),o[n]=[s,c],d(n=\"RANGE\")&&(isArray(e)?g(e[0],-MAX,-1,2,n)&&g(e[1],1,MAX,2,n)&&(f=0|e[0],a=0|e[1]):g(e,-MAX,MAX,2,n)&&(0|e?f=-(a=0|(e<0?-e:e)):h&&T(2,n+\" cannot be zero\",e))),o[n]=[f,a],d(n=\"ERRORS\")&&(e===!!e||1===e||0===e?(r=0,g=(h=!!e)?b:intValidatorNoErrors):h&&T(2,n+notBool,e)),o[n]=h,d(n=\"CRYPTO\")&&(!0===e||!1===e||1===e||0===e?e?(e=\"undefined\"==typeof crypto,!e&&crypto&&(crypto.getRandomValues||crypto.randomBytes)?A=!0:h?T(2,\"crypto unavailable\",e?void 0:crypto):A=!1):A=!1:h&&T(2,n+notBool,e)),o[n]=A,d(n=\"MODULO_MODE\")&&g(e,0,9,2,n)&&(E=0|e),o[n]=E,d(n=\"POW_PRECISION\")&&g(e,0,MAX,2,n)&&(p=0|e),o[n]=p,d(n=\"FORMAT\")&&(\"object\"==typeof e?S=e:h&&T(2,n+\" not an object\",e)),o[n]=S,o},m.max=function(){return N(arguments,o.lt)},m.min=function(){return N(arguments,o.gt)},m.random=(d=9007199254740992,B=Math.random()*d&2097151?function(){return mathfloor(Math.random()*d)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var n,t,r,o,l,s=0,c=[],f=new m(i);if(e=null!=e&&g(e,0,MAX,14)?0|e:u,o=mathceil(e/LOG_BASE),A)if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(o*=2));s>>11),l>=9e15?(t=crypto.getRandomValues(new Uint32Array(2)),n[s]=t[0],n[s+1]=t[1]):(c.push(l%1e14),s+=2);s=o/2}else if(crypto.randomBytes){for(n=crypto.randomBytes(o*=7);s=9e15?crypto.randomBytes(7).copy(n,s):(c.push(l%1e14),s+=7);s=o/7}else A=!1,h&&T(14,\"crypto unavailable\",crypto);if(!A)for(;s=10;l/=10,s++);sr?1:-1;else for(o=i=0;on[o]?1:-1;break}return i}function t(e,n,t,r){var o=0;for(;t--;)e[t]-=o,o=e[t]1;e.splice(0,1));}return function(r,o,i,u,l){var s,c,f,a,h,g,A,E,p,S,d,B,_,O,N,b,w,v=r.s==o.s?1:-1,L=r.c,G=o.c;if(!(L&&L[0]&&G&&G[0]))return new m(r.s&&o.s&&(L?!G||L[0]!=G[0]:G)?L&&0==L[0]||!G?0*v:v/0:NaN);for(E=new m(v),p=E.c=[],c=r.e-o.e,v=i+c+1,l||(l=BASE,c=bitFloor(r.e/LOG_BASE)-bitFloor(o.e/LOG_BASE),v=v/LOG_BASE|0),f=0;G[f]==(L[f]||0);f++);if(G[f]>(L[f]||0)&&c--,v<0)p.push(1),a=!0;else{for(O=L.length,b=G.length,f=0,v+=2,h=mathfloor(l/(G[0]+1)),h>1&&(G=e(G,h,l),L=e(L,h,l),b=G.length,O=L.length),_=b,S=L.slice(0,b),d=S.length;d=l/2&&N++;do{if(h=0,s=n(G,S,b,d),s<0){if(B=S[0],b!=d&&(B=B*l+(S[1]||0)),h=mathfloor(B/N),h>1)for(h>=l&&(h=l-1),g=e(G,h,l),A=g.length,d=S.length;1==n(g,S,A,d);)h--,t(g,b=10;v/=10,f++);M(E,i+(E.e=f+c*LOG_BASE-1)+1,u,a)}else E.e=c,E.r=+a;return E}}(),v=/^(-?)0([xbo])(?=\\w[\\w.]*$)/i,L=/^([^.]+)\\.$/,G=/^\\.([^.]+)$/,F=/^-?(Infinity|NaN)$/,y=/^\\s*\\+(?=[\\w.])|^\\s+|\\s+$/g,t=function(e,n,t,o){var i,u=t?n:n.replace(y,\"\");if(F.test(u))e.s=isNaN(u)?null:u<0?-1:1;else{if(!t&&(u=u.replace(v,function(e,n,t){return i=\"x\"==(t=t.toLowerCase())?16:\"b\"==t?2:8,o&&o!=i?e:n}),o&&(i=o,u=u.replace(L,\"$1\").replace(G,\"0.$1\")),n!=u))return new m(u,i);h&&T(r,\"not a\"+(o?\" base \"+o:\"\")+\" number\",n),e.s=null}e.c=e.e=null,r=0},o.absoluteValue=o.abs=function(){var e=new m(this);return e.s<0&&(e.s=1),e},o.ceil=function(){return M(new m(this),this.e+1,2)},o.comparedTo=o.cmp=function(e,n){return r=1,compare(this,new m(e,n))},o.decimalPlaces=o.dp=function(){var e,n,t=this.c;if(!t)return null;if(e=((n=t.length-1)-bitFloor(this.e/LOG_BASE))*LOG_BASE,n=t[n])for(;n%10==0;n/=10,e--);return e<0&&(e=0),e},o.dividedBy=o.div=function(e,t){return r=3,n(this,new m(e,t),u,l)},o.dividedToIntegerBy=o.divToInt=function(e,t){return r=4,n(this,new m(e,t),0,1)},o.equals=o.eq=function(e,n){return r=5,0===compare(this,new m(e,n))},o.floor=function(){return M(new m(this),this.e+1,3)},o.greaterThan=o.gt=function(e,n){return r=6,compare(this,new m(e,n))>0},o.greaterThanOrEqualTo=o.gte=function(e,n){return r=7,1===(n=compare(this,new m(e,n)))||0===n},o.isFinite=function(){return!!this.c},o.isInteger=o.isInt=function(){return!!this.c&&bitFloor(this.e/LOG_BASE)>this.c.length-2},o.isNaN=function(){return!this.s},o.isNegative=o.isNeg=function(){return this.s<0},o.isZero=function(){return!!this.c&&0==this.c[0]},o.lessThan=o.lt=function(e,n){return r=8,compare(this,new m(e,n))<0},o.lessThanOrEqualTo=o.lte=function(e,n){return r=9,-1===(n=compare(this,new m(e,n)))||0===n},o.minus=o.sub=function(e,n){var t,o,i,u,s=this,c=s.s;if(r=10,e=new m(e,n),n=e.s,!c||!n)return new m(NaN);if(c!=n)return e.s=-n,s.plus(e);var f=s.e/LOG_BASE,a=e.e/LOG_BASE,h=s.c,g=e.c;if(!f||!a){if(!h||!g)return h?(e.s=-n,e):new m(g?s:NaN);if(!h[0]||!g[0])return g[0]?(e.s=-n,e):new m(h[0]?s:3==l?-0:0)}if(f=bitFloor(f),a=bitFloor(a),h=h.slice(),c=f-a){for((u=c<0)?(c=-c,i=h):(a=f,i=g),i.reverse(),n=c;n--;i.push(0));i.reverse()}else for(o=(u=(c=h.length)<(n=g.length))?c:n,c=n=0;n0)for(;n--;h[t++]=0);for(n=BASE-1;o>c;){if(h[--o]0?(l=u,t=c):(i=-i,t=s),t.reverse();i--;t.push(0));t.reverse()}for(i=s.length,n=c.length,i-n<0&&(t=c,c=s,s=t,n=i),i=0;n;)i=(s[--n]=s[n]+c[n]+i)/BASE|0,s[n]=BASE===s[n]?0:s[n]%BASE;return i&&(s=[i].concat(s),++l),w(e,s,l)},o.precision=o.sd=function(e){var n,t,r=this,o=r.c;if(null!=e&&e!==!!e&&1!==e&&0!==e&&(h&&T(13,\"argument\"+notBool,e),e!=!!e&&(e=null)),!o)return null;if(t=o.length-1,n=t*LOG_BASE+1,t=o[t]){for(;t%10==0;t/=10,n--);for(t=o[0];t>=10;t/=10,n++);}return e&&r.e+1>n&&(n=r.e+1),n},o.round=function(e,n){var t=new m(this);return(null==e||g(e,0,MAX,15))&&M(t,~~e+this.e+1,null!=n&&g(n,0,8,15,roundingMode)?0|n:l),t},o.shift=function(e){var n=this;return g(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER,16,\"argument\")?n.times(\"1e\"+truncate(e)):new m(n.c&&n.c[0]&&(e<-MAX_SAFE_INTEGER||e>MAX_SAFE_INTEGER)?n.s*(e<0?0:1/0):n)},o.squareRoot=o.sqrt=function(){var e,t,r,o,i,s=this,c=s.c,f=s.s,a=s.e,h=u+4,g=new m(\"0.5\");if(1!==f||!c||!c[0])return new m(!f||f<0&&(!c||c[0])?NaN:c?s:1/0);if(f=Math.sqrt(+s),0==f||f==1/0?(t=coeffToString(c),(t.length+a)%2==0&&(t+=\"0\"),f=Math.sqrt(t),a=bitFloor((a+1)/2)-(a<0||a%2),f==1/0?t=\"1e\"+a:(t=f.toExponential(),t=t.slice(0,t.indexOf(\"e\")+1)+a),r=new m(t)):r=new m(f+\"\"),r.c[0])for(a=r.e,f=a+h,f<3&&(f=0);;)if(i=r,r=g.times(i.plus(n(s,i,h,1))),coeffToString(i.c).slice(0,f)===(t=coeffToString(r.c)).slice(0,f)){if(r.e=0;){for(t=0,g=_[i]%S,A=_[i]/S|0,l=c,u=i+l;u>i;)f=B[--l]%S,a=B[l]/S|0,s=A*f+a*g,f=g*f+s%S*S+E[u]+t,t=(f/p|0)+(s/S|0)+A*a,E[u--]=f%p;E[u]=t}return t?++o:E.splice(0,1),w(e,E,o)},o.toDigits=function(e,n){var t=new m(this);return e=null!=e&&g(e,1,MAX,18,\"precision\")?0|e:null,n=null!=n&&g(n,0,8,18,roundingMode)?0|n:l,e?M(t,e,n):t},o.toExponential=function(e,n){return O(this,null!=e&&g(e,0,MAX,19)?1+~~e:null,n,19)},o.toFixed=function(e,n){return O(this,null!=e&&g(e,0,MAX,20)?~~e+this.e+1:null,n,20)},o.toFormat=function(e,n){var t=O(this,null!=e&&g(e,0,MAX,21)?~~e+this.e+1:null,n,21);if(this.c){var r,o=t.split(\".\"),i=+S.groupSize,u=+S.secondaryGroupSize,l=S.groupSeparator,s=o[0],c=o[1],f=this.s<0,a=f?s.slice(1):s,h=a.length;if(u&&(r=i,i=u,u=r,h-=r),i>0&&h>0){for(r=h%i||i,s=a.substr(0,r);r0&&(s+=l+a.slice(r)),f&&(s=\"-\"+s)}t=c?s+S.decimalSeparator+((u=+S.fractionGroupSize)?c.replace(new RegExp(\"\\\\d{\"+u+\"}\\\\B\",\"g\"),\"$&\"+S.fractionGroupSeparator):c):s}return t},o.toFraction=function(e){var t,r,o,u,s,c,f,g,A,E=h,p=this,S=p.c,d=new m(i),B=r=new m(i),_=f=new m(i);if(null!=e&&(h=!1,c=new m(e),h=E,(E=c.isInt())&&!c.lt(i)||(h&&T(22,\"max denominator \"+(E?\"out of range\":\"not an integer\"),e),e=!E&&c.c&&M(c,c.e+1,1).gte(i)?c:null)),!S)return p.toString();for(A=coeffToString(S),u=d.e=A.length-p.e-1,d.c[0]=POWS_TEN[(s=u%LOG_BASE)<0?LOG_BASE+s:s],e=!e||c.cmp(d)>0?u>0?d:B:c,s=a,a=1/0,c=new m(A),f.c[0]=0;g=n(c,d,0,1),o=r.plus(g.times(_)),1!=o.cmp(e);)r=_,_=o,B=f.plus(g.times(o=B)),f=o,d=c.minus(g.times(o=d)),c=o;return o=n(e.minus(r),_,0,1),f=f.plus(o.times(B)),r=r.plus(o.times(_)),f.s=B.s=p.s,u*=2,t=n(B,_,u,l).minus(p).abs().cmp(n(f,r,u,l).minus(p).abs())<1?[B.toString(),_.toString()]:[f.toString(),r.toString()],a=s,t},o.toNumber=function(){return+this},o.toPower=o.pow=function(e,n){var t,o,u,s=mathfloor(e<0?-e:+e),c=this;if(null!=n&&(r=23,n=new m(n)),!g(e,-MAX_SAFE_INTEGER,MAX_SAFE_INTEGER,23,\"exponent\")&&(!isFinite(e)||s>MAX_SAFE_INTEGER&&(e/=0)||parseFloat(e)!=e&&!(e=NaN))||0==e)return t=Math.pow(+c,e),new m(n?t%n:t);for(n?e>1&&c.gt(i)&&c.isInt()&&n.gt(i)&&n.isInt()?c=c.mod(n):(u=n,n=null):p&&(t=mathceil(p/LOG_BASE+2)),o=new m(i);;){if(s%2){if(o=o.times(c),!o.c)break;t?o.c.length>t&&(o.c.length=t):n&&(o=o.mod(n))}if(s=mathfloor(s/2),!s)break;c=c.times(c),t?c.c&&c.c.length>t&&(c.c.length=t):n&&(c=c.mod(n))}return n?o:(e<0&&(o=i.div(o)),u?o.mod(u):t?M(o,p,l):o)},o.toPrecision=function(e,n){return O(this,null!=e&&g(e,1,MAX,24,\"precision\")?0|e:null,n,24)},o.toString=function(e){var n,t=this,r=t.s,o=t.e;return null===o?r?(n=\"Infinity\",r<0&&(n=\"-\"+n)):n=\"NaN\":(n=coeffToString(t.c),n=null!=e&&g(e,2,64,25,\"base\")?_(toFixedPoint(n,o),0|e,10,r):o<=s||o>=c?toExponential(n,o):toFixedPoint(n,o),r<0&&t.c[0]&&(n=\"-\"+n)),n},o.truncated=o.trunc=function(){return M(new m(this),this.e+1,1)},o.valueOf=o.toJSON=function(){var e,n=this,t=n.e;return null===t?n.toString():(e=coeffToString(n.c),e=t<=s||t>=c?toExponential(e,t):toFixedPoint(e,t),n.s<0?\"-\"+e:e)},o.isBigNumber=!0,null!=e&&m.config(e),m}function bitFloor(e){var n=0|e;return e>0||e===n?n:n-1}function coeffToString(e){var n,t,r=1,o=e.length,i=e[0]+\"\";for(;rc^t?1:-1;for(l=(s=o.length)<(c=i.length)?s:c,u=0;ui[u]^t?1:-1;return s==c?0:s>c^t?1:-1}function intValidatorNoErrors(e,n,t){return(e=truncate(e))>=n&&e<=t}function isArray(e){return\"[object Array]\"==Object.prototype.toString.call(e)}function toBaseOut(e,n,t){var r,o,i=[0],u=0,l=e.length;for(;ut-1&&(null==i[r+1]&&(i[r+1]=0),i[r+1]+=i[r]/t|0,i[r]%=t)}return i.reverse()}function toExponential(e,n){return(e.length>1?e.charAt(0)+\".\"+e.slice(1):e)+(n<0?\"e\":\"e+\")+n}function toFixedPoint(e,n){var t,r;if(n<0){for(r=\"0.\";++n;r+=\"0\");e=r+e}else if(t=e.length,++n>t){for(r=\"0\",n-=t;--n;r+=\"0\");e+=r}else n 997 ? -1 : index + 1);\n}\n\nmain();\n", "src_uid": "0bc7bf67b96e2898cfd8d129ad486910"} {"source_code": "input1=readline();\ninput=readline();\ncnt=0\nfor ( index = 1; index < input.length; index++) {\n element = input[index];\n if(element===input[index-1])cnt++;\n}\nprint(cnt)\n\n", "src_uid": "d561436e2ddc9074b98ebbe49b9e27b8"} {"source_code": "function solve(){\n var a = readline();\n var last = 1;\n var res = 0;\n for(var i = 1; i < a.length; i++){\n if(a[i] != a[i-1]){\n if(last % 2 == 0) ++res;\n last = 1;\n } else {\n last++;\n }\n }\n if(last % 2 == 0) ++res;\n print(res);\n}\nsolve();", "src_uid": "8b26ca1ca2b28166c3d25dceb1f3d49f"} {"source_code": "function checkAlenasMoney(n, a, b, c)\n{\n function increase(n1, n2)\n {\n return n1 - n2;\n }\n var arr = [a, b, c];\n var k = 0;\n while ((n + k) % 4 !== 0)\n {\n k++;\n }\n if (k === 0) return 0;\n else\n {\n if (k === 1) \n {\n arr = [a, c + b, 3 * c];\n return arr.sort(increase)[0];\n }\n if (k === 2)\n {\n arr = [b, 2 * a, 2 * c];\n return arr.sort(increase)[0];\n }\n if (k === 3) \n {\n arr = [c, 3 * a, b + a, 2 * c + a];\n return arr.sort(increase)[0];\n }\n }\n}\n\n{\n var input = readline();\n input = input.split(' ');\n print(checkAlenasMoney(+input[0], +input[1], +input[2], +input[3]));\n}", "src_uid": "c74537b7e2032c1d928717dfe15ccfb8"} {"source_code": "String.prototype.lpad = function(padString, length) {\n var str = this;\n while (str.length < length)\n str = padString + str;\n return str;\n};\n\nvar currentTime = readline().split(\":\");\ncurrentTime[0] = parseInt(currentTime[0]);\ncurrentTime[1] = parseInt(currentTime[1]);\nvar sleepLength = readline().split(\":\");\nsleepLength[0] = parseInt(sleepLength[0]);\nsleepLength[1] = parseInt(sleepLength[1]);\n\nvar sleepTimeHours = (currentTime[0] - sleepLength[0]);\nvar sleepTimeMinutes = (currentTime[1] - sleepLength[1]);\n\nif (sleepLength[1] > currentTime[1]) {\n sleepTimeHours--;\n}\n\nif (sleepTimeHours < 0) sleepTimeHours = 24 + sleepTimeHours;\nif (sleepTimeMinutes < 0) sleepTimeMinutes = 60 + sleepTimeMinutes;\n\nvar sleepTime = sleepTimeHours.toString().lpad(\"0\", 2) + \":\" + sleepTimeMinutes.toString().lpad(\"0\", 2);\n\nprint(sleepTime);\n", "src_uid": "595c4a628c261104c8eedad767e85775"} {"source_code": "var p = readline().split(\" \").map(Number);\nprint((p[1] - p[0])/(p[2] + p[3]));", "src_uid": "f34f3f974a21144b9f6e8615c41830f5"} {"source_code": "var values = readline().split(' ').map((elements)=>{\n\treturn parseInt(elements)\n})\nvar circleDistance = 2*values[0]\nvar path = Math.ceil( Math.sqrt(\n\tMath.pow(values[1] - values[3],2) + Math.pow(values[2] - values[4],2)\n\t)/circleDistance)\nprint(path)", "src_uid": "698da80c7d24252b57cca4e4f0ca7031"} {"source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\n\nrl.on('line', (d) => {\n const arr = d.split(' ').map(Number);\n let point = Infinity;\n\n for (let i = 0; i <= 2; i++) {\n if (point + i > arr[i]) {\n point = arr[i] - i;\n }\n }\n\n console.log(point * 3 + 3);\n});", "src_uid": "03ac8efe10de17590e1ae151a7bae1a5"} {"source_code": "var n = (parseInt(readline()) + 1)%6,\n x = parseInt(readline())\n\n//console.log(x,n)\nswitch (x) {\n case 0:\n switch (n) {\n case 0:\n case 1:\n print(0)\n break;\n case 2:\n case 3:\n print(1)\n break;\n case 4:\n case 5:\n print(2)\n break;\n }\n break;\n\n case 1:\n switch (n) {\n case 0:\n case 3:\n print(2)\n break;\n case 2:\n case 5:\n print(0)\n break;\n case 4:\n case 1:\n print(1)\n break;\n }\n break;\n\n case 2:\n switch (n) {\n case 0:\n case 5:\n print(1)\n break;\n case 4:\n case 3:\n print(0)\n break;\n case 2:\n case 1:\n print(2)\n break;\n }\n break;\n}\n", "src_uid": "7853e03d520cd71571a6079cdfc4c4b0"} {"source_code": "var input = readline()\nvar touched = Array(parseInt(input)).fill(false)\nvar step = 1\n\n\nfor(var i=0;i<=input;i++){\n step += i\n \tif(step>input) step-=input\n \ttouched[step]=true\n}\n\nvar isAllVisited=true\nfor(var i=1;i<=input;i++){ \n if(!touched[i]) isAllVisited=false\n}\n\nisAllVisited? print(\"YES\"):print(\"NO\")", "src_uid": "4bd174a997707ed3a368bd0f2424590f"} {"source_code": "'use strict'\n\nlet lll = readline()\n\nlet max = 0\n\nfor (let i = 0; i < lll.length; i++)\n for (let j = max + 1; j < lll.length - i; j++) \n if (lll.lastIndexOf(lll.slice(i, i + j)) != i) \n max = j\n\n\nprint(max)", "src_uid": "13b5cf94f2fabd053375a5ccf3fd44c7"} {"source_code": "var n = +readline();\n\nvar min = 0;\nfor(var i = 6, j = 7; ; i += 7, j += 7){\n if(i <= n){\n min++;\n }else break;\n if(j <= n){\n min++;\n }else break;\n}\n\nvar max = 0;\nfor(var i = 1, j = 2; ; i += 7, j += 7){\n if(i <= n){\n max++;\n }else break;\n if(j <= n){\n max++;\n }else break;\n}\n\nwrite(min, max);", "src_uid": "8152daefb04dfa3e1a53f0a501544c35"} {"source_code": "l=readline();\ng=readline().split('');\n\nvar toS=0, toF=0;\n\nfor (i=0; i<(l-1); i++) {\n if (g[i]==\"S\" && g[i] != g[i+1]) toF++;\n if (g[i]==\"F\" && g[i] != g[i+1]) toS++\n}\n\nif (toF>toS) print(\"YES\")\nelse print(\"NO\")\n\n\n", "src_uid": "ab8a2070ea758d118b3c09ee165d9517"} {"source_code": "var t = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n \nvar inp = readline().split(' ');\nvar n = inp[0];\nvar type = inp[2];\n\nif (type == \"week\") {\n var current = 5;\n var a = 0;\n for (var i = 0; i < 366; ++i) {\n if(current == n)\n ++a;\n ++current;\n if(current > 7)\n current = 1;\n }\n print(a);\n} else {\n var a = 0;\n for (var i = 0; i < 12; ++i) {\n a += n <= t[i];\n \n }\n print(a);\n}", "src_uid": "9b8543c1ae3666e6c163d268fdbeef6b"} {"source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\n\nrl.on('line', (d) => {\n let [n, k] = d.split(' ').map(Number);\n\n let mid = Math.floor(n / 2);\n let x = mid % (k + 1);\n let a = (mid - x) / (k + 1);\n let b = a * k;\n let c = n - a - b;\n\n console.log(`${a} ${b} ${c}`);\n});\n", "src_uid": "405a70c3b3f1561a9546910ab3fb5c80"} {"source_code": "(function() {\n var s = readline();\n \n if (s.length < 26) {\n print(-1);\n return 0;\n }\n \n const alph = 'abcdefghijklmnopqrstuvwxyz';\n \n var sIdx = 0;\n var resultString = '';\n \n for (var i = 0; i < alph.length; i++) {\n if (sIdx >= s.length) {\n print(-1);\n return 0;\n }\n \n var aLetter = alph[i];\n var searchNeeded = true;\n \n while (searchNeeded && sIdx < s.length) {\n var sLetter = s[sIdx];\n \n if (sLetter <= aLetter) {\n resultString += aLetter;\n searchNeeded = false;\n } else {\n resultString += sLetter;\n }\n \n sIdx++;\n }\n }\n \n for (var i = sIdx; i < s.length; i++) {\n resultString += s[i];\n }\n \n print(resultString);\n return 0;\n})();", "src_uid": "f8ad543d499bcc0da0121a71a26db854"} {"source_code": "var N = parseInt(readline());\nvar arr = readline().split(\"\");\nvar localCounter = 0;\nvar res = 0;\n\narr.map(function(el) {\n if (el === 'x') {\n localCounter++;\n if (localCounter > 2) {\n res++;\n }\n } else {\n localCounter = 0;\n }\n});\n\nprint(res);", "src_uid": "8de14db41d0acee116bd5d8079cb2b02"} {"source_code": "var s = readline();\nvar t = readline();\n\nvar b = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p',\n\t'q','r','s','t','u','v','w','x','y','z'];\n\nvar ans=\"\";\nvar p = 1;\nfor(var i=s.length-1; i>=0; i--){\n\tfor(var ind=0; b[ind]!=s[i]; ind++);\n\tif(ind+p>=b.length){\n\t\tind = 0 + p - 1;\n\t\tp = 1;\n\t}else{\n\t\tind = ind+p;\n\t\tp = 0;\n\t}\n\t\n\tans+=b[ind];\n}\nvar ansRev=\"\";\n\tfor(var i=s.length-1; i>=0; i--)\n\t\tansRev+=ans[i];\nif(p!=0 || ansRev>=t)\n\tprint('No such string');\nelse{\n\tprint(ansRev);\n}", "src_uid": "47618510d2a17b1cc1e6a688201d51a3"} {"source_code": "function abs(q)\n{\n if (q>0){return q;}\n return -q\n}\n\ns=readline().split(' ').map(function(x){return +x;})\na=+s[0]\nb=+s[1]\ns=readline().split(' ').map(function(x){return +x;})\nc=+s[0]\nd=+s[1]\nu=0\nif (a==c||b==d)\n{\n u=2\n}\nprint(abs(a-c)*2+abs(b-d)*2+4+u)", "src_uid": "f54ce13fb92e51ebd5e82ffbdd1acbed"} {"source_code": "process.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n\nlet inp = 0\nprocess.stdin.on(\"data\",input=>{\n inp = input\n})\nprocess.stdin.on(\"end\",input=>{\n inp = inp.replace(/\\s*$/, '').split(\"\\n\").map(str => str.replace(/\\s*$/, ''));\n \n \n main();\n \n})\n\n\n\n\nfunction main(){\n n = inp[0].split(\" \")[0]\n k = inp[0].split(\" \")[1]\n \n let allscores = inp[1].split(\" \").map(item=>{return parseInt(item)})\n \n let gecen = allscores.filter((item)=>{return item >= allscores[k-1]}).filter(item=>{return item>0})\n console.log(gecen.length)\n \n}", "src_uid": "193ec1226ffe07522caf63e84a7d007f"} {"source_code": "print(readline()*3/2);", "src_uid": "031e53952e76cff8fdc0988bb0d3239c"} {"source_code": "/**\nPolycarp has just invented a new binary protocol for data transmission. He is encoding positive integer decimal number to binary string using following algorithm:\n\nEach digit is represented with number of '1' characters equal to the value of that digit (for 0 it is zero ones).\nDigits are written one by one in order corresponding to number and separated by single '0' character.\nThough Polycarp learnt how to encode the numbers, he has no idea how to decode them back. Help him calculate the decoded number.\n\nInput\nThe first line contains one integer number n (1 ≤ n ≤ 89) — length of the string s.\n\nThe second line contains string s — sequence of '0' and '1' characters, number in its encoded format. It is guaranteed that the number corresponding to the string is positive and doesn't exceed 109. The string always starts with '1'.\n\nOutput\nPrint the decoded number.\n\nExamples\ninput\n3\n111\noutput\n3\ninput\n9\n110011101\noutput\n2031\n\n */\n\nlet inputString = '';\n\nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n\nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n\n let lengthOfString = Number(inputString[0]);\n let string = inputString[1];\n\n solution(lengthOfString, string);\n\n});\n\nfunction solution(lengthOfString, string) {\n\n let onesCount = 0;\n let zeorCount = '';\n let digit = [];\n\n for (let index = 0; index < lengthOfString; index++) {\n\n if (string[index] == '1') {\n\n onesCount++;\n\n if (zeorCount.length > 1)\n digit.push(zeorCount.substring(0, zeorCount.length - 1));\n\n zeorCount = '';\n }\n\n if (string[index] == '0') {\n\n zeorCount += '0';\n\n if (onesCount)\n digit.push(onesCount.toString());\n\n onesCount = 0;\n }\n }\n\n if (onesCount)\n digit.push(onesCount.toString());\n\n if (zeorCount.length )\n digit.push(zeorCount);\n\n console.log(digit.join(\"\"));\n\n}", "src_uid": "a4b3da4cb9b6a7ed0a33a862e940cafa"} {"source_code": "var arr1=readline().split(\" \");\nvar arr2=readline().split(\" \");\nvar n=readline();\nvar ans1=parseInt(parseInt(arr1[0])+parseInt(arr1[1])+parseInt(arr1[2]));\nvar ans2=parseInt(parseInt(arr2[0])+parseInt(arr2[1])+parseInt(arr2[2]));\nvar x =Math.ceil(parseFloat(ans1/5));\nvar y =Math.ceil(parseFloat(ans2/10));\nif(parseInt(n)>=parseInt(x+y)){\n print(\"YES\");\n}\nelse{\n print(\"NO\");\n}", "src_uid": "fe6301816dea7d9cea1c3a06a7d1ea7e"} {"source_code": "var read = require('readline').createInterface({\n input: process.stdin,\n output: process.stdout\n});\nvar obj;\nvar inLine = [];\nread.on('line', function(input){inLine.push(input);});\nread.on('close', function(){\n obj = init(inLine);\n console.error(\"\\n\");\n var start = Date.now();\n Main();\n var end = Date.now() - start;\n myerr(\"time : \" + (end) + \"ms\");\n myerr(\"memory : \" + Math.round(process.memoryUsage().heapTotal / 1024) + \"KB\");\n});\nfunction makeClone(obj){return JSON.parse(JSON.stringify(obj));}\nfunction nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}\nfunction nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}\nfunction next(){return obj.next();} function hasNext(){return obj.hasNext();}\nfunction init(input){ \n var returnObj = {\n list : input, index : 0, max : input.length,\n hasNext : function(){return (this.index < this.max);},\n next : function(){\n if(!this.hasNext()){\n\n throw \"ArrayIndexOutOfBoundsException これ以上ないよ\";\n }\n else{\n var returnInput = this.list[this.index];\n this.index++;\n return returnInput;\n }\n }};\n return returnObj;\n}\nfunction myout(s){console.log(s);}\nfunction myerr(s){console.error(\"debug:\" + require(\"util\").inspect(s,false,null));}\n //[no]要素の扱い。数値型\n //不明値、異常時:引数そのまま返す 1:数値へ変換\n //2:半角SPで分割 4:半角SPで分割し、数値配列へ\n //6:1文字で分割 7:1文字で分割し、数値配列へ\n //8:半角SPで結合 9:改行で結合 0:文字なしで結合\nfunction myconv(i,no){\n try{\n switch(no){\n case 1:return parseInt(i);\n case 2:return i.split(\" \");\n case 4:return i.split(\" \").map(Number);\n case 6:return i.split(\"\");\n case 7:return i.split(\"\").map(Number);\n case 8:return i.join(\" \");\n case 9:return i.join(\"\\n\");\n case 0:return i.join(\"\");\n default:return i;\n }\n }\n catch(e){\n return i;\n }\n}\nfunction Main(){\n var output = [];\n\n var ul = next();\n var arr = nextIntArray() ;\n var brr = nextIntArray() ; \n arr.sort() ;\n brr.sort();\n var crr = arr.filter(x=>brr.includes(x));\n if(crr.length > 0) {\n myout(crr[0]) ;\n }\n else {\n var l = Math.min(arr[0],brr[0]) ;\n var h = Math.max(arr[0],brr[0]) ;\n myout(l+\"\"+h)\n }\n \n}", "src_uid": "3a0c1b6d710fd8f0b6daf420255d76ee"} {"source_code": "var N = parseInt(readline());\nvar ar = readline().split(' ').map(function(a) {return parseInt(a);});\nar.sort(function(a, b) { return a-b;});\n\nvar sum = 0;\nfor (var i = 0; i < ar.length; i++) {\n sum += ar[i];\n}\n\nvar r = 0;\nvar navg = Math.round( sum / ar.length );\n\nfor (var i = 0; i < ar.length && navg < 5; i++) {\n sum -= ar[i];\n sum += 5;\n navg = Math.round( sum / ar.length );\n r++;\n}\n\nprint(r);\n", "src_uid": "715608282b27a0a25b66f08574a6d5bd"} {"source_code": "\"use strict\";\nArray.prototype.contains = function(el){\n return this.indexOf(el) > -1;\n};\n\nvar rotateArray = function rotateArray(arr){ \n arr.unshift(arr.pop());\n return arr;\n};\n\nprint(function(input){ \n input = input.split('');\n var len = input.length;\n var arr = [];\n var i = 0;\n var count = 0;\n while (i < len) {\n //print(i, len);\n input = rotateArray(input); \n var add = input.join('');\n if (!arr.contains(add)){\n count++; \n arr.push(add);\n //print(\"we here with\", input);\n //print(arr);\n }\n i++;\n }\n return count;\n}.apply(null, readline().split(\" \")));\n\n", "src_uid": "8909ac99ed4ab2ee4d681ec864c7831e"} {"source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nlet c = 0;\nlet a, b;\n\nrl.on('line', (d) => {\n if (c === 0) {\n c++;\n a = +d;\n return;\n }\n\n b = +d;\n const a1 = Math.floor(Math.abs(a - b) / 2);\n const b1 = Math.ceil(Math.abs(a - b) / 2);\n const leftSum = a1 * (a1 + 1) / 2;\n const rigthSum = b1 * (b1 + 1) / 2;\n const ans = leftSum + rigthSum;\n\n console.log(ans);\n\n c++;\n});\n", "src_uid": "d3f2c6886ed104d7baba8dd7b70058da"} {"source_code": "var line = readline();\nvar isOne = false;\nvar counter = 0;\nvar found = false;\nfor (var i = 0; i < line.length; i++) {\n if ((line[i] === '1' && isOne) || (line[i] === '0' && !isOne)) {\n counter++;\n } else {\n counter = 1;\n isOne = (line[i] === '1');\n }\n if (counter === 7) {\n print('YES');\n found = true;\n break;\n }\n}\nif (!found) {\nprint('NO');\n}", "src_uid": "ed9a763362abc6ed40356731f1036b38"} {"source_code": "// https://codeforces.com/problemset/problem/596/A\n// Big O:\n// Time complexity:\n// Space complexity:\n\n// Read input\nvar readline = require(\"readline\");\nvar rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nlet numberOfVertices;\nlet vertices = [];\nrl.on('line', (input) => {\n if (!numberOfVertices) {\n numberOfVertices = parseInt(input);\n return;\n }\n\n const verticesArray = input.split(\" \").map(Number)\n const x = verticesArray[0];\n const y = verticesArray[1];\n vertices.push({ x, y });\n\n if (vertices.length === numberOfVertices) {\n console.log(findRectangleArea(numberOfVertices, vertices));\n rl.close();\n }\n\n});\n\n// Problem\nfunction findRectangleArea(numberOfVertices, vertices) {\n\n const xPositions = new Set();\n const yPositions = new Set();\n\n for (let vertex of vertices) {\n xPositions.add(vertex.x);\n yPositions.add(vertex.y);\n }\n\n if (xPositions.size < 2 || yPositions.size < 2) {\n return -1;\n }\n\n const xPositionsArray = Array.from(xPositions)\n const yPositionsArray = Array.from(yPositions)\n\n return Math.abs((xPositionsArray[0] - xPositionsArray[1]) * (yPositionsArray[0] - yPositionsArray[1]));\n}", "src_uid": "ba49b6c001bb472635f14ec62233210e"} {"source_code": "'use strict';\r\n\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding('utf-8');\r\n\r\nlet inputString = '';\r\nlet currentLine = 0;\r\n\r\nprocess.stdin.on('data', stdin => inputString += stdin);\r\n\r\nprocess.stdin.on('end', _ => {\r\n inputString = inputString.trim().split('\\n').map(s => s.trim());\r\n main(); \r\n});\r\n\r\nfunction readline() {\r\n return inputString[currentLine++];\r\n}\r\n\r\nfunction output(x) {\r\n if (typeof x !== 'string') {\r\n x = x.toString();\r\n }\r\n //process.stdout.write(x); // without auto '\\n' (newline)\r\n console.log(x); // with auto '\\n' (newline)\r\n}\r\n\r\nfunction main() {\r\n /*let N = readline();\r\n\r\n for (let test = 0; test < N; test++) {*/\r\n let [r, c] = readline().split(' ');\r\n r = BigInt(r);\r\n c = BigInt(c);\r\n if (c == BigInt(1)) {\r\n output(r - BigInt(1));\r\n } else {\r\n output((c - BigInt(1)) * r);\r\n }\r\n /*}*/\r\n}", "src_uid": "a91aab4c0618d036c81022232814ef44"} {"source_code": "function main() {\n var input = readline().split(' ').map(Number);\n var n = input[0];\n var t = input[1];\n \n var count = 0;\n \n function isBigEnough(element, index, array) {\n return element >= 1;\n }\n \n var array = [t];\n count += array.filter(isBigEnough).length;\n for (var i = 2; i <= n; ++i) {\n var next_array = [];\n for (var j = 0; j < i; ++j) {\n var value = 0;\n if (j - 1 >= 0) {\n value += Math.max(0, array[j - 1] - 1);\n }\n if (j < array.length) {\n value += Math.max(0, array[j] - 1);\n }\n value /= 2;\n next_array.push(value);\n }\n array = next_array;\n count += array.filter(isBigEnough).length;\n }\n \n print(count);\n}\n\nmain();", "src_uid": "b2b49b7f6e3279d435766085958fb69d"} {"source_code": "var a = readline()\n\nvar dict = \"aouie\"\nvar b = true\n\nfor(var i = 0;i < a.length;i++){\n\tif(dict.indexOf(a[i]) == -1){\n\t\tif(dict.indexOf(a[i + 1]) != -1 || a[i] == \"n\"){\n\t\t\tcontinue;\n\t\t} else {\n\t\t\tb = false\n\t\t\tbreak\n\t\t}\n\t} \n}\n\nif(b && (dict.indexOf(a[a.length - 1]) != -1 || a[a.length - 1] == \"n\")){\n\tprint(\"YES\")\n} else {\n\tprint(\"NO\")\n}", "src_uid": "a83144ba7d4906b7692456f27b0ef7d4"} {"source_code": "let inputString = '';\nlet currentLine = 0;\nprocess.stdin.on('data', data => {\n\tinputString += data;\n});\nprocess.stdin.on('end', function () {\n\tinputString = inputString\n\t\t.trim()\n\t\t.split('\\n')\n\t\t.map(str => str.trim());\n\tmain();\n});\n\nfunction readLine() {\n\treturn inputString[currentLine++];\n}\n\nconst store = {};\n\nfunction main() {\n\tlet [n, m] = readLine()\n\t\t.split(' ')\n\t\t.map(x => x >> 0);\n\n\tif (m > n) {\n\t\tconsole.log(-1);\n\t\treturn;\n\t}\n\n\tlet steps = (n & 1) === 0 ? n >> 1 : (n >> 1) + 1;\n\n\tif (steps % m === 0) {\n\t\tconsole.log(steps);\n\t\treturn;\n\t}\n\n\tlet found = false;\n\twhile (steps <= n) {\n\t\tsteps++;\n\t\tif (steps % m === 0) {\n\t\t\tfound = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tfound ? console.log(steps) : console.log(-1);\n}\n", "src_uid": "0fa526ebc0b4fa3a5866c7c5b3a4656f"} {"source_code": "function getOutput(n, a, x, b, y) {\n const maxNumberOfSteps = n;\n for (var currentMinute = 0; currentMinute < maxNumberOfSteps; currentMinute++) {\n var danielCurrentStation = (a + currentMinute) % maxNumberOfSteps;\n if (danielCurrentStation === 0) {\n danielCurrentStation = n;\n }\n var vladCurrentStation = (b - currentMinute) % maxNumberOfSteps;\n if (vladCurrentStation < 0) {\n vladCurrentStation = n + vladCurrentStation;\n }\n if (vladCurrentStation === 0) {\n vladCurrentStation = n;\n }\n if (danielCurrentStation === vladCurrentStation) {\n return 'YES';\n }\n if (danielCurrentStation === x || vladCurrentStation === y) {\n break;\n }\n }\n return 'NO';\n}\n\nfunction main() {\n var line;\n while (line = readline()) {\n line = line.split(' ');\n var n = parseInt(line[0]);\n var a = parseInt(line[1]);\n var x = parseInt(line[2]);\n var b = parseInt(line[3]);\n var y = parseInt(line[4]);\n print(getOutput(n, a, x, b, y));\n }\n}\n\nmain();", "src_uid": "5b889751f82c9f32f223cdee0c0095e4"} {"source_code": "var num = readline();\n\n// var num = '1000000000'\n\n\nfunction multiplyNines(num) {\n var hi = 1;\n for (var i = 0; i < num.length-1; i++) {\n hi *= 9;\n }\n\n return hi + ''\n}\n\nfunction allNines(num) {\n var arr=[]\n for (var i = 0; i < num.length-1; i++) {\n arr.push(9);\n }\n\n return parseInt(arr.join(''))\n}\n\nfunction main(num) {\n //add less than 2 case\n if (num.length === 1) {\n return parseInt(num);\n } else if (num[0] === '1') {\n return multiplyNines(num)\n } else {\n return Math.max(parseInt(num[0])*main(num.split('').slice(1).join('')), (parseInt(num[0]) - 1)*parseInt(multiplyNines(num)));\n }\n}\n\nwrite(main(num))", "src_uid": "38690bd32e7d0b314f701f138ce19dfb"} {"source_code": "var n = parseInt(readline());\nvar arr = readline().split(' ').map(Number);\n\nvar max = arrayMax(arr);\nvar min = arrayMin(arr);\n\nvar startIndex = 0;\nvar endIndex = 0;\n\n\tvar startCounting = false;\n\n\tfor (var i = 0; i < n; i++) {\n\t\tif ((arr[i] == max || arr[i] == min) && !startCounting)\n\t\t{\n\t\t\tstartCounting = true;\n\t\t\tstartIndex = i;\n\t\t\ti++;\n\t\t}\n\t\tif ((arr[i] == max || arr[i] == min) && startCounting)\n\t\t{\n\n\t\t\tstartCounting = false;\n\t\t\tendIndex = i;\n\t\t\tbreak;\n\t\t}\n\t}\n\nvar maxarr = [];\nmaxarr.push(endIndex - startIndex);\nmaxarr.push(endIndex);\nmaxarr.push(startIndex);\nmaxarr.push(arr.length - 1 - startIndex);\nmaxarr.push(arr.length - 1 - endIndex);\n\nfunction arrayMin(array) {\n var len = array.length, min = Infinity;\n while (len--) {\n if (array[len] < min) {\n min = array[len];\n }\n }\n return min;\n};\n\nfunction arrayMax(array) {\n var len = array.length, max = -Infinity;\n while (len--) {\n if (array[len] > max) {\n max = array[len];\n }\n }\n return max;\n};\n\nprint(arrayMax(maxarr));", "src_uid": "1d2b81ce842f8c97656d96bddff4e8b4"} {"source_code": "var a = readline().split(\" \").map(Number);\nvar flag=true;\nvar moves = 1;\nvar path =\"\"+a[1];\nwhile(a[1] > a[0]) {\n moves++;\n if (a[1]% 2 === 0) {\n a[1]=a[1]/2;\n } else if(a[1]%10 === 1) {\n a[1]= (a[1]-1)/10;\n } else { \n print(\"NO\");\n flag=false;\n break;\n }\n if (a[1] < a[0]) {\n print(\"NO\");\n flag=false;\n break;\n }\n path = a[1]+\" \"+path;\n}\nif (flag) {\n print('YES');\n print(moves);\n print(path);\n}\n\n", "src_uid": "fc3adb1a9a7f1122b567b4d8afd7b3f3"} {"source_code": "let inputString = \"\";\nlet currentLine = 0;\nprocess.stdin.on(\"data\", (data) => {\n inputString += data;\n});\nprocess.stdin.on(\"end\", function () {\n inputString = inputString\n .trim()\n .split(\"\\n\")\n .map((str) => str.trim());\n main();\n});\nfunction readLine() {\n return inputString[currentLine++];\n}\nfunction main() {\n let [n, len] = readLine()\n .split(\" \")\n .map((n) => parseInt(n));\n const arr = readLine()\n .split(\" \")\n .map((n) => parseInt(n));\n arr.sort((a, b) => a - b);\n let min = Number.MAX_SAFE_INTEGER;\n\n for (let i = 0; i <= len - n; i++) {\n const [low, high] = [arr[i], arr[i + n - 1]];\n min = Math.min(min, high - low);\n }\n\n console.log(min);\n}\n", "src_uid": "7830aabb0663e645d54004063746e47f"} {"source_code": "var n = +readline();\n\nvar pos = {1: 'A', 3: 'B', 2: 'C', 0: 'D'};\nvar hm = {1: 0, 3: 2, 2: 1, 0: 1};\nvar mod = n % 4;\n\nwrite(hm[mod], mod === 2 ? 'B' : 'A');", "src_uid": "488e809bd0c55531b0b47f577996627e"} {"source_code": "// Sample code to perform I/O:\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding(\"utf-8\");\nvar stdin_input = \"\";\n\nprocess.stdin.on(\"data\", function (input) {\n stdin_input += input; // Reading input from STDIN\n});\n\nprocess.stdin.on(\"end\", function () {\n main(stdin_input);\n});\n\nfunction main(input) {\n let output = nameLookUp(input);\n process.stdout.write(output); // Writing output to STDOUT\n}\n\n// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail\n\n// Write your code here\nfunction nameLookUp(str) {\n let input = str.trim().split('\\n');\n let numeric = input[0].split(' ');\n let seconds = +numeric[1];\n let bg = input[1].split('');\n let newbg = [...bg];\n for (let i = 0; i < seconds; i++) {\n\n for (let i = 1; i < bg.length; i++) {\n if (bg[i - 1] < bg[i]) {\n let temp = bg[i - 1];\n newbg[i - 1] = bg[i];\n newbg[i] = temp;\n }\n }\n bg = newbg;\n newbg = [...bg];\n }\n return bg.join('').toString();\n}\n", "src_uid": "964ed316c6e6715120039b0219cc653a"} {"source_code": "var nk = readline().split(' ').map(el => parseInt(el, 10)),\n num = nk[0];\n \nfor(var i=1; i<=nk[1]; i++) {\n if(num%10 === 0) num /= 10;\n else num--;\n}\n \nprint(num);", "src_uid": "064162604284ce252b88050b4174ba55"} {"source_code": "var arr = readline().split(\" \", 2);\nif (arr[0] === arr[1]) {\n print(arr[0]);\n} else {\n print(\"1\");\n}", "src_uid": "9c5b6d8a20414d160069010b2965b896"} {"source_code": "var s = []\nfor(var i=0;i<8;i++) s.push(readline());\nvar get = function(s, x, y) {\n if(s[x][y] == 'W') {\n for(var i=x-1;i>=0;i--) if(s[i][y] == 'B') return -1;\n return x;\n } else if(s[x][y] == 'B') {\n for(var i=x+1;i<8;i++) if(s[i][y] == 'W') return -1;\n return 7 - x;\n } else {\n return -1;\n }\n};\nvar getw = function(s) {\n for(var i=0;i<8;i++) {\n for(var j=0;j<8;j++) {\n if(s[i][j] == 'W' && get(s, i, j) != -1) return i;\n }\n }\n return -1;\n}\nvar getb = function(s) {\n for(var i=7;i>=0;i--) {\n for(var j=0;j<8;j++) {\n if(s[i][j] == 'B' && get(s, i, j) != -1) return 7-i;\n }\n }\n return -1;\n}\nvar answ = getw(s);\nvar ansb = getb(s);\nif(ansb == -1 || answ <= ansb) print(\"A\");\nelse print(\"B\");\n// print(answ, \",\" , ansb);\n\n\n", "src_uid": "0ddc839e17dee20e1a954c1289de7fbd"} {"source_code": "var names = new Array(\"Sheldon\", \"Leonard\", \"Penny\", \"Rajesh\", \"Howard\");\nvar n = parseInt(readline());\n\nn += 4;\n\nvar pow = Math.floor(Math.log(Math.floor(n * 2 / 5))/Math.log(2));\nvar pos = Math.floor((n - Math.pow(2, pow) * 5 / 2) / Math.pow(2, pow - 1));\n\nprint(names[pos]);\n", "src_uid": "023b169765e81d896cdc1184e5a82b22"} {"source_code": "try {require('codef');} catch (e){};\nfunction readLineAsArray(separator){\n return readline().split(typeof separator == \"undefined\" ? ' ' : separator)\n}\nfunction readLineAsIntegerArray(separator){\n return readLineAsArray(separator).map(function(v){return +v});\n}\n\nvar arr = readLineAsIntegerArray('');\nvar length = arr.length;\nvar res = [];\n\nwhile(1){\n var tepm = 0;\n arr.forEach(function(v, k){\n if (v > 0) {\n tepm += Math.pow(10, length - k - 1);\n arr[k]--;\n }\n });\n if (tepm == 0) break; else res.push(tepm);\n}\nwrite(res.length + \"\\n\" + res.join(' '));\n", "src_uid": "033068c5e16d25f09039e29c88474275"} {"source_code": "var n = +readline(),\ninput = readline().split(\" \"), min1 = +input[0], max1 = +input[1],\ninput = readline().split(\" \"), min2 = +input[0], max2 = +input[1],\ninput = readline().split(\" \"), min3 = +input[0], max3 = +input[1];\nvar i, j, k;\n\ncycle:\nfor(i = max1; i >= min1; i--){\n\n\tif((n - i) < (min2 + min3)){\n\t\tcontinue;\n\t}\n\t\n\tj = (n-i > max2) ? max2 : n-i;\n\tfor( ; j >= min2; j--){\n\t\tif((n - i - j) < min3){\n\t\t\tcontinue;\n\t\t}\n\n\t\tk = n - i - j;\n\n\t\twrite(i + \" \" + j + \" \" + k);\n\n\t\tbreak cycle;\n\t}\n}", "src_uid": "3cd092b6507079518cf206deab21cf97"} {"source_code": "var num = readline().split(' ');\nvar l = parseInt(num[0]);\nvar r = parseInt(num[1]);\nif(r > l){\n\tprint(2);\n}else if(r == l){\n\tprint(l);\n}", "src_uid": "a8d992ab26a528f0be327c93fb499c15"} {"source_code": "print(function(a) {\n\tvar sum = a.reduce(function(a, b) {return a + b;});\n\tif (sum % 2 === 1) return 'Impossible';\n\tsum = sum / 2;\n\n\tvar ans = [0, 0, 0];\n\tfor (var i = 0; i < 3; i++) {\n\t\tans[i] = sum - a[(i + 2) % 3];\n\t\tif (ans[i] > a[i]) return 'Impossible';\n\t}\n\treturn ans.join(' ');\n\n}(readline().split(' ').map(Number)));", "src_uid": "b3b986fddc3770fed64b878fa42ab1bc"} {"source_code": "//Input\n// var firstLine = \"Is it a melon?\"; //R: NO\n// var firstLine = \"Is it an apple?\"; //R: YES\n// var firstLine = \" Is it a banana ?\"; //R: YES\n// var firstLine = \"Is it an apple and a banana simultaneouSLY?\"; //R: YES\n\n\nvar firstLine = readline();\n\nretorno = eval(firstLine);\n\n//Solution\nfunction eval(firstLine){\n var str = firstLine;\n\n write(sleuth(str));\n // console.log(sleuth(str));\n return \"Hola\";\n};\n\nfunction sleuth(str){\n str = str.toLowerCase();\n //console.log(str);\n var vowels = \"aeiouy\";\n var char = \"\";\n var len = str.length;\n var answer = \"NO\";\n for(var i = len ; i >= 0 ; i--){\n if(str[i] >= \"a\" && str[i] <= \"z\"){\n char = str[i];\n break;\n };\n };\n if(char == \"a\" || char == \"e\" || char == \"i\" || char == \"o\" || char == \"u\" || char == \"y\"){\n answer = \"YES\"\n };\n return answer;\n};\n\n\n\n", "src_uid": "dea7eb04e086a4c1b3924eff255b9648"} {"source_code": "var tokens = [];\nvar numTokens = 0;\nfunction next(){\n\twhile(numTokens>=tokens.length){\n\t\ttokens = readline().split(/[\\s]+/);\n\t\tnumTokens = 0;\n\t}\n\treturn tokens[numTokens++];\n}\nfunction invertir(n){\n\treturn n.split(\"\").reverse().join(\"\"); \n}\nfunction impri(n){\n\tif(n<10) return \"0\"+n;\n\treturn \"\"+n;\n}\n\nfunction cumple(h,m){\n\tif(h<24 && m < 60)\n\t\treturn invertir(impri(h)) == impri(m);\n\treturn false;\n}\nfunction solve(h){\n\twhile(h < 24*60 ){\n\t\tc = Math.floor(h/60);\n\t\tif(cumple(c,h-c*60))\n\t\t\treturn h;\n\t\th++;\n\t}\n\treturn 0;\n}\nfunction main(){\n\tvar a = next();\n\tvar h = parseInt(a.substring(0,2),10)*60\t+ parseInt(a.substring(3,5),10);\n\th = solve(h+1);\n\tvar c = Math.floor(h/60);\n\tvar x = c;\n\tvar y = h - c*60;\n\tprint(impri(x)+\":\"+impri(y));\n}\nmain();\n", "src_uid": "158eae916daa3e0162d4eac0426fa87f"} {"source_code": "var n = parseInt(readline());\nvar m = parseInt(readline());\nvar result = m % Math.pow(2, n);\nprint(result);", "src_uid": "c649052b549126e600691931b512022f"} {"source_code": "print(function(a, b) {\n\tvar i, x, ans = [0, 0, 0];\n\tfor (i = 1; i <= 6; i++) {\n\t\tx = Math.abs(i - a) - Math.abs(i - b);\n\t\tans[x < 0 ? 0 : x === 0 ? 1 : 2]++;\n\t}\n\treturn ans.join(' ');\n}.apply(0, readline().split(' ').map(Number)));\n", "src_uid": "504b8aae3a3abedf873a3b8b127c5dd8"} {"source_code": "var alphabet = ['a', 'b', 'c', 'd', 'e', 'f']\n\nvar input = readline().split(' ')\n\nvar n = input[0]\n\nvar strings = generateStrings(n)\n\nvar q = input[1]\n\nvar ops = {}\n\nfor (var i = 0; i < q; i++) {\n\n input = readline().split(' ')\n ops[input[0]] = input[1]\n\n}\n\nprint(\n strings\n .filter(function (string) {\n for (var i = 0; string.length > 1; i++) {\n var op = string.slice(0, 2)\n if (!ops[op]) { return false }\n string = ops[op] + string.slice(2)\n }\n return string === 'a'\n })\n .length\n)\n\n\nfunction generateStrings (NN) {\n\n var strings = []\n\n var K = NN - 1, k = 0,\n N = alphabet.length, n = 0,\n out = [],\n stack = []\n\n function next(){\n while (true) {\n while (n < alphabet.length) {\n out[k] = alphabet[n++];\n if (k == K) return out.slice(0);\n else {\n if (n < alphabet.length) {\n stack.push(k);\n stack.push(n);\n }\n k++;\n n = 0;\n }\n }\n if (stack.length == 0) break;\n\n n = stack.pop();\n k = stack.pop();\n }\n return false;\n }\n\n var str\n\n while (str = next()) {\n strings.push(str.join(''))\n }\n\n return strings\n\n}\n", "src_uid": "c42abec29bfd17de3f43385fa6bea534"} {"source_code": "\nvar line = readline().split(' ');\nvar d = parseInt( line[0] );\nvar sumTime = parseInt( line[1] );\n\nvar minTime = [];\nvar maxTime = [];\nvar minSum = 0;\nvar maxSum = 0;\n\n\nfor(var i=0; i= minSum && sumTime<= maxSum){\n\tprint('YES');\n\tvar time=maxSum;\n\tvar ret = [];\n\tfor(var i=0; i Math.floor(obj[1]/2) ? 1 : 0;\nmax = Math.floor(obj[max]/(max*2||1)) > Math.floor(obj[2]/4) ? 2 : max;\nobj[max] = obj[max] - obj[max]%(max*2||1);\nvar sum = 0;\nvar one = obj[max]/(max*2||1);\n\nfor (var i = 0; i < 3; i++) {\n sum += one*(i*2||1);\n}\n\nprint(sum);\n", "src_uid": "82a4a60eac90765fb62f2a77d2305c01"} {"source_code": "'use strict'\n\nconst {EOL} = require('os')\n\nlet ipt = ''\nprocess.stdin.on('data', s => ipt += s)\nprocess.stdin.on('end', () => {\n const n = +ipt.split(EOL).slice(0, -1)[0]\n let o = 'ROY'\n let r = (n - 3) / 4 | 0\n for (let i = 0; i < r; i++) o += 'GBIV'\n o += 'GBIV'.slice(0, (n - 3) % 4)\n console.log(o)\n})", "src_uid": "dc3817c71b1fa5606f316e5e94732296"} {"source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i], 10);\n\t};\n\treturn tokens;\n}\n\nfunction gcd(a, b) {\n\twhile (a != 0 && b != 0) {\n\t\tif (a > b) {\n\t\t\ta %= b;\n\t\t}\n\t\telse {\n\t\t\tb %= a;\n\t\t}\n\t}\n\treturn Math.max(a, b);\n}\n\nfunction solve(screenWidth, screenHeight, movieWidth, movieHeight) {\n\tvar bottom = movieWidth*screenHeight,\n\t\ttop = bottom - movieHeight*screenWidth,\n\t\tfactor = gcd(top, bottom);\n\treturn { top: top/factor, bottom: bottom/factor };\n}\n\nfunction main() {\n\tvar data = tokenizeIntegers(readline()),\n\t\tscreenWidth = data[0], screenHeight = data[1],\n\t\tmovieWidth = data[2], movieHeight = data[3];\n\n\tif (screenWidth*movieHeight < movieWidth*screenHeight) {\n\t\tvar solution = solve(screenWidth, screenHeight, movieWidth, movieHeight);\n\t}\n\telse {\n\t\tvar solution = solve(screenHeight, screenWidth, movieHeight, movieWidth);\n\t}\n\n\tprint(solution.top + \"/\" + solution.bottom);\n}\n\nmain();\n", "src_uid": "b0f435fc2f7334aee0d07524bc37cb1e"} {"source_code": "function main(){\n var n = +readline();\n for(var i = 0; i < n; ++i){\n var c = readline().split('');\n var l = 1;\n if(c.length === 2) l = 3;\n if(c.length === 3) l = 6;\n if(c.length === 4) l = 10;\n print(l + ((+c[0] - 1) * 10));\n }\n}\n\nmain();", "src_uid": "289a55128be89bb86a002d218d31b57f"} {"source_code": "var line = readline().split(' ');\nvar n = parseInt(line[0]);\nvar v = parseInt(line[1]);\nvar arr = readline().split(' ');\nvar a = [];\nvar cur = [];\nvar sum = 0;\nfor (var i = 0; i < arr.length; i ++)\n{\n a[i] = parseInt(arr[i]);\n cur[i] = a[i]%2===0?a[i]/2:parseInt(a[i]/2)+1;\n sum += cur[i];\n}\nif (sum > v)\n{\n print(-1);\n}\nelse\n{\n while(v-sum > 0)\n {\n var max = 0;\n var maxi = 0;\n for (var i = 0; i < a.length; i ++)\n {\n if (a[i] > max && cur[i]!=a[i])\n {\n max = a[i];\n maxi = i;\n }\n }\n var put = Math.min(Math.min(v-sum), (a[maxi]-cur[maxi]));\n cur[maxi]+=put;\n sum+=put;\n }\n \n print( cur.join(\" \") );\n}\n", "src_uid": "5d3bb9e03f4c5c8ecb6233bd5f90f3a3"} {"source_code": "let i = ''\n\nprocess.stdin.on('data',c => {\n i += c\n})\n\nprocess.stdin.on('end', () => {\n const { EOL } = require('os')\n const lines = i.split(EOL) /*your input text, split by lines*/\n\n\n let citiesCount = parseInt(lines[0].split(\" \")[0])\n let limakCity = parseInt(lines[0].split(\" \")[1])\n\n let criminals = lines[1].split(\" \").map( value => {\n return parseInt(value)\n })\n\n let distanceCount = 0\n let caughtCriminalsCount = 0\n let passedCities = {}\n\n let limakCityIndex = limakCity - 1\n\n for(i = 0; i < citiesCount ; i++){\n\n distanceCount = Math.abs(i - limakCityIndex)\n\n let leftCityIndex = limakCityIndex - distanceCount\n let rightCityIndex = distanceCount + limakCityIndex\n\n if (passedCities[rightCityIndex] === true || passedCities[leftCityIndex] === true) {\n continue\n }\n\n if (distanceCount === 0) {\n caughtCriminalsCount = caughtCriminalsCount + criminals[i]\n passedCities[i] = true\n distanceCount++\n continue\n }\n\n let rightCriminalCount = 0\n let leftCriminalCount = 0\n\n if (leftCityIndex >= 0) {\n passedCities[leftCityIndex] = true\n leftCriminalCount = criminals[leftCityIndex]\n } else {\n leftCriminalCount = -1\n }\n\n if (rightCityIndex < citiesCount) {\n passedCities[rightCityIndex] = true\n rightCriminalCount = criminals[rightCityIndex]\n } else {\n rightCriminalCount = -1\n }\n\n if (rightCriminalCount + leftCriminalCount === 2) {\n caughtCriminalsCount = caughtCriminalsCount + 2\n } else if (rightCriminalCount === 1 && leftCriminalCount === -1) {\n caughtCriminalsCount = caughtCriminalsCount + 1\n } else if (leftCriminalCount === 1 && rightCriminalCount === -1){\n caughtCriminalsCount = caughtCriminalsCount + 1\n }\n\n distanceCount++\n }\n console.log(caughtCriminalsCount)\n})", "src_uid": "4840d571d4ce6e1096bb678b6c100ae5"} {"source_code": "'use strict';\r\n\r\nprocess.stdin.resume();\r\nprocess.stdin.setEncoding('utf-8');\r\n\r\nlet inputString = '';\r\nlet currentLine = 0;\r\n\r\nprocess.stdin.on('data', inputStdin => {\r\n inputString += inputStdin;\r\n});\r\n\r\nprocess.stdin.on('end', _ => {\r\n inputString = inputString.trim().split('\\n').map(string => {\r\n return string.trim();\r\n });\r\n \r\n main(); \r\n});\r\n\r\nfunction readline() {\r\n return inputString[currentLine++];\r\n}\r\n\r\nfunction output(x) {\r\n if (typeof x !== 'string') {\r\n x = x.toString();\r\n }\r\n //process.stdout.write(x); // without auto '\\n' (newline)\r\n console.log(x); // with auto '\\n' (newline)\r\n}\r\n\r\nfunction main() {\r\n let N = readline();\r\n\r\n for (let test = 0; test < N; test++) {\r\n let x = Number(readline());\r\n let arr = readline().split(' ').map(Number);\r\n\r\n let result = 'YES';\r\n\r\n let first = arr[x - 1];\r\n let second = first ? arr[first - 1] : 0;\r\n\r\n if (first === 0) {\r\n result = 'NO';\r\n } else if (second === 0) {\r\n result = 'NO';\r\n }\r\n\r\n output(result);\r\n }\r\n}\r\n", "src_uid": "5cd113a30bbbb93d8620a483d4da0349"} {"source_code": "var importanceInPetriciumusCifera = function ( base, number ) {\n var rest,\n importance;\n rest = number;\n importance = 0;\n while ( rest % base === 0 && rest > base) {\n\n rest /= base;\n ++importance;\n }\n if ( rest === base ) {\n return importance;\n }\n};\n\nvar k = parseInt( readline(), 10 );\nvar l = parseInt( readline(), 10 );\nvar importance = importanceInPetriciumusCifera( k, l );\nif ( typeof importance !== \"undefined\" ) {\n print( \"YES\" );\n print( importance );\n} else {\n print( \"NO\" );\n}\n", "src_uid": "8ce89b754aa4080e7c3b2c3b10f4be46"} {"source_code": "var whoWinsFromTwo = function(n, p, winner)\n {\n if ((n === 1) || (p === 1)) return winner;\n else {\n winner = -winner;\n return whoWinsFromTwo(n - 1, p - 1, winner);\n }\n }\nvar input1 = readline();\ninput1 = input1.split(' ');\nvar person = 1;\nvar result = whoWinsFromTwo(+input1[0], +input1[1], person);\nif (result < 0) print('Malvika');\nelse print('Akshat');", "src_uid": "a4b9ce9c9f170a729a97af13e81b5fe4"} {"source_code": "var n = parseInt(readline());\nvar ar = readline().split(' ').map((v)=>{return parseInt(v);}).sort((a,b)=>(b-a));\n\nvar marked = {0: true}\nvar markeda = {0: true}\n\nvar a = ar[0]\n\nar.forEach((o, i)=>{\n if (!markeda[o] && a%o==0) {\n markeda[o] = true;\n marked[i] = true;\n }\n})\n\nvar b = ar.filter((x, i)=>(!marked[i]))[0]\nprint(a, b)\n", "src_uid": "868407df0a93085057d06367aecaf9be"} {"source_code": "print(readline().toLowerCase().replace(/[aeiouy]/g,'').split('').map(i => `.${i}`).join(''))", "src_uid": "db9520e85b3e9186dd3a09ff8d1e8c1b"} {"source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\n\nrl.on('line', (d) => {\n const arr = d.split(' ').map(Number);\n let ans = 0;\n const max = Math.max(...arr);\n\n for (let i = 0; i < arr.length - 1; i++) {\n for (let j = i + 1; j < arr.length; j++) {\n if (arr[i] + arr[j] <= max) {\n ans = max - (arr[i] + arr[j]) + 1;\n }\n }\n }\n\n console.log(ans);\n});\n", "src_uid": "3dc56bc08606a39dd9ca40a43c452f09"} {"source_code": "let input = [];\n \nconst RL = require('readline').createInterface({\n input : process.stdin,\n output : process.stdout\n});\n\nRL.on('line', (line) => {\n let count_a = 0; [...line].forEach( i => {if(i === 'a') count_a++} );\n if(count_a > line.length - count_a)\n console.log(line.length);\n else\n console.log( line.length - ( line.length-count_a - count_a ) -1)\n});\n\nRL.on('close', () => {\n});\n\n", "src_uid": "84cb9ad2ae3ba7e912920d7feb4f6219"} {"source_code": "process.stdin.resume()\nprocess.stdin.setEncoding('utf-8')\n\nvar arr = ''\nprocess.stdin.on('data', (i) => {\n arr += i\n})\n\n\nprocess.stdin.on('end', () => {\n arr = arr.split('\\n')\n const ax = arr.shift().split(' ')\n const v = parseInt(ax[0])\n const e = parseInt(ax[1])\n\n if(e == 0) {\n console.log(0)\n return\n }\n if(v <= 6) {\n console.log(e)\n }\n\n else {\n let m = new Map()\n \n for(let i = 1; i <= v; i ++) {\n m.set(i, [])\n }\n \n for(let i = 0; i < e; i ++) {\n const edge = arr.shift().split(' ')\n const a = parseInt(edge[0])\n const b = parseInt(edge[1])\n m.get(a).push(b)\n m.get(b).push(a)\n }\n\n var f = false\n var noOfVertices = 20\n for(let j = 1; j <= 7; j ++) {\n var a7 = m.get(j)\n for(let i = 1; i <= 7; i ++) {\n if(i == j) continue\n var other = m.get(i)\n var x = a7.filter(el => other.indexOf(el) != -1)\n if(x.length == 0) {\n f = true\n break\n }\n else if(x.length < noOfVertices) {\n noOfVertices = x.length\n }\n }\n }\n if(f) {\n console.log(e)\n }\n\n else {\n console.log(e - noOfVertices)\n }\n }\n}) ", "src_uid": "11e6559cfb71b8f6ca88242094b17a2b"} {"source_code": "ar = [];\nn = +readline();\nreadline().split('').map(Number).forEach(x=>{\n if (x !== 0) ar.push(x);\n});\nfound = (ar.length === 0)?true:false;\nsum = 0;\nfor (i = 0;i sum) break;\n }\n found = cur === 0;\n}\nprint(found?'YES':'NO');", "src_uid": "410296a01b97a0a39b6683569c84d56c"} {"source_code": "'use strict';\n \n//const fs = require('fs');\n \nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n \nlet inputString = '';\nlet currentLine = 0;\n \nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n \nprocess.stdin.on('end', _ => {\n inputString = inputString.replace(/\\s*$/, '')\n .split('\\n')\n .map(str => str.replace(/\\s*$/, ''));\n \n main();\n});\n \nfunction readLine() {\n return inputString[currentLine++];\n}\nfunction main() {\n var n = parseInt(readLine(), 10);\n var coins = [];\n coins.push(n);\n for (var i = n - 1; i > 0; i--) {\n if ((n % i) == 0) {\n coins.push(i);\n n = i;\n }\n }\n console.log(coins.join(\" \"));\n \n}", "src_uid": "2fc946bb72f56b6d86eabfaf60f9fa63"} {"source_code": "function main() {\n let line = stdin[0].split(' ');\n let n = parseInt(line[0], 10);\n let p = parseInt(line[1], 10);\n let k = parseInt(line[2], 10);\n\n const lo = Math.max(p - k, 1);\n const hi = Math.min(p + k, n);\n \n let str = [];\n \n if (lo !== 1) str.push(\"<<\")\n \n for (let i = lo; i <= hi; ++i) {\n if (i === p) {\n str.push(`(${i})`);\n } else {\n str.push(i + '')\n }\n }\n \n if (hi !== n) str.push(\">>\")\n \n console.log(str.join(' '));\n}\n\nconst readline = require('readline');\nconst rl = readline.createInterface({input: process.stdin});\nvar stdin = [];\nrl.on('line', function (line) {stdin.push(line);});\nrl.on('close', main);\n", "src_uid": "526e2cce272e42a3220e33149b1c9c84"} {"source_code": "var n=+readline();\nvar s=readline();\nvar ans=0;\ns.replace(/B/g, function(_, i){\n\tans+=Math.pow(2, i);\n});\nprint(ans);\n", "src_uid": "d86a1b5bf9fe9a985f7b030fedd29d58"} {"source_code": "const readline = require('readline');\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\nlet n = 0 ;\nlet columns ;\n\nrl.on(\"line\", (input)=>{\n if(!n) n = parseInt(input.split(\" \"))\n else\n {\n columns = input.split(\" \");\n columns.sort((a,b)=>{return a-b});\n columns.forEach(element => {\n console.log(element);\n });\n rl.close();\n }\n\n})", "src_uid": "ae20712265d4adf293e75d016b4b82d8"} {"source_code": "const memo = {};\n\nfunction resolve(k, arr, n) {\n if (memo[arr.join('')] !== undefined) {\n return memo[arr.join('')];\n }\n if (parseInt(arr[0], 10) % 2 === 0 || parseInt(arr[k - 1], 10) % 2 === 0) {\n memo[arr.join('')] = false;\n return false;\n } else {\n if (k % 2 !== 0 && n % 2 !== 0) {\n memo[arr.join('')] = true;\n return true;\n } else {\n for (var i = 0; i < k; i += 2) {\n if (parseInt(arr[i], 10) % 2 !== 0) {\n if (resolve(arr.slice(i + 1).length, arr.slice(i + 1), n + 1)) {\n memo[arr.join('')] = true;\n return true;\n }\n }\n }\n\n for (var i = k - 1; i >= 0; i -= 2) {\n if (parseInt(arr[i], 10) % 2 !== 0) {\n if (resolve(arr.slice(0, i).length, arr.slice(0, i), n + 1)) {\n memo[arr.join('')] = true;\n return true;\n }\n }\n }\n memo[arr.join('')] = false;\n return false;\n }\n }\n}\n\nconst k = parseInt(readline(), 10);\nconst arr = readline().split(' ');\n\nconst result = resolve(k, arr, 1);\n\nprint(result ? 'Yes' : 'No' + '\\n');", "src_uid": "2b8c2deb5d7e49e8e3ededabfd4427db"} {"source_code": "var firstDay = getDayNumber(readline());\nvar secondDay = getDayNumber(readline());\n\nprint(firstDay === secondDay || (firstDay + 2) % 7 === secondDay % 7 || (firstDay + 3) % 7 === secondDay % 7 ? \"YES\" : \"NO\");\n\nfunction getDayNumber(dayName) {\n switch (dayName.trim()) {\n case \"monday\":\n return 1;\n case \"tuesday\":\n return 2;\n case \"wednesday\":\n return 3;\n case \"thursday\":\n return 4;\n case \"friday\":\n return 5;\n case \"saturday\":\n return 6;\n case \"sunday\":\n return 7;\n }\n}", "src_uid": "2a75f68a7374b90b80bb362c6ead9a35"} {"source_code": "'use strict'\n\nlet lll = readline().split(' ').map(v => parseInt(v))\nlet a = lll[0]\nlet b = lll[1]\n\nlet min = String(a).split('').reduce((r, v) => Math.max(r, v), 0)\nmin = String(b).split('').reduce((r, v) => Math.max(r, v), min)\nmin++\n\nlet max = 0\nfor (let i = min; i < 14; i++) {\n let da = parseInt(a, i)\n let db = parseInt(b, i)\n let ds = da + db\n let bs = from10(ds, i)\n max = Math.max(max, String(bs).length)\n}\n\nprint(max)\n\nfunction from10 (x, b) {\n let res = ''\n let n = 0\n while (Math.pow(b, ++n) <= x) {}\n while (n--) {\n let a = x / Math.pow(b, n) | 0\n if (b > 9) {\n res += 'a'\n } else {\n res += a\n }\n x -= a * Math.pow(b, n)\n }\n return res\n}", "src_uid": "8ccfb9b1fef6a992177cc49bd56fab7b"} {"source_code": "function trim(s) {\n\treturn s.replace(/^\\s+|\\s+$/gm, '');\n}\n\nfunction tokenize(s) {\n\treturn trim(s).split(/\\s+/);\n}\n\nfunction tokenizeIntegers(s) {\n\tvar tokens = tokenize(s);\n\tfor (var i = 0; i < tokens.length; i += 1) {\n\t\ttokens[i] = parseInt(tokens[i]);\n\t};\n\treturn tokens;\n}\n\nfunction main() {\n\tvar integers = tokenizeIntegers(readline());\n\tvar fromR = integers[0], fromC = integers[1];\n\tvar toR = integers[2], toC = integers[3];\n\t\n\tvar rook = (fromR == toR || fromC == toC ? 1 : 2);\n\n\tif ((fromR+fromC)%2 != (toR+toC)%2) {\n\t\tvar bishop = 0;\n\t}\n\telse {\n\t\tvar bishop = (Math.abs(fromR - toR) == Math.abs(fromC - toC) ? 1 : 2);\n\t}\n\n\tvar dr = Math.abs(fromR - toR), dc = Math.abs(fromC - toC);\n\tvar king = dr + dc - Math.min(dr, dc);\n\n\tprint(rook, bishop, king);\n}\n\nmain();\n", "src_uid": "7dbf58806db185f0fe70c00b60973f4b"} {"source_code": "var triangles=[0]\nwhile(triangles[triangles.length-1]<=100000)\n{\n triangles.push(triangles[triangles.length-1]+triangles.length);\n}\n\nvar n=+readline()\nvar nows='qwertyuiopasdfghjklzxcvbnm'\nvar now=0\nres=''\nif (7==n)\n{\n print(\"skorobogatova\")\n}\nelse if (0==n)\n{\n print(\"danil\")\n}\nelse\n{\n var i=triangles.length-1;\n while(n)\n {\n while(triangles[i]>n){i--;}\n n-=triangles[i]\n for (var j=0;j<=i;j++)\n {\n res+=nows[now];\n }\n now++;\n }\n}\nprint(res)", "src_uid": "b991c064562704b6106a6ff2a297e64a"} {"source_code": "/*\n Pick your own problems you fuck faced cunt.\n*/\nvar radix=parseInt(readline());\nfor(var i = 1;i < radix; ++i){\n for(var j = 1;j < radix; ++j){\n write((i*j).toString(radix)+\" \");\n }\n print();\n}", "src_uid": "a705144ace798d6b41068aa284d99050"} {"source_code": "var n = Number(readline());\nvar k = 1, sum = 0;\nwhile (sum < n - k) {\n sum += k++;\n}\nprint(n - sum);", "src_uid": "1db5631847085815461c617854b08ee5"} {"source_code": "var line = readline().split(' ');\nvar n = parseInt(line[0]);\nvar k = parseInt(line[1]);\nvar arr = readline().split(' ');\nvar list = [];\n\nif (n === arr.length) {\n\nfor (var i = 0; i < arr.length; i++) {\n \n if (k % arr[i] === 0) {\n list.push(arr[i]);\n }\n \n}\n\nprint(k / Math.max.apply(Math, list));\n\n}", "src_uid": "80520be9916045aca3a7de7bc925af1f"} {"source_code": "var n =readline()\n\nvar nLeft,nRight,qLeft,qRight\n\nvar aPos=n.indexOf('A')\nvar sum=0\n\n\n\nwhile(aPos!=-1){\n nLeft=n.substring(0,aPos)\n nRight=n.substring(aPos+1,n.length)\n \n qLeft=(nLeft.match(/Q/g) || []).length\n qRight=(nRight.match(/Q/g) || []).length\n sum+= qLeft*qRight\n n=nLeft+nRight\n aPos=n.indexOf('A')\n}\nprint(sum)\n", "src_uid": "8aef4947322438664bd8610632fe0947"} {"source_code": "const readline = require('readline');\n\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\nrl.on('line', (inputString) => {\n let numberOfSquares = parseInt(inputString);\n console.log(findTheNumberOfLinesForLady(numberOfSquares));\n process.exit();\n});\n\nfunction findTheNumberOfLinesForLady(forTheNumberOfSquaress) {\n let a = Math.sqrt(forTheNumberOfSquaress);\n let b = Math.trunc(a);\n if (a == b) return (a + a);\n if (b * (b + 1) >= forTheNumberOfSquaress) return b + b + 1;\n return b + b + 2;\n}", "src_uid": "eb8212aec951f8f69b084446da73eaf7"} {"source_code": "function getInput() {\n var line = readline();\n var lines = [line];\n while (line = readline()) {\n lines.push(line);\n }\n return lines;\n}\n\nfunction main() {\n var lines = getInput().map(item => item.split(' '));\n var durationA = Number(lines[0][1]);\n var durationB = Number(lines[1][1]);\n var repeatB = Number(lines[1][0]);\n\n // first bus run at 5:00.\n var firstBusTime = 5 * 60;\n // start time in minutes.\n var startTime = lines[2][0].split(':').map(Number);\n startTime = startTime[0] * 60 + startTime[1];\n\n var x1 = startTime;\n var y1 = x1 + durationA;\n\n var count = 0;\n for (var x2 = firstBusTime; x2 < 24 * 60; x2 += repeatB) {\n var y2 = x2 + durationB;\n var x = Math.max(x1, x2);\n var y = Math.min(y1, y2);\n\n if (x < y) {\n count++;\n }\n }\n\n print(count);\n}\n\nmain()", "src_uid": "1c4cf1c3cb464a483511a8a61f8685a7"} {"source_code": "print(readline().split('WUB').join(' '))", "src_uid": "edede580da1395fe459a480f6a0a548d"} {"source_code": "\"use strict\";[]\n/*** Custom Header For JAVASCRIPT ***/\nvar min = Math.min\nvar max = Math.max\n\n//_f should be primitive\nvar nDArray = function(_a, _f)\n{\n\tif(!Array.isArray(_a)) return null;\n\tif(_a.length==1)\n\t{\n\t\tvar _ret = [];\n\t\twhile(_ret.push(_f)<_a[0]);\n\t\treturn _ret\n\t}\n\tvar _ret = [];\n\twhile(_ret.push(nDArray(_a.slice(1),_f))<_a[0]);\n\treturn _ret;\n}\n\n\nvar INF = 1e9+9;\n/*** End of Custom Header ***/\nvar main = function()\n{\n\tvar N = +readline()\n\tvar A = (\"0 \"+readline()).split(\" \").map(Number)\n\tvar dp = nDArray([N+1,3],0)\n\tdp[0][0] = 0;\n\tdp[0][1] = INF;\n\tdp[0][2] = INF;\n\tfor(var i=1; i<=N; i++)\n\t{\n\t\tdp[i][0] = 1 + min(dp[i-1][0], min(dp[i-1][1], dp[i-1][2]) );\n\t\tdp[i][1] = min(dp[i-1][0], dp[i-1][2]);\n\t\tdp[i][2] = min(dp[i-1][0], dp[i-1][1]);\n\t\tif(A[i]==2 || A[i]==0) dp[i][2]=INF;\n\t\tif(A[i]==1 || A[i]==0) dp[i][1]=INF;\n\t}\n\tvar ans = min(dp[N][0], min(dp[N][1],dp[N][2]));\n\twrite(ans)\n}\n\n\nmain()\n", "src_uid": "08f1ba79ced688958695a7cfcfdda035"} {"source_code": "const readline = require('readline');\n\n// Create readline Interface\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout\n});\n\nlet grid = [];\n// Read Inputs\n\nrl.on('line', lineInput => {\n grid.push(lineInput);\n})\nrl.on('close', () => { \n let r = grid[0].split(\" \")[0];\n let c = grid[0].split(\" \")[1];\n\n \n // rows\n let clearRows = 0, rows = [];\n for (let i = 1; i <= r; i++) {\n const row = grid[i];\n rows.push(row)\n if (!row.split('').includes('S'))\n clearRows++;\n }\n\n // cols\n let clearCols = 0;\n for (let i = 0; i < c; i++) {\n let f = 0;\n for (let j = 0; j < r; j++) {\n const box = rows[j].split('')[i];\n if (box === 'S') { f = 1; break; }\n }\n if (!f)\n clearCols++;\n }\n let overlaps = clearCols * clearRows;\n let ans = ((clearCols * r) + (clearRows * c)) - overlaps\n\n console.log(ans)\n\n});", "src_uid": "ebaf7d89c623d006a6f1ffd025892102"} {"source_code": "n=+readline()\na=readline().split(' ').map(function(x){return +x;})\nvar res=0;\nfor (var i=0;i<=n;i++)\n{\n var x0=0;\n var x1=0;\n for (var j=0;jres){res=x0+x1;}\n}\nprint(res)", "src_uid": "c7b1f0b40e310f99936d1c33e4816b95"} {"source_code": ";(function () {\n\tprint(function (n) {\n\n\t\tfor (var i = 1; i <= 4; i++) {\n\t\t\tvar l = readline().split(' ').map(Number),\n\t\t\t\tx = Math.min(l[0], l[1]),\n\t\t\t\ty = Math.min(l[2], l[3]);\n\n\t\t\tif (x + y <= n) {\n\t\t\t\treturn [i, x, n - x].join(' ');\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\n\t}(+readline()));\n}.call(this));\n", "src_uid": "6e7ee0da980beb99ca49a5ddd04089a5"} {"source_code": "'use strict';\n\nprocess.stdin.resume();\nprocess.stdin.setEncoding('utf-8');\n\nlet inputString = '';\nlet currentLine = 0;\n\nprocess.stdin.on('data', inputStdin => {\n inputString += inputStdin;\n});\n\nprocess.stdin.on('end', _ => {\n inputString = inputString.trim().split('\\n').map(string => {\n return string.trim();\n });\n\n main();\n});\n\nfunction readLine() {\n return inputString[currentLine++];\n}\n\nfunction printResult(x) {\n process.stdout.write(x);\n}\n\nfunction main() {\n const arrPoints = new Array(8);\n for (let i = 0; i < 8; i++) {\n let rl = readLine().split(' ').map(Number);\n arrPoints[i] = new Point(rl[0], rl[1]);\n }\n\n eightPointSet(arrPoints);\n}\n\nfunction Point(x, y)\n{\n this.x = x;\n this.y = y;\n}\n\nconst comparePoints = (a, b) => {\n if (a.x < b.x || (a.x === b.x && a.y < b.y)) {\n return -1;\n }\n if (a.x > b.x || (a.x === b.x && a.y > b.y)) {\n return 1;\n }\n return 0;\n}\n\n/**\n * eightPointSet\n *\n * 2 4 7\n * 1 6\n * 0 3 5\n *\n * => Equal\n * x0 = x0 = x2\n * x3 = x4\n * x5 = x6 = x7\n * y0 = y3 = y5\n * y1 = y6\n * y2 = y4 = y7\n *\n * => Not equal\n * x0 != x3\n * x3 != x5\n * y0 != y1\n * y1 != y2\n */\nconst eightPointSet = (a) => {\n a.sort(comparePoints);\n if (a[0].x === a[1].x && a[1].x === a[2].x\n && a[3].x === a[4].x\n && a[5].x === a[6].x && a[6].x === a[7].x\n && a[0].y === a[3].y && a[3].y === a[5].y\n && a[1].y === a[6].y\n && a[2].y === a[4].y && a[4].y === a[7].y\n\n && a[0].x !== a[3].x\n && a[3].x !== a[5].x\n && a[0].y !== a[1].y\n && a[1].y !== a[2].y) {\n printResult('respectable');\n } else {\n printResult('ugly');\n }\n};", "src_uid": "f3c96123334534056f26b96f90886807"} {"source_code": "var input = readline().split(\" \"), a = input[0], b = input[1], counter = 0;\n\nfor(;a > 0 && b > 0;){\n\tif(a >= b){\n\t\tcounter += Math.floor(a/b);\n\t\ta = a % b;\n\t}\n\telse{\n\t\tcounter += Math.floor(b/a);\n\t\tb = b % a;\n\t}\n}\nwrite(counter);", "src_uid": "ce698a0eb3f5b82de58feb177ce43b83"} {"source_code": ";(function () {\n\tprint(function () {\n\t\tvar s = readline().split(''), l = [];\n\t\tfor (var i = 0; i < 8; i++) {\n\t\t\tl.push(s.splice(0, 10).join(''));\n\t\t}\n\n\t\tvar n = [], s = 10;\n\t\twhile (s--) {\n\t\t\tn.push(readline());\n\t\t}\n\n\t\tl.forEach(function (e, i) {\n\t\t\tl[i] = n.indexOf(e);\n\t\t});\n\n\t\treturn l.join('');\n\t}());\n}.call(this));", "src_uid": "0f4f7ca388dd1b2192436c67f9ac74d9"} {"source_code": "var cards = readline().split(' ').map(Number);\n\nvar duplicates = {};\n\nfor (var i = 0; i < cards.length; i++) {\n\tif (cards[i] in duplicates) {\n\t\tif (duplicates[cards[i]] < 3) {\n\t\t\tduplicates[cards[i]] += 1; //but only up to 3!!\n\t\t}\n\t} else {\n\t\tduplicates[cards[i]] = 1;\n\t}\n}\n\nvar sum = 0;\nvar max_sum = 0;\n\nfor (var key in duplicates) {\n\tif (duplicates[key] > 1) {\n\t\tsum = key * duplicates[key];\n\t\tif (sum > max_sum) {\n\t\t\tmax_sum = sum;\n\t\t}\n\t}\n}\n\nvar cards_sum = 0;\nvar min_sum = 0;\n\nfor (var i = 0; i < cards.length; i++) {\n\tcards_sum += cards[i];\n}\n\nmin_sum = cards_sum - max_sum;\n\nprint(min_sum);", "src_uid": "a9c17ce5fd5f39ffd70917127ce3408a"} {"source_code": "var a = +readline();\n\nwhile(String(a).split('').map(e => +e).reduce((a,b) => a + b) % 4 != 0) a ++;\nwrite(a)", "src_uid": "bb6fb9516b2c55d1ee47a30d423562d7"} {"source_code": "var keyboard = \"qwertyuiopasdfghjkl;zxcvbnm,./\", mistake = readline(), string = readline(), answer = [];\n\nif( mistake == \"R\" ){\n\tfor(i = 0; i < string.length; i++){\n\t\tanswer.push(keyboard[keyboard.indexOf(string[i])-1]);\n\t}\n\twrite(answer.join(\"\"));\n}\nelse{\n\tfor(i = 0; i < string.length; i++){\n\t\tanswer.push(keyboard[keyboard.indexOf(string[i])+1]);\n\t}\n\twrite(answer.join(\"\"));\n}", "src_uid": "df49c0c257903516767fdb8ac9c2bfd6"} {"source_code": "function calculateProb(str1, str2) {\n var num = parseInt(str1);\n var arr = str2.split(\"\").map(function(x) { return parseInt(x); });\n var ob = {};\n\n for (var i = 0; i < arr.length; i++) {\n if (!ob[arr[i]]) {\n ob[arr[i]] = 0;\n }\n\n ob[arr[i]]++;\n }\n\n var min = 0;\n\n for (var j = 0; j < 10; j++) {\n if (j === 0) {\n min = ob[j] || 0;\n } else {\n if (ob[j] < min) min = ob[j];\n }\n\n }\n\n ob[8] = ob[8] ? ob[8] : 0;\n\n return Math.min(ob[8], Math.floor(num / 11));\n}\n\nvar s1 = readline();\nvar s2 = readline();\n\nprint(calculateProb(s1, s2));\n", "src_uid": "259d01b81bef5536b969247ff2c2d776"} {"source_code": "const readline = require('readline');\nconst rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n terminal: false\n});\nconst arr = [];\n\nrl.on('line', (data) => {\n arr.push(+data);\n});\n\nrl.on('close', () => {\n const [a, b, c, d, e, f] = arr;\n\n let suite2 = Math.min(b, c, d);\n let suite1 = Math.min(a, d - suite2);\n if (f > e) {\n suite2 = Math.min(b, c, d);\n suite1 = Math.min(a, d - suite2);\n }\n else {\n suite1 = Math.min(a, d);\n suite2 = Math.min(b, c, d - suite1);\n }\n\n const price1 = suite1 * e < 0 ? 0 : suite1 * e;\n const price2 = suite2 * f < 0 ? 0 : suite2 * f;\n const ans = price1 + price2;\n\n console.log(ans);\n});\n", "src_uid": "84d9e7e9c9541d997e6573edb421ae0a"} {"source_code": "function main() {\n var line1 = readline();\n var data = readline().split(' ').map(Number);\n data.sort((a, b) => a-b);\n for (var k = data.length-1; k >= 2 && data[k-2] > 0 ; --k) {\n if ( data[k-2]+data[k-1] > data[k] )\n return print(\"YES\")\n }\n return print(\"NO\")\n}\n\n\n\n\nmain()", "src_uid": "897bd80b79df7b1143b652655b9a6790"} {"source_code": "!function(t){var n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&\"object\"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,\"default\",{enumerable:!0,value:t}),2&n&&\"string\"!=typeof t)for(var o in t)r.d(e,o,function(n){return t[n]}.bind(null,o));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,\"a\",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p=\"\",r(r.s=49)}([function(t,n,r){var e=r(26)(\"wks\"),o=r(14),i=r(2).Symbol,u=\"function\"==typeof i;(t.exports=function(t){return e[t]||(e[t]=u&&i[t]||(u?i:o)(\"Symbol.\"+t))}).store=e},function(t,n,r){var e=r(2),o=r(11),i=r(5),u=r(17),c=r(27),f=function(t,n,r){var a,s,l,p,v=t&f.F,y=t&f.G,h=t&f.S,d=t&f.P,g=t&f.B,b=y?e:h?e[n]||(e[n]={}):(e[n]||{}).prototype,x=y?o:o[n]||(o[n]={}),m=x.prototype||(x.prototype={});for(a in y&&(r=n),r)l=((s=!v&&b&&void 0!==b[a])?b:r)[a],p=g&&s?c(l,e):d&&\"function\"==typeof l?c(Function.call,l):l,b&&u(b,a,l,t&f.U),x[a]!=l&&i(x,a,p),d&&m[a]!=l&&(m[a]=l)};e.core=o,f.F=1,f.G=2,f.S=4,f.P=8,f.B=16,f.W=32,f.U=64,f.R=128,t.exports=f},function(t,n){var r=t.exports=\"undefined\"!=typeof window&&window.Math==Math?window:\"undefined\"!=typeof self&&self.Math==Math?self:Function(\"return this\")();\"number\"==typeof __g&&(__g=r)},function(t,n,r){t.exports=!r(9)(function(){return 7!=Object.defineProperty({},\"a\",{get:function(){return 7}}).a})},function(t,n,r){var e=r(12),o=r(39),i=r(15),u=Object.defineProperty;n.f=r(3)?Object.defineProperty:function(t,n,r){if(e(t),n=i(n,!0),e(r),o)try{return u(t,n,r)}catch(t){}if(\"get\"in r||\"set\"in r)throw TypeError(\"Accessors not supported!\");return\"value\"in r&&(t[n]=r.value),t}},function(t,n,r){var e=r(4),o=r(16);t.exports=r(3)?function(t,n,r){return e.f(t,n,o(1,r))}:function(t,n,r){return t[n]=r,t}},function(t,n,r){var e=r(29),o=r(30);t.exports=function(t){return e(o(t))}},function(t,n,r){var e=r(30);t.exports=function(t){return Object(e(t))}},function(t,n){t.exports=function(t){return\"object\"==typeof t?null!==t:\"function\"==typeof t}},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n){var r={}.hasOwnProperty;t.exports=function(t,n){return r.call(t,n)}},function(t,n){var r=t.exports={version:\"2.5.7\"};\"number\"==typeof __e&&(__e=r)},function(t,n,r){var e=r(8);t.exports=function(t){if(!e(t))throw TypeError(t+\" is not an object!\");return t}},function(t,n){t.exports=!1},function(t,n){var r=0,e=Math.random();t.exports=function(t){return\"Symbol(\".concat(void 0===t?\"\":t,\")_\",(++r+e).toString(36))}},function(t,n,r){var e=r(8);t.exports=function(t,n){if(!e(t))return t;var r,o;if(n&&\"function\"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if(\"function\"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&\"function\"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError(\"Can't convert object to primitive value\")}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n,r){var e=r(2),o=r(5),i=r(10),u=r(14)(\"src\"),c=Function.toString,f=(\"\"+c).split(\"toString\");r(11).inspectSource=function(t){return c.call(t)},(t.exports=function(t,n,r,c){var a=\"function\"==typeof r;a&&(i(r,\"name\")||o(r,\"name\",n)),t[n]!==r&&(a&&(i(r,u)||o(r,u,t[n]?\"\"+t[n]:f.join(String(n)))),t===e?t[n]=r:c?t[n]?t[n]=r:o(t,n,r):(delete t[n],o(t,n,r)))})(Function.prototype,\"toString\",function(){return\"function\"==typeof this&&this[u]||c.call(this)})},function(t,n,r){var e=r(41),o=r(32);t.exports=Object.keys||function(t){return e(t,o)}},function(t,n){t.exports={}},function(t,n){t.exports=function(t){if(\"function\"!=typeof t)throw TypeError(t+\" is not a function!\");return t}},function(t,n){var r={}.toString;t.exports=function(t){return r.call(t).slice(8,-1)}},function(t,n,r){var e=r(42),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,r){var e=r(23),o=r(16),i=r(6),u=r(15),c=r(10),f=r(39),a=Object.getOwnPropertyDescriptor;n.f=r(3)?a:function(t,n){if(t=i(t),n=u(n,!0),f)try{return a(t,n)}catch(t){}if(c(t,n))return o(!e.f.call(t,n),t[n])}},function(t,n,r){\"use strict\";t.exports=r(13)||!r(9)(function(){var t=Math.random();__defineSetter__.call(null,t,function(){}),delete r(2)[t]})},function(t,n,r){var e=r(11),o=r(2),i=o[\"__core-js_shared__\"]||(o[\"__core-js_shared__\"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})(\"versions\",[]).push({version:e.version,mode:r(13)?\"pure\":\"global\",copyright:\"© 2018 Denis Pushkarev (zloirock.ru)\"})},function(t,n,r){var e=r(20);t.exports=function(t,n,r){if(e(t),void 0===n)return t;switch(r){case 1:return function(r){return t.call(n,r)};case 2:return function(r,e){return t.call(n,r,e)};case 3:return function(r,e,o){return t.call(n,r,e,o)}}return function(){return t.apply(n,arguments)}}},function(t,n,r){var e=r(4).f,o=r(10),i=r(0)(\"toStringTag\");t.exports=function(t,n,r){t&&!o(t=r?t:t.prototype,i)&&e(t,i,{configurable:!0,value:n})}},function(t,n,r){var e=r(21);t.exports=Object(\"z\").propertyIsEnumerable(0)?Object:function(t){return\"String\"==e(t)?t.split(\"\"):Object(t)}},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError(\"Can't call method on \"+t);return t}},function(t,n,r){var e=r(26)(\"keys\"),o=r(14);t.exports=function(t){return e[t]||(e[t]=o(t))}},function(t,n){t.exports=\"constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf\".split(\",\")},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,r){var e=r(21);t.exports=Array.isArray||function(t){return\"Array\"==e(t)}},function(t,n,r){var e=r(41),o=r(32).concat(\"length\",\"prototype\");n.f=Object.getOwnPropertyNames||function(t){return e(t,o)}},function(t,n,r){var e=r(10),o=r(7),i=r(31)(\"IE_PROTO\"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),e(t,i)?t[i]:\"function\"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,n,r){var e=r(2),o=r(11),i=r(13),u=r(38),c=r(4).f;t.exports=function(t){var n=o.Symbol||(o.Symbol=i?{}:e.Symbol||{});\"_\"==t.charAt(0)||t in n||c(n,t,{value:u.f(t)})}},function(t,n,r){n.f=r(0)},function(t,n,r){t.exports=!r(3)&&!r(9)(function(){return 7!=Object.defineProperty(r(40)(\"div\"),\"a\",{get:function(){return 7}}).a})},function(t,n,r){var e=r(8),o=r(2).document,i=e(o)&&e(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n,r){var e=r(10),o=r(6),i=r(54)(!1),u=r(31)(\"IE_PROTO\");t.exports=function(t,n){var r,c=o(t),f=0,a=[];for(r in c)r!=u&&e(c,r)&&a.push(r);for(;n.length>f;)e(c,r=n[f++])&&(~i(a,r)||a.push(r));return a}},function(t,n){var r=Math.ceil,e=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?e:r)(t)}},function(t,n,r){var e=r(12),o=r(56),i=r(32),u=r(31)(\"IE_PROTO\"),c=function(){},f=function(){var t,n=r(40)(\"iframe\"),e=i.length;for(n.style.display=\"none\",r(57).appendChild(n),n.src=\"javascript:\",(t=n.contentWindow.document).open(),t.write(\"