content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#
# PySNMP MIB module RADLAN-rndMng (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RADLAN-rndMng
# Produced by pysmi-0.3.4 at Wed May 1 14:51:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 201... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, constraints_union, value_size_constraint, single_value_constraint) ... |
s = '100'
print(s)
s = 'abc1234-09232<>?323'
print(s)
s = 'abc 123'
print(s)
s = ' '
print(s)
| s = '100'
print(s)
s = 'abc1234-09232<>?323'
print(s)
s = 'abc 123'
print(s)
s = ' '
print(s) |
description = 'Slit ZB0 using Beckhoff controllers'
group = 'lowlevel'
includes = ['zz_absoluts']
instrument_values = configdata('instrument.values')
showcase_values = configdata('cf_showcase.showcase_values')
optic_values = configdata('cf_optic.optic_values')
tango_base = instrument_values['tango_base']
code_base =... | description = 'Slit ZB0 using Beckhoff controllers'
group = 'lowlevel'
includes = ['zz_absoluts']
instrument_values = configdata('instrument.values')
showcase_values = configdata('cf_showcase.showcase_values')
optic_values = configdata('cf_optic.optic_values')
tango_base = instrument_values['tango_base']
code_base = in... |
# Given an integer n, return true if it is possible to represent n as the sum of distinct powers of three. Otherwise, return false.
# An integer y is a power of three if there exists an integer x such that y == 3x.
def checkPowersOfThree(n):
while n > 0:
if n % 3 > 1:
return False
n //... | def check_powers_of_three(n):
while n > 0:
if n % 3 > 1:
return False
n //= 3
return True
print(check_powers_of_three(12))
print(check_powers_of_three(21))
print(check_powers_of_three(91))
print(check_powers_of_three(100)) |
def longest_increasing_subsequency(l: List) -> int:
result = end = 0
for i in range(len(l)):
if i > 0 and l[i - 1] >= l[i]:
end = i
result = max(result, i - end+1)
return result
print(longest_increasing_subsequency([3,5,7,2,1]))
print(longest_increasing_subsequency... | def longest_increasing_subsequency(l: List) -> int:
result = end = 0
for i in range(len(l)):
if i > 0 and l[i - 1] >= l[i]:
end = i
result = max(result, i - end + 1)
return result
print(longest_increasing_subsequency([3, 5, 7, 2, 1]))
print(longest_increasing_subsequency([2, 2, 2... |
train_data_path = "data/chunked/train/train_*"
valid_data_path = "data/chunked/valid/valid_*"
test_data_path = "data/chunked/test/test_*"
vocab_path = "data/vocab"
# Hyperparameters
hidden_dim = 512
emb_dim = 256
batch_size = 200
max_enc_steps = 55 #99% of the articles are within length 55
max_dec_steps = 15 #... | train_data_path = 'data/chunked/train/train_*'
valid_data_path = 'data/chunked/valid/valid_*'
test_data_path = 'data/chunked/test/test_*'
vocab_path = 'data/vocab'
hidden_dim = 512
emb_dim = 256
batch_size = 200
max_enc_steps = 55
max_dec_steps = 15
beam_size = 4
min_dec_steps = 3
vocab_size = 50000
lr = 0.001
rand_uni... |
# from https://github.com/pyca/bcrypt/blob/3.1.7/tests/test_bcrypt.py
#
# Copyright 2013 Donald Stufft
#
# 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/LICEN... | [(b'Kk4DQuMMfZL9o', b'$2b$04$cVWp4XaNU8a4v1uMRum2SO', b'$2b$04$cVWp4XaNU8a4v1uMRum2SO026BWLIoQMD/TXg5uZV.0P.uO8m3YEm'), (b'9IeRXmnGxMYbs', b'$2b$04$pQ7gRO7e6wx/936oXhNjrO', b'$2b$04$pQ7gRO7e6wx/936oXhNjrOUNOHL1D0h1N2IDbJZYs.1ppzSof6SPy'), (b'xVQVbwa1S0M8r', b'$2b$04$SQe9knOzepOVKoYXo9xTte', b'$2b$04$SQe9knOzepOVKoYXo9x... |
question_data = [
{
"category": "Entertainment: Japanese Anime & Manga",
"type": "boolean",
"difficulty": "easy",
"question": "In the 1988 film "Akira", Tetsuo ends up destroying Tokyo.",
"correct_answer": "True",
"incorrect_answers": [
"False"
... | question_data = [{'category': 'Entertainment: Japanese Anime & Manga', 'type': 'boolean', 'difficulty': 'easy', 'question': 'In the 1988 film "Akira", Tetsuo ends up destroying Tokyo.', 'correct_answer': 'True', 'incorrect_answers': ['False']}, {'category': 'Entertainment: Japanese Anime & Manga', 'type': 'bo... |
def do_helm(s):
if not s.command_available('helm'):
# https://docs.helm.sh/using_helm/#installing-the-helm-client
s.send('curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash')
s.send('helm init')
s.send('kubectl get pods --namespace kube-system')
| def do_helm(s):
if not s.command_available('helm'):
s.send('curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash')
s.send('helm init')
s.send('kubectl get pods --namespace kube-system') |
tuplas=("inacio","python","udemy")
print(tuplas)
print(tuplas[0])
print(tuplas[1])
print(tuplas[2])
print(tuplas[0:2])
print(tuplas+tuplas)
print(tuplas*5)
print(4 in tuplas)
print("udemy" in tuplas)
lista=[1,2,4,"inacio"]
print(lista)
tuplas2=lista
print(tuplas2)
| tuplas = ('inacio', 'python', 'udemy')
print(tuplas)
print(tuplas[0])
print(tuplas[1])
print(tuplas[2])
print(tuplas[0:2])
print(tuplas + tuplas)
print(tuplas * 5)
print(4 in tuplas)
print('udemy' in tuplas)
lista = [1, 2, 4, 'inacio']
print(lista)
tuplas2 = lista
print(tuplas2) |
for char in "Hello, world!":
for _ in range(0, ord(char)):
print("+", end = "")
print("[", end = "")
print()
| for char in 'Hello, world!':
for _ in range(0, ord(char)):
print('+', end='')
print('[', end='')
print() |
def read_settings_sql(cluster_descr, host_type):
for settings_descr in cluster_descr.settings_list:
if settings_descr.settings_type != host_type:
continue
yield from settings_descr.read_sql()
# vi:ts=4:sw=4:et
| def read_settings_sql(cluster_descr, host_type):
for settings_descr in cluster_descr.settings_list:
if settings_descr.settings_type != host_type:
continue
yield from settings_descr.read_sql() |
# Use this file to configure your DNA Center via REST APIs
# Replace all values below with your production DNA Center information
# DNA Parameters
DNA_FQDN = "dna.fqdn"
DNA_PORT = "443"
DNA_USER = "admin"
DNA_PASS = "password"
DNA_SWITCHES = ["switch1", "switch2", "switch3"]
# DNA API Calls
DNA_AUTH_API = "/dna/syst... | dna_fqdn = 'dna.fqdn'
dna_port = '443'
dna_user = 'admin'
dna_pass = 'password'
dna_switches = ['switch1', 'switch2', 'switch3']
dna_auth_api = '/dna/system/api/v1/auth/token'
dna_device_api = '/dna/intent/api/v1/network-device'
dna_interface_api = '/api/v1/interface/network-device/' |
x = 42
y = 3/4
z = int('7')
a = float(5)
name = "David"
print(type(x))
print(type(y))
print(type(z))
print(type(a))
print(type(name))
rent = 2000
per_day = rent / 30
print(per_day)
greeting = "My name is"
print(greeting, name)
print(greeting, name, f"My rent is {rent}")
help(greeting)
| x = 42
y = 3 / 4
z = int('7')
a = float(5)
name = 'David'
print(type(x))
print(type(y))
print(type(z))
print(type(a))
print(type(name))
rent = 2000
per_day = rent / 30
print(per_day)
greeting = 'My name is'
print(greeting, name)
print(greeting, name, f'My rent is {rent}')
help(greeting) |
class Solution:
def intToRoman(self, num: int) -> str:
roman = {}
roman[1000] = 'M'
roman[900] = 'CM'
roman[500] = 'D'
roman[400] = 'CD'
roman[100] = 'C'
roman[90] = 'XC'
roman[50] = 'L'
roman[40] = 'XL'
roman[10] = 'X'
roman[9]... | class Solution:
def int_to_roman(self, num: int) -> str:
roman = {}
roman[1000] = 'M'
roman[900] = 'CM'
roman[500] = 'D'
roman[400] = 'CD'
roman[100] = 'C'
roman[90] = 'XC'
roman[50] = 'L'
roman[40] = 'XL'
roman[10] = 'X'
roman... |
# from .latexrun import
__version__ = "0.1.0"
__all__ = []
| __version__ = '0.1.0'
__all__ = [] |
def memberGraph():
return {
"nodes": [
{
"id": 1,
"label": "mbudiselicbuda",
"shape": "circularImage",
"image": "https://avatars.githubusercontent.com/u/4950251?s=88&v=4",
"title": "Ovo je njonjo",
"s... | def member_graph():
return {'nodes': [{'id': 1, 'label': 'mbudiselicbuda', 'shape': 'circularImage', 'image': 'https://avatars.githubusercontent.com/u/4950251?s=88&v=4', 'title': 'Ovo je njonjo', 'size': 100, 'borderWidth': 10, 'color': {'border': 'green'}}, {'id': 2, 'label': 'mbudiselicbuda', 'shape': 'ellipse', ... |
def solve(arr):
arr.sort()
s = 0
for i in range(0, len(arr), 2):
s += arr[i]
return s
| def solve(arr):
arr.sort()
s = 0
for i in range(0, len(arr), 2):
s += arr[i]
return s |
#! /usr/bin/python3.5
### INSTRUCTIONS ###
# instruction: ([chars list], has parameter, "representation in WIL")
CHARS = 0
PARAM = 1
WIL = 2
STACK_INSTRUCTIONS = [
(['S'], True, 'push' ),
(['L', 'S'], False, 'dup' ),
(['T', 'S'], True, 'copy' ),
(['L', 'T'], False, 'swap' ),
(['L', 'L... | chars = 0
param = 1
wil = 2
stack_instructions = [(['S'], True, 'push'), (['L', 'S'], False, 'dup'), (['T', 'S'], True, 'copy'), (['L', 'T'], False, 'swap'), (['L', 'L'], False, 'pop'), (['T', 'L'], True, 'slide')]
arith_instructions = [(['S', 'S'], False, 'add'), (['S', 'T'], False, 'sub'), (['S', 'L'], False, 'mul'),... |
rows = 11
for i in range(0, rows):
for j in range(0, i + 1):
print(i * j, end= ' ')
print()
| rows = 11
for i in range(0, rows):
for j in range(0, i + 1):
print(i * j, end=' ')
print() |
class Mobile:
def __init__(self):
print("Mobile features: Camera, Phone, Applications")
class Samsung(Mobile):
def __init__(self):
print("Samsung Company")
super().__init__()
class Samsung_Prime(Samsung):
def __init__(self):
print("Samsung latest Mobile")
super().__in... | class Mobile:
def __init__(self):
print('Mobile features: Camera, Phone, Applications')
class Samsung(Mobile):
def __init__(self):
print('Samsung Company')
super().__init__()
class Samsung_Prime(Samsung):
def __init__(self):
print('Samsung latest Mobile')
super()... |
#========================example 1======================
#check a number if it can perfectly divide by n^2+1
fx = lambda n: (n**2+1)%5==0
k=int(input("please enter a number: "))
print(fx(k))
#========================example 2======================
findMax = lambda x,y: max(x,y)
print(findMax(100,200)) | fx = lambda n: (n ** 2 + 1) % 5 == 0
k = int(input('please enter a number: '))
print(fx(k))
find_max = lambda x, y: max(x, y)
print(find_max(100, 200)) |
class Snake:
def __init__(self, SCREEN_LENGTH, MIDDLE_SCREEN):
self.screen = SCREEN_LENGTH
self.middle_screen = MIDDLE_SCREEN
self.position = [self.middle_screen, self.middle_screen]
self.body = [[self.middle_screen, self.middle_screen], [self.middle_screen - 10 , self.middle_screen]... | class Snake:
def __init__(self, SCREEN_LENGTH, MIDDLE_SCREEN):
self.screen = SCREEN_LENGTH
self.middle_screen = MIDDLE_SCREEN
self.position = [self.middle_screen, self.middle_screen]
self.body = [[self.middle_screen, self.middle_screen], [self.middle_screen - 10, self.middle_screen]... |
def fourSum(nums, target):
def threeSum(nums, target):
if len(nums) < 3:
return []
res = set()
for i, n in enumerate(nums):
l = i + 1
r = len(nums) - 1
t = target - n
while l < r:
if nums[l] + nums[r] > t:
... | def four_sum(nums, target):
def three_sum(nums, target):
if len(nums) < 3:
return []
res = set()
for (i, n) in enumerate(nums):
l = i + 1
r = len(nums) - 1
t = target - n
while l < r:
if nums[l] + nums[r] > t:
... |
class Shift:
def __init__(self, id, ansvar, tid_fra, tid_til, antall_timer, weight, sted, antrekk):
self.id = id
self.responsibility = ansvar
self.time_from = tid_fra
self.time_to = tid_til
self.hours = antall_timer
self.weight = weight
self.allocated = Fals... | class Shift:
def __init__(self, id, ansvar, tid_fra, tid_til, antall_timer, weight, sted, antrekk):
self.id = id
self.responsibility = ansvar
self.time_from = tid_fra
self.time_to = tid_til
self.hours = antall_timer
self.weight = weight
self.allocated = False... |
BZX = Contract.from_abi("BZX", "0xfe4F0eb0A1Ad109185c9AaDE64C48ff8e928e54B", interface.IBZx.abi)
TOKEN_REGISTRY = Contract.from_abi("TOKEN_REGISTRY", "0x5a6f1e81334C63DE0183A4a3864bD5CeC4151c27", TokenRegistry.abi)
list = TOKEN_REGISTRY.getTokens(0, 100)
for l in list:
iTokenTemp = Contract.from_abi("iTokenTemp", ... | bzx = Contract.from_abi('BZX', '0xfe4F0eb0A1Ad109185c9AaDE64C48ff8e928e54B', interface.IBZx.abi)
token_registry = Contract.from_abi('TOKEN_REGISTRY', '0x5a6f1e81334C63DE0183A4a3864bD5CeC4151c27', TokenRegistry.abi)
list = TOKEN_REGISTRY.getTokens(0, 100)
for l in list:
i_token_temp = Contract.from_abi('iTokenTemp',... |
class StoredAttachmentsManager:
PROVIDER_ID_FIELD = 'id'
URL_FIELD = 'url'
CAPTION_FIELD = 'content'
CREDIT_FIELD = 'excerpt'
items_collection = 'attachments'
response_collection = 'imported_images'
original_key_fields = ['id', 'url']
# item = {i: original_item[i] for i in self.origi... | class Storedattachmentsmanager:
provider_id_field = 'id'
url_field = 'url'
caption_field = 'content'
credit_field = 'excerpt'
items_collection = 'attachments'
response_collection = 'imported_images'
original_key_fields = ['id', 'url']
def __init__(self, db):
self.db = db
de... |
# https://www.hackerrank.com/challenges/acm-icpc-team
def union(p1, p2):
return [t1 | t2 for t1, t2 in zip(p1, p2)]
def acm_icpc_team(persons):
max_t, max_qty = 0, 0
for i, p1 in enumerate(persons):
for j, p2 in enumerate(persons[(i + 1):], i + 1):
t = sum(union(p1, p2))
... | def union(p1, p2):
return [t1 | t2 for (t1, t2) in zip(p1, p2)]
def acm_icpc_team(persons):
(max_t, max_qty) = (0, 0)
for (i, p1) in enumerate(persons):
for (j, p2) in enumerate(persons[i + 1:], i + 1):
t = sum(union(p1, p2))
if t == max_t:
max_qty += 1
... |
# Challenge 10 : Create a function named reversed_list() that takes two lists of the same size as parameters named lst1 and lst2.
# The function should return True if lst1 is the same as lst2 reversed.
# The function should return False otherwise.
# Date : Sun 07 Jun 2020 09:43:32... | def reversed_list(lst1, lst2):
for index in range(len(lst1)):
if lst1[index] != lst2[len(lst2) - 1 - index]:
return False
return True
print(reversed_list([1, 2, 3], [3, 2, 1]))
print(reversed_list([1, 5, 3], [3, 2, 1])) |
__theme_meta__ = {
'author': "Baseline Core Team",
'title': "Baseline 2015",
'url': "https://github.com/loftylabs/baseline/",
'version': "0.1a",
'description': "The default Baseline theme.",
}
| __theme_meta__ = {'author': 'Baseline Core Team', 'title': 'Baseline 2015', 'url': 'https://github.com/loftylabs/baseline/', 'version': '0.1a', 'description': 'The default Baseline theme.'} |
'''
Write a function that takes a non-empty array of distinct integers, and an integer representing a target sum.
If any two numbers in the array sum upto the target sum, return the two numbers
Else, return an empty array.
'''
# Prompt:
# Distinct & non-empty integer array
# Returns two integers - any order
... | """
Write a function that takes a non-empty array of distinct integers, and an integer representing a target sum.
If any two numbers in the array sum upto the target sum, return the two numbers
Else, return an empty array.
"""
def two_number_sum(array, targetSum):
for i in range(0, len(array) - 1):
for j i... |
# Sets - A set is an unordered collection of items.
# Creating Sets
set_nums = {9, 10, 1, 4, 3, 2, 5, 0}
set_empty = {}
set_names = {'John', 'Kim', 'Kelly', 'Dora', False}
# all (True if all items are true or empty set)
print(" all - ".center(30, "-"))
print('set_nums : ', all(set_nums))
print('set_nums2 : ', all(se... | set_nums = {9, 10, 1, 4, 3, 2, 5, 0}
set_empty = {}
set_names = {'John', 'Kim', 'Kelly', 'Dora', False}
print(' all - '.center(30, '-'))
print('set_nums : ', all(set_nums))
print('set_nums2 : ', all(set_empty))
print(' any - '.center(30, '-'))
print('set_nums : ', any(set_nums))
print('set_nums2 : ', any(set_empty))
... |
# Copyright 2014 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': 'athena_main_lib',
'type': 'static_library',
'dependenc... | {'variables': {'chromium_code': 1}, 'targets': [{'target_name': 'athena_main_lib', 'type': 'static_library', 'dependencies': ['../athena.gyp:athena_lib', '../athena.gyp:athena_content_lib', '../athena.gyp:athena_content_support_lib', '../resources/athena_resources.gyp:athena_resources', '../../ash/ash_resources.gyp:ash... |
'''
Given a string s consisting of small English letters, find and return the first instance of a non-repeating character in it. If there is no such character, return '_'.
Example
For s = "abacabad", the output should be
first_not_repeating_character(s) = 'c'.
There are 2 non-repeating characters in the string: 'c' ... | """
Given a string s consisting of small English letters, find and return the first instance of a non-repeating character in it. If there is no such character, return '_'.
Example
For s = "abacabad", the output should be
first_not_repeating_character(s) = 'c'.
There are 2 non-repeating characters in the string: 'c' ... |
{
"targets": [
{
"target_name": "binding-helloworld",
"sources": [ "src/cpp/binding-helloworld.cc" ]
},
{
"target_name": "binding-fibonacci",
"sources": [ "src/cpp/binding-fibonacci.cc" ]
}
]
} | {'targets': [{'target_name': 'binding-helloworld', 'sources': ['src/cpp/binding-helloworld.cc']}, {'target_name': 'binding-fibonacci', 'sources': ['src/cpp/binding-fibonacci.cc']}]} |
{
"targets": [{
"include_dirs" : [
"<!(node -e \"require('nan')\")"
],
"defines": [
"PSAPI_VERSION=1",
"METRO_APPS=1"
],
"libraries": ["-lPsapi"],
"target_name": "whoisopen",
"sources": ["src/whoisopen.cc"]
}]
} | {'targets': [{'include_dirs': ['<!(node -e "require(\'nan\')")'], 'defines': ['PSAPI_VERSION=1', 'METRO_APPS=1'], 'libraries': ['-lPsapi'], 'target_name': 'whoisopen', 'sources': ['src/whoisopen.cc']}]} |
def arr_mult(A,B):
new = []
# Iterate over the rows of A.
for i in range(len(A)):
# Create a new row to insert into the product.
newrow = []
# Iterate over the columns of B.
# len(B[0]) returns the length of the first row
# (the number of columns).
for j in r... | def arr_mult(A, B):
new = []
for i in range(len(A)):
newrow = []
for j in range(len(B[0])):
tot = 0
for k in range(len(B)):
tot += A[i][k] * B[k][j]
newrow.append(tot)
new.append(newrow)
return new |
def pandigital_generator():
for perm in itertools.permutations(range(0,10)):
if perm[0] != 0:
yield functools.reduce(lambda x,y: x*10 + y, perm)
def prime_generator():
yield 2
yield 3
yield 5
yield 7
yield 11
yield 13
yield 17
def has_p043_property(n):
n_str = s... | def pandigital_generator():
for perm in itertools.permutations(range(0, 10)):
if perm[0] != 0:
yield functools.reduce(lambda x, y: x * 10 + y, perm)
def prime_generator():
yield 2
yield 3
yield 5
yield 7
yield 11
yield 13
yield 17
def has_p043_property(n):
n_str... |
class PluginBase:
instances = []
def __init_subclass__(cls, **kwargs):
super().__init_subclass__(**kwargs)
cls.instances.append(cls())
def hello() -> list:
results = []
for i in PluginBase.instances:
results.append(i.hello())
return results
class Pl... | class Pluginbase:
instances = []
def __init_subclass__(cls, **kwargs):
super().__init_subclass__(**kwargs)
cls.instances.append(cls())
def hello() -> list:
results = []
for i in PluginBase.instances:
results.append(i.hello())
return results
class Plugin... |
def write_table_row(key, value):
row = f"<tr><td>{key}</td><td>{value}</td></tr>"
return row
def write_doc_entry(idx, domain):
fields = domain.get("fields")
doc_entry = f'<tr><th colspan="2">Link {idx}</th></tr>'
doc_entry += write_table_row(
"URL",
f"<a target=\"_blank\" rel=\"noo... | def write_table_row(key, value):
row = f'<tr><td>{key}</td><td>{value}</td></tr>'
return row
def write_doc_entry(idx, domain):
fields = domain.get('fields')
doc_entry = f'<tr><th colspan="2">Link {idx}</th></tr>'
doc_entry += write_table_row('URL', f"""<a target="_blank" rel="noopener noreferrer" h... |
# https://www.codewars.com/kata/how-good-are-you-really
def better_than_average(class_points, your_points):
counter = 0
sum = 0
output = True
for i in class_points:
sum += i
counter += 1
if sum / counter >= your_points:
output = False
return output
| def better_than_average(class_points, your_points):
counter = 0
sum = 0
output = True
for i in class_points:
sum += i
counter += 1
if sum / counter >= your_points:
output = False
return output |
'''
Given the head of a singly linked list, reverse the list, and return the reversed list.
Example 1:
Input: head = [1,2,3,4,5]
Output: [5,4,3,2,1]
Example 2:
Input: head = [1,2]
Output: [2,1]
Example 3:
Input: head = []
Output: []
Constraints:
The number of nodes in the list is the range [0, 5000].
-5000 <= Nod... | """
Given the head of a singly linked list, reverse the list, and return the reversed list.
Example 1:
Input: head = [1,2,3,4,5]
Output: [5,4,3,2,1]
Example 2:
Input: head = [1,2]
Output: [2,1]
Example 3:
Input: head = []
Output: []
Constraints:
The number of nodes in the list is the range [0, 5000].
-5000 <= Nod... |
def dig_str(n):
lista = []
st = str(n)
for i in range(len(st)):
lista.append(st[i])
return(sorted(lista))
def comparador_de_digitos(x,y):
if dig_str(x) == dig_str(y):
return(1)
else:
return(0)
N = 1
while(True):
if comparador_de_digitos(N, 2 * N) == 1 and comparador_de_digitos(N, 3 * N) == 1 and comparad... | def dig_str(n):
lista = []
st = str(n)
for i in range(len(st)):
lista.append(st[i])
return sorted(lista)
def comparador_de_digitos(x, y):
if dig_str(x) == dig_str(y):
return 1
else:
return 0
n = 1
while True:
if comparador_de_digitos(N, 2 * N) == 1 and comparador_de_... |
'''
Author : MiKueen
Level : Medium
Problem Statement : Coin Change 2
You are given coins of different denominations and a total amount of money.
Write a function to compute the number of combinations that make up that amount.
You may assume that you have infinite number of each kind of coin.
Example 1:
Input: amou... | """
Author : MiKueen
Level : Medium
Problem Statement : Coin Change 2
You are given coins of different denominations and a total amount of money.
Write a function to compute the number of combinations that make up that amount.
You may assume that you have infinite number of each kind of coin.
Example 1:
Input: amou... |
gitdownloads = {
"opsxcq": ("exploit-CVE-2017-7494", "exploit-CVE-2016-10033"),
"t0kx": ("exploit-CVE-2016-9920"),
"helmL64": "https://get.helm.sh/helm-v3.7.0-linux-amd64.tar.gz",
"helmW64": "https://get.helm.sh/helm-v3.7.0-windows-amd64.zip"
}
helmchartrepos = {
"gitlab": "helm repo add gitlab http... | gitdownloads = {'opsxcq': ('exploit-CVE-2017-7494', 'exploit-CVE-2016-10033'), 't0kx': 'exploit-CVE-2016-9920', 'helmL64': 'https://get.helm.sh/helm-v3.7.0-linux-amd64.tar.gz', 'helmW64': 'https://get.helm.sh/helm-v3.7.0-windows-amd64.zip'}
helmchartrepos = {'gitlab': 'helm repo add gitlab https://charts.gitlab.io/', '... |
'''
Kattis - primematrix
Constructive problem, first we find a set of distinct positive integers that sum to a prime
number such that the maximum number is minimised. Then the matrix can be constructed by printing
all lexicographical rotations of the set of numbers.
To find this set of numbers, given the bounds of th... | """
Kattis - primematrix
Constructive problem, first we find a set of distinct positive integers that sum to a prime
number such that the maximum number is minimised. Then the matrix can be constructed by printing
all lexicographical rotations of the set of numbers.
To find this set of numbers, given the bounds of th... |
def validate_password(password: str):
if len(password)<8:
return False
for i in password:
if i.isdigit():
return True
return False | def validate_password(password: str):
if len(password) < 8:
return False
for i in password:
if i.isdigit():
return True
return False |
# Common test data used by multiple tests
AUTH_ARGS = {
'client_id': 'cats',
'client_secret': 'opposable thumbs',
'access_token': 'paw',
'refresh_token': 'teeth',
}
| auth_args = {'client_id': 'cats', 'client_secret': 'opposable thumbs', 'access_token': 'paw', 'refresh_token': 'teeth'} |
{
"targets": [
{
"target_name": "itt",
"sources": [ "itt-addon.cc" ],
"include_dirs": [
"include", "C:\\Program Files (x86)\\IntelSWTools\\VTune Profiler 2020\\include"
],
"libraries": [
"C:\\Program Files (x86)\\IntelSWTools\\VTune Profiler 2020\\lib64\\libittnotify.... | {'targets': [{'target_name': 'itt', 'sources': ['itt-addon.cc'], 'include_dirs': ['include', 'C:\\Program Files (x86)\\IntelSWTools\\VTune Profiler 2020\\include'], 'libraries': ['C:\\Program Files (x86)\\IntelSWTools\\VTune Profiler 2020\\lib64\\libittnotify.lib']}]} |
ranges ={
'temp':{'min':1,'max':45},#Temperature
'soc':{'min':20,'max':80},#state of Charge
'charge_rate':{'min':0,'max':0.8},#state of Charge
}
test_report=[]
test_case_id=0
def append_list(src_list,dst_list):
for x in src_list:
dst_list.append(x)
def min_range_test(value,range_min):
result=Fal... | ranges = {'temp': {'min': 1, 'max': 45}, 'soc': {'min': 20, 'max': 80}, 'charge_rate': {'min': 0, 'max': 0.8}}
test_report = []
test_case_id = 0
def append_list(src_list, dst_list):
for x in src_list:
dst_list.append(x)
def min_range_test(value, range_min):
result = False
test_step = '\t\tTeststep... |
class SomeClass:
def __init__(self, name='lin'):
self.name = name
# def get_name(self):
# return self.name
def get_name_new():
return self.name
| class Someclass:
def __init__(self, name='lin'):
self.name = name
def get_name_new():
return self.name |
# ___ ___
# | _ \ | _ \
# ___ __ __ || || ||_||
#_\/_ | | ||__| __ || || |___/ _\/_
# /\ | |__|| || || | _ \ /\
# ||_|| ||_||
# |___/ |___/
#
__version__ = '2.0.7'
| __version__ = '2.0.7' |
x = 10
y = 1
color = 'blue'
first_name = 'Julian'
last_name = 'Henao'
# < > <= <= ==
if x < 30:
print('X is less than 30')
else:
print('X is greater than 30')
if color == 'red':
print('The color is red')
else:
print('Any color')
if color == 'yellow':
print('The color is yellow')
elif color == 'b... | x = 10
y = 1
color = 'blue'
first_name = 'Julian'
last_name = 'Henao'
if x < 30:
print('X is less than 30')
else:
print('X is greater than 30')
if color == 'red':
print('The color is red')
else:
print('Any color')
if color == 'yellow':
print('The color is yellow')
elif color == 'blue':
print('Th... |
class Mobile:
def make_call(self):
print("i am making a call")
def play_game(self):
print("i am playing games")
m1=Mobile()
m1.make_call()
m1.play_game()
class Mobile:
def set_color(self,color):
self.color=color
def set_cost(self,cost):
self.cost=cost
def show_col... | class Mobile:
def make_call(self):
print('i am making a call')
def play_game(self):
print('i am playing games')
m1 = mobile()
m1.make_call()
m1.play_game()
class Mobile:
def set_color(self, color):
self.color = color
def set_cost(self, cost):
self.cost = cost
de... |
'''
Find the continuous sequence in array with mix of positive and negative integers
with the largest sum: Return the sum
'''
def max_subseq(arr):
sum = 0
maxSum = 0
start = 0
end = 0
for i in range(1, len(arr)):
sum += arr[i]
if maxSum < sum:
maxSum = sum
... | """
Find the continuous sequence in array with mix of positive and negative integers
with the largest sum: Return the sum
"""
def max_subseq(arr):
sum = 0
max_sum = 0
start = 0
end = 0
for i in range(1, len(arr)):
sum += arr[i]
if maxSum < sum:
max_sum = sum
elif... |
class AuthenticateViews:
def authenticate_product(self,name, qty, min_stock, price, units, category):
if not name or not isinstance(name, str):
return "product name missing or must be a string."
if name.isspace() or not name.isalpha():
return "product name should onl... | class Authenticateviews:
def authenticate_product(self, name, qty, min_stock, price, units, category):
if not name or not isinstance(name, str):
return 'product name missing or must be a string.'
if name.isspace() or not name.isalpha():
return 'product name should only be le... |
# md5 : 157b3267a46a79dd900104f241da8c4c
# sha1 : 178271eaf8c48384e206cbaebcbbc12030980410
# sha256 : 8611dc1b60ae5c383bba6cb3ffd8a51aeebff23b95844f0ab3d6e5ecd0fadc84
ord_names = {
100: b'ThunRTMain',
101: b'VBDllUnRegisterServer',
102: b'VBDllCanUnloadNow',
103: b'VBDllRegisterServer',
104: b'VBDl... | ord_names = {100: b'ThunRTMain', 101: b'VBDllUnRegisterServer', 102: b'VBDllCanUnloadNow', 103: b'VBDllRegisterServer', 104: b'VBDllGetClassObject', 105: b'UserDllMain', 106: b'DllRegisterServer', 107: b'DllUnregisterServer', 108: b'__vbaAryLock', 109: b'__vbaBoolErrVar', 110: b'__vbaStrErrVarCopy', 111: b'__vbaAryVarV... |
# model
model = Model()
i0 = Input("op_shape", "TENSOR_INT32", "{4}")
weights = Parameter("ker", "TENSOR_FLOAT32", "{2, 3, 3, 1}",
[1.0, 3.0, 5.0, 7.0, 9.0, 11.0,
13.0, 15.0, 17.0, 2.0, 4.0, 6.0,
8.0, 10.0, 12.0, 14.0, 16.0, 18.0])
i1 = Input("in", "TENSOR_FLOAT32", "{1, 2, 2, 1}" )
pad = Int32Scalar("pad_valid",... | model = model()
i0 = input('op_shape', 'TENSOR_INT32', '{4}')
weights = parameter('ker', 'TENSOR_FLOAT32', '{2, 3, 3, 1}', [1.0, 3.0, 5.0, 7.0, 9.0, 11.0, 13.0, 15.0, 17.0, 2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0, 18.0])
i1 = input('in', 'TENSOR_FLOAT32', '{1, 2, 2, 1}')
pad = int32_scalar('pad_valid', 2)
s_x = int3... |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"Intake": "01_Download_and_Load.ipynb",
"mergeDatasets": "02_Merge_Data.ipynb",
"workWithGeometryData": "03_Map_Basics_Intake_and_Operations.ipynb",
"readInGeometryData": "03_Map_Ba... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'Intake': '01_Download_and_Load.ipynb', 'mergeDatasets': '02_Merge_Data.ipynb', 'workWithGeometryData': '03_Map_Basics_Intake_and_Operations.ipynb', 'readInGeometryData': '03_Map_Basics_Intake_and_Operations.ipynb', 'map_points': '03_Map_Basics_Inta... |
def main():
age = int(input('Enter your age: '))
name = input('Enter your name: ')
if age < 30:
print('Hello', name)
print('I see you are less than 30.')
print('You are so young.') | def main():
age = int(input('Enter your age: '))
name = input('Enter your name: ')
if age < 30:
print('Hello', name)
print('I see you are less than 30.')
print('You are so young.') |
file = open("IntegerArray.txt")
data = []
n = 0
while 1:
line = file.readline()
if not line:
break
data.append(int(line))
n += 1
def InverseCount(data):
n = len(data)
if n <= 1:
return data,0
n1 = int(n/2+0.5)
A = data[:n1]
B = data[n1:]
A,m1 = InverseCount(A)
B,m2 = InverseCount(... | file = open('IntegerArray.txt')
data = []
n = 0
while 1:
line = file.readline()
if not line:
break
data.append(int(line))
n += 1
def inverse_count(data):
n = len(data)
if n <= 1:
return (data, 0)
n1 = int(n / 2 + 0.5)
a = data[:n1]
b = data[n1:]
(a, m1) = inverse... |
#
# PySNMP MIB module Wellfleet-X25PAD-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Wellfleet-X25PAD-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:35:50 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint) ... |
class HumanPlayer:
def __init__(self, start_position, boundary):
self.size = 3
self.cycleSpeed = 4
self.cycleInterval = 0
pos = int(start_position - self.size / 2)
self.positions = range(pos, pos + self.size)
self.startPosition = start_position
self.boundary... | class Humanplayer:
def __init__(self, start_position, boundary):
self.size = 3
self.cycleSpeed = 4
self.cycleInterval = 0
pos = int(start_position - self.size / 2)
self.positions = range(pos, pos + self.size)
self.startPosition = start_position
self.boundary ... |
class Solution:
def missingNumber(self, nums: List[int]) -> int:
numsLen = len(nums)
sumAll = numsLen * (numsLen + 1) // 2
sumReal = sum(nums)
return sumAll - sumReal | class Solution:
def missing_number(self, nums: List[int]) -> int:
nums_len = len(nums)
sum_all = numsLen * (numsLen + 1) // 2
sum_real = sum(nums)
return sumAll - sumReal |
class TransformError(Exception):
def __init__(self, func_name, reason, context=''):
self.func_name = func_name
self.reason = reason
self.context = context
| class Transformerror(Exception):
def __init__(self, func_name, reason, context=''):
self.func_name = func_name
self.reason = reason
self.context = context |
#
# PySNMP MIB module DES3052P-L2MGMT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DES3052P-L2MGMT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:24:54 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_range_constraint, single_value_constraint, constraints_union, value_size_constraint) ... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
def fedora_storage_config(release):
return {
"bucket": "antlir",
"key": "s3",
"kind": "s3",
"prefix": "s... | def fedora_storage_config(release):
return {'bucket': 'antlir', 'key': 's3', 'kind': 's3', 'prefix': 'snapshots/fedora/{}'.format(release), 'region': 'us-east-2'} |
#!/usr/bin/env python3
# Complete the superDigit function below.
def superDigit(n, k):
x = int(n) * k % 9
return x if x else 9
if __name__ == "__main__":
nk = input().split()
n = nk[0]
k = int(nk[1])
result = superDigit(n, k)
print(result)
| def super_digit(n, k):
x = int(n) * k % 9
return x if x else 9
if __name__ == '__main__':
nk = input().split()
n = nk[0]
k = int(nk[1])
result = super_digit(n, k)
print(result) |
class Operation(object):
def __eq__(self, other):
return self.__class__ == other.__class__ and self.__dict__ == other.__dict__
class Update(Operation):
def __init__(self, from_package, to_package):
self.from_package = from_package
self.to_package = to_package
def __repr__(self):
... | class Operation(object):
def __eq__(self, other):
return self.__class__ == other.__class__ and self.__dict__ == other.__dict__
class Update(Operation):
def __init__(self, from_package, to_package):
self.from_package = from_package
self.to_package = to_package
def __repr__(self):
... |
contact_address = 'crowd.group.mturk@gmail.com'
COGNITIVE_TEST_STROOP = 'stroop'
COGNITIVE_TEST_FLANKER = 'flanker'
COGNITIVE_TEST_TASK_SWITCHING = 'task-switching'
COGNITIVE_TEST_POINTING = 'pointing'
COGNITIVE_TEST_N_BACK = 'n-back'
CROWD_TASK_SENTIMENT = 'sentiment'
CROWD_TASK_TRANSCRIPTION = 'transcription'
CROWD... | contact_address = 'crowd.group.mturk@gmail.com'
cognitive_test_stroop = 'stroop'
cognitive_test_flanker = 'flanker'
cognitive_test_task_switching = 'task-switching'
cognitive_test_pointing = 'pointing'
cognitive_test_n_back = 'n-back'
crowd_task_sentiment = 'sentiment'
crowd_task_transcription = 'transcription'
crowd_t... |
class Node:
def __init__(self, key, next=None):
self.key = key
self.next = next
class Queue:
def __init__(self):
self._head = self._tail = None
self._count: int = 0
def enqueue(self, item):
if self.is_empty():
self._head = self._tail = Node(item)
... | class Node:
def __init__(self, key, next=None):
self.key = key
self.next = next
class Queue:
def __init__(self):
self._head = self._tail = None
self._count: int = 0
def enqueue(self, item):
if self.is_empty():
self._head = self._tail = node(item)
... |
# Approach 1:
def Cloning_List(Given_List):
Result = Given_List[:]
return Result
Given_List = [4, 5, 7, 8, 9, 6, 10, 15]
print(Cloning_List(Given_List))
# Approach 2:
def Cloning_List(Given_List):
Result = []
Result.extend(Given_List)
return Result
Given_List = [4, 5, 7,... | def cloning__list(Given_List):
result = Given_List[:]
return Result
given__list = [4, 5, 7, 8, 9, 6, 10, 15]
print(cloning__list(Given_List))
def cloning__list(Given_List):
result = []
Result.extend(Given_List)
return Result
given__list = [4, 5, 7, 8, 9, 6, 10, 15]
print(cloning__list(Given_List))
... |
# Description: List Comprehensions
# Note
# 1. List comprehensions provide a concise way to create lists.
# 2. A list comprehension consists of brackets containing an expression followed by a for clause, then zero or more for
# or if clauses.
# Method 1: Create a list
squares = []
for x in range(10):
squares.a... | squares = []
for x in range(10):
squares.append(x ** 2)
print(squares)
squares = map(lambda x: x ** 2, range(10))
print(squares)
squares = [x ** 2 for x in range(10)]
print(squares) |
class StaticRoute:
def __init__(self, interface_name, network_uuid, network_name, gateway_host):
self.static_route = {
"interfaceName": interface_name,
"selectedNetworks": [{"type": "Network", "overridable": False, "id": network_uuid, "name": network_name}],
"gateway": {"... | class Staticroute:
def __init__(self, interface_name, network_uuid, network_name, gateway_host):
self.static_route = {'interfaceName': interface_name, 'selectedNetworks': [{'type': 'Network', 'overridable': False, 'id': network_uuid, 'name': network_name}], 'gateway': {'literal': {'type': 'Host', 'value': ... |
N = int(input())
arr = list(map(int, input().split()))
tmp = [2] * len(arr)
for i in range(2, len(tmp)):
if not (arr[i - 2] <= arr[i - 1] and arr[i - 1] <= arr[i]) and not (arr[i - 2] >= arr[i - 1] and arr[i - 1] >= arr[i]):
tmp[i] = tmp[i - 1] + 1
print(max(tmp))
| n = int(input())
arr = list(map(int, input().split()))
tmp = [2] * len(arr)
for i in range(2, len(tmp)):
if not (arr[i - 2] <= arr[i - 1] and arr[i - 1] <= arr[i]) and (not (arr[i - 2] >= arr[i - 1] and arr[i - 1] >= arr[i])):
tmp[i] = tmp[i - 1] + 1
print(max(tmp)) |
#!/usr/bin/env python3
# https://codeforces.com/problemset/problem/1223/A
t = int(input())
for _ in range(t):
n = int(input())
print(n%2 if n>3 else 4-n)
| t = int(input())
for _ in range(t):
n = int(input())
print(n % 2 if n > 3 else 4 - n) |
# encoding: utf-8
__doc__ = 'Data Importer'
__version__ = '3.1.1'
__author__ = 'Valder Gallo <valdergallo@gmail.com>'
| __doc__ = 'Data Importer'
__version__ = '3.1.1'
__author__ = 'Valder Gallo <valdergallo@gmail.com>' |
S = input()
T = input()
count = 0
if S[0] == T[0]:
count += 1
if S[1] == T[1]:
count += 1
if S[2] == T[2]:
count += 1
print(count) | s = input()
t = input()
count = 0
if S[0] == T[0]:
count += 1
if S[1] == T[1]:
count += 1
if S[2] == T[2]:
count += 1
print(count) |
class Solution:
# @return an integer
def maxArea(self, height):
left = 0
right = len(height) - 1
max = 0
while left < right:
h = height[left]
if height[right] < h:
h = height[right]
s = ( right - left ) * h
if ... | class Solution:
def max_area(self, height):
left = 0
right = len(height) - 1
max = 0
while left < right:
h = height[left]
if height[right] < h:
h = height[right]
s = (right - left) * h
if s > max:
max = ... |
_base_ = [
'./_base_/default_runtime.py'
]
# dataset settings
dataset_type = 'Filelist'
img_norm_cfg = dict(
mean=[125.09, 102.01, 93.19],
std=[71.35, 63.75, 61.46],
to_rgb=True)
train_pipeline = [
# dict(type='RandomCrop', size=32, padding=4),
dict(type='LoadImageFromFile'),
dict(type='Res... | _base_ = ['./_base_/default_runtime.py']
dataset_type = 'Filelist'
img_norm_cfg = dict(mean=[125.09, 102.01, 93.19], std=[71.35, 63.75, 61.46], to_rgb=True)
train_pipeline = [dict(type='LoadImageFromFile'), dict(type='Resize', size=(512, -1)), dict(type='RandomFlip', flip_prob=0.5, direction='horizontal'), dict(type='N... |
def parse_dict(args, attr, default_ok=True):
'''Parse an "nargs='*'" field from an ArgumentParser's parsed arguments
Each argument value should be of the form <k>=<v>, and a dict() of those mappings will be returned
At most one argument value can simply be of the form <v>, in which case it will be assign... | def parse_dict(args, attr, default_ok=True):
"""Parse an "nargs='*'" field from an ArgumentParser's parsed arguments
Each argument value should be of the form <k>=<v>, and a dict() of those mappings will be returned
At most one argument value can simply be of the form <v>, in which case it will be assigne... |
# When we delete the max element and all elements to its right,
# the new max element must be the max before the deleted element was
# added to the array.
for case in range(int(input())):
N = int(input())
max_x, peaks = 0, 0
for x in map(int, input().split()):
if x > max_x:
max_x = x
peaks += 1
... | for case in range(int(input())):
n = int(input())
(max_x, peaks) = (0, 0)
for x in map(int, input().split()):
if x > max_x:
max_x = x
peaks += 1
print('BOB' if peaks % 2 else 'ANDY') |
def set_and_shift_values(big_muddy_io, values):
for value in values:
set_and_shift_single(big_muddy_io, value)
def set_and_shift_single(big_muddy_io, value):
big_muddy_io.set_data_pins(value)
big_muddy_io.shifting.pulse() | def set_and_shift_values(big_muddy_io, values):
for value in values:
set_and_shift_single(big_muddy_io, value)
def set_and_shift_single(big_muddy_io, value):
big_muddy_io.set_data_pins(value)
big_muddy_io.shifting.pulse() |
sizes = [
5000,
2353,
43234,
3634,
23421,
324,
23432,
2342,
2341
]
for i, value in enumerate(sizes):
sizes[i] = value * 0.3
print(sizes)
| sizes = [5000, 2353, 43234, 3634, 23421, 324, 23432, 2342, 2341]
for (i, value) in enumerate(sizes):
sizes[i] = value * 0.3
print(sizes) |
def main():
start, end = map(int, input().split())
hours = (end - start + 24) % 24
if hours == 0:
hours = 24
print('O JOGO DUROU {} HORA(S)'.format(hours))
if __name__ == '__main__':
main()
| def main():
(start, end) = map(int, input().split())
hours = (end - start + 24) % 24
if hours == 0:
hours = 24
print('O JOGO DUROU {} HORA(S)'.format(hours))
if __name__ == '__main__':
main() |
#https://www.acmicpc.net/problem/4673
a = [0 for i in range(10000)]
def d(n):
total = n
n10000 = n//10000
if n10000 != 0:
n -= 10000*n10000
n1000 = n//1000
if n1000 != 0:
n -= 1000*n1000
n100 = n//100
if n100 != 0:
n -= 100*n100
n10 = n//10
if n10 != 0:
... | a = [0 for i in range(10000)]
def d(n):
total = n
n10000 = n // 10000
if n10000 != 0:
n -= 10000 * n10000
n1000 = n // 1000
if n1000 != 0:
n -= 1000 * n1000
n100 = n // 100
if n100 != 0:
n -= 100 * n100
n10 = n // 10
if n10 != 0:
n -= 10 * n10
n1 ... |
segundos = int(input(""))
horas = segundos/3600
minutos = (segundos%3600)/60
segundos = (segundos%60)
print("%d:%d:%d" %(horas,minutos,segundos))
| segundos = int(input(''))
horas = segundos / 3600
minutos = segundos % 3600 / 60
segundos = segundos % 60
print('%d:%d:%d' % (horas, minutos, segundos)) |
class Solution:
def sortedSquares(self, nums: List[int]) -> List[int]:
leftIndex = 0
rightIndex = len(nums) - 1
result = [0] * len(nums)
resultIndex = len(nums) - 1
while leftIndex <= rightIndex:
if nums[leftIndex] ** 2 > nums[rightIndex] ** 2:
res... | class Solution:
def sorted_squares(self, nums: List[int]) -> List[int]:
left_index = 0
right_index = len(nums) - 1
result = [0] * len(nums)
result_index = len(nums) - 1
while leftIndex <= rightIndex:
if nums[leftIndex] ** 2 > nums[rightIndex] ** 2:
... |
#!/usr/bin/python3
def new_in_list(my_list, idx, element):
if idx < 0 or (len(my_list) - 1) < idx:
return (my_list)
new_list = my_list.copy()
new_list[idx] = element
return (new_list)
| def new_in_list(my_list, idx, element):
if idx < 0 or len(my_list) - 1 < idx:
return my_list
new_list = my_list.copy()
new_list[idx] = element
return new_list |
class Exchange(object):
def __init__(self, name, asset_types, country_code):
'''
Parameters
----------
name : str
asset_types : list
country_code : str
'''
self._name = name
self._asset_types = asset_types
self._country_code = country_... | class Exchange(object):
def __init__(self, name, asset_types, country_code):
"""
Parameters
----------
name : str
asset_types : list
country_code : str
"""
self._name = name
self._asset_types = asset_types
self._country_code = country... |
def summa1(jarjend):
tulemus = jarjend[0]
if isinstance(jarjend[1], int):
tulemus += jarjend[1]
else:
tulemus += summa1(jarjend[1])
return tulemus
def summa2(jarjend):
tulemus = jarjend[0]
while isinstance(jarjend[1], list):
jarjend = jarjend[1]
tulemus += jarjen... | def summa1(jarjend):
tulemus = jarjend[0]
if isinstance(jarjend[1], int):
tulemus += jarjend[1]
else:
tulemus += summa1(jarjend[1])
return tulemus
def summa2(jarjend):
tulemus = jarjend[0]
while isinstance(jarjend[1], list):
jarjend = jarjend[1]
tulemus += jarjen... |
line_input1, line_input2 = sorted(input().split(), key=lambda x: -len(x))
result = 0
for ch in range(len(line_input1)):
if ch < len(line_input2):
result += (ord(line_input1[ch]) * ord(line_input2[ch]))
else:
result += ord(line_input1[ch])
print(result)
| (line_input1, line_input2) = sorted(input().split(), key=lambda x: -len(x))
result = 0
for ch in range(len(line_input1)):
if ch < len(line_input2):
result += ord(line_input1[ch]) * ord(line_input2[ch])
else:
result += ord(line_input1[ch])
print(result) |
pyliterals = {
'for': 'The Loop King',
'if': 'The Conditional Master',
'tuple': 'Too Stubborn to be changed',
'list': 'As free as water',
'dictionary': 'Emperor of Information Storage'
}
for literal in pyliterals:
print(literal+": "+pyliterals[literal]+"\n") | pyliterals = {'for': 'The Loop King', 'if': 'The Conditional Master', 'tuple': 'Too Stubborn to be changed', 'list': 'As free as water', 'dictionary': 'Emperor of Information Storage'}
for literal in pyliterals:
print(literal + ': ' + pyliterals[literal] + '\n') |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Silvio Peroni <essepuntato@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any purpose
# with or without fee is hereby granted, provided that the above copyright notice
# and this permission notice appear in all copies.
#
# THE SOFTWARE I... | def f(cur_digit):
c_list = list()
c_list.append('a')
c_list.append('b')
c_list.extend(c_list)
c_list.extend(c_list)
c_list.append('c')
for i in range(cur_digit):
if c_list[i] != 'a' and 'a' in c_list:
c_list.remove('a')
else:
c_list.insert(i, 'c')
... |
class Solution:
# @return a list of lists of integers
def generate(self, numRows):
if numRows < 1:
return []
result = [[1]]
for i in range(numRows - 1):
tri = [1]
result.append(tri)
preTri = result[len(result) - 2]
for j in ran... | class Solution:
def generate(self, numRows):
if numRows < 1:
return []
result = [[1]]
for i in range(numRows - 1):
tri = [1]
result.append(tri)
pre_tri = result[len(result) - 2]
for j in range(len(preTri) - 1):
tri.... |
# -*- coding: utf-8 -*-
class GildedRose(object):
MAX_QUALITY = 50
MIN_QUALITY = 0
def __init__(self, items):
self.items = items
def update_quality_brie(self, item):
item.sell_in -= 1
item.quality = min(self.MAX_QUALITY, item.quality +1 )
def update_quality_backsta... | class Gildedrose(object):
max_quality = 50
min_quality = 0
def __init__(self, items):
self.items = items
def update_quality_brie(self, item):
item.sell_in -= 1
item.quality = min(self.MAX_QUALITY, item.quality + 1)
def update_quality_backstage(self, item):
item.sel... |
class GenericRecordError(Exception):
pass
class ValidationError(GenericRecordError):
pass
class TableNotSupported(GenericRecordError):
pass
class DuplicateSignature(GenericRecordError):
pass
class GenericVBRError(Exception):
pass
class ConnectionFailedError(GenericVBRError):
pass
cla... | class Genericrecorderror(Exception):
pass
class Validationerror(GenericRecordError):
pass
class Tablenotsupported(GenericRecordError):
pass
class Duplicatesignature(GenericRecordError):
pass
class Genericvbrerror(Exception):
pass
class Connectionfailederror(GenericVBRError):
pass
class Rec... |
class DBSPEC(object):
TB_CHECKIN = "bk_checkin"
TB_USER = "bk_user"
TB_FRIENDSHIP = "bk_friendship"
| class Dbspec(object):
tb_checkin = 'bk_checkin'
tb_user = 'bk_user'
tb_friendship = 'bk_friendship' |
# Copyright (c) 2001-2013, Scott D. Peckham
#
#-----------------------------------------------------------------------
#
# unit_test()
#
#-----------------------------------------------------------------------
def unit_test( n_steps=10 ):
c = erosion_component()
c.CCA = False
c.DEBUG = False
c.SI... | def unit_test(n_steps=10):
c = erosion_component()
c.CCA = False
c.DEBUG = False
c.SILENT = True
cfg_directory = '/home/beach/faculty/peckhams/CMT_Output/Erode_Global/'
cfg_prefix = 'Test'
c.run_model(cfg_directory=cfg_directory, cfg_prefix=cfg_prefix, n_steps=n_steps) |
def all_clans():
return {
'Legendary Monks':'#PCCUPG9R',
'SN JAIN':'#2029V92QV',
'Brute Force':'#22PQL2L0R',
'PBfPN':'#22QL8YUC8',
'Wookies':'#298092P99',
'Mini Matter':'#2PJYCQYV9',
'Endor':'#2YLL8UVPY',
'Mos Eisley':'#2YUVPQQCU',
'Killer_Black_Wf':'#8VQYR2LR',
'Golden Clan':'#C2QPR82Q',
'Optimu... | def all_clans():
return {'Legendary Monks': '#PCCUPG9R', 'SN JAIN': '#2029V92QV', 'Brute Force': '#22PQL2L0R', 'PBfPN': '#22QL8YUC8', 'Wookies': '#298092P99', 'Mini Matter': '#2PJYCQYV9', 'Endor': '#2YLL8UVPY', 'Mos Eisley': '#2YUVPQQCU', 'Killer_Black_Wf': '#8VQYR2LR', 'Golden Clan': '#C2QPR82Q', 'Optimus Prime*':... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.