57
veky
22 48 64 Leader of the month
44583/ 53887
Last seen 14 hours ago
Member for 11 years, 6 months, 6 days
Difficulty Advanced
We shall not cease from exploration, and the end of all our exploring will be to arrive where we started and know the place for the first time.

Best reviews / Newest reviews
First-Sim0000 1 1
First, a defaultdict would _really_ help here. :-) Second, you don't need () inside [] indexing. Just d[i, j]. Third, end of line 11 can be just `... else max((n1, s1), (n2, s2))`. Tuples compare sensibly. :-) And fourth, you can get by without tracking lengths all the time, just calculate when n More
defaultdict-Sim0000 1
Yes, this is much nicer. That ugly last line indexing, it could have been just d[max(d)], right? :-) More
First & boring-smilicic 1 1
Not boring at all. That [Chekhov's product](https://en.wikipedia.org/wiki/Chekhov's_gun) in first line is very interesting. I deeply wonder what was its intended purpose in the never-revealed third line. :-DD More
First-tivvit 1
... if array ... is much better than ... if len(array). If you really want to use len(array), you can use and. :-) len(array) and sum(...)*... More
the obvious way-tivvit 1
Line 6: `if number % 5 == number % 3 == 0` More
It can take negative indexes too-borisuvarov 1 1
... except if array is empty, then it cannot. ;-D More
First-splinter12345 1
Please don't use find if you just want to see whether something is _in_ something else. if a.find(b) >= 0: ~~~~> if b in a: Also, sum is a builtin. You can use it directly instead of rewriting it. ;-) return sum(word in text for word in words) More
replace all-michael.kej 1 1
This is really pointless. But it did make me smile. :-) More
mybest-nennogabriel 1 1
Too many "list"s (in cols). You don't need () around '\_\_\_' in lines. You don't need 0 and 9 (len) in slices: inline[::4]. If you're really obsessed with speed, try inlining diags and cols. Also try extending rows directly instead of copying. More
First-RomanKorbutyak 1 1
Nice. Could be a bit simpler if you pulled int conversion into iteration itself: for digit in map(int, str(number)): if digit: result *= digit And use *= and similar assignments... they do make code easier to read. --- A minor philosophical point: "result" would probably More
First-ridhianand16 1 1
Line 4 is a perfect example of what horribilities people go through, just to avoid writing another newline. It's not worth it. :-P digit = int(i) if digit: s *= digit More
First-Sim0000 1 1
Line 1 is unnecessary in principle, but even if this were Python2, it would still be unnecessary, since it specifies the coding of _source text_, and there you don't have any funny characters. :-) BTW that three-char indent really stabs the eye. ;-P More
First-RomanKorbutyak 1 1
Use // for int division, much more readable than int(/). You can also use divmod since you need both size % 2 and size // 2. And eliminate duplication, there's no need to write med calculation twice. You can also use if...else expression, but it's not necessary. And a wizard would use `data[med] + More
Python's family tree-ermichin158 1 1
Why do you always write JavaScript in Python? =-O More
First-RomanKorbutyak 1 1
First, read about `collections.Counter`. It will make your life a lot easier. Second, `dict()` is `{}`. But you probably knew that. :-) Third, drop [] inside (). They are just slowing you and Python down. `sorted(k for ...)`. And fourth, `sorted(blah)[0]` is really more readable and more efficien More
BFS-bryukh 1 1
count\_diff is very nonclear IMO. :-P Much simpler would be to do what the name says, instead of complement\_of\_count\_eq :-P sum(f != s for f, s in ...) \+ what nickie said. Python list is really an array, but that precisely means that pop(0) is O(n). deque is what you need (or better a More
one line-Apua 1 1
Nice contortions you're going through just to get it all in one line. I even learned something (locals can't be changed live, but function dicts are fair game:). It can be made much shorter if you want, though. For example, e[0] if e[1]==k else e[1] can be written as e[e[0]==k]. Also, {e for e in E More
First-AHrEJl 1 1
* About that htoi function: int accepts second argument as base. htoi(a) is in fact int(a,16). revsum can also be written using it, you just have to reverse the string: int(a[1::-1],16) Line 44 could also use revsum, right? * That while loop instead of for is really jarring. And its body could mu More
First-htamas 1 1
Meh... I expected more of you (for example, calculating probability distributions, and guessing most probable things:). BTW, it's surprising you don't use chaining: 0 <= i < N it really is more readable (at least Guido thinks so:). Nice check if field is empty. :-) If neighbors we More
The same without `all`-Tinus_Trotyl 1 1
LOL, this is actually an interesting one. I'd even give it a few thumbs if you change the category. :-P More