content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def usersagein_Sec():
users_age = int(input("Enter user age in years"))
agein_sec = users_age *12 *365 * 24
print(f"Age in sec is {agein_sec}")
print("Welcome to function project 1 ")
usersagein_Sec()
# Never use same name in anywhere inside a function program. else going to get error.
friends ... | def usersagein__sec():
users_age = int(input('Enter user age in years'))
agein_sec = users_age * 12 * 365 * 24
print(f'Age in sec is {agein_sec}')
print('Welcome to function project 1 ')
usersagein__sec()
friends = []
def friend():
friends.append('Ram')
friend()
friend()
friend()
print(friends) |
def test_non_standard_default_desired_privilege_level(iosxe_conn):
# purpose of this test is to ensure that when a user sets a non-standard default desired priv
# level, that there is nothing in genericdriver/networkdriver that will prevent that from
# actually being set as the default desired priv level
... | def test_non_standard_default_desired_privilege_level(iosxe_conn):
iosxe_conn.close()
iosxe_conn.default_desired_privilege_level = 'configuration'
iosxe_conn.open()
current_prompt = iosxe_conn.get_prompt()
assert current_prompt == 'csr1000v(config)#'
iosxe_conn.close() |
class Trader(object):
"""An entity buying and/or selling on the market."""
def __init__(self, name, funds=0, units=0):
self.name = name
self.funds = funds
self.units = units
def __repr__(self):
return "[Trader: name={}, funds={}, units={}]".format(self.name, self.funds, sel... | class Trader(object):
"""An entity buying and/or selling on the market."""
def __init__(self, name, funds=0, units=0):
self.name = name
self.funds = funds
self.units = units
def __repr__(self):
return '[Trader: name={}, funds={}, units={}]'.format(self.name, self.funds, sel... |
fruits = {
"orange" :"a sweet,orange citrus fruit",
"apple" :"good for making cider",
"lemon" :"a sour,yellow citrus fruit",
"grape" :"a small, sweet fruit growing in bunches",
"lime" :"a sour,yellow citrus fruit",
}
def simple_operation():
print("T... | fruits = {'orange': 'a sweet,orange citrus fruit', 'apple': 'good for making cider', 'lemon': 'a sour,yellow citrus fruit', 'grape': 'a small, sweet fruit growing in bunches', 'lime': 'a sour,yellow citrus fruit'}
def simple_operation():
print('To find the details in Fruits dictionary')
print(fruits)
print... |
# Mac address of authentication server
AUTH_SERVER_MAC = "b8:ae:ed:7a:05:3b"
# IP address of authentication server
AUTH_SERVER_IP = "192.168.1.42"
# Switch port authentication server is facing
AUTH_SERVER_PORT = 3
#CTL_REST_IP = "192.168.1.39"
CTL_REST_IP = "10.0.1.8"
CTL_REST_PORT = "8080"
CTL_MAC = "b8:27:eb:b0:1d... | auth_server_mac = 'b8:ae:ed:7a:05:3b'
auth_server_ip = '192.168.1.42'
auth_server_port = 3
ctl_rest_ip = '10.0.1.8'
ctl_rest_port = '8080'
ctl_mac = 'b8:27:eb:b0:1d:6b'
gateway_mac = '24:09:95:79:31:7e'
gateway_port = 1
whitelist = [(AUTH_SERVER_MAC, CTL_MAC), (CTL_MAC, AUTH_SERVER_MAC), (GATEWAY_MAC, '00:1d:a2:80:60:6... |
running = True
# Global Options
SIZES = {'small': [7.58, 0], 'medium': [9.69, 1], 'large': [12.09, 2], 'jumbo': [17.99, 3], 'party': [20.29, 4]} # [Price, ID]
TOPPINGS = {'pepperoni': [0, False], 'bacon': [0, True], 'sausage': [0, False], 'mushroom': [1, False], 'black olive': [1, False], 'green pepper': [1, False]} #... | running = True
sizes = {'small': [7.58, 0], 'medium': [9.69, 1], 'large': [12.09, 2], 'jumbo': [17.99, 3], 'party': [20.29, 4]}
toppings = {'pepperoni': [0, False], 'bacon': [0, True], 'sausage': [0, False], 'mushroom': [1, False], 'black olive': [1, False], 'green pepper': [1, False]}
topping_prices = [[1.6, 2.05, 2.3... |
#
# PySNMP MIB module EdgeSwitch-QOS-AUTOVOIP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EdgeSwitch-QOS-AUTOVOIP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:10:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python versio... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, constraints_union, value_size_constraint, single_value_constraint) ... |
def reverse(my_list):
if type(my_list) != list:
return f"{my_list} is not a list"
elif len(my_list) ==0:
return 'list should not be empty'
reversed_list = my_list[::-1]
return reversed_list
if __name__ == "__main__":
riddle_index = 0
| def reverse(my_list):
if type(my_list) != list:
return f'{my_list} is not a list'
elif len(my_list) == 0:
return 'list should not be empty'
reversed_list = my_list[::-1]
return reversed_list
if __name__ == '__main__':
riddle_index = 0 |
class _dafny:
def print(value):
if type(value) == bool:
print("true" if value else "false", end="")
elif type(value) == property:
print(value.fget(), end="")
else:
print(value, end="")
| class _Dafny:
def print(value):
if type(value) == bool:
print('true' if value else 'false', end='')
elif type(value) == property:
print(value.fget(), end='')
else:
print(value, end='') |
limit=int(input("enter the limit"))
no=int(input("enter the no"))
for i in range(1,limit+1,1):
multi=no*i
print(no,"*",i,"=",multi) | limit = int(input('enter the limit'))
no = int(input('enter the no'))
for i in range(1, limit + 1, 1):
multi = no * i
print(no, '*', i, '=', multi) |
"""Exceptions raised by `e2e.pom` at runtime."""
class PomError(Exception):
"""Base exception from which all `e2e.pom` errors inherit."""
class ElementNotUniqueErrror(PomError):
"""Raised when multiple DOM matches are found for a "unique" model."""
class ElementNotFoundErrror(PomError):
"""Raised when... | """Exceptions raised by `e2e.pom` at runtime."""
class Pomerror(Exception):
"""Base exception from which all `e2e.pom` errors inherit."""
class Elementnotuniqueerrror(PomError):
"""Raised when multiple DOM matches are found for a "unique" model."""
class Elementnotfounderrror(PomError):
"""Raised when no... |
class Arithmetic:
def __init__(self, command):
self.text = command
def operation(self):
return self.text.strip()
class MemoryAccess:
def __init__(self, command):
self.op, self.seg, self.idx = tuple(command.split())
def operation(self):
return self.op
def segmen... | class Arithmetic:
def __init__(self, command):
self.text = command
def operation(self):
return self.text.strip()
class Memoryaccess:
def __init__(self, command):
(self.op, self.seg, self.idx) = tuple(command.split())
def operation(self):
return self.op
def segme... |
N = int(input())
pokemons = []
while (N != 0):
Name = input()
pokemons.append(Name)
N-= 1
print('Falta(m) {} pomekon(s).'.format(151 - len(set(pokemons))))
| n = int(input())
pokemons = []
while N != 0:
name = input()
pokemons.append(Name)
n -= 1
print('Falta(m) {} pomekon(s).'.format(151 - len(set(pokemons)))) |
def count_salutes(hallway):
count=hallway.count("<")
total=0
for i in hallway:
count-=i=="<"
if i==">":
total+=count*2
return total
| def count_salutes(hallway):
count = hallway.count('<')
total = 0
for i in hallway:
count -= i == '<'
if i == '>':
total += count * 2
return total |
# Python - 3.6.0
Test.assert_equals(catch_sign_change([1, 3, 4, 5]), 0)
Test.assert_equals(catch_sign_change([1, -3, -4, 0, 5]), 2)
Test.assert_equals(catch_sign_change([]), 0)
Test.assert_equals(catch_sign_change([-47, 84, -30, -11, -5, 74, 77]), 3)
| Test.assert_equals(catch_sign_change([1, 3, 4, 5]), 0)
Test.assert_equals(catch_sign_change([1, -3, -4, 0, 5]), 2)
Test.assert_equals(catch_sign_change([]), 0)
Test.assert_equals(catch_sign_change([-47, 84, -30, -11, -5, 74, 77]), 3) |
{
'targets': [
{
'target_name': 'murmurhash3',
'sources': ['src/MurmurHash3.cpp', 'src/node_murmurhash3.cc'],
'cflags': ['-fexceptions'],
'cflags_cc': ['-fexceptions'],
'cflags!': ['-fno-exceptions'],
'cflags_cc!': ['-fno-exception'],
"include_dirs" : [
"<!(node... | {'targets': [{'target_name': 'murmurhash3', 'sources': ['src/MurmurHash3.cpp', 'src/node_murmurhash3.cc'], 'cflags': ['-fexceptions'], 'cflags_cc': ['-fexceptions'], 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exception'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'conditions': [['OS=="win"', {'msvs_... |
def create_desktop_file_KDE():
path="/usr/share/applications/klusta_process_manager.desktop"
text=["[Desktop Entry]",
"Version=0.1",
"Name=klusta_process_manager",
"Comment=GUI",
"Exec=klusta_process_manager",
"Icon=eyes",
"Terminal=False",
"Type=Application",
"Categories=Applications;... | def create_desktop_file_kde():
path = '/usr/share/applications/klusta_process_manager.desktop'
text = ['[Desktop Entry]', 'Version=0.1', 'Name=klusta_process_manager', 'Comment=GUI', 'Exec=klusta_process_manager', 'Icon=eyes', 'Terminal=False', 'Type=Application', 'Categories=Applications;']
with open(path,... |
class BinarySearchTreeNode:
def __init__(self,data):
self.data=data
self.left=None
self.right=None
def add_child(self,data):
if data == self.data:
return
if data <self.data:
#add on the left side of the subtree
if self.left:
... | class Binarysearchtreenode:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def add_child(self, data):
if data == self.data:
return
if data < self.data:
if self.left:
self.left.add_child(data)
... |
# -*- coding: utf-8 -*-
# Scrapy settings for cosme project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/en/latest/topics/settings.html
#
BOT_NAME = 'cosme'
SPIDER_MODULES = ['cosme.spiders']
NEWSPIDER_... | bot_name = 'cosme'
spider_modules = ['cosme.spiders']
newspider_module = 'cosme.spiders'
download_delay = 1.5
cookies_enables = False
item_pipelines = {'cosme.pipelines.ProductDetailPipeline': 1}
(host, db, user, pwd) = ('127.0.0.1', 'cosme', 'root', '123456') |
# Time: O(n)
# Space: O(h), h is height of binary tree
# 129
# Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.
#
# An example is the root-to-leaf path 1->2->3 which represents the number 123.
#
# Find the total sum of all root-to-leaf numbers.
#
# For example,
#
# ... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def sum_numbers(self, root: TreeNode) -> int:
ans = 0
stack = [(root, 0)]
while stack:
(node, v) = stack.pop()
if node:
... |
"""
Georgia Institute of Technology - CS1301
HW04 - Strings, Indexing and Lists
"""
#########################################
"""
Function Name: findMax()
Parameters: a caption list of numbers (list), start index (int), stop index (int)
Returns: highest number (int)
"""
def findMax(theNumbersMason, theStart, theEnd):... | """
Georgia Institute of Technology - CS1301
HW04 - Strings, Indexing and Lists
"""
'\nFunction Name: findMax()\nParameters: a caption list of numbers (list), start index (int), stop index (int)\nReturns: highest number (int)\n'
def find_max(theNumbersMason, theStart, theEnd):
highscore = theNumbersMason[theStart]... |
"""
Midi pitch values:
A0 has value 21
C8 has value 108
"""
NAME_TO_VAL = {
"C": 0,
"D": 2,
"E": 4,
"F": 5,
"G": 7,
"A": 9,
"B": 11,
}
def name_to_val(name):
name = name.upper()
note = name[0]
mod = None
octave = None
offset = 12
if name[1] in ("#", "B"):
... | """
Midi pitch values:
A0 has value 21
C8 has value 108
"""
name_to_val = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
def name_to_val(name):
name = name.upper()
note = name[0]
mod = None
octave = None
offset = 12
if name[1] in ('#', 'B'):
mod = name[1]
octa... |
task = int(input())
points = int(input())
course = input()
if task == 1:
if course == 'Basics':
points = points * 0.08 - (0.2 * (points * 0.08))
elif course == 'Fundamentals':
points = points * 0.11
elif course == 'Advanced':
points = points * 0.14 + (0.2 * (points * 0.14))
elif ta... | task = int(input())
points = int(input())
course = input()
if task == 1:
if course == 'Basics':
points = points * 0.08 - 0.2 * (points * 0.08)
elif course == 'Fundamentals':
points = points * 0.11
elif course == 'Advanced':
points = points * 0.14 + 0.2 * (points * 0.14)
elif task == ... |
# Given a number N, print the odd digits in the number(space seperated) or print -1 if there is no odd digit in the given number.
number = int(input(''))
array = list(str(number))
flag = 0
for digit in range(0, len(array)-1):
if(int(array[digit]) % 2 == 0):
print(' ', end='')
else:
print(array... | number = int(input(''))
array = list(str(number))
flag = 0
for digit in range(0, len(array) - 1):
if int(array[digit]) % 2 == 0:
print(' ', end='')
else:
print(array[digit], end='')
flag = flag + 1
if int(array[len(array) - 1]) % 2 == 0:
print('', end='')
else:
print(int(array[le... |
"""A function to reverse a string.
By Ted Silbernagel
"""
def reverse_string(input_word: str) -> str:
return_word = ''
for _ in input_word:
return_word += input_word[-1:]
input_word = input_word[:-1]
return return_word
if __name__ == '__main__':
user_string = input('Please enter a word/string to r... | """A function to reverse a string.
By Ted Silbernagel
"""
def reverse_string(input_word: str) -> str:
return_word = ''
for _ in input_word:
return_word += input_word[-1:]
input_word = input_word[:-1]
return return_word
if __name__ == '__main__':
user_string = input('Please enter a word/... |
"""
File: forestfire.py
----------------
This program highlights fires in an image by identifying
pixels who red intensity is more than INTENSITY_THRESHOLD times
the average of the red, green, and blue values at a pixel.
Those "sufficiently red" pixels are then highlighted in the
image and the rest of the image is turn... | """
File: forestfire.py
----------------
This program highlights fires in an image by identifying
pixels who red intensity is more than INTENSITY_THRESHOLD times
the average of the red, green, and blue values at a pixel.
Those "sufficiently red" pixels are then highlighted in the
image and the rest of the image is turn... |
t5_generation_config = {
"do_sample": True,
"num_beams": 2,
"repetition_penalty": 5.0,
"length_penalty": 1.0,
"num_return_sequences": 1,
}
GPT2_generation_config = {
"do_sample": True,
"num_beams": 2,
"repetition_penalty": 5.0,
"length_penalty": 1.0,
} | t5_generation_config = {'do_sample': True, 'num_beams': 2, 'repetition_penalty': 5.0, 'length_penalty': 1.0, 'num_return_sequences': 1}
gpt2_generation_config = {'do_sample': True, 'num_beams': 2, 'repetition_penalty': 5.0, 'length_penalty': 1.0} |
# -*- coding: utf-8 -*-
"""
Created on Tue May 7 12:11:09 2019
@author: DiPu
"""
A1=int(input())
A2=int(input())
A3=int(input())
E1=int(input())
E2=int(input())
weighted_score=((A1+A2+A3)*0.1)+((E1+E2)*0.35 )
print("weightrd score is",weighted_score)
| """
Created on Tue May 7 12:11:09 2019
@author: DiPu
"""
a1 = int(input())
a2 = int(input())
a3 = int(input())
e1 = int(input())
e2 = int(input())
weighted_score = (A1 + A2 + A3) * 0.1 + (E1 + E2) * 0.35
print('weightrd score is', weighted_score) |
# Pyomniar
# Copyright 2011 Chris Kelly
# See LICENSE for details.
class OmniarError(Exception):
"""Omniar exception"""
def __init__(self, reason, response=None):
self.reason = unicode(reason)
self.response = response
def __str__(self):
return self.reason | class Omniarerror(Exception):
"""Omniar exception"""
def __init__(self, reason, response=None):
self.reason = unicode(reason)
self.response = response
def __str__(self):
return self.reason |
while True:
number = int(input('Enter a number: '))
while number != 1:
if number % 2 == 0:
number //= 2
else:
number = number * 3 + 1
print(number)
print()
| while True:
number = int(input('Enter a number: '))
while number != 1:
if number % 2 == 0:
number //= 2
else:
number = number * 3 + 1
print(number)
print() |
# ------------------------------
# 276. Paint Fence
#
# Description:
# There is a fence with n posts, each post can be painted with one of the k colors.
# You have to paint all the posts such that no more than two adjacent fence posts have the same color.
#
# Return the total number of ways you can paint the fence.
#... | class Solution(object):
def num_ways(self, n, k):
"""
:type n: int
:type k: int
:rtype: int
"""
if n == 0:
return 0
if n == 1:
return k
(same, diff) = (k, k * (k - 1))
for i in range(3, n + 1):
(same, diff) ... |
#Conditional if
x = 22
y = 100
if y < x:
print("This is True, y is not greater than x!")
elif y == x:
print("This is True, y is greater than x!")
else:
print("Anything else!")
print("Completed")
| x = 22
y = 100
if y < x:
print('This is True, y is not greater than x!')
elif y == x:
print('This is True, y is greater than x!')
else:
print('Anything else!')
print('Completed') |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
models
----------------------------------
Models store record state during parsing and serialisation to other formats.
"""
class InventoryItem(object):
""" Inventory Item Model """
def __init__(self, id=None, price=None, description=None, cost=None, price_t... | """
models
----------------------------------
Models store record state during parsing and serialisation to other formats.
"""
class Inventoryitem(object):
""" Inventory Item Model """
def __init__(self, id=None, price=None, description=None, cost=None, price_type=None, quantity_on_hand=None, modifiers=[]):
... |
""""""
_TEST_TEMPLATE = """#!/bin/bash
# Unset TEST_SRCDIR since we're trying to test the non-test behavior
unset TEST_SRCDIR
# --- begin runfiles.bash initialization v2 ---
# Copy-pasted from the Bazel Bash runfiles library v2.
set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash
source "${RUNFILES_DIR:-... | """"""
_test_template = '#!/bin/bash\n# Unset TEST_SRCDIR since we\'re trying to test the non-test behavior\nunset TEST_SRCDIR\n\n# --- begin runfiles.bash initialization v2 ---\n# Copy-pasted from the Bazel Bash runfiles library v2.\nset -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash\nsource "${RUNFILES... |
#!/usr/bin/env python
# encoding: utf-8
"""
constants.py
Useful constants; the ones embedded in classes can be thought of as Enums.
Created by Niall Richard Murphy on 2011-05-25.
"""
_DNS_SEPARATOR = "." # What do we use to join hostname to domain name
_FIRST_ONE_ONLY = 0 # If we only want the first match back from... | """
constants.py
Useful constants; the ones embedded in classes can be thought of as Enums.
Created by Niall Richard Murphy on 2011-05-25.
"""
_dns_separator = '.'
_first_one_only = 0
class Types(object):
"""Types of router configuration."""
unknown = 0
default_cisco = 1
default_juniper = 2
class Re... |
"""
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary tree and sum = 22,
5
/ \
4 8
/ / \
11 13 4
/ \ \
... | """
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary tree and sum = 22,
5
/ 4 8
/ / 11 13 4
/ \\ ... |
#import sys
#sys.stdin = open('rectangles.in', 'r')
#sys.stdout = open('rectangles.out', 'w')
n, m, k = map(int, input().split())
a = [[100000, 0, 100000, 0] for i in range(k)]
field = []
for i in range(n):
field.append(list(map(int, input().split())))
field.reverse()
for i in range(n):
for j in range(m):
... | (n, m, k) = map(int, input().split())
a = [[100000, 0, 100000, 0] for i in range(k)]
field = []
for i in range(n):
field.append(list(map(int, input().split())))
field.reverse()
for i in range(n):
for j in range(m):
if field[i][j] > 0:
v = field[i][j] - 1
a[v][0] = min(a[v][0], j)... |
def _cc_injected_toolchain_header_library_impl(ctx):
hdrs = ctx.files.hdrs
transitive_cc_infos = [dep[CcInfo] for dep in ctx.attr.deps]
compilation_ctx = cc_common.create_compilation_context(headers = depset(hdrs))
info = cc_common.merge_cc_infos(
cc_infos = transitive_cc_infos + [CcInfo(compila... | def _cc_injected_toolchain_header_library_impl(ctx):
hdrs = ctx.files.hdrs
transitive_cc_infos = [dep[CcInfo] for dep in ctx.attr.deps]
compilation_ctx = cc_common.create_compilation_context(headers=depset(hdrs))
info = cc_common.merge_cc_infos(cc_infos=transitive_cc_infos + [cc_info(compilation_context... |
"""
Given two integers n and k, return all possible combinations of k numbers out
of 1 ... n.
For example,
If n = 4 and k = 2, a solution is:
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,3],
[1,4],
]
"""
class Solution(object):
def combine(self, n, k):
"""
:type n: int
:type k: int
... | """
Given two integers n and k, return all possible combinations of k numbers out
of 1 ... n.
For example,
If n = 4 and k = 2, a solution is:
[
[2,4],
[3,4],
[2,3],
[1,2],
[1,3],
[1,4],
]
"""
class Solution(object):
def combine(self, n, k):
"""
:type n: int
:type k: int
... |
#
# PySNMP MIB module TRAPEZE-NETWORKS-REGISTRATION-DEVICES-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/TRAPEZE-NETWORKS-REGISTRATION-DEVICES-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:27:22 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user da... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, value_size_constraint, value_range_constraint, constraints_union, single_value_constraint) ... |
class Solution:
def searchMatrix(self, matrix, target):
i = 0
m = len(matrix)
while i < m and matrix[i][0] <= target:
i = i + 1
i = i - 1
return target in matrix[i]
if __name__ == '__main__':
matrix = [[1]]
target = 1
ans = Solution().searchMatrix(mat... | class Solution:
def search_matrix(self, matrix, target):
i = 0
m = len(matrix)
while i < m and matrix[i][0] <= target:
i = i + 1
i = i - 1
return target in matrix[i]
if __name__ == '__main__':
matrix = [[1]]
target = 1
ans = solution().searchMatrix(ma... |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
def _download_binary(ctx):
ctx.download(
url = [
ctx.attr.uri,
],
output = ctx.attr.binary_name,
executable = True,
)
ctx.file(
"BUILD.bazel",
content = 'exports_files(glob(["*"]))'... | load('@bazel_tools//tools/build_defs/repo:http.bzl', 'http_file')
def _download_binary(ctx):
ctx.download(url=[ctx.attr.uri], output=ctx.attr.binary_name, executable=True)
ctx.file('BUILD.bazel', content='exports_files(glob(["*"]))')
download_binary = repository_rule(_download_binary, doc='Downloads a single b... |
# Basic type checking: no types necessary
x = 3
x + 'a'
def return_type() -> float:
return 'a'
return_type(9)
def argument_type(x: float):
return
argument_type()
| x = 3
x + 'a'
def return_type() -> float:
return 'a'
return_type(9)
def argument_type(x: float):
return
argument_type() |
def sudoku(board, rows, columns):
return helper(board, 0, 0, columns, rows)
def helper(board, r, c, rows, columns):
def inbound(r, c):
return (0 <= r < rows) and (0 <= c < columns)
# Out of bounds:
# We filled all blank cells and, thus, a valid solution
if not inbound(r, c):
return True
nr, nc = ... | def sudoku(board, rows, columns):
return helper(board, 0, 0, columns, rows)
def helper(board, r, c, rows, columns):
def inbound(r, c):
return 0 <= r < rows and 0 <= c < columns
if not inbound(r, c):
return True
(nr, nc) = next_pos(r, c, rows, columns)
if board[r][c] != 0:
r... |
"""
Configuration file
"""
URL = 'localhost'
PORT = 1883
KEEPALIVE = 60
UDP_URL = 'localhost'
UDP_PORT = 1885
| """
Configuration file
"""
url = 'localhost'
port = 1883
keepalive = 60
udp_url = 'localhost'
udp_port = 1885 |
'''Print multiplication table of given number'''
n=int(input("Enter the no:"))
print("Multiplication table is:")
for i in range(1,11):
print(i*n) | """Print multiplication table of given number"""
n = int(input('Enter the no:'))
print('Multiplication table is:')
for i in range(1, 11):
print(i * n) |
# CONVERT DB_DATA TO STRING FOR SELF-MESSAGE
def format_to_writeable_db_data(db_data: list) -> str:
writeable_data = ""
for user in db_data:
listed_mangoes = ""
for manga in user['mangoes']:
listed_mangoes += f"{manga}>(u*u)>"
writeable_data = f"{writeable_data}{user['name']... | def format_to_writeable_db_data(db_data: list) -> str:
writeable_data = ''
for user in db_data:
listed_mangoes = ''
for manga in user['mangoes']:
listed_mangoes += f'{manga}>(u*u)>'
writeable_data = f"{writeable_data}{user['name']}:{listed_mangoes}\n"
return writeable_dat... |
class SuperList(list):
def __len__(self):
return 1000
super_list1 = SuperList()
print((len(super_list1)))
super_list1.append(5)
print(super_list1[0])
print(issubclass(SuperList, list)) # true
print(issubclass(list, object)) | class Superlist(list):
def __len__(self):
return 1000
super_list1 = super_list()
print(len(super_list1))
super_list1.append(5)
print(super_list1[0])
print(issubclass(SuperList, list))
print(issubclass(list, object)) |
def reverse(SA):
reverse = [0] * len(SA)
for i in range(len(SA)):
reverse[SA[i] - 1] = i + 1
return reverse
def prefix_doubling(text, n):
'''Computes suffix array using Karp-Miller-Rosenberg algorithm'''
text += '$'
mapping = {v: i + 1 for i, v in enumerate(sorted(set(text[1:])))}
R, k = [mapping[v] ... | def reverse(SA):
reverse = [0] * len(SA)
for i in range(len(SA)):
reverse[SA[i] - 1] = i + 1
return reverse
def prefix_doubling(text, n):
"""Computes suffix array using Karp-Miller-Rosenberg algorithm"""
text += '$'
mapping = {v: i + 1 for (i, v) in enumerate(sorted(set(text[1:])))}
... |
N, M = map(int, input().split())
case = [i for i in range(1, N+1)]
disk = []
for _ in range(M):
disk.append(int(input()))
now = 0
for d in disk:
if d == now:
continue
i = case.index(d)
tmp = case[i]
case[i] = now
now = tmp
for c in case:
print(c)
| (n, m) = map(int, input().split())
case = [i for i in range(1, N + 1)]
disk = []
for _ in range(M):
disk.append(int(input()))
now = 0
for d in disk:
if d == now:
continue
i = case.index(d)
tmp = case[i]
case[i] = now
now = tmp
for c in case:
print(c) |
def maximum():
A = input('Enter the 1st number:')
B = input('Enter the 2nd number:')
if A > B:
print("%d The highest num than %d"%(A,B))
else:
print('The highest num is:' ,B)
print("Optised max",max(A,B))
def minimum():
A1 = input('Enter the 1st number:')
B1 = input('Enter ... | def maximum():
a = input('Enter the 1st number:')
b = input('Enter the 2nd number:')
if A > B:
print('%d The highest num than %d' % (A, B))
else:
print('The highest num is:', B)
print('Optised max', max(A, B))
def minimum():
a1 = input('Enter the 1st number:')
b1 = input('En... |
"""
# 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())
shelters = [0] * (n + 1)
f... | """
# 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())
shelters = [0] * (n + 1)
for _ in range(n - 1):
... |
__author__ = 'varx'
class BaseRenderer(object):
"""
Base renderer that all renders should inherit from
"""
def can_render(self, path):
raise NotImplementedError()
def render(self, path):
raise NotImplementedError() | __author__ = 'varx'
class Baserenderer(object):
"""
Base renderer that all renders should inherit from
"""
def can_render(self, path):
raise not_implemented_error()
def render(self, path):
raise not_implemented_error() |
stores = []
command = input()
while command != 'END':
tokens = command.split('->')
store_name = tokens[1]
if tokens[0] == 'Add':
items = tokens[2].split(',')
if len([x for x in stores if x[0] == store_name]) > 0:
idx = stores.index([x for x in stores if x[0] == store_name... | stores = []
command = input()
while command != 'END':
tokens = command.split('->')
store_name = tokens[1]
if tokens[0] == 'Add':
items = tokens[2].split(',')
if len([x for x in stores if x[0] == store_name]) > 0:
idx = stores.index([x for x in stores if x[0] == store_name][0])
... |
# This is a great place to put your bot's version number.
__version__ = "0.1.0"
# You'll want to change this.
GUILD_ID = 845688627265536010
| __version__ = '0.1.0'
guild_id = 845688627265536010 |
#dictionary and for statements with values method
linguagens = {
'lea': 'python',
'sara': 'c',
'eddie': 'java',
'phil': 'python',
}
for linguagem in linguagens.values(): #values method shows us the values of a dictionary
print(linguagem.title()) | linguagens = {'lea': 'python', 'sara': 'c', 'eddie': 'java', 'phil': 'python'}
for linguagem in linguagens.values():
print(linguagem.title()) |
class EmitterTypeError(Exception):
pass
class EmitterValidationError(Exception):
pass
| class Emittertypeerror(Exception):
pass
class Emittervalidationerror(Exception):
pass |
class BSTNode():
def __init__(self, Key, Value=None):
self.key = Key
self.Value = Value
self.left = None
self.right = None
self.parent = None
@staticmethod
def remove_none(lst):
return [x for x in lst if x is not None]
def check_BSTNode(self):
if... | class Bstnode:
def __init__(self, Key, Value=None):
self.key = Key
self.Value = Value
self.left = None
self.right = None
self.parent = None
@staticmethod
def remove_none(lst):
return [x for x in lst if x is not None]
def check_bst_node(self):
if... |
LSM9DS1_MAG_ADDRESS = 0x1C #Would be 0x1E if SDO_M is HIGH
LSM9DS1_ACC_ADDRESS = 0x6A
LSM9DS1_GYR_ADDRESS = 0x6A #Would be 0x6B if SDO_AG is HIGH
#/////////////////////////////////////////
#// LSM9DS1 Accel/Gyro (XL/G) Registers //
#/////////////////////////////////////////
LSM9DS1_ACT_THS = 0x04
LSM9DS1_ACT... | lsm9_ds1_mag_address = 28
lsm9_ds1_acc_address = 106
lsm9_ds1_gyr_address = 106
lsm9_ds1_act_ths = 4
lsm9_ds1_act_dur = 5
lsm9_ds1_int_gen_cfg_xl = 6
lsm9_ds1_int_gen_ths_x_xl = 7
lsm9_ds1_int_gen_ths_y_xl = 8
lsm9_ds1_int_gen_ths_z_xl = 9
lsm9_ds1_int_gen_dur_xl = 10
lsm9_ds1_reference_g = 11
lsm9_ds1_int1_ctrl = 12
l... |
def handle(event, context):
"""handle a request to the function
Args:
event (dict): request params
context (dict): function call metadata
"""
return {
"message": "Hello From Python3 runtime on Serverless Framework and Scaleway Functions"
}
| def handle(event, context):
"""handle a request to the function
Args:
event (dict): request params
context (dict): function call metadata
"""
return {'message': 'Hello From Python3 runtime on Serverless Framework and Scaleway Functions'} |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 10 15:19:36 2020
@author: krishan
"""
class Book:
def __init__(self, pages):
self.pages = pages
def __add__(self, other):
total = self.pages + other.pages
b = Book(total)
return b
... | """
Created on Mon Aug 10 15:19:36 2020
@author: krishan
"""
class Book:
def __init__(self, pages):
self.pages = pages
def __add__(self, other):
total = self.pages + other.pages
b = book(total)
return b
def __mul__(self, other):
total = self.pages * other.pages
... |
n = int(input('digite um numero: '))
n2 = int(input('digite um numero: '))
def soma ():
s = n + n2
print(soma)
| n = int(input('digite um numero: '))
n2 = int(input('digite um numero: '))
def soma():
s = n + n2
print(soma) |
# noinspection PyUnusedLocal
# skus = unicode string
def checkout(skus):
sd = dict()
for sku in skus:
if sku in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
if sku in sd:
sd[sku] += 1
else:
sd[sku] = 1
else:
return -1
na = sd.get('A', 0... | def checkout(skus):
sd = dict()
for sku in skus:
if sku in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':
if sku in sd:
sd[sku] += 1
else:
sd[sku] = 1
else:
return -1
na = sd.get('A', 0)
p = int(na / 5) * 200
na %= 5
p += int(na ... |
def test_upgrade_atac_alignment_enrichment_quality_metric_1_2(
upgrader, atac_alignment_enrichment_quality_metric_1
):
value = upgrader.upgrade(
'atac_alignment_enrichment_quality_metric',
atac_alignment_enrichment_quality_metric_1,
current_version='1',
target_version='2',
)
... | def test_upgrade_atac_alignment_enrichment_quality_metric_1_2(upgrader, atac_alignment_enrichment_quality_metric_1):
value = upgrader.upgrade('atac_alignment_enrichment_quality_metric', atac_alignment_enrichment_quality_metric_1, current_version='1', target_version='2')
assert value['schema_version'] == '2'
... |
PREVIEW_CHOICES = [
('slider', 'Slider'),
('pre-order', 'Pre-order'),
('new', 'New'),
('offer', 'Offer'),
('hidden', 'Hidden'),
]
CATEGORY_CHOICES = [
('accesory', 'Accesory'),
('bottom', 'Bottoms'),
('hoodie', 'Hoodies'),
('outerwear', 'Outerwears'),
('sneaker', 'Sneakers'),
... | preview_choices = [('slider', 'Slider'), ('pre-order', 'Pre-order'), ('new', 'New'), ('offer', 'Offer'), ('hidden', 'Hidden')]
category_choices = [('accesory', 'Accesory'), ('bottom', 'Bottoms'), ('hoodie', 'Hoodies'), ('outerwear', 'Outerwears'), ('sneaker', 'Sneakers'), ('t-shirt', 'T-Shirts')] |
# SPDX-License-Identifier: BSD-2-Clause
"""osdk-manager about details.
Manage osdk and opm binary installation, and help to scaffold, release, and
version Operator SDK-based Kubernetes operators.
This file contains some basic variables used for setup.
"""
__title__ = "osdk-manager"
__name__ = __title__
__summary__ ... | """osdk-manager about details.
Manage osdk and opm binary installation, and help to scaffold, release, and
version Operator SDK-based Kubernetes operators.
This file contains some basic variables used for setup.
"""
__title__ = 'osdk-manager'
__name__ = __title__
__summary__ = 'A script for managing Operator SDK-base... |
print("Let's practice everything")
print('You\'d need to know \'bout escapes with \\ that do:')
print('\n newlines and \t tabs.')
poem="""
\tThe lovely world
with logic so firmly planted
cannnot discern \n the needs of love
nor comprehend passion from intuition
and requires an explanation
\n\t\twhere there is none.
""... | print("Let's practice everything")
print("You'd need to know 'bout escapes with \\ that do:")
print('\n newlines and \t tabs.')
poem = '\n\tThe lovely world\nwith logic so firmly planted\ncannnot discern \n the needs of love\nnor comprehend passion from intuition\nand requires an explanation\n\n\t\twhere there is none.... |
class Estereo:
def __init__(self, marca) -> None:
self.marca = marca
self.estado = 'apagado'
| class Estereo:
def __init__(self, marca) -> None:
self.marca = marca
self.estado = 'apagado' |
list = [2, 4, 6, 8]
sum = 0
for num in list:
sum = sum + num
print("The sum is:", sum)
| list = [2, 4, 6, 8]
sum = 0
for num in list:
sum = sum + num
print('The sum is:', sum) |
class RDBMSHost:
def __init__(self, host: str, port: int, db_name: str, db_schema: str, db_user: str, db_password: str):
self.host: str = host
self.port: int = port
self.db_name: str = db_name
self.db_schema: str = db_schema
self.db_user: str = db_user
self.db_passwor... | class Rdbmshost:
def __init__(self, host: str, port: int, db_name: str, db_schema: str, db_user: str, db_password: str):
self.host: str = host
self.port: int = port
self.db_name: str = db_name
self.db_schema: str = db_schema
self.db_user: str = db_user
self.db_passwo... |
grid = [input() for _ in range(323)]
width = len(grid[0])
height = len(grid)
trees = 0
i, j = 0, 0
while (i := i + 1) < height:
j = (j + 3) % width
if grid[i][j] == '#':
trees += 1
print(trees)
| grid = [input() for _ in range(323)]
width = len(grid[0])
height = len(grid)
trees = 0
(i, j) = (0, 0)
while (i := (i + 1)) < height:
j = (j + 3) % width
if grid[i][j] == '#':
trees += 1
print(trees) |
def test_root_redirect(client):
r_root = client.get("/")
assert r_root.status_code == 302
assert r_root.headers["Location"].endswith("/overview/")
| def test_root_redirect(client):
r_root = client.get('/')
assert r_root.status_code == 302
assert r_root.headers['Location'].endswith('/overview/') |
class Solution:
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
size = len(prices)
bought = False
profit = 0
price = 0
for i in range(0, size - 1):
if not bought:
if prices[i] < prices[i + 1]... | class Solution:
def max_profit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
size = len(prices)
bought = False
profit = 0
price = 0
for i in range(0, size - 1):
if not bought:
if prices[i] < prices[i + ... |
'''8. Write a Python program to split a given list into two parts where the length of the first part of the list is given.
Original list:
[1, 1, 2, 3, 4, 4, 5, 1]
Length of the first part of the list: 3
Splited the said list into two parts:
([1, 1, 2], [3, 4, 4, 5, 1]) '''
def split_two_parts(n_list, L):
return n... | """8. Write a Python program to split a given list into two parts where the length of the first part of the list is given.
Original list:
[1, 1, 2, 3, 4, 4, 5, 1]
Length of the first part of the list: 3
Splited the said list into two parts:
([1, 1, 2], [3, 4, 4, 5, 1]) """
def split_two_parts(n_list, L):
return (... |
n = int(input())
for i in range(n):
row, base, number = map(int, input().split())
remains = list()
while number > 0:
remain = number % base
number = number // base
remains.append(remain)
sumOfRemains = 0
for i in range(len(remains)):
remains[i] = remains[i] ** 2
... | n = int(input())
for i in range(n):
(row, base, number) = map(int, input().split())
remains = list()
while number > 0:
remain = number % base
number = number // base
remains.append(remain)
sum_of_remains = 0
for i in range(len(remains)):
remains[i] = remains[i] ** 2
... |
with open("110000.dat","r") as fi:
with open("110000num.dat","w") as fo:
i=1
for l in fi.readlines():
if i%100 == 0:
fo.write(l.strip()+" #"+str(i)+"\n")
else:
fo.write(l)
i = i+1
| with open('110000.dat', 'r') as fi:
with open('110000num.dat', 'w') as fo:
i = 1
for l in fi.readlines():
if i % 100 == 0:
fo.write(l.strip() + ' #' + str(i) + '\n')
else:
fo.write(l)
i = i + 1 |
class Person(object):
# This definition hasn't changed from part 1!
def __init__(self, fn, ln, em, age, occ):
self.firstName = fn
self.lastName = ln
self.email = em
self.age = age
self.occupation = occ
class Occupation(object):
def __init__(self, name, location):
self.name = name
sel... | class Person(object):
def __init__(self, fn, ln, em, age, occ):
self.firstName = fn
self.lastName = ln
self.email = em
self.age = age
self.occupation = occ
class Occupation(object):
def __init__(self, name, location):
self.name = name
self.location = lo... |
#!/usr/bin/python3
class Face(object):
def __init__(self, bbox, aligned_face_img, confidence, key_points):
self._bbox = bbox # [x_min, y_min, x_max, y_max]
self._aligned_face_img = aligned_face_img
self._confidence = confidence
self._key_points = key_points
@property
... | class Face(object):
def __init__(self, bbox, aligned_face_img, confidence, key_points):
self._bbox = bbox
self._aligned_face_img = aligned_face_img
self._confidence = confidence
self._key_points = key_points
@property
def bbox(self):
return self._bbox
@property... |
start_house, end_house = map(int, input().split())
left_tree, right_tree = map(int, input().split())
number_of_apples, number_of_oranges = map(int, input().split())
apple_distances = map(int, input().split())
orange_distances = map(int, input().split())
apple_count = 0
orange_count = 0
for distance in apple_distances:... | (start_house, end_house) = map(int, input().split())
(left_tree, right_tree) = map(int, input().split())
(number_of_apples, number_of_oranges) = map(int, input().split())
apple_distances = map(int, input().split())
orange_distances = map(int, input().split())
apple_count = 0
orange_count = 0
for distance in apple_dista... |
def countInversions(nums):
#Our recursive base case, if our list is of size 1 we know there's no inversion and that it's already sorted
if len(nums) == 1: return nums, 0
#We run our function recursively on it's left and right halves
left, leftInversions = countInversions(nums[:len(nums) // 2])
righ... | def count_inversions(nums):
if len(nums) == 1:
return (nums, 0)
(left, left_inversions) = count_inversions(nums[:len(nums) // 2])
(right, right_inversions) = count_inversions(nums[len(nums) // 2:])
inversions = leftInversions + rightInversions
sorted_nums = []
i = j = 0
while i < len... |
# find highest grade of an assignment
def highest_SRQs_grade(queryset):
queryset = queryset.order_by('-assignment', 'SRQs_grade')
dict_q = {}
for each in queryset:
dict_q[each.assignment] = each
result = []
for assignment in dict_q.values():
result.append(assignment)
return resu... | def highest_sr_qs_grade(queryset):
queryset = queryset.order_by('-assignment', 'SRQs_grade')
dict_q = {}
for each in queryset:
dict_q[each.assignment] = each
result = []
for assignment in dict_q.values():
result.append(assignment)
return result |
def f(x):
if x:
return
if x:
return
elif y:
return
if x:
return
else:
return
if x:
return
elif y:
return
else:
return
if x:
return
elif y:
return
elif z:
return
else:
return
... | def f(x):
if x:
return
if x:
return
elif y:
return
if x:
return
else:
return
if x:
return
elif y:
return
else:
return
if x:
return
elif y:
return
elif z:
return
else:
return
... |
# Iterative approach using stack
# 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 mergeTrees(self, root1: TreeNode, root2: TreeNode) -> TreeNode:
... | class Solution:
def merge_trees(self, root1: TreeNode, root2: TreeNode) -> TreeNode:
if root1 == None:
return root2
stack = []
stack.append([root1, root2])
while stack:
node = stack.pop()
if node[0] == None or node[1] == None:
cont... |
class point:
"K-D POINT CLASS"
def __init__(self,coordinate, name=None, dim=None):
""" name, dimension and coordinates """
self.name = name
if type(dim) == type(None):
self.dim = len(coordinate)
else:
self.dim = dim
if len(coordinate) == self.dim:
... | class Point:
"""K-D POINT CLASS"""
def __init__(self, coordinate, name=None, dim=None):
""" name, dimension and coordinates """
self.name = name
if type(dim) == type(None):
self.dim = len(coordinate)
else:
self.dim = dim
if len(coordinate) == self... |
# 26.05.2019
# Working with BitwiseOperators and different kind of String Outputs.
print(f"Working with Bitwise Operators and different kind of String Outputs.")
var1 = 13 # 13 in Binary: 1101
var2 = 5 # 5 in Binary: 0101
# AND Operator with format String
# 1101 13
# 0101 5
# ---- A... | print(f'Working with Bitwise Operators and different kind of String Outputs.')
var1 = 13
var2 = 5
print('AND & Operator {}'.format(var1 & var2))
print(f'OR | operator {var1 | var2}')
print('XOR ^ operator %d' % (var1 ^ var2))
print('Left Shift << operator {}'.format(var1 << 1))
print(f'Right Shift >> operator {var1 >> ... |
"""
Given a non negative integer number num. For every numbers i in the range 0 <= i <= num calculate the number of 1's in
their binary representation and return them as an array.
Example:
For num = 5 you should return [0,1,1,2,1,2].
Follow up:
It is very easy to come up with a solution with run time O(n*sizeof(inte... | """
Given a non negative integer number num. For every numbers i in the range 0 <= i <= num calculate the number of 1's in
their binary representation and return them as an array.
Example:
For num = 5 you should return [0,1,1,2,1,2].
Follow up:
It is very easy to come up with a solution with run time O(n*sizeof(inte... |
"""
Conf file for product catagory and payment gateway
"""
#Products
product_sunscreens_category = ['SPF-50','SPF-30']
product_moisturizers_category = ['Aloe','Almond']
| """
Conf file for product catagory and payment gateway
"""
product_sunscreens_category = ['SPF-50', 'SPF-30']
product_moisturizers_category = ['Aloe', 'Almond'] |
class Solution:
def numTilings(self, n: int) -> int:
MOD = 1000000007
if n <= 2:
return n
previous = 1
result = 2
current = 1
for k in range(3, n + 1):
tmp = result
result = (result + previous + 2 * current) % MOD
curren... | class Solution:
def num_tilings(self, n: int) -> int:
mod = 1000000007
if n <= 2:
return n
previous = 1
result = 2
current = 1
for k in range(3, n + 1):
tmp = result
result = (result + previous + 2 * current) % MOD
curr... |
# 4. Caesar Cipher
# Write a program that returns an encrypted version of the same text.
# Encrypt the text by shifting each character with three positions forward.
# For example A would be replaced by D, B would become E, and so on. Print the encrypted text.
text = input()
encrypted_text = [chr(ord(character) + 3) ... | text = input()
encrypted_text = [chr(ord(character) + 3) for character in text]
print(''.join(encrypted_text)) |
ies = []
ies.append({ "ie_type" : "Node ID", "ie_value" : "Node ID", "presence" : "M", "instance" : "0", "comment" : "This IE shall contain the unique identifier of the sending Node."})
ies.append({ "ie_type" : "F-SEID", "ie_value" : "CP F-SEID", "presence" : "M", "instance" : "0", "comment" : "This IE shall contain th... | ies = []
ies.append({'ie_type': 'Node ID', 'ie_value': 'Node ID', 'presence': 'M', 'instance': '0', 'comment': 'This IE shall contain the unique identifier of the sending Node.'})
ies.append({'ie_type': 'F-SEID', 'ie_value': 'CP F-SEID', 'presence': 'M', 'instance': '0', 'comment': 'This IE shall contain the unique ide... |
code = """
400 0078 Clear Display
402 21C0 V1 = 0C0h (Pattern #)
404 2200 V2 = 10h (Cell#)
406 2301 V3 = 01 (Centre)
408 B600 B = 600 Set B to point to $600
40A 1422 CALL 422 Call 422 for C0,C5,CA,CA,BC,B5
40C 21C5 V1 = C5 Print PUZZLE.
40E 1422 CALL 422
410 21CA V1 = CA
412 1422 C... | code = '\n400\t\t0078 \tClear Display\n402\t\t21C0 \tV1 = 0C0h \t\t\t(Pattern #)\n404\t\t2200\tV2 = 10h \t\t\t(Cell#)\n406 \t2301 \tV3 = 01 \t\t\t(Centre)\n\n408 \tB600 \tB = 600 \t\t\tSet B to point to $600\n40A \t1422 \tCALL 422 \t\t\tCall 422 for C0,C5,CA,CA,BC,B5\n40C \t21C5 \tV1 = C5 \t\t\tPrint PUZZLE.\n40E \t142... |
# https://www.codechef.com/problems/MISSP
for T in range(int(input())):
a=[]
for n in range(int(input())):
k=int(input())
if(k not in a): a.append(k)
else: a.remove(k)
print(a[0]) | for t in range(int(input())):
a = []
for n in range(int(input())):
k = int(input())
if k not in a:
a.append(k)
else:
a.remove(k)
print(a[0]) |
"""
1. Clarification
2. Possible solutions
- Naive Approach
- String Concatenation
- Hash
3. Coding
4. Tests
"""
# T=O(n), S=O(1)
class Solution:
def fizzBuzz(self, n: int) -> List[str]:
ans = []
for num in range(1, n + 1):
divisible_by_3 = (num % 3 == 0)
divisi... | """
1. Clarification
2. Possible solutions
- Naive Approach
- String Concatenation
- Hash
3. Coding
4. Tests
"""
class Solution:
def fizz_buzz(self, n: int) -> List[str]:
ans = []
for num in range(1, n + 1):
divisible_by_3 = num % 3 == 0
divisible_by_5 = num % 5... |
def check_subtree(t2, t1):
if t1 is None or t2 is None:
return False
if t1.val == t2.val: # potential subtree
if subtree_equality(t2, t1):
return True
return check_subtree(t2, t1.left) or check_subtree(t2, t1.right)
def subtree_equality(t2, t1):
if t2 is None and t1 is Non... | def check_subtree(t2, t1):
if t1 is None or t2 is None:
return False
if t1.val == t2.val:
if subtree_equality(t2, t1):
return True
return check_subtree(t2, t1.left) or check_subtree(t2, t1.right)
def subtree_equality(t2, t1):
if t2 is None and t1 is None:
return True... |
# Sky Jewel box (2002016) | Treasure Room of Queen (926000010)
eleska = 3935
skyJewel = 4031574
reactor.incHitCount()
if reactor.getHitCount() >= 3:
if sm.hasQuest(eleska) and not sm.hasItem(skyJewel):
sm.dropItem(skyJewel, sm.getPosition(objectID).getX(), sm.getPosition(objectID).getY())
sm.removeReactor()
| eleska = 3935
sky_jewel = 4031574
reactor.incHitCount()
if reactor.getHitCount() >= 3:
if sm.hasQuest(eleska) and (not sm.hasItem(skyJewel)):
sm.dropItem(skyJewel, sm.getPosition(objectID).getX(), sm.getPosition(objectID).getY())
sm.removeReactor() |
a[-1]
a[-2:]
a[:-2]
a[::-1]
a[1::-1]
a[:-3:-1]
a[-3::-1]
point_coords = coords[i, :]
main(sys.argv[1:])
| a[-1]
a[-2:]
a[:-2]
a[::-1]
a[1::-1]
a[:-3:-1]
a[-3::-1]
point_coords = coords[i, :]
main(sys.argv[1:]) |
'''
for a in range(3,1000):
for b in range(a+1,999):
csquared= a**2+b**2
c=csquared**0.5
if a+b+c==1000:
product= a*b*c
print(product)
print(c)
break
'''
def compute():
PERIMETER = 1000
for a in range(1, PERIMETER + 1):
for b in range(a + 1... | """
for a in range(3,1000):
for b in range(a+1,999):
csquared= a**2+b**2
c=csquared**0.5
if a+b+c==1000:
product= a*b*c
print(product)
print(c)
break
"""
def compute():
perimeter = 1000
for a in range(1, PERIMETER + 1):
for b i... |
# Language: Python
# Level: 8kyu
# Name of Problem: DNA to RNA Conversion
# Instructions: Deoxyribonucleic acid, DNA is the primary information storage molecule in biological systems.
# It is composed of four nucleic acid bases Guanine ('G'), Cytosine ('C'), Adenine ('A'), and Thymine ('T').
# Ribonucleic acid, RNA, ... | def dn_ato_rna(dna):
return dna.replace('T', 'U') |
data = (
'Kay ', # 0x00
'Kayng ', # 0x01
'Ke ', # 0x02
'Ko ', # 0x03
'Kol ', # 0x04
'Koc ', # 0x05
'Kwi ', # 0x06
'Kwi ', # 0x07
'Kyun ', # 0x08
'Kul ', # 0x09
'Kum ', # 0x0a
'Na ', # 0x0b
'Na ', # 0x0c
'Na ', # 0x0d
'La ', # 0x0e
'Na ', # 0x0f
'Na ', ... | data = ('Kay ', 'Kayng ', 'Ke ', 'Ko ', 'Kol ', 'Koc ', 'Kwi ', 'Kwi ', 'Kyun ', 'Kul ', 'Kum ', 'Na ', 'Na ', 'Na ', 'La ', 'Na ', 'Na ', 'Na ', 'Na ', 'Na ', 'Nak ', 'Nak ', 'Nak ', 'Nak ', 'Nak ', 'Nak ', 'Nak ', 'Nan ', 'Nan ', 'Nan ', 'Nan ', 'Nan ', 'Nan ', 'Nam ', 'Nam ', 'Nam ', 'Nam ', 'Nap ', 'Nap ', 'Nap ', ... |
class Sol(object):
def __init__(self):
self.suc = None
def in_order(self, head, num):
if not head:
return None
int = []
def helper(head):
nonlocal int
if head:
self.helper(head.left)
int.append(head.val)
... | class Sol(object):
def __init__(self):
self.suc = None
def in_order(self, head, num):
if not head:
return None
int = []
def helper(head):
nonlocal int
if head:
self.helper(head.left)
int.append(head.val)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.