This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Iterator; | |
import java.util.List; | |
import java.util.Random; | |
import java.util.concurrent.*; | |
import java.util.stream.Collectors; | |
public class CustomExecutor { | |
private SynchronousQueue<Task> queue = new SynchronousQueue<>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable | |
object Solution extends App { | |
val in = io.Source.stdin.getLines() | |
val Array(n, m) = in.next().split(' ').map(_.toInt) | |
val p = in.next().split(' ').map(_.toInt) | |
var pMap = mutable.Map.empty[Int, List[Int]] | |
val s = in.next().split(' ').map(_.toInt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.mutable | |
object Solution extends App { | |
val in = io.Source.stdin.getLines() | |
val Array(n, m) = in.next().split(' ').map(_.toInt) | |
val p = in.next().split(' ').map(_.toInt) | |
var pMap = mutable.Map.empty[Int, List[Int]] | |
var s = in.next().split(' ').map(_.toInt).zipWithIndex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.io.Source | |
object Solution extends App { | |
def swap(arr: Array[Long], i: Int, j: Int) { | |
val tmp = arr(i) | |
arr(i) = arr(j) | |
arr(j) = tmp | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Received: from mxfront2g.mail.yandex.net ([127.0.0.1]) | |
by mxfront2g.mail.yandex.net with LMTP id gahpS8xH | |
for <eldr@ya.ru>; Wed, 30 Mar 2016 09:14:02 +0300 | |
Received: from cm-smtp.beeline.ru (cm-smtp.beeline.ru [89.179.138.59]) | |
by mxfront2g.mail.yandex.net (nwsmtp/Yandex) with ESMTPS id 36ngjvEUWG-E1OqxNuc; | |
Wed, 30 Mar 2016 09:14:01 +0300 | |
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) | |
(Client certificate not present) | |
Return-Path: bee4you@beeline.ru | |
X-Yandex-Front: mxfront2g.mail.yandex.net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Светлана, 16:44 | |
Добрый день! Ярких и солнечных дней вместе с Билайн! Чем могу помочь Вам, Эльдар? | |
Эльдар, 16:45 | |
Добрый день, мой номер был заблокирован и я им не пользовался год. Сегодня я положил на него деньги и хотел бы продолжить его использовать. Можете ли вы мне помочь? | |
Светлана | |
Светлана, 16:49 | |
Речь идет о номере, который Вы указали в теме чата? | |
Светлана | |
Светлана, 16:49 | |
Подскажите, пожалуйста, фамилию, имя и отчество владельца номера. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def snapshot_create(backup_opt_dict): | |
""" | |
Calls the code to take fs snapshots, depending on the platform | |
:param backup_opt_dict: | |
:return: boolean value, True if snapshot has been taken, false otherwise | |
""" | |
if winutils.is_windows(): | |
if backup_opt_dict.snapshot: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Solution extends App { | |
@inline def diff(str1: String, str2: String, i: Int, j: Int, count: Int, maxCalced: Int): Int = { | |
var c = count | |
var a = 0 | |
val maxCount = str1.size - Math.max(i, j) | |
if (maxCount <= maxCalced) | |
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Solution extends App { | |
var cache = Map(Map(1 -> 1) -> true, Map(2 -> 1) -> true) | |
def splitKey(key: Int): Seq[(Int, Int)] = key match { | |
case x if x < 2 => List.empty | |
case x if x == 2 => List((1, 0)) | |
case _ => Range(0, key / 2 + key % 2).map(i => (key - i - 1, i)) ++ | |
Range(0, key / 2).map(i => (key - i - 2, i)) | |
} |
NewerOlder