tag:blogger.com,1999:blog-36755827966195902062024-03-11T13:49:00.026+06:00 I, ME AND MYSELF !!!Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.comBlogger118125tag:blogger.com,1999:blog-3675582796619590206.post-67220888227701152912015-11-16T13:14:00.000+06:002015-11-16T13:14:35.702+06:00(Computational?) Geometry problems from POJ<div align="justify">
<p>Here's a short list of some mixed geometry flavored problems from <a href="http://poj.org/" target="_blank">POJ</a>.</p>
<table>
<tr><td><a href="http://poj.org/problem?id=1039" target="_blank">1039</a></td><td><a href="http://poj.org/problem?id=1066" target="_blank">1066</a></td><td><a href="http://poj.org/problem?id=1113" target="_blank">1113</a></td><td><a href="http://poj.org/problem?id=1151" target="_blank">1151</a></td><td><a href="http://poj.org/problem?id=1177" target="_blank">1177</a></td><td><a href="http://poj.org/problem?id=1228" target="_blank">1228</a></td><td><a href="http://poj.org/problem?id=1254" target="_blank">1254</a></td><td><a href="http://poj.org/problem?id=1263" target="_blank">1263</a></td><td><a href="http://poj.org/problem?id=1269" target="_blank">1269</a></td><td><a href="http://poj.org/problem?id=1385" target="_blank">1385</a></td><td><a href="http://poj.org/problem?id=1389" target="_blank">1389</a></td><td><a href="http://poj.org/problem?id=1408" target="_blank">1408</a></td><td><a href="http://poj.org/problem?id=1410" target="_blank">1410</a></td></tr>
<tr><td><a href="http://poj.org/problem?id=1556" target="_blank">1556</a></td><td><a href="http://poj.org/problem?id=1584" target="_blank">1584</a></td><td><a href="http://poj.org/problem?id=1696" target="_blank">1696</a></td><td><a href="http://poj.org/problem?id=1765" target="_blank">1765</a></td><td><a href="http://poj.org/problem?id=1819" target="_blank">1819</a></td><td><a href="http://poj.org/problem?id=1837" target="_blank">1837</a></td><td><a href="http://poj.org/problem?id=1873" target="_blank">1873</a></td><td><a href="http://poj.org/problem?id=2031" target="_blank">2031</a></td><td><a href="http://poj.org/problem?id=2043" target="_blank">2043</a></td><td><a href="http://poj.org/problem?id=2074" target="_blank">2074</a></td><td><a href="http://poj.org/problem?id=2079" target="_blank">2079</a></td><td><a href="http://poj.org/problem?id=2165" target="_blank">2165</a></td><td><a href="http://poj.org/problem?id=2187" target="_blank">2187</a></td></tr>
<tr><td><a href="http://poj.org/problem?id=2242" target="_blank">2242</a></td><td><a href="http://poj.org/problem?id=2280" target="_blank">2280</a></td><td><a href="http://poj.org/problem?id=2318" target="_blank">2318</a></td><td><a href="http://poj.org/problem?id=2354" target="_blank">2354</a></td><td><a href="http://poj.org/problem?id=2398" target="_blank">2398</a></td><td><a href="http://poj.org/problem?id=2420" target="_blank">2420</a></td><td><a href="http://poj.org/problem?id=2423" target="_blank">2423</a></td><td><a href="http://poj.org/problem?id=2540" target="_blank">2540</a></td><td><a href="http://poj.org/problem?id=2653" target="_blank">2653</a></td><td><a href="http://poj.org/problem?id=2826" target="_blank">2826</a></td><td><a href="http://poj.org/problem?id=2954" target="_blank">2954</a></td><td><a href="http://poj.org/problem?id=2966" target="_blank">2966</a></td><td><a href="http://poj.org/problem?id=3004" target="_blank">3004</a></td></tr>
<tr><td><a href="http://poj.org/problem?id=3130" target="_blank">3130</a></td><td><a href="http://poj.org/problem?id=3227" target="_blank">3227</a></td><td><a href="http://poj.org/problem?id=3277" target="_blank">3277</a></td><td><a href="http://poj.org/problem?id=3304" target="_blank">3304</a></td><td><a href="http://poj.org/problem?id=3335" target="_blank">3335</a></td><td><a href="http://poj.org/problem?id=3347" target="_blank">3347</a></td><td><a href="http://poj.org/problem?id=3348" target="_blank">3348</a></td><td><a href="http://poj.org/problem?id=3384" target="_blank">3384</a></td><td><a href="http://poj.org/problem?id=3429" target="_blank">3429</a></td><td><a href="http://poj.org/problem?id=3449" target="_blank">3449</a></td><td><a href="http://poj.org/problem?id=3525" target="_blank">3525</a></td><td><a href="http://poj.org/problem?id=3608" target="_blank">3608</a></td><td><a href="http://poj.org/problem?id=3695" target="_blank">3695</a></td></tr>
</table>
<p>There is a possibility that some of these may not be geometry problem at all, tried my best to sort them out though. Also, some of these problems are not solvable by only geometry knowledge. Graph, dynamic programming, and understanding of advanced data structure may also be required.</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com0tag:blogger.com,1999:blog-3675582796619590206.post-2895767204879031502015-11-16T11:50:00.002+06:002015-11-16T11:52:37.301+06:00Maximum Flow and BPM Problems from SPOJ and HDU<div align="justify">
<p>Here is a short list of network flow and bpm problems that I managed to solve from <a href="http://www.spoj.com/" target="_blank">SPOJ</a> and <a href="http://acm.hdu.edu.cn/" target="_blank">HDU</a>. This is not much and there are other sources of these kinds of problems, but I think these are some good starting points. Also I did not classify them on the types of flow or bpm, that would be up to the reader.</p>
<h3>Maximum Flow and Bipartite Matching problems from SPOJ</h3>
<p><table>
<style type="text/css">td {text-align:center; width:120px;}</style>
<tr><td><a href="http://www.spoj.com/problems/ANGELS/en/" target="_blank">ANGELS</a></td><td><a href="http://www.spoj.com/problems/BABY/en/" target="_blank">BABY</a></td><td><a href="http://www.spoj.com/problems/DIVREL/en/" target="_blank">DIVREL</a></td><td><a href="http://www.spoj.com/problems/FASTFLOW/en/" target="_blank">FASTFLOW</a></td><td><a href="http://www.spoj.com/problems/MATCHING/en/" target="_blank">MATCHING</a></td></tr>
<tr><td><a href="http://www.spoj.com/problems/MSE06I/en/" target="_blank">MSE06I</a></td><td><a href="http://www.spoj.com/problems/MTOTALF/en/" target="_blank">MTOTALF</a></td><td><a href="http://www.spoj.com/problems/MUDDY/en/" target="_blank">MUDDY</a></td><td><a href="http://www.spoj.com/problems/PCPC12H/en/" target="_blank">PCPC12H</a></td><td><a href="http://www.spoj.com/problems/PROFIT/en/" target="_blank">PROFIT</a></td></tr>
<tr><td><a href="http://www.spoj.com/problems/PT07X/en/" target="_blank">PT07X</a></td><td><a href="http://www.spoj.com/problems/QUEST4/en/" target="_blank">QUEST4</a></td><td><a href="http://www.spoj.com/problems/SCITIES/en/" target="_blank">SCITIES</a></td><td><a href="http://www.spoj.com/problems/STEAD/en/" target="_blank">STEAD</a></td><td><a href="http://www.spoj.com/problems/TAXI/en/" target="_blank">TAXI</a></td></tr>
</table></p>
<h3>Maximum Flow and Bipartite Matching problems from HDU</h3>
<p><table>
<tr><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=1532" target="_blank">1532</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=1533" target="_blank">1533</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=1853" target="_blank">1853</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=2448" target="_blank">2448</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=2686" target="_blank">2686</a></td></tr>
<tr><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=2732" target="_blank">2732</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=2833" target="_blank">2833</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3081" target="_blank">3081</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3277" target="_blank">3277</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3315" target="_blank">3315</a></td></tr>
<tr><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3376" target="_blank">3376</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3395" target="_blank">3395</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3416" target="_blank">3416</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3419" target="_blank">3419</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3435" target="_blank">3435</a></td></tr>
<tr><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3468" target="_blank">3468</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3472" target="_blank">3472</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3488" target="_blank">3488</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3491" target="_blank">3491</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3572" target="_blank">3572</a></td></tr>
<tr><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3667" target="_blank">3667</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3987" target="_blank">3987</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=3998" target="_blank">3998</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=4183" target="_blank">4183</a></td><td><a href="http://acm.hdu.edu.cn/showproblem.php?pid=4309" target="_blank">4309</a></td></tr>
</table></p>
<p>Note: <a href="https://uva.onlinejudge.org/" target="_blank">UVa</a> has a lot of flow and bpm problems, please visit <a href="http://uhunt.felix-halim.net/">uHunt</a> for guidelines.</p>
<p>Note: It is very possible that there are many other problems from these online judges which can be solved by flow or bpm algorithms. And, some problems here could be mistakenly added as flow or bpm category due to copy paste errors. Please feel free to leave a note on the comment section, add more links if you like to. Happy coding \m/</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com0tag:blogger.com,1999:blog-3675582796619590206.post-9288504687396186402015-10-01T11:40:00.000+06:002015-10-01T11:42:39.695+06:00Ajax Queue Example Code<div align="justify">
<p>Although this is not what ajax is meant for, but sometimes application requirements force us to implement various hacks. For example, ajax is usually done for light-weight request. But in my case, I am using it for an alternative to form submission. Each of these submissions causes heavy load at server end. So I cannot allow more than one concurrent ajax call to reach the server. This simple solution worked as a charm.</p>
<p>Javascript code:</p>
<pre class="prettyprint linenums">
var ajaxQueue = $({});
var currentRequest = null;
$.ajaxQueue = function( ajaxOpts ) {
// Hold the original complete function.
var oldComplete = ajaxOpts.complete;
// Queue our ajax request.
ajaxQueue.queue(function( next ) {
// Create a complete callback to fire the next event in the queue.
ajaxOpts.complete = function() {
// Fire the original complete if it was there.
if ( oldComplete ) {
oldComplete.apply( this, arguments );
}
// Run the next query in the queue.
next();
};
// Run the query.
currentRequest = $.ajax( ajaxOpts );
});
};
// Ajax calls
function ajaxCall() {
$.ajaxQueue({
type: "POST",
url: '/echo/json/',
async: true,
cache: false,
success: function( result ) {
// process response
}
});
}
// Abort method
function abortAjaxQueue() {
ajaxQueue.clearQueue();
if (currentRequest) {
currentRequest.abort();
}
}
</pre>
<h4>Disclaimer</h4>
<p>This is not my own code, this is community developed, thanks to <a href="http://stackoverflow.com/questions/16775447/jquery-dequeue-an-ajaxqueue" target="_blank">this stackoverflow question</a> and its accepted answer by <a href="http://stackoverflow.com/users/616859/sroes" target="_blank">sroes</a>. Tested using JQuery versions 1.9.1 to 2.3.1</p>
<p>Play with this code in <a href="http://jsfiddle.net/4AQ9N/46/" target="_blank">JSFiddle</a></p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com0tag:blogger.com,1999:blog-3675582796619590206.post-88555199853833233402015-06-27T17:22:00.000+06:002015-06-27T17:22:16.410+06:00Dynamic Programming (DP) problems from SPOJ<div align="justify">
<p><a href="http://www.spoj.com/" target="_blank">Sphere Online Judge</a> a.k.a. SPOJ is a very good online judge. Still, beginners face a lot of trouble when they first come to SPOJ, mainly because SPOJ is not as well categorized as some other judges out there. Recently SPOJ is trying to offer problem hints, but due to being community driven, this is still a long shot. Classification hints for SPOJ problems are not commonly available in the internet as well. So far I have managed to solve a few dynamic problems from SPOJ and I think for someone who is trying to practice dynamic programming problems from SPOJ, this short list might come handy.</p>
<table style="width:600px;">
<tr><td><a href='http://www.spoj.com/problems/ACMAKER/' target='_blank'>ACMAKER</a></td><td><a href='http://www.spoj.com/problems/EDIST/' target='_blank'>EDIST</a></td><td><a href='http://www.spoj.com/problems/MBLAST/en/' target='_blank'>MBLAST</a></td><td><a href='http://www.spoj.com/problems/RAINBOW/' target='_blank'>RAINBOW</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/ACODE/' target='_blank'>ACODE</a></td><td><a href='http://www.spoj.com/problems/EQ2/' target='_blank'>EQ2</a></td><td><a href='http://www.spoj.com/problems/MCARDS/en/' target='_blank'>MCARDS</a></td><td><a href='http://www.spoj.com/problems/RENT/' target='_blank'>RENT</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/ACPC10D/' target='_blank'>ACPC10D</a></td><td><a href='http://www.spoj.com/problems/FISHER/' target='_blank'>FISHER</a></td><td><a href='http://www.spoj.com/problems/MDOLLS/en/' target='_blank'>MDOLLS</a></td><td><a href='http://www.spoj.com/problems/ROCK/' target='_blank'>ROCK</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/ACPC10G/' target='_blank'>ACPC10G</a></td><td><a href='http://www.spoj.com/problems/FPOLICE/' target='_blank'>FPOLICE</a></td><td><a href='http://www.spoj.com/problems/MISERMAN/' target='_blank'>MISERMAN</a></td><td><a href='http://www.spoj.com/problems/SAMER08C/' target='_blank'>SAMER08C</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/AIBOHP/' target='_blank'>AIBOHP</a></td><td><a href='http://www.spoj.com/problems/GCPC11B/' target='_blank'>GCPC11B</a></td><td><a href='http://www.spoj.com/problems/MIXTURES/' target='_blank'>MIXTURES</a></td><td><a href='http://www.spoj.com/problems/SCUBADIV/' target='_blank'>SCUBADIV</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/ANARC05B/en' target='_blank'>ANARC05B</a></td><td><a href='http://www.spoj.com/problems/GNY07H/' target='_blank'>GNY07H</a></td><td><a href='http://www.spoj.com/problems/MMAXPER/en/' target='_blank'>MMAXPER</a></td><td><a href='http://www.spoj.com/problems/SOLDIER/' target='_blank'>SOLDIER</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/ANARC05H/en' target='_blank'>ANARC05H</a></td><td><a href='http://www.spoj.com/problems/GNYR09F/' target='_blank'>GNYR09F</a></td><td><a href='http://www.spoj.com/problems/MPILOT/en/' target='_blank'>MPILOT</a></td><td><a href='http://www.spoj.com/problems/SQRBR/' target='_blank'>SQRBR</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/ARBITRAG/' target='_blank'>ARBITRAG</a></td><td><a href='http://www.spoj.com/problems/HANGOVER/' target='_blank'>HANGOVER</a></td><td><a href='http://www.spoj.com/problems/MREPLBRC/en/' target='_blank'>MREPLBRC</a></td><td><a href='http://www.spoj.com/problems/STONE2/' target='_blank'>STONE2</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/BABTWR/' target='_blank'>BABTWR</a></td><td><a href='http://www.spoj.com/problems/HELPBOB/' target='_blank'>HELPBOB</a></td><td><a href='http://www.spoj.com/problems/NOCHANGE/' target='_blank'>NOCHANGE</a></td><td><a href='http://www.spoj.com/problems/TEMPTISL/' target='_blank'>TEMPTISL</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/BYTESM2/' target='_blank'>BYTESM2</a></td><td><a href='http://www.spoj.com/problems/HIST2/' target='_blank'>HIST2</a></td><td><a href='http://www.spoj.com/problems/NUMPLAY/' target='_blank'>NUMPLAY</a></td><td><a href='http://www.spoj.com/problems/TOURIST/' target='_blank'>TOURIST</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/CHAIR/' target='_blank'>CHAIR</a></td><td><a href='http://www.spoj.com/problems/IKEYB/' target='_blank'>IKEYB</a></td><td><a href='http://www.spoj.com/problems/NY10E/' target='_blank'>NY10E</a></td><td><a href='http://www.spoj.com/problems/TRAVERSE/' target='_blank'>TRAVERSE</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/COINS/' target='_blank'>COINS</a></td><td><a href='http://www.spoj.com/problems/INGRED/' target='_blank'>INGRED</a></td><td><a href='http://www.spoj.com/problems/OSPROB1/' target='_blank'>OSPROB1</a></td><td><a href='http://www.spoj.com/problems/TRIKA/' target='_blank'>TRIKA</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/COUNT/' target='_blank'>COUNT</a></td><td><a href='http://www.spoj.com/problems/IOIPALIN/' target='_blank'>IOIPALIN</a></td><td><a href='http://www.spoj.com/problems/PARTIT/' target='_blank'>PARTIT</a></td><td><a href='http://www.spoj.com/problems/TRIP/' target='_blank'>TRIP</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/CPRMT/' target='_blank'>CPRMT</a></td><td><a href='http://www.spoj.com/problems/JRIDE/' target='_blank'>JRIDE</a></td><td><a href='http://www.spoj.com/problems/PARTY/' target='_blank'>PARTY</a></td><td><a href='http://www.spoj.com/problems/TRT/' target='_blank'>TRT</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/CRSCNTRY/' target='_blank'>CRSCNTRY</a></td><td><a href='http://www.spoj.com/problems/KNAPSACK/' target='_blank'>KNAPSACK</a></td><td><a href='http://www.spoj.com/problems/PCPC12G/' target='_blank'>PCPC12G</a></td><td><a href='http://www.spoj.com/problems/TWENDS/' target='_blank'>TWENDS</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/CSUBSEQS/' target='_blank'>CSUBSEQS</a></td><td><a href='http://www.spoj.com/problems/LINEUP/' target='_blank'>LINEUP</a></td><td><a href='http://www.spoj.com/problems/PEGS/' target='_blank'>PEGS</a></td><td><a href='http://www.spoj.com/problems/UPSUB/' target='_blank'>UPSUB</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/CZ_PROB1/' target='_blank'>CZ_PROB1</a></td><td><a href='http://www.spoj.com/problems/M3TILE/en/' target='_blank'>M3TILE</a></td><td><a href='http://www.spoj.com/problems/PERMUT1/' target='_blank'>PERMUT1</a></td><td><a href='http://www.spoj.com/problems/VOCV/' target='_blank'>VOCV</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/DCEPC501/' target='_blank'>DCEPC501</a></td><td><a href='http://www.spoj.com/problems/MAIN112/' target='_blank'>MAIN112</a></td><td><a href='http://www.spoj.com/problems/PHIDIAS/' target='_blank'>PHIDIAS</a></td><td><a href='http://www.spoj.com/problems/WPC4F/' target='_blank'>WPC4F</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/DINGRP/' target='_blank'>DINGRP</a></td><td><a href='http://www.spoj.com/problems/MAIN113/' target='_blank'>MAIN113</a></td><td><a href='http://www.spoj.com/problems/PIGBANK/' target='_blank'>PIGBANK</a></td><td><a href='http://www.spoj.com/problems/ZUMA/' target='_blank'>ZUMA</a></td> </tr>
<tr><td><a href='http://www.spoj.com/problems/DSUBSEQ/' target='_blank'>DSUBSEQ</a></td><td><a href='http://www.spoj.com/problems/MARTIAN/' target='_blank'>MARTIAN</a></td><td><a href='http://www.spoj.com/problems/PIZZALOC/en/' target='_blank'>PIZZALOC</a></td><td> </td> </tr>
<tr><td><a href='http://www.spoj.com/problems/DTT/' target='_blank'>DTT</a></td><td><a href='http://www.spoj.com/problems/MAXSUMSQ/' target='_blank'>MAXSUMSQ</a></td><td><a href='http://www.spoj.com/problems/PSTRING/' target='_blank'>PSTRING</a></td><td> </td> </tr>
</table>
<p>Please feel free to add more in the comments. Thanks</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com7tag:blogger.com,1999:blog-3675582796619590206.post-36345709412487895532014-01-06T00:18:00.003+06:002014-01-14T22:23:10.575+06:00SPOJ GUANGGUN<div align="justify">
<p>Problem link: <a href="http://www.spoj.com/problems/GUANGGUN/" target="_blank">SPOJ Problem Set (classical): 9952. 111…1 Squared</a></p>
<p>Interesting and fun problem. This is one of those problems that you can sense a pattern from miles away. Just do some bruteforce and print the patterns. You can use pen and paper too, but Python is surely a better option when you have it. All I did is write some bruteforce in my python interpreter, and the pattern is instantly visible, here is the output of f(n)<sup>2</sup> for n = 1 to 50:</p>
<pre style="font-weight:bold; overflow:auto;">
<span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Indigo">8</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Indigo">8</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Indigo">8</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Indigo">8</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Indigo">8</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
<span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Red">6</span><span style="color:Gold">7</span><span style="color:Brown">9</span><span style="color:Black">0</span><span style="color:Green">1</span><span style="color:Cyan">2</span><span style="color:Gray">3</span><span style="color:Coral">4</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Black">0</span><span style="color:Brown">9</span><span style="color:Indigo">8</span><span style="color:Gold">7</span><span style="color:Red">6</span><span style="color:Blue">5</span><span style="color:Coral">4</span><span style="color:Gray">3</span><span style="color:Cyan">2</span><span style="color:Green">1</span>
</pre>
<p>Beautiful, isn't it? </p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com1tag:blogger.com,1999:blog-3675582796619590206.post-54747869831857003332014-01-04T22:25:00.000+06:002014-01-04T22:25:32.817+06:00SPOJ DCEPC206<div align="justify">
<p>Problem link: <a href="http://www.spoj.com/problems/DCEPC206/" target="_blank">SPOJ Problem Set (classical): 10810. Its a Murder!</a></p>
<p>Given a sequence of integers (at most 10<sup>5</sup> integers ranging from 0 to 10<sup>6</sup>. You have to go from left to right, and for each position, you have to add the sum of all the numbers before current position which are strictly smaller than the number in current position.</p>
<p>Well, if the numbers where sorted, then we could do it more easily, i.e. keep an array for cumulative sum, and then calculate the answer in O(n) time. However, this is not the case. So, what can we do? According the problem, you have to maintain the cumulative sum anyway. So for each number in the sequence, if we keep adding them one by one, we can break down the problem in two parts. Let's think of a data structure which keeps cumulative sums, and we can add numbers anywhere and still maintain the sum. Segment tree / or binary indexed tree could come handy in this situation, where, the later one is more straight forward and less memory hungry. Now the steps are:</p>
<p>1 ⇒ Query: When a number is to be added, what is the sum of numbers smaller than current one? Note, as we are adding one by one in the order they appear, so the question whether there are any numbers which came after current number is eliminated. It is guaranteed that, when you are adding the i<sup>th</sup> number, all the numbers already present in the data-structure came before position <i>i</i>.</p>
<p>2 ⇒ Update: Once you have taken the partial sum for current number, it is now time to add the number in proper place, and update the cumulative sum structure. Here, clearly, appropriate position means, the position where the number would be placed <i>when sorted</i>. Now, we can do two things here. (a), we can sort the number and give each number an unique id to indicate its position in the sorted array. And (b), as the numbers are up to 10<sup>6</sup>, we can use the numbers as their indices or positions in the sorted array. It is faster and the memory overhead is not that of a big issue here.</p>
<p>Now, here are two more things to be taken care about, (a), there can be duplicate numbers, and (b), 0 can be present in the input sequence, which can cause some trouble if you use BIT. However, (a) is handled naturally, because the problem wanted you to add only strictly smaller numbers, so it doesn't matter if you add same numbers in the same positions. There will be no query points in-between the equal numbers. And for (b), there is really no need to worry about 0, cause it contributes nothing at all, just ignore 0.</p>
<p>So, the overall algorithm looks like the following:</p>
<pre class="prettyprint">
for each number a<sub>i</sub>:
if a<sub>i</sub> > 0:
ans += BIT_Query(a<sub>i</sub> - 1)
BIT_Update(a<sub>i</sub>, a<sub>i</sub>)
</pre>
<p>Here: BIT_Query(pos) returns the sum up to position <i>pos</i> and BIT_Update(pos, val) adds <i>val</i> in <i>pos</i> in the BIT structure. Solutions involving the segment tree is also similar. Just keep the tree of total sums, whenever you are trying to add a number, read the partial sum, and then update the structure.</p>
<p>Happy coding..</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com1tag:blogger.com,1999:blog-3675582796619590206.post-89659992003055708742014-01-01T16:04:00.001+06:002014-01-01T16:04:53.375+06:00SPOJ ABCLOG<div align="justify">
<p>Problem link: <a href="http://www.spoj.com/problems/ABCLOG/" target="_blank">SPOJ Problem Set (classical): 17659. Time to get a job</a></p>
<p>This problem should go to the Riddle section or what-so-ever, not worthy for classical. Just reverse the bit string.</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com0tag:blogger.com,1999:blog-3675582796619590206.post-37228445118351780442014-01-01T13:51:00.000+06:002014-01-01T13:52:29.259+06:00SPOJ POLCONST<div align="justify">
<p>Problem link: <a href="http://www.spoj.com/problems/POLCONST/" target="_blank">SPOJ Problem Set (classical): 17707. Constructible Regular Polygons</a></p>
<p>As stated in the problem description, you are required to utilize <a href="http://en.wikipedia.org/wiki/Constructible_polygon" target="_blank">this</a> page. As there are only 5 <a href="http://oeis.org/A019434" target="_blank">Fermat Primes</a>, you can easily do a pre-processing up to 10<sup>6</sup> in constant time (2<sup>5</sup>×5) and answer each query in O(1).</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com1tag:blogger.com,1999:blog-3675582796619590206.post-81544688649401627972014-01-01T10:16:00.001+06:002014-01-01T10:17:25.695+06:00SPOJ HOLI<div align="justify">
<p>Problem link: <a href="http://www.spoj.com/problems/HOLI/" target="_blank">SPOJ Problem Set (classical): 9942. Holiday Accommodation</a></p>
<p>Given a weighted tree, consider there are N people in N nodes. You have to rearrange these N people such that everyone is in a new node, and no node contains more than one people and maximizes the cost. Here cost is the distance travelled for each person.</p>
<p>First observation is, in order to maximize cost, all edges will be used to travel around. So, if we can calculate how many times each edge will be used, we can calculate the cost.</p>
<p>Now for any edge E<sub>i</sub>, we can partition the whole tree into two subtrees, if one side has n nodes, the other side will have N - n nodes. Also, note that, min(n, N-n) people will be crossing the edge from each side. Because if more people cross the edge, then by pigeon-hole principle in one side, we will get more people than available node which is not allowed in the problem statement. So, E<sub>i</sub> will be used a total of 2 * min(n, N-n) times.</p>
<p>Thus the final result is:</p>
<pre>cost = ∑ 2*min(n<sub>i</sub>, N-n<sub>i</sub>)*wieght(E<sub>i</sub>) | for each edge E<sub>i</sub></pre>
<p>Here, n<sub>i</sub> is the count for nodes in one side of the edge E<sub>i</sub> and N-n<sub>i</sub> on the other side. So, we can use simple DFS algorithm to solve the problem. During the traversal, just count number of nodes in the subtree for an edge u⇒v and calculate result for each edge in the process.</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com1tag:blogger.com,1999:blog-3675582796619590206.post-61353258924747704512014-01-01T00:48:00.001+06:002014-01-01T00:48:09.717+06:00SPOJ PRIMIT<div align="justify">
<p>Problem link: <a href="http://www.spoj.com/problems/PRIMIT/" target="_blank">SPOJ Problem Set (classical): 211. Primitivus recurencis</a></p>
<p>Given a list of directed edges or features, we have to find the smallest possible sequence of nodes where all the given edges are present without violating the direction.</p>
<p>Although at first this may seem to be a bipartite matching problem or problem related to strongly connected component. But I am not sure whether this particular problem can be solved using any of those techniques. Here we have two things to observe.</p>
<p>1 ⇒ Ordering for each <a href="http://mathworld.wolfram.com/WeaklyConnectedComponent.html" target="_blank">weakly connected component</a> is independent. So, we can add up the results for each weakly connected component as we can arrange them in any order, because they don't have any node in common.</p>
<p>2 ⇒ The minimum length will be the length of eulerian circuit for each component. We can break the circuit at suitable places to make it a chain. Considering [1], we can break the chain anywhere we want. Because other components have nothing to do with it.</p>
<p>So, for each weakly connected component, it boils down to finding minimum number of edges need to be added to make the component an euler circuit. For each component G<sub>i</sub>, we can find the minimum number of additional edges by the following formula (Note, the formula will also handle the components which are already an euler circuit).</p>
<pre>
Number of additional edges = ∑max( cnt(G<sub>i</sub>) / 2, 1 ) for all i
</pre>
<p>Note: if you already have an euler circuit, i.e. cnt(G<sub>i</sub>) = 0, then you still need 1 additional term in the sequence. The simplest example is two edges, 1-2 and 2-1. You will need either 1-2-1, or 2-1-2 sequence.</p>
<p>And to find the value of cnt() for a component G<sub>i</sub>, we just add the absolute difference of in and out degree count for each node in that component.</p>
<pre>
cnt(G<sub>i</sub>) = ∑|d<sup>+</sup>(u) - d<sup>-</sup>(u)| for each u ∈ G<sub>i</sub>
Here, d<sup>+</sup>(u) ⇒ indegree count for u, and d<sup>-</sup>(u) ⇒ outdegree count for u.
</pre>
<p>So, the overall solution outline is something like this, first use disjoint set data structure, or commonly known as union-find to mark the components. You can also use simple DFS / BFS as well. Ofcourse we are ignoring direction in this stage as we want to generate weakly connected components. Then for each node, calculate total indegree and outdegree counts. Now for each component, use the above formula to find additional edges x<sub>add</sub>, thus the final answer is N + x<sub>add</sub>, here x is the given number of edges.</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com0tag:blogger.com,1999:blog-3675582796619590206.post-43920467509341192622013-12-30T13:26:00.002+06:002013-12-30T13:31:18.985+06:00SPOJ QUEEN<div align="justify">
<p>Problem Source: <a href="http://www.spoj.com/problems/QUEEN/" target="_blank">SPOJ Problem Set (classical): 4235. Wandering Queen</a></p>
<p>Basically you are given a grid with a start and end point along with some obstacles. You have to reach end point using smallest number of standard chess queen moves.</p>
<p>The first idea that pops into mind is using BFS, along with states for 8 direction. In this case, the complexity is around 8 * 256 * 1000 * 1000. Anyone who is a bit familiar with SPOJ engine, knows that, this solution will definitely get a "Time Limit Exceed" verdict.</p>
<p>The catch is, it doesn't matter for a standard chess queen from which direction you reach a particular cell in terms of cost. A queen moves toward 8 directions as long as nothing is blocking her paths and the cost remains the same. So, whenever you reach a cell, you will want to traverse all of the 8 possible directions from that cell. If you maintain the previous direction, the cost will not change, and if you change direction, the cost will be increased by 1. Fortunately, we can maintain the BFS property without keeping extra states for direction simply by adding a parallel flag array and modifying how we choose the next cell.</p>
<p>Although there are 8 possible directions, we have only 2 different scenarios, namely: whether we want to change direction or not. Instead of keeping states for direction changes, we will visit all cells in a particular direction from a specific cell before traversing from other cells and pushing them into a queue as usual. Following this, we can visit all the reachable cells from a particular cell in a single move. During this process, we will store the bit-masked flags for direction in a parallel array. Now, when we meet a new cell, there are four possible scenarios.</p>
<p>1 ⇒ The cell is out of the grid or contain an 'X', simply stop moving in that direction anymore.</p>
<p>2 ⇒ The flag value for this cell already has the bit for current direction set to 1. It means, going in this direction doesn't do anything helpful anymore.</p>
<p>3 ⇒ The flag value for this cell doesn't contain bit for current direction, but it has been visited form different direction earlier. We just skip this cell and continue with the direction. Note: This step is important to understand. Because at first this may seem like, we can just stop here as the cell is already in the queue and will be traversed later. But thinking carefully, you will find out that, your current move will definitely have a lower or equal cost than the current cell which resides in the queue will have (obvious BFS property). So, we may still need to update the rest of the cells following the direction. Although we skip this cell, we update its flag value to mark the direction from which it was visited. See sample case 2, that explains the necessity of this step.</p>
<p>4 ⇒ New cell, we visit it, do regular BFS stuffs like updating cost, pushing into queue, and additionally, we mark the direction from which it was visited in the flag array.</p>
<p>Oh, and ofcourse, flag for the start cell should have all the bits set. Now, we visit each cell at most 8 times for each direction, but we push each cell only once into the queue. Thus, we are able to remove the 256 different bitmasked states, and the solution is more likely to pass the time limit.</p>
<p>Following this procedure, I got accepted in 2.56 with STL queue, and no IO optimization. I am having a feeling that, this problem can be solved more efficiently. So, don't forget to share your idea on this problem.</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com1tag:blogger.com,1999:blog-3675582796619590206.post-71506863600861782012013-12-30T01:55:00.003+06:002013-12-30T01:58:39.396+06:00Repository Transfer<div align="justify">
Finally I have removed all of my github repositories. I have been getting request from a lot of people for removing the repositories or making them private. As github charges too much for maintaining private repositories, I have decided to switch to bitbucket, another wonderful free git server. All of my repositories are set as private. Sorry for the inconvenience. There are already plenty of sites where one can find solutions for online judge problems. My repositories were never intended to be known as a place where you get all the beautiful solutions and then just copy-paste them from your account. That is just meaning-less, stupid and of no good use of-course. Still if you want to see any of my noob-ish solutions, please send me an email.<br/><br/>
Thanks for understanding and happy problem solving. I think I am now retired from all these beautiful little things. I will miss these programming contests forever...
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com2tag:blogger.com,1999:blog-3675582796619590206.post-65952135716081067582013-11-27T17:32:00.001+06:002014-08-08T15:27:44.423+06:00Various Usage of B.I.T.<div align="justify">
<p>I’ve always imagined what BIT (I will omit the dots, but don't confuse it with binary bits) can do and can’t. I have seen numerous times, experienced solvers say “Oh it’s easily solvable using BIT” leaving me wondering, “BIT on this problem! How on earth!” Still I haven’t found quite a good answer for this question. Looks like BIT can do as much as you can imagine it to do (and obviously design it to do so).</p>
<p>However, I am not going to explain the structure of BIT or how it works etc. As there are lots of well documented articles available on the net. I can’t help putting one specific link here, which is a <a href="http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=binaryIndexedTrees" target="_blank">TopCoder algorithm tutorial for BIT</a>. So, if you are not familiar with BIT yet, first go ahead, and read that post.</p>
<p>In this post, we will discuss some of the most common application of BIT for solving data structure related problems, more specifically, where range sum updates and queries are involved.</p>
<p>Some methods used in this post:<br/><u>Update(x, v):</u> Adds V at the position x in BIT.<br/><u>Query(x):</u> Returns the cumulative value on position x in BIT.<br/>Read the above tutorial to know how these methods are implemented.<br/>We will be using 1-based indexing throughout the post.</p>
<h4>(I) Point Update, Range Query:</h4>
<p>This is the most common form of BIT, and just about 99% of online tutorials you will find on the net will describe this application. So here we don't have much to say. If your updates are like “Add v in the x position of the array”, and queries are like “What is the sum of elements in index range [a, b] in the array?”, then all you do for update is call Update(x, v) and answer queries by Query(b) - Query(a-1). Simple cumulative sum formula, nothing really astonishing. This problem is can be solved using BIT: <a href="http://www.spoj.com/problems/MSE06H/" target="_blank">SPOJ - MSE06H</a>.</p>
<h4>(II) Range Update, Point Query:</h4>
<p>Although not something you see every now and then, but it's readily doable. Now you are required to update v over the range [a, b] and the query is performed on a single index x. So now you call update twice, first add v at index a, then remove v for indices larger than b, which is: Update(a, v); Update(b+1, -v); And for query, you simply call Query(x). Now to see why this works, the following reasoning can be made:</p>
<p>Lets consider, initially you have everything 0. So Query(x) will return 0, no matter what index you call it with. Suppose you have called Update(a, v) and Update(b+1, -v). Now what will happen if you call Query(x)? Three cases can arise:<br/>
1. if x < a, the query is not affected by the updates. So you get correct result.<br/>
2. if x > b, x will be affected by the update(a, v) since x ≥ a, and update(b+1, -v) since x ≥ b+1, therefore, v-v=0 so everything cancels out. Again, you get the correct result.<br/>
3. a ≤ x ≤ b. x is only affected by update(a, v), but not update(b+1, -v), therefore, Query(x)'s value is increased by v, and it will return the correct result.</p>
<p>As we can see, in this fashion, we can increment or decrement for a range [a, b], and get a single index effect for some index x. This problem is an example: <a href="http://www.spoj.com/problems/UPDATEIT/" target="_blank">SPOJ - UPDATEIT</a></p>
<h4>(III) Range Update, Range Query:</h4>
<p>I didn't even know it exists until I read some post in TopCoder forums (the post was made by: <a href="http://www.topcoder.com/tc?module=MemberProfile&cr=22647580" target="_blank" style="color:#d4d400;font-weight:bold">AnilKishore</a>).</p>
<p>I will just re-state his explanation as it was quite clear itself. All we want here is to support range updates, and do range queries. As from the previous type, if we try to store range updates, the BIT structure effectively captures updates for single positions, instead of range/cumulative sums. However, we can do some tweaking to work around this problem.</p>
<p>Let's just consider only one update: Add v to [a, b] while the rest elements of the array is 0.<br/>
Now, consider sum(0, x) for all possible x, again three situation can arise:<br/>
1. 0 ≤ x < a : which results in 0<br/>
2. a ≤ x ≤ b : we get v * (x - (a-1))<br/>
3. b < x < n : we get v * (b - (a-1))<br/>
</p>
<p>This suggests that, if we can find v*x for any index x, then we can get the sum(0, x) by subtracting T from it, where:<br/>
1. 0 ≤ x < : Sum should be 0, thus, T = 0<br/>
2. a ≤ x ≤ : Sum should be v*x-v*(a-1), thus, T = v*(a-1)<br/>
3. b < x < n : Sum should be 0, thus, T = -v*b + v*(a-1)<br/>
</p>
<p>As, we can see, knowing T solves our problem, we can use another BIT to store this additive amount from which we can get:<br/>
0 for x < a, v*(a-1) for x in [a..b], -v*b+v(a-1) for x > b.</p>
<p>Now we have two BITs.<br/>
To add v in range [a, b]: Update(a, v), Update(b+1, -v) in the first BIT and Update(a, v*(a-1)) and Update(b+1, -v*b) on the second BIT.<br/>
To get sum in range [0, x]: you simply do Query_BIT1(x)*x - Query_BIT2(x);<br/>
Now you know how to find range sum for [a, b]. Just find sum(b) - sum(a-1) using the formula stated above.</p>
<p>Pretty impressive this one! <a href="http://www.spoj.com/problems/HORRIBLE/" target="_blank">SPOJ - HORRIBLE</a> can be solved in this approach. And thanks to Iqram Mahmud for this nice problem.</p>
<h4>(IV) 2D BIT</h4>
<p>How to write Update and Query methods for 2D BIT is well described in the TopCoder tutorial I've mentioned above. The only thing to notice here is how the queries and updates work. 2D BIT is basically a BIT where each element is another BIT. Adding v on (x, y) means it's effect will be found throughout the rectangle [(x, y), (W, H)], and query for (x, y) gives you the result of the rectangle [(0, 0), (x, y)], assuming the total rectangle is [(0, 0), (W, H)]. SO when you query and update on this BIT, you have to be careful about how many times you are subtracting a rectangle and adding it. Simple set union formula works here. So if you want to get the result of a specific rectangle [(x1, y1), (x2, y2)], the following steps are necessary to do so:<br/>
V = Query(x2, y2)<br/>
V -= Query(x2, y1-1)<br/>
V -= Query(x1-1, y2)<br/>
V += Query(x1-1, y1-1)</p>
<p>This problem is an example: <a href="http://www.spoj.com/problems/MATSUM/" target="_blank">SPOJ - MATSUM</a></p>
<p>This page is likely to be updated if I find and manage to solve new types of BIT problems. Please let me know if there are mistakes. This post is inspired by some random posts lying around in TopCoder forums, I just wanted to put them in one place for future reference.</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com29tag:blogger.com,1999:blog-3675582796619590206.post-53604613713694503312013-10-27T00:53:00.002+06:002013-10-27T00:55:48.314+06:00Set Apache Document Root (Windows)<div align="justify">
<p>I always forget how to set virtual host or more than one document root in Apache server, this is just to remind myself about the changes in httpd.conf file.</p>
<p>Usually the document root is set as default to the www directory of your Apache installation, which Apache keeps listening on port 80. If you create your projects just within the www directory, you can pretty much access it with http://localhost/mypage.php (considering your page is called mypage.php). This looks more like working with a real website where http://localhost/ will be replaced by your registered domain name or ip address. However, if you make sub-directories inside your www directory, you will have to access them as http://localhost/mydirectory/mypage.php, but we don't want to write the specific directories separately from the base domain name, so one way to get around it is to tell your Apache to make 'mydirectory' another document root, so that you can access the pages in a 'more realistic' manner.</p>
<p>Now to keep things clean, we will assign new port numbers to each virtual document root other than the www directory which is listened to port 80. So, if we assign port 8080 to our new document root 'mydirectory', we can now access mypage.php using the url http://localhost:8080/mypage.php which is much better than the previous one and it will cost you less setup hassles when you deploy the project in an actual server.</p>
<p>Here what you need to add to your Apache's httpd.conf file:</p>
<pre class="prettyprint">
Listen 8080
NameVirtualHost *:8080
<VirtualHost *:8080>
ServerName localhost
DocumentRoot "D:/wamp/www/mydirectory" #example path yo your new document root directory
</VirtualHost>
</pre>
<p>Don't forget to restart your Apache server.
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com0tag:blogger.com,1999:blog-3675582796619590206.post-21034787283817531162013-09-20T01:32:00.001+06:002013-09-20T01:42:17.190+06:00Java: Get Instance of Inner Class<div align="justify">
<p>Today my good unpredictable friend <a href="https://plus.google.com/u/0/110616153185018715734/">Mishuk</a> gave me a piece of Java code which is full of nested classes. I was not surprised at all as I already know his love for inner classes. Then he asked me whether it is possible to call a method from the innermost class, i.e. is it possible to get an instance of the nested classes. At first I thought how hard could it be, but it eventually turned out to be thought provoking. It was not as straight forward for me as I thought (I won't deny, I know a very little Java, which is why this little bit of trick had surprised me). So I just wanted to put it up here for future references.</p>
<p>The class he gave me follows:</p>
<pre class="prettyprint linenums">
class A {
String name="A";
public class B {
String name="B";
public class C {
String name= "C";
public void print(String name){
System.out.println(name);
System.out.println(C.this.name);
System.out.println(B.this.name);
System.out.println(A.this.name);
}
}
}
}
</pre>
<p>As there was a restriction that the above code can't be modified, the only way to do this is to somehow get instances in a hierarchical manner. Because you cannot get instances of B without creating an instance of A and so on. But Java has a cool thing called reflection, and using reflection, it is possible to get instances from the inner class as well. So here is how the print() method from class C can be called. The idea is to create instances following the hierarchical order and then use the last one. Now it seems easy!</p>
<pre class="prettyprint linenums">
import java.lang.reflect.*;
class Main {
public static void main(String[] args) throws Exception {
Class<A.B> classAB = A.B.class;
Class<A.B.C> classABC = A.B.C.class;
Constructor<A.B> constructorAB = classAB.getConstructor(A.class);
Constructor<A.B.C> constructorABC = classABC.getConstructor(A.B.class);
A instanceA = new A();
A.B instanceAB = constructorAB.newInstance(instanceA);
A.B.C instanceABC = constructorABC.newInstance(instanceAB);
instanceABC.print("JAVA SUCKS WITHOUT REFLECTION");
}
}
</pre>
<p>Oh, one more thing, for those who don't know this yet and too lazy to run some Java codes, here is the output:</p>
<pre class="prettyprint">
JAVA SUCKS WITHOUT REFLECTION
C
B
A
</pre>
<p>Yah I know this may be done in hundreds of different ways and exceptions should be handled and and and and .... who cares?</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com2tag:blogger.com,1999:blog-3675582796619590206.post-1921853260330057812013-07-03T11:19:00.001+06:002013-07-03T11:45:55.872+06:00Simple Chat Program in C (Part 3)<div align="justify">
<p>Read <a href="http://zobayer.blogspot.com/2013/07/simple-chat-program-in-c-part-2.html" target="_blank">Part 2 : The Client</a></p>
<h3>Sample Execution:</h3>
<pre class="prettyprint">
$ gcc server.c -o server -lpthread
$ gcc client.c -o client -lpthread
</pre>
<p>Now we run the server program and several client programs</p>
<p>Each client should first connect to the server by typing in:
<pre class="prettyprint">login [alias]</pre>
Here [alias] is optional, if it is not mentioned, the name will be set as Anonymous.</p>
<p>The name can be changed by the command:
<pre class="prettyprint">alias [new_name]</pre>
After this, you alias will be changed to the new name you have given.</p>
<p>To send a message to everyone connected at the moment:
<pre class="prettyprint">send [message]</pre></p>
<p>To send a message to a specific alias:
<pre class="prettyprint">whisp [user_alias] [message]</pre>
If the target alias is not active at that moment, message will not be sent anywhere</p>
<p>You can disconnect from the server by typing:
<pre class="prettyprint">logout</pre>
You can again reconnect by using the login command</p>
<p>You can terminate the client by typing:
<pre class="prettyprint">exit</pre></p>
<p>This is pretty much of it. Basically this is good for your C lab assignments regarding TCP / socket based chat clients. Here is a screen shot from my computer:</p>
<div align="center"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxbLolsatHTz8r1irbQVGBh_HUt3Lhyphenhyphen1aK8fYIHJNQr93jFbjcSVM2__Iadl8XPV8IiBBfOxC6nLktEhnc5N6pgV_N9VFFM8NOrGEDwQnaO36E-uIu77-Sy1XXPiZLu9n2WHV416gMwj8Z/s1366/Screenshot+from+2013-07-03+11%253A09%253A09.png" imageanchor="1"><img width="800" style="border-style:solid;border-width:0 0 1px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxbLolsatHTz8r1irbQVGBh_HUt3Lhyphenhyphen1aK8fYIHJNQr93jFbjcSVM2__Iadl8XPV8IiBBfOxC6nLktEhnc5N6pgV_N9VFFM8NOrGEDwQnaO36E-uIu77-Sy1XXPiZLu9n2WHV416gMwj8Z/s1366/Screenshot+from+2013-07-03+11%253A09%253A09.png" /><br/>[ click to enlarge ]</a></div>
<p>Good luck!</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com12tag:blogger.com,1999:blog-3675582796619590206.post-13902515223224774562013-07-03T09:25:00.000+06:002013-07-03T11:22:00.821+06:00Simple Chat Program in C (Part 2)<div align="justify">
<p>Read <a href="http://zobayer.blogspot.com/2013/06/socket-programming-in-c-pthread.html" target="_blank">Part 1 : The server</a></p>
<h3>The client program</h3>
<p>The client program basically communicates with other client program, to run multiple clients, just open a terminal for each client. The client is command driven in this code, that is you have to enter command strings. Just read the code and you will see what it is expecting from you. The code is pretty simple.</p>
<pre class="prettyprint linenums">
/*
** Author: Zobayer Hasan
** Date: 26th February, 2010
** Copyright: NO COPYRIGHT ISSUES. However, do not copy it.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <netdb.h>
#include <unistd.h>
#include <pthread.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#define SERVERIP "127.0.0.1"
#define SERVERPORT 8080
#define BUFFSIZE 1024
#define ALIASLEN 32
#define OPTLEN 16
#define LINEBUFF 2048
struct PACKET {
char option[OPTLEN]; // instruction
char alias[ALIASLEN]; // client's alias
char buff[BUFFSIZE]; // payload
};
struct USER {
int sockfd; // user's socket descriptor
char alias[ALIASLEN]; // user's name
};
struct THREADINFO {
pthread_t thread_ID; // thread's pointer
int sockfd; // socket file descriptor
};
int isconnected, sockfd;
char option[LINEBUFF];
struct USER me;
int connect_with_server();
void setalias(struct USER *me);
void logout(struct USER *me);
void login(struct USER *me);
void *receiver(void *param);
void sendtoall(struct USER *me, char *msg);
void sendtoalias(struct USER *me, char * target, char *msg);
int main(int argc, char **argv) {
int sockfd, aliaslen;
memset(&me, 0, sizeof(struct USER));
while(gets(option)) {
if(!strncmp(option, "exit", 4)) {
logout(&me);
break;
}
if(!strncmp(option, "help", 4)) {
FILE *fin = fopen("help.txt", "r");
if(fin != NULL) {
while(fgets(option, LINEBUFF-1, fin)) puts(option);
fclose(fin);
}
else {
fprintf(stderr, "Help file not found...\n");
}
}
else if(!strncmp(option, "login", 5)) {
char *ptr = strtok(option, " ");
ptr = strtok(0, " ");
memset(me.alias, 0, sizeof(char) * ALIASLEN);
if(ptr != NULL) {
aliaslen = strlen(ptr);
if(aliaslen > ALIASLEN) ptr[ALIASLEN] = 0;
strcpy(me.alias, ptr);
}
else {
strcpy(me.alias, "Anonymous");
}
login(&me);
}
else if(!strncmp(option, "alias", 5)) {
char *ptr = strtok(option, " ");
ptr = strtok(0, " ");
memset(me.alias, 0, sizeof(char) * ALIASLEN);
if(ptr != NULL) {
aliaslen = strlen(ptr);
if(aliaslen > ALIASLEN) ptr[ALIASLEN] = 0;
strcpy(me.alias, ptr);
setalias(&me);
}
}
else if(!strncmp(option, "whisp", 5)) {
char *ptr = strtok(option, " ");
char temp[ALIASLEN];
ptr = strtok(0, " ");
memset(temp, 0, sizeof(char) * ALIASLEN);
if(ptr != NULL) {
aliaslen = strlen(ptr);
if(aliaslen > ALIASLEN) ptr[ALIASLEN] = 0;
strcpy(temp, ptr);
while(*ptr) ptr++; ptr++;
while(*ptr <= ' ') ptr++;
sendtoalias(&me, temp, ptr);
}
}
else if(!strncmp(option, "send", 4)) {
sendtoall(&me, &option[5]);
}
else if(!strncmp(option, "logout", 6)) {
logout(&me);
}
else fprintf(stderr, "Unknown option...\n");
}
return 0;
}
void login(struct USER *me) {
int recvd;
if(isconnected) {
fprintf(stderr, "You are already connected to server at %s:%d\n", SERVERIP, SERVERPORT);
return;
}
sockfd = connect_with_server();
if(sockfd >= 0) {
isconnected = 1;
me->sockfd = sockfd;
if(strcmp(me->alias, "Anonymous")) setalias(me);
printf("Logged in as %s\n", me->alias);
printf("Receiver started [%d]...\n", sockfd);
struct THREADINFO threadinfo;
pthread_create(&threadinfo.thread_ID, NULL, receiver, (void *)&threadinfo);
}
else {
fprintf(stderr, "Connection rejected...\n");
}
}
int connect_with_server() {
int newfd, err_ret;
struct sockaddr_in serv_addr;
struct hostent *to;
/* generate address */
if((to = gethostbyname(SERVERIP))==NULL) {
err_ret = errno;
fprintf(stderr, "gethostbyname() error...\n");
return err_ret;
}
/* open a socket */
if((newfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
err_ret = errno;
fprintf(stderr, "socket() error...\n");
return err_ret;
}
/* set initial values */
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(SERVERPORT);
serv_addr.sin_addr = *((struct in_addr *)to->h_addr);
memset(&(serv_addr.sin_zero), 0, 8);
/* try to connect with server */
if(connect(newfd, (struct sockaddr *)&serv_addr, sizeof(struct sockaddr)) == -1) {
err_ret = errno;
fprintf(stderr, "connect() error...\n");
return err_ret;
}
else {
printf("Connected to server at %s:%d\n", SERVERIP, SERVERPORT);
return newfd;
}
}
void logout(struct USER *me) {
int sent;
struct PACKET packet;
if(!isconnected) {
fprintf(stderr, "You are not connected...\n");
return;
}
memset(&packet, 0, sizeof(struct PACKET));
strcpy(packet.option, "exit");
strcpy(packet.alias, me->alias);
/* send request to close this connetion */
sent = send(sockfd, (void *)&packet, sizeof(struct PACKET), 0);
isconnected = 0;
}
void setalias(struct USER *me) {
int sent;
struct PACKET packet;
if(!isconnected) {
fprintf(stderr, "You are not connected...\n");
return;
}
memset(&packet, 0, sizeof(struct PACKET));
strcpy(packet.option, "alias");
strcpy(packet.alias, me->alias);
/* send request to close this connetion */
sent = send(sockfd, (void *)&packet, sizeof(struct PACKET), 0);
}
void *receiver(void *param) {
int recvd;
struct PACKET packet;
printf("Waiting here [%d]...\n", sockfd);
while(isconnected) {
recvd = recv(sockfd, (void *)&packet, sizeof(struct PACKET), 0);
if(!recvd) {
fprintf(stderr, "Connection lost from server...\n");
isconnected = 0;
close(sockfd);
break;
}
if(recvd > 0) {
printf("[%s]: %s\n", packet.alias, packet.buff);
}
memset(&packet, 0, sizeof(struct PACKET));
}
return NULL;
}
void sendtoall(struct USER *me, char *msg) {
int sent;
struct PACKET packet;
if(!isconnected) {
fprintf(stderr, "You are not connected...\n");
return;
}
msg[BUFFSIZE] = 0;
memset(&packet, 0, sizeof(struct PACKET));
strcpy(packet.option, "send");
strcpy(packet.alias, me->alias);
strcpy(packet.buff, msg);
/* send request to close this connetion */
sent = send(sockfd, (void *)&packet, sizeof(struct PACKET), 0);
}
void sendtoalias(struct USER *me, char *target, char *msg) {
int sent, targetlen;
struct PACKET packet;
if(target == NULL) {
return;
}
if(msg == NULL) {
return;
}
if(!isconnected) {
fprintf(stderr, "You are not connected...\n");
return;
}
msg[BUFFSIZE] = 0;
targetlen = strlen(target);
memset(&packet, 0, sizeof(struct PACKET));
strcpy(packet.option, "whisp");
strcpy(packet.alias, me->alias);
strcpy(packet.buff, target);
strcpy(&packet.buff[targetlen], " ");
strcpy(&packet.buff[targetlen+1], msg);
/* send request to close this connetion */
sent = send(sockfd, (void *)&packet, sizeof(struct PACKET), 0);
}
</pre>
Compile it like this:
<pre class="prettyprint">
gcc client.c -o client -lpthread
</pre>
<p>So basically this is it. It's just a program to show and example of pthread and socket together, it will be pointless to find how poorly written this program is compared to real life chat clients, those are off the limits of this post. Also, read the main functions of the client first to understand what you need to give it as input to make it work.</p>
<p>The next part of the post describes the commands which are usable from the client program.</p>
<p>Continue to <a href="http://zobayer.blogspot.com/2013/07/simple-chat-program-in-c-part-3.html" target="_blank">Part 3 : Sample Execution</a></p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com5tag:blogger.com,1999:blog-3675582796619590206.post-10880739623586621582013-06-23T11:39:00.000+06:002013-06-23T11:50:02.462+06:00Git Cheat Sheet<div align="justify">
<h3>Most commonly used git commands</h3>
<pre class="prettyprint">
git init
# initializes an empty git in the current directory
git config -l
git config --global user.name "<your name>"
git config --global user.email "<your email>"
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git clone <git host>:/repo/<projectName>
# copy a git repository so you can add to it
git add <file1 file2>
# adds files to the staging area
git add .
# recursively add all files under current directory
git add *
# add all files in current directory only
git checkout -- <file>
# reverts back the modified file to the one in the repository
git status
# view the status of your files in the working directory and staging area
git status -s
# short form. Left column for staging area. Right column for working dir
git diff
# show diff of unstaged changes
git diff --cached
# show diff of staged changes
git diff HEAD
# show diff of all staged or unstaged changes
git commit
# records a snapshot of the staging area
git commit -a
# stage modified files before commit. Does not add new files, but removes deleted files from staging area
git commit -m 'commit message goes here'
git commit --amend
# Update the last commit message
git commit --amend --reset-author
# Use this if you have changed your user name or email with git config and want to fix this identity for previous commit
git reset --hard HEAD
# This will throw away any changes you may have added to the git index and as well as any outstanding changes you have in your working tree.
git reset HEAD
# unstage all changes that were staged. Reset staging area to HEAD
git reset HEAD -- <file1 file2>
# unstage files. Reset the file to its snapshot in HEAD
git revert HEAD
# This will create a new commit which undoes the change in HEAD (i.e. the last commit). You will need to enter the message for the new commit.
git revert HEAD^
# Git will attempt to undo the old change while leaving intact any changes made since then.
git rm <file1 file2>
# remove files from staging area and working dir
git rm --cached <files>
# remove files from staging area only
git rm -r subdir/<path>
# path = * to recursively remove subdirectories from staging area and working dir
git pull
git branch -a
git branch <branchName>
# create new local branch at your last commit. So all commits of current branch will be copied over to the new branch.
git push origin <branchName>
# push a new local branch to the server. If you do not explicitly push your new local branches, they stay in your repo and are invisible to others
git pull origin <branchName>
# pull a remote branch
git branch -d <branchName>
# delete branch. This command ensures that the changes in the branch (to be deleted) are already in the current branch.
git branch -D <branchName>
# delete branch. This command will NOT check if the changes in the branch (to be deleted) are already in the current branch.
git push origin :<branchName>
# will delete the branch on the origin remote
git branch --track <master> <origin/master>
#Add release branch??
git checkout <branchName>
# Switch the branch you are currently on
git remote
git remote show <origin>
# Lists the URL for the remote repository as well as the tracking branch information
git log <release>
git log --name-status
git log -p
git log --pretty=full
git log --no-merges
# Ignore merges
git tag -l
# list tag names
git tag -a v1.4 -m 'version 1.4'
# Create tag with annotation
git tag v1.4
# Create tag without annotation
git push --tags
# Push tags to remote
git show <tagname>
# Show tag and tagger details
#To rename a tag:
git tag NEW OLD
# First create NEW as an alias of OLD
git tag -d OLD
# Delete OLD
git push origin :OLD
# Delete OLD in remote branch
git stash
git stash apply
git stash list
git log stash@{2}
git show stash@{32}
git reflog
git reflog expire --expire=30.days refs/stash
</pre>
<p>Looking for anything else? Please refer to <a href="http://git-scm.com/documentation" target="_blank">Git Documentation</a> page.</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com4tag:blogger.com,1999:blog-3675582796619590206.post-90684445560145549752013-06-21T02:11:00.000+06:002013-07-03T09:30:05.988+06:00Simple Chat Program in C (Part 1)<div align="justify">
<h3>A multi-threaded chat client in C using socket and pthread library</h3>
<p>I wrote this code years ago, putting it here because some people may want to get some help in writing server client programs in C using socket programming.</p>
<p>The server and client programs have a few features that you might want to take a look at. I am not going to explain the functionalities here, you can get that fairly easily by just going through the codes, they are bit long, but quite self explanatory. Ask in the comment area if you have any confusion.</p>
<h3>The server program</h3>
<p>The server basically waits for clients to connect and start passing message among them. Whenever a client connects to this server, it creates a thread to handle the new client, this way, it does not block other clients from connecting. Also the server can take a few commands such as whether you want to exit or not. Here is the source code of the server:</p>
<pre class="prettyprint linenums">
/*
** Author: Zobayer Hasan
** Date: 26th February, 2010
** Copyright: NO COPYRIGHT ISSUES. However, do not copy it.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <netdb.h>
#include <unistd.h>
#include <pthread.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#define IP "127.0.0.1"
#define PORT 8080
#define BACKLOG 10
#define CLIENTS 10
#define BUFFSIZE 1024
#define ALIASLEN 32
#define OPTLEN 16
struct PACKET {
char option[OPTLEN]; // instruction
char alias[ALIASLEN]; // client's alias
char buff[BUFFSIZE]; // payload
};
struct THREADINFO {
pthread_t thread_ID; // thread's pointer
int sockfd; // socket file descriptor
char alias[ALIASLEN]; // client's alias
};
struct LLNODE {
struct THREADINFO threadinfo;
struct LLNODE *next;
};
struct LLIST {
struct LLNODE *head, *tail;
int size;
};
int compare(struct THREADINFO *a, struct THREADINFO *b) {
return a->sockfd - b->sockfd;
}
void list_init(struct LLIST *ll) {
ll->head = ll->tail = NULL;
ll->size = 0;
}
int list_insert(struct LLIST *ll, struct THREADINFO *thr_info) {
if(ll->size == CLIENTS) return -1;
if(ll->head == NULL) {
ll->head = (struct LLNODE *)malloc(sizeof(struct LLNODE));
ll->head->threadinfo = *thr_info;
ll->head->next = NULL;
ll->tail = ll->head;
}
else {
ll->tail->next = (struct LLNODE *)malloc(sizeof(struct LLNODE));
ll->tail->next->threadinfo = *thr_info;
ll->tail->next->next = NULL;
ll->tail = ll->tail->next;
}
ll->size++;
return 0;
}
int list_delete(struct LLIST *ll, struct THREADINFO *thr_info) {
struct LLNODE *curr, *temp;
if(ll->head == NULL) return -1;
if(compare(thr_info, &ll->head->threadinfo) == 0) {
temp = ll->head;
ll->head = ll->head->next;
if(ll->head == NULL) ll->tail = ll->head;
free(temp);
ll->size--;
return 0;
}
for(curr = ll->head; curr->next != NULL; curr = curr->next) {
if(compare(thr_info, &curr->next->threadinfo) == 0) {
temp = curr->next;
if(temp == ll->tail) ll->tail = curr;
curr->next = curr->next->next;
free(temp);
ll->size--;
return 0;
}
}
return -1;
}
void list_dump(struct LLIST *ll) {
struct LLNODE *curr;
struct THREADINFO *thr_info;
printf("Connection count: %d\n", ll->size);
for(curr = ll->head; curr != NULL; curr = curr->next) {
thr_info = &curr->threadinfo;
printf("[%d] %s\n", thr_info->sockfd, thr_info->alias);
}
}
int sockfd, newfd;
struct THREADINFO thread_info[CLIENTS];
struct LLIST client_list;
pthread_mutex_t clientlist_mutex;
void *io_handler(void *param);
void *client_handler(void *fd);
int main(int argc, char **argv) {
int err_ret, sin_size;
struct sockaddr_in serv_addr, client_addr;
pthread_t interrupt;
/* initialize linked list */
list_init(&client_list);
/* initiate mutex */
pthread_mutex_init(&clientlist_mutex, NULL);
/* open a socket */
if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
err_ret = errno;
fprintf(stderr, "socket() failed...\n");
return err_ret;
}
/* set initial values */
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(PORT);
serv_addr.sin_addr.s_addr = inet_addr(IP);
memset(&(serv_addr.sin_zero), 0, 8);
/* bind address with socket */
if(bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(struct sockaddr)) == -1) {
err_ret = errno;
fprintf(stderr, "bind() failed...\n");
return err_ret;
}
/* start listening for connection */
if(listen(sockfd, BACKLOG) == -1) {
err_ret = errno;
fprintf(stderr, "listen() failed...\n");
return err_ret;
}
/* initiate interrupt handler for IO controlling */
printf("Starting admin interface...\n");
if(pthread_create(&interrupt, NULL, io_handler, NULL) != 0) {
err_ret = errno;
fprintf(stderr, "pthread_create() failed...\n");
return err_ret;
}
/* keep accepting connections */
printf("Starting socket listener...\n");
while(1) {
sin_size = sizeof(struct sockaddr_in);
if((newfd = accept(sockfd, (struct sockaddr *)&client_addr, (socklen_t*)&sin_size)) == -1) {
err_ret = errno;
fprintf(stderr, "accept() failed...\n");
return err_ret;
}
else {
if(client_list.size == CLIENTS) {
fprintf(stderr, "Connection full, request rejected...\n");
continue;
}
printf("Connection requested received...\n");
struct THREADINFO threadinfo;
threadinfo.sockfd = newfd;
strcpy(threadinfo.alias, "Anonymous");
pthread_mutex_lock(&clientlist_mutex);
list_insert(&client_list, &threadinfo);
pthread_mutex_unlock(&clientlist_mutex);
pthread_create(&threadinfo.thread_ID, NULL, client_handler, (void *)&threadinfo);
}
}
return 0;
}
void *io_handler(void *param) {
char option[OPTLEN];
while(scanf("%s", option)==1) {
if(!strcmp(option, "exit")) {
/* clean up */
printf("Terminating server...\n");
pthread_mutex_destroy(&clientlist_mutex);
close(sockfd);
exit(0);
}
else if(!strcmp(option, "list")) {
pthread_mutex_lock(&clientlist_mutex);
list_dump(&client_list);
pthread_mutex_unlock(&clientlist_mutex);
}
else {
fprintf(stderr, "Unknown command: %s...\n", option);
}
}
return NULL;
}
void *client_handler(void *fd) {
struct THREADINFO threadinfo = *(struct THREADINFO *)fd;
struct PACKET packet;
struct LLNODE *curr;
int bytes, sent;
while(1) {
bytes = recv(threadinfo.sockfd, (void *)&packet, sizeof(struct PACKET), 0);
if(!bytes) {
fprintf(stderr, "Connection lost from [%d] %s...\n", threadinfo.sockfd, threadinfo.alias);
pthread_mutex_lock(&clientlist_mutex);
list_delete(&client_list, &threadinfo);
pthread_mutex_unlock(&clientlist_mutex);
break;
}
printf("[%d] %s %s %s\n", threadinfo.sockfd, packet.option, packet.alias, packet.buff);
if(!strcmp(packet.option, "alias")) {
printf("Set alias to %s\n", packet.alias);
pthread_mutex_lock(&clientlist_mutex);
for(curr = client_list.head; curr != NULL; curr = curr->next) {
if(compare(&curr->threadinfo, &threadinfo) == 0) {
strcpy(curr->threadinfo.alias, packet.alias);
strcpy(threadinfo.alias, packet.alias);
break;
}
}
pthread_mutex_unlock(&clientlist_mutex);
}
else if(!strcmp(packet.option, "whisp")) {
int i;
char target[ALIASLEN];
for(i = 0; packet.buff[i] != ' '; i++); packet.buff[i++] = 0;
strcpy(target, packet.buff);
pthread_mutex_lock(&clientlist_mutex);
for(curr = client_list.head; curr != NULL; curr = curr->next) {
if(strcmp(target, curr->threadinfo.alias) == 0) {
struct PACKET spacket;
memset(&spacket, 0, sizeof(struct PACKET));
if(!compare(&curr->threadinfo, &threadinfo)) continue;
strcpy(spacket.option, "msg");
strcpy(spacket.alias, packet.alias);
strcpy(spacket.buff, &packet.buff[i]);
sent = send(curr->threadinfo.sockfd, (void *)&spacket, sizeof(struct PACKET), 0);
}
}
pthread_mutex_unlock(&clientlist_mutex);
}
else if(!strcmp(packet.option, "send")) {
pthread_mutex_lock(&clientlist_mutex);
for(curr = client_list.head; curr != NULL; curr = curr->next) {
struct PACKET spacket;
memset(&spacket, 0, sizeof(struct PACKET));
if(!compare(&curr->threadinfo, &threadinfo)) continue;
strcpy(spacket.option, "msg");
strcpy(spacket.alias, packet.alias);
strcpy(spacket.buff, packet.buff);
sent = send(curr->threadinfo.sockfd, (void *)&spacket, sizeof(struct PACKET), 0);
}
pthread_mutex_unlock(&clientlist_mutex);
}
else if(!strcmp(packet.option, "exit")) {
printf("[%d] %s has disconnected...\n", threadinfo.sockfd, threadinfo.alias);
pthread_mutex_lock(&clientlist_mutex);
list_delete(&client_list, &threadinfo);
pthread_mutex_unlock(&clientlist_mutex);
break;
}
else {
fprintf(stderr, "Garbage data from [%d] %s...\n", threadinfo.sockfd, threadinfo.alias);
}
}
/* clean up */
close(threadinfo.sockfd);
return NULL;
}
</pre>
Compile it like this:
<pre class="prettyprint">
gcc server.c -o server -lpthread
</pre>
<p>Continue to <a href="http://zobayer.blogspot.com/2013/07/simple-chat-program-in-c-part-2.html" target="_blank">Part 2 : The Client</a></p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com25tag:blogger.com,1999:blog-3675582796619590206.post-46575003957631139892013-04-02T13:24:00.000+06:002013-04-02T14:39:52.377+06:00SPOJ FINDPRM<div align="justify">
<h3><a href="" target="_blank">SPOJ Problem Set (Classical) 5970. Finding Primes</a></h3>
<p>Fun problem! First it wants you to run a sieve from 2 to N, and then do the similar operations starting from N to 2, except, this time, you have to mark the factors of N and then find the next largest N1 not yet marked, then mark factors of N1 and so on... Finally, you have to tell how many numbers will be unmarked by both algorithms up to N.</p>
<p>First observation is, you only need to consider those numbers which are primes, so, we can run a sieve up to 10<sup>7</sup>, which will allow us to test whether a number is prime or not in O(1) time.</p>
<p>Now, for each N, we can pre-calculate the result. Just note that, say if you know ans[n-1] and want to determine ans[n] from it, this inequality will hold |ans[n] - ans[n-1]| <= 1. Because the current N will be added as an unmarked, or there may be a number which you added in the past, will be removed by one of the factors of this N. Or, if N is not a prime, then it will be already removed by the first algorithm i.e. sieve.</p>
<p>If N is a prime number, then no N1 has removed this N already, so in this case the ans[n] = ans[n-1] + 1.</p>
<p>If N is an even number, and if N/2 was a prime, you have added that with your result, but this should be removed at this stage. So in such a case, ans[n] = ans[n-1].</p>
<p>Why don't you need to consider other factors like N/3, N/5 ... ? 2 is the only even prime factor and it can produce even numbers by multiplying other primes with it. For other primes, p = 3, 5 and so on, if N/p is prime, then N cannot be even. So the basic idea is as follows:
<pre class="prettyprint">
for( i = 2; i <= N; i++ ) {
ans[i] = ans[i - 1];
if( i is even and i/2 is prime ) ans[i] = ans[i] - 1;
if( i is prime ) ans[i] = ans[i] + 1;
}
</pre></p>
<p>I had absolutely no clue at the first glance. Really nice problem.</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com2tag:blogger.com,1999:blog-3675582796619590206.post-63793474668612958652013-03-25T02:10:00.001+06:002013-04-02T13:05:04.210+06:00SPOJ PRHYME<div align="justify">
<h3><a href="http://www.spoj.com/problems/PRHYME/" target="_blank">SPOJ Problem Set (classical) 2737. Perfect Rhyme</a></h3>
<div align="center"><blockquote>
A perfect rhyme is not a crime,<br/>
it is something that exceeds time,<br/>
a bit of science, a piece of art,<br/>
soft as a pillow, sharp as a dart.<br/>
</blockquote></div>
<p>I really love this little rhyme.</p>
<p>Basically the problem is, you are given a dictionary of words, and some query words. For each query word q, you have to find a dictionary word u such that, u != q and the common suffix of q and u are of maximum length possible. In case there is a tie, the problem requires the lexicographically smallest such word.</p>
<p>This problem can be solved using STL maps and storing the suffixes along with their sorted id, but there is a more elegant solution using Trie data structure, i.e. prefix tree. As we are interested in maximizing common suffix length, we can store the strings in the Trie in reversed form, so now the suffixes will become prefixes in this tree. For each dictionary word, we also need to store its index number, when sorted, as a termination marker for that word, so that, we can find the id of an word easily during the query. On each node, we also need to keep two additional information, the ids of lexicographically smallest and second smallest strings passing through that node, which we call min1 and min2. Initially both should contain an infinite value.</p>
<p>Now for each query word, we also search the word in reversed form. If it is not found in the tree, i.e. a path may exist, but the end marker is not present, then the task is simple, we just return the lexicographically smallest id, which is min1, from the current node, i.e. the node which we reached while trying to match the query string.</p>
<p>But extra cares should be taken when the query string is found on the tree, because, then we have to look for another candidate, for which, we have kept min2, i.e. second lexicographically smallest index. If we can deduce that, going to node x from current node cur, if it evidently means we will end up finding the exact same word, then we can't follow that path, instead, we decide which index to return from current node cur, if its min1 index refers to the word itself, then we return min2, otherwise we return min1. And if we have no other choice but end up at the exact matching point, then we are also sure that there is at least another string which follows the same path, but does not end at our current node, i.e. at least two different words. Then depending on our query word, we select min1 or min2 from our current node.</p>
<p>So, if you know how to code a Trie, it is not really a hard one, but indeed a tricky one.</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com5tag:blogger.com,1999:blog-3675582796619590206.post-81025837874877379432013-03-24T22:06:00.000+06:002013-03-24T22:19:45.525+06:00SPOJ VONNY<div align="justify">
<h3><a href="http://www.spoj.com/problems/VONNY/" target="_blank">SPOJ Problem Set (Classical) 224. Vonny and her dominos</a></h3>
<p>This is exactly the same problem from 2006 TopCoder Collegiate Challenge, problem DominoesFinding. I am not sure whether this problem can be solved by bipartite matching algorithm or dynamic programming, probably both will run out of time limit. But it can be solved by straight forward backtracking with a little bit pruning. The backtracking idea is pretty simple, just keep track of which tiles are used (each tile must be used exactly once), and try filling the grid in row major fashion. So there is no point discussing the solution, it is better to discuss why backtracking can be used here. I am not going to write these on my own words as it has already been written, so I will repost the analysis from TopCoder</p>
<blockquote>
<h3>DominoesFinding</h3>
<h4>by <a href="http://community.topcoder.com/tc?module=MemberProfile&cr=15231364&tab=alg" target="_blank" style="color:red;">soul-net</a></h4>
<p>Backtracking. Yes, that's it. Knowing that a problem is in fact solvable with a backtracking approach is most times a matter of intuition gained with experience. Anyway, in this and some other cases, there can be found more formal estimators that the idea is in fact THE idea.</p>
<p>I'll describe a possible backtracking approach, possibly the easiest to implement, but there are other possibilities. The idea is based on the fact that all squares must be used. For example, if we take the upper-left square of the board, we can see that we must connect it with one of its two neighbors. With this in mind, we can iterate over all squares and, each time we find an unused one, we know that we must match it with one of its two (or one) remaining neighboors -- or both, if we iterate in a column-row or a row-column fashion; when we find an unused square, we know that everybody in its upper-left rectangle is already used.</p>
<p>As we do this, we go marking each used piece and only continue trying if the new piece made by each new matching is "new". In this way, if we finally get all squares to be used, we know also that all pieces are used (because we managed to get no repeats) and then, we add 1 to the counter.</p>
<p>To be sure this approach works perfectly in time, you can conduct a little experiment and run the algorithm over an empty board without the "new piece" pruning. This will show you that there are less than 1.3 million ways to divide the board (1,292,697 actually), so it is perfectly feasible to try every one of them. Of course, the pruning of the "new piece" will reduce the running time dramatically in most cases.</p>
<p>There is also a good theoretical estimator that the approach will work in time, to convince ourselves before programming anything (many programmers think this is a must). There is a total of 56 squares in the board, our algorithm does nothing for half of them (when it finds them already used) and tries 2 or less cases for the other half (the ones it finds unused). This means the total number of leaves in the search tree will be bounded by 2<sup>56/2</sup> which is roughly 256 millions. This is pretty big, but considering it is a wide margin upper bound, it can be pretty well used as a "proof" that time limits won't bother.</p>
</blockquote>
<p><a href="http://community.topcoder.com/tc?module=Static&d1=tournaments&d2=tccc06&d3=alg_room2_analysis" target="_blank">View original analysis page from TopCoder.</a></p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com2tag:blogger.com,1999:blog-3675582796619590206.post-32785532750837364792013-03-24T20:10:00.000+06:002013-03-25T02:14:44.308+06:00Practice Week #1<div align="justify">
<h3>Problems for this week:</h3>
<a href="http://www.spoj.com/problems/VONNY" target="_blank" style="font-family:courier;">SPOJ::VONNY</a><br />
<a href="http://www.spoj.com/problems/PRIMIT" target="_blank" style="font-family:courier;">SPOJ::PRIMIT</a><br />
<a href="http://www.spoj.com/problems/FINDPRM" target="_blank" style="font-family:courier;">SPOJ::FINDPRM</a><br />
<a href="http://www.spoj.com/problems/GRAPHCUT" target="_blank" style="font-family:courier;">SPOJ::GRAPHCUT</a><br />
<a href="http://www.spoj.com/problems/TPERML" target="_blank" style="font-family:courier;">SPOJ::TPERML</a><br />
<a href="http://www.spoj.com/problems/SCITIES" target="_blank" style="font-family:courier;">SPOJ::SCITIES</a><br />
<a href="http://www.spoj.com/problems/QUERYSTR" target="_blank" style="font-family:courier;">SPOJ::QUERYSTR</a><br />
<a href="http://www.spoj.com/problems/PRHYME" target="_blank" style="font-family:courier;">SPOJ::PRHYME</a><br />
<a href="http://www.spoj.com/problems/STARGATE" target="_blank" style="font-family:courier;">SPOJ::STARGATE</a><br />
<a href="http://www.spoj.com/problems/MOBIVINA" target="_blank" style="font-family:courier;">SPOJ::MOBIVINA</a><br />
<a href="http://www.spoj.com/problems/MDOLLS" target="_blank" style="font-family:courier;">SPOJ::MDOLLS</a><br />
<a href="http://www.spoj.com/problems/MA1" target="_blank" style="font-family:courier;">SPOJ::MA1</a><br />
A virtual contest using these problems is hosted on Hust. <a href="http://acm.hust.edu.cn/vjudge/contest/view.action?cid=21004" target="_blank">Follow this link</a>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com0tag:blogger.com,1999:blog-3675582796619590206.post-40254647382498266062013-03-16T13:17:00.001+06:002013-03-16T13:17:41.431+06:00SPOJ ARRAYSUB<div align="justify">
<h3><a href="http://www.spoj.com/problems/ARRAYSUB/" target="_blank">SPOJ Problem Set (Classical) 10582. Subarrays</a></h3>
<p>This was also one of the problems I was asked on my recent interview with Google. Problem is a simple one for segment tree based algorithm. The solution basically requires us to maintain a Range Maximum Query (RMQ) algorithm, and I implemented this using segment tree.</p>
<p>Given, there are N items and a window of size K, we have to find the maximum item in each K sized window. First, we insert the first K items in the RMQ, so the segment tree root now knows the maximum item at this stage. Now if you observe you will see, for the (k+1)th item, 1st item will be removed from the tree and (k+1)th item will be inserted. This can be done by inserting (k+1)th item at the position of 1st item. Because for (k+1)th item, 1st item is in the oldest position. And clearly, for each of the next items, we can just insert it in the current oldest position on the K sized window. so (k+1) will be inserted at index 1, (k+2) at 2, (k+3) at 3 ... (2k) at k, (2k+1) at 1, (2k+2) at 2 and so on. So all we need is to keep inserting the items in the RMQ in a circular fashion and each time taking the updated range maximum value.</p>
<p>So, basically the structure of the code is:
<pre class="prettyprint">
for(i = 0; i < k; i++) insert(root, 0, k-1, item[i]);
output Tree[root];
for(; i < n; i++) {
insert(root, 0, k-1, item[i % k]);
output Tree[root];
}
// considering item indexes to be 0 based in code
// insert is the function that inserts an item on a specific index in the RMQ tree
</pre>
So, once you write down the RMQ function insert, you are pretty much done with it. Happy coding!</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com5tag:blogger.com,1999:blog-3675582796619590206.post-19244848393214340312013-02-28T00:34:00.002+06:002013-02-28T02:40:51.819+06:00Euler Totient / φ Function<div align="justify">
<p>Euler Totient / Phi Function φ(n) counts the number of positive integers less than or equal to n which are relatively prime to n, i.e. do not have any common divisor with n except 1.</p>
<p>Formula for Euler Phi function:
<div align="center"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtiXPS2TcNTE3aWwBLvblfB_vbArQCYh7CrJW4M95kTPtrJRLT8GHgj7n5Zo4uLJaBuC-CWJwvursZ9Fgvpj7Du5_nhAVpTtEosAa-xa0UThm0CjUd_ukkTtz2iBOYfiEXmnVCxEjqka7O/s1600/Capture.PNG" imageanchor="1" ><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtiXPS2TcNTE3aWwBLvblfB_vbArQCYh7CrJW4M95kTPtrJRLT8GHgj7n5Zo4uLJaBuC-CWJwvursZ9Fgvpj7Du5_nhAVpTtEosAa-xa0UThm0CjUd_ukkTtz2iBOYfiEXmnVCxEjqka7O/s320/Capture.PNG" /></a></div>
Here, the product is over the distinct prime numbers which divide n. Now, you can just factorize n and calculate φ(n) pretty easily. But, will that be efficient for a task such as you are asked to find φ(n) over a range of integers?</p>
<p>If you look closely to the formula, you will see that, we multiply n with (p-1)/p for each prime p that divides n. Now recall what do we do when we run Sieve of Eratosthenes for marking primes / non-primes. On the outer loop of the sieve, we determine if a number is prime, then in inner loop, instead of setting flags, if we can keep multiplying the number with (p-1)/p where p is the current prime number from outer loop, at the end of the iterations, we can actually generate φ(n) for each n over the range we are asked for. Here is a source code example that does exactly the same thing. Just take a look and try to understand what are the loops doing here, and how we are performing calculation and storing results.</p>
<pre class="prettyprint linenums">
#include <cstdio>
const int MAX = 1000001;
int phi[MAX];
void euler_phi() {
phi[1] = 1;
for(int i=2; i<MAX; i++) {
if(!phi[i]) {
phi[i] = i-1;
for(int j=(i<<1); j<MAX; j+=i) {
if(!phi[j]) phi[j] = j;
phi[j] = phi[j]/i*(i-1);
}
}
}
}
int main() {
euler_phi();
for(int t=1; t<MAX; t++) printf("%d\n", phi[t]);
return 0;
}
</pre>
<p>A bit of explanation on what we are doing here: Initially the phi[] array is set to 0 (as it is declared global). We know that, phi[1] = 1 and phi[n] = n-1 when n is a prime number. So, similar to sieve algorithm, first we check if current number is prime in the outer loop, if phi[i] = 0, it means i is prime. So, we update it with i-1 accordingly. Now, for all the multiples of i greater than i, which starts from 2*i, calling it j in inner loop, we need to multiply phi[j] by (i-1) / i. Here, we first check if phi[j] is 0, i.e. visiting it for the first time, in this case we set it with j, as I said earlier that, for φ(n) we will multiply n with (p-1)/p where p are the primes that divide n. Also, one thing to note here: a * b / c and a / c * b are not always same for integer calculation unless you can assure that c divides a. In this case it does, why? cause this is basically a prime factoring algorithm, and c = i here. As we are traversing i's multiples, it is guaranteed that a=phi[j] can be divided by c=i and instead of a * b / c format, we will always use a / c * b in these types of situations, because it will help preventing overflow many times.</p>
<p>Now, think about the optimizations we could apply here, and try applying them, like discarding even numbers, starting inner loop from squares, increment inner loop twice the prime number each time, won't work here. Because, we need to go through every numbers in inner loop, as we are trying to find Totient function for every n in the range 1 to MAX. Test the code on smaller range, and try to check if it is doing this correctly, play around with it.</p>
</div>Zobayer Hasanhttp://www.blogger.com/profile/10946508827987290398noreply@blogger.com2