content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#print hello with arguments
def hello(name):
print('hello ' + name)
hello('bob')
hello('alice')
| def hello(name):
print('hello ' + name)
hello('bob')
hello('alice') |
n = int(input())
gerais = [e for e in input().split()]
m = int(input())
proib = [e for e in input().split()]
q = int(input())
arr = [e for e in input().split()]
for i in range(q):
key = arr[i]
esq = 0
dir = m-1
achou = False
while esq <= dir:
meio = (esq + dir) // 2
if proi... | n = int(input())
gerais = [e for e in input().split()]
m = int(input())
proib = [e for e in input().split()]
q = int(input())
arr = [e for e in input().split()]
for i in range(q):
key = arr[i]
esq = 0
dir = m - 1
achou = False
while esq <= dir:
meio = (esq + dir) // 2
if proib[meio] ... |
n = int(input())
calculadora = 1
for i in range(n):
valor, operacao = input().split()
valor = int(valor)
if(operacao == '/'):
calculadora = calculadora / valor
else:
calculadora = calculadora * valor
print("{0:.0f}".format(calculadora)) | n = int(input())
calculadora = 1
for i in range(n):
(valor, operacao) = input().split()
valor = int(valor)
if operacao == '/':
calculadora = calculadora / valor
else:
calculadora = calculadora * valor
print('{0:.0f}'.format(calculadora)) |
BEHIND_PROXY = True
SWAGGER_BASEPATH = ""
DEFAULT_DATABASE = "dev"
DATABASES = ["test"]
ENV = "development"
DEBUG = True
| behind_proxy = True
swagger_basepath = ''
default_database = 'dev'
databases = ['test']
env = 'development'
debug = True |
class Solution:
def findMaxValueOfEquation(self, points: List[List[int]], k: int) -> int:
ans = -math.inf
maxHeap = [] # (y - x, x)
for x, y in points:
while maxHeap and x + maxHeap[0][1] > k:
heapq.heappop(maxHeap)
if maxHeap:
ans = max(ans, x + y - maxHeap[0][0])
heap... | class Solution:
def find_max_value_of_equation(self, points: List[List[int]], k: int) -> int:
ans = -math.inf
max_heap = []
for (x, y) in points:
while maxHeap and x + maxHeap[0][1] > k:
heapq.heappop(maxHeap)
if maxHeap:
ans = max(ans... |
class Feature:
def __init__(self, value, string, infix_string, size=0, fitness=1, original_variable=False):
self.value = value
self.fitness = fitness
self.string = string
self.infix_string = infix_string
self.size = size
self.original_variable = original_variable
... | class Feature:
def __init__(self, value, string, infix_string, size=0, fitness=1, original_variable=False):
self.value = value
self.fitness = fitness
self.string = string
self.infix_string = infix_string
self.size = size
self.original_variable = original_variable
... |
def my_range(n):
i = 0
while i <= n:
yield i
i += 1
yield 'there are no values left'
gen = my_range(4)
for i in range(7):
print(next(gen))
| def my_range(n):
i = 0
while i <= n:
yield i
i += 1
yield 'there are no values left'
gen = my_range(4)
for i in range(7):
print(next(gen)) |
# Advent of code Year 2021 Day 02 solution
# Author = Anmol Gupta
# Date = December 2021
input = list()
with open("input.txt", "r") as input_file:
input = input_file.readlines()
def get_command(line):
splitInput = line.strip().split()
return (splitInput[0], int(splitInput[1]))
input_commands = [get_com... | input = list()
with open('input.txt', 'r') as input_file:
input = input_file.readlines()
def get_command(line):
split_input = line.strip().split()
return (splitInput[0], int(splitInput[1]))
input_commands = [get_command(line) for line in input]
horizontal_position = 0
depth = 0
for (action, magnitude) in i... |
{
'targets':
[
{
'target_name': 'node_libtiepie',
'sources':
[
'src/libtiepie.cc'
],
'include_dirs':
[
'<!(node -e "require(\'nan\')")'
],
'conditions':
[
[
'OS=="linux"',
{
'libraries': ['-ltiepie']
... | {'targets': [{'target_name': 'node_libtiepie', 'sources': ['src/libtiepie.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'conditions': [['OS=="linux"', {'libraries': ['-ltiepie']}], ['OS=="win"', {'sources': ['src/libtiepieloader.cc'], 'defines': ['LIBTIEPIE_DYNAMIC'], 'include_dirs': ['<(module_root_dir)/de... |
def typist(s):
cur=res=0
for i in s:
next_val=int(i.isupper())
res+=1+int(next_val!=cur)
cur=next_val
return res | def typist(s):
cur = res = 0
for i in s:
next_val = int(i.isupper())
res += 1 + int(next_val != cur)
cur = next_val
return res |
n=int(input())
for i in range(n):
a,b,c=[int(x) for x in input().split()]
sum=a+b+c
if sum==180:
print("YES")
else:
print("NO") | n = int(input())
for i in range(n):
(a, b, c) = [int(x) for x in input().split()]
sum = a + b + c
if sum == 180:
print('YES')
else:
print('NO') |
beta = 9.
gamma = 0.6
logLX = beta + gamma * logLUV
scatter = 0.4 # 0.35
# LX: monochromatic at 2 keV
# LUV: monochromatic at 2500 AA | beta = 9.0
gamma = 0.6
log_lx = beta + gamma * logLUV
scatter = 0.4 |
class Solution:
def isValid(self, s):
if s == '':
return True
sList = list(s)
stack = []
for chr in sList:
if len(stack) == 0:
stack.append(chr)
else:
stack.pop() if (chr == ')' and stack[-1] == '(') or (chr == ']' a... | class Solution:
def is_valid(self, s):
if s == '':
return True
s_list = list(s)
stack = []
for chr in sList:
if len(stack) == 0:
stack.append(chr)
else:
stack.pop() if chr == ')' and stack[-1] == '(' or (chr == ']' ... |
# For loops are used ot iterate over all elements of an iterable
# They use use the 'for variable in iterable' syntax
for i in range(0, 3):
# x is defined in the for loop and usable in this body of the for loop
print(i) # prints 0, 1, 2 each on a new line
for i in [10, "Hello", "World"]:
# We call this it... | for i in range(0, 3):
print(i)
for i in [10, 'Hello', 'World']:
print(i) |
weight = float(input("Please enter weight in kilograms: "))
height = float(input("Please enter height in meters: "))
bmi = weight/(height * height)
print("BMI is: ",bmi) | weight = float(input('Please enter weight in kilograms: '))
height = float(input('Please enter height in meters: '))
bmi = weight / (height * height)
print('BMI is: ', bmi) |
_base_ = ['./pipelines/rand_aug.py']
# dataset settings
dataset_type = 'ImageNet'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(
type='RandomResizedCrop',
size=224,
backend='pil... | _base_ = ['./pipelines/rand_aug.py']
dataset_type = 'ImageNet'
img_norm_cfg = dict(mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [dict(type='LoadImageFromFile'), dict(type='RandomResizedCrop', size=224, backend='pillow', interpolation='bicubic'), dict(type='RandomFlip', flip... |
RELEVANT_EXTENSIONS = [
"java",
"c",
"cpp",
"h",
"py",
"js",
"xml",
"go",
"rb",
"php",
"sh",
"scale",
"lua",
"m",
"pl",
"ts",
"swift",
"sql",
"groovy",
"erl",
"swf",
"vue",
"bat",
"s",
"ejs",
"yaml",
"yml",
"... | relevant_extensions = ['java', 'c', 'cpp', 'h', 'py', 'js', 'xml', 'go', 'rb', 'php', 'sh', 'scale', 'lua', 'm', 'pl', 'ts', 'swift', 'sql', 'groovy', 'erl', 'swf', 'vue', 'bat', 's', 'ejs', 'yaml', 'yml', 'jar']
allowed_sites = ['for.testing.purposes', 'lists.apache.org', 'just.an.example.site', 'one.more.example.site... |
with open ('2gram_output_birkbeck.txt') as f:
with open ('../data/birkbeck_correct.txt') as g:
corrects = []
i = 0
for line in g:
corrects.append(line.strip())
for line in f:
try:
A = line.split(' potential diatance_word:(')
... | with open('2gram_output_birkbeck.txt') as f:
with open('../data/birkbeck_correct.txt') as g:
corrects = []
i = 0
for line in g:
corrects.append(line.strip())
for line in f:
try:
a = line.split(' potential diatance_word:(')
mis... |
def set_session_user_profile(request, profile=None):
user_profile = {
'use_pop_article': True,
'theme': '',
'is_authenticated': request.user.is_authenticated
}
if profile:
user_profile['use_pop_article'] = profile.use_pop_article
user_profile['theme'] = profile.theme
... | def set_session_user_profile(request, profile=None):
user_profile = {'use_pop_article': True, 'theme': '', 'is_authenticated': request.user.is_authenticated}
if profile:
user_profile['use_pop_article'] = profile.use_pop_article
user_profile['theme'] = profile.theme
request.session['user_prof... |
def squared(n):
return n * n
def cubed(n):
return n * n * n
def raise_power(n, power):
total = 1
for t in range (power) :
total = total * n
return total
def is_divisible(n, t):
return n % t == 0
def is_even(n):
return n % 2 == 0
def is_odd(n):
return n % 2 != 0
p... | def squared(n):
return n * n
def cubed(n):
return n * n * n
def raise_power(n, power):
total = 1
for t in range(power):
total = total * n
return total
def is_divisible(n, t):
return n % t == 0
def is_even(n):
return n % 2 == 0
def is_odd(n):
return n % 2 != 0
print(list(map(... |
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@berty_go//:repositories.bzl", "berty_go_repositories")
def berty_bridge_repositories():
# utils
maybe(... | load('@bazel_tools//tools/build_defs/repo:utils.bzl', 'maybe')
load('@bazel_tools//tools/build_defs/repo:git.bzl', 'git_repository')
load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_archive')
load('@berty_go//:repositories.bzl', 'berty_go_repositories')
def berty_bridge_repositories():
maybe(git_reposito... |
def score(name=tom,score=0):
print(name," scored ", score )
| def score(name=tom, score=0):
print(name, ' scored ', score) |
# estos es un cometario en python
#decalro una variable
x = 5
# imprime variable
print ("x =",x)
#operaciones aritmeticas
print ("x - 5 = ",x - 5)
print ("x + 5 = ",x + 5)
print ("x * 5 = ",x * 5)
print ("x % 5 = ",x % 5)
print ("x / 5 = ",x /5)
print ("x // 5 = ",x //5)
print ("x ** 5 = ",x **5) | x = 5
print('x =', x)
print('x - 5 = ', x - 5)
print('x + 5 = ', x + 5)
print('x * 5 = ', x * 5)
print('x % 5 = ', x % 5)
print('x / 5 = ', x / 5)
print('x // 5 = ', x // 5)
print('x ** 5 = ', x ** 5) |
class PushwooshException(Exception):
pass
class PushwooshCommandException(PushwooshException):
pass
class PushwooshNotificationException(PushwooshException):
pass
class PushwooshFilterException(PushwooshException):
pass
class PushwooshFilterInvalidOperatorException(PushwooshFilterException):
... | class Pushwooshexception(Exception):
pass
class Pushwooshcommandexception(PushwooshException):
pass
class Pushwooshnotificationexception(PushwooshException):
pass
class Pushwooshfilterexception(PushwooshException):
pass
class Pushwooshfilterinvalidoperatorexception(PushwooshFilterException):
pas... |
#
# PySNMP MIB module CISCO-ENTITY-SENSOR-CAPABILITY (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-ENTITY-SENSOR-CAPABILITY
# Produced by pysmi-0.3.4 at Mon Apr 29 17:39:53 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, constraints_intersection, single_value_constraint, value_size_constraint) ... |
# -*- coding: utf-8 -*-
__author__ = 'Alfredo Cobo'
__email__ = 'ajscobo@gmail.com'
__version__ = '0.1.0' | __author__ = 'Alfredo Cobo'
__email__ = 'ajscobo@gmail.com'
__version__ = '0.1.0' |
in_file = 'report_suis.tsv'
biovar_list = ['bv01', 'bv02', 'bv03', 'bv04', 'bv05']
for biovar in biovar_list:
if biovar == 'bv04':
t=1
bv = biovar[-1]
preID = 0
pos = 0
pcrID = 0
anyID = 0
justPCR = 0
false_pos = 0
false_neg = 0
with open(in_file, 'r') as f:
for... | in_file = 'report_suis.tsv'
biovar_list = ['bv01', 'bv02', 'bv03', 'bv04', 'bv05']
for biovar in biovar_list:
if biovar == 'bv04':
t = 1
bv = biovar[-1]
pre_id = 0
pos = 0
pcr_id = 0
any_id = 0
just_pcr = 0
false_pos = 0
false_neg = 0
with open(in_file, 'r') as f:
... |
# Create a class called Triangle with 3 instances variables that represents 3 angles of triangle. Its __init__() method should take self, angle1, angle2, and angle3 as
# arguments. Make sure to set these appropriately in the body of the __init__() method. Create a method named check_angles(self). It should return True ... | class Triangle:
def _init_(self, angle1, angle2, angle3):
self.angle1 = angle1
self.angle2 = angle2
self.angle3 = angle3
def check_angles(self):
if self.angle1 + self.angle2 + self.angle3 == 180:
return True
else:
return False |
fields_masks = {
'background': "sheets/data/rowData/values/effectiveFormat/backgroundColor",
'value': "sheets/data/rowData/values/formattedValue",
'note': "sheets/data/rowData/values/note",
'font_color': "sheets/data/rowData/values/effectiveFormat/textFormat/foregroundColor"
}
| fields_masks = {'background': 'sheets/data/rowData/values/effectiveFormat/backgroundColor', 'value': 'sheets/data/rowData/values/formattedValue', 'note': 'sheets/data/rowData/values/note', 'font_color': 'sheets/data/rowData/values/effectiveFormat/textFormat/foregroundColor'} |
def tuple_to_string(tuple):
string = ''
for i in range(0, len(tuple)):
num = tuple[i]
char = chr(num)
string += str(char)
return string | def tuple_to_string(tuple):
string = ''
for i in range(0, len(tuple)):
num = tuple[i]
char = chr(num)
string += str(char)
return string |
def count(sequence, item):
amount = 0
for x in sequence:
if x == item:
amount += 1
return amount
| def count(sequence, item):
amount = 0
for x in sequence:
if x == item:
amount += 1
return amount |
'''
Write a Python program to get the sum of a non-negative integer.
'''
class Solution:
def __init__(self, num):
self.num = num
def sum_digits(self, x):
if x == 1:
return int(str(self.num)[-1])
else:
return int(str(self.num)[-x]) + self.sum_digits(x-1)
def s... | """
Write a Python program to get the sum of a non-negative integer.
"""
class Solution:
def __init__(self, num):
self.num = num
def sum_digits(self, x):
if x == 1:
return int(str(self.num)[-1])
else:
return int(str(self.num)[-x]) + self.sum_digits(x - 1)
def ... |
'#La nomenclatura utilizada es INSTANCIA_ESQUEMA_PWD'
FISCO_USER = 'FISCAR'
FISCO_FISCAR_PWD = 'FISCAR'
'#String de conexion '
FISCO_CONNECTION_STRING = '10.30.205.127/fisco'
| """#La nomenclatura utilizada es INSTANCIA_ESQUEMA_PWD"""
fisco_user = 'FISCAR'
fisco_fiscar_pwd = 'FISCAR'
'#String de conexion '
fisco_connection_string = '10.30.205.127/fisco' |
def hamming_distance(string1, string2):
assert len(string1) == len(string2)
distance = 0
for i in range(len(string1)):
if string1[i] != string2[i]:
distance += 1
return distance
'''def results(string1, string2):
print(hamming_distance(string1, string2))
results('CGTGAGATAGCATATGGTAAATGTTCCGCAATCGCTACCGCC... | def hamming_distance(string1, string2):
assert len(string1) == len(string2)
distance = 0
for i in range(len(string1)):
if string1[i] != string2[i]:
distance += 1
return distance
"def results(string1, string2):\n\tprint(hamming_distance(string1, string2))\n\nresults('CGTGAGATAGCATATGG... |
# -*- coding: utf-8 -*-
__author__ = 'Hamish Downer'
__email__ = 'hamish@aptivate.org'
__version__ = '0.1.0'
| __author__ = 'Hamish Downer'
__email__ = 'hamish@aptivate.org'
__version__ = '0.1.0' |
{
"targets": [
{
"target_name": "switch_bindings",
"sources": [
"src/switch_bindings.cpp",
"src/log-utils/logging.c",
"src/log-utils/log_core.c",
"src/common-utils/common_utils.c",
"src/shm_core/shm_dup.c",
"src/shm_core/shm_data.c",
"src/shm_core/shm_mutex.c... | {'targets': [{'target_name': 'switch_bindings', 'sources': ['src/switch_bindings.cpp', 'src/log-utils/logging.c', 'src/log-utils/log_core.c', 'src/common-utils/common_utils.c', 'src/shm_core/shm_dup.c', 'src/shm_core/shm_data.c', 'src/shm_core/shm_mutex.c', 'src/shm_core/shm_datatypes.c', 'src/shm_core/shm_apr.c', 'src... |
def main():
n = int(input())
for a in range(1, 10):
b = n / a
if 1 <= b and b <= 9 and b % 1 == 0:
print('Yes')
exit()
print('No')
if __name__ == '__main__':
main()
| def main():
n = int(input())
for a in range(1, 10):
b = n / a
if 1 <= b and b <= 9 and (b % 1 == 0):
print('Yes')
exit()
print('No')
if __name__ == '__main__':
main() |
x = int(input("Enter number"))
for i in range(x):
a = list(str(i))
sum1 = 0
for j in range(len(a)):
b = int(a[j])**len(a)
sum1 = sum1 + b
if i == sum1:
print (i,"amstrong")
| x = int(input('Enter number'))
for i in range(x):
a = list(str(i))
sum1 = 0
for j in range(len(a)):
b = int(a[j]) ** len(a)
sum1 = sum1 + b
if i == sum1:
print(i, 'amstrong') |
x = int(input("Please enter the first digit"))
y = int(input("Please enter the second digit"))
output_list = []
while len(output_list) < x - 1:
for i in range(0, x):
list_2d = []
output_list.append(list_2d)
for j in range(0 ,y):
number = i * j
output_list[i].append... | x = int(input('Please enter the first digit'))
y = int(input('Please enter the second digit'))
output_list = []
while len(output_list) < x - 1:
for i in range(0, x):
list_2d = []
output_list.append(list_2d)
for j in range(0, y):
number = i * j
output_list[i].append(nu... |
class Player():
def __init__(self, name):
self.name = name
self.force = 0.0
def set_force(self, force):
self.force = force
| class Player:
def __init__(self, name):
self.name = name
self.force = 0.0
def set_force(self, force):
self.force = force |
def combine_nonblank_lines(content: list[str], sep: str = " ") -> list[str]:
content = [item.strip() for item in content]
i, new_content, clean_content = 0, "", []
while i < len(content):
if content[i] == "":
clean_content.append(new_content.strip())
new_content = ""
... | def combine_nonblank_lines(content: list[str], sep: str=' ') -> list[str]:
content = [item.strip() for item in content]
(i, new_content, clean_content) = (0, '', [])
while i < len(content):
if content[i] == '':
clean_content.append(new_content.strip())
new_content = ''
... |
def phoneCall(min1, min2_10, min11, s):
minutes = 0
rate = min1
while s > 0:
minutes += 1
if minutes == 2:
rate = min2_10
elif minutes > 10:
rate = min11
s -= rate
if s < 0:
minutes -= 1
return minutes
| def phone_call(min1, min2_10, min11, s):
minutes = 0
rate = min1
while s > 0:
minutes += 1
if minutes == 2:
rate = min2_10
elif minutes > 10:
rate = min11
s -= rate
if s < 0:
minutes -= 1
return minutes |
print('hello\tworld')
print('hello\nworld')
print( len('hello world'))
print('hello world'[0])
my_letter_list = ['a','a','b','b','c']
print(my_letter_list)
print( set(my_letter_list))
my_unique_letters = set(my_letter_list)
print(my_unique_letters)
print( len(my_unique_letters))
print( 'd' in my_unique_letters... | print('hello\tworld')
print('hello\nworld')
print(len('hello world'))
print('hello world'[0])
my_letter_list = ['a', 'a', 'b', 'b', 'c']
print(my_letter_list)
print(set(my_letter_list))
my_unique_letters = set(my_letter_list)
print(my_unique_letters)
print(len(my_unique_letters))
print('d' in my_unique_letters) |
# The value to indicate NO LIMIT parameter
NO_LIMIT = -1
# PER_CPU_SHARES has been set to 1024 because CPU shares' quota
# is commonly used in cloud frameworks like Kubernetes[1],
# AWS[2] and Mesos[3] in a similar way. They spawn containers with
# --cpu-shares option values scaled by PER_CPU_SHARES.
PER_CPU_SHARES =... | no_limit = -1
per_cpu_shares = 1024
subsys_memory = 'memory'
subsys_cpuset = 'cpuset'
subsys_cpu = 'cpu'
subsys_cpuacct = 'cpuacct'
subsys_pids = 'pids'
cgroup_type_v2 = 'cgroup2'
cgroup_type_v1 = 'cgroup' |
n = int(input())
total = 0
line = map(int, input().split())
for _ in line:
if _ < 0:
total += -_
print(total)
| n = int(input())
total = 0
line = map(int, input().split())
for _ in line:
if _ < 0:
total += -_
print(total) |
#common variables!
def set_loop(lp):
global loop #not to use local variable
loop=lp
def set_nm(nm):
global noisymode
noisymode=nm
def get_loop():
return loop
def get_nm(): return noisymode
loop=[]
noisymode=False | def set_loop(lp):
global loop
loop = lp
def set_nm(nm):
global noisymode
noisymode = nm
def get_loop():
return loop
def get_nm():
return noisymode
loop = []
noisymode = False |
def maior():
for c in range(10):
num = int(input())
if c == 0:
maior = primeiro = num
if num > maior:
maior = num
print(maior)
if maior % primeiro == 0:
print(primeiro)
maior()
| def maior():
for c in range(10):
num = int(input())
if c == 0:
maior = primeiro = num
if num > maior:
maior = num
print(maior)
if maior % primeiro == 0:
print(primeiro)
maior() |
AwayPlayerFoulClockStart=0
AwayLastPlayerFoul=''
HomePlayerFoulClockStart=0
HomeLastPlayerFoul=''
| away_player_foul_clock_start = 0
away_last_player_foul = ''
home_player_foul_clock_start = 0
home_last_player_foul = '' |
#Global
PARENT_DIR = "PARENT_DIR"
#Logging
LOG_FILE = "LOG_FILE"
SAVE_DIR = "SAVE_DIR"
TENSORBOARD_LOG_DIR = "TENSORBOARD_LOG_DIR"
#Preprocessing Dataset
DATASET_PATH = "DATASET_PATH"
#DeepSense Parameters
##Dataset Parameters
BATCH_SIZE = "BATCH_SIZE"
HISTORY_LENGTH = "HISTORY_LENGTH"
HORIZON = "HORIZON"
MEMORY_SIZ... | parent_dir = 'PARENT_DIR'
log_file = 'LOG_FILE'
save_dir = 'SAVE_DIR'
tensorboard_log_dir = 'TENSORBOARD_LOG_DIR'
dataset_path = 'DATASET_PATH'
batch_size = 'BATCH_SIZE'
history_length = 'HISTORY_LENGTH'
horizon = 'HORIZON'
memory_size = 'MEMORY_SIZE'
num_actions = 'NUM_ACTIONS'
num_channels = 'NUM_CHANNELS'
split_size... |
# https://www.codechef.com/problems/TWOSTR
for T in range(int(input())):
a,b,s=input(),input(),0
for i in range(len(a)):
if(a[i]==b[i] or a[i]=="?" or b[i]=="?"): s+=1
print("Yes") if(s==len(a)) else print("No") | for t in range(int(input())):
(a, b, s) = (input(), input(), 0)
for i in range(len(a)):
if a[i] == b[i] or a[i] == '?' or b[i] == '?':
s += 1
print('Yes') if s == len(a) else print('No') |
w2vSize = 100
feature_dim = 100
max_len=21
debug = False
poolSize=32
topicNum = 100
fresh = True
| w2v_size = 100
feature_dim = 100
max_len = 21
debug = False
pool_size = 32
topic_num = 100
fresh = True |
E = [[ 0, 1, 0, 0, 0, 0],
[E21, 0, 0, E24, E25, 0],
[ 0, 0, 0, 1, 0, 0],
[ 0, 0, E43, 0, 0, -1],
[ 0, 0, 0, 0, 0, 1],
[E61, 0, 0, E64, E65, 0]]
| e = [[0, 1, 0, 0, 0, 0], [E21, 0, 0, E24, E25, 0], [0, 0, 0, 1, 0, 0], [0, 0, E43, 0, 0, -1], [0, 0, 0, 0, 0, 1], [E61, 0, 0, E64, E65, 0]] |
#Represents the entire memory bank of the TB-3 (64 patterns in total)
class TB3Bank:
BANK_SIZE = 64
def __init__(self,patterns=None):
if(patterns != None):
self.patterns = patterns
else:
self.patterns = []
def get_patterns(self):
return self.patterns
def get_pattern(self,index):
return self.patt... | class Tb3Bank:
bank_size = 64
def __init__(self, patterns=None):
if patterns != None:
self.patterns = patterns
else:
self.patterns = []
def get_patterns(self):
return self.patterns
def get_pattern(self, index):
return self.patterns[index]
d... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | success = {'name': 'SUCCESS', 'ordinal': '0', 'color': 'BLUE', 'complete': True}
unstable = {'name': 'UNSTABLE', 'ordinal': '1', 'color': 'YELLOW', 'complete': True}
failure = {'name': 'FAILURE', 'ordinal': '2', 'color': 'RED', 'complete': True}
notbuild = {'name': 'NOT_BUILD', 'ordinal': '3', 'color': 'NOTBUILD', 'com... |
#!/usr/bin/env python
#######################################
# Installation module for mana-toolkit
#######################################
# AUTHOR OF MODULE NAME
AUTHOR="jklaz"
# DESCRIPTION OF THE MODULE
DESCRIPTION="This module will install/update the mana-toolkit"
# INSTALL TYPE GIT, SVN, FILE DOWNLOAD
# OPTIO... | author = 'jklaz'
description = 'This module will install/update the mana-toolkit'
install_type = 'GIT'
repository_location = 'https://github.com/sensepost/mana'
install_location = 'mana'
debian = 'libnl-dev,isc-dhcp-server,tinyproxy,libssl-dev,apache2,macchanger,python-dnspython,python-pcapy,dsniff,stunnel4,python-scap... |
class Holding_Registers:
Winch_ID, \
DIP_Switch_Status, \
Soft_Reset, \
Max_Velocity, \
Max_Acceleration, \
Encoder_Radius, \
Target_Setpoint, \
Target_Setpoint_Offset, \
Kp_velocity, \
Ki_velocity, \
Kd_velocity, \
Max_Encoder_Feedrate, \
Kp_position, \
Ki_position, \
Kd_position, \
Kp, \
Ki, \
Kd, \... | class Holding_Registers:
(winch_id, dip__switch__status, soft__reset, max__velocity, max__acceleration, encoder__radius, target__setpoint, target__setpoint__offset, kp_velocity, ki_velocity, kd_velocity, max__encoder__feedrate, kp_position, ki_position, kd_position, kp, ki, kd, pid__setpoint, target_x, target_y, ta... |
first_term = int(input('Insert the first term of an arithmetic progression: '))
reason = int(input('Insert the reason of the arithmetic progression: '))
for c in range (1, 11):
if reason == 0:
print(first_term)
elif reason > 0:
c = first_term + (c - 1)*reason
print(c)
else:
c... | first_term = int(input('Insert the first term of an arithmetic progression: '))
reason = int(input('Insert the reason of the arithmetic progression: '))
for c in range(1, 11):
if reason == 0:
print(first_term)
elif reason > 0:
c = first_term + (c - 1) * reason
print(c)
else:
... |
self = [1]*11000
for i in range(1,10):
self[2*i-1] = 0
for j in range(10,100):
self[j+int(str(j)[0])+int(str(j)[1])-1] = 0
for k in range(100,1000):
self[k+int(str(k)[0])+int(str(k)[1])+int(str(k)[2])-1] = 0
for m in range(1000,10000):
self[m+int(str(m)[0])+int(str(m)[1])+int(str(m)[2])+int(str(m)[3])... | self = [1] * 11000
for i in range(1, 10):
self[2 * i - 1] = 0
for j in range(10, 100):
self[j + int(str(j)[0]) + int(str(j)[1]) - 1] = 0
for k in range(100, 1000):
self[k + int(str(k)[0]) + int(str(k)[1]) + int(str(k)[2]) - 1] = 0
for m in range(1000, 10000):
self[m + int(str(m)[0]) + int(str(m)[1]) + i... |
APP_KEY = 'your APP_KEY'
APP_SECRET = 'your APP_SECRET'
OAUTH_TOKEN = 'your OAUTH_TOKEN'
OAUTH_TOKEN_SECRET = 'your OAUTH_TOKEN_SECRET'
ROUTE = 'your ROUTE'
| app_key = 'your APP_KEY'
app_secret = 'your APP_SECRET'
oauth_token = 'your OAUTH_TOKEN'
oauth_token_secret = 'your OAUTH_TOKEN_SECRET'
route = 'your ROUTE' |
def main():
s = input("Please enter your sentence: ")
words = s.split()
wordCount = len(words)
print ("Your word and letter counts are:", wordCount)
main() | def main():
s = input('Please enter your sentence: ')
words = s.split()
word_count = len(words)
print('Your word and letter counts are:', wordCount)
main() |
#!/usr/bin/env python3
def calculate():
L = 100000
rads = [0] + [1] * L
for i in range(2, len(rads)):
if rads[i] == 1:
for j in range(i, len(rads), i):
rads[j] *= i
data = sorted((rad, i) for(i, rad) in enumerate(rads))
return str(data[10000][1])
if __name__ =... | def calculate():
l = 100000
rads = [0] + [1] * L
for i in range(2, len(rads)):
if rads[i] == 1:
for j in range(i, len(rads), i):
rads[j] *= i
data = sorted(((rad, i) for (i, rad) in enumerate(rads)))
return str(data[10000][1])
if __name__ == '__main__':
print(... |
temperatures = []
with open('lab_05.txt') as infile:
for row in infile:
temperatures.append(float(row.strip()))
min_tem = min(temperatures)
max_tem = max(temperatures)
avr_tem = sum(temperatures)/len(temperatures)
temperatures.sort()
median = temperatures[len(temperatures)//2]
unique = len(set(temperature... | temperatures = []
with open('lab_05.txt') as infile:
for row in infile:
temperatures.append(float(row.strip()))
min_tem = min(temperatures)
max_tem = max(temperatures)
avr_tem = sum(temperatures) / len(temperatures)
temperatures.sort()
median = temperatures[len(temperatures) // 2]
unique = len(set(temperatu... |
s = 0
for c in range(0, 4):
n = int(input('Digite um numero:'))
s += n
print('O somatorio de todos os valores foi {}'.format(s)) | s = 0
for c in range(0, 4):
n = int(input('Digite um numero:'))
s += n
print('O somatorio de todos os valores foi {}'.format(s)) |
faces = fetch_olivetti_faces()
# set up the figure
fig = plt.figure(figsize=(6, 6)) # figure size in inches
fig.subplots_adjust(left=0, right=1, bottom=0, top=1, hspace=0.05, wspace=0.05)
# plot the faces:
for i in range(64):
ax = fig.add_subplot(8, 8, i + 1, xticks=[], yticks=[])
ax.imshow(faces.images[i], ... | faces = fetch_olivetti_faces()
fig = plt.figure(figsize=(6, 6))
fig.subplots_adjust(left=0, right=1, bottom=0, top=1, hspace=0.05, wspace=0.05)
for i in range(64):
ax = fig.add_subplot(8, 8, i + 1, xticks=[], yticks=[])
ax.imshow(faces.images[i], cmap=plt.cm.bone, interpolation='nearest') |
class Solution:
def findLucky(self, arr: List[int]) -> int:
x=[i for i in arr if arr.count(i)==i]
if not x:
return -1
else:
return max(x)
| class Solution:
def find_lucky(self, arr: List[int]) -> int:
x = [i for i in arr if arr.count(i) == i]
if not x:
return -1
else:
return max(x) |
i = input("Enter a number: ")
d = '0369'
if i[-1] in d:
print('Last digit is divisible by 3.')
else:
print('Last digit is not divisible by 3.')
| i = input('Enter a number: ')
d = '0369'
if i[-1] in d:
print('Last digit is divisible by 3.')
else:
print('Last digit is not divisible by 3.') |
# Get the config object
c = get_config()
# Inline figures when using Matplotlib
c.IPKernelApp.pylab = 'inline'
c.NotebookApp.ip = '*'
c.NotebookApp.allow_remote_access = True
# Do not open a browser window by default when using notebooks
c.NotebookApp.open_browser = False
# INSECURE: No token. Always use jupyter over s... | c = get_config()
c.IPKernelApp.pylab = 'inline'
c.NotebookApp.ip = '*'
c.NotebookApp.allow_remote_access = True
c.NotebookApp.open_browser = False
c.NotebookApp.token = ''
c.NotebookApp.notebook_dir = '/git'
c.NotebookApp.allow_root = True |
Import('env')
global_env = DefaultEnvironment()
global_env.Append(
CPPDEFINES=[
"MSGPACK_ENDIAN_LITTLE_BYTE",
]
)
| import('env')
global_env = default_environment()
global_env.Append(CPPDEFINES=['MSGPACK_ENDIAN_LITTLE_BYTE']) |
def get_label_lower(opts):
if hasattr(opts, 'label_lower'):
return opts.label_lower
model_label = opts.model_name
app_label = opts.app_label
return "{app_label}.{model_label}".format(app_label=app_label,
model_label=model_label)
| def get_label_lower(opts):
if hasattr(opts, 'label_lower'):
return opts.label_lower
model_label = opts.model_name
app_label = opts.app_label
return '{app_label}.{model_label}'.format(app_label=app_label, model_label=model_label) |
# list the uses of all certificates
res = client.get_certificates_uses()
print(res)
if type(res) == pypureclient.responses.ValidResponse:
print(list(res.items))
# list the uses of certificates named "ad-cert-1" and "posix-cert"
res = client.get_certificates_uses(names=['ad-cert-1', 'posix-cert'])
print(res)
if type... | res = client.get_certificates_uses()
print(res)
if type(res) == pypureclient.responses.ValidResponse:
print(list(res.items))
res = client.get_certificates_uses(names=['ad-cert-1', 'posix-cert'])
print(res)
if type(res) == pypureclient.responses.ValidResponse:
print(list(res.items)) |
def allLongestStrings(inputArray):
'''
Given an array of strings, return another array containing all of its longest strings.
'''
resultArray = []
currentMax = len(inputArray[0])
for i in range(len(inputArray) ):
currentLen = len(inputArray[i])
if currentLen... | def all_longest_strings(inputArray):
"""
Given an array of strings, return another array containing all of its longest strings.
"""
result_array = []
current_max = len(inputArray[0])
for i in range(len(inputArray)):
current_len = len(inputArray[i])
if currentLen > currentMax:
... |
n , m = map(int, input().split())
array = list(map(int, input().split()))
A = list(set(map(int, input().split())))
B = list(set(map(int, input().split())))
happiness = 0
for i in range(n):
for j in range(m):
if array[i] == A[j]:
happiness += 1
elif array[i]... | (n, m) = map(int, input().split())
array = list(map(int, input().split()))
a = list(set(map(int, input().split())))
b = list(set(map(int, input().split())))
happiness = 0
for i in range(n):
for j in range(m):
if array[i] == A[j]:
happiness += 1
elif array[i] == B[j]:
happines... |
def relativeSorting(A1,A2):
common_elements = set(A1).intersection(set(A2))
extra = set(A1).difference(set(A2))
out = []
for i in A2:
s = [i] * A1.count(i)
out.extend(s)
extra_out = []
for j in extra:
u = [j] * A1.count(j)
extra_out.extend(u)
out = out + sorte... | def relative_sorting(A1, A2):
common_elements = set(A1).intersection(set(A2))
extra = set(A1).difference(set(A2))
out = []
for i in A2:
s = [i] * A1.count(i)
out.extend(s)
extra_out = []
for j in extra:
u = [j] * A1.count(j)
extra_out.extend(u)
out = out + sor... |
#!/usr/bin/env python3.8
# Copyright 2021 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def f():
print('lib.f')
def truthy():
return True
def falsy():
return False
| def f():
print('lib.f')
def truthy():
return True
def falsy():
return False |
n=int(input())
a=list(map(int,input().split()))
jump=0
i=0
while i<=n:
if i+2<n and a[i+2]==0:
jump+=1
i+=2
elif i+1<n and a[i+1]==0:
jump+=1
i+=1
else:
i+=1
print(jump) | n = int(input())
a = list(map(int, input().split()))
jump = 0
i = 0
while i <= n:
if i + 2 < n and a[i + 2] == 0:
jump += 1
i += 2
elif i + 1 < n and a[i + 1] == 0:
jump += 1
i += 1
else:
i += 1
print(jump) |
class config(object):
rank_norm = 0
run_list = str.split("zh2en_w2vv_attention w2vv_attention")
nr_of_runs = len(run_list)
#weights = [1.0/nr_of_runs] * nr_of_runs
weights = [0.73, 0.27]
| class Config(object):
rank_norm = 0
run_list = str.split('zh2en_w2vv_attention w2vv_attention')
nr_of_runs = len(run_list)
weights = [0.73, 0.27] |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( n ) :
if ( n == 0 ) :
return "0" ;
bin = "" ;
while ( n > 0 ) :
if ( n & 1 == 0 ) :
... | def f_gold(n):
if n == 0:
return '0'
bin = ''
while n > 0:
if n & 1 == 0:
bin = '0' + bin
else:
bin = '1' + bin
n = n >> 1
return bin
if __name__ == '__main__':
param = [(35,), (17,), (8,), (99,), (57,), (39,), (99,), (14,), (22,), (7,)]
n_... |
class Clip:
def __init__(self, start_time: float, end_time: float):
self.start_time: float = start_time
self.end_time: float = end_time
@property
def length_in_seconds(self) -> float:
return self.end_time - self.start_time
| class Clip:
def __init__(self, start_time: float, end_time: float):
self.start_time: float = start_time
self.end_time: float = end_time
@property
def length_in_seconds(self) -> float:
return self.end_time - self.start_time |
# LISTAS INTERNAS - ISINSTANCE
minhaLista = [[1, "a", 2], [3, 4, "b"], ["c", 5, "d"]]
letras = []
numeros = []
for listaInterna in minhaLista:
for elementos in listaInterna:
if (isinstance(elementos, str)):
letras.append(elementos)
else:
numeros.append(elemento... | minha_lista = [[1, 'a', 2], [3, 4, 'b'], ['c', 5, 'd']]
letras = []
numeros = []
for lista_interna in minhaLista:
for elementos in listaInterna:
if isinstance(elementos, str):
letras.append(elementos)
else:
numeros.append(elementos)
print(letras)
print(numeros) |
slackInfo = {
"url": "https://hooks.slack.com/services/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",
"username": "leaderboard-bot",
}
hackerrankInfo = {
"url": "https://www.hackerrank.com/rest/contests/wissen-coding-challenge-2021/leaderboard",
} | slack_info = {'url': 'https://hooks.slack.com/services/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', 'username': 'leaderboard-bot'}
hackerrank_info = {'url': 'https://www.hackerrank.com/rest/contests/wissen-coding-challenge-2021/leaderboard'} |
class AdditionExpression:
def __init__(self, left, right):
self.right = right
self.left = left
def print(self, buffer):
buffer.append('(')
self.left.print(buffer)
buffer.append('+')
self.right.print(buffer)
buffer.append(')')
def eval(self):
... | class Additionexpression:
def __init__(self, left, right):
self.right = right
self.left = left
def print(self, buffer):
buffer.append('(')
self.left.print(buffer)
buffer.append('+')
self.right.print(buffer)
buffer.append(')')
def eval(self):
... |
'''
3. Swap string variable values
fname = "rahul"
lname = "dravid"
Swap the value of variable with fname & fname with lname
Output:: print(fname) # dravid
print(lname) # rahul
'''
fname = "rahul"
lname = "dravid"
#fname.swap(lname)
#lname.swap(fname)
fname="dravid"
lname="rahul"
print(fname)
print(... | """
3. Swap string variable values
fname = "rahul"
lname = "dravid"
Swap the value of variable with fname & fname with lname
Output:: print(fname) # dravid
print(lname) # rahul
"""
fname = 'rahul'
lname = 'dravid'
fname = 'dravid'
lname = 'rahul'
print(fname)
print(lname)
print('-------------------------------------... |
{
'includes': [
'../common.gypi',
'../config.gypi',
],
'targets': [
{
'target_name': 'linuxapp',
'product_name': 'mapbox-gl',
'type': 'executable',
'sources': [
'./main.cpp',
'../common/settings_json.cpp',
'../common/settings_json.hpp',
'../commo... | {'includes': ['../common.gypi', '../config.gypi'], 'targets': [{'target_name': 'linuxapp', 'product_name': 'mapbox-gl', 'type': 'executable', 'sources': ['./main.cpp', '../common/settings_json.cpp', '../common/settings_json.hpp', '../common/platform_default.cpp', '../common/glfw_view.hpp', '../common/glfw_view.cpp', '.... |
class State:
def __init__(self):
self.StateId = 0
self.StateName = ""
class City:
def __init__(self):
self.CityId = 0
self.CityName = ""
self.StateId = 0
class Properties:
def __init__(self):
self.Area=0
self.Age=0
self... | class State:
def __init__(self):
self.StateId = 0
self.StateName = ''
class City:
def __init__(self):
self.CityId = 0
self.CityName = ''
self.StateId = 0
class Properties:
def __init__(self):
self.Area = 0
self.Age = 0
self.Rooms = 0
... |
# substituindo com o metodo replace
s1 = 'Um mafagafinho, dois mafagafinhos, tres mafagafinhos...'
print(s1.replace('mafagafinho', 'gatinho'))
# podemos adicionar a quantidade substituicao que sera feitas
print(s1.replace('mafagafinho', 'gatinho', 1))
| s1 = 'Um mafagafinho, dois mafagafinhos, tres mafagafinhos...'
print(s1.replace('mafagafinho', 'gatinho'))
print(s1.replace('mafagafinho', 'gatinho', 1)) |
class Movies(object):
def __init__(self, **kwargs):
short_plot = kwargs.get('Plot')[0:170]
self.title = kwargs.get('Title')
self.poster_link = kwargs.get('Poster')
self.rated = kwargs.get('Rated')
self.type = kwargs.get('Type')
self.awards = kwargs.get('Awards')
... | class Movies(object):
def __init__(self, **kwargs):
short_plot = kwargs.get('Plot')[0:170]
self.title = kwargs.get('Title')
self.poster_link = kwargs.get('Poster')
self.rated = kwargs.get('Rated')
self.type = kwargs.get('Type')
self.awards = kwargs.get('Awards')
... |
class Solution:
def maxLength(self, arr: List[str]) -> int:
results = [""]
max_len = 0
for word in arr:
for concat_str in results:
new_str = concat_str + word
if len(new_str) == len(set(new_str)):
results.append(new_str)
... | class Solution:
def max_length(self, arr: List[str]) -> int:
results = ['']
max_len = 0
for word in arr:
for concat_str in results:
new_str = concat_str + word
if len(new_str) == len(set(new_str)):
results.append(new_str)
... |
class Solution:
def longestCommonSubsequence(self, text1: str, text2: str) -> int:
# The idea is to use 2D dynamic programming from the top-left
# if the characters are match,
# we set the cell = 1 + top-left
# if the characters aren't match,
# we set the ... | class Solution:
def longest_common_subsequence(self, text1: str, text2: str) -> int:
dp = [[0 for _ in range(len(text2))] for _ in range(len(text1))]
for i in range(len(text1)):
for j in range(len(text2)):
if text1[i] == text2[j]:
dp[i][j] = 1 + (dp[i... |
N=int(input())
for i in range (-(N-1),N):
for j in range (-2*(N-1),2*(N-1)+1):
if j%2==0 and (abs(j//2)+abs(i))< N:
print (chr(abs(j//2)+abs(i)+ord('a')),end='')
else:
print('-',end='')
print() | n = int(input())
for i in range(-(N - 1), N):
for j in range(-2 * (N - 1), 2 * (N - 1) + 1):
if j % 2 == 0 and abs(j // 2) + abs(i) < N:
print(chr(abs(j // 2) + abs(i) + ord('a')), end='')
else:
print('-', end='')
print() |
# coding: utf8
# try something like
def index():
rows = db((db.activity.type=='project')&(db.activity.status=='accepted')).select()
if rows:
return dict(projects=rows)
else:
return plugin_flatpage()
@auth.requires_login()
def apply():
project = db.activity[request.args(1)]
partaker... | def index():
rows = db((db.activity.type == 'project') & (db.activity.status == 'accepted')).select()
if rows:
return dict(projects=rows)
else:
return plugin_flatpage()
@auth.requires_login()
def apply():
project = db.activity[request.args(1)]
partaker = db((db.partaker.activity == ... |
N = int(input())
C = set()
for _ in range(N):
S, T = map(str, input().split())
C.add(tuple([S, T]))
if len(C) == N:
print("No")
else:
print("Yes") | n = int(input())
c = set()
for _ in range(N):
(s, t) = map(str, input().split())
C.add(tuple([S, T]))
if len(C) == N:
print('No')
else:
print('Yes') |
class DoubleLinkedList:
def __init__(self, value):
self.prev = self
self.next = self
self.value = value
def get_next(self):
return self.next
def get_prev(self):
return self.prev
def get_value(self):
return self.value
def move_clockwise(self, steps=... | class Doublelinkedlist:
def __init__(self, value):
self.prev = self
self.next = self
self.value = value
def get_next(self):
return self.next
def get_prev(self):
return self.prev
def get_value(self):
return self.value
def move_clockwise(self, steps... |
golfcube = dm.sample_data.golf()
stratcube = dm.cube.StratigraphyCube.from_DataCube(golfcube, dz=0.05)
stratcube.register_section('demo', dm.section.StrikeSection(distance_idx=10))
fig, ax = plt.subplots(5, 1, sharex=True, sharey=True, figsize=(12, 9))
ax = ax.flatten()
for i, var in enumerate(['time', 'eta', 'veloci... | golfcube = dm.sample_data.golf()
stratcube = dm.cube.StratigraphyCube.from_DataCube(golfcube, dz=0.05)
stratcube.register_section('demo', dm.section.StrikeSection(distance_idx=10))
(fig, ax) = plt.subplots(5, 1, sharex=True, sharey=True, figsize=(12, 9))
ax = ax.flatten()
for (i, var) in enumerate(['time', 'eta', 'velo... |
__all__ = ['USBQException', 'USBQInvocationError', 'USBQDeviceNotConnected']
class USBQException(Exception):
'Base of all USBQ exceptions'
class USBQInvocationError(USBQException):
'Error invoking USBQ'
class USBQDeviceNotConnected(USBQException):
'USBQ device not connected.'
| __all__ = ['USBQException', 'USBQInvocationError', 'USBQDeviceNotConnected']
class Usbqexception(Exception):
"""Base of all USBQ exceptions"""
class Usbqinvocationerror(USBQException):
"""Error invoking USBQ"""
class Usbqdevicenotconnected(USBQException):
"""USBQ device not connected.""" |
# Copyright (c) 2009 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,
},
'targets': [
{
'target_name': 'security_tests',
'type': 'shared_library',
'source... | {'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'security_tests', 'type': 'shared_library', 'sources': ['../../../sandbox/win/tests/validation_tests/commands.cc', '../../../sandbox/win/tests/validation_tests/commands.h', 'ipc_security_tests.cc', 'ipc_security_tests.h', 'security_tests.cc']}]} |
#!/usr/bin/env python
# encoding: utf-8
'''
@author: Jason Lee
@license: (C) Copyright @ Jason Lee
@contact: jiansenll@163.com
@file: money_dp.py
@time: 2019/4/22 23:17
@desc:
find least number of money to achieve a total amount
'''
def money_dp(total):
money = [1, 5, 11] # value of each money
number ... | """
@author: Jason Lee
@license: (C) Copyright @ Jason Lee
@contact: jiansenll@163.com
@file: money_dp.py
@time: 2019/4/22 23:17
@desc:
find least number of money to achieve a total amount
"""
def money_dp(total):
money = [1, 5, 11]
number = [0] * (total + 1)
for i in range(1, total + 1):
cos... |
class Solution:
def majorityElement(self, nums) -> int:
dic={}
for num in nums:
dic[num]=dic.get(num,0)+1
#guess,dic.get(num,0)=dic.get(num,0)+1 is non-existential,for in syntax field,we can't assign to function call
for num in nums:
i... | class Solution:
def majority_element(self, nums) -> int:
dic = {}
for num in nums:
dic[num] = dic.get(num, 0) + 1
for num in nums:
if dic.get(num, 0) >= len(nums) / 2:
return num |
[2,8,"t","pncmjxlvckfbtrjh"],
[8,9,"l","lzllllldsl"],
[3,11,"c","ccchcccccclxnkcmc"],
[3,10,"h","xcvxkdqshh"],
[4,5,"s","gssss"],
[7,14,"m","mmcmqmmxmmmnmmrmcxc"],
[3,12,"n","grnxnbsmzttnzbnnn"],
[5,9,"j","ddqwznjhjcjn"],
[8,9,"d","fddddddmd"],
[6,8,"t","qtlwttsqg"],
[7,15,"m","lxzxrdbmmtvwhgm"],
[6,10,"h","hhnhhhhxhkh... | ([2, 8, 't', 'pncmjxlvckfbtrjh'],)
([8, 9, 'l', 'lzllllldsl'],)
([3, 11, 'c', 'ccchcccccclxnkcmc'],)
([3, 10, 'h', 'xcvxkdqshh'],)
([4, 5, 's', 'gssss'],)
([7, 14, 'm', 'mmcmqmmxmmmnmmrmcxc'],)
([3, 12, 'n', 'grnxnbsmzttnzbnnn'],)
([5, 9, 'j', 'ddqwznjhjcjn'],)
([8, 9, 'd', 'fddddddmd'],)
([6, 8, 't', 'qtlwttsqg'],)
([... |
# Rename this to keys.py if running locally,
# and replace the API keys with your own information.
# This project uses an EC2 instance with
# Elasticache providing the redis broker and an
# RDS instance of postgresql.
EMAIL_HOST_USER = 'YOUR_EMAIL_ADDRESS@gmail.com'
EMAIL_HOST_PASSWORD = 'YOUR_EMAIL_PASSWORD'
SETTING... | email_host_user = 'YOUR_EMAIL_ADDRESS@gmail.com'
email_host_password = 'YOUR_EMAIL_PASSWORD'
settings_key = 'YOUR_SETTINGS_KEY'
site_url = 'LOCALHOST_OR_YOUR_URL'
twilio_sid = 'YOUR_TWILIO_SID'
twilio_token = 'YOUR_TWILIO_TOKEN'
server_number = 'YOUR_TWILIO_NUMBER'
twilio_callback_url = 'http://YOUR_SITE_URL.com/api/ca... |
a = [2, 3]
for n in range(5, 10 ** 7, 2):
i = 1
while a[i] <= n ** .5:
if n % a[i] == 0:
break
i = i + 1
else:
a.append(n)
print(a)
| a = [2, 3]
for n in range(5, 10 ** 7, 2):
i = 1
while a[i] <= n ** 0.5:
if n % a[i] == 0:
break
i = i + 1
else:
a.append(n)
print(a) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.