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 warnings | |
import json | |
warnings.filterwarnings("ignore") | |
from dejavu import Dejavu | |
from dejavu.recognize import FileRecognizer, MicrophoneRecognizer | |
# load config from a JSON file (or anything outputting a python dictionary) | |
with open("dejavu.cnf.SAMPLE") as f: | |
config = json.load(f) |
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 solution(x, a) | |
return 0 if a.empty? || !x.is_a?(Integer) | |
indexes = matched_indexes(a, x) | |
not_matched = a.size - indexes.size | |
k = -1 | |
return k if indexes.size <= 1 || not_matched.odd? | |
indexes.each do |ind, count| | |
if ind > count + not_matched / 2 | |
k = ind - not_matched / 2 |
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
###client side### | |
request_parser_url = 'http://parsing.clickavia.ru/parsing' | |
options = { | |
datafile: { | |
title: 'ntk_mow_boj_csv', | |
parser: { | |
rule: 'some_rule', | |
city_from: 'MOW', | |
city_to: 'BOJ', | |
flight_class: 'econom', |