#dev-general
1 messages ยท Page 92 of 1
rip
share
It wont let me share but
fun main(args : Array<String>) {
val input = Scanner(System.`in`)
val N = input.nextLong()
val s = N.toString()
var sum = 0
for( x in 0..s.length-1){
val y= s[x].toInt()
if(y %2 == 0) sum += y
}
println(sum)
}
Thats what i was trying
.. is end inclusive
score: 14%
it was just giving me really high numbers
Integer.valueOf(String.valueOf(i)
Integer.valueOf(i+"")
Character.getNumericValue(i)
omg i beat bm
Oh shit Yugi, I didn't think of the second one
haahahah L
welp
I beat BM
fuck me
new link when
wew
bm join
yeah
have fun :)
is it addition?
ah yeah I got it
yeah
binary or
|| (ns Solution
(:gen-class))
; Auto-generated code below aims at helping you parse
; the standard input according to the problem statement.
(defn output [msg] (println msg) (flush))
(defn debug [msg] (binding [out err] (println msg) (flush)))
(defn -main [& args]
(let [T (read-line) T2 (read-line)]
(println (apply str (map #(if (or (= %1 \1) (= %2 \1)) \1 \0) T T2)))))
||
solution here
lmao
if anyone understands clojure :)))
sure that helps everyone
does it do tests other than the test cases?
no
I'm disguisted but mk
no
@prisma wave explain my 0% score then
@ocean quartz ?
Yugi I would've beat you if Java wasn't shit and you didn't have to specifiy chars as '' and could have them without ""/''
lmao
It does do random tests for validation, I think
Share code
come join gaby#
bc in is a keyword
ah
^in kotlin
Integer.toBinaryString(Integer.parseInt(T) | Integer.parseInt(T2))
@hot hull
1 sec wait for me
Jesus
had to ad the extra zeros
@old wyvern that does not work
that will remove leading zeros
yeah because of padding
You should share code yugi ๐
oh there
it was also my initial attempt
aj wtf
but the binary stuff never goes right
๐
hAvE yA hEaRd Of SpAcEs smh
xD
for(int i = 0; i<T.length();i++)res+=((T.charAt(i) == '1' || T2.charAt(i) =='1') ? "1":"0");
๐ next ๐ game
@onyx loom you're committed to submitting nonsense results are you lmao
join km and john
โน๏ธ
IM TRYING MY BEST
wat
you in?
Soz was getting a drink
alrighty
Oh god the 3d thingy would be useful here lol
damn
i had this challenge in a college book
if i wouldve learnt how to do it in kotlin
id be winning
mine is a massive hack
ok now let me copy it
yes
those tasks are absolutely shit to do in clojure
lisp ass syntax
clojure is a lisp
wow
i think?
who'd've thought
((((((when )ds) dsfa))fsda))))
yeah keep making fun, noobs
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( return 3 ))))))))))))))))))))))))))))))))))))))))))))
what
oof
90%
Only reason i hate it
is you've never tried it
is because my eyes pobably cant deal with the (())
the last test was 1
oof
Does cpp have something built in for this?
for what?
doesn't seem like it
im pretty sure tho
one sec lemme try to find it
I mean you could do this with hacky string formatting
yeah stupid website ๐
<< "setw(6):" << std::setw(6) << 42 << '\n'
<< "setw(6), several elements: " << 89 << std::setw(6) << 12 << 34 << '\n';```Something like this
ohhh
ayy
I completely forgot what everything does
oh god
should probably look it up before exams
yeah that stuff
that's hideous
Ugly but mk lmao
I feel i did this a weird way
share code
o yea
yeah that's very weird
lol
Done i think
๐
how come i was last ffs
smh my head
Was failing a bit because it had to be until instead of ..
oh god
๐ฎ
share
||println(W == W.reversed())||
oh
bm how tf are you so fast
fuck
educated guess
i didnt quite think it through LMAO
String.reversed() should exist so I tried it
and yes
@onyx loom you need to test it first lmao
ecksdee

๐
he smort
the cool thing about the clojure template is that it's almost always wrong
lmao
and I first have to adjust it
for example (read) doesn't read a string like Scanner#next()
god
that would SUCK
did you steal that name btw
it would be left unused tho
fuck you kid
I saw another language called odin
xD
It'd probably lose to python on shortest code as well
rather big one, too
Yeah but you know what I mean
If I called my language Java people would also ask
And saying "I named it after the island" doesn't really answer that
you're a fraud
Ah you're a reference for everything of course
What the hell? This looks like Go
Goals
simplicity
i gtg
This looks almost exactly like Go
last round for me
Was just checking if W was the same as W reversed
He gone
ah alrighty
Jesus
wtf
why do you guys clash only when I can't play smh
I legit have no clue what I'm looking at..
@distant sun When can you play?
We spent all day doing it yesterday
You gotta be shitting me
@distant sun When can you play?
We spent all day doing it yesterday
@ocean quartz tag me next time smh
At first I thought you had to not include the 4's since there was so many..
I did xD
I'm free in like 1h
Sure thing
no you didnt lol
@lunar cypress join
sTaRt
Syracuse suite
xD
its explained on top
A Syrac suites are every number in the series when you use the following function on any number N:
f(N): even ? N/2 : 3*N+1 till the current syracuse suite is 1
||String a = "";
while(n!=1){
a+=n+" ";
if(n%2==0)n/=2;
else n=n*3+1;
}
System.out.println(a+"1");||
Me too
when you complain about a domain already being registered and it turns out you're the one who registered it and just kinda forgot about it :/
lol what
basically I was complaining about bardy.me being registered since I get a free .me domain with namecheap as part of my GitHub Student Developer Pack, and obviously I'd already claimed that domain before, and just kinda forgot about it, and until I logged in to my namecheap account I didn't realise that it was mine lol
I lost a domain like that, forgot to renew it then it would take 3 months to go into auction or something like that and it'd cost 180$ wtf
Was actually Godaddy in my case
keeps complaining that waterfox isn't a supported browser since waterfox classic uses an older version of firefox for backwards compat
even though it works perfectly fine
https://www.codingame.com/servlet/urlinvite?u=3444825 add me :3
what's your username?iGabyTM?
"Company: help-chat" yeah that sounds like you
ye
later
I'm in
@distant sun
im in class
yeah I had no idea
you give it 4 and you get the sum of 2, 4, 6 and 8, I mean wtf?
lol
we really need to get some more players here
lemme ask if my friend wants to play as well
Im thinking about trying linux, any suggestions?
Sure
Im thinking about trying linux, any suggestions? @jovial warren
arch linux will be way too complex for new linux users
yea im going for mint
never used mint
nvm I have to go back :))
rip
somehow my monstrosity does the job lol
also my friend said he's currently doing puzzles lol
what in the hell is that
it's advent of code
@old wyvern I personally quite like Manjaro on KDE. Doesn't require much setup, comes with most things preinstalled, and looks nice enough
having a look one sec
What time is it for y'all americans rn?
Doesn't the spigot page have them linked?
nope
?autosellapi
Here you can find the API to hook into Clip's plugin AutoSell, which was made by vk2gpz - https://www.spigotmc.org/resources/62935/
Please do not contact Clip for help with this particular resource.
cheers
Since always iirc
It's just not advised
Same with kotlin, you can use semicolons but they advise you don't
Day 1: The Tyranny of the Rocket Equation
@old wyvern Advent of Code is really nice
can recommend
although it gets very, very hard
I see. Ill give it a try tonight ๐
I did half of it last year
Then I just couldn't do it anymore, it took me too long
In one task you have to calculate a simplified solar system and the point in time when it reaches the same constellation for the first time again
that one ended me
or was it the orbit of a planet
I don't remember
o.o
It's always a two part thing. The first part for this one was like "calculate the 1000000. state of the system" and if you solved that naively, the second part would take thousands of years to calculate
and I still have not a damn idea
TSC just got raided rip
also I just boosted and got an x6 multiplier
time to get to chatting
@lunar cypress they announced they were getting raided
Quick! Someone talk about kotlin
Dae kotlin good java bad?
Is it? Please do elaborate
yeah Kotlin > Java any day lol
kotlin
If popularity is purely the basis for an opinion, then that doesnโt mean much
did u guys know kotlin is good?
I'd say underrated by those who never used it, overrated by those who do xD
I would LOVE to elaborate! Kotlin is a high level, statically typed language made by Jetbrains. It most popularly targets the JVM, but also supports JS and Native Code
Would you like to hear another paragraph?
Another tool in the tool belt that has pluses and minuses, but isnโt the second coming
Is Kotlin native faster than JVMs? 
yes please assertTrue(kotlin.isGood)
Is Kotlin native faster than JVMs?
Possibly somewhat. It's mostly made for running kotlin on systems that don't have a JVM
so android?
Android has a JVM
I mean android is jvm
o
It uses a different bytecode format though
didnt know ๐
Yeah Java is kind of ideal for Android
Because WORA
iOS can use native code because they know their target devices
Write Once, Run Anywhere
oh very nice
Once of the main Java features
Pretty much, as long as the architecture supports the JVM
look how big it is now
Has anyone heard about kotlin coroutines? They are a concurrency model that allows programmers to write multithreaded code that looks sequential
That's a huge brain
Woah amazing
Thatโs not a feature unique to kotlin
Oh yeah BM, you might need to help me out with coroutines at some point
so kotlin is good right?
So i can stop using future
kotlin good java bad
I only actually figured out how they work today
I linked a good article in #off-topic which shows quite well how they work
link it again
What would you use instead of supplyAsync then thenAcceptAsync?
https://medium.com/androiddevelopers/coroutines-on-android-part-i-getting-the-background-3e0e54d20bb
Nothing
You write the code as if it's blocking
Eg kotlin val user = getUserFromDB(id) user.something()
No futures needed
Here is what it does for me with future, I start inserting values to the database async, once it's done it'll send a message
Ooh interesting
You basically would do that example then
Imma give it a try in a sec then
getUserFromDB would be a suspend function that uses the IO dispatcher
There's probably facilities to integrate coroutines with "traditional" async code
Probably
I know there is for Flow
But mixing concurrency patterns seems like a bad idea
It's not a mix. If you have to communicate to some outside resource how are you going to do that?
Oh yeah I see what you mean
From what I know a lot of kotlin libraries already support coroutines
You either block in the coroutine (possible, but not really desirable) or you convert it somehow
Yeah but I mean there are cases
But most of the time you should indeed find yourself a library that already has support
Suspend doesn't block the main tread does it?
I'm not sure about that one. I imagine there are libraries that make suspending extension functions for Futures for example
No
Nice
But that is only for java interop, you shouldn't create futures in kotlin
Absolutely not
@ocean quartz suspend means that the function can be paused mid-execution
But yeah if a library gives you a CompletableFuture you may use that
Oh okay, so how would you convert this function?
apologies about how ugly it looks
https://paste.helpch.at/sagayahoze.php
Suspending is like running everything after it in a callback
So while the thing is done, the thread is released for other tasks
When i think about it the accept doesn't make sense to be async
In this case I would probably just block
Coroutines are executed on a thread pool, possibly even the fork join pool, which supplyAsync uses too
So there isn't really a difference there
You can make a custom coroutine context or something of you want proper suspending
you shouldn't block that
you should have 1 suspending function in the IO dispatcher to do the sql call
that would return the measureTimeMillis or whatever
I went specifically with async because it was blocking the main thread for 3 minutes
then you call that function as normal, and treat it as if it was blocking
Java is like cutting butter with a hot knife.
Not sure about that one chief
You do it fast and make a mess while doing it?
kotlin*
Also BM you meant something like this?
https://paste.helpch.at/tahulosamo.bash
i'm pretty dumb
pretty much
Why does it say suspend is redundant?
On the test function
I feel like this explains everything - https://i.gyazo.com/da10f5d8ae105fbe97ff8f32c3777f78.png
hmm
This is true for everything in life
Where would the withDispatcher(Dispatchers.IO) go?
around everything
withDispatcher(IO) {
//everything in here
}```
that makes the coroutine be ran off the main thread
that's probably why it's saying it's redundant btw
Says there is no function called withDispatcher
Maybe i am implementing the wrong coroutines
Oh yeah that fixed the suspend stuff
You should be able to directly launch it with that
Let me try it out
Since withContext only works from within a coroutine scope, no?
Yeah but I mean how do you launch the coroutine currently?
usually you'd use something like GlobalScope.launch no?
Shit, that makes me need to put suspend on the command method which will throw an error on the framework
you don't need to
you can do something like GlobalScope.launch inside the command function
which makes a new coroutine
Ooh
Anyone got an idea how I can speed this up
Running locally on same machine as DB brought big big improvements
But the searching dao's is still slow
Would caching be useful?
Perfect, worked pretty nice
Actually was faster than future
yay
โSo whenโs this operation going to complete?โ โSometime in the Future.โ
kotlin good java bad?
โน๏ธ
Well it was taking 190 seconds with future and 52 with coroutines
190 SECONDS???
Youโre not going to sell that to me if youโre not foaming at the mouth
Yup, it was taking a while
Yeah i told you it was blocking the main thread for 3 minutes xD
wtaf
Any luck, Niall?
About 1500 inserts
jesus
Can you batch them? Thatโs basically what the coroutine is accomplishing
Is this... a Spring?
๐
This one wasn't as big of a difference but still faster than future
What are you saving? Chunks?
It literally says what's being saved in it xD
Just messages, and that takes 2:30?
Yeah, around 1500 messages
are you not able to do it in bulk or something?
Is this a conversion that happens regularly or a one off thing
What are you using
Can't BM
And it's a one off thing to sync of data if the bot goes offline for too long
hm fair enough
What are you using
@heady birch
coroutine everything
Dont tag me please..
tag me
Why not queue up changes and schedule them? Instead of all at once?
if you're doing it async who cares
@prisma wave
NP
It's faster this way, plus it's like BM just said, it's async it doesn't matter much
1500 messages in 2 mins
And what happens if it gets interrupted?
Seriosuly spring could do that in a couple seconds with proper batching
It's a bot for my server, i don't care if it gets interrupted xD
Spring bad coroutines good
I can insert 449222 records in under 5 minutes in spring
they are completely different things but who cares
This is why Hal 9000 went crazy
without any relations
Niall tbh i think what slows it so much is having to iterate through all channels and queue up the past 100 messages for each channel
Just inserting would be probably be fast
That will be it
Why not put it all in a list then do it
I doubt it would rn out of memory
The amount of operations would be the same, so would the time to do it all
Pretty sure this is the slow down of the operations channel.history.retrievePast(100).complete()
probably yeah
you might want to queue that and do it in a callback based fashion
you might also find something like this useful
suspend fun <T> RestAction<T>.await() = suspendCoroutine<T> { continuation ->
queue(
continuation::resume,
continuation::resumeWithException
)
}```
I mean i made my own lib for commands xD
you may also find a library that naturally supports coroutines more useful
Speaking of which i gotta fix a bug in it
help me
Hold the F up
Why is it inserting fast...
๐ฎ
@frail glade Please make my name CEO of enterprise
boost
๐๐
wait if I boost
thats cursed
it's beautiful
WHAT
MY KINDEST PLEASURE,
niall
we making use of all those tier 3 perks?
๐
they're doing science
lol
so they need to collect data for the experiment
what's your host @heady birch ?
@remote goblet gay
of which it will go to the government to confirm the data
๐
also if there's that many requests to log in to the root account you should disable root login or setup fail2ban
they're probably just bots trying to brute force the root password, happens to literally everyone mate
running an experiment on their new brute forcing software
lol
also, even though I deleted my old service offer post, Barry still tells me to wait a month
anything anyone can do about that?
nop
service channels reset tomorrow anyway
if u need a new service post / change it
u can edit it
It's anti bumping
I can't edit a deleted post :/
service channels reset tomorrow anyway
yeah I saw that
u can post then ๐
what's wrong is that I have less than 0% of my knowledge dedicated to usage of the citizens api
a.k.a I got absolutely no clue
have to start somewhere
Figure out how to create a basic Trait and integrate it into the system, even if it's something as simple as persisting a string and having the npc speak it.
fair point
I'm not a massive fan of depending on closed-source projects though
https://github.com/CitizensDev/Citizens2 wait is citizens open-source?
yh
guessing it's "freemium" then
yup
I mean citizens has always been free
Even now it's premium
It's still free if you don't want to pay
But no support for free I think
Citizens still offers free support
and they even tell people that citizens is free
The premium part is a donation and they offer a free link on their premium page
I see
what's that principle acronym again anyone?
which?
SOLID?
๐
rip
how tf did I get 60% on this
Whats my mistake?
you were supposed to split by " "
should have read the question better
huh nvm something is wrong
I'm an idiot
I used split-with instead of partition-by
@old wyvern I can't understand this lol
it has to do with counting a specific letter in the list of Strings they give you.
Then there is also the unused 3rd int.
Once you look at both of them youll get the answer
||count of 'o' * the 3rd int||
ye I got that
anyone using linux, run curl parrot.live in your terminal lol
I was trying to understand how to get the number that has to me multiplied with the 3rd int :))
well I was doing java so
||int count = 0;
for (int i = 0; i < N; i++) {
String row = in.nextLine();
count+=row.chars().filter(a->((char)a)=='o').count();
}||
ikr, im addicted to this xD
@lunar cypress clojur? xd
?
Clojohn
ah
share code gaby
class Solution {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
int M = in.nextInt();
int S = in.nextInt();
int count = 0;
if (in.hasNextLine()) {
in.nextLine();
}
for (int i = 0; i < N; i++) {
count += in.nextLine().chars().filter(ch -> ch == 'o').count();
}
// Write an answer using System.out.println()
// To debug: System.err.println("Debug messages...");
System.out.println(count * S);
}
}```
You can click the "Share" button on the result page btw
^
ah xd
xD
next
we're waiting for our boy
who is that
John's friend I think
we need a channel for this xd
xD
I'll do the next one, in the middle of a tft match xD
tft?
Team fight tactics
Alrighty
nice one
Anyone who I want to talk about writing plug-ins or writing a web site can go to talk. https://www.facebook.com/groups/1106706959702934/
Join plss
Hey guys
Why does facebook look white?
facebook looks like its from 1989
just had a brain fart there
you don't wanna see this
Nothing is in english in it
I do xd
oh you were right
I'm too greedy
Literally had to replace partition with partition-all
god damn it
I had so much time
lol
just put some shitcode in there lmao
wdym
just have a look at my code
what's your point
that you shouldn't wonder why the code looks that shitty
I do not, I'm just mad that I didn't use the correct function
lol
((((())(()()()()((((()()((()))))
(->> S (partition-all 2) (map reverse) flatten (apply str)) like that more?
less parens than go btw ๐
Confused af on this one
it's actually easy
Pretty sure i am overcomplicating it
me too :))
gn
ciao
๐
let's go boyz
Oh i'm dumb
The sounds of condingame are literally the ones you get when you record a whatsapp audio
What's that
wtf
that is an absolutely easy one
I have no idea
same
what have you done @lunar cypress
||binary?||
o
what's the equivalent of that in java?
I used java interop
Oh i was right it was binary
Long.toBinaryString
well F
or what lukas did works in java as well I believe
Integer also has that
I did not like this one xd
well it was a no brainer
I hate reverse ones
:))
got em
oh ..
the reverse ones are fine if it's not maths
Clojure it's lisp?
yes
o
a dialect
maybe this time I will do it better
Wait is Lisp JVM as well?
Ooh interesting, good to know
@lunar cypress did you select reverse mode only? ::))
I am clueless with this
can someone help me setup Bungee voting?
I hate Go for this one lol
think i got it
have a look at my code matt. you may see what my problem was
it just let out the .something. I don't know why, but I had to parse the integers into floats to make it work.
Yeah, I did mine but it was 2.0 instead of 2 so had to check if it was a whole number or not and print it's int version
One of the operands must be a floating-point constant for the result to a floating-point constant. ah yes
I should have looked at the name of the input params earlier
Gab it was just ||(x1 + x2) / 2 and (y1 + y2) / 2||
I saw
Yup
you guys still playing?
yay
it's pretty late here too
i know
ye
again?
Had this one before too
oh lol
god that took me way too long
had to look up how to import java classes in clojure lol
why did you need java classes lol
Because I have a big brain
Using date?
I shared my code
oh you sneaky devil
Pretty smart tbh
implementing this yourself in a non imperative way - good luck
yeah that doesn't sound easy
wtf
:))
lol just import some go time module
package main
import "fmt"
import "time"
/**
* Auto-generated code below aims at helping you parse
* the standard input according to the problem statement.
**/
func main() {
var year int
fmt.Scan(&year)
tm := time.Date(year, 12, 0, 0, 0, 0, 0, time.Local)
// fmt.Fprintln(os.Stderr, "Debug messages...")
fmt.Println(tm.YearDay() > 365)// Write answer to stdout
}
I do
holy
you guys are cheating
Tbh LocalDate.of(year, 1, 1).isLeapYear would be much easier
it's VERY addictive
but here I am, playing this nonsense at 1 am
what's wrong with that?
gotta love FP
shame it will still be longer than kotlin
you sure about that?
absolutely
idk i can't get lower than 87 characters
same
oh god, I just used a 500IQ move lol
How tf did you do 87
BLOATED???
yes
I mean i am doing Kotlin like him and mine is 179
it's 1 line
I mean the standard library is
:))
@ocean quartz replace the Scanner stuff with readLine()!!.toInt()
saves a nice few bytes
yeah
This is my line for (i in 0 until readLine()!!.toInt())if(i%3==0||i%5==0||i%7==0)sum+=i
How do you make it not include the current? I have readLine()!!.toInt().downTo(0).filter { it%3==0||it%5==0||it%7==0 }.sum() but N is also included
fun main()=println((1..readLine()!!.toInt()-1).filter{it%3==0||it%5==0||it%7==0}.sum())```
this is what I'm using
same for me
yeah me too
yup
Oh god
oh no
I am not using clojure for that
Can we skip this one? xD
i... hate this
what?
I get the correct output in the console
but it says I'm printing nothing
no wait
it expects nothing
what
Yeah me too lol
only works for the ones where the chin is 5 chars
Got it
how
How yeah
that was fucking stupid


