content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Solution:
def findLUSlength(self, words):
def isSubsequence(s, t):
t = iter(t)
return all(c in t for c in s)
words.sort(key = lambda x:-len(x))
for i, word in enumerate(words):
if all(not isSubsequence(word, words[j]) for j in range(len(words)) if ... | class Solution:
def find_lu_slength(self, words):
def is_subsequence(s, t):
t = iter(t)
return all((c in t for c in s))
words.sort(key=lambda x: -len(x))
for (i, word) in enumerate(words):
if all((not is_subsequence(word, words[j]) for j in range(len(wor... |
class Query:
def __init__(self, the_query, filename=None):
self.data = None
self.the_query = the_query
def set_data(self, data):
self.data = data
def __repr__(self):
return self.the_query
class LocalMP3Query(Query):
def __init__(self, filename, url, author_name):
... | class Query:
def __init__(self, the_query, filename=None):
self.data = None
self.the_query = the_query
def set_data(self, data):
self.data = data
def __repr__(self):
return self.the_query
class Localmp3Query(Query):
def __init__(self, filename, url, author_name):
... |
class Rect:
def __init__(self, id: int, x: int, y: int, w: int, h: int):
self.id = id
self.pos = (x,y)
self.size = (w,h)
def getX(self):
return self.pos[0]
def getY(self):
return self.pos[1]
def getEndX(self):
return self.getX() + self.getW()
def getEn... | class Rect:
def __init__(self, id: int, x: int, y: int, w: int, h: int):
self.id = id
self.pos = (x, y)
self.size = (w, h)
def get_x(self):
return self.pos[0]
def get_y(self):
return self.pos[1]
def get_end_x(self):
return self.getX() + self.getW()
... |
# Databricks notebook source
# MAGIC %run /Shared/churn-model/utils
# COMMAND ----------
seed = 2022
target = 'Churn'
drop_columns = [target, 'CodigoCliente']
# Get the Train Dataset
dataset = get_dataset('/dbfs/Dataset/Customer')
# Preprocessing Features
dataset, numeric_columns = preprocessing(dataset)
# Split ... | seed = 2022
target = 'Churn'
drop_columns = [target, 'CodigoCliente']
dataset = get_dataset('/dbfs/Dataset/Customer')
(dataset, numeric_columns) = preprocessing(dataset)
(train_dataset, test_dataset) = split_dataset(dataset, seed)
params = {'early_stopping_rounds': 50, 'learning_rate': 0.226, 'max_depth': 64, 'maximize... |
#
# @lc app=leetcode.cn id=747 lang=python3
#
# [747] min-cost-climbing-stairs
#
None
# @lc code=end | None |
class Note:
def __init__(self, number=0, name='', alt_name='', frequency=0, velocity=1):
self.number = number
self.name = name
self.alt_name = alt_name
self.frequency = frequency
self.velocity = velocity
| class Note:
def __init__(self, number=0, name='', alt_name='', frequency=0, velocity=1):
self.number = number
self.name = name
self.alt_name = alt_name
self.frequency = frequency
self.velocity = velocity |
#!/usr/bin/env python
# Copyright (c) 2015 Nelson Tran
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, ... | mouse_cmd = 224
mouse_calibrate = 225
mouse_press = 226
mouse_release = 227
mouse_click = 228
mouse_fast_click = 229
mouse_move = 230
mouse_bezier = 231
mouse_left = 234
mouse_right = 235
mouse_middle = 236
mouse_buttons = [MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT]
keyboard_cmd = 240
keyboard_press = 241
keyboard_release ... |
def minion_game(string):
# your code goes here
vowels = ['A', 'E', 'I', 'O', 'U']
kevin = 0
stuart = 0
for i in range(len(string)):
if s[i] in vowels:
kevin = kevin + (len(s)-i)
else:
stuart = stuart + (len(s)-i)
if stuart > kevin:
... | def minion_game(string):
vowels = ['A', 'E', 'I', 'O', 'U']
kevin = 0
stuart = 0
for i in range(len(string)):
if s[i] in vowels:
kevin = kevin + (len(s) - i)
else:
stuart = stuart + (len(s) - i)
if stuart > kevin:
print('Stuart ' + str(stuart))
eli... |
# https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list
N = int(input())
line_of_numbers = input().split(' ')
# Extract numbers from input line and add them to list
A = []
for i in range(N):
A.append(int(line_of_numbers[i]))
# Sort list and get largest value from it
A.sort()
max_number =... | n = int(input())
line_of_numbers = input().split(' ')
a = []
for i in range(N):
A.append(int(line_of_numbers[i]))
A.sort()
max_number = A[-1]
while A[-1] == max_number:
A.pop()
print(A[-1]) |
# The kth Factor of n
'''
Given two positive integers n and k.
A factor of an integer n is defined as an integer i where n % i == 0.
Consider a list of all factors of n sorted in ascending order, return the kth factor in this list or return -1 if n has less than k factors.
Example 1:
Input: n = 12, k = 3
Output... | """
Given two positive integers n and k.
A factor of an integer n is defined as an integer i where n % i == 0.
Consider a list of all factors of n sorted in ascending order, return the kth factor in this list or return -1 if n has less than k factors.
Example 1:
Input: n = 12, k = 3
Output: 3
Explanation: Factor... |
LOGIN_REQUIRED = 'Es Necesario iniciar Sesion!'
USER_CREATED = 'Usuario Creado Exitosamente!'
LOGOUT = 'Cerraste Sesion!'
ERRO_USER_PASSWORD = 'Usuario o Contrasena Invalidos!'
LOGIN = 'Usuario Autenticado Exitosamente!'
TASK_CREATED = 'Tarea creada Exitosamente!'
TASK_UPDATED = 'Tarea Actualizada!'
TASK_DELETE ... | login_required = 'Es Necesario iniciar Sesion!'
user_created = 'Usuario Creado Exitosamente!'
logout = 'Cerraste Sesion!'
erro_user_password = 'Usuario o Contrasena Invalidos!'
login = 'Usuario Autenticado Exitosamente!'
task_created = 'Tarea creada Exitosamente!'
task_updated = 'Tarea Actualizada!'
task_delete = 'Tare... |
def left_join(d1, d2):
results = []
for key in d1:
if key in d2:
results.append([key, d1[key], d2[key]])
else:
results.append([key, d1[key], None])
return results | def left_join(d1, d2):
results = []
for key in d1:
if key in d2:
results.append([key, d1[key], d2[key]])
else:
results.append([key, d1[key], None])
return results |
listagem = ('APRENDER', 'PROGRAMAR',
'LINGUAGEM', 'PYTHON',
'CURSO', 'GRATIS',
'ESTUDAR', 'PRATICAR',
'TRABALHAR', 'MERCADO',
'PROGRAMADOR', 'FUTURO')
for pos in listagem:
print(f'\nNa palavra {pos} temos ', end=' ')
for letra in pos:
if letra.... | listagem = ('APRENDER', 'PROGRAMAR', 'LINGUAGEM', 'PYTHON', 'CURSO', 'GRATIS', 'ESTUDAR', 'PRATICAR', 'TRABALHAR', 'MERCADO', 'PROGRAMADOR', 'FUTURO')
for pos in listagem:
print(f'\nNa palavra {pos} temos ', end=' ')
for letra in pos:
if letra.upper() in 'AEIOU':
print(letra, end=' ') |
# In Python, the names of classes follow the CapWords
# convention. Let's convert the input phrase accordingly by
# capitilizing all words and spelling them without underscores in-
# between.
# The input format:
# A word or phrase, with words separated by underscores, like
# function and variable names in Python.
# ... | word = input()
print(word.title() if word.find('_') == -1 else word.title().replace('_', ''))
print(''.join([x.capitalize() for x in input().lower().split('_')])) |
pow_of_5th = {i:i**5 for i in range(10)}
def get_5th_pow_of(n):
return pow_of_5th[n]
def get_sum_of_5th_pow_of(n):
sum = 0
for digit in str(n):
sum += get_5th_pow_of(int(digit))
return sum
if __name__ == "__main__":
numb = set()
ceil = ((pow_of_5th[9]) * 9)+1 # Verify this ceil
for n in range(2, ce... | pow_of_5th = {i: i ** 5 for i in range(10)}
def get_5th_pow_of(n):
return pow_of_5th[n]
def get_sum_of_5th_pow_of(n):
sum = 0
for digit in str(n):
sum += get_5th_pow_of(int(digit))
return sum
if __name__ == '__main__':
numb = set()
ceil = pow_of_5th[9] * 9 + 1
for n in range(2, cei... |
CONSUMER_API_KEY = ""
CONSUMER_API_SECRET = ""
ACCESS_TOKEN = ""
ACCESS_KEY = ""
| consumer_api_key = ''
consumer_api_secret = ''
access_token = ''
access_key = '' |
def emergency_stop(driver):
driver.setSteeringAngle(0.0)
driver.setCruisingSpeed(0)
def stop(driver, frame=30):
driver.setSteeringAngle(0.0)
driver.setCruisingSpeed(0)
def print_all_devices(r):
print('---------------------------------------')
for i in range(r.getNumberOfDevices()):
... | def emergency_stop(driver):
driver.setSteeringAngle(0.0)
driver.setCruisingSpeed(0)
def stop(driver, frame=30):
driver.setSteeringAngle(0.0)
driver.setCruisingSpeed(0)
def print_all_devices(r):
print('---------------------------------------')
for i in range(r.getNumberOfDevices()):
pri... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Script: solution.py
# @Author: Pradip Patil
# @Contact: @pradip__patil
# @Created: 2018-02-12 23:58:20
# @Last Modified By: Pradip Patil
# @Last Modified: 2018-02-13 00:15:16
# @Description: https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/prob... | if __name__ == '__main__':
n = int(input())
print(sorted(set([int(i) for i in input().split()]))[-2]) |
class Base(object):
TYPE_ATTRIBUTES = ("_entity_type", "workflow_type")
@staticmethod
def _get_camelcase(attribute):
if attribute in Base.TYPE_ATTRIBUTES:
return "type"
tmp = attribute.split("_")
return tmp[0] + "".join([w.title() for w in tmp[1:]])
@staticmethod
... | class Base(object):
type_attributes = ('_entity_type', 'workflow_type')
@staticmethod
def _get_camelcase(attribute):
if attribute in Base.TYPE_ATTRIBUTES:
return 'type'
tmp = attribute.split('_')
return tmp[0] + ''.join([w.title() for w in tmp[1:]])
@staticmethod
... |
n = int(input())
while n:
p = str(input())
print("gzuz")
n = n - 1
| n = int(input())
while n:
p = str(input())
print('gzuz')
n = n - 1 |
group_name = [
'DA',
'DG',
'DC',
'DT',
'DI'
]
| group_name = ['DA', 'DG', 'DC', 'DT', 'DI'] |
LESSONS = [
{
"Move cursor left": ["h"],
"Move cursor right": ["l"],
"Move cursor down": ["j"],
"Move cursor up": ["k"],
"Close file": [":q"],
"Close file, don't save changes": [":q!"],
"Save changes to file": [":w"],
"Save changes and close file": [":... | lessons = [{'Move cursor left': ['h'], 'Move cursor right': ['l'], 'Move cursor down': ['j'], 'Move cursor up': ['k'], 'Close file': [':q'], "Close file, don't save changes": [':q!'], 'Save changes to file': [':w'], 'Save changes and close file': [':wq', ':x', 'ZZ'], 'Delete character at cursor': ['x'], 'Insert at curs... |
def centuryFromYear(year):
if ((year > 0) and (year <= 2005)):
str_year = str(year) # converts integer input to string type with 'str()'
len_year = len(str_year) # finds length of new 'str_year'
century_arr = []
century = 0
# iterates through 'str_year'...
for digit... | def century_from_year(year):
if year > 0 and year <= 2005:
str_year = str(year)
len_year = len(str_year)
century_arr = []
century = 0
for digit in range(len_year):
century_arr.append(str_year[digit])
if len_year == 1:
century += 1
if le... |
#
# PySNMP MIB module CISCO-DMN-DSG-SDI-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-DMN-DSG-SDI-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:37:52 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_size_constraint, value_range_constraint, constraints_intersection) ... |
#
# TrafficLight.py
# Taco --- SPH Innovation Challenge
#
# Created by Mat, Kon and Len on 2017-03-11.
# Copyright 2016 Researchnix. All rights reserved.
#
class TrafficLight:
# State is a 2D array with the values 0 and 1 associating red and green
# to the path from one incoming street to another outgoi... | class Trafficlight:
state = {}
def __init__(self, incoming, outgoing):
for o in outgoing:
self.state[o.ID] = {}
for i in incoming:
self.state[o.ID][i.ID] = True
def set_state(self):
pass
def path_allowed(self, i, o):
return self.state[o]... |
mins = []
maxes = []
letters = []
passwords = []
with open("day2_input", "r") as f:
for line in f:
first, second = line.split(':')
first = first.split('-')
mins.append(int(first[0]))
maxes.append(int(first[1].split(' ')[0]))
letters.append(first[1].split(' ')[1])
pas... | mins = []
maxes = []
letters = []
passwords = []
with open('day2_input', 'r') as f:
for line in f:
(first, second) = line.split(':')
first = first.split('-')
mins.append(int(first[0]))
maxes.append(int(first[1].split(' ')[0]))
letters.append(first[1].split(' ')[1])
pa... |
#
# PySNMP MIB module PDN-UPLINK-TAGGING-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-UPLINK-TAGGING-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:39:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint) ... |
class Chromosome:
def __init__(self, gene):
self.gene = gene
| class Chromosome:
def __init__(self, gene):
self.gene = gene |
#
# PySNMP MIB module FDRY-RADIUS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/FDRY-RADIUS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:59:41 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, value_range_constraint, constraints_union, constraints_intersection) ... |
expected_output = {
"ap_name": {
"b25a-13-cap10": {
"ap_mac": "3c41.0fee.5094",
"site_tag_name": "default-site-tag-fabric",
"policy_tag_name": "PT_Fabri_B25_B25-1_fe778",
"rf_tag_name": "Standard",
"misconfigured": "No",
"tag_source": "... | expected_output = {'ap_name': {'b25a-13-cap10': {'ap_mac': '3c41.0fee.5094', 'site_tag_name': 'default-site-tag-fabric', 'policy_tag_name': 'PT_Fabri_B25_B25-1_fe778', 'rf_tag_name': 'Standard', 'misconfigured': 'No', 'tag_source': 'Static'}, 'b25b-12-cap01': {'ap_mac': '3c41.0fee.5884', 'site_tag_name': 'default-site-... |
epoch = 100
train_result = "/home/yetaoyu/zc/Classification/patch_train_results"
train_dataset_dir = "/home/yetaoyu/zc/Classification/patch_data"
test_data_dir = "/home/yetaoyu/zc/Classification/patch_data"
test_result_dir = "/home/yetaoyu/zc/Classification/patch_test_results"
model_weight_path = "/home/yetaoyu/zc/Clas... | epoch = 100
train_result = '/home/yetaoyu/zc/Classification/patch_train_results'
train_dataset_dir = '/home/yetaoyu/zc/Classification/patch_data'
test_data_dir = '/home/yetaoyu/zc/Classification/patch_data'
test_result_dir = '/home/yetaoyu/zc/Classification/patch_test_results'
model_weight_path = '/home/yetaoyu/zc/Clas... |
bunsyou = "I am a"
gengo = "cat"
if len(gengo) > 3:
print(gengo)
elif bunsyou[-1] == gengo[1]:
print(bunsyou)
else:
print(bunsyou + " " + gengo)
| bunsyou = 'I am a'
gengo = 'cat'
if len(gengo) > 3:
print(gengo)
elif bunsyou[-1] == gengo[1]:
print(bunsyou)
else:
print(bunsyou + ' ' + gengo) |
# Space: O(n)
# Time: O(n!)
class Solution:
def permuteUnique(self, nums):
def backtracking(nums_list, temp_list, res, visited):
if len(nums_list) == len(temp_list):
res.append(temp_list[:])
for i, num in enumerate(nums_list):
if visited[i]: contin... | class Solution:
def permute_unique(self, nums):
def backtracking(nums_list, temp_list, res, visited):
if len(nums_list) == len(temp_list):
res.append(temp_list[:])
for (i, num) in enumerate(nums_list):
if visited[i]:
continue
... |
#
# PySNMP MIB module HH3C-NVGRE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HH3C-NVGRE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:16:01 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection, constraints_union) ... |
def isPrime(n):
if n<=3 :
return True
for i in range(2, n):
if n%i==0:
return False
return True
a,b = map(int, input().split())
flag = True
if not isPrime(a) or not isPrime(b):
flag = False
print("NO")
else :
for i in range(a+1,b):
if isPrime(i):
... | def is_prime(n):
if n <= 3:
return True
for i in range(2, n):
if n % i == 0:
return False
return True
(a, b) = map(int, input().split())
flag = True
if not is_prime(a) or not is_prime(b):
flag = False
print('NO')
else:
for i in range(a + 1, b):
if is_prime(i):... |
def binary_search_recursive(array, element, start, end):
if start > end:
return -1
mid = (start + end) // 2
if element < array[mid]:
return binary_search_recursive(array, element, start, mid - 1)
else:
return binary_search_recursive(array, element, mid + 1, end)
element = 1... | def binary_search_recursive(array, element, start, end):
if start > end:
return -1
mid = (start + end) // 2
if element < array[mid]:
return binary_search_recursive(array, element, start, mid - 1)
else:
return binary_search_recursive(array, element, mid + 1, end)
element = 18
arra... |
_base_ = './faster_rcnn_r50_fpn_1x_voc0712_cocofmt.py'
model = dict(
rpn_head=dict(loss_bbox=dict(type='MSELoss', loss_weight=1.0)),
roi_head=dict(
bbox_head=dict(
loss_bbox=dict(type='MSELoss', loss_weight=1.0))))
optimizer_config = dict(
_delete_=True, grad_clip=dict(max_norm=35, norm... | _base_ = './faster_rcnn_r50_fpn_1x_voc0712_cocofmt.py'
model = dict(rpn_head=dict(loss_bbox=dict(type='MSELoss', loss_weight=1.0)), roi_head=dict(bbox_head=dict(loss_bbox=dict(type='MSELoss', loss_weight=1.0))))
optimizer_config = dict(_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))
work_dir = './work_dirs/voc... |
no_of_labels=4
no_of_iterations = 10
graph = {
'a': {('b', 1), ('e', 4),('c',2)},
'b': {('a',1),('c', 3), ('d',3),('e',4)},
'c': {('a',2),('d',1),('b',3)},
'd': {('b',3),('e',1), ('c',1)},
'e': {('d',1),('a',4),('b',4)}
} | no_of_labels = 4
no_of_iterations = 10
graph = {'a': {('b', 1), ('e', 4), ('c', 2)}, 'b': {('a', 1), ('c', 3), ('d', 3), ('e', 4)}, 'c': {('a', 2), ('d', 1), ('b', 3)}, 'd': {('b', 3), ('e', 1), ('c', 1)}, 'e': {('d', 1), ('a', 4), ('b', 4)}} |
# Read one line of data
file = open('myfile.txt', 'r')
line_of_data = file.readline()
print(line_of_data, end='')
file.close()
| file = open('myfile.txt', 'r')
line_of_data = file.readline()
print(line_of_data, end='')
file.close() |
#
# PySNMP MIB module Nortel-Magellan-Passport-VnetEtsiQsigMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-Magellan-Passport-VnetEtsiQsigMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:19:14 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davw... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_intersection, value_size_constraint, constraints_union) ... |
# -*- coding: utf-8 -*-
# (N.B : the site root is also related to the nginx conf!)
SITE_ROOT = "__YNH_APP_WEBPATH__"
DEBUG = False
TEMPLATE_DEBUG = False
| site_root = '__YNH_APP_WEBPATH__'
debug = False
template_debug = False |
class TestarosaPyError(Exception):
...
class AnotherError(TestarosaPyError):
...
| class Testarosapyerror(Exception):
...
class Anothererror(TestarosaPyError):
... |
def upper_case_first_param(func):
def wrapper(text):
return func(text.upper())
return wrapper
@upper_case_first_param
def recibed_a_msg(name: str) -> str:
return f"{name}, you has received a message."
@upper_case_first_param
def uppercase(msg: str) -> str:
return msg
if __name__ == "__mai... | def upper_case_first_param(func):
def wrapper(text):
return func(text.upper())
return wrapper
@upper_case_first_param
def recibed_a_msg(name: str) -> str:
return f'{name}, you has received a message.'
@upper_case_first_param
def uppercase(msg: str) -> str:
return msg
if __name__ == '__main__'... |
class FlagRegion:
def __init__(self, name, format, icon, mode):
self.name = name
self.format = format
self.icon = icon
self.mode = mode
| class Flagregion:
def __init__(self, name, format, icon, mode):
self.name = name
self.format = format
self.icon = icon
self.mode = mode |
class Status(object):
'''Object to represent row in status table
Attributes:
conn: database connection, usually sqlite3 connection object
name: name of pipeline job running
display_name: pretty formatted display name for pipeline
last_ran: UNIX timestamp (number) for last comple... | class Status(object):
"""Object to represent row in status table
Attributes:
conn: database connection, usually sqlite3 connection object
name: name of pipeline job running
display_name: pretty formatted display name for pipeline
last_ran: UNIX timestamp (number) for last comple... |
# clean = open("../data/fics_2017_HvC.pgn", "w+")
# with open("../data/fics_2017_HvC_raw.pgn") as raw:
# for i, line in enumerate(raw):
# if (i % 1000): print(i)
# if "\r\n" in line:
# clean.write(line.replace("\r\n", "\n"))
# else:
# clean.write("\n\n")
# clean.... | def write_eof(src):
with open(src, 'a') as f:
f.write('EOF\n')
write_eof('../data/fics_2017_HvC.pgn')
write_eof('../data/games.pgn') |
# Multiple Choice
# Return the answer to the multiple choice question in the handout.
# If you think option c is the correct answer,
# return 'c'
def question_1():
# [Image] The first hidden layer has 4 filters of kernel-width 2 and stride 2;
# the second layer has 3 filters of kernel-width 8 and stride 2; th... | def question_1():
return 'b'
def question_2():
return 'd'
def question_3():
return 'b'
def question_4():
return 'a'
def question_5():
return 'a' |
class WorkflowNotFound(Exception):
pass
class WorkflowSyntaxError(Exception):
pass
| class Workflownotfound(Exception):
pass
class Workflowsyntaxerror(Exception):
pass |
#
# PySNMP MIB module ALVARION-BANDWIDTH-CONTROL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALVARION-BANDWIDTH-CONTROL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:21:58 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... | (alvarion_mgmt_v2,) = mibBuilder.importSymbols('ALVARION-SMI', 'alvarionMgmtV2')
(alvarion_priority_queue,) = mibBuilder.importSymbols('ALVARION-TC', 'AlvarionPriorityQueue')
(octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mib... |
# Solution by PauloBA
def sum_of_minimums(numbers):
ans = 0
for i in numbers:
i.sort()
ans = ans + i[0]
return ans | def sum_of_minimums(numbers):
ans = 0
for i in numbers:
i.sort()
ans = ans + i[0]
return ans |
s=str(input()) # Number n in binary format
s='0'+s # Trailing zero will make the code run for '11111' etc. without changes
first1=-1
seqend=-1
if s[-1]=='0':
'''
If s ends with '0', the next biggest number will be '1' followed by the
number of '0's + one extra '0' followed by the number of '1's. For ex:
... | s = str(input())
s = '0' + s
first1 = -1
seqend = -1
if s[-1] == '0':
"\n If s ends with '0', the next biggest number will be '1' followed by the\n number of '0's + one extra '0' followed by the number of '1's. For ex:\n\n if s = 111000\n answer = 1000011\n "
for i in range(len(s)):
if ... |
n = int(input())
case = 0
l = []
for i in range(n):
item = int(input())
l.append(item)
for i in l:
for j in range(1, i+1):
x = j
y = i - j
lx = [int(a) for a in str(x)]
ly = [int(b) for b in str(y)]
if((4 in lx) or (4 in ly)):
con... | n = int(input())
case = 0
l = []
for i in range(n):
item = int(input())
l.append(item)
for i in l:
for j in range(1, i + 1):
x = j
y = i - j
lx = [int(a) for a in str(x)]
ly = [int(b) for b in str(y)]
if 4 in lx or 4 in ly:
continue
else:
... |
# If Expression
# if expr:
if True:
print("it is true")
else:
print("it is false")
if False:
print("it is false")
print("print intented next line")
else:
print("it is not false")
if bool("python"):
print("it is python")
else:
print("it is not python")
h = 50
if h > 50:
print("h is n... | if True:
print('it is true')
else:
print('it is false')
if False:
print('it is false')
print('print intented next line')
else:
print('it is not false')
if bool('python'):
print('it is python')
else:
print('it is not python')
h = 50
if h > 50:
print('h is not greater than 50')
else:
p... |
'''
test cases and facts for unit tests
'''
# list for testing fibonacci output
fib_list = [
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597,
2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418,
317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465,
... | """
test cases and facts for unit tests
"""
fib_list = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
'chromium_code': 1,
},
'includes': [
'../../build/common_untrusted.gypi',
],
'conditions': [
['disable_nacl==0 and dis... | {'variables': {'chromium_code': 1}, 'includes': ['../../build/common_untrusted.gypi'], 'conditions': [['disable_nacl==0 and disable_nacl_untrusted==0', {'targets': [{'target_name': 'sandbox_linux_nacl_nonsfi', 'type': 'none', 'variables': {'nacl_untrusted_build': 1, 'nlib_target': 'libsandbox_linux_nacl_nonsfi.a', 'bui... |
# Given two integers representing the numerator and denominator of a fraction,
# return the fraction in string format.
# If the fractional part is repeating, enclose the repeating part in parentheses.
class Solution:
# @return a string
def fractionToDecimal(self, numerator, denominator):
(integer, rem... | class Solution:
def fraction_to_decimal(self, numerator, denominator):
(integer, remainder) = divmod(numerator, denominator)
if remainder == 0:
return str(integer)
else:
return str(integer) + '.' + self.tenths(remainder, denominator, '')
def tenths(self, numerat... |
credentials = dict(
email = '',
password = '',
telegram_api_token = '__telegram_api_token__',
telegram_userid = '__telegram_userid__'
)
| credentials = dict(email='', password='', telegram_api_token='__telegram_api_token__', telegram_userid='__telegram_userid__') |
with open("0404.csv", 'r', encoding='utf-8') as f:
lines = f.readlines()
new_Json = {}
hospital_Json = {}
hospital_Json['date'] = '0404'
school_list = []
for line in lines:
#print(len(line))
if len(line)<=1:
continue
lineList = line.split(",")
doc = ... | with open('0404.csv', 'r', encoding='utf-8') as f:
lines = f.readlines()
new__json = {}
hospital__json = {}
hospital_Json['date'] = '0404'
school_list = []
for line in lines:
if len(line) <= 1:
continue
line_list = line.split(',')
doc = {}
doc['Suburb'... |
num = int(input())
def f(n):
if n <= 0:
return 0
return f(n-1) + n
print(f(num))
| num = int(input())
def f(n):
if n <= 0:
return 0
return f(n - 1) + n
print(f(num)) |
# -*- coding: utf-8 -*-
pytest_plugins = [
u'ckan.tests.pytest_ckan.ckan_setup',
u'ckan.tests.pytest_ckan.fixtures',
u'ckanext.harvest.tests.fixtures',
]
| pytest_plugins = [u'ckan.tests.pytest_ckan.ckan_setup', u'ckan.tests.pytest_ckan.fixtures', u'ckanext.harvest.tests.fixtures'] |
# -*- coding:utf-8 -*-
class Solution:
stack1 = []
stack2 = []
def push(self, node):
# write code here
self.stack1.append(node)
def pop(self):
# return xx
if len(self.stack2)==0:
while len(self.stack1)!=0:
self.stack2.append(self.stack1[-1])
... | class Solution:
stack1 = []
stack2 = []
def push(self, node):
self.stack1.append(node)
def pop(self):
if len(self.stack2) == 0:
while len(self.stack1) != 0:
self.stack2.append(self.stack1[-1])
self.stack1.pop()
xx = self.stack2[-1]
... |
def validate_columns(table_catalog, column_family_id, keys, values_batch):
columns = table_catalog["column_families"][column_family_id]["columns"].keys()
row_key_identifiers = table_catalog["row_key_identifiers"]
unregisterd_keys = set(keys) - (set(row_key_identifiers) | set(columns))
if unregisterd_ke... | def validate_columns(table_catalog, column_family_id, keys, values_batch):
columns = table_catalog['column_families'][column_family_id]['columns'].keys()
row_key_identifiers = table_catalog['row_key_identifiers']
unregisterd_keys = set(keys) - (set(row_key_identifiers) | set(columns))
if unregisterd_key... |
#!/usr/bin/env python3
# -*- coidng=utf-8 -*-
'''
learn MOEA/D
'''
def main():
pass
if __name__ == '__main__':
main() | """
learn MOEA/D
"""
def main():
pass
if __name__ == '__main__':
main() |
def displayPermuation(s):
return displayPermuationHelper("", s)
def displayPermuationHelper(s1, s2):
if len(s2) == 0:
print (s1)
for i in range(len(s2)):
displayPermuationHelper(s1 + s2[i], s2[0: i] + s2[i + 1 : ])
def main():
str = input("Please enter a string: ").replace(' ', '')
... | def display_permuation(s):
return display_permuation_helper('', s)
def display_permuation_helper(s1, s2):
if len(s2) == 0:
print(s1)
for i in range(len(s2)):
display_permuation_helper(s1 + s2[i], s2[0:i] + s2[i + 1:])
def main():
str = input('Please enter a string: ').replace(' ', '')
... |
Version = "{{VERSION}}"
if __name__ == "__main__":
print(Version)
| version = '{{VERSION}}'
if __name__ == '__main__':
print(Version) |
# Problem URL: https://leetcode.com/problems/4sum/
class Solution:
def fourSum(self, nums: List[int], target: int) -> List[List[int]]:
solution = set()
nums.sort()
if len(nums) < 4:
return []
for i in range(len(nums)-3):
for j in range(... | class Solution:
def four_sum(self, nums: List[int], target: int) -> List[List[int]]:
solution = set()
nums.sort()
if len(nums) < 4:
return []
for i in range(len(nums) - 3):
for j in range(i + 1, len(nums) - 2):
p = j + 1
q = le... |
def solve(a, b):
larger = max(a, b)
return larger
def main():
a, b = map(int, input().strip().split())
a, b = int(str(a)[::-1]), int(str(b)[::-1])
return solve(a, b)
if __name__ == "__main__":
print(main()) | def solve(a, b):
larger = max(a, b)
return larger
def main():
(a, b) = map(int, input().strip().split())
(a, b) = (int(str(a)[::-1]), int(str(b)[::-1]))
return solve(a, b)
if __name__ == '__main__':
print(main()) |
if __name__ == '__main__':
samples = [
[0, 0, 2, 'EA'],
[1, 'QRI', 0, 4, 'RRQR'],
[1, 'QFT', 1, 'QF', 7, 'FAQFDFQ'],
[1, 'EEZ', 1, 'QE', 7, 'QEEEERA'],
[0, 1, 'QW', 2, 'QW']
]
for sample in samples:
haha
| if __name__ == '__main__':
samples = [[0, 0, 2, 'EA'], [1, 'QRI', 0, 4, 'RRQR'], [1, 'QFT', 1, 'QF', 7, 'FAQFDFQ'], [1, 'EEZ', 1, 'QE', 7, 'QEEEERA'], [0, 1, 'QW', 2, 'QW']]
for sample in samples:
haha |
LOG_FILE_NAME = "logs/log.txt"
SUCESS_FILE_NAME = "logs/success.txt"
FAIL_FILE_NAME = "logs/fail.txt"
EXCEPTION_FILE_NAME = "logs/exception.txt"
ALL_PATHS = [LOG_FILE_NAME, SUCESS_FILE_NAME, FAIL_FILE_NAME, EXCEPTION_FILE_NAME] | log_file_name = 'logs/log.txt'
sucess_file_name = 'logs/success.txt'
fail_file_name = 'logs/fail.txt'
exception_file_name = 'logs/exception.txt'
all_paths = [LOG_FILE_NAME, SUCESS_FILE_NAME, FAIL_FILE_NAME, EXCEPTION_FILE_NAME] |
day = ["saturday", "sunday", "monday", "tuesday", "wednesday", "thursday", "friday"]
for _ in range(int(input())):
a = [x for x in input().split()]
# gap = abs(d[a[0]] - d[a[1]]) + 1
l,r = int(a[2]),int(a[3])
c,d = 0,0
for i in range(len(day)):
if(a[0] == day[i]): c = i
if(a[1] == day[i]): d = i
if(c == d):g... | day = ['saturday', 'sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday']
for _ in range(int(input())):
a = [x for x in input().split()]
(l, r) = (int(a[2]), int(a[3]))
(c, d) = (0, 0)
for i in range(len(day)):
if a[0] == day[i]:
c = i
if a[1] == day[i]:
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: Jeremy Parks
# Note: Requires Python 3.3.x or higher
desc = "Animate Weapon target"
# types intended for this is "animate melee" and "animate range"
# Base type : settings pair
items = {
"0 animate melee white 4x1": {"other": ["Class Dagger \"One Hand\" Stave \"Two... | desc = 'Animate Weapon target'
items = {'0 animate melee white 4x1': {'other': ['Class Dagger "One Hand" Stave "Two Hand" Sceptre Claws', 'Rarity Normal', 'Height 4', 'Width 1'], 'type': 'animate melee b'}, '0 animate range white 4x1': {'other': ['Class Wand Bow', 'Rarity Normal', 'Height 4', 'Width 1'], 'type': 'ignor... |
class Solution:
def buildtree(self, preorder, inorder):
if inorder:
root_index = inorder.index(preorder.pop(0))
root = TreeNode(inorder[root_index])
root.left = self.buildtree(preorder, inorder[:root_index])
rootright = self.buildtree(preorder, inorder[root_in... | class Solution:
def buildtree(self, preorder, inorder):
if inorder:
root_index = inorder.index(preorder.pop(0))
root = tree_node(inorder[root_index])
root.left = self.buildtree(preorder, inorder[:root_index])
rootright = self.buildtree(preorder, inorder[root_... |
# b_flow
# Flow constraint vector
__all__ = ["b_flow"]
def b_flow(a_vertices):
# b_flow
#
# Construct flow constraint vector
# (vector of size |V| x 1 representing the sum of flow for each vertex.
# Having removed source and drain nodes. Now require:
# L nodes = -1
# R nodes = +1
# A... | __all__ = ['b_flow']
def b_flow(a_vertices):
b = []
l_cells = sum((1 for x in a_vertices if 'L' in x))
r_cells = sum((1 for x in a_vertices if 'R' in x))
for node in a_vertices:
if 'L' in node:
b.append(-1)
elif 'R' in node:
b.append(1)
elif 'A' in node:
... |
class Employee:
raise_amt = 1.04
def __init__(self, first, last, pay):
self.first = first
self.last = last
self.pay = pay
self.email = first + last + "@compani.com"
def fullname(self):
return f"{self.first} {self.last}"
def add_raise(self):
self.pay ... | class Employee:
raise_amt = 1.04
def __init__(self, first, last, pay):
self.first = first
self.last = last
self.pay = pay
self.email = first + last + '@compani.com'
def fullname(self):
return f'{self.first} {self.last}'
def add_raise(self):
self.pay = i... |
n = int(input())
while(n != 0):
jogadas = list(map(int, input().split()))
contMary = contJonh = 0
for i in range(len(jogadas)):
if(jogadas[i] == 0):
contMary = contMary + 1
else:
contJonh = contJonh + 1
print("Mary won {} times and John won {} times".form... | n = int(input())
while n != 0:
jogadas = list(map(int, input().split()))
cont_mary = cont_jonh = 0
for i in range(len(jogadas)):
if jogadas[i] == 0:
cont_mary = contMary + 1
else:
cont_jonh = contJonh + 1
print('Mary won {} times and John won {} times'.format(cont... |
def lowestCommonAncestor(self, root, p, q):
if root in (None, p, q): return root
left = self.lowestCommonAncestor(root.left, p, q)
right = self.lowestCommonAncestor(root.right, p, q)
return root if left and right else left or right | def lowest_common_ancestor(self, root, p, q):
if root in (None, p, q):
return root
left = self.lowestCommonAncestor(root.left, p, q)
right = self.lowestCommonAncestor(root.right, p, q)
return root if left and right else left or right |
class Ordenation:
def selection_sort(self, lista):
fim = len(lista)
for i in range(fim-1):
# Inicialmente, o menor elemento ja visto e o i-esimo
posicao_do_menor = i
for j in range(i+1, fim):
if lista[j] < lista[posicao_do_menor]:
... | class Ordenation:
def selection_sort(self, lista):
fim = len(lista)
for i in range(fim - 1):
posicao_do_menor = i
for j in range(i + 1, fim):
if lista[j] < lista[posicao_do_menor]:
posicao_do_menor = j
(lista[i], lista[posicao_... |
def minimumMovement(obstacleLanes):
# Write your code here
pass
minimumMovement([2, 3, 2, 1, 3, 1]) # 2
minimumMovement([2, 1, 3, 3, 3, 1]) # 2
minimumMovement([3, 2, 2, 1, 2, 1]) # 1 | def minimum_movement(obstacleLanes):
pass
minimum_movement([2, 3, 2, 1, 3, 1])
minimum_movement([2, 1, 3, 3, 3, 1])
minimum_movement([3, 2, 2, 1, 2, 1]) |
class MyList(list):
def append(self, *args):
self.extend(args)
m = MyList()
m.append(0)
m.append(1,2,3,4,5,6)
print(m)
class MyList1(list):
def sort(self):
return 'eae vey? ta afim de ordenar?'
l = [4,1,78,34,4,9]
'''l.sort()
print(l)'''
lista = MyList1()
print(lista.sort())
| class Mylist(list):
def append(self, *args):
self.extend(args)
m = my_list()
m.append(0)
m.append(1, 2, 3, 4, 5, 6)
print(m)
class Mylist1(list):
def sort(self):
return 'eae vey? ta afim de ordenar?'
l = [4, 1, 78, 34, 4, 9]
'l.sort()\nprint(l)'
lista = my_list1()
print(lista.sort()) |
n1 = input('Digite algo:')
print('isnumeric:', n1.isnumeric())
print('isalpha:', n1.isalpha())
print('islower:', n1.islower())
print('isalnum:', n1.isalnum())
| n1 = input('Digite algo:')
print('isnumeric:', n1.isnumeric())
print('isalpha:', n1.isalpha())
print('islower:', n1.islower())
print('isalnum:', n1.isalnum()) |
#===============================================================
# DMXIS Macro (c) 2010 db audioware limited
#===============================================================
RgbColour(75,0,130)
| rgb_colour(75, 0, 130) |
def calc_result(home, away):
if home < away:
return 'lose'
elif home > away:
return 'win'
else:
return 'draw'
def calc_bet_result(
home_score, away_score,
home_bet, away_bet,
shootout_winner=None,
shootout_bet=None,
):
if home_score == home_bet a... | def calc_result(home, away):
if home < away:
return 'lose'
elif home > away:
return 'win'
else:
return 'draw'
def calc_bet_result(home_score, away_score, home_bet, away_bet, shootout_winner=None, shootout_bet=None):
if home_score == home_bet and away_score == away_bet:
s... |
#: Okay
GLOBAL_UPPER_CASE = 0
#: N816
mixedCase = 0
#: N816:1:1
mixed_Case = 0
#: Okay
_C = 0
#: Okay
__D = 0
#: N816
__mC = 0
#: N816
__mC__ = 0
#: Okay
__C6__ = 0
#: Okay
C6 = 0
#: Okay
C_6 = 0.
#: Okay(--ignore-names=mixedCase)
mixedCase = 0
| global_upper_case = 0
mixed_case = 0
mixed__case = 0
_c = 0
__d = 0
__m_c = 0
__m_c__ = 0
__c6__ = 0
c6 = 0
c_6 = 0.0
mixed_case = 0 |
def sumOfNumbers(n):
if n <= 1:
return n
else:
return n + sumOfNumbers(n-1)
print(sumOfNumbers(10)) | def sum_of_numbers(n):
if n <= 1:
return n
else:
return n + sum_of_numbers(n - 1)
print(sum_of_numbers(10)) |
WIDTH = 32
HEIGHT = 32
FIRST = 0x20
LAST = 0x7f
_font =\
b'\x00\x4a\x5a\x0e\x4d\x57\x52\x46\x51\x48\x52\x54\x53\x48\x52'\
b'\x46\x20\x52\x52\x48\x52\x4e\x20\x52\x52\x59\x51\x5a\x52\x5b'\
b'\x53\x5a\x52\x59\x15\x49\x5b\x4e\x46\x4d\x47\x4d\x4d\x20\x52'\
b'\x4e\x47\x4d\x4d\x20\x52\x4e\x46\x4f\x47\x4d\x4d\x20\x52\x57'\
b'... | width = 32
height = 32
first = 32
last = 127
_font = b'\x00JZ\x0eMWRFQHRTSHRF RRHRN RRYQZR[SZRY\x15I[NFMGMM RNGMM RNFOGMM RWFVGVM RWGVM RWFXGVM\x0bH]SBLb RYBRb RLOZO RKUYU)H\\PBP_ RTBT_ RXIWJXKYJYIWGTFPFMGKIKKLMMNOOUQWRYT RKKMMONUPWQXRYTYXWZT[P[MZKXKWLVMWLX\x1fF^[FI[ RNFPHPJOLMMKMIKIIJGLFNFPGSHVHYG[F RWTUUTWTYV[X[ZZ[X[... |
# encoding: UTF-8
RISK_MANAGER = u'Risk Manager'
RISK_MANAGER_STOP = u'RM Stop'
RISK_MANAGER_RUNNING = u'RM Running'
CLEAR_ORDER_FLOW_COUNT = u'Clear Flow Count'
CLEAR_TOTAL_FILL_COUNT = u'Clear Fill Count'
SAVE_SETTING = u'Save Setting'
WORKING_STATUS = u'Working Status'
ORDER_FLOW_LIMIT = u'Flow Limit'
ORDER_FLOW_... | risk_manager = u'Risk Manager'
risk_manager_stop = u'RM Stop'
risk_manager_running = u'RM Running'
clear_order_flow_count = u'Clear Flow Count'
clear_total_fill_count = u'Clear Fill Count'
save_setting = u'Save Setting'
working_status = u'Working Status'
order_flow_limit = u'Flow Limit'
order_flow_clear = u'Flow Clear(... |
# lst = [1, 2, 3, 4, 6, 9]
# integ = 15
# result = []
# if len(lst) < 2:
# raise ValueError
# for i in lst:
# for j in lst:
# if i + j == integ:
# result.append([i, j])
# if len(result) != 0:
# print(result)
# lst = [1, 2, 3, 4, 6, 9]
# integ = 15
# result = []
# if... | def cari_pasangan(lst, integ):
result = []
if len(lst) < 2:
raise ValueError
for i in lst:
for j in lst:
if i + j == integ and [j, i] not in result:
result.append([i, j])
if len(result) != 0:
return result
print(cari_pasangan([1, 2, 3, 4, 5], 7)) |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Silvio Peroni <essepuntato@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copies.
#
# THE SOFTWARE I... | def w_count(name, text):
result = dict()
c_values = dict()
for c in name.lower().replace(' ', ''):
if c not in c_values:
result[c] = 0
c_values[c] = 0
c_values[c] = (c_values[c] + 1) * 2
for k in c_values:
result[k] = calculate(k, c_values[k], text.split()... |
#
# PySNMP MIB module CODIMA-EXPRESS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CODIMA-EXPRESS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:25:36 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, constraints_union, single_value_constraint, value_range_constraint, constraints_intersection) ... |
class Solution:
def peakIndexInMountainArray(self, arr: List[int]) -> int:
if not arr or len(arr) < 3:
return
start, end = 0, len(arr) - 1
while start + 1 < end:
mid = (start + end) // 2
if arr[mid] > arr[mid - 1]:
start =... | class Solution:
def peak_index_in_mountain_array(self, arr: List[int]) -> int:
if not arr or len(arr) < 3:
return
(start, end) = (0, len(arr) - 1)
while start + 1 < end:
mid = (start + end) // 2
if arr[mid] > arr[mid - 1]:
start = mid
... |
#!/usr/bin/env qork
img = "player.png"
camera.mode = "3D"
camera.z = 1
p = add(img)
level = add("map.png", scale=25, pos=-Z * 10)
nodes = [None] * 4
nodes[0] = p.add(img, scale=0.25, pos=(-0.5, 0.5, 0.1))
nodes[1] = p.add(img, scale=0.25, pos=(0.5, -0.5, 0.1))
nodes[2] = p.add(img, scale=0.25, pos=(-0.5, -0.5, 0.1... | img = 'player.png'
camera.mode = '3D'
camera.z = 1
p = add(img)
level = add('map.png', scale=25, pos=-Z * 10)
nodes = [None] * 4
nodes[0] = p.add(img, scale=0.25, pos=(-0.5, 0.5, 0.1))
nodes[1] = p.add(img, scale=0.25, pos=(0.5, -0.5, 0.1))
nodes[2] = p.add(img, scale=0.25, pos=(-0.5, -0.5, 0.1))
nodes[3] = p.add(img, ... |
#!/usr/bin/python
table_cols = 9
table_rows = 9
list_size = 9
with open("vimwiki.snippets", "w") as file:
# generate tables
for i in range(1, table_cols+1):
for j in range(1, table_rows+1):
file.write("snippet table{}x{} \"table{}x{}\" A\n".format(i, j, i, j))
for k in range... | table_cols = 9
table_rows = 9
list_size = 9
with open('vimwiki.snippets', 'w') as file:
for i in range(1, table_cols + 1):
for j in range(1, table_rows + 1):
file.write('snippet table{}x{} "table{}x{}" A\n'.format(i, j, i, j))
for k in range(0, i):
file.write('|')
... |
# -*- coding: utf-8 -*-
def main():
h, w = map(int, input().split())
grids = [list(input()) for _ in range(h)]
up = [[1 for __ in range(w)] for _ in range(h)]
down = [[1 for __ in range(w)] for _ in range(h)]
left = [[1 for __ in range(w)] for _ in range(h)]
right = [[1 for __ in rang... | def main():
(h, w) = map(int, input().split())
grids = [list(input()) for _ in range(h)]
up = [[1 for __ in range(w)] for _ in range(h)]
down = [[1 for __ in range(w)] for _ in range(h)]
left = [[1 for __ in range(w)] for _ in range(h)]
right = [[1 for __ in range(w)] for _ in range(h)]
ans ... |
def solution(nums):
setNums = set(nums)
if len(setNums) > (len(nums) // 2): return len(nums) // 2
return len(setNums)
# print(solution([3,1,2,3]))
# print(solution([3,3,3,2,2,4]))
print(solution([3, 3, 3, 2, 2, 2]))
| def solution(nums):
set_nums = set(nums)
if len(setNums) > len(nums) // 2:
return len(nums) // 2
return len(setNums)
print(solution([3, 3, 3, 2, 2, 2])) |
def test1():
for i in range(2):
print('+' + str(i))
yield str(i)
for a in test1():
print("-" + a)
for a in list(test1()):
print('-' + a) | def test1():
for i in range(2):
print('+' + str(i))
yield str(i)
for a in test1():
print('-' + a)
for a in list(test1()):
print('-' + a) |
def findDecision(obj): #obj[0]: Coupon, obj[1]: Education, obj[2]: Occupation, obj[3]: Distance
# {"feature": "Coupon", "instances": 51, "metric_value": 0.9975, "depth": 1}
if obj[0]>1:
# {"feature": "Education", "instances": 37, "metric_value": 0.9353, "depth": 2}
if obj[1]>0:
# {"feature": "Occupation", "ins... | def find_decision(obj):
if obj[0] > 1:
if obj[1] > 0:
if obj[2] <= 20:
if obj[3] <= 2:
return 'True'
elif obj[3] > 2:
return 'True'
else:
return 'True'
elif obj[2] > 20:
... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2020, Brian Scholer <@briantist>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
DOCUMENTATION = r'''
---
module: win_psrepository_copy
short_description: Copies registered PSRepositories to other user profiles
ver... | documentation = '\n---\nmodule: win_psrepository_copy\nshort_description: Copies registered PSRepositories to other user profiles\nversion_added: \'1.3.0\'\ndescription:\n - Copies specified registered PSRepositories to other user profiles on the system.\n - Can include the C(Default) profile so that new users start ... |
class MockupSpineLog(object):
def debug(self, message, *args):
pass
class MockupSpine(object):
def __init__(self):
self.queryHandlers = {}
self.commandHandlers = {}
self.eventHandlers = {}
self.events={}
self.log = MockupSpineLog()
def register_query_handler... | class Mockupspinelog(object):
def debug(self, message, *args):
pass
class Mockupspine(object):
def __init__(self):
self.queryHandlers = {}
self.commandHandlers = {}
self.eventHandlers = {}
self.events = {}
self.log = mockup_spine_log()
def register_query_h... |
def interchange(array,k):
low,high,n = 0, len(array)-1,len(array)
x = min(k,n-k)
for i in range(x):
array[low],array[high] = array[high],array[low]
low +=1
high -= 1
def rotateArray(array,k):
for i in range(k):
temp = array[0]
for j in range(len(array)-1):
... | def interchange(array, k):
(low, high, n) = (0, len(array) - 1, len(array))
x = min(k, n - k)
for i in range(x):
(array[low], array[high]) = (array[high], array[low])
low += 1
high -= 1
def rotate_array(array, k):
for i in range(k):
temp = array[0]
for j in range... |
class Record():
def __init__(self, record_id, parent_id):
self.record_id = record_id
self.parent_id = parent_id
class Node():
def __init__(self, node_id):
self.node_id = node_id
self.children = []
def BuildTree(records):
root = None
records.sort(key=lambda x: x.record... | class Record:
def __init__(self, record_id, parent_id):
self.record_id = record_id
self.parent_id = parent_id
class Node:
def __init__(self, node_id):
self.node_id = node_id
self.children = []
def build_tree(records):
root = None
records.sort(key=lambda x: x.record_id... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.