1. I would refrain from including `<bits/stdc++.h>`. This includes pretty much every single STL header which is certainly easier to use but in general you should only include what you actually need. It's also not a standard C++ header file and hence not portable.
1. `using namespace std` is generally [considered bad practice][1].
1. Instead of using `#define` you should use `typedef` (more [here][2]).
1. Use spaces to declutter your code, i.e. instead of `for(int i=0;i<s.length();i++)` it should be `for (int i = 0; i < s.length(); i++)`. This increases readability.
1. Indent your code properly and consistently. Again this improves readability. This is especially important when you decide to omit braces for single line statements in `for` loops or `if` blocks like you did here:
> for(int j=i;j<13+i;j++)
prod*=(s[j]-'0');
if(prod>=max)
max=prod;
This should at least be:
for (int j = i; j < 13 + i; j++)
prod *= (s[j] - '0');
if (prod >= max)
max = prod;
to make clear what belongs into which block. Better would be:
for (int j = i; j < 13 + i; j++)
{
prod *= (s[j] - '0');
}
if (prod >= max)
{
max = prod;
}
Short code is not necessarily good code because it tends to obfuscate the meaning and is more prone to contain bugs.
Cleaned up the code looks like this:
#include <string>
typedef unsigned long long ull
int main()
{
string s;
std::getline(cin, s);
ull max = 0;
for (int i = 0; i < s.length(); i++)
{
ull prod = 1;
for (int j = i; j < 13 + i; j++)
{
prod *= (s[j] - '0');
}
if (prod >= max)
{
max = prod;
}
}
std::cout << max;
return 0;
}
[1]: https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice
[2]: https://stackoverflow.com/questions/2591713/why-use-c-typedefs-rather-than-defines