Create a new link on your bookmark bar with the following URL:↵
↵
<pre class="prettyprint">javascript:for(var data="",inputs=document.querySelectorAll(".input pre"),i=0;i<inputs.length;i++){var s=inputs[i].innerHTML;s=s.replace(/<br>/g,"\n"),s=s.replace(/\n*$/,"\n\n");var div=document.createElement("div");div.innerHTML=s,s=div.textContent,s=s.replace(/\n/g,"\r\n"),data+=s}var a=document.createElement("a");a.setAttribute("href","data:text/plain,"+encodeURIComponent(data)),a.setAttribute("download","tests.txt"),document.body.appendChild(a),a.click();</pre>↵
↵
which is a minified version of this:↵
<pre class="prettyprint">var data = "";<br/><br/>var inputs = document.querySelectorAll(".input pre");<br/>for (var i = 0; i < inputs.length; i++) {<br/> var s = inputs[i].innerHTML;<br/><br/> // fix spacing<br/> s = s.replace(/<br>/g, "\n");<br/> s = s.replace(/\n*$/, "\n\n");<br/><br/> // decode html entities<br/> var div = document.createElement("div");<br/> div.innerHTML = s;<br/> s = div.textContent;<br/><br/> // for Windows<br/> s = s.replace(/\n/g, "\r\n");<br/><br/> data += s;<br/>}<br/><br/>var a = document.createElement("a");<br/>a.setAttribute("href", "data:text/plain," + encodeURIComponent(data));<br/>a.setAttribute("download", "tests.txt");<br/><br/>document.body.appendChild(a);<br/>a.click();</pre>↵
↵
Clicking this bookmark will download a file with all the sample tests from currently opened problem statement.↵
↵
You can run your solution with all the sample inputs like this:↵
↵
<pre class="prettyprint">int main() {<br/>#ifndef ONLINE_JUDGE<br/> freopen("tests.txt", "r", stdin);<br/>#endif<br/><br/> int n;<br/> while (cin >> n) {<br/> // solve<br/> }<br/> return 0;<br/>}</pre>↵
↵
Cheers!
↵
<pre class="prettyprint">javascript:for(var data="",inputs=document.querySelectorAll(".input pre"),i=0;i<inputs.length;i++){var s=inputs[i].innerHTML;s=s.replace(/<br>/g,"\n"),s=s.replace(/\n*$/,"\n\n");var div=document.createElement("div");div.innerHTML=s,s=div.textContent,s=s.replace(/\n/g,"\r\n"),data+=s}var a=document.createElement("a");a.setAttribute("href","data:text/plain,"+encodeURIComponent(data)),a.setAttribute("download","tests.txt"),document.body.appendChild(a),a.click();</pre>↵
↵
which is a minified version of this:↵
<pre class="prettyprint">var data = "";<br/><br/>var inputs = document.querySelectorAll(".input pre");<br/>for (var i = 0; i < inputs.length; i++) {<br/> var s = inputs[i].innerHTML;<br/><br/> // fix spacing<br/> s = s.replace(/<br>/g, "\n");<br/> s = s.replace(/\n*$/, "\n\n");<br/><br/> // decode html entities<br/> var div = document.createElement("div");<br/> div.innerHTML = s;<br/> s = div.textContent;<br/><br/> // for Windows<br/> s = s.replace(/\n/g, "\r\n");<br/><br/> data += s;<br/>}<br/><br/>var a = document.createElement("a");<br/>a.setAttribute("href", "data:text/plain," + encodeURIComponent(data));<br/>a.setAttribute("download", "tests.txt");<br/><br/>document.body.appendChild(a);<br/>a.click();</pre>↵
↵
Clicking this bookmark will download a file with all the sample tests from currently opened problem statement.↵
↵
You can run your solution with all the sample inputs like this:↵
↵
<pre class="prettyprint">int main() {<br/>#ifndef ONLINE_JUDGE<br/> freopen("tests.txt", "r", stdin);<br/>#endif<br/><br/> int n;<br/> while (cin >> n) {<br/> // solve<br/> }<br/> return 0;<br/>}</pre>↵
↵
Cheers!