verdictsFor(Site site) {
39 | return invMap.keySet()
40 | .stream()
41 | .filter(s -> s.startsWith(site.getShortName()))
42 | .map(s -> s.split(":")[1])
43 | .collect(Collectors.toList());
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/resources/application-dev.properties:
--------------------------------------------------------------------------------
1 | is_prod=false
2 |
3 | # ===============================
4 | # = internal settings
5 | # ===============================
6 | tags_limit=5
7 |
8 | # ===============================
9 | # = compression settings
10 | # ===============================
11 | server.compression.enabled=false
12 |
13 | # ===============================
14 | # = DATA SOURCE
15 | # ===============================
16 |
17 | # Connection url for the database "code-drills"
18 | spring.datasource.url = jdbc:mysql://localhost:3310/code_drills?useSSL=false
19 |
20 | # Username and password
21 | spring.datasource.username = cd_local_user
22 | spring.datasource.password = {cd_use_secure}
23 |
24 | spring.jpa.show-sql = true
25 |
26 | spring.datasource.tomcat.max-active=100
27 | spring.datasource.tomcat.max-idle=8
28 | spring.datasource.tomcat.min-idle=8
29 |
30 |
--------------------------------------------------------------------------------
/src/main/resources/application-prod.properties:
--------------------------------------------------------------------------------
1 | is_prod=true
2 |
3 | # ===============================
4 | # = internal settings
5 | # ===============================
6 | tags_limit=100000
7 |
8 | # ===============================
9 | # = compression settings
10 | # ===============================
11 | server.compression.enabled=true
12 | server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain,text/css,text/js
13 |
14 | # ===============================
15 | # = DATA SOURCE
16 | # ===============================
17 |
18 | # Connection url for the database "code-drills"
19 | spring.datasource.url = jdbc:mysql://localhost:3306/codedrills?useSSL=false
20 |
21 | # Username and password
22 | spring.datasource.username = root
23 | spring.datasource.password = root123 # is replaced via env variable
24 |
25 | spring.jpa.show-sql = false
26 |
27 | spring.datasource.tomcat.max-active=100
28 | spring.datasource.tomcat.max-idle=8
29 | spring.datasource.tomcat.min-idle=8
30 |
--------------------------------------------------------------------------------
/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | # ===============================
2 | # = DATA SOURCE
3 | # ===============================
4 |
5 | # Keep the connection alive if idle for a long time (needed in production)
6 | spring.datasource.testWhileIdle = true
7 | spring.datasource.validationQuery = SELECT 1
8 |
9 | # ===============================
10 | # = JPA / HIBERNATE
11 | # ===============================
12 |
13 | # Hibernate ddl auto (create, create-drop, update): with "update" the database
14 | # schema will be automatically updated accordingly to java entities found in
15 | # the project
16 | spring.jpa.hibernate.ddl-auto = update
17 |
18 | # Naming strategy
19 | spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
20 |
21 | # Allows Hibernate to generate SQL optimized for a particular DBMS
22 | spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
23 |
--------------------------------------------------------------------------------
/src/main/resources/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/favicon.ico
--------------------------------------------------------------------------------
/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | %d{dd MMM yyyy HH:mm:ss.SSS, UTC} [%thread] %-5level %logger{36} - %msg%n
10 |
11 |
12 |
13 |
14 |
15 | ${LOGS}/application.log
16 |
17 | %d{dd MMM yyyy HH:mm:ss.SSS, UTC} [%thread] %-5level %logger{36} - %msg%n
18 |
19 |
20 |
21 |
22 |
23 | ${LOGS}/archived/application.%d{yyyy-MM-dd, UTC}.log
24 |
25 |
26 | 30
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/main/resources/static/css/common.css:
--------------------------------------------------------------------------------
1 | body {
2 | background: #e7e7e7 !important;
3 | }
4 |
5 | .container {
6 | background: #fff !important;
7 | padding-bottom: 25px !important;
8 | }
9 |
10 | .footer {
11 | margin-top: 20px;
12 | }
13 |
14 | .faqHeader {
15 | font-size: 27px;
16 | margin: 20px;
17 | }
18 |
19 | .fb-like {
20 | margin-top: 5px;
21 | }
22 |
23 | .panel-heading [data-toggle="collapse"]:after {
24 | font-family: 'Glyphicons Halflings';
25 | content: "\e072"; /* "play" icon */
26 | float: right;
27 | color: #F58723;
28 | font-size: 18px;
29 | line-height: 22px;
30 | /* rotate "play" icon from > (right arrow) to down arrow */
31 | -webkit-transform: rotate(-90deg);
32 | -moz-transform: rotate(-90deg);
33 | -ms-transform: rotate(-90deg);
34 | -o-transform: rotate(-90deg);
35 | transform: rotate(-90deg);
36 | }
37 |
38 | .panel-heading [data-toggle="collapse"].collapsed:after {
39 | /* rotate "play" icon from > (right arrow) to ^ (up arrow) */
40 | -webkit-transform: rotate(90deg);
41 | -moz-transform: rotate(90deg);
42 | -ms-transform: rotate(90deg);
43 | -o-transform: rotate(90deg);
44 | transform: rotate(90deg);
45 | color: #454444;
46 | }
47 |
48 | .thumbnail img {
49 | min-height: 90px;
50 | height: 100px;
51 | max-height: 120px;
52 | }
53 |
54 | .table-borderless tbody tr td,
55 | .table-borderless tbody tr th,
56 | .table-borderless thead tr th,
57 | .table-borderless thead tr td,
58 | .table-borderless tfoot tr th,
59 | .table-borderless tfoot tr td {
60 | border: none;
61 | }
62 |
63 | .banner {
64 | max-height: 150px;
65 | min-height: 150px;
66 | overflow-y: none;
67 | }
68 |
69 | .site-img {
70 | border: none;
71 | }
72 |
73 | .problem-attributes img {
74 | border: none;
75 | width: 20px;
76 | height: 20px;
77 | margin-left: 5px;
78 | }
79 |
80 | img.input-site-icon {
81 | border: none;
82 | width: 15px;
83 | height: 15px;
84 | margin-left: 5px;
85 | margin-right: 5px;
86 | }
87 |
88 | .site-icon {
89 | border: none;
90 | width: 20px;
91 | height: 20px;
92 | }
93 |
94 | #input-format {
95 | line-height: 175%;
96 | }
97 |
98 | .navbar-right {
99 | margin-top: 5px;
100 | }
101 |
102 | .problem-attributes {
103 | text-align: right;
104 | vertical-align: middle !important;
105 | }
106 |
107 | .practice-solved {
108 | color: green;
109 | text-decoration: line-through;
110 | }
111 |
112 | .code {
113 | margin-top: 20px;
114 | margin-bottom: 20px;
115 | }
116 |
117 | .refs {
118 | margin-top: 10px;
119 | }
120 |
121 | .alert {
122 | margin-top: 10px;
123 | }
124 |
125 | .level > .panel-heading {
126 | background-color: lightgrey;
127 | }
128 |
129 | .level1 > .panel-heading > a {
130 | color: darkgrey;
131 |
132 | }
133 |
134 | .level1-title {
135 | color: darkgrey;
136 | }
137 |
138 | .level2 > .panel-heading > a {
139 | color: darkgreen;
140 | }
141 |
142 | .level2-title {
143 | color: darkgreen;
144 | }
145 |
146 | .level3 > .panel-heading > a {
147 | color: darkblue;
148 | }
149 |
150 | .level3-title {
151 | color: darkblue;
152 | }
153 |
154 | .level4 > .panel-heading > a {
155 | color: #aaaa00;
156 | }
157 |
158 | .level4-title {
159 | color: #aaaa00;
160 | }
161 |
162 | .level5 > .panel-heading > a {
163 | color: red;
164 | }
165 |
166 | .level5-title {
167 | color: red;
168 | }
169 |
170 | .bfscp_title {
171 | font-family: "Courier New", Courier, monospace !important;
172 | }
173 |
174 | .progress-img {
175 | width: 20px;
176 | height: 20px;
177 | }
178 |
179 |
--------------------------------------------------------------------------------
/src/main/resources/static/images/banners/codechef.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/banners/codechef.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/banners/codeforces.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/banners/codeforces.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/banners/facebook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/banners/facebook.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/banners/google.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/banners/google.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/banners/hackerearth.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/banners/hackerearth.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/banners/hackerrank.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/banners/hackerrank.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/banners/ipsc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/banners/ipsc.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/banners/topcoder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/banners/topcoder.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/code-drills.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/code-drills.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/difficulty/easy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/difficulty/easy.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/difficulty/hard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/difficulty/hard.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/difficulty/medium.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/difficulty/medium.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/fb.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/fb.gif
--------------------------------------------------------------------------------
/src/main/resources/static/images/github-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/github-logo.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/icons/codechef.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/icons/codechef.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/icons/codeforces.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/icons/codeforces.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/icons/spoj.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/icons/spoj.png
--------------------------------------------------------------------------------
/src/main/resources/static/images/inprogress.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
14 |
16 |
20 |
24 |
28 |
29 |
37 |
45 |
48 |
51 |
52 |
61 |
62 |
65 |
69 |
73 |
78 |
82 |
85 |
89 |
99 |
108 |
118 |
128 |
138 |
146 |
156 |
166 |
176 |
177 |
178 |
179 |
--------------------------------------------------------------------------------
/src/main/resources/static/images/ln.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/ln.gif
--------------------------------------------------------------------------------
/src/main/resources/static/images/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
14 |
17 |
20 |
24 |
28 |
33 |
38 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/src/main/resources/static/images/sorry.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CodeDrills-CD/codedrills-recommender/9000228ae2ac7a2f55ca9526e7d15359e632dd89/src/main/resources/static/images/sorry.jpg
--------------------------------------------------------------------------------
/src/main/resources/templates/common/head.ftl:
--------------------------------------------------------------------------------
1 | <#ftl output_format="HTML" auto_esc=true>
2 | <#setting url_escaping_charset="UTF-8">
3 | <#assign title="code-drills - Competitive programming resources and problem recommender">
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | ${title}
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
39 |
40 | <#include "/common/navbar.ftl">
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/main/resources/templates/common/macros.ftl:
--------------------------------------------------------------------------------
1 | <#macro displayRating handle rating>
2 |
3 |
4 | ${handle.handle}
5 |
6 |
${rating.current!"NA"}
7 |
(Highest ${rating.highest!"NA"})
8 | #macro>
9 |
10 | <#macro refs name="References">
11 |
12 |
13 |
14 |
15 | ${name}
16 |
17 |
18 |
19 | <#nested>
20 |
21 |
22 | #macro>
23 |
24 | <#macro ref name link>
25 |
${name}
26 | #macro>
27 |
28 | <#macro code gist file>
29 |
30 |
31 |
32 | #macro>
33 |
34 | <#macro info>
35 |
36 |
37 | <#nested>
38 |
39 | #macro>
40 |
41 | <#macro warning>
42 |
43 |
44 | <#nested>
45 |
46 | #macro>
47 |
48 | <#macro remind text>
49 |
50 |
${text}
51 |
52 | #macro>
53 |
54 |
--------------------------------------------------------------------------------
/src/main/resources/templates/common/navbar.ftl:
--------------------------------------------------------------------------------
1 | <#macro isactive type>
2 | <#if type == pageType>
3 | <#assign active="active"/>
4 | <#else>
5 | <#assign active=""/>
6 | #if>
7 | #macro>
8 |
9 |
10 |
11 |
23 |
24 |
25 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/src/main/resources/templates/common/recommendation.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | <#list recommendation.practiceProblems as pr>
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | #list>
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/main/resources/templates/common/tail.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/main/resources/templates/common/tip_macros.ftl:
--------------------------------------------------------------------------------
1 | <#include "/common/macros.ftl">
2 |
3 | <#macro tip_title>
4 | <#nested>
5 | #macro>
6 |
7 | <#macro tip_content>
8 | <#nested>
9 |
10 | #macro>
11 |
--------------------------------------------------------------------------------
/src/main/resources/templates/comparator.ftl:
--------------------------------------------------------------------------------
1 | <#assign pageType="tools">
2 | <#include "/common/head.ftl">
3 |
4 |
5 |
6 |
Competitive programming comparator
7 |
8 |
9 |
10 |
11 |
12 | Compare competitive programming profiles between 2 different sets of handles
13 |
14 |
15 |
16 |
17 |
18 |
58 |
59 |
60 |
61 |
62 |
63 | Input format
64 |
65 |
66 |
67 |
68 | <#include "/partial/input.ftl">
69 |
70 |
71 |
83 |
84 |
85 |
86 | <#include "/common/tail.ftl">
87 |
--------------------------------------------------------------------------------
/src/main/resources/templates/compare.ftl:
--------------------------------------------------------------------------------
1 | <#assign pageType="tools">
2 | <#include "/common/head.ftl">
3 | <#include "/common/macros.ftl">
4 | <#assign ha="${result.handlesA?html}">
5 | <#assign hb="${result.handlesB?html}">
6 |
7 |
8 |
9 |
Comparision Result
10 |
11 |
12 |
13 |
14 |
15 |
A = ${ha}
16 | Vs
17 | B = ${hb}
18 |
19 |
20 |
21 | <#if result.areSame()>
22 |
23 |
24 |
Both handles are same
25 |
26 |
27 |
28 |
29 | The only person you should try to be better than is who you were yesterday
30 |
31 |
32 | <#else>
33 |
34 |
35 |
36 |
37 |
38 | A's ratings
39 |
40 |
41 | <#list result.ratingsA as handle, rating>
42 |
43 | <@displayRating handle=handle rating=rating>@displayRating>
44 |
45 | #list>
46 |
47 |
48 |
49 |
50 |
51 |
52 | B's ratings
53 |
54 |
55 | <#list result.ratingsB as handle, rating>
56 |
57 | <@displayRating handle=handle rating=rating>@displayRating>
58 |
59 | #list>
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | A is stronger than B in
72 |
73 | <#list result.strongerA as t>
74 |
75 |
76 | ${t}
77 |
78 | <#sep> | #sep>
79 | <#else>
80 | None
81 | #list>
82 |
83 |
84 |
85 |
86 | B is stronger than A in
87 |
88 | <#list result.strongerB as t>
89 |
90 |
91 | ${t}
92 |
93 | <#sep> | #sep>
94 | <#else>
95 | None
96 | #list>
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | Problems only solved by A
107 |
108 | <#list result.onlySolvedByA as p>
109 |
${p.name}
110 | <#sep> | #sep>
111 | <#else>
112 | None
113 | #list>
114 |
115 |
116 |
117 |
118 | Problems only solved by B
119 |
120 | <#list result.onlySolvedByB as p>
121 |
${p.name}
122 | <#sep> | #sep>
123 | <#else>
124 | None
125 | #list>
126 |
127 |
128 | #if>
129 |
130 | <#include "/common/tail.ftl">
131 |
--------------------------------------------------------------------------------
/src/main/resources/templates/content/tips.ftl:
--------------------------------------------------------------------------------
1 | <#assign pageType="resources">
2 | <#include "/common/head.ftl">
3 | <#include "/common/macros.ftl">
4 |
5 |
6 |
7 |
Tips and tricks
8 |
9 |
10 |
11 |
12 |
13 |
These articles explain the small tricks and tips that are useful for competitive programmers
14 |
15 |
16 |
17 | <@refs name="Tips and tricks">
18 | <@ref link="/resources/tips/include_all_libraries_cpp" name="Including all libraries in C++">@ref>
19 | <@ref link="/resources/tips/fast_cin_cout_cpp" name="Fast I/O optimization for cin
/cout
in C++">@ref>
20 | @refs>
21 |
22 | <#include "/common/tail.ftl">
23 |
--------------------------------------------------------------------------------
/src/main/resources/templates/content/tips/fast_cin_cout_cpp.ftl:
--------------------------------------------------------------------------------
1 | <#assign pageType="fast_cin_cout_cpp">
2 | <#include "/common/head.ftl">
3 | <#include "/common/tip_macros.ftl">
4 |
5 | <@tip_title>
6 | Fast I/O optimization for cin
/cout
in C++
7 | @tip_title>
8 |
9 | <@tip_content>
10 | Some problems have a huge amount of input and output data. Here are some tips for optimizing I/O through cin
/cout
. Without these optimizations cin
and cout
maybe too slow.
11 |
12 | <@info>
13 | All code snippets provided assume that you have included the required headers and are using namespace std;
14 | @info>
15 |
16 | set sync with stdio to false
17 | C++ allows both C and C++ styled I/O in order to remain backward compatible. So each I/O operation performed on standard C++ streams (such as cin
/cout
/cerr
) are also performed on the standard C streams. We can save a lot of time by not requiring this synchronization. We can do that by:
18 |
19 | <@code gist="https://gist.github.com/code-drills/9e8af843266e58a2d935b6499471d287.js" file="sync_with_stdio.cpp">@code>
20 |
21 | <@warning>
22 | When you set synchronization to false you cannot intermix C++ styled I/O and C styled I/O (scanf
/printf
etc.)
23 | @warning>
24 |
25 | untie cin
and cout
26 | Usually when you output someting to cout
it is not output immediately to stdandard output but stored in a buffer. It has to be flushed for the content to be actually output. Flushing usually happens when the buffer is full or the program is being terminated. To facilitate interaction with the user via cin
/cout
whenever cin
is used cout
is flushed. This is to help with user prompt. Consider the following snippet:
27 |
28 | <@code gist="https://gist.github.com/code-drills/9e8af843266e58a2d935b6499471d287.js" file="tied.cpp">@code>
29 |
30 | Since cin
and cout
are tied, the cout
's buffer is flushed before cin
executes allowing the user to see the prompt. However in coding contests we don't need this. So we can untie cout
from cin
by doing this:
31 |
32 | <@code gist="https://gist.github.com/code-drills/9e8af843266e58a2d935b6499471d287.js" file="untied.cpp">@code>
33 |
34 | Avoid using endl
35 | We usually use endl
for ending a line of output in cout
. But it also has the side effect of flushing cout
. So avoid using endl
and use '\n' instead to take full advantage of bufferring. This is especially useful if you have to output a large number of lines.
36 |
37 | Caveats
38 | Before using these optimizations do try to understand the what and why of each optimization. Otherwise they may cause strange, hard-to-debug bugs. Note that with above optimization you will have to manually flush cout
for interactive problems. You can do that using:
39 |
40 | <@code gist="https://gist.github.com/code-drills/9e8af843266e58a2d935b6499471d287.js" file="flush.cpp">@code>
41 |
42 | Where to put those statements
43 | Those statements should be at start of the program. You can put them in main as the first few lines or if you don't like cluterring main you can use this trick:
44 |
45 | <@code gist="https://gist.github.com/code-drills/9e8af843266e58a2d935b6499471d287.js" file="fastio_class.cpp">@code>
46 |
47 | More optimizations
48 | There are ofcourse more I/O optimizations that can be performed. But these should be enough for the vast majority of problems. See the references for links to articles on more advanced optimizations.
49 |
50 | <@refs>
51 | <@ref name="sync_with_stdio" link="http://en.cppreference.com/w/cpp/io/ios_base/sync_with_stdio">@ref>
52 | <@ref name="endl" link="http://www.cplusplus.com/reference/ostream/endl/">@ref>
53 | <@ref name="tie" link="http://www.cplusplus.com/reference/ios/ios/tie/">@ref>
54 | <@ref name="C++ I/O benchmark" link="http://codeforces.com/blog/entry/5217">@ref>
55 | <@ref name="Fast I/O using getchar" link="http://abhisharlives.blogspot.in/2012/06/really-fast-io-methods-for-programming.html">@ref>
56 | <@ref name="Discussion on advanced fast I/O" link="http://discuss.spoj.com/t/fast-io-in-c-c/3902/8">@ref>
57 | <@ref name="Fast I/O using getc" link="https://discuss.codechef.com/questions/11364/fast-io-discussion">@ref>
58 |
59 | @refs>
60 |
61 |
62 | @tip_content>
63 |
64 | <#include "/common/tail.ftl">
65 |
--------------------------------------------------------------------------------
/src/main/resources/templates/content/tips/include_all_libraries_cpp.ftl:
--------------------------------------------------------------------------------
1 | <#assign pageType="include_all_libraries_cpp">
2 | <#include "/common/head.ftl">
3 | <#include "/common/tip_macros.ftl">
4 |
5 | <@tip_title>
6 | Including all libraries in C++
7 | @tip_title>
8 |
9 | <@warning>
10 | This tip only applies for gcc and mingw compiler
11 | @warning>
12 |
13 |
14 | <@tip_content>
15 | Suppose you have a lot of includes in your code:
16 |
17 | <@code gist="https://gist.github.com/code-drills/02aa2637040d84081ba4478172cd3282.js" file="lots_of_includes.cpp">@code>
18 |
19 | If you use gcc compiler (or minGW) you can replace all of above with a single line:
20 |
21 | <@code gist="https://gist.github.com/code-drills/02aa2637040d84081ba4478172cd3282.js" file="single_include.cpp">@code>
22 |
23 | This header has almost all of the usual libraries. This is especially useful if you don't have template with you or you want to shortern your template. Keep in mind that this is not a standard header file and hence not available in all C++ compilers.
24 |
25 | <@refs>
26 | <@ref name="GCC's stdc++.h header file" link="https://github.com/gcc-mirror/gcc/blob/master/libstdc++-v3/include/precompiled/stdc++.h"> @ref>
27 | @refs>
28 |
29 | @tip_content>
30 |
31 | <#include "/common/tail.ftl">
32 |
--------------------------------------------------------------------------------
/src/main/resources/templates/contests.ftl:
--------------------------------------------------------------------------------
1 | <#assign pageType="contests">
2 | <#include "/common/head.ftl">
3 |
4 | <#macro timeUrl time str msg>
5 |
6 | ${str}
7 |
8 | #macro>
9 |
10 | <#if timezone?has_content>
11 |
12 |
13 |
14 | All times are in
${timezone} time zone.
Switch to UTC .
15 |
16 |
17 | #if>
18 |
19 | <#list contests as type,clists>
20 |
21 |
22 |
${type?cap_first}
23 |
24 |
25 | <#if type == "live">
26 | <#assign startText="Started">
27 | <#assign panelType="panel-success">
28 | <#else>
29 | <#assign startText="Starts">
30 | <#assign panelType="panel-info">
31 | #if>
32 | <#list clists?chunk(3) as crow>
33 |
34 | <#list crow as contest>
35 |
73 | #list>
74 |
75 |
76 | #list>
77 |
78 | #list>
79 | <#include "/common/tail.ftl">
80 |
--------------------------------------------------------------------------------
/src/main/resources/templates/error.ftl:
--------------------------------------------------------------------------------
1 | <#assign pageType="error">
2 | <#include "/common/head.ftl">
3 |
4 |
5 |
${errorText!"Oops! Something went wrong while processing your request."}
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | Mark this as a RTE against us :(
18 |
19 |
20 | <#include "/common/tail.ftl">
21 |
--------------------------------------------------------------------------------
/src/main/resources/templates/partial/analysis.ftl:
--------------------------------------------------------------------------------
1 | <#include "/common/macros.ftl">
2 |
3 |
Analysis
4 |
5 |
6 | <#assign userStats=result.getUserStats()/>
7 | <#assign total_submitted=userStats.totalSubmissions()/>
8 | <#assign subs=userStats.getVerdictCount()/>
9 |
10 | <#assign total_solved=userStats.totalSolved()/>
11 | <#assign tags=userStats.getTagCount()/>
12 |
13 | <#assign strong=userStats.getStrong()/>
14 | <#assign weak=userStats.getWeak()/>
15 |
16 |
17 |
38 |
39 | <#if total_submitted != 0>
40 |
97 |
144 | #if>
145 |
146 |
147 |
148 |
149 | Ratings
150 |
151 |
152 |
153 |
154 |
155 |
156 | <#list userStats.ratings as handle, rating>
157 |
158 | <@displayRating handle=handle rating=rating>@displayRating>
159 |
160 | #list>
161 |
162 |
163 |
164 |
165 |
166 |
167 | Submissions
168 |
169 |
170 |
171 |
172 |
173 |
174 | <#if total_submitted == 0>
175 | No submissions found
176 | #if>
177 |
178 |
179 |
180 |
181 | <#if total_submitted == 0>
182 | No submissions found
183 | #if>
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 | Strong Areas
194 |
195 |
196 |
197 | <#list strong as s>
198 | <#if s?index < 5>
199 |
200 |
201 | ${s.tag}
202 |
203 | #if>
204 | <#else>
205 | Need more submissions for this analysis
206 | #list>
207 |
208 |
209 |
210 |
211 |
212 |
213 | Weak Areas
214 |
215 |
216 |
217 | <#list weak as w>
218 | <#if w?index < 5>
219 |
220 |
221 | ${w.tag}
222 |
223 | #if>
224 | <#else>
225 | Need more submissions for this analysis
226 | #list>
227 |
228 |
229 |
--------------------------------------------------------------------------------
/src/main/resources/templates/partial/input.ftl:
--------------------------------------------------------------------------------
1 | <#macro example>
2 | <#nested>
3 | #macro>
4 |
5 |
6 |
7 | Each handle should be prefixed with the site prefix (in lowercase) of that handle
8 | Sites supported
9 |
10 |
11 |
12 | Site
13 | Prefix
14 | Example
15 |
16 |
17 |
18 |
19 |
20 |
21 | Codeforces
22 |
23 |
24 | cf/
25 | no prefix
26 |
27 |
28 | <@example>cf/tourist@example>
29 | <@example>petr@example>
30 |
31 |
32 |
33 |
34 |
35 | Codechef
36 |
37 | cc/
38 | <@example>cc/mugurelionut@example>
39 |
40 |
41 |
42 |
43 | Spoj
44 |
45 | sp/
46 | <@example>sp/xilinx@example>
47 |
48 |
49 |
50 |
51 |
52 | You can apply multiple prefixes to same handle. This is useful if the same handle is used across multiple sites
53 | e.g. <@example>cf/sp/cc/acrush@example>
54 |
55 |
56 | Different handle groups should be space separated
57 | e.g. <@example>cc/sp/balajiganapath cf/balajiganapathi@example>
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/src/main/resources/templates/partial/recommendations.ftl:
--------------------------------------------------------------------------------
1 | <#assign practice=result.getPracticeRecommendations().getRecommendations()/>
2 | <#assign defaultRec="Warmup">
3 |
4 |
5 |
6 |
7 | Practice Recommendations
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | <#list practice as p>
17 | class="active" #if> >
18 | ${p.name}
19 |
20 | #list>
21 |
22 |
23 |
24 |
25 | <#list practice as recommendation>
26 |
27 |
28 |
29 |
34 |
${recommendation.description}
35 |
36 | <#include "/common/recommendation.ftl">
37 |
38 | #list>
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/main/resources/templates/profile.ftl:
--------------------------------------------------------------------------------
1 | <#assign pageType="tools">
2 | <#include "/common/head.ftl">
3 |
4 |
5 |
6 |
7 | ${result.handles?html}
8 |
9 |
10 |
11 | <#include "/partial/analysis.ftl">
12 | <#include "/partial/recommendations.ftl">
13 |
14 | <#include "/common/tail.ftl">
15 |
--------------------------------------------------------------------------------
/src/main/resources/templates/recommendation_list.ftl:
--------------------------------------------------------------------------------
1 | <#assign pageType="tools">
2 | <#include "/common/head.ftl">
3 |
4 |
5 |
6 |
${recommendation.name}
7 |
8 |
9 |
10 |
11 |
12 |
${recommendation.description}
13 |
14 |
15 |
16 |
17 |
18 |
19 |
Tracking for ${recommendation.handles}
20 |
21 |
22 |
23 |
24 |
25 |
26 |
Use this url to keep track of your recommendation list. You can also share it with your team for team practice. It may take upto 10 minutes for a solved problem to be updated here.
27 |
28 |
29 |
30 |
31 |
32 |
33 | <#include "/common/recommendation.ftl">
34 |
35 | <#include "/common/tail.ftl">
36 |
--------------------------------------------------------------------------------
/src/main/resources/templates/recommender.ftl:
--------------------------------------------------------------------------------
1 | <#assign pageType="tools">
2 | <#include "/common/head.ftl">
3 |
4 |
5 |
6 |
7 |
We are now Open Source!
8 |
CodeDrills recommender is now open source! Visit the GitHub repository to contribute or report issues and feature requests.
9 |
10 |
11 |
12 |
13 |
14 |
15 |
Practice problems recommender
16 |
17 |
18 |
19 |
20 |
21 | Analyze your profile on various competitive programming sites and get practice problem recommendations based on your past submissions
22 |
23 |
24 |
25 |
26 |
27 |
48 |
49 |
50 |
51 |
52 |
53 | Input format
54 |
55 |
56 |
57 |
58 | <#include "/partial/input.ftl">
59 |
60 |
61 |
74 |
75 | <#include "/common/tail.ftl">
76 |
--------------------------------------------------------------------------------