content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
s, min = list(map(int, input().split())), float('inf')
for i in range(len(s)):
if s[i] > 0 and s[i] < min:
min = s[i]
print(min)
| (s, min) = (list(map(int, input().split())), float('inf'))
for i in range(len(s)):
if s[i] > 0 and s[i] < min:
min = s[i]
print(min) |
class Bitset:
def __init__(self, maxn, bucketSize=32):
self.maxn = maxn
self.bucket_bits = bucketSize
self.bits = [0] * ( (maxn // bucketSize) + 1)
def get(self, i):
m = i // self.bucket_bits
bucket_index = i - m * self.bucket_bits
B = self.bits[ m ]
return (B >> bucket_index) & 1
de... | class Bitset:
def __init__(self, maxn, bucketSize=32):
self.maxn = maxn
self.bucket_bits = bucketSize
self.bits = [0] * (maxn // bucketSize + 1)
def get(self, i):
m = i // self.bucket_bits
bucket_index = i - m * self.bucket_bits
b = self.bits[m]
return B... |
def pg_quote(value):
if value is None:
return 'null'
return 'e\'{}\''.format(
str(value)
.replace('\\', '\\\\')
.replace('\'', '\\\'')
.replace('\n', '\\n')
)
def pg_ident_quote(ident):
if ident is None:
raise ValueError('ident is None')
return '"{... | def pg_quote(value):
if value is None:
return 'null'
return "e'{}'".format(str(value).replace('\\', '\\\\').replace("'", "\\'").replace('\n', '\\n'))
def pg_ident_quote(ident):
if ident is None:
raise value_error('ident is None')
return '"{}"'.format(str(ident).replace('"', '""'))
def ... |
def batch(reader, batch_size, drop_last=False):
"""
This operator creates a batched reader which combines the data from the
input reader to batched data.
Args:
reader(generator): the data reader to read from.
batch_size(int): size of each mini-batch.
drop_last(bool, optional): I... | def batch(reader, batch_size, drop_last=False):
"""
This operator creates a batched reader which combines the data from the
input reader to batched data.
Args:
reader(generator): the data reader to read from.
batch_size(int): size of each mini-batch.
drop_last(bool, optional): I... |
#While Loop Printer:
#In this exercise I had to write a short program that prints the numbers 1 to 10 using a while loop.
#I instantiated my initial variable.
printedNumber = 1
#Created a While Loop that increments my initial variable by adding 1 for every loop as long as my variable is under 11.
#I also added a cond... | printed_number = 1
while printedNumber < 11:
print(printedNumber)
if printedNumber == 10:
break
printed_number += 1 |
#!/bin/python3
x = int(input())
y = int(input())
z = int(input())
n = int(input())
lg_order = [[i, j, k] for i in range(0, x + 1)
for j in range(0, y + 1)
for k in range(0, z + 1) if i + j + k != n]
print(lg_order)
| x = int(input())
y = int(input())
z = int(input())
n = int(input())
lg_order = [[i, j, k] for i in range(0, x + 1) for j in range(0, y + 1) for k in range(0, z + 1) if i + j + k != n]
print(lg_order) |
"""Logger module for TcEx Framework"""
# flake8: noqa
# first-party
# from tcex.logger.cache_handler import CacheHandler
# from tcex.logger.logger import Logger
# from tcex.logger.rotating_file_handler_custom import RotatingFileHandlerCustom
# from tcex.logger.trace_logger import TraceLogger
| """Logger module for TcEx Framework""" |
def rectangle_area(base, height):
return base * height
if __name__ == '__main__':
print(rectangle_area(2, 2))
| def rectangle_area(base, height):
return base * height
if __name__ == '__main__':
print(rectangle_area(2, 2)) |
#
# PySNMP MIB module ALTIGA-SYNC-STATS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALTIGA-SYNC-STATS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 11:21:49 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (al_sync_mib_module,) = mibBuilder.importSymbols('ALTIGA-GLOBAL-REG', 'alSyncMibModule')
(al_sync_group, al_stats_sync) = mibBuilder.importSymbols('ALTIGA-MIB', 'alSyncGroup', 'alStatsSync')
(integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(name... |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( degree , n ) :
deg_sum = sum ( degree )
if ( 2 * ( n - 1 ) == deg_sum ) :
return True
else :
... | def f_gold(degree, n):
deg_sum = sum(degree)
if 2 * (n - 1) == deg_sum:
return True
else:
return False
if __name__ == '__main__':
param = [([2, 3, 1, 1, 1], 5), ([2, 2, 1, 1, 2], 5), ([2, 2, 1, 1, 1], 5), ([0, 0, 0, 3, 3, 4], 6), ([-10, 12, 2], 3), ([1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1... |
# -*- coding: utf-8 -*-
"""
pypeline.core
~~~~~~~~~~~~~
this module contains all the processing method, and advanced algorithms for OCT signal processing
calibrate:
disp_comp:
sp2struct:
@phase, @intensity, @complex
despeckle: (2D, 3D, etc.)
angiograph: (2D, 3D, etc.)
@speckle_var, @
"""
# register/loa... | """
pypeline.core
~~~~~~~~~~~~~
this module contains all the processing method, and advanced algorithms for OCT signal processing
calibrate:
disp_comp:
sp2struct:
@phase, @intensity, @complex
despeckle: (2D, 3D, etc.)
angiograph: (2D, 3D, etc.)
@speckle_var, @
"""
__all__ = ['pipeline', 'funcwrap'] |
class MyList(list):
"A subclass of list with additional functionality"
def prepend(self, obj):
"""prepend obj to list
Keyword arguments:
obj -- obj to prepend"""
self.insert(0, obj) | class Mylist(list):
"""A subclass of list with additional functionality"""
def prepend(self, obj):
"""prepend obj to list
Keyword arguments:
obj -- obj to prepend"""
self.insert(0, obj) |
"""
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
# Write your code here
n = int(input())
variables = set()
for _ in... | """
# Sample code to perform I/O:
name = input() # Reading input from STDIN
print('Hi, %s.' % name) # Writing output to STDOUT
# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
"""
n = int(input())
variables = set()
for _ in range(n):
variables... |
#!/usr/bin/env python3
#-------------------------------------------------------------------------------
class Solution:
def numJewelsInStones(self, J, S):
"""
:type J: str
:type S: str
:rtype: int
"""
return sum([i in J for i in S])
#---------------------------------... | class Solution:
def num_jewels_in_stones(self, J, S):
"""
:type J: str
:type S: str
:rtype: int
"""
return sum([i in J for i in S]) |
def binary_search(list, item):
low = 0
high = len(list)-1
while low<=high:
mid = (low+high)//2
guess = list[mid]
if guess == item:
return mid
if guess > item:
high = mid -1
else :
low = mid + 1
return None
... | def binary_search(list, item):
low = 0
high = len(list) - 1
while low <= high:
mid = (low + high) // 2
guess = list[mid]
if guess == item:
return mid
if guess > item:
high = mid - 1
else:
low = mid + 1
return None
list1 = [1, 5,... |
def updateBoard(self, board, click):
(row, col), directions = click, ((-1, 0), (1, 0),
(0, 1), (0, -1), (-1, 1), (-1, -1), (1, 1), (1, -1))
if 0 <= row < len(board) and 0 <= col < len(board[0]):
if board[row][col] == 'M':
board[row][col] = 'X'
eli... | def update_board(self, board, click):
((row, col), directions) = (click, ((-1, 0), (1, 0), (0, 1), (0, -1), (-1, 1), (-1, -1), (1, 1), (1, -1)))
if 0 <= row < len(board) and 0 <= col < len(board[0]):
if board[row][col] == 'M':
board[row][col] = 'X'
elif board[row][col] == 'E':
... |
class Definition:
"""Definition is a compile-time definition used for readability, e.g. "#define name value" in C or "`name value" in
Verilog"""
def __init__(self, name: str, value: int):
self.name = name.upper()
self.value = value
def print_pseudo(self) -> str:
return self.na... | class Definition:
"""Definition is a compile-time definition used for readability, e.g. "#define name value" in C or "`name value" in
Verilog"""
def __init__(self, name: str, value: int):
self.name = name.upper()
self.value = value
def print_pseudo(self) -> str:
return self.na... |
def test_healthcheck_endpoint(client):
res = client.get("/healthcheck")
assert res.status_code == 200
res = client.post("/healthcheck")
assert res.status_code == 405
res = client.delete("/healthcheck")
assert res.status_code == 405
res = client.put("/healthcheck")
assert res.status_code ... | def test_healthcheck_endpoint(client):
res = client.get('/healthcheck')
assert res.status_code == 200
res = client.post('/healthcheck')
assert res.status_code == 405
res = client.delete('/healthcheck')
assert res.status_code == 405
res = client.put('/healthcheck')
assert res.status_code ... |
'''
The rgb() method is incomplete. Complete the method so that passing in RGB decimal values will result in a hexadecimal representation being returned. The valid decimal values for RGB are 0 - 255. Any (r,g,b) argument values that fall out of that range should be rounded to the closest valid value.
The following are... | """
The rgb() method is incomplete. Complete the method so that passing in RGB decimal values will result in a hexadecimal representation being returned. The valid decimal values for RGB are 0 - 255. Any (r,g,b) argument values that fall out of that range should be rounded to the closest valid value.
The following are... |
num = 5
while num > 0 :
print(num)
num = num - 1
| num = 5
while num > 0:
print(num)
num = num - 1 |
class OSMNode:
def __init__(self, ident, lat, lon):
self.ident = ident
self.lat = float(lat)
self.lon = float(lon)
self.tags = {}
def __repr__(self):
return f"Node {self.ident}: {self.lat} {self.lon} {self.tags}"
def to_json(self):
ret = {'ident': self.iden... | class Osmnode:
def __init__(self, ident, lat, lon):
self.ident = ident
self.lat = float(lat)
self.lon = float(lon)
self.tags = {}
def __repr__(self):
return f'Node {self.ident}: {self.lat} {self.lon} {self.tags}'
def to_json(self):
ret = {'ident': self.iden... |
def add(l1, l2):
return [x + y for x, y in zip(l1, l2)]
def minus(l1, l2):
return [x - y for x, y in zip(l1, l2)]
def multiply(l1, l2):
return [x * y for x, y in zip(l1, l2)]
def divide(l1, l2):
return [x / y for x, y in zip(l1, l2)]
def dot_product(l1, l2):
products = multiply(l1, l2)
ret... | def add(l1, l2):
return [x + y for (x, y) in zip(l1, l2)]
def minus(l1, l2):
return [x - y for (x, y) in zip(l1, l2)]
def multiply(l1, l2):
return [x * y for (x, y) in zip(l1, l2)]
def divide(l1, l2):
return [x / y for (x, y) in zip(l1, l2)]
def dot_product(l1, l2):
products = multiply(l1, l2)
... |
# Inverted full pyramid of *
# * * * * * * * * *
# * * * * * * *
# * * * * *
# * * *
# *
rows = int(input("Enter number of rows: "))
for i in range(rows, 1, -1):
for space in range(0, rows - i):
print(" ", end="")
for j in range(i, 2 * i - 1):
print("* ", end=... | rows = int(input('Enter number of rows: '))
for i in range(rows, 1, -1):
for space in range(0, rows - i):
print(' ', end='')
for j in range(i, 2 * i - 1):
print('* ', end='')
for j in range(1, i - 1):
print('* ', end='')
print() |
def converte_entrada (texto_dos_numeros):
lista = []
texto = texto_dos_numeros
y = (texto.split(' '))
for x in y:
lista.append (int(x))
return lista
def processar_numeros (lista):
soma = 0
for x in lista:
soma += x
return (soma, len(lista))
def main (lista_dos_numeros):
soma = soma_e_con... | def converte_entrada(texto_dos_numeros):
lista = []
texto = texto_dos_numeros
y = texto.split(' ')
for x in y:
lista.append(int(x))
return lista
def processar_numeros(lista):
soma = 0
for x in lista:
soma += x
return (soma, len(lista))
def main(lista_dos_numeros):
s... |
class Solution:
def topKFrequent(self, words: List[str], k: int) -> List[str]:
count = collections.Counter(words)
heap = [(-freq, word) for word, freq in count.items()]
heapq.heapify(heap)
return [heapq.heappop(heap)[1] for _ in range(k)] | class Solution:
def top_k_frequent(self, words: List[str], k: int) -> List[str]:
count = collections.Counter(words)
heap = [(-freq, word) for (word, freq) in count.items()]
heapq.heapify(heap)
return [heapq.heappop(heap)[1] for _ in range(k)] |
# -*- coding: utf-8 -*-
class Settings(object):
def __init__(self):
self._slow_test_threshold = .075
self._enable_code_coverage = False
self._enable_file_watcher = False
self._format = 'documentation'
self._no_color = False
@property
def format(self):
retu... | class Settings(object):
def __init__(self):
self._slow_test_threshold = 0.075
self._enable_code_coverage = False
self._enable_file_watcher = False
self._format = 'documentation'
self._no_color = False
@property
def format(self):
return self._format
@for... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Used to run all batpod tests
"""
| """Used to run all batpod tests
""" |
# Space: O(n)
# Time: O(n)
# DFS approach(recursive)
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def sumOfLeftLeaves(self, root):
if root is... | class Solution:
def sum_of_left_leaves(self, root):
if root is None:
return 0
def helper(root, flag):
if root is None:
return 0
if root.left is None and root.right is None and flag:
return root.val
return helper(root.l... |
'''
We have two monkeys, a and b, and the parameters a_smile and b_smile indicate
if each is smiling. We are in trouble if they are both smiling or if neither
of them is smiling. Return True if we are in trouble.
'''
def monkey_trouble(a_smile, b_smile):
return a_smile and b_smile or not a_smile and not b_smile
| """
We have two monkeys, a and b, and the parameters a_smile and b_smile indicate
if each is smiling. We are in trouble if they are both smiling or if neither
of them is smiling. Return True if we are in trouble.
"""
def monkey_trouble(a_smile, b_smile):
return a_smile and b_smile or (not a_smile and (not b_smile)... |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 8 16:13:31 2020
reverse a string.
https://www.codewars.com/kata/5168bb5dfe9a00b126000018/train/python
@author: Ashish
"""
# method 1
def approach_1(str):
return(str[::-1])
# method 2
def approach_2(string):
newstring = ""
letter = len(string) ... | """
Created on Tue Sep 8 16:13:31 2020
reverse a string.
https://www.codewars.com/kata/5168bb5dfe9a00b126000018/train/python
@author: Ashish
"""
def approach_1(str):
return str[::-1]
def approach_2(string):
newstring = ''
letter = len(string) - 1
for x in string:
x = string[letter]
ne... |
__author__ = 'karunab'
def get_resolution():
return 2880, 1800
| __author__ = 'karunab'
def get_resolution():
return (2880, 1800) |
#
# PySNMP MIB module Unisphere-Data-PPP-Profile-CONF (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-PPP-Profile-CONF
# Produced by pysmi-0.3.4 at Mon Apr 29 21:25:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Pytho... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, single_value_constraint, value_range_constraint, value_size_constraint) ... |
class FamilyPointLocation(APIObject,IDisposable):
""" Data corresponding to the point locations in certain types of Family Symbols. """
def Dispose(self):
""" Dispose(self: FamilyPointLocation,A_0: bool) """
pass
def GetLocation(self):
"""
GetLocation(self: FamilyPointLocation) -> Transform
... | class Familypointlocation(APIObject, IDisposable):
""" Data corresponding to the point locations in certain types of Family Symbols. """
def dispose(self):
""" Dispose(self: FamilyPointLocation,A_0: bool) """
pass
def get_location(self):
"""
GetLocation(self: FamilyPointLocation)... |
"""
Take input from a number of input_select and then tell Roborock to clean those rooms
miiocli vacuum --ip 10.0.0.10 --token $(cat ~/homeassistant/secrets.yaml | grep -F roborock_token | awk ' {print $2 }') get_room_mapping
OR use sensor.roborock_current_room attribute "room_number" to get rooms
"""
rooms = {'Dini... | """
Take input from a number of input_select and then tell Roborock to clean those rooms
miiocli vacuum --ip 10.0.0.10 --token $(cat ~/homeassistant/secrets.yaml | grep -F roborock_token | awk ' {print $2 }') get_room_mapping
OR use sensor.roborock_current_room attribute "room_number" to get rooms
"""
rooms = {'Dinin... |
configs = {
"cifar10": {
"depth": 28,
"width": 10,
"epochs": 200,
"batch_size": 128,
"lr": 0.1,
"lr_decay": 0.2,
"schedule": "60|120|160",
"momentum": 0.9,
"dropout": 0.3,
"preprocess_method": "cifar10",
"seed": None,
},
"svhn": {
"depth": 16,
"width": 8... | configs = {'cifar10': {'depth': 28, 'width': 10, 'epochs': 200, 'batch_size': 128, 'lr': 0.1, 'lr_decay': 0.2, 'schedule': '60|120|160', 'momentum': 0.9, 'dropout': 0.3, 'preprocess_method': 'cifar10', 'seed': None}, 'svhn': {'depth': 16, 'width': 8, 'epochs': 160, 'batch_size': 128, 'lr': 0.01, 'lr_decay': 0.1, 'sched... |
def insertion(nums):
for i in range(len(nums)):
key=nums[i]
j=i-1
while j>=0 and key < nums[j]:
nums[j+1]=nums[j]
j-=1
... | def insertion(nums):
for i in range(len(nums)):
key = nums[i]
j = i - 1
while j >= 0 and key < nums[j]:
nums[j + 1] = nums[j]
j -= 1
nums[j + 1] = key
nums = [8, 6, 9, 3, 4, 1]
insertion(nums)
print('sorted arry')
for i in range(len(nums)):
print(nums[... |
x = 0
while x<6:
print(x)
x+=1 | x = 0
while x < 6:
print(x)
x += 1 |
# class Solution:
# def uniqueMorseRepresentations(self, words):
# """
# :type words: List[str]
# :rtype: int
# """
# MorseCode = [".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.",
# "---", ".--.", "--.-", "... | class Solution:
def unique_morse_representations(self, words):
"""
:type words: List[str]
:rtype: int
"""
morse_code = ['.-', '-...', '-.-.', '-..', '.', '..-.', '--.', '....', '..', '.---', '-.-', '.-..', '--', '-.', '---', '.--.', '--.-', '.-.', '...', '-', '..-', '...-', ... |
def png_to_xbm(name):
target_name = name + "_xbm"
png_name = name + ".png"
xbm_name = name + ".xbm"
native.genrule(
name = target_name,
srcs = [png_name],
outs = [xbm_name],
cmd = """
convert $(SRCS) $(OUTS)
""",
)
| def png_to_xbm(name):
target_name = name + '_xbm'
png_name = name + '.png'
xbm_name = name + '.xbm'
native.genrule(name=target_name, srcs=[png_name], outs=[xbm_name], cmd='\n convert $(SRCS) $(OUTS)\n ') |
@app.route("/url/<int:id>/type/<any(html, xlsx):format>")
@role_required("specialist")
def project_results(id, format):
#Get project from database by id
project = get_my_project(id)
#Builder report based on project and format
report_builder = get_report_builder(project, format)
if project.id == 48:... | @app.route('/url/<int:id>/type/<any(html, xlsx):format>')
@role_required('specialist')
def project_results(id, format):
project = get_my_project(id)
report_builder = get_report_builder(project, format)
if project.id == 48:
colors_iterator = itertools.cycle((color for color in bg_colors if color != '... |
def factorial(n):
if n == 0 or n == 1:
return 1
counter = 1
result = 1
while counter <= n:
result *= counter
counter += 1
return result
print (factorial(0))
print (factorial(1))
print (factorial(5))
print (10 * '-')
def fibonacci(n):
if n == 1:
return [1]
... | def factorial(n):
if n == 0 or n == 1:
return 1
counter = 1
result = 1
while counter <= n:
result *= counter
counter += 1
return result
print(factorial(0))
print(factorial(1))
print(factorial(5))
print(10 * '-')
def fibonacci(n):
if n == 1:
return [1]
result ... |
"""
------------Problem Statement---------
You are given a non-negative number in the form of list elements. For example, the number 123 would be provided as arr = [1, 2, 3]. Add one to the number and return the output in the form of a new list.
Example 1:
input = [1, 2, 3]
output = [1, 2, 4]
Example 2:
input = [9, ... | """
------------Problem Statement---------
You are given a non-negative number in the form of list elements. For example, the number 123 would be provided as arr = [1, 2, 3]. Add one to the number and return the output in the form of a new list.
Example 1:
input = [1, 2, 3]
output = [1, 2, 4]
Example 2:
input = [9, ... |
def solution(n):
cnt = 0
while n:
if n % 2 == 0:
n = n // 2
elif n % 2 == 1:
n -= 1
cnt += 1
return cnt
| def solution(n):
cnt = 0
while n:
if n % 2 == 0:
n = n // 2
elif n % 2 == 1:
n -= 1
cnt += 1
return cnt |
class RuntimeError:
@classmethod
def cast_error(cls, type_, cast_type):
cls._halt(f"Cannot cast {type_} to {cast_type}")
@classmethod
def _halt(cls, message):
print("Runtime error:", message)
exit(1)
| class Runtimeerror:
@classmethod
def cast_error(cls, type_, cast_type):
cls._halt(f'Cannot cast {type_} to {cast_type}')
@classmethod
def _halt(cls, message):
print('Runtime error:', message)
exit(1) |
class Rom:
def __init__(self, rom_data, header):
self.rom_data = rom_data
self.header = header
def patch_rom(self, bytes, address):
start_address = address - len(self.header)
end_address = start_address + len(bytes)
self.rom_data[start_address:end_address] = bytes
... | class Rom:
def __init__(self, rom_data, header):
self.rom_data = rom_data
self.header = header
def patch_rom(self, bytes, address):
start_address = address - len(self.header)
end_address = start_address + len(bytes)
self.rom_data[start_address:end_address] = bytes
... |
for n in range(1, 21):
print(n)
for n in range(1, 21):
print(f"{n}", end=', ')
| for n in range(1, 21):
print(n)
for n in range(1, 21):
print(f'{n}', end=', ') |
"""
Sum Root to Leaf Numbers
You are given the root of a binary tree containing digits from 0 to 9 only.
Each root-to-leaf path in the tree represents a number.
For example, the root-to-leaf path 1 -> 2 -> 3 represents the number 123.
Return the total sum of all root-to-leaf numbers. Test cases are generated so tha... | """
Sum Root to Leaf Numbers
You are given the root of a binary tree containing digits from 0 to 9 only.
Each root-to-leaf path in the tree represents a number.
For example, the root-to-leaf path 1 -> 2 -> 3 represents the number 123.
Return the total sum of all root-to-leaf numbers. Test cases are generated so tha... |
def DoTheThing(lines):
myDict = dict()
for line in lines:
numb = int(line.strip())
pair = 2020-numb
if pair in myDict:
return myDict[pair] * numb
else:
myDict[numb] = numb
return None
f = f = open('input.txt', 'r')
lines = f.readlines()
print(DoTheThi... | def do_the_thing(lines):
my_dict = dict()
for line in lines:
numb = int(line.strip())
pair = 2020 - numb
if pair in myDict:
return myDict[pair] * numb
else:
myDict[numb] = numb
return None
f = f = open('input.txt', 'r')
lines = f.readlines()
print(do_t... |
with open('input') as f:
grid = list(map(list, f.read().splitlines()))
w = len(grid[0])
h = len(grid)
moves = [
(0, 1),
(0, -1),
(1, 0),
(-1, 0),
(1, -1),
(-1, 1),
(1, 1),
(-1, -1),
]
def adjacent(grid, x, y):
for mx, my in moves:
X = x + mx
Y = y + my
i... | with open('input') as f:
grid = list(map(list, f.read().splitlines()))
w = len(grid[0])
h = len(grid)
moves = [(0, 1), (0, -1), (1, 0), (-1, 0), (1, -1), (-1, 1), (1, 1), (-1, -1)]
def adjacent(grid, x, y):
for (mx, my) in moves:
x = x + mx
y = y + my
if 0 <= X < w and 0 <= Y < h:
... |
class ElectronicDevice:
""" Represent each electronic device. """
def __init__(self, name, model, size: dict):
""" Constructor
Args:
name: The name of the device.
model: The model of the device.
size: The size of the device. Should be a dictionary i... | class Electronicdevice:
""" Represent each electronic device. """
def __init__(self, name, model, size: dict):
""" Constructor
Args:
name: The name of the device.
model: The model of the device.
size: The size of the device. Should be a dictionary in a forma... |
"""Below Python Programme demonstrate format
functions in a string"""
#Substring argument Only
sentence = 'Python programming is fun.'
result = sentence.index('is fun')
print("Substring 'is fun':", result)
result = sentence.index('Java')
print("Substring 'Java':", result)
sentence = 'Python programming is fun.'
# Su... | """Below Python Programme demonstrate format
functions in a string"""
sentence = 'Python programming is fun.'
result = sentence.index('is fun')
print("Substring 'is fun':", result)
result = sentence.index('Java')
print("Substring 'Java':", result)
sentence = 'Python programming is fun.'
print(sentence.index('ing', 10))... |
class HostStatus:
def __init__(self, host):
self.host = host
self.currentState = "UNKNOWN"
self.goalState = "UNKNOWN"
self.services = None
| class Hoststatus:
def __init__(self, host):
self.host = host
self.currentState = 'UNKNOWN'
self.goalState = 'UNKNOWN'
self.services = None |
def factorial(n: int) -> int:
if n<0: return None
if n==0 or n==1: return 1
else:
return n*factorial(n-1)
n = int(input())
if(factorial(n)):
print(factorial(n))
else:
print("VALUE ERROR") | def factorial(n: int) -> int:
if n < 0:
return None
if n == 0 or n == 1:
return 1
else:
return n * factorial(n - 1)
n = int(input())
if factorial(n):
print(factorial(n))
else:
print('VALUE ERROR') |
# (c) 2014, Will Thames <will@thames.id.au>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version... | class Moduledocfragment(object):
documentation = '\noptions:\n hostname:\n description: Deployed NSX manager hostname.\n required: true\n type: str\n username:\n description: The username to authenticate with the NSX manager.\n required: true\n type: str\n password... |
#!/usr/bin/env python3
if 'raw_input' in vars(__builtins__): input = raw_input #Fix for Python 2.x raw_input
print('["Hello, World!",{"id":"Press Me","v":false}]')
input()
print('[null,"You pressed the button!"]')
| if 'raw_input' in vars(__builtins__):
input = raw_input
print('["Hello, World!",{"id":"Press Me","v":false}]')
input()
print('[null,"You pressed the button!"]') |
class Solution:
def XXX(self, root: TreeNode) -> List[List[int]]:
if not root:
return []
stack = [root]
level = []
cur_level = []
res = []
while stack:
for cur_node in stack:
cur_level.append(cur_node.val)
if cur... | class Solution:
def xxx(self, root: TreeNode) -> List[List[int]]:
if not root:
return []
stack = [root]
level = []
cur_level = []
res = []
while stack:
for cur_node in stack:
cur_level.append(cur_node.val)
if cu... |
benchmark_name = "Benchmark factorial_recursive"
fact_num = 500
def run_benchmark():
def factorial_recursive(num):
if num == 1:
return 1
return num * factorial_recursive(num - 1)
def warmup():
i = 0
while i < 50:
factorial_recursive(fact_num)
... | benchmark_name = 'Benchmark factorial_recursive'
fact_num = 500
def run_benchmark():
def factorial_recursive(num):
if num == 1:
return 1
return num * factorial_recursive(num - 1)
def warmup():
i = 0
while i < 50:
factorial_recursive(fact_num)
... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 15 12:59:02 2017
MIT 6.00.1x course on edX.org: PSet1 P2
Task:
Assume s is a string of lower case characters.
Write a program that prints the number of times the string 'bob' occurs in s.
@author: Andrey Tymofeiuk
Important: This code is placed at GitHub to track my p... | """
Created on Thu Jun 15 12:59:02 2017
MIT 6.00.1x course on edX.org: PSet1 P2
Task:
Assume s is a string of lower case characters.
Write a program that prints the number of times the string 'bob' occurs in s.
@author: Andrey Tymofeiuk
Important: This code is placed at GitHub to track my progress in programming a... |
class OrbisimSemanticError(Exception):
@property
def error_info(self):
return self.args[0]
class OrbisimExecutionError(Exception):
@property
def error_info(self):
return self.args[0]
class OrbisimLexerError(Exception):
@property
def error_info(self):
return self.args[... | class Orbisimsemanticerror(Exception):
@property
def error_info(self):
return self.args[0]
class Orbisimexecutionerror(Exception):
@property
def error_info(self):
return self.args[0]
class Orbisimlexererror(Exception):
@property
def error_info(self):
return self.args... |
a = 1
while True:
found = False
for x in range(56 * 48):
if not ({2, 4, 8, 12, 15} <= (not ({3, 6, 8, 15}) or (a))):
found = True
break
if not found:
print(a)
break
a += 1
| a = 1
while True:
found = False
for x in range(56 * 48):
if not {2, 4, 8, 12, 15} <= (not {3, 6, 8, 15} or a):
found = True
break
if not found:
print(a)
break
a += 1 |
class BatchReadingError(Exception):
"""Error while doing batch process.
Attributes:
last_batch -- last batch where the error occured
msg -- explanation of the error
"""
def __init__(self, last_batch, msg):
self.last_batch = last_batch
self.msg = msg | class Batchreadingerror(Exception):
"""Error while doing batch process.
Attributes:
last_batch -- last batch where the error occured
msg -- explanation of the error
"""
def __init__(self, last_batch, msg):
self.last_batch = last_batch
self.msg = msg |
# Multiple Inheritence example
# class SapleBase1:
# def sampleBase1Function(self):
# print("Sample Base 1 Function")
# class SampleBase2:
# def sampleBase2Function(self):
# print("Sample Base 2 Function")
# class MultiInheritenceExample(SapleBase1, SampleBase2):
# pass
# multipleInherit... | class Level1:
pass
class Level2(Level1):
pass
class Multiplelevel(Level2):
pass
multi_level_inheritence_object = multiple_level()
print(MultipleLevel.__mro__)
print(MultipleLevel.__bases__) |
def _perl_print(*args, **kwargs):
"""Replacement for perl built-in print function when used in an expression,
where it must return True if successful"""
global OS_ERROR, TRACEBACK, AUTODIE
try:
file = sys.stdout
if 'file' in kwargs:
file = kwargs['file']
... | def _perl_print(*args, **kwargs):
"""Replacement for perl built-in print function when used in an expression,
where it must return True if successful"""
global OS_ERROR, TRACEBACK, AUTODIE
try:
file = sys.stdout
if 'file' in kwargs:
file = kwargs['file']
if file i... |
txt = "Hello, And Welcome To My World!"
x = txt.casefold()
print(x)
# Author: Bryan G
| txt = 'Hello, And Welcome To My World!'
x = txt.casefold()
print(x) |
#
# PySNMP MIB module HP-SwitchStack-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HP-SwitchStack-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:36:52 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, ... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint) ... |
class state_params():
def __init__(self):
self._pos = 0
self._vel = 0
self._acc = 0
self._time = 0
class state_organizer():
def __init__(self):
self.pos = state_params()
self.vel = state_params()
self.acc = state_params() | class State_Params:
def __init__(self):
self._pos = 0
self._vel = 0
self._acc = 0
self._time = 0
class State_Organizer:
def __init__(self):
self.pos = state_params()
self.vel = state_params()
self.acc = state_params() |
OFFLINE=0
INSPIRATIONAL=1
DESIGN=2
URL_INSPIRATIONAL="https://zenquotes.io/api/random"
URL_DESIGN="https://quotesondesign.com/wp-json/wp/v2/posts/?orderby=rand"
REFRESH_TIME_SEC=7200
| offline = 0
inspirational = 1
design = 2
url_inspirational = 'https://zenquotes.io/api/random'
url_design = 'https://quotesondesign.com/wp-json/wp/v2/posts/?orderby=rand'
refresh_time_sec = 7200 |
# Problem 1 - Summing all integers between user inputted number and 1
# Colin Morrow - Wed 27/02/2018
# Asking the user to input a number to define "n"
n = int(input("Enter a positive integer..."))
# total is a reference point for the addition of each integer
total = 0
if n <= 0:
print("Not really the positive ... | n = int(input('Enter a positive integer...'))
total = 0
if n <= 0:
print('Not really the positive integer I was looking for...')
elif n == 1:
print('You should try a bigger number')
else:
while n > 0:
total += n
n -= 1
print(total) |
# -*- coding: utf-8 -*-
# see LICENSE.rst
"""External codes, untested and unloved."""
##############################################################################
# END
| """External codes, untested and unloved.""" |
class Cloud(object):
def __init__(self, cloud, log):
self.log = log
self.cloud = cloud
def create_instance(self, name, inst_info, ssh_user, ssh_key, wait=False):
pass
def create_client(self, inst_info, prefix, num_instances, ssh_username,
... | class Cloud(object):
def __init__(self, cloud, log):
self.log = log
self.cloud = cloud
def create_instance(self, name, inst_info, ssh_user, ssh_key, wait=False):
pass
def create_client(self, inst_info, prefix, num_instances, ssh_username, ssh_key):
return 0
def create... |
class Source(object):
SOURCES = []
@classmethod
def can_use(cls, source):
return False
@classmethod
def register(cls, subcls):
cls.SOURCES.append(subcls)
return subcls
@classmethod
def find(cls, path):
for source in cls.SOURCES:
... | class Source(object):
sources = []
@classmethod
def can_use(cls, source):
return False
@classmethod
def register(cls, subcls):
cls.SOURCES.append(subcls)
return subcls
@classmethod
def find(cls, path):
for source in cls.SOURCES:
if source.can_us... |
__version__ = '0.1.0'
__author__ = 'AnyThund'
__email__ = 'seaventhunder@gmail.com'
__description__ = 'Portable for your scoop.'
| __version__ = '0.1.0'
__author__ = 'AnyThund'
__email__ = 'seaventhunder@gmail.com'
__description__ = 'Portable for your scoop.' |
class QueryException(Exception):
def __init__(self, message, httpcode):
self.message = message
self.httpcode = httpcode
| class Queryexception(Exception):
def __init__(self, message, httpcode):
self.message = message
self.httpcode = httpcode |
#!/usr/bin/env python3
'''
Implement a function that adds two numbers together and returns their sum in binary. The conversion can be done before, or after the addition.
The binary number returned should be a string.
'''
def add_binary(a,b):
sum = a + b
print(bin(sum)[2:])
add_binary(1,1)
#Alternative ... | """
Implement a function that adds two numbers together and returns their sum in binary. The conversion can be done before, or after the addition.
The binary number returned should be a string.
"""
def add_binary(a, b):
sum = a + b
print(bin(sum)[2:])
add_binary(1, 1)
def add_binary(a, b):
return bin(a + ... |
defined_environments = [
'test',
'production'
]
def has_environment(name):
return name in defined_environments
| defined_environments = ['test', 'production']
def has_environment(name):
return name in defined_environments |
'''
This software is derived from the OpenNMT project at
https://github.com/OpenNMT/OpenNMT.
Modified 2017, Idiap Research Institute, http://www.idiap.ch/ (Xiao PU)
'''
PAD = 0
UNK = 1
BOS = 2
EOS = 3
PAD_WORD = '<blank>'
UNK_WORD = '<unk>'
BOS_WORD = '<s>'
EOS_WORD = '</s>'
| """
This software is derived from the OpenNMT project at
https://github.com/OpenNMT/OpenNMT.
Modified 2017, Idiap Research Institute, http://www.idiap.ch/ (Xiao PU)
"""
pad = 0
unk = 1
bos = 2
eos = 3
pad_word = '<blank>'
unk_word = '<unk>'
bos_word = '<s>'
eos_word = '</s>' |
#class SVNRepo:
# @classmethod
# def isBadVersion(cls, id)
# # Run unit tests to check whether verison `id` is a bad version
# # return true if unit tests passed else false.
# You can use SVNRepo.isBadVersion(10) to check whether version 10 is a
# bad version.
class Solution:
"""
@param n:... | class Solution:
"""
@param n: An integers.
@return: An integer which is the first bad version.
"""
def find_first_bad_version(self, n):
l = 1
r = n
mid = 1
if n == 1:
return 1
while l <= r:
mid = (l + r) / 2
if SVNRepo.isBa... |
# Python program to demonstract perfect num :
n = int(input('Enter a number : '))
sum = 0
for i in range(1, n) :
if (n % i == 0) :
sum = sum + i
if (sum == n) :
print('Perfect num ...')
else :
print('Not perfect num...')
| n = int(input('Enter a number : '))
sum = 0
for i in range(1, n):
if n % i == 0:
sum = sum + i
if sum == n:
print('Perfect num ...')
else:
print('Not perfect num...') |
if __name__ == '__main__':
n = int(input())
a = list(map(int, input().split()))
start = 0
while start + 1 < n and a[start] < a[start + 1]:
start += 1
end = start
while end + 1 < n and a[end] > a[end + 1]:
end += 1
b = a[:start] + a[start:end + 1][::-1] + a[end + 1:]
a.so... | if __name__ == '__main__':
n = int(input())
a = list(map(int, input().split()))
start = 0
while start + 1 < n and a[start] < a[start + 1]:
start += 1
end = start
while end + 1 < n and a[end] > a[end + 1]:
end += 1
b = a[:start] + a[start:end + 1][::-1] + a[end + 1:]
a.sor... |
# gets key presses. Only helpful for key down strokes
class KeyboardListener:
def KeyDown (self, event):
pass
def get_keydown (oldkeystate, newkeystate, keys):
return any ([newkeystate[k] and not oldkeystate[k] for k in keys]) | class Keyboardlistener:
def key_down(self, event):
pass
def get_keydown(oldkeystate, newkeystate, keys):
return any([newkeystate[k] and (not oldkeystate[k]) for k in keys]) |
#!/Usr/bin/env python
"""
Arpasland has surrounded by attackers. A truck enters the city. The driver claims the load is food and medicine from Iranians. Ali is one of the soldiers in Arpasland. He doubts about the truck, maybe it's from the siege. He knows that a tag is valid if the sum of every two consecutive digit... | """
Arpasland has surrounded by attackers. A truck enters the city. The driver claims the load is food and medicine from Iranians. Ali is one of the soldiers in Arpasland. He doubts about the truck, maybe it's from the siege. He knows that a tag is valid if the sum of every two consecutive digits of it is even and its ... |
_base_ = (
"./FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_Pbr_01_02MasterChefCan_bop_test.py"
)
OUTPUT_DIR = "output/deepim/ycbvPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_ycbvPbr_SO/13_24Bowl"
DATASETS = dict(TRAIN=("ycbv_024_bowl_train_pbr"... | _base_ = './FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_Pbr_01_02MasterChefCan_bop_test.py'
output_dir = 'output/deepim/ycbvPbrSO/FlowNet512_1.5AugCosyAAEGray_AggressiveR_ClipGrad_fxfy1_Dtw01_LogDz_PM10_Flat_ycbvPbr_SO/13_24Bowl'
datasets = dict(TRAIN=('ycbv_024_bowl_train_pbr',)) |
class TestResult:
def __init__(self) -> None:
self.__details = {}
self.run_count = 0
self.error_count = 0
def test_started(self):
self.run_count += 1
def test_failed(self, test_name: str, failure_reason: str):
self.__details.update({test_name: failure_reason... | class Testresult:
def __init__(self) -> None:
self.__details = {}
self.run_count = 0
self.error_count = 0
def test_started(self):
self.run_count += 1
def test_failed(self, test_name: str, failure_reason: str):
self.__details.update({test_name: failure_reason})
... |
# -*- coding: utf-8 -*-
__author__ = 'Syd Logan'
__email__ = 'slogan621@gmail.com'
__version__ = '0.1.0'
| __author__ = 'Syd Logan'
__email__ = 'slogan621@gmail.com'
__version__ = '0.1.0' |
# Advent of Code 2021 Solution
# By: Bailey Carothers
# For: Day 3, Part 1
# Objective:
# Inputs are structured as binary numbers. ex "01011"
# See requirements.txt for full explanation
if __name__ == "__main__":
# Declare variables as needed by requirements
onesFound = []
zerosFound = []
gamma = ""
... | if __name__ == '__main__':
ones_found = []
zeros_found = []
gamma = ''
epsilon = ''
total_lines = 0
with open('input.txt', 'r') as infile:
first_line = infile.readline()
list_length = len(firstLine) - 1
binary_size = listLength
for x in range(0, listLength, 1):
... |
cnt = 0
def new_employee(name, job, cnt):
cnt += 1
return ({'name': name, 'job':job}, cnt)
def get_name(employee):
print(employee['name'])
def change_job(employee, job):
employee['job'] = job
return employee
# dodajemy komputer
def new_computer(name, type):
return {'name': ... | cnt = 0
def new_employee(name, job, cnt):
cnt += 1
return ({'name': name, 'job': job}, cnt)
def get_name(employee):
print(employee['name'])
def change_job(employee, job):
employee['job'] = job
return employee
def new_computer(name, type):
return {'name': name, 'type': type}
def give_compute... |
def tau(values):
"""
Calculates the Tau value for a list of expression values
:param dist: list of values
:return: tau value
"""
n = len(values) # number of values
mxi = max(values) # max value
if mxi > 0:
t = sum([1 - (x/mxi) for x in values])... | def tau(values):
"""
Calculates the Tau value for a list of expression values
:param dist: list of values
:return: tau value
"""
n = len(values)
mxi = max(values)
if mxi > 0:
t = sum([1 - x / mxi for x in values]) / (n - 1)
return t
else:
return None |
class Tag(object):
def __init__(self, store, location, tagid, name):
self.store = store
self.location = location
self.tagid = tagid
self.name = name
def __str__(self):
return str(self.__unicode__())
def __unicode__(self):
return self.name
class TagDoc(obje... | class Tag(object):
def __init__(self, store, location, tagid, name):
self.store = store
self.location = location
self.tagid = tagid
self.name = name
def __str__(self):
return str(self.__unicode__())
def __unicode__(self):
return self.name
class Tagdoc(obje... |
def task8():
f = open('input.txt', 'r')
line = f.readline()
f.close()
op = ['[', '(']
cl = [']', ')']
res = 0
stack = []
for c in line.strip():
if c in op:
stack.insert(0, c)
else:
if len(stack) == 0:
res = -1
break
... | def task8():
f = open('input.txt', 'r')
line = f.readline()
f.close()
op = ['[', '(']
cl = [']', ')']
res = 0
stack = []
for c in line.strip():
if c in op:
stack.insert(0, c)
else:
if len(stack) == 0:
res = -1
break
... |
base = 2 ** 8
def get_hash(text):
ans = 0
for c in text:
ans *= base
ans += ord(c)
return ans | base = 2 ** 8
def get_hash(text):
ans = 0
for c in text:
ans *= base
ans += ord(c)
return ans |
s = "Global Variable"
def func():
s=50
print(locals()) #will print all local variables in a dictionary
print(globals()['s']) # will print 'Global Variable'
return s
print(func())
def hello(name='Jack'):
return "hello "+ name
print("hello",hello())
## Assign a label to a function
mynewgreet = hello
print("... | s = 'Global Variable'
def func():
s = 50
print(locals())
print(globals()['s'])
return s
print(func())
def hello(name='Jack'):
return 'hello ' + name
print('hello', hello())
mynewgreet = hello
print('mynewgreet', mynewgreet())
def greetings(name='Sean'):
print('The greetings() function has bee... |
#
# PySNMP MIB module TPLINK-SYSMONITOR-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TPLINK-SYSMONITOR-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:26:01 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (def... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, constraints_intersection, constraints_union, value_size_constraint) ... |
# Pharmacy Drawer 4 (1052132) | Kerning City Pharmacy (103000002)
middleman = 2852
firstAid = 4033036
if sm.hasQuest(middleman):
if sm.canHold(firstAid) and not sm.hasItem(firstAid):
sm.giveItem(firstAid)
sm.sendSayOkay("(You searched the drawer and took out an emergency kit.)")
elif sm.hasIte... | middleman = 2852
first_aid = 4033036
if sm.hasQuest(middleman):
if sm.canHold(firstAid) and (not sm.hasItem(firstAid)):
sm.giveItem(firstAid)
sm.sendSayOkay('(You searched the drawer and took out an emergency kit.)')
elif sm.hasItem(firstAid):
sm.sendSayOkay('(The drawer is now empty.)')... |
"""
@author : anirudh-jwala
@date : 12/01/2019
"""
# Finding no of vowels in given string
# a e i o u A E I O U are the vowels in English language
print("String to calculate vowels:")
string = input()
vowels=['a','e','i','o','u', 'A', 'E', 'I', 'O', 'U']
counter = 0
for i in range(len(string)):
if string[i] ... | """
@author : anirudh-jwala
@date : 12/01/2019
"""
print('String to calculate vowels:')
string = input()
vowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']
counter = 0
for i in range(len(string)):
if string[i] in vowels:
counter += 1
print('No of vowels are ', counter)
print()
print('Most frequ... |
def get_config(model):
if model == 'ptb_fs_rum_test':
return ptb_fs_rum_test_config()
if model == 'ptb_fs_rum':
return ptb_fs_rum_config()
elif model == 'ptb_fs_goru':
return ptb_fs_goru_config()
elif model == 'ptb_fs_eunn':
return ptb_fs_eunn_config()
elif model == '... | def get_config(model):
if model == 'ptb_fs_rum_test':
return ptb_fs_rum_test_config()
if model == 'ptb_fs_rum':
return ptb_fs_rum_config()
elif model == 'ptb_fs_goru':
return ptb_fs_goru_config()
elif model == 'ptb_fs_eunn':
return ptb_fs_eunn_config()
elif model == '... |
#
# PySNMP MIB module CISCO-UNITY-EXPRESS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNITY-EXPRESS-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:18:02 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_size_constraint, value_range_constraint, single_value_constraint) ... |
input = open('input', 'r').read().strip()
input = [[list(map(frozenset, x.split())) for x in r.split('|')] for r in input.splitlines()]
# Preparing smart key table based on fixed digits
segments = list(map(frozenset, 'abcefg cf acdeg acdfg bcdf abdfg abdefg acf abcdefg abcdfg'.split()))
count = {}
for n, seg in enum... | input = open('input', 'r').read().strip()
input = [[list(map(frozenset, x.split())) for x in r.split('|')] for r in input.splitlines()]
segments = list(map(frozenset, 'abcefg cf acdeg acdfg bcdf abdfg abdefg acf abcdefg abcdfg'.split()))
count = {}
for (n, seg) in enumerate(segments):
count.setdefault(len(seg), [])... |
items_by_category = {
"logistics": {
"storage": ["wooden-chest", "iron-chest", "steel-chest", "storage-tank"],
"belt-transport": ["transport-belt", "fast-transport-belt", "express-transport-belt",
"underground-belt", "fast-underground-belt", "express-underground-belt", "splitter",
... | items_by_category = {'logistics': {'storage': ['wooden-chest', 'iron-chest', 'steel-chest', 'storage-tank'], 'belt-transport': ['transport-belt', 'fast-transport-belt', 'express-transport-belt', 'underground-belt', 'fast-underground-belt', 'express-underground-belt', 'splitter', 'fast-splitter', 'express-splitter'], 'i... |
while True:
try:
hh, mm = str(input()).split()
hh = int(hh) // 30
mm = int(mm) // 6
print('{:02}:{:02}'.format(hh, mm))
except EOFError:
break
| while True:
try:
(hh, mm) = str(input()).split()
hh = int(hh) // 30
mm = int(mm) // 6
print('{:02}:{:02}'.format(hh, mm))
except EOFError:
break |
for i in range(2, 21):
for j in range(2, i):
if i % j == 0:
print(f"{i} = {j} times {i // j}")
break
else:
print(i, " is a prime number!")
print("Done")
| for i in range(2, 21):
for j in range(2, i):
if i % j == 0:
print(f'{i} = {j} times {i // j}')
break
else:
print(i, ' is a prime number!')
print('Done') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.