<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Shipu's Blog]]></title><description><![CDATA[Thoughts, stories and ideas.]]></description><link>https://shipuahamed.com/</link><image><url>http://shipuahamed.com/favicon.png</url><title>Shipu&apos;s Blog</title><link>https://shipuahamed.com/</link></image><generator>Ghost 4.22</generator><lastBuildDate>Tue, 07 Apr 2026 19:46:16 GMT</lastBuildDate><atom:link href="https://shipuahamed.com/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[How I setup my Development Environment on macOS 2022 Edition]]></title><description><![CDATA[<!--kg-card-begin: markdown--><h3 id="package-manager">Package Manager</h3>
<ul>
<li>Homebrew<pre><code>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;
</code></pre>
</li>
<li>NVM<pre><code>brew install nvm
</code></pre>
</li>
<li>Composer<pre><code>brew install composer
</code></pre>
</li>
</ul>
<h3 id="browsers">Browsers</h3>
<ul>
<li><a href="https://www.google.com/chrome/">Google Chrome</a>
<ul>
<li><a href="https://chrome.google.com/webstore/detail/dailydev-the-homepage-dev/jlmpjdjjbgclbocgajdjefcidcncaied">Daily Dev Plugin</a></li>
<li><a href="https://chrome.google.com/webstore/detail/adblock-%E2%80%94-best-ad-blocker/gighmmpiobklfepjocnamgkkbiglidom">AdBlock</a></li>
<li><a href="https://chrome.google.com/webstore/detail/awesome-screenshot-and-sc/nlipoenfbbikpbjkfpfillcgkoblgpmj">Awesome Screenshot and Screen Recorder</a></li>
<li><a href="https://chrome.google.com/webstore/detail/lastpass-free-password-ma/hdokiejnpimakedhajhdlcegeplioahd">LastPass</a></li>
<li><a href="https://chrome.google.com/webstore/detail/alpinejs-devtools/fopaemeedckajflibkpifppcankfmbhk">Alpine.js devtools</a></li>
<li><a href="https://chrome.google.com/webstore/detail/colorpick-eyedropper/ohcpnigalekghcmgcdcenkpelffpdolg">ColorPick Eyedropper</a></li>
<li><a href="https://chrome.google.com/webstore/detail/dotvpn-%E2%80%94-a-better-way-to/kpiecbcckbofpmkkkdibbllpinceiihk?hl=en">DotVPN &#x2014; a Better way</a></li></ul></li></ul>]]></description><link>https://shipuahamed.com/how-i-setup-my-development-environment-on-macos-2022-edition/</link><guid isPermaLink="false">621205f526d1e5142eecd1a9</guid><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Sun, 20 Feb 2022 10:06:40 GMT</pubDate><media:content url="http://shipuahamed.com/content/images/2022/02/How-I-setup-my-Development-Environment-on-macOS-2022-Edition.jpeg" medium="image"/><content:encoded><![CDATA[<!--kg-card-begin: markdown--><h3 id="package-manager">Package Manager</h3>
<ul>
<li>Homebrew<pre><code>/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;
</code></pre>
</li>
<li>NVM<pre><code>brew install nvm
</code></pre>
</li>
<li>Composer<pre><code>brew install composer
</code></pre>
</li>
</ul>
<h3 id="browsers">Browsers</h3>
<ul>
<li><a href="https://www.google.com/chrome/">Google Chrome</a>
<ul>
<li><a href="https://chrome.google.com/webstore/detail/dailydev-the-homepage-dev/jlmpjdjjbgclbocgajdjefcidcncaied">Daily Dev Plugin</a></li>
<li><a href="https://chrome.google.com/webstore/detail/adblock-%E2%80%94-best-ad-blocker/gighmmpiobklfepjocnamgkkbiglidom">AdBlock</a></li>
<li><a href="https://chrome.google.com/webstore/detail/awesome-screenshot-and-sc/nlipoenfbbikpbjkfpfillcgkoblgpmj">Awesome Screenshot and Screen Recorder</a></li>
<li><a href="https://chrome.google.com/webstore/detail/lastpass-free-password-ma/hdokiejnpimakedhajhdlcegeplioahd">LastPass</a></li>
<li><a href="https://chrome.google.com/webstore/detail/alpinejs-devtools/fopaemeedckajflibkpifppcankfmbhk">Alpine.js devtools</a></li>
<li><a href="https://chrome.google.com/webstore/detail/colorpick-eyedropper/ohcpnigalekghcmgcdcenkpelffpdolg">ColorPick Eyedropper</a></li>
<li><a href="https://chrome.google.com/webstore/detail/dotvpn-%E2%80%94-a-better-way-to/kpiecbcckbofpmkkkdibbllpinceiihk?hl=en">DotVPN &#x2014; a Better way to VPN</a></li>
<li><a href="https://chrome.google.com/webstore/detail/desktop-app-for-google-ta/lpofefdiokgmcdnnaigddelnfamkkghi?hl=en">Desktop app for Google Tasks</a></li>
<li><a href="https://chrome.google.com/webstore/detail/alpinejs-devtools/fopaemeedckajflibkpifppcankfmbhk?hl=en">Alpine.js devtools</a></li>
</ul>
</li>
<li><a href="https://www.mozilla.org/en-US/firefox/new/">Firefox</a></li>
</ul>
<h3 id="terminal">Terminal</h3>
<ul>
<li><a href="https://app.warp.dev/download/r/7QL3L2">Warp</a></li>
<li><a href="https://iterm2.com/">iTerm2</a></li>
</ul>
<h3 id="ide">IDE</h3>
<ul>
<li><a href="https://www.jetbrains.com/phpstorm/download/#section=mac">PhpStorm</a></li>
<li><a href="https://www.jetbrains.com/go/download/#section=mac">GoLand</a></li>
<li><a href="https://www.jetbrains.com/webstorm/download/#section=mac">WebStorm</a></li>
<li><a href="https://www.jetbrains.com/pycharm/download/#section=mac">PyCharm</a></li>
</ul>
<h3 id="dev-tools">Dev Tools</h3>
<ul>
<li><a href="https://docs.docker.com/desktop/mac/install/">Docker</a></li>
<li><a href="https://ohmyz.sh/">Oh My Zsh</a></li>
</ul>
<h3 id="editor">Editor</h3>
<ul>
<li><a href="https://code.visualstudio.com/download">VsCode</a></li>
<li>Vim<pre><code>brew install vim
</code></pre>
</li>
<li><a href="https://www.notion.so/">Notion</a></li>
<li><a href="https://appflowy.gitbook.io/docs/essential-documentation/install-appflowy/installation-methods/mac-windows-linux-packages">Appflowy</a> - Notion Alternative</li>
<li><a href="https://obsidian.md/download">Obsidian</a> - Markdown</li>
</ul>
<h3 id="database-client">Database Client</h3>
<ul>
<li><a href="https://www.jetbrains.com/datagrip/download/#section=mac">DataGrip</a></li>
<li><a href="https://apps.apple.com/us/app/sequel-ace/id1518036000?mt=12">Sequal Ace</a></li>
<li><a href="https://www.mongodb.com/try/download/compass">Mongodb</a></li>
</ul>
<h3 id="communications">Communications</h3>
<ul>
<li><a href="https://slack.com/">Slack</a></li>
<li><a href="https://discord.com/">Discord</a></li>
<li><a href="https://www.whatsapp.com/download">Whatsapp</a></li>
<li><a href="https://zoom.us/download">Zoom</a></li>
</ul>
<h3 id="api-platform">API Platform</h3>
<ul>
<li><a href="https://insomnia.rest/download">Insomnia</a></li>
<li><a href="https://www.postman.com/">Postman</a></li>
<li><a href="https://hoppscotch.io/">Hoppscotch</a></li>
</ul>
<h3 id="project-management">Project Management</h3>
<ul>
<li><a href="https://trello.com/">Trello</a></li>
<li><a href="https://jira.atlassian.com">Jira Atlassian</a></li>
</ul>
<h3 id="music">Music</h3>
<ul>
<li><a href="https://www.youtube.com/">Youtube</a></li>
<li><a href="https://open.spotify.com/">Spotify</a></li>
</ul>
<h3 id="cdn">CDN</h3>
<ul>
<li><a href="https://cloudinary.com/">Cloudinary</a></li>
</ul>
<h3 id="blog">Blog</h3>
<ul>
<li><a href="https://dev.to/">Devto</a></li>
<li><a href="https://medium.com">Medium</a></li>
</ul>
<h3 id="uiux">UI/UX</h3>
<ul>
<li><a href="https://www.figma.com/">Figma</a></li>
</ul>
<h3 id="server">Server</h3>
<ul>
<li><a href="https://aws.amazon.com/lightsail/">Aws LightSail</a></li>
<li><a href="https://www.digitalocean.com/">DigitalOcean</a></li>
</ul>
<h3 id="others">Others</h3>
<ul>
<li><a href="https://openvpn.net/client-connect-vpn-for-mac-os/">OpenVpn</a> - Access Server</li>
<li><a href="https://clipy-app.com/">Clipy</a> - Copy paste mangement</li>
</ul>
<!--kg-card-end: markdown-->]]></content:encoded></item><item><title><![CDATA[The Adapter Design Pattern]]></title><description><![CDATA[
Adapter Pattern বুজতে আপনার একদমই অসুবিধা হবে না কারণ আপনি জানেন Adapter Pattern কি । এখন হয়তো ভাবছেন আমি কিভাবে জানি । চলেন দেখি ।
]]></description><link>https://shipuahamed.com/the-adapter-design/</link><guid isPermaLink="false">61a0be421ddff808acb336c1</guid><category><![CDATA[Laravel]]></category><category><![CDATA[PHP]]></category><category><![CDATA[Design Pattern]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Tue, 22 Sep 2020 00:00:00 GMT</pubDate><media:content url="http://shipuahamed.com/content/images/2021/11/adapter.jpeg" medium="image"/><content:encoded><![CDATA[<img src="http://shipuahamed.com/content/images/2021/11/adapter.jpeg" alt="The Adapter Design Pattern"><p>Adapter Pattern &#x9AC;&#x9C1;&#x99C;&#x9A4;&#x9C7; &#x986;&#x9AA;&#x9A8;&#x9BE;&#x9B0; &#x98F;&#x995;&#x9A6;&#x9AE;&#x987; &#x985;&#x9B8;&#x9C1;&#x9AC;&#x9BF;&#x9A7;&#x9BE; &#x9B9;&#x9AC;&#x9C7; &#x9A8;&#x9BE; &#x995;&#x9BE;&#x9B0;&#x9A3; &#x986;&#x9AA;&#x9A8;&#x9BF; &#x99C;&#x9BE;&#x9A8;&#x9C7;&#x9A8; Adapter Pattern &#x995;&#x9BF; &#x964; &#x98F;&#x996;&#x9A8; &#x9B9;&#x9DF;&#x9A4;&#x9CB; &#x9AD;&#x9BE;&#x9AC;&#x99B;&#x9C7;&#x9A8; &#x986;&#x9AE;&#x9BF; &#x995;&#x9BF;&#x9AD;&#x9BE;&#x9AC;&#x9C7; &#x99C;&#x9BE;&#x9A8;&#x9BF; &#x964; &#x99A;&#x9B2;&#x9C7;&#x9A8; &#x9A6;&#x9C7;&#x996;&#x9BF; &#x964;</p><figure class="kg-card kg-image-card kg-card-hascaption"><img src="http://shipuahamed.com/content/images/2021/11/1-63_y516PM4AShJ_jo8_flQ-2.jpeg" class="kg-image" alt="The Adapter Design Pattern" loading="lazy" width="800" height="571" srcset="http://shipuahamed.com/content/images/size/w600/2021/11/1-63_y516PM4AShJ_jo8_flQ-2.jpeg 600w, http://shipuahamed.com/content/images/2021/11/1-63_y516PM4AShJ_jo8_flQ-2.jpeg 800w" sizes="(min-width: 720px) 720px"><figcaption>Source from&#xA0;google</figcaption></figure><p>&#x986;&#x9AA;&#x9A8;&#x9BE;&#x9B0;&#x9BE; &#x9B8;&#x9AC;&#x9BE;&#x987; &#x9AE;&#x9C7;&#x9AE;&#x9B0;&#x9BF; &#x995;&#x9BE;&#x9B0;&#x9CD;&#x9A1; &#x9A6;&#x9C7;&#x996;&#x9C7; &#x9A5;&#x9BE;&#x995;&#x9AC;&#x9C7;&#x9A8; &#x964; &#x9AF;&#x996;&#x9A8; &#x9AE;&#x9C7;&#x9AE;&#x9B0;&#x9BF; &#x995;&#x9BE;&#x9B0;&#x9CD;&#x9A1; &#x9A5;&#x9C7;&#x995;&#x9C7; &#x995;&#x9CB;&#x9A8; &#x9AB;&#x9BE;&#x987;&#x9B2; &#x986;&#x9AA;&#x9A8;&#x9BE;&#x9B0; &#x995;&#x9AE;&#x9CD;&#x9AA;&#x9BF;&#x989;&#x99F;&#x9BE;&#x9B0; &#x9AC;&#x9BE; &#x9B2;&#x9CD;&#x9AF;&#x9BE;&#x9AA;&#x99F;&#x9AA; Transfer &#x995;&#x9B0;&#x9A4;&#x9C7; &#x99A;&#x9BE;&#x9A8; &#x986;&#x9B0; &#x9AF;&#x996;&#x9A8; &#x9A6;&#x9C7;&#x996;&#x9C7;&#x9A8; &#x9AE;&#x9C7;&#x9AE;&#x9B0;&#x9BF; &#x995;&#x9BE;&#x9B0;&#x9CD;&#x9A1; &#x9A5;&#x9C7;&#x995;&#x9C7; &#x9AB;&#x9BE;&#x987;&#x9B2; Transfer &#x995;&#x9B0;&#x9BE;&#x9B0; &#x9AE;&#x9A4; &#x995;&#x9BF;&#x99B;&#x9C1;&#x987; &#x9A8;&#x9C7;&#x987; &#x995;&#x9AE;&#x9CD;&#x9AA;&#x9BF;&#x989;&#x99F;&#x9BE;&#x9B0; &#x9AC;&#x9BE; &#x9B2;&#x9CD;&#x9AF;&#x9BE;&#x9AA;&#x99F;&#x9AA; &#x9A4;&#x996;&#x9A8; &#x9A8;&#x9BF;&#x9B6;&#x9CD;&#x99A;&#x9DF; &#x986;&#x9AA;&#x9A8;&#x9BF; &#x995;&#x9BE;&#x9B0;&#x9CD;&#x9A1; &#x9B0;&#x9BF;&#x9A1;&#x9BE;&#x9B0; &#x985;&#x9A5;&#x9AC;&#x9BE; Adapter &#x9AC;&#x9CD;&#x9AF;&#x9AC;&#x9B9;&#x9BE;&#x9B0; &#x995;&#x9B0;&#x9C7;&#x99B;&#x9C7;&#x9A8; &#x964;</p><figure class="kg-card kg-gallery-card kg-width-wide"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="http://shipuahamed.com/content/images/2021/11/1-1.jpeg" width="670" height="377" loading="lazy" alt="The Adapter Design Pattern" srcset="http://shipuahamed.com/content/images/size/w600/2021/11/1-1.jpeg 600w, http://shipuahamed.com/content/images/2021/11/1-1.jpeg 670w"></div><div class="kg-gallery-image"><img src="http://shipuahamed.com/content/images/2021/11/2-1.jpeg" width="896" height="621" loading="lazy" alt="The Adapter Design Pattern" srcset="http://shipuahamed.com/content/images/size/w600/2021/11/2-1.jpeg 600w, http://shipuahamed.com/content/images/2021/11/2-1.jpeg 896w" sizes="(min-width: 720px) 720px"></div></div></div></figure><p>&#x995;&#x9BF; &#x9AC;&#x9C1;&#x99D;&#x9CB; &#x9A8;&#x9BE;&#x987; &#x9AC;&#x9CD;&#x9AF;&#x9BE;&#x9AA;&#x9BE;&#x9B0;&#x99F;&#x9BE;&#xA0;!!! &#x986;&#x9B0;&#x9C7; &#x9AC;&#x9CD;&#x9AF;&#x9BE;&#x9AA;&#x9BE;&#x9B0; &#x9A8;&#x9BE; &#x99A;&#x9B2;&#x9C7;&#x9A8; &#x986;&#x9B0;&#x993; &#x98F;&#x995;&#x99F;&#x9BE; Example &#x9A6;&#x9C7;&#x9DF;&#x9BE; &#x9AF;&#x9BE;&#x995; &#x964;</p><p>&#x9A7;&#x9B0;&#x9C1;&#x9A8; &#x986;&#x9AA;&#x9A8;&#x9BF; &#x986;&#x9AA;&#x9A8;&#x9BE;&#x9B0; Laptop &#x9A8;&#x9BF;&#x9DF;&#x9C7; &#x995;&#x9CB;&#x9A5;&#x9BE;&#x9DF; &#x998;&#x9C1;&#x9B0;&#x9A4;&#x9C7; &#x997;&#x9C7;&#x99B;&#x9C7;&#x9A8; &#x964; Laptop &#x99F;&#x9BE; &#x9AF;&#x996;&#x9A8; &#x99A;&#x9BE;&#x9B0;&#x9CD;&#x99C; &#x9A6;&#x9BF;&#x9A4;&#x9C7; &#x997;&#x9C7;&#x9B2;&#x9C7;&#x9A8;, &#x9A6;&#x9C7;&#x996;&#x9B2;&#x9C7;&#x9A8; &#x986;&#x9AA;&#x9A8;&#x9BE;&#x9B0; Laptop &#x98F;&#x9B0; &#x99A;&#x9BE;&#x9B0;&#x9CD;&#x99C;&#x9BE;&#x9B0; &#x9AA;&#x9CB;&#x9B0;&#x9CD;&#x99F; &#x9A4;&#x9BF;&#x9A8; &#x9AA;&#x9BF;&#x9A8;&#x9C7;&#x9B0; &#x964; &#x986;&#x9B0; &#x9AF;&#x9C7;&#x996;&#x9BE;&#x9A8;&#x9C7; &#x99A;&#x9BE;&#x9B0;&#x9CD;&#x99C; &#x9A6;&#x9BF;&#x9AC;&#x9C7;&#x9A8; &#x9B8;&#x9C7;&#x99F;&#x9BE;&#x9B0; &#x9AA;&#x9CB;&#x9B0;&#x9CD;&#x99F; &#x9A6;&#x9C1;&#x987; &#x9AA;&#x9BF;&#x9A8;&#x9C7;&#x9B0; &#x9A4;&#x996;&#x9A8; &#x986;&#x9AA;&#x9A8;&#x9BF; &#x995;&#x9BF; &#x995;&#x9B0;&#x9AC;&#x9C7;&#x9A8; ??</p><figure class="kg-card kg-gallery-card kg-width-wide"><div class="kg-gallery-container"><div class="kg-gallery-row"><div class="kg-gallery-image"><img src="http://shipuahamed.com/content/images/2021/11/3-1.jpeg" width="988" height="555" loading="lazy" alt="The Adapter Design Pattern" srcset="http://shipuahamed.com/content/images/size/w600/2021/11/3-1.jpeg 600w, http://shipuahamed.com/content/images/2021/11/3-1.jpeg 988w" sizes="(min-width: 720px) 720px"></div><div class="kg-gallery-image"><img src="http://shipuahamed.com/content/images/2021/11/4-1.jpeg" width="556" height="556" loading="lazy" alt="The Adapter Design Pattern"></div><div class="kg-gallery-image"><img src="http://shipuahamed.com/content/images/2021/11/5-1.png" width="576" height="700" loading="lazy" alt="The Adapter Design Pattern"></div></div></div></figure><!--kg-card-begin: html--><div style="display:flex">
     <div style="flex:1;padding-right:5px;">
          <img src="https://miro.medium.com/max/1000/1*6ZqJuu29hOfIsIu4xX-08g.jpeg" alt="The Adapter Design Pattern">
     </div>
     <div style="flex:1;padding-left:5px;">
         <br>
         <br>
         <br>
              &#x9A8;&#x9BF;&#x9B6;&#x9CD;&#x99A;&#x9DF; &#x98F;&#x995;&#x99F;&#x9BE; Adapter &#x987;&#x989;&#x99C; &#x995;&#x9B0;&#x9AC;&#x9C7;&#x9A8; &#x964; Adapter pattern &#x993; &#x98F;&#x995;&#x9BF; &#x9B0;&#x995;&#x9AE;, &#x9AC;&#x9CD;&#x9AF;&#x9A4;&#x9BF;&#x995;&#x9CD;&#x9B0;&#x9AE; &#x995;&#x9BF;&#x99B;&#x9C1; &#x9A8;&#x9BE; &#x964; &#x9A4;&#x9BE;&#x9B9;&#x9B2;&#x9C7; &#x99A;&#x9B2;&#x9C1;&#x9A8; &#x9A6;&#x9C7;&#x996;&#x9BF; Adapter Pattern &#x995;&#x9BF;&#x9AD;&#x9BE;&#x9AC;&#x9C7; Implement &#x995;&#x9B0;&#x9BE; &#x9AF;&#x9BE;&#x9DF; &#x964;
     </div>
</div><!--kg-card-end: html--><hr><p>&#x9B6;&#x9C1;&#x9B0;&#x9C1;&#x9A4;&#x9C7;&#x987; &#x98F;&#x995;&#x99F;&#x9BE; Problem &#x9A8;&#x9BF;&#x9DF;&#x9C7; &#x986;&#x9B2;&#x9CB;&#x99A;&#x9A8;&#x9BE; &#x995;&#x9B0;&#x9BF; &#x964; &#x9A7;&#x9B0;&#x9C1;&#x9A8; &#x986;&#x9AA;&#x9A8;&#x9BE;&#x9B0; &#x98F;&#x995;&#x99F;&#x9BE; website &#x986;&#x99B;&#x9C7; &#x98F;&#x9AC;&#x982; &#x995;&#x9BF;&#x99B;&#x9C1; &#x987;&#x989;&#x99C;&#x9BE;&#x9B0;&#x993; &#x986;&#x99B;&#x9C7; &#x9A4;&#x9BE;&#x9A6;&#x9C7;&#x9B0; Facebook &#x9AB;&#x9CD;&#x9B0;&#x9C7;&#x9A8;&#x9CD;&#x9A1;&#x9B8; &#x98F;&#x9AC;&#x982; &#x995;&#x9A4;&#x997;&#x9C1;&#x9B2;&#x9CB; &#x9AA;&#x9CB;&#x9B8;&#x9CD;&#x99F; &#x995;&#x9B0;&#x9C7;&#x99B;&#x9C7; &#x9B8;&#x9C7;&#x99F;&#x9BE; &#x99C;&#x9BE;&#x9A8;&#x9A4;&#x9C7; &#x99A;&#x9BE;&#x9A8; &#x964; &#x9A6;&#x9C7;&#x996;&#x9BE; &#x9AF;&#x9BE;&#x995; &#x9A4;&#x9BE;&#x9B9;&#x9B2;&#x9C7; &#x995;&#x9BF;&#x9AD;&#x9BE;&#x9AC;&#x9C7; &#x995;&#x9B0;&#x9BE; &#x9AF;&#x9BE;&#x9DF; &#x964;</p><pre><code>class Facebook
{
    public function getFriends()
    {
        var_dump(&#x201C;get all facebook friends&#x201D;);
    }

    public function getPosts()
    {
        var_dump(&#x201C;get all facebook posts&#x201D;);
    }
}

class Person
{
    public function social( $social )
    {
        $social-&gt;getPosts();
        $social-&gt;getFriends();
    }
}

$person = new Person();
$person-&gt;social(new Facebook());</code></pre><p>&#x98F;&#x987;&#x9A4;&#x9CB; &#x9B9;&#x9DF;&#x9C7; &#x997;&#x9C7;&#x99B;&#x9C7;, &#x996;&#x9C1;&#x9AC; &#x9B8;&#x9B9;&#x99C; &#x9A8;&#x9BE; &#x964; &#x995;&#x9BF;&#x9A8;&#x9CD;&#x9A4;&#x9C1; &#x98F;&#x987; &#x9AE;&#x9C1;&#x9B9;&#x9C2;&#x9B0;&#x9CD;&#x9A4;&#x9C7; &#x986;&#x9AA;&#x9BE;&#x9A8;&#x9BE;&#x9B0; &#x9AC;&#x9B8; &#x98F;&#x9B8;&#x9C7; &#x986;&#x9AA;&#x9A8;&#x9BE;&#x995;&#x9C7; &#x9AC;&#x9B2;&#x9B2; &#x989;&#x9A8;&#x9BF; twitter -&#x98F;&#x9B0; &#x9B8;&#x995;&#x9B2; Followers and Tweets &#x993; &#x99C;&#x9BE;&#x9A8;&#x9A4;&#x9C7; &#x99A;&#x9BE;&#x9DF; &#x964; &#x98F;&#x987; &#x9B6;&#x9C1;&#x9A8;&#x9C7; &#x986;&#x9AA;&#x9A8;&#x9BF; &#x9B9;&#x9DF;&#x9A4;&#x9CB; &#x9AE;&#x9A8;&#x9C7; &#x9AE;&#x9A8;&#x9C7; &#x9AC;&#x9B2;&#x9AC;&#x9C7;&#x9A8; &#x986;&#x997;&#x9C7; &#x9AC;&#x9B2;&#x9A4;&#x9C7; &#x995;&#x9BF; &#x9B9;&#x9DF;&#x9C7;..&#x99B;&#x9BF;..&#x9B2;&#x9CB; &#x997;&#x9CB; &#x9AE;&#x9A8;&#x9C1; &#x964; &#x9A7;&#x9B0;&#x9C7; &#x9A8;&#x9BF;&#x99A;&#x9CD;&#x99B;&#x9BF; &#x986;&#x9AA;&#x9A8;&#x9BF; &#x986;&#x9AC;&#x9BE;&#x9B0; &#x98F;&#x995;&#x99F;&#x9C1; &#x99A;&#x9BE;&#x9B2;&#x9BE;&#x995; &#x9AA;&#x9CD;&#x9B0;&#x995;&#x9C3;&#x9A4;&#x9BF;&#x9B0; &#x986;&#x9AA;&#x9A8;&#x9BF; &#x9AC;&#x9C1;&#x99D;&#x9A4;&#x9C7; &#x9AA;&#x9BE;&#x9B0;&#x99B;&#x9C7;&#x9A8; &#x9AF;&#x9C7; &#x9B8;&#x9BE;&#x9AE;&#x9A8;&#x9C7; &#x986;&#x9B0;&#x993; &#x99A;&#x9C7;&#x99E;&#x9CD;&#x99C; &#x986;&#x9B8;&#x9A4;&#x9C7; &#x9AA;&#x9BE;&#x9B0;&#x9C7; &#x964; &#x9A4;&#x9BE;&#x987; &#x98F;&#x9AE;&#x9A8; &#x995;&#x9BF;&#x99B;&#x9C1; &#x99A;&#x9BE;&#x99A;&#x9CD;&#x99B;&#x9C7;&#x9A8; &#x9AF;&#x9C7; &#x9B8;&#x9BE;&#x9AE;&#x9A8;&#x9C7; &#x98F;&#x9AE;&#x9A8; &#x995;&#x9BF;&#x99B;&#x9C1; &#x986;&#x9AC;&#x9BE;&#x9B0; &#x986;&#x9B8;&#x9B2;&#x9C7; &#x986;&#x9AA;&#x9A8;&#x9BF; &#x9AF;&#x9C7;&#x9A8; &#x9B8;&#x9B9;&#x99C;&#x9C7; &#x9B8;&#x9BE;&#x9AE;&#x9BE;&#x9B2; &#x9A6;&#x9BF;&#x9A4;&#x9C7; &#x9AA;&#x9BE;&#x9B0;&#x9C7;&#x9A8; &#x964; &#x986;&#x9B0; &#x9B8;&#x9C7;&#x987; &#x99C;&#x9A8;&#x9CD;&#x9AF;&#x987; &#x9AE;&#x9C2;&#x9B2;&#x9A4; &#x986;&#x9AE;&#x9B0;&#x9BE; &#x986;&#x99C;&#x995;&#x9C7; Adapter Pattern &#x9B6;&#x9BF;&#x996;&#x99B;&#x9BF; &#x964; &#x99A;&#x9B2;&#x9C7;&#x9A8; &#x9B8;&#x9CD;&#x99F;&#x9C7;&#x9AA; &#x9AC;&#x9BE;&#x987; &#x9B8;&#x9CD;&#x99F;&#x9C7;&#x9AA; &#x9A6;&#x9C7;&#x996;&#x9BF; &#x964; &#x9B6;&#x9C1;&#x9B0;&#x9C1;&#x9A4;&#x9C7;&#x987; Twitter &#x995;&#x9CD;&#x9B2;&#x9BE;&#x9B8; &#x9AC;&#x9BE;&#x9A8;&#x9BE;&#x9DF; &#x9AB;&#x9C7;&#x9B2;&#x9BF; &#x964;</p><pre><code>&lt;?php

class Twitter
{
    public function getFollowers()
    {
        var_dump(&quot;get Twitter followers&quot;);
    }

    public function getTweets()
    {
        var_dump(&quot;get all twitter tweets&quot;);
    }
}

class Person
{
    public function social( $social )
    {
        $social-&gt;getPosts();
        $social-&gt;getFriends();
    }
}

$person = new Person();

$person-&gt;social(new Facebook());

$person-&gt;social(new Twitter());</code></pre><p>&#x98F;&#x996;&#x9A8; &#x9B0;&#x9BE;&#x9A8; &#x995;&#x9B0;&#x9BF; &#x964; &#x9A6;&#x9C7;&#x996;&#x9BE; &#x9AF;&#x9BE;&#x99A;&#x9CD;&#x99B;&#x9C7; &#x98F;&#x995;&#x99F;&#x9BE; <em>ERROR</em> &#x964; &#x995;&#x9BE;&#x9B0;&#x9A3; getPosts &#x9A8;&#x9BE;&#x9AE;&#x9C7; Twitter &#x995;&#x9CD;&#x9B2;&#x9BE;&#x9B8;&#x9C7; &#x995;&#x9CB;&#x9A8; &#x9AE;&#x9C7;&#x9A5;&#x9A1; &#x9A8;&#x9C7;&#x987; &#x964; &#x98F;&#x996;&#x9BE;&#x9A8;&#x9C7; &#x9B6;&#x9C1;&#x9A7;&#x9C1; &#x9AE;&#x9BE;&#x9A4;&#x9CD;&#x9B0; getPosts and getFriend &#x9AE;&#x9C7;&#x9A5;&#x9A1;&#x987; Allow &#x995;&#x9B0;&#x9AC;&#x9C7; &#x964;&#x9A7;&#x9B0;&#x9C7; &#x9A8;&#x9C7;&#x987; Person &#x995;&#x9CD;&#x9B2;&#x9BE;&#x9B8; &#x986;&#x9AA;&#x9A8;&#x9BE;&#x9B0; &#x9AA;&#x9C1;&#x9B0;&#x9CB; web application &#x98F;&#x9AC;&#x982; &#x986;&#x9AA;&#x9A8;&#x9BF; &#x99A;&#x9BE;&#x99A;&#x9CD;&#x99B;&#x9C7;&#x9A8; &#x9A8;&#x9BE; &#x9AE;&#x9C7;&#x99C;&#x9B0; &#x995;&#x9BF;&#x99B;&#x9C1; &#x99A;&#x9C7;&#x99E;&#x9CD;&#x99C; &#x995;&#x9B0;&#x9A4;&#x9C7; &#x964; &#x9A4;&#x9BE;&#x9B9;&#x9B2;&#x9C7; &#x995;&#x9BF; &#x995;&#x9B0;&#x9AC;&#x9C7;&#x9A8;&#xA0;?? &#x9A4;&#x9BE;&#x9B9;&#x9B2;&#x9C7; &#x9AF;&#x9C7;&#x99F;&#x9BE; &#x995;&#x9B0;&#x9A4;&#x9C7; &#x9B9;&#x9AC;&#x9C7; Person &#x995;&#x9CD;&#x9B2;&#x9BE;&#x9B8;&#x9C7;&#x9B0; social &#x9AE;&#x9C7;&#x9A5;&#x9A1;&#x99F;&#x9BE; &#x98F;&#x995;&#x99F;&#x9BE; Contract &#x98F;&#x9B0; &#x9AE;&#x9A7;&#x9CD;&#x9AF;&#x9C7; &#x9A8;&#x9BF;&#x9DF;&#x9C7; &#x986;&#x9B8;&#x9A4;&#x9C7; &#x9B9;&#x9AC;&#x9C7; &#x964; &#x9AF;&#x9C7;&#x9AE;&#x9A8;&#x983;</p><pre><code>interface SocialInterface
{
    public function getFriends();

    public function getPosts();
}</code></pre><p>&#x98F;&#x9AC;&#x982; Person &#x995;&#x9CD;&#x9B2;&#x9BE;&#x9B8;&#x9C7;&#x9B0; social &#x9AE;&#x9C7;&#x9A5;&#x9A1;&#x99F;&#x9BE; &#x9B6;&#x9C1;&#x9A7;&#x9C1; &#x9AE;&#x9BE;&#x9A4;&#x9CD;&#x9B0; SocialInterface Contract &#x987; Allow &#x995;&#x9B0;&#x9AC;&#x9C7; &#x964; &#x98F;&#x987;&#x9AC;&#x9BE;&#x9B0; &#x986;&#x9AE;&#x9BE;&#x9A6;&#x9C7;&#x9B0; &#x986;&#x9AA;&#x9A1;&#x9C7;&#x99F;&#x9C7;&#x9B0; &#x995;&#x9CB;&#x9A1; &#x9B9;&#x9AC;&#x9C7; &#x98F;&#x987; &#x9B0;&#x995;&#x9AE;</p><pre><code>&lt;?php

interface SocialInterface
{
    public function getFriends();

    public function getPosts();
}

class Twitter
{
    public function getFollowers()
    {
        var_dump(&quot;get Twitter followers&quot;);
    }

    public
    function getTweets()
    {
        var_dump(&quot;get all twitter tweets&quot;);
    }
}

class Person
{
    public function social(SocialInterface $social)
    {
        $social-&gt;getPosts();
        $social-&gt;getFriends();
    }
}

$person = new Person();
$person-&gt;social(new Facebook());
$person-&gt;social(new Twitter());</code></pre><p>&#x986;&#x9AC;&#x9BE;&#x9B0; &#x9B0;&#x9BE;&#x9A8; &#x995;&#x9B0;&#x9BF; &#x964; &#x986;&#x9AC;&#x9BE;&#x9B0;&#x9CB; Error &#x995;&#x9BE;&#x9B0;&#x9A3; twitter class &#x9B8;&#x9C7;&#x987; SocialInterface contract &#x99F;&#x9BE; Follow &#x995;&#x9B0;&#x9C7; &#x9A8;&#x9BE; &#x964; &#x98F;&#x996;&#x9A8; &#x9B9;&#x9DF;&#x9A4;&#x9CB; &#x9AE;&#x9A8;&#x9C7; &#x9AE;&#x9A8;&#x9C7; &#x986;&#x9AE;&#x9BE;&#x995;&#x9C7; &#x997;&#x9BE;&#x9B2;&#x9BF; &#x9A6;&#x9BF;&#x99A;&#x9CD;&#x99B;&#x9C7;&#x9A8; &#x98F;&#x9A4;&#x9CB; &#x995;&#x9B7;&#x9CD;&#x99F; &#x995;&#x9CD;&#x9AF;&#x9BE;&#x9A8; &#x995;&#x9B0;&#x9BE;&#x987;&#x9B2;&#x9C7;&#x9A8; &#x9AA;&#x9DF;&#x9C7;&#x9A8;&#x9CD;&#x99F; &#x986;&#x9B8;&#x9C7;&#x9A8; &#x9AD;&#x9BE;&#x987; &#x9AA;&#x9DF;&#x9C7;&#x9A8;&#x9CD;&#x99F;&#x9C7; &#x964;</p><hr><p>&#x9AA;&#x9CD;&#x9B0;&#x9A4;&#x9C0;&#x995;&#x9CD;&#x9B7;&#x9BE;&#x9B0; &#x9AA;&#x9BE;&#x9B2;&#x9BE; &#x9B6;&#x9C7;&#x9B7; &#x9B9;&#x9B2;&#x9CB; &#x964; &#x98F;&#x996;&#x9A8; &#x986;&#x9AE;&#x9BE;&#x9B0; Twitter&#x200A;&#x2014;&#x200A;&#x98F;&#x9B0; &#x99C;&#x9A8;&#x9CD;&#x9AF; &#x98F;&#x995;&#x99F;&#x9BE; Adapter &#x9B2;&#x9BF;&#x996;&#x9AC;&#x9CB; &#x964;</p><pre><code>// ... previous code ...

class TwitterAdapter implements SocialInterface
{
    /**
     * @var Twitter
     */
    protected $twitter;

    public function __construct(Twitter $twitter)
    {
        $this-&gt;twitter = $twitter;
    }

    public function getFriends()
    {
        $this-&gt;twitter-&gt;getFollowers();
    }

    public function getPosts()
    {
        $this-&gt;twitter-&gt;getTweets();
    }
}

$person = new Person();
$person-&gt;social(new Facebook());
$person-&gt;social(new TwitterAdapter(new Twitter()));</code></pre><p>&#x9A6;&#x9C7;&#x996;&#x9C7;&#x9A8; &#x995;&#x9A4; &#x9B8;&#x9B9;&#x99C;&#x9C7; &#x986;&#x9AE;&#x9B0;&#x9BE; &#x995;&#x9B0;&#x9C7; &#x9AB;&#x9C7;&#x9B2;&#x9B2;&#x9BE;&#x9AE; &#x964; &#x995;&#x9BF;&#x9A8;&#x9CD;&#x9A4;&#x9C1; &#x986;&#x9AA;&#x9BE;&#x9A8;&#x9BE;&#x9B0; &#x9AC;&#x9B8; &#x98F;&#x9A4;&#x9C7;&#x993; &#x9B8;&#x9A8;&#x9CD;&#x9A4;&#x9C1;&#x9B7;&#x9CD;&#x99F; &#x9A8;&#x9BE; &#x9AF;&#x9BE; &#x986;&#x9AA;&#x9A8;&#x9BF; &#x986;&#x997;&#x9C7;&#x987; &#x99C;&#x9BE;&#x9A8;&#x9A4;&#x9C7;&#x9A8; &#x964; &#x9A4;&#x9BF;&#x9A8;&#x9BF; &#x98F;&#x9AC;&#x9BE;&#x9B0; linkedin -&#x98F;&#x9B0; &#x9B8;&#x995;&#x9B2; conections and feeds &#x99C;&#x9BE;&#x9A8;&#x9A4;&#x9C7; &#x99A;&#x9BE;&#x99A;&#x9CD;&#x99B;&#x9C7; &#x964; &#x995;&#x9BF;&#x9A8;&#x9CD;&#x9A4;&#x9C1; &#x986;&#x9AA;&#x9A8;&#x9BE;&#x9B0; &#x99F;&#x9C7;&#x9A8;&#x9B6;&#x9A8; &#x9A8;&#x9C7;&#x9DF;&#x9BE;&#x9B0; &#x995;&#x9CB;&#x9A8; &#x995;&#x9BE;&#x9B0;&#x9A3; &#x9A8;&#x9C7;&#x987; &#x964; &#x995;&#x9BE;&#x9B0;&#x9A3; &#x9AA;&#x9C1;&#x9B0;&#x9CB; Application &#x98F;&#x9B0; &#x995;&#x9CB;&#x9A5;&#x9BE;&#x993; &#x986;&#x9AA;&#x9A8;&#x9BE;&#x995;&#x9C7; &#x99A;&#x9C7;&#x99E;&#x9CD;&#x99C; &#x995;&#x9B0;&#x9A4;&#x9C7; &#x9B9;&#x9AC;&#x9C7; &#x9A8;&#x9BE; &#x964; &#x985;&#x9AC;&#x9BE;&#x995; &#x9B9;&#x993;&#x9DF;&#x9BE;&#x9B0; &#x995;&#x9CB;&#x9A8; &#x995;&#x9BE;&#x9B0;&#x9A3; &#x9A8;&#x9C7;&#x987;, &#x995;&#x9BF;&#x9AD;&#x9BE;&#x9AC;&#x9C7; &#x995;&#x9B0;&#x9AC;&#x9CB; &#x99A;&#x9B2;&#x9C7;&#x9A8; &#x9A6;&#x9C7;&#x996;&#x9C7; &#x986;&#x9B8;&#x9BF; &#x964;</p><pre><code>class LinkedInAdapter implements SocialInterface
{
    /**
     * @var LinkedIn
     */
    protected $linkedIn;

    public function __construct(LinkedIn $linkedIn)
    {
        $this-&gt;linkedIn = $linkedIn;
    }

    public function getFriends()
    {
        $this-&gt;linkedIn-&gt;getConnections();
    }

    public function getPosts()
    {
        $this-&gt;linkedIn-&gt;getFeeds();
    }
}

class LinkedIn
{
    public function getConnections()
    {
        var_dump(&quot;get all linkedin connections&quot;);
    }

    public function getFeeds()
    {
        var_dump(&quot;get all linkedin feeds&quot;);
    }
}

// ... previous code ...
$person-&gt;social(new LinkedInAdapter(new LinkedIn()));</code></pre><p>&#x9B8;&#x9CB; &#x98F;&#x987; &#x99B;&#x9BF;&#x9B2; Basically <strong>Adapter Pattern</strong> &#x964; <strong>Adapter Pattern</strong> &#x98F;&#x9B0; &#x986;&#x9B0;&#x993; Example &#x9A6;&#x9BF;&#x9A4;&#x9C7; &#x99A;&#x9BE;&#x987;&#x9B2;&#x9C7; &#x986;&#x9AA;&#x9A8;&#x9BF; Multiple Payment Gateway &#x9A6;&#x9BF;&#x9DF;&#x9C7; &#x995;&#x9BE;&#x99C; &#x995;&#x9B0;&#x9A4;&#x9C7; &#x9AA;&#x9BE;&#x9B0;&#x9C7;&#x9A8; &#x9AF;&#x9BE; &#x9B6;&#x9C1;&#x9B0;&#x9C1;&#x9A4;&#x9C7; &#x9B9;&#x9DF;&#x9A4;&#x9CB; &#x98F;&#x995;&#x99F;&#x9BE; Payment Gateway &#x9A8;&#x9BF;&#x9DF;&#x9C7; &#x995;&#x9BE;&#x99C; &#x995;&#x9B0;&#x9C7;&#x99B;&#x9C7;&#x9A8; &#x9AA;&#x9B0;&#x9AC;&#x9B0;&#x9CD;&#x9A4;&#x9C0;&#x9A4;&#x9C7; &#x986;&#x9B0;&#x9CB; &#x995;&#x9BF;&#x99B;&#x9C1; Payment Gateway &#x9B8;&#x982;&#x9AF;&#x9C1;&#x995;&#x9CD;&#x9A4; &#x995;&#x9B0;&#x9A4;&#x9C7; &#x99A;&#x9BE;&#x987;&#x9B2;&#x9C7; &#x964; &#x98F;&#x99B;&#x9BE;&#x9DC;&#x9BE; &#x9B2;&#x9BE;&#x9B0;&#x9BE;&#x9AD;&#x9C7;&#x9B2;&#x9C7; &#x995;&#x9BE;&#x99C; &#x995;&#x9B0;&#x9C7; &#x9A5;&#x9BE;&#x995;&#x9B2;&#x9C7; &#x9B2;&#x9BE;&#x9B0;&#x9BE;&#x9AD;&#x9C7;&#x9B2; filesystem &#x993; &#x995;&#x9BF;&#x9A8;&#x9CD;&#x9A4;&#x9C1; <strong>Adapter Pattern</strong> &#x98F; &#x995;&#x9B0;&#x9BE;, &#x99A;&#x9BE;&#x987;&#x9B2;&#x9C7; &#x9A6;&#x9C7;&#x996;&#x9C7; &#x9A8;&#x9BF;&#x9A4;&#x9C7; &#x9AA;&#x9BE;&#x9B0;&#x9C7;&#x9A8; &#x964;</p><p><strong><strong>Full Code</strong></strong> &#x9AA;&#x9BE;&#x9AC;&#x9C7;&#x9A8; <a href="https://gist.github.com/Shipu/fdbb99aef9028c022e426f2f555e41b7" rel="noopener nofollow">&#x98F;&#x987;&#x996;&#x9BE;&#x9A8;&#x9C7;</a> &#x964;</p><p>&#x996;&#x9C1;&#x9AC; &#x9AD;&#x9BE;&#x9B2;&#x9CB; &#x995;&#x9B0;&#x9C7; &#x9B2;&#x9BF;&#x996;&#x9A4;&#x9C7; &#x99C;&#x9BE;&#x9A8;&#x9BF; &#x9A8;&#x9BE; &#x98F;&#x9AC;&#x982; &#x996;&#x9C1;&#x9AC; &#x9AD;&#x9BE;&#x9B2;&#x9CB; &#x9AC;&#x9C1;&#x99D;&#x9BE;&#x9A4;&#x9C7;&#x993; &#x9AA;&#x9BE;&#x9B0;&#x9BF; &#x9A8;&#x9BE;&#x9B9; &#x9A4;&#x9AC;&#x9C1; &#x99A;&#x9C7;&#x9B7;&#x9CD;&#x99F;&#x9BE; &#x995;&#x9B0;&#x9C7;&#x99B;&#x9BF; &#x98F;&#x9AC;&#x982; &#x99A;&#x9C7;&#x9B7;&#x9CD;&#x99F;&#x9BE; &#x995;&#x9B0;&#x9C7;&#x987; &#x9AF;&#x9BE;&#x9AC;&#x9CB; &#x987;&#x9A8; &#x9B6;&#x9BE;&#x9B9;&#x9CD;&#x200C; &#x986;&#x9B2;&#x9CD;&#x9B2;&#x9BE;&#x9B9;&#x9CD;&#x200C; &#x964; &#x9B8;&#x9BE;&#x9AE;&#x9A8;&#x9C7; &#x986;&#x9B0; &#x995;&#x9BF;&#x99B;&#x9C1; Design Pattern &#x9A8;&#x9BF;&#x9DF;&#x9C7; &#x9B2;&#x9C7;&#x996;&#x9BE;&#x9B0; &#x987;&#x99A;&#x9CD;&#x99B;&#x9BE; &#x986;&#x99B;&#x9C7; &#x964; &#x9AD;&#x9BE;&#x9B2;&#x9CB; &#x9A5;&#x9BE;&#x995;&#x9AC;&#x9C7;&#x9A8; &#x986;&#x9B2;&#x9CD;&#x9B2;&#x9BE;&#x9B9;&#x9CD;&#x200C; &#x9B9;&#x9BE;&#x9AB;&#x9C7;&#x99C; &#x964;

</p>]]></content:encoded></item><item><title><![CDATA[UVA 913 - Joana and the Odd Numbers]]></title><description><![CDATA[uva 913 - joana and the odd numbers programing problem solution in shipu ahamed blog]]></description><link>https://shipuahamed.com/uva-913-joana-and-the-odd-numbers/</link><guid isPermaLink="false">61a0be421ddff808acb336be</guid><category><![CDATA[UVA]]></category><category><![CDATA[Competitive Programming]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Mon, 31 Aug 2020 20:26:44 GMT</pubDate><media:content url="https://i.imgur.com/qlCCGln.png" medium="image"/><content:encoded><![CDATA[<h3 id="problem-pdf"><a href="https://onlinejudge.org/external/9/913.pdf">Problem PDF</a></h3><h3 id="solution-">Solution:</h3><figure class="kg-card kg-code-card"><pre><code class="language-cpp">#include
int main()
{
    long long n;
    while (scanf(&quot;%lld&quot;,&amp;n)==1)
    printf(&quot;%lld\n&quot;,((n*(n+2))/2)*3-6);
return 0;
}
</code></pre><figcaption><a href="https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/913/913.cpp">https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/913/913.cpp</a></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[UVA 871 - Counting Cells in a Blob]]></title><description><![CDATA[uva 871 - counting cells in a blob programing problem solution in shipu ahamed blog]]></description><link>https://shipuahamed.com/uva-871-counting-cells-in-a-blob/</link><guid isPermaLink="false">61a0be421ddff808acb336bd</guid><category><![CDATA[UVA]]></category><category><![CDATA[Competitive Programming]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Mon, 31 Aug 2020 20:26:43 GMT</pubDate><media:content url="https://i.imgur.com/ETRCvUx.png" medium="image"/><content:encoded><![CDATA[<h3 id="problem-pdf"><a href="https://onlinejudge.org/external/8/871.pdf">Problem PDF</a></h3><h3 id="solution-">Solution:</h3><figure class="kg-card kg-code-card"><pre><code class="language-cpp">/******************************************************************
***   Problem       :                                           ***
***   Author        : Shipu Ahamed (Psycho Timekiller)          ***
***   E-mail        : shipuahamed01@gmail.com                   ***
***   University    : BUBT,Dept. of CSE                         ***
***   Team          : BUBT_Psycho                               ***
***   My Blog       : http://shipuahamed.blogspot.com           ***
***   Facebook      : http://www.facebook.com/DeesheharaShipu   ***
******************************************************************/

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;

#define pi 2*acos(0.0)
#define all(v) v.begin(),v.end()

//input
#define si(t) scanf(&quot;%d&quot;,&amp;t)
#define sl(t) scanf(&quot;%lld&quot;,&amp;t)
#define sf(t) scanf(&quot;%f&quot;,&amp;t)
#define sd(t) scanf(&quot;%lf&quot;,&amp;t)
#define sc(c) scanf(&quot;%c&quot;,&amp;c)
#define sii(a,b) scanf(&quot;%d%d&quot;,&amp;a,&amp;b)
#define sll(a,b) scanf(&quot;%lld%lld&quot;,&amp;a,&amp;b)

//Output
#define P(a) printf(&quot;%d\n&quot;,a)
#define PL(a) printf(&quot;%lld\n&quot;,a)
#define PF(a) printf(&quot;%f\n&quot;,a)
#define PD(a) printf(&quot;%lf\n&quot;,a)
#define PS(a) printf(&quot;%s\n&quot;,a)
#define PSN(a) printf(&quot;%s &quot;,a)
#define PN(a) printf(&quot;%d &quot;,a)
#define PLN(a) printf(&quot;%lld &quot;,a)
#define PFN(a) printf(&quot;%f &quot;,a)
#define PDN(a) printf(&quot;%lf &quot;,a)
#define PP(a,b) printf(&quot;%d %d\n&quot;,a,b)
#define PPN(a,b) printf(&quot;%d %d &quot;,a,b)
#define PPL(a,b) printf(&quot;%lld %lld\n&quot;,a,b)
#define PPLN(a,b) printf(&quot;%lld %lld &quot;,a,b)

#define CP(a) cout&lt; vi;
typedef  vector vll;
typedef  vector vs;
typedef  set si;
typedef  set ss;
typedef  map mii;
typedef  map mll;
typedef  map msi;
typedef  map mci;

template string toString( T Number ){stringstream st;st &lt;&lt; Number;return st.str();}
template  T SOD(T n) {__typeof(n) sum=0;for(__typeof(n) i=1;i*i&lt;=n;i++)sum+=(n%i)?0:((i*i==n)?i:i+n/i);return sum;}

//For Define
#define forab(i,a,b) for(__typeof(b) i=(a);i&lt;=(b);i++)
#define for0(i,n) forab(i,0,(n)-1)
#define for1(i,n) forab(i,1,n)
#define rforab(i,b,a) for(__typeof(b) i=(b);i&gt;=(a);i--)
#define rfor0(i,n) rforba(i,(n)-1,0)
#define rfor1(i,n) rforba(i,n,1)
#define forstl(i,s) for(__typeof((s).end()) i=(s).begin(); i != (s).end(); i++)

//Debug
#define dbg(x) cout &lt;&lt; #x &lt;&lt; &quot; -&gt; &quot; &lt;&lt; (x) &lt;&lt; endl;
#define dbgsarr(i,a) cout&lt;&lt;#a&lt;&lt;&quot;[&quot;&lt; &quot;&lt; &quot;&lt; &quot;&lt;&gt;p ; return p;}

ll pow(ll a,ll b, ll m) { ll res = 1; while(b) { if(b &amp; 1) { res = ( (res % m) * (a % m) ) %m ; } a= ((a%m) * (a%m)) %m; b &gt;&gt;= 1; } return res; }
ll modInverse(ll a, ll m){return pow(a,m-2,m);}

////============ CONSTANT ===============////
#define mx7   10000007
#define mx6   1000006
#define mx5   100005
#define inf   1&lt;&lt;30                                           //infinity value
#define eps   1e-9
#define mx    (100010)
#define mod   1000000007
////=====================================////

int cnt,a[30][30],r,c;

void dfs(int i,int j)
{
    if(i&gt;=r || i&lt;0 || j&lt;0 || j&gt;=c || a[i][j]==0) return;
    cnt++;
    a[i][j]=0;

    dfs(i,j+1);
    dfs(i,j-1);
    dfs(i+1,j);
    dfs(i-1,j);
    dfs(i+1,j+1);
    dfs(i+1,j-1);
    dfs(i-1,j+1);
    dfs(i-1,j-1);
}

int main()
{
    int t;
    si(t);
    getchar();
    getchar();
    while(t--)
    {
        int i=0,n;
        string s;

        while(getline(cin,s) &amp;&amp; sz(s))
        {
            n=sz(s);
            if(i==0)
            {
                c=n;
            }
            for0(j,n)
            {
                a[i][j]=s[j]-&apos;0&apos;;
            }
            i++;
        }
        r=i;

        int res=0;
        for0(i,r)
        {
            for0(j,c)
            {
                cnt=0;
                if(a[i][j])
                    dfs(i,j);
                res=max(res,cnt);
            }
        }
        P(res);
        if(t)
            puts(&quot;&quot;);
        cover(a,0);
    }

    return 0;
}

</code></pre><figcaption><a href="https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/871/871.cpp">https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/871/871.cpp</a></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[UVA 866 - Intersecting Line Segments]]></title><description><![CDATA[uva 866 - intersecting line segments programing problem solution in shipu ahamed blog]]></description><link>https://shipuahamed.com/uva-866-intersecting-line-segments/</link><guid isPermaLink="false">61a0be421ddff808acb336bc</guid><category><![CDATA[UVA]]></category><category><![CDATA[Competitive Programming]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Mon, 31 Aug 2020 20:26:42 GMT</pubDate><media:content url="https://i.imgur.com/FKtcSsg.png" medium="image"/><content:encoded><![CDATA[<h3 id="problem-pdf"><a href="https://onlinejudge.org/external/8/866.pdf">Problem PDF</a></h3><h3 id="solution-">Solution:</h3><figure class="kg-card kg-code-card"><pre><code class="language-cpp">/******************************************************************
***   Problem       :                                           ***
***   Author        : Shipu Ahamed (Psycho Timekiller)          ***
***   E-mail        : shipuahamed01@gmail.com                   ***
***   University    : BUBT,Dept. of CSE                         ***
***   Team          : BUBT_Psycho                               ***
***   My Blog       : http://shipuahamed.blogspot.com           ***
***   Facebook      : http://www.facebook.com/DeesheharaShipu   ***
******************************************************************/

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;

#define pi 2*acos(0.0)
#define all(v) v.begin(),v.end()

//input
#define si(t) scanf(&quot;%d&quot;,&amp;t)
#define sl(t) scanf(&quot;%lld&quot;,&amp;t)
#define sf(t) scanf(&quot;%f&quot;,&amp;t)
#define sd(t) scanf(&quot;%lf&quot;,&amp;t)
#define sc(c) scanf(&quot;%c&quot;,&amp;c)
#define sii(a,b) scanf(&quot;%d%d&quot;,&amp;a,&amp;b)
#define sll(a,b) scanf(&quot;%lld%lld&quot;,&amp;a,&amp;b)

//Output
#define P(a) printf(&quot;%d\n&quot;,a)
#define PL(a) printf(&quot;%lld\n&quot;,a)
#define PF(a) printf(&quot;%f\n&quot;,a)
#define PD(a) printf(&quot;%lf\n&quot;,a)
#define PS(a) printf(&quot;%s\n&quot;,a)
#define PSN(a) printf(&quot;%s &quot;,a)
#define PN(a) printf(&quot;%d &quot;,a)
#define PLN(a) printf(&quot;%lld &quot;,a)
#define PFN(a) printf(&quot;%f &quot;,a)
#define PDN(a) printf(&quot;%lf &quot;,a)
#define PP(a,b) printf(&quot;%d %d\n&quot;,a,b)
#define PPN(a,b) printf(&quot;%d %d &quot;,a,b)
#define PPL(a,b) printf(&quot;%lld %lld\n&quot;,a,b)
#define PPLN(a,b) printf(&quot;%lld %lld &quot;,a,b)

#define CP(a) cout&lt; vi;
typedef  vector vll;
typedef  vector vs;
typedef  set si;
typedef  set ss;
typedef  map mii;
typedef  map mll;
typedef  map msi;
typedef  map mci;

template string toString( T Number ){stringstream st;st &lt;&lt; Number;return st.str();}
template  T SOD(T n) {__typeof(n) sum=0;for(__typeof(n) i=1;i*i&lt;=n;i++)sum+=(n%i)?0:((i*i==n)?i:i+n/i);return sum;}

//For Define
#define forab(i,a,b) for(__typeof(b) i=(a);i&lt;=(b);i++)
#define for0(i,n) forab(i,0,(n)-1)
#define for1(i,n) forab(i,1,n)
#define rforab(i,b,a) for(__typeof(b) i=(b);i&gt;=(a);i--)
#define rfor0(i,n) rforba(i,(n)-1,0)
#define rfor1(i,n) rforba(i,n,1)
#define forstl(i,s) for(__typeof((s).end()) i=(s).begin(); i != (s).end(); i++)

//Debug
#define dbg(x) cout &lt;&lt; #x &lt;&lt; &quot; -&gt; &quot; &lt;&lt; (x) &lt;&lt; endl;
#define dbgsarr(i,a) cout&lt;&lt;#a&lt;&lt;&quot;[&quot;&lt; &quot;&lt; &quot;&lt; &quot;&lt;&gt;p ; return p;}

ll pow(ll a,ll b, ll m) { ll res = 1; while(b) { if(b &amp; 1) { res = ( (res % m) * (a % m) ) %m ; } a= ((a%m) * (a%m)) %m; b &gt;&gt;= 1; } return res; }
ll modInverse(ll a, ll m){return pow(a,m-2,m);}

////============ CONSTANT ===============////
#define mx7   10000007
#define mx6   1000006
#define mx5   100005
#define inf   1&lt;&lt;30                                           //infinity value
#define eps   1e-9
#define mx    (100010)
#define mod   1000000007
////=====================================////

int tarea(int x1, int y1, int x2, int y2, int x3, int y3){ //i don&apos;t use struct bcz it&apos;s tough for me.
    return x1*y2-y1*x2+x2*y3-y2*x3+x3*y1-y3*x1;
}

bool online(int x1,int y1,int x2,int y2,int x3,int y3)
{
    int  minx,miny,maxx,maxy;
    minx=min(x1,x2);miny=min(y1,y2);
    maxx=max(x1,x2);maxy=max(y1,y2);

    if(minx&lt;=x3 &amp;&amp; maxx&gt;=x3 &amp;&amp; miny&lt;=y3 &amp;&amp; maxy&gt;=y3 )
        return true;
    else
    return false;
}

bool intersection(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
{
    int a1=tarea(x3,y3,x4,y4,x1,y1);
    int a2=tarea(x3,y3,x4,y4,x2,y2);
    int a3=tarea(x1,y1,x2,y2,x3,y3);
    int a4=tarea(x1,y1,x2,y2,x4,y4);

//    PP(a1,a2),PP(a3,a4);
//    P(online(x3,y3,x4,y4,x1,y1));
//    nl;
    if(a1*a2&lt;0 &amp;&amp; a3*a4&lt;0) return true;
    else if(a1==0 &amp;&amp; online(x3,y3,x4,y4,x1,y1)) return true;
    else if(a2==0 &amp;&amp; online(x3,y3,x4,y4,x2,y2)) return true;
    else if(a3==0 &amp;&amp; online(x1,y1,x2,y2,x3,y3)) return true;
    else if(a4==0 &amp;&amp; online(x1,y1,x2,y2,x4,y4)) return true;
    else
        return false;
}

struct line
{
    int x1,y1,x2,y2;
};

int main()
{
    int t;
    si(t);
    while(t--)
    {
        vectorv;
        line p;

        int n;
        si(n);
        while(n--)
        {
            sii(p.x1,p.y1),sii(p.x2,p.y2);
            v.pb(p);
        }

        n=sz(v);

        int res=0;
        for0(i,n)
        {
//            PP(v[i].x1,v[i].y1),PP(v[i].x2,v[i].y2);
            int cnt=0;
            for0(j,n)
            {
                if(i==j) continue;

                if(intersection(v[i].x1,v[i].y1,v[i].x2,v[i].y2,v[j].x1,v[j].y1,v[j].x2,v[j].y2 ))
                    cnt++;
            }
            res += cnt+1;
        }

        P(res);
        if(t)
            nl;

    }

    return 0;
}
</code></pre><figcaption><a href="https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/866/866.cpp">https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/866/866.cpp</a></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[UVA 847 - A Multiplication Game]]></title><description><![CDATA[uva 847 - a multiplication game programing problem solution in shipu ahamed blog]]></description><link>https://shipuahamed.com/uva-847-a-multiplication-game/</link><guid isPermaLink="false">61a0be421ddff808acb336bb</guid><category><![CDATA[UVA]]></category><category><![CDATA[Competitive Programming]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Mon, 31 Aug 2020 20:26:41 GMT</pubDate><media:content url="https://i.imgur.com/RhZTGyL.png" medium="image"/><content:encoded><![CDATA[<h3 id="problem-pdf"><a href="https://onlinejudge.org/external/8/847.pdf">Problem PDF</a></h3><h3 id="solution-">Solution:</h3><figure class="kg-card kg-code-card"><pre><code class="language-cpp">#include 
int main()
{
    long long int n,p;
    while(scanf(&quot;%lld&quot;,&amp;n)!=EOF)
    {
        p=1;
        while(p=n)
            {
                puts(&quot;Stan wins.&quot;);
                break;
            }
            p*=2;
            if(p&gt;=n)
            {
                puts(&quot;Ollie wins.&quot;);
                break;
            }
        }
    }
}

</code></pre><figcaption><a href="https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/847/847.cpp">https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/847/847.cpp</a></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[UVA 836 - Largest Submatrix]]></title><description><![CDATA[uva 836 - largest submatrix programing problem solution in shipu ahamed blog]]></description><link>https://shipuahamed.com/uva-836-largest-submatrix/</link><guid isPermaLink="false">61a0be421ddff808acb336ba</guid><category><![CDATA[UVA]]></category><category><![CDATA[Competitive Programming]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Mon, 31 Aug 2020 20:26:40 GMT</pubDate><media:content url="https://i.imgur.com/ucqnVZH.png" medium="image"/><content:encoded><![CDATA[<h3 id="problem-pdf"><a href="https://onlinejudge.org/external/8/836.pdf">Problem PDF</a></h3><h3 id="solution-">Solution:</h3><figure class="kg-card kg-code-card"><pre><code class="language-cpp">/******************************************************************
***   Problem       :                                           ***
***   Author        : Shipu Ahamed (Psycho Timekiller)          ***
***   E-mail        : shipuahamed01@gmail.com                   ***
***   University    : BUBT,Dept. of CSE                         ***
***   Team          : BUBT_Psycho                               ***
***   My Blog       : http://shipuahamed.blogspot.com           ***
***   Facebook      : http://www.facebook.com/DeesheharaShipu   ***
******************************************************************/

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;

#define pi 2*acos(0.0)
#define all(v) v.begin(),v.end()

//input
#define si(t) scanf(&quot;%d&quot;,&amp;t)
#define sl(t) scanf(&quot;%lld&quot;,&amp;t)
#define sf(t) scanf(&quot;%f&quot;,&amp;t)
#define sd(t) scanf(&quot;%lf&quot;,&amp;t)
#define sc(c) scanf(&quot;%c&quot;,&amp;c)
#define sii(a,b) scanf(&quot;%d%d&quot;,&amp;a,&amp;b)
#define sll(a,b) scanf(&quot;%lld%lld&quot;,&amp;a,&amp;b)

//Output
#define P(a) printf(&quot;%d\n&quot;,a)
#define PL(a) printf(&quot;%lld\n&quot;,a)
#define PF(a) printf(&quot;%f\n&quot;,a)
#define PD(a) printf(&quot;%lf\n&quot;,a)
#define PS(a) printf(&quot;%s\n&quot;,a)
#define PSN(a) printf(&quot;%s &quot;,a)
#define PN(a) printf(&quot;%d &quot;,a)
#define PLN(a) printf(&quot;%lld &quot;,a)
#define PFN(a) printf(&quot;%f &quot;,a)
#define PDN(a) printf(&quot;%lf &quot;,a)
#define PP(a,b) printf(&quot;%d %d\n&quot;,a,b)
#define PPN(a,b) printf(&quot;%d %d &quot;,a,b)
#define PPL(a,b) printf(&quot;%lld %lld\n&quot;,a,b)
#define PPLN(a,b) printf(&quot;%lld %lld &quot;,a,b)

#define CP(a) cout&lt; vi;
typedef  vector vll;
typedef  vector vs;
typedef  set si;
typedef  set ss;
typedef  map mii;
typedef  map mll;
typedef  map msi;
typedef  map mci;

template string toString( T Number ){stringstream st;st &lt;&lt; Number;return st.str();}
template  T SOD(T n) {__typeof(n) sum=0;for(__typeof(n) i=1;i*i&lt;=n;i++)sum+=(n%i)?0:((i*i==n)?i:i+n/i);return sum;}

//For Define
#define forab(i,a,b) for(__typeof(b) i=(a);i&lt;=(b);i++)
#define for0(i,n) forab(i,0,(n)-1)
#define for1(i,n) forab(i,1,n)
#define rforab(i,b,a) for(__typeof(b) i=(b);i&gt;=(a);i--)
#define rfor0(i,n) rforba(i,(n)-1,0)
#define rfor1(i,n) rforba(i,n,1)
#define forstl(i,s) for(__typeof((s).end()) i=(s).begin(); i != (s).end(); i++)

//Debug
#define dbg(x) cout &lt;&lt; #x &lt;&lt; &quot; -&gt; &quot; &lt;&lt; (x) &lt;&lt; endl;
#define dbgsarr(i,a) cout&lt;&lt;#a&lt;&lt;&quot;[&quot;&lt; &quot;&lt; &quot;&lt; &quot;&lt;&gt;p ; return p;}

ll pow(ll a,ll b, ll m) { ll res = 1; while(b) { if(b &amp; 1) { res = ( (res % m) * (a % m) ) %m ; } a= ((a%m) * (a%m)) %m; b &gt;&gt;= 1; } return res; }
ll modInverse(ll a, ll m){return pow(a,m-2,m);}

////============ CONSTANT ===============////
#define mx7   10000007
#define mx6   1000006
#define mx5   100005
#define inf   1&lt;&lt;30                                           //infinity value
#define eps   1e-9
#define mx    (100010)
#define mod   1000000007
////=====================================////

struct zeone
{
    int one=0,zero=0;

};

int main()
{
    int t;
    si(t);
    while(t--)
    {
        string s[30];
        cin&gt;&gt;s[0];

        int n=sz(s[0]);

        zeone cs[50][50];

        for0(i,n)
        {
            if(s[0][i]==&apos;0&apos;)
            {
                cs[1][i+1].zero = cs[1][i].zero+1;
                cs[1][i+1].one = cs[1][i].one;
            }
            else
            {
                cs[1][i+1].one = cs[1][i].one+1;
                cs[1][i+1].zero = cs[1][i].zero;
            }

//            PN(cs[1][i+1].one);
        }
//        nl;

        for1(i,n-1)
        {
            cin&gt;&gt;s[i];
            for0(j,n)
            {
                if(s[i][j]==&apos;0&apos;)
                {
                    cs[i+1][j+1].zero = cs[i][j+1].zero + cs[i+1][j].zero - cs[i][j].zero +1;
                    cs[i+1][j+1].one = cs[i][j+1].one + cs[i+1][j].one - cs[i][j].one;
                }
                else
                {
                    cs[i+1][j+1].zero = cs[i][j+1].zero + cs[i+1][j].zero - cs[i][j].zero;
                    cs[i+1][j+1].one = cs[i][j+1].one + cs[i+1][j].one - cs[i][j].one+1;
                }
//                PN(cs[i+1][j+1].one);

            }
//            nl;
        }

//        nl;
//        for0(i,n)
//        {
//            cout&lt;=p)
                        {
                            res.zero = p;
                            p = ( cs[i][j].one - (cs[i][l-1].one + cs[k-1][j].one) ) + cs[k-1][l-1].one;
                            if(res.one</code></pre><figcaption><code class="language-cpp"><a href="https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/836/836.cpp">https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/836/836.cpp</a></code></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[UVA 793 - Network Connections]]></title><description><![CDATA[uva 793 - network connections programing problem solution in shipu ahamed blog]]></description><link>https://shipuahamed.com/uva-793-network-connections/</link><guid isPermaLink="false">61a0be421ddff808acb336b9</guid><category><![CDATA[UVA]]></category><category><![CDATA[Competitive Programming]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Mon, 31 Aug 2020 20:26:39 GMT</pubDate><media:content url="https://i.imgur.com/84Em7p5.png" medium="image"/><content:encoded><![CDATA[<h3 id="problem-pdf"><a href="https://onlinejudge.org/external/7/793.pdf">Problem PDF</a></h3><h3 id="solution-">Solution:</h3><figure class="kg-card kg-code-card"><pre><code class="language-cpp">/******************************************************************
***   Problem       :                                           ***
***   Author        : Shipu Ahamed (Psycho Timekiller)          ***
***   E-mail        : shipuahamed01@gmail.com                   ***
***   University    : BUBT,Dept. of CSE                         ***
***   Team          : BUBT_Psycho                               ***
***   My Blog       : http://shipuahamed.blogspot.com           ***
***   Facebook      : http://www.facebook.com/DeesheharaShipu   ***
******************************************************************/

#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;

#define pi 2*acos(0.0)
#define all(v) v.begin(),v.end()

//input
#define si(t) scanf(&quot;%d&quot;,&amp;t)
#define sl(t) scanf(&quot;%lld&quot;,&amp;t)
#define sf(t) scanf(&quot;%f&quot;,&amp;t)
#define sd(t) scanf(&quot;%lf&quot;,&amp;t)
#define sc(c) scanf(&quot;%c&quot;,&amp;c)
#define sii(a,b) scanf(&quot;%d%d&quot;,&amp;a,&amp;b)
#define sll(a,b) scanf(&quot;%lld%lld&quot;,&amp;a,&amp;b)

//Output
#define P(a) printf(&quot;%d\n&quot;,a)
#define PL(a) printf(&quot;%lld\n&quot;,a)
#define PF(a) printf(&quot;%f\n&quot;,a)
#define PD(a) printf(&quot;%lf\n&quot;,a)
#define PS(a) printf(&quot;%s\n&quot;,a)
#define PSN(a) printf(&quot;%s &quot;,a)
#define PN(a) printf(&quot;%d &quot;,a)
#define PLN(a) printf(&quot;%lld &quot;,a)
#define PFN(a) printf(&quot;%f &quot;,a)
#define PDN(a) printf(&quot;%lf &quot;,a)
#define PP(a,b) printf(&quot;%d %d\n&quot;,a,b)
#define PPN(a,b) printf(&quot;%d %d &quot;,a,b)
#define PPL(a,b) printf(&quot;%lld %lld\n&quot;,a,b)
#define PPLN(a,b) printf(&quot;%lld %lld &quot;,a,b)

#define CP(a) cout&lt; vi;
typedef  vector vll;
typedef  vector vs;
typedef  set si;
typedef  set ss;
typedef  map mii;
typedef  map mll;
typedef  map msi;
typedef  map mci;

template string toString( T Number ){stringstream st;st &lt;&lt; Number;return st.str();}
template  T SOD(T n) {__typeof(n) sum=0;for(__typeof(n) i=1;i*i&lt;=n;i++)sum+=(n%i)?0:((i*i==n)?i:i+n/i);return sum;}

//For Define
#define forab(i,a,b) for(__typeof(b) i=(a);i&lt;=(b);i++)
#define for0(i,n) forab(i,0,(n)-1)
#define for1(i,n) forab(i,1,n)
#define rforab(i,b,a) for(__typeof(b) i=(b);i&gt;=(a);i--)
#define rfor0(i,n) rforab(i,(n)-1,0)
#define rfor1(i,n) rforab(i,n,1)
#define forstl(i,s) for(__typeof((s).end()) i=(s).begin(); i != (s).end(); i++)

//File input/output
#define input freopen(&quot;in.txt&quot;,&quot;r&quot;,stdin)
#define output freopen(&quot;out.txt&quot;,&quot;w&quot;,stdout)

//upper bound and lower bound
#define LB(a,value) (lower_bound(all(a),value)-a.begin())
#define UB(a,value) (upper_bound(all(a),value)-a.begin())

//Test Case &amp; New line
#define Case(no) printf(&quot;Case %d: &quot;,++no)
#define nl puts(&quot;&quot;)

int stringconvert(string s){int p; istringstream st(s); st&gt;&gt;p ; return p;}

ll pow(ll a,ll b, ll m) { ll res = 1; while(b) { if(b &amp; 1) { res = ( (res % m) * (a % m) ) %m ; } a= ((a%m) * (a%m)) %m; b &gt;&gt;= 1; } return res; }
ll modInverse(ll a, ll m){return pow(a,m-2,m);}

////============ CONSTANT ===============////
#define mx7   10000007
#define mx6   1000006
#define mx5   100005
#define inf   1&lt;&lt;30                                           //infinity value
#define eps   1e-9
#define mx    (100010)
#define mod   1000000007
////=====================================////

int par[1000005];

int Find(int n)
{
    if(par[n]==n)
        return n;
    return par[n]=Find(par[n]);
}

void Union(int a,int b)
{
    int u= Find(a);
    int v= Find(b);
    if(u!=v)
    {
        par[u]=v;
    }
}

int main()
{
    int t;
    si(t);
    while(t--)
    {
        int n,a,b;
        si(n);

        getchar();

        for1(i,n)
            par[i]=i;

        string s;
        int cnt1=0,cnt2=0;
        while(getline(cin,s))
        {
            if(s.length()==0) break;

            stringstream ss;
            ss&lt;&gt;s&gt;&gt;a&gt;&gt;b;

            if(s==&quot;c&quot;)
            {
                Union(a,b);
            }
            else
            {
                int u= Find(a);
                int v= Find(b);
                if(u==v)
                    cnt1++;
                else
                    cnt2++;
            }

        }

        printf(&quot;%d,%d\n&quot;,cnt1,cnt2);

        if(t)
            nl;


    }

    return 0;
}
</code></pre><figcaption><a href="https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/793/793.cpp">https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/793/793.cpp</a></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[UVA 787 - Maximum Sub-sequence Product]]></title><description><![CDATA[uva 787 - maximum sub-sequence product programing problem solution in shipu ahamed blog]]></description><link>https://shipuahamed.com/uva-787-maximum-sub-sequence-product/</link><guid isPermaLink="false">61a0be421ddff808acb336b8</guid><category><![CDATA[UVA]]></category><category><![CDATA[Competitive Programming]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Mon, 31 Aug 2020 20:26:38 GMT</pubDate><media:content url="https://i.imgur.com/ZBDhvWw.png" medium="image"/><content:encoded><![CDATA[<h3 id="problem-pdf"><a href="https://onlinejudge.org/external/7/787.pdf">Problem PDF</a></h3><h3 id="solution-">Solution:</h3><figure class="kg-card kg-code-card"><pre><code class="language-java">package pkg787;

import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    private static String line;
    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
    ArrayList a = new ArrayList();
    BigInteger n;
    
    while (in.hasNext()) {
      
      n = in.nextBigInteger();
      if (n.compareTo(BigInteger.valueOf(-999999))==0)
      {
        BigInteger result = a.get(0);
        BigInteger pro;
        for (int i = 0; i &lt; a.size(); i ++) {
          pro =BigInteger.ONE;
          for(int j=i;j &lt; a.size();j++) {
            pro = pro.multiply(a.get(j));
            if (result.compareTo(pro) == -1) 
                result = pro;
 
          }
        }
        a.clear();
        System.out.println(result);
      }
      else
      {
          a.add(n);
      }
    }
    }
    
}
</code></pre><figcaption><a href="https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/787/Main.java">https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/787/Main.java</a></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[UVA 785 - Grid Colouring]]></title><description><![CDATA[uva 785 - grid colouring programing problem solution in shipu ahamed blog]]></description><link>https://shipuahamed.com/uva-785-grid-colouring/</link><guid isPermaLink="false">61a0be421ddff808acb336b7</guid><category><![CDATA[UVA]]></category><category><![CDATA[Competitive Programming]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Mon, 31 Aug 2020 20:26:37 GMT</pubDate><media:content url="https://i.imgur.com/ooddnGF.png" medium="image"/><content:encoded><![CDATA[<h3 id="problem-pdf"><a href="https://onlinejudge.org/external/7/785.pdf">Problem PDF</a></h3><h3 id="solution-">Solution:</h3><figure class="kg-card kg-code-card"><pre><code class="language-cpp">/******************************************************************
***   Problem       :                                           ***
***   Author        : Shipu Ahamed (Psycho Timekiller)          ***
***   E-mail        : shipuahamed01@gmail.com                   ***
***   University    : BUBT,Dept. of CSE                         ***
***   Team          : BUBT_Psycho                               ***
***   My Blog       : http://shipuahamed.blogspot.com           ***
***   Facebook      : http://www.facebook.com/DeesheharaShipu   ***
******************************************************************/

#include 
using namespace std;

#define pi 2*acos(0.0)
#define all(v) v.begin(),v.end()

//input
#define si(t) scanf(&quot;%d&quot;,&amp;t)
#define sl(t) scanf(&quot;%lld&quot;,&amp;t)
#define sf(t) scanf(&quot;%f&quot;,&amp;t)
#define sd(t) scanf(&quot;%lf&quot;,&amp;t)
#define sc(c) scanf(&quot;%c&quot;,&amp;c)
#define sii(a,b) scanf(&quot;%d%d&quot;,&amp;a,&amp;b)
#define sll(a,b) scanf(&quot;%lld%lld&quot;,&amp;a,&amp;b)

//Output
#define P(a) printf(&quot;%d\n&quot;,a)
#define PL(a) printf(&quot;%lld\n&quot;,a)
#define PF(a) printf(&quot;%f\n&quot;,a)
#define PD(a) printf(&quot;%lf\n&quot;,a)
#define PS(a) printf(&quot;%s\n&quot;,a)
#define PSN(a) printf(&quot;%s &quot;,a)
#define PN(a) printf(&quot;%d &quot;,a)
#define PLN(a) printf(&quot;%lld &quot;,a)
#define PFN(a) printf(&quot;%f &quot;,a)
#define PDN(a) printf(&quot;%lf &quot;,a)
#define PP(a,b) printf(&quot;%d %d\n&quot;,a,b)
#define PPN(a,b) printf(&quot;%d %d &quot;,a,b)
#define PPL(a,b) printf(&quot;%lld %lld\n&quot;,a,b)
#define PPLN(a,b) printf(&quot;%lld %lld &quot;,a,b)

#define CP(a) cout&lt; vi;
typedef  vector vll;
typedef  vector vs;
typedef  set si;
typedef  set ss;
typedef  map mii;
typedef  map mll;
typedef  map msi;
typedef  map mci;

template string toString( T Number ){stringstream st;st &lt;&lt; Number;return st.str();}
template  T SOD(T n) {__typeof(n) sum=0;for(__typeof(n) i=1;i*i&lt;=n;i++)sum+=(n%i)?0:((i*i==n)?i:i+n/i);return sum;}

//For Define
#define forab(i,a,b) for(__typeof(b) i=(a);i&lt;=(b);i++)
#define for0(i,n) forab(i,0,(n)-1)
#define for1(i,n) forab(i,1,n)
#define rforab(i,b,a) for(__typeof(b) i=(b);i&gt;=(a);i--)
#define rfor0(i,n) rforba(i,(n)-1,0)
#define rfor1(i,n) rforba(i,n,1)
#define forstl(i,s) for(__typeof((s).end()) i=(s).begin(); i != (s).end(); i++)

//Debug
#define dbg(x) cout &lt;&lt; #x &lt;&lt; &quot; -&gt; &quot; &lt;&lt; (x) &lt;&lt; endl;
#define dbgsarr(i,a) cout&lt;&lt;#a&lt;&lt;&quot;[&quot;&lt; &quot;&lt; &quot;&lt; &quot;&lt;&gt;p ; return p;}

ll pow(ll a,ll b, ll m) { ll res = 1; while(b) { if(b &amp; 1) { res = ( (res % m) * (a % m) ) %m ; } a= ((a%m) * (a%m)) %m; b &gt;&gt;= 1; } return res; }
ll modInverse(ll a, ll m){return pow(a,m-2,m);}

////============ CONSTANT ===============////
#define mx7   10000007
#define mx6   1000006
#define mx5   100005
#define inf   1&lt;&lt;30                                           //infinity value
#define eps   1e-9
#define mx    (100010)
#define mod   1000000007
////=====================================////

string s[100];
char c;
bool f;
void dfs(int i,int j)
{
    if(f &amp; s[i][j]!=&apos; &apos;) return;
    s[i][j]=c;
    f=true;
    dfs(i,j-1);
    dfs(i,j+1);
    dfs(i-1,j);
    dfs(i+1,j);
}
int main()
{
    int n=-1;
    while(getline(cin,s[++n])!=NULL)
    {
        if(s[n][0]!=&apos;_&apos;)
            continue;
        for0(i,n)
        {
            for(int j=0;s[i][j];j++)
            {
                if(s[i][j]!=&apos;X&apos; &amp;&amp; s[i][j]!=&apos; &apos;)
                {
                    f=false;
                    c=s[i][j];
                    dfs(i,j);
                }
            }
        }
        for0(i,n+1)
            CP(s[i]);
        n=-1;
    }
    return 0;
}

</code></pre><figcaption><a href="https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/785/785.cpp">https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/785/785.cpp</a></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[UVA 713 - Adding Reversed Numbers]]></title><description><![CDATA[uva 713 - adding reversed numbers programing problem solution in shipu ahamed blog]]></description><link>https://shipuahamed.com/uva-713-adding-reversed-numbers/</link><guid isPermaLink="false">61a0be421ddff808acb336b6</guid><category><![CDATA[UVA]]></category><category><![CDATA[Competitive Programming]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Mon, 31 Aug 2020 20:26:36 GMT</pubDate><media:content url="https://i.imgur.com/YyCjg7B.png" medium="image"/><content:encoded><![CDATA[<h3 id="problem-pdf"><a href="https://onlinejudge.org/external/7/713.pdf">Problem PDF</a></h3><h3 id="solution-">Solution:</h3><figure class="kg-card kg-code-card"><pre><code class="language-cpp">#include
#include
int main()
{
char a[260],b[260],p[205];
int t,l,len,e,f,i,r,s,d,y,q,j;
scanf(&quot;%d&quot;,&amp;t);
while(t--)
{
scanf(&quot;%s%s&quot;,&amp;a,&amp;b);
l=strlen(a);
len=strlen(b);
if(l&gt;len)
{
y=l;
for(i=len;il)
{
y=len;
for(i=l;i9)
{
r=s%10;
p[j]=r+&apos;0&apos;;
f=1;
}
 else{
    p[j]=s+&apos;0&apos;;
    f=0;
    }
}
if(f==1){
    p[j]=f+&apos;0&apos;;
    p[j+1]=&apos;\0&apos;;
    }
else{
    p[j]=&apos;\0&apos;;
    }
  i=0;
y=strlen(p);
while (p[i]==&apos;0&apos;)
i++;
for (;i</code></pre><figcaption><code class="language-cpp"><a href="https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/713/713.cpp">https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/713/713.cpp</a></code></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[UVA 694 - The Collatz Sequence]]></title><description><![CDATA[uva 694 - the collatz sequence programing problem solution in shipu ahamed blog]]></description><link>https://shipuahamed.com/uva-694-the-collatz-sequence/</link><guid isPermaLink="false">61a0be421ddff808acb336b5</guid><category><![CDATA[UVA]]></category><category><![CDATA[Competitive Programming]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Mon, 31 Aug 2020 20:26:35 GMT</pubDate><media:content url="https://i.imgur.com/KWJxtCR.png" medium="image"/><content:encoded><![CDATA[<h3 id="problem-pdf"><a href="https://onlinejudge.org/external/6/694.pdf">Problem PDF</a></h3><h3 id="solution-">Solution:</h3><figure class="kg-card kg-code-card"><pre><code class="language-cpp">#include
#include
#include
#include
#include
#include
#include
#include
#include
#include 
#include 
#include
#define ll long long
#define sc scanf
#define pf printf
#define Pi 2*acos(0.0)
using namespace std;
int main()
{
   ll n,e,c,a;
   int no=0;
   while(sc(&quot;%lld %lld&quot;,&amp;n,&amp;e)==2)
   {
       if(n&lt;0&amp;&amp;e&lt;0)
       break;
       c=0;
       a=n;
       while(n&lt;=e)
       {
           if(n==1)
           {
               c++;
               break;
           }
           else if(n%2==0)
           {
               c++;
               n/=2;
           }
           else if(n%2==1)
           {
               c++;
               n=n*3+1;
           }

       }
       pf(&quot;Case %d: A = %lld, limit = %lld, number of terms = %lld\n&quot;,
          ++no,a,e,c);
   }
    return 0;
}

</code></pre><figcaption><a href="https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/694/694.cpp">https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/694/694.cpp</a></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[UVA 686 - Goldbach's Conjecture (II)]]></title><description><![CDATA[uva 686 - goldbach's conjecture (ii) programing problem solution in shipu ahamed blog]]></description><link>https://shipuahamed.com/uva-686-goldbach-s-conjecture-ii/</link><guid isPermaLink="false">61a0be421ddff808acb336b4</guid><category><![CDATA[UVA]]></category><category><![CDATA[Competitive Programming]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Mon, 31 Aug 2020 20:26:34 GMT</pubDate><media:content url="https://i.imgur.com/4MEKs58.png" medium="image"/><content:encoded><![CDATA[<h3 id="problem-pdf"><a href="https://onlinejudge.org/external/6/686.pdf">Problem PDF</a></h3><h3 id="solution-">Solution:</h3><figure class="kg-card kg-code-card"><pre><code class="language-cpp">/*************************************
******** Team : BUBT_HIDDEN **********
**************************************
*********** Shipu Ahamed *************
*************************************/

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include

#define ll long long
#define sc scanf
#define pf printf
#define pi 2*acos(0.0)

#define ft first
#define se second
#define st(s) s.size();
#define r(input) freopen(&quot;input.txt&quot;,&quot;r&quot;,stdin)
#define w(output) freopen(&quot;output.txt&quot;,&quot;w&quot;,stdout)
#define maxall(v) *max_element(v.begin(),v.end())
#define minall(v) *min_element(v.begin(),v.end())
#define Sort(v) sort(v.begin(),v.end())
#define un(v) Sort(v), v.erase(unique(v.begin(),v.end()),v.end())
#define cover(a,d) memset(a,d,sizeof(a))
using namespace std;

bool prime[10000010];
void sieve()
{
    prime[1]=false;
        int n=sqrt(10000000);
        for(int i=2;i&lt;=n;i++)
        {
            if(prime[i]!=false)
            {
                for(int j=2*i;j&lt;=10000000;j=j+i)
                {
                    prime[j]=false;
                }
            }
        }
}
int main()
{
    cover(prime,true);
    sieve();
    int n;
    while(sc(&quot;%d&quot;,&amp;n)==1)
    {
        if(n==0) break;
        int a,i,c=0;
        mapmp;
        for(i=2;i</code></pre><figcaption><code class="language-cpp"><a href="https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/686/686.cpp">https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/686/686.cpp</a></code></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[UVA 679 - Dropping Balls]]></title><description><![CDATA[uva 679 - dropping balls programing problem solution in shipu ahamed blog]]></description><link>https://shipuahamed.com/uva-679-dropping-balls/</link><guid isPermaLink="false">61a0be421ddff808acb336b3</guid><category><![CDATA[UVA]]></category><category><![CDATA[Competitive Programming]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Mon, 31 Aug 2020 20:26:33 GMT</pubDate><media:content url="https://i.imgur.com/36GsbST.png" medium="image"/><content:encoded><![CDATA[<h3 id="problem-pdf"><a href="https://onlinejudge.org/external/6/679.pdf">Problem PDF</a></h3><h3 id="solution-">Solution:</h3><figure class="kg-card kg-code-card"><pre><code class="language-cpp">/******************************************************************
***   Problem       :                                           ***
***   Author        : Shipu Ahamed (Psycho Timekiller)          ***
***   E-mail        : shipuahamed01@gmail.com                   ***
***   University    : BUBT,Dept. of CSE                         ***
***   Team          : BUBT_Psycho                               ***
***   My Blog       : http://shipuahamed.blogspot.com           ***
***   Facebook      : http://www.facebook.com/DeesheharaShipu   ***
******************************************************************/

#include &lt;stdio.h&gt;
#include &lt;math.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
#include &lt;stack&gt;
#include &lt;queue&gt;
#include &lt;vector&gt;
#include &lt;utility&gt;
#include &lt;string&gt;
#include &lt;sstream&gt;
#include &lt;iostream&gt;
#include &lt;set&gt;
#include &lt;map&gt;
#include &lt;algorithm&gt;
#include &lt;memory.h&gt;
#include &lt;functional&gt;
#include &lt;numeric&gt;
#include &lt;bits/stdc++.h&gt;
using namespace std;

#define pi 2*acos(0.0)
#define all(v) v.begin(),v.end()

//input
#define si(t) scanf(&quot;%d&quot;,&amp;t)
#define sl(t) scanf(&quot;%lld&quot;,&amp;t)
#define sf(t) scanf(&quot;%f&quot;,&amp;t)
#define sd(t) scanf(&quot;%lf&quot;,&amp;t)
#define sc(c) scanf(&quot;%c&quot;,&amp;c)
#define sii(a,b) scanf(&quot;%d%d&quot;,&amp;a,&amp;b)
#define sll(a,b) scanf(&quot;%lld%lld&quot;,&amp;a,&amp;b)

//Output
#define P(a) printf(&quot;%d\n&quot;,a)
#define PL(a) printf(&quot;%lld\n&quot;,a)
#define PF(a) printf(&quot;%f\n&quot;,a)
#define PD(a) printf(&quot;%lf\n&quot;,a)
#define PS(a) printf(&quot;%s\n&quot;,a)
#define PSN(a) printf(&quot;%s &quot;,a)
#define PN(a) printf(&quot;%d &quot;,a)
#define PLN(a) printf(&quot;%lld &quot;,a)
#define PFN(a) printf(&quot;%f &quot;,a)
#define PDN(a) printf(&quot;%lf &quot;,a)
#define PP(a,b) printf(&quot;%d %d\n&quot;,a,b)
#define PPN(a,b) printf(&quot;%d %d &quot;,a,b)
#define PPL(a,b) printf(&quot;%lld %lld\n&quot;,a,b)
#define PPLN(a,b) printf(&quot;%lld %lld &quot;,a,b)

#define CP(a) cout&lt;&lt;a&lt;&lt;endl
#define CPN(a) cout&lt;&lt;a&lt;&lt;&quot; &quot;

#define ff first
#define se second
#define pb push_back
#define ST(v) sort(all(v))
#define sz(x) (int)x.size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define maxall(v) *max_element(all(v))
#define minall(v) *min_element(all(v))
#define sqr(a) ((a)*(a))
#define abs(x) (((x)&lt;0)?-(x):(x))
#define cover(a,d) memset(a,d,sizeof(a))
#define popcount(i) __builtin_popcount(i)      //count one. in long long use __builtin_popcountll(i)
#define parity(i)   __builtin_parity(i)       //evenparity 0 and odd parity 1
#define btz(a)   __builtin_ctz(a)            //count binary trailling zero
#define un(v) ST(v), (v).erase(unique(all(v)),v.end())
#define common(a,b) ST(a), ST(b), a.erase(set_intersection(all(a),all(b),a.begin()),a.end())
#define uncommon(a,b) ST(a), ST(b), a.erase(set_symmetric_difference(all(a),all(b),a.begin()),a.end())

typedef  long long ll;
typedef  unsigned long long ull;

typedef  vector&lt;int&gt; vi;
typedef  vector&lt;ll&gt; vll;
typedef  vector&lt;string&gt; vs;
typedef  set&lt;int&gt; si;
typedef  set&lt;string&gt; ss;
typedef  map&lt;int,int&gt; mii;
typedef  map&lt;ll,ll&gt; mll;
typedef  map&lt;string,int&gt; msi;
typedef  map&lt;char,int&gt; mci;

template &lt;typename T&gt;string toString( T Number ){stringstream st;st &lt;&lt; Number;return st.str();}
template &lt;typename T&gt; T SOD(T n) {__typeof(n) sum=0;for(__typeof(n) i=1;i*i&lt;=n;i++)sum+=(n%i)?0:((i*i==n)?i:i+n/i);return sum;}

//For Define
#define forab(i,a,b) for(__typeof(b) i=(a);i&lt;=(b);i++)
#define for0(i,n) forab(i,0,(n)-1)
#define for1(i,n) forab(i,1,n)
#define rforab(i,b,a) for(__typeof(b) i=(b);i&gt;=(a);i--)
#define rfor0(i,n) rforab(i,(n)-1,0)
#define rfor1(i,n) rforab(i,n,1)
#define forstl(i,s) for(__typeof((s).end()) i=(s).begin(); i != (s).end(); i++)

//File input/output
#define input freopen(&quot;in.txt&quot;,&quot;r&quot;,stdin)
#define output freopen(&quot;out.txt&quot;,&quot;w&quot;,stdout)

//upper bound and lower bound
#define LB(a,value) (lower_bound(all(a),value)-a.begin())
#define UB(a,value) (upper_bound(all(a),value)-a.begin())

//Test Case &amp; New line
#define Case(no) printf(&quot;Case %d: &quot;,++no)
#define nl puts(&quot;&quot;)

int stringconvert(string s){int p; istringstream st(s); st&gt;&gt;p ; return p;}

ll pow(ll a,ll b, ll m) { ll res = 1; while(b) { if(b &amp; 1) { res = ( (res % m) * (a % m) ) %m ; } a= ((a%m) * (a%m)) %m; b &gt;&gt;= 1; } return res; }
ll modInverse(ll a, ll m){return pow(a,m-2,m);}

////============ CONSTANT ===============////
#define mx7   10000007
#define mx6   1000006
#define mx5   100005
#define inf   1&lt;&lt;30                                           //infinity value
#define eps   1e-9
#define mx    (100010)
#define mod   1000000007
////=====================================////

int main()
{
    while(1)
    {
        int t;
        si(t);

        if(t==-1) break;

        while(t--)
        {
            int d,n;
            sii(d,n);


            int k=1,node=1,f=0;
            while(k&lt;d)
            {
                 if(n&amp;1 || n==0)
                 {
                     node = node&lt;&lt;1;
                     n=(n/2)+1;
                 }
                 else
                 {
                     node = (node&lt;&lt;1)+1;
                     n/=2;
                 }
                k++;
            }

            P(node);
        }
    }

    return 0;
}</code></pre><figcaption><code class="language-cpp"><a href="https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/679/679.cpp">https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/679/679.cpp</a></code></figcaption></figure>]]></content:encoded></item><item><title><![CDATA[UVA 674 - Coin Change]]></title><description><![CDATA[uva 674 - coin change programing problem solution in shipu ahamed blog]]></description><link>https://shipuahamed.com/uva-674-coin-change/</link><guid isPermaLink="false">61a0be421ddff808acb336b2</guid><category><![CDATA[UVA]]></category><category><![CDATA[Competitive Programming]]></category><dc:creator><![CDATA[Shipu Ahamed]]></dc:creator><pubDate>Mon, 31 Aug 2020 20:26:32 GMT</pubDate><media:content url="https://i.imgur.com/rHOmVWJ.png" medium="image"/><content:encoded><![CDATA[<h3 id="problem-pdf"><a href="https://onlinejudge.org/external/6/674.pdf">Problem PDF</a></h3><h3 id="solution-">Solution:</h3><figure class="kg-card kg-code-card"><pre><code class="language-cpp">#include
#include
long long Mod = 100000007;
int main()
{
       long long coin[6]={1,5,10,25,50},way[7510]={0},i,j,a;
        way[0]=1;
        for(i=0;i&lt;5;i++)
        {
          for(j=coin[i];j&lt;=7500;j++)
          {
                way[j]+=way[j-coin[i]];
                if(way[j]&gt;=Mod)
                way[j]%=Mod;
          }
        }
        while(scanf(&quot;%lld&quot;,&amp;a)==1)
        {
           printf(&quot;%lld\n&quot;,way[a]);
        }
    return 0;
}

</code></pre><figcaption><a href="https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/674/674.cpp">https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/674/674.cpp</a></figcaption></figure>]]></content:encoded></item></channel></rss>