content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
expected_output = {
"slot": {
"rp0": {
"cpu": {
"0": {
"idle": 99.1,
"irq": 0.0,
"nice_process": 0.0,
"sirq": 0.0,
"system": 0.2,
"user": 0.7,
"waiting... | expected_output = {'slot': {'rp0': {'cpu': {'0': {'idle': 99.1, 'irq': 0.0, 'nice_process': 0.0, 'sirq': 0.0, 'system': 0.2, 'user': 0.7, 'waiting': 0.0}, '1': {'idle': 98.69, 'irq': 0.0, 'nice_process': 0.0, 'sirq': 0.0, 'system': 0.3, 'user': 1.0, 'waiting': 0.0}, '10': {'idle': 97.3, 'irq': 0.0, 'nice_process': 0.0,... |
# Create a program that receives two strings on a single line separated by a single space.
# Then, it prints the sum of their multiplied character codes as follows:
# multiply str1[0] with str2[0] and add the result to the total sum, then continue with the next two characters.
# If one of the strings is longer than ... | sum_of_multiplication = lambda x, y: sum([ord(x[i]) * ord(y[i]) for i in range(min(len(x), len(y)))])
def addition_of_remainder(x, y):
diff = abs(len(x) - len(y))
if len(x) > len(y):
return sum([ord(ch) for ch in x[-diff:]])
elif len(y) > len(x):
return sum([ord(ch) for ch in y[-diff:]])
... |
OPENERS = {'(', '{', '['}
CLOSER_MAP = {')': '(', '}': '{', ']': '['}
def solve(s: str) -> bool:
stack = []
for c in s:
if c in OPENERS:
stack.append(c)
elif len(stack) == 0 or stack.pop() != CLOSER_MAP[c]:
return False
return True if len(stack) == 0 else False
def ... | openers = {'(', '{', '['}
closer_map = {')': '(', '}': '{', ']': '['}
def solve(s: str) -> bool:
stack = []
for c in s:
if c in OPENERS:
stack.append(c)
elif len(stack) == 0 or stack.pop() != CLOSER_MAP[c]:
return False
return True if len(stack) == 0 else False
def ... |
"""
Given the triangle of consecutive odd numbers:
1
3 5
7 9 11
13 15 17 19
21 23 25 27 29
...
Calculate the row sums of this triangle from the row index (starting at index 1)
"""
def row_sum_odd_numbers(number: int) -> int:
"""Returns the row sums... | """
Given the triangle of consecutive odd numbers:
1
3 5
7 9 11
13 15 17 19
21 23 25 27 29
...
Calculate the row sums of this triangle from the row index (starting at index 1)
"""
def row_sum_odd_numbers(number: int) -> int:
"""Returns the row sums.... |
'''
Task:
Your task is to write a function which returns the sum of following series upto nth term(parameter).
Series: 1 + 1/4 + 1/7 + 1/10 + 1/13 + 1/16 +...
Rules:
You need to round the answer to 2 decimal places and return it as String.
If the given value is 0 then it should return 0.00
You will only be given Nat... | """
Task:
Your task is to write a function which returns the sum of following series upto nth term(parameter).
Series: 1 + 1/4 + 1/7 + 1/10 + 1/13 + 1/16 +...
Rules:
You need to round the answer to 2 decimal places and return it as String.
If the given value is 0 then it should return 0.00
You will only be given Nat... |
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython
Even though the group is only for spanish speakers, english
speakers are welcome.
"""
numbers = [50, 30, 20, 50, 50, 62, 70, 50]
# just the first match
print("Index ->", numbers.index(50))
# output: Index -> 0
# all matches
print("Indexes ->", list((i fo... | """AyudaEnPython: https://www.facebook.com/groups/ayudapython
Even though the group is only for spanish speakers, english
speakers are welcome.
"""
numbers = [50, 30, 20, 50, 50, 62, 70, 50]
print('Index ->', numbers.index(50))
print('Indexes ->', list((i for (i, el) in enumerate(numbers) if el == 50))) |
# -*- coding: utf-8 -*-
"""
1963. Minimum Number of Swaps to Make the String Balanced
https://leetcode.com/problems/minimum-number-of-swaps-to-make-the-string-balanced/
Example 1:
Input: s = "][]["
Output: 1
Explanation: You can make the string balanced by swapping index 0 with index 3.
The resulting string is "[[]]... | """
1963. Minimum Number of Swaps to Make the String Balanced
https://leetcode.com/problems/minimum-number-of-swaps-to-make-the-string-balanced/
Example 1:
Input: s = "][]["
Output: 1
Explanation: You can make the string balanced by swapping index 0 with index 3.
The resulting string is "[[]]".
Example 2:
Input: s ... |
def count_unique_values(arr):
# return 0 of the length of array is 0
# loop the array by the second element at index j
# compare the previous element at index i
arr_len = len(arr)
if arr_len == 0:
return 0
pre_index = 0
unique_arr = [arr[pre_index]]
for j in range(1, arr_len):
... | def count_unique_values(arr):
arr_len = len(arr)
if arr_len == 0:
return 0
pre_index = 0
unique_arr = [arr[pre_index]]
for j in range(1, arr_len):
if arr[pre_index] != arr[j]:
unique_arr.append(arr[j])
pre_index = j
print(unique_arr)
return len(unique_... |
#05_01_converter
class ScaleConverter:
def __init__(self, units_from, units_to, factor):
self.units_from = units_from
self.units_to = units_to
self.factor = factor
def description(self):
return 'Convert ' + self.units_from + ' to ' + self.units_to
def convert(self, value):
return value * self.factor
... | class Scaleconverter:
def __init__(self, units_from, units_to, factor):
self.units_from = units_from
self.units_to = units_to
self.factor = factor
def description(self):
return 'Convert ' + self.units_from + ' to ' + self.units_to
def convert(self, value):
return v... |
#local storage
LOCAL="/home/pi/MTU-Timelapse-Pi"
#in minutes. 60 % interval must be 0
INTERVAL=5
#time between failed uploads
FAILTIME=5
#retry count
RETRYCOUNT=3
CMD="raspistill -o '/home/pi/MTU-Timelapse-Pi/cam/%s/%s-%s.jpg' -h 1080 -w 1920 --nopreview --timeout 1"
| local = '/home/pi/MTU-Timelapse-Pi'
interval = 5
failtime = 5
retrycount = 3
cmd = "raspistill -o '/home/pi/MTU-Timelapse-Pi/cam/%s/%s-%s.jpg' -h 1080 -w 1920 --nopreview --timeout 1" |
"""Zero_Width table. Created by setup.py."""
# Generated: 2020-03-23T04:40:34.685051
# Source: DerivedGeneralCategory-13.0.0.txt
# Date: 2019-10-21, 14:30:32 GMT
ZERO_WIDTH = (
(0x0300, 0x036F,), # Combining Grave Accent ..Combining Latin Small Le
(0x0483, 0x0489,), # Combining Cyrillic Titlo..Combining Cyr... | """Zero_Width table. Created by setup.py."""
zero_width = ((768, 879), (1155, 1161), (1425, 1469), (1471, 1471), (1473, 1474), (1476, 1477), (1479, 1479), (1552, 1562), (1611, 1631), (1648, 1648), (1750, 1756), (1759, 1764), (1767, 1768), (1770, 1773), (1809, 1809), (1840, 1866), (1958, 1968), (2027, 2035), (2045, 2045... |
class line(object):
def __init__(self, _char, _row, _column, _dir, _length):
self.char = _char
self.row = _row
self.column = _column
self.dir = _dir
self.length = _length
return None
| class Line(object):
def __init__(self, _char, _row, _column, _dir, _length):
self.char = _char
self.row = _row
self.column = _column
self.dir = _dir
self.length = _length
return None |
"""Compare two version numbers version1 and version2.
If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0.
You may assume that the version strings are non-empty and contain only digits and the . character.
The . character does not represent a decimal point and is used to separate numb... | """Compare two version numbers version1 and version2.
If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0.
You may assume that the version strings are non-empty and contain only digits and the . character.
The . character does not represent a decimal point and is used to separate numb... |
A, B, C = map(int, input().split())
print((A+B)%C)
print((A%C+B%C)%C)
print((A*B)%C)
print(((A%C)*(B%C))%C)
| (a, b, c) = map(int, input().split())
print((A + B) % C)
print((A % C + B % C) % C)
print(A * B % C)
print(A % C * (B % C) % C) |
lst_1=[1,2,4,88]
lst_2=[1,3,4,95,120]
lst_3=[]
i=0
j=0
for k in range(len(lst_1)+len(lst_2)):
if (lst_1[i]<= (lst_2[j])):
lst_3.append(lst_1[i])
if (i>=len(lst_1)-1):
if j<=(len(lst_2)-1):
lst_3.append(lst_2[j])
if j<len(lst_2)-1:
... | lst_1 = [1, 2, 4, 88]
lst_2 = [1, 3, 4, 95, 120]
lst_3 = []
i = 0
j = 0
for k in range(len(lst_1) + len(lst_2)):
if lst_1[i] <= lst_2[j]:
lst_3.append(lst_1[i])
if i >= len(lst_1) - 1:
if j <= len(lst_2) - 1:
lst_3.append(lst_2[j])
if j < len(lst_2) - 1:
... |
class JournalBlock:
"""
Represents a JournalBlock that was recorded after executing a transaction in the ledger.
"""
def __init__(self, block_address, transaction_id, block_timestamp, block_hash, entries_hash, previous_block_hash,
entries_hash_list, transaction_info, revisions):
... | class Journalblock:
"""
Represents a JournalBlock that was recorded after executing a transaction in the ledger.
"""
def __init__(self, block_address, transaction_id, block_timestamp, block_hash, entries_hash, previous_block_hash, entries_hash_list, transaction_info, revisions):
self.block_addr... |
__author__ = 'shukkkur'
'''
https://codeforces.com/problemset/problem/1475/B
B. New Year's Number
'''
t = int(input())
for _ in range(t):
n = int(input())
if n < 2020:
print('NO')
else:
if n % 2020 <= n / 2020:
print('YES')
... | __author__ = 'shukkkur'
"\nhttps://codeforces.com/problemset/problem/1475/B\nB. New Year's Number\n"
t = int(input())
for _ in range(t):
n = int(input())
if n < 2020:
print('NO')
elif n % 2020 <= n / 2020:
print('YES')
else:
print('NO') |
def caller():
a = []
for i in range(33, 49):
a.append(chr(i))
b = []
c = []
d = []
for i in range(65, 91):
b.append(chr(i))
for i in range(97, 123):
c.append(chr(i))
for i in range(48, 58):
d.append(chr(i))
... | def caller():
a = []
for i in range(33, 49):
a.append(chr(i))
b = []
c = []
d = []
for i in range(65, 91):
b.append(chr(i))
for i in range(97, 123):
c.append(chr(i))
for i in range(48, 58):
d.append(chr(i))
return (a, b, c, d) |
"""
A list of CSS properties to expand.
Format:
(property, [aliases], unit, [values])
- property : (String) the full CSS property name.
- aliases : (String list) a list of aliases for this shortcut.
- unit : (String) when defined, assumes that the property has a value with a
unit. When the value is numberless (... | """
A list of CSS properties to expand.
Format:
(property, [aliases], unit, [values])
- property : (String) the full CSS property name.
- aliases : (String list) a list of aliases for this shortcut.
- unit : (String) when defined, assumes that the property has a value with a
unit. When the value is numberless (... |
class Beacon():
def __init__(self, sprite, type):
self.sprite = sprite
self.type = type
'''
self.x = 0
self.y = 0
def set_pos(self, x, y):
self.x = x
self.y = y
'''
@property
def position(self):
return self.sprite.posit... | class Beacon:
def __init__(self, sprite, type):
self.sprite = sprite
self.type = type
'\n self.x = 0\n self.y = 0\n def set_pos(self, x, y):\n self.x = x\n self.y = y \n '
@property
def position(self):
return self.sprite.position
@p... |
class Attribute:
NAME = 'Keyboard'
class KeyState:
LEFT_ARROW_DOWN = 'leftArrowDown'
RIGHT_ARROW_DOWN = 'rightArrowDown'
UP_ARROW_DOWN = 'upArrowDown'
DOWN_ARROW_DOWN = 'downArrowDown'
| class Attribute:
name = 'Keyboard'
class Keystate:
left_arrow_down = 'leftArrowDown'
right_arrow_down = 'rightArrowDown'
up_arrow_down = 'upArrowDown'
down_arrow_down = 'downArrowDown' |
#Hierarchical Inheritance
class A: #Super Class or Parent Class
def feature1(self):
print("Feature 1 Working")
def feature2(self):
print("Feature 2 Working")
class B(A): # Subclass or Child Class
def feature3(self):
print("Feature 3 Working")
def feature4(self):
pr... | class A:
def feature1(self):
print('Feature 1 Working')
def feature2(self):
print('Feature 2 Working')
class B(A):
def feature3(self):
print('Feature 3 Working')
def feature4(self):
print('Feature 4 Working')
class C(A):
def feature5(self):
print('Featu... |
def hurdleRace(k, height):
if k >= max(height):
return 0
else:
return max(height) - k
# test case
h = [1,3,4,5,2,5]
print(hurdleRace(3, h)) # Should be 2
print(hurdleRace(8, h)) # Should be 0 | def hurdle_race(k, height):
if k >= max(height):
return 0
else:
return max(height) - k
h = [1, 3, 4, 5, 2, 5]
print(hurdle_race(3, h))
print(hurdle_race(8, h)) |
# try:
# except KeyError:
# return render(request, "circle/error.html", context={"message": "Upload file.!!", "type": "Key Error", "link": "newArticle"})
# except ValueError:
# return render(request, "circle/error.html", context={"message": "Invalid Value to given field image.!!", "type": "Value Error", "link... | message_tags = {messages.DEBUG: 'alert-secondary', messages.INFO: 'alert-info', messages.SUCCESS: 'alert-success', messages.WARNING: 'alert-warning', messages.ERROR: 'alert-danger'}
def verification(request):
ph_no = 9316300064
request.session['ph_no'] = ph_no
otp = str(random.randint(100000, 999999))
... |
class Solution:
def isPalindrome(self, s: str) -> bool:
string2 = ""
for character in s.lower():
if character.isalnum():
string2 += character
if string2 == string2[::-1]:
return True
return False
| class Solution:
def is_palindrome(self, s: str) -> bool:
string2 = ''
for character in s.lower():
if character.isalnum():
string2 += character
if string2 == string2[::-1]:
return True
return False |
squares = [value ** 2 for value in range(1, 11)]
print(squares)
cubes = [value ** 3 for value in range(1, 11)]
print(cubes)
a_million = list(range(1, 1_000_0001))
print(min(a_million))
print(max(a_million))
print(sum(a_million))
| squares = [value ** 2 for value in range(1, 11)]
print(squares)
cubes = [value ** 3 for value in range(1, 11)]
print(cubes)
a_million = list(range(1, 10000001))
print(min(a_million))
print(max(a_million))
print(sum(a_million)) |
class Restaurant:
def __init__(self, restaurant_name, cuisine_type):
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type
self.number_serverd = 0
def describe_restaurant(self):
print(f'Welcome to {self.restaurant_name.title()}')
print(f'Our cousine ... | class Restaurant:
def __init__(self, restaurant_name, cuisine_type):
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type
self.number_serverd = 0
def describe_restaurant(self):
print(f'Welcome to {self.restaurant_name.title()}')
print(f'Our cousine ty... |
mtx = []
while True:
n = str(input())
if n == 'end':
break
mtx.append([int(s) for s in n.split()])
out_mtx = [[0 for j in range(len(mtx[i]))] for i in range(len(mtx))]
for i in range(len(mtx)):
for j in range(len(mtx[i])):
ylen = len(mtx)
xlen = len(mtx[0])
out_mtx[i][... | mtx = []
while True:
n = str(input())
if n == 'end':
break
mtx.append([int(s) for s in n.split()])
out_mtx = [[0 for j in range(len(mtx[i]))] for i in range(len(mtx))]
for i in range(len(mtx)):
for j in range(len(mtx[i])):
ylen = len(mtx)
xlen = len(mtx[0])
out_mtx[i][j] ... |
# https://leetcode.com/problems/check-array-formation-through-concatenation/
class Solution:
def canFormArray(self, arr: List[int], pieces: List[List[int]]) -> bool:
result = []
for j in arr:
for i in pieces:
if i[0] == j:
for m in range(len... | class Solution:
def can_form_array(self, arr: List[int], pieces: List[List[int]]) -> bool:
result = []
for j in arr:
for i in pieces:
if i[0] == j:
for m in range(len(i)):
result.append(i[m])
if result == arr:
... |
a = 10
b = 3
print('Add -', a + b)
print('Subtract -', a - b)
print('Multiply -', a * b)
print('Divide (with floating point) -', a / b)
print('Divide (ignoring floats) -', a // b)
# With interactive python
# >>> 10 / 3
# 3.3333333333333335
# >>> 10.0 / 3
# 3.3333333333333335
# >>> 10 // 3
# 3
# >>> 10 // 3.0
# 3.0
p... | a = 10
b = 3
print('Add -', a + b)
print('Subtract -', a - b)
print('Multiply -', a * b)
print('Divide (with floating point) -', a / b)
print('Divide (ignoring floats) -', a // b)
print('Remainder or Modulus -', a % b)
print('a raised to power b -', a ** b)
a += b
print('a incremented by b -', a)
a -= b
print('a decrem... |
class IrregualrConfigParser(object):
COMMENT_FLAGS = ("#", ";")
def __init__(self):
super(IrregualrConfigParser, self).__init__()
self.__content = []
def read(self, fn_or_fp):
content = []
if isinstance(fn_or_fp, file):
content = [line.strip() for line in fn_or_... | class Irregualrconfigparser(object):
comment_flags = ('#', ';')
def __init__(self):
super(IrregualrConfigParser, self).__init__()
self.__content = []
def read(self, fn_or_fp):
content = []
if isinstance(fn_or_fp, file):
content = [line.strip() for line in fn_or_... |
def readConstants(constants_list):
constants = []
for attribute, value in constants_list.items():
constants.append({"name": attribute, "cname": "c_" + attribute, "value": value})
return constants
def readClocks(clocks_lists):
clocks = {"par": [], "seq": []}
for attribute, value in clocks_... | def read_constants(constants_list):
constants = []
for (attribute, value) in constants_list.items():
constants.append({'name': attribute, 'cname': 'c_' + attribute, 'value': value})
return constants
def read_clocks(clocks_lists):
clocks = {'par': [], 'seq': []}
for (attribute, value) in clo... |
def main() -> None:
N = int(input())
S = []
T = []
for _ in range(N):
S.append(input())
for _ in range(N):
T.append(input())
assert 1 <= N <= 100
assert all(len(S_i) == N for S_i in S)
assert all(len(T_i) == N for T_i in S)
assert all(S_ij in ('.', '#') for S_i in S... | def main() -> None:
n = int(input())
s = []
t = []
for _ in range(N):
S.append(input())
for _ in range(N):
T.append(input())
assert 1 <= N <= 100
assert all((len(S_i) == N for s_i in S))
assert all((len(T_i) == N for t_i in S))
assert all((S_ij in ('.', '#') for s_i i... |
""" --- Even the last --- Elementary
You are given an array of integers. You should find the sum of the
elements with even indexes (0th, 2nd, 4th...) then multiply this summed
number and the final element of the array together.
Don't forget that the first element has an index of 0.
For an empty array, the result wi... | """ --- Even the last --- Elementary
You are given an array of integers. You should find the sum of the
elements with even indexes (0th, 2nd, 4th...) then multiply this summed
number and the final element of the array together.
Don't forget that the first element has an index of 0.
For an empty array, the result wi... |
def fib(n):
if n == 1:
return 1
return n + fib(n-1)
def main():
n = 0
m = 1
result = 0
while n < 4000000:
tmp = n
n = n + m
m = tmp
if n % 2 == 0:
result += n
# print(n, n % 2)
# print(n, result)
print("Problem 2:", result)
| def fib(n):
if n == 1:
return 1
return n + fib(n - 1)
def main():
n = 0
m = 1
result = 0
while n < 4000000:
tmp = n
n = n + m
m = tmp
if n % 2 == 0:
result += n
print('Problem 2:', result) |
# file path (load_data.py, main.py, and compute_relation_vectors.py)
_SOURCE_DATA = '../data/source.csv'
_TARGET_DATA = '../data/target.csv'
_RESULT_FILE = '../results/results.csv'
_MEAN_RELATION = '../results/relation_vectors_before.csv'
_MODIFIED_MEAN_RELATINON = '../results/relation_vectors_after.csv'
_COUNT_... | _source_data = '../data/source.csv'
_target_data = '../data/target.csv'
_result_file = '../results/results.csv'
_mean_relation = '../results/relation_vectors_before.csv'
_modified_mean_relatinon = '../results/relation_vectors_after.csv'
_count_relatinon = '../results/count_ver_relation_vectors.csv'
_source_dim_num = 9
... |
class Instruction:
def __init__(self, name):
if not(name in dir(self)):
raise Exception("Instruction not exists")
self.name = name
def execute(self, cpu, a, b, c):
func = getattr(self,self.name)
func(cpu, a, b, c)
def addr(self, cpu, a, b, c):
... | class Instruction:
def __init__(self, name):
if not name in dir(self):
raise exception('Instruction not exists')
self.name = name
def execute(self, cpu, a, b, c):
func = getattr(self, self.name)
func(cpu, a, b, c)
def addr(self, cpu, a, b, c):
if not se... |
'''
modifier: 02
eqtime: 10
'''
def main():
info("Jan Air Sniff Pipette x1")
gosub('jan:WaitForMiniboneAccess')
gosub('jan:PrepareForAirShot')
gosub('jan:EvacPipette2')
gosub('common:FillPipette2')
gosub('jan:PrepareForAirShotExpansion')
close(name="M", description="Microbone to Getter NP-10... | """
modifier: 02
eqtime: 10
"""
def main():
info('Jan Air Sniff Pipette x1')
gosub('jan:WaitForMiniboneAccess')
gosub('jan:PrepareForAirShot')
gosub('jan:EvacPipette2')
gosub('common:FillPipette2')
gosub('jan:PrepareForAirShotExpansion')
close(name='M', description='Microbone to Getter NP-1... |
class Verdict:
OK = 'OK'
WA = 'WA'
RE = 'RE'
CE = 'CE'
TL = 'TL'
ML = 'ML'
FAIL = 'FAIL'
NR = 'NR'
| class Verdict:
ok = 'OK'
wa = 'WA'
re = 'RE'
ce = 'CE'
tl = 'TL'
ml = 'ML'
fail = 'FAIL'
nr = 'NR' |
# 2014.10.20 12:29:04 CEST
typew = {'AROMATIC': 3.0,
'DOUBLE': 2.0,
'TRIPLE': 3.0,
'SINGLE': 1.0}
heterow = {False: 2,
True: 1}
missingfragmentpenalty = 10.0
mims = {'H': 1.0078250321,
'He': 3.016029,
'Li': 6.015122,
'Be': 9.012182,
'B': 10.012937,
'C': 12.000000,
'N': 14.0030740052,
'O': 15.9949146221,
'F... | typew = {'AROMATIC': 3.0, 'DOUBLE': 2.0, 'TRIPLE': 3.0, 'SINGLE': 1.0}
heterow = {False: 2, True: 1}
missingfragmentpenalty = 10.0
mims = {'H': 1.0078250321, 'He': 3.016029, 'Li': 6.015122, 'Be': 9.012182, 'B': 10.012937, 'C': 12.0, 'N': 14.0030740052, 'O': 15.9949146221, 'F': 18.9984032, 'Ne': 19.99244, 'Na': 22.98976... |
for i in range(1, 101):
name = str(i)
name = name + ".txt"
print(name)
print(type(name))
arq = open(name, "w")
arq.close();
| for i in range(1, 101):
name = str(i)
name = name + '.txt'
print(name)
print(type(name))
arq = open(name, 'w')
arq.close() |
guild = """CREATE TABLE IF NOT EXISTS guild (guild_id bigint NOT NULL, guild_name varchar(100) NOT NULL,
prefix varchar(5), server_log bigint, mod_log bigint, ignored_channel bigint[], lockdown_channel bigint[],
filter_ignored_channel bigint[], profanity_check boolean DEFAULT false, invite_link boolean DEFAULT false,
P... | guild = 'CREATE TABLE IF NOT EXISTS guild (guild_id bigint NOT NULL, guild_name varchar(100) NOT NULL,\nprefix varchar(5), server_log bigint, mod_log bigint, ignored_channel bigint[], lockdown_channel bigint[],\nfilter_ignored_channel bigint[], profanity_check boolean DEFAULT false, invite_link boolean DEFAULT false,\n... |
def post_to_dict(post):
data = {}
data["owner_username"] = post.owner_username
data["owner_id"] = post.owner_id
data["post_date"] = post.date_utc
data["post_caption"] = post.caption
data["tagged_users"] = post.tagged_users
data["caption_mentions"] = post.caption_mentions
data["is... | def post_to_dict(post):
data = {}
data['owner_username'] = post.owner_username
data['owner_id'] = post.owner_id
data['post_date'] = post.date_utc
data['post_caption'] = post.caption
data['tagged_users'] = post.tagged_users
data['caption_mentions'] = post.caption_mentions
data['is_video']... |
class Solution:
def equationsPossible(self, equations: List[str]) -> bool:
parent = {}
def findParent(x):
if x not in parent:
parent[x] = x
else:
while parent[x] != x:
parent[x] = parent[parent[x]]
x = pa... | class Solution:
def equations_possible(self, equations: List[str]) -> bool:
parent = {}
def find_parent(x):
if x not in parent:
parent[x] = x
else:
while parent[x] != x:
parent[x] = parent[parent[x]]
x ... |
def new_decorator(func):
def wrapper_func():
print('code before executing func')
func()
print('func() has been called')
return wrapper_func
@new_decorator
def func_needs_decorator():
print('this function is in need of decorator!')
# func_needs_decorator()
# before adding @new_d... | def new_decorator(func):
def wrapper_func():
print('code before executing func')
func()
print('func() has been called')
return wrapper_func
@new_decorator
def func_needs_decorator():
print('this function is in need of decorator!')
func_needs_decorator() |
class Stats:
def min(dataset):
value = dataset[0]
for data in dataset:
if data < value:
value = data
return value
def max(dataset):
value = dataset[0]
for data in dataset:
if data > value:
value = data
return value
def range(dataset):
return Stats.max(dataset) - Stats.min(dataset)
def me... | class Stats:
def min(dataset):
value = dataset[0]
for data in dataset:
if data < value:
value = data
return value
def max(dataset):
value = dataset[0]
for data in dataset:
if data > value:
value = data
retu... |
########
# PART 1
# on python 3.7+ can just call pow(base, exp, mod), no need to implement anything!
def modexp(base, exp, mod):
''' mod exp by repeated squaring '''
res = 1
cur = base
while (exp > 0):
if (exp % 2 == 1):
res = (res * cur) % mod
exp = exp >> 1
cur = ... | def modexp(base, exp, mod):
""" mod exp by repeated squaring """
res = 1
cur = base
while exp > 0:
if exp % 2 == 1:
res = res * cur % mod
exp = exp >> 1
cur = cur * cur % mod
return res
(row, col) = (2981, 3075)
firstcode = 20151125
base = 252533
mod = 33554393
di... |
# swap it to get solution
fin = open("pic.png", "rb")
fout = open("../public/file.bin", "wb")
data = fin.read()[::-1]
result = bytearray()
for byte in data:
high = byte >> 4
low = byte & 0xF
rbyte = (low << 4) + high
result.append(rbyte)
fout.write(result)
fout.close()
| fin = open('pic.png', 'rb')
fout = open('../public/file.bin', 'wb')
data = fin.read()[::-1]
result = bytearray()
for byte in data:
high = byte >> 4
low = byte & 15
rbyte = (low << 4) + high
result.append(rbyte)
fout.write(result)
fout.close() |
WTF_CSRF_ENABLED = True
SECRET_KEY = 'you-will-never-guess'
projects = {}
| wtf_csrf_enabled = True
secret_key = 'you-will-never-guess'
projects = {} |
# some specific relevant fields
timestamp_field = 'requestInTs'
service_call_fields = ["clientMemberClass", "clientMemberCode", "clientXRoadInstance", "clientSubsystemCode", "serviceCode",
"serviceVersion", "serviceMemberClass", "serviceMemberCode", "serviceXRoadInstance",
... | timestamp_field = 'requestInTs'
service_call_fields = ['clientMemberClass', 'clientMemberCode', 'clientXRoadInstance', 'clientSubsystemCode', 'serviceCode', 'serviceVersion', 'serviceMemberClass', 'serviceMemberCode', 'serviceXRoadInstance', 'serviceSubsystemCode']
relevant_cols_general = ['_id', 'totalDuration', 'prod... |
class Mesh(GeometryObject,IDisposable):
""" A triangular mesh. """
def Dispose(self):
""" Dispose(self: Mesh,A_0: bool) """
pass
def ReleaseManagedResources(self,*args):
""" ReleaseManagedResources(self: APIObject) """
pass
def ReleaseUnmanagedResources(self,*args):
""" ReleaseUnmanagedResources(... | class Mesh(GeometryObject, IDisposable):
""" A triangular mesh. """
def dispose(self):
""" Dispose(self: Mesh,A_0: bool) """
pass
def release_managed_resources(self, *args):
""" ReleaseManagedResources(self: APIObject) """
pass
def release_unmanaged_resources(self, *ar... |
n, k = map(int, input().split())
graph = []
printInfo = []
for i in range(n):
graph.append([])
for i in range(k):
oper, u, v = input().split()
u = int(u) - 1
v = int(v) - 1
if oper == '+':
graph[u] += [v]
graph[v] += [u]
if oper == '?':
if not(graph[u] and graph[v]):
printInfo += ['?']
elif set... | (n, k) = map(int, input().split())
graph = []
print_info = []
for i in range(n):
graph.append([])
for i in range(k):
(oper, u, v) = input().split()
u = int(u) - 1
v = int(v) - 1
if oper == '+':
graph[u] += [v]
graph[v] += [u]
if oper == '?':
if not (graph[u] and graph[v])... |
# A colection of key value pairs
# Keys need to be a string
my_dict = {'name':'john', 'age':27, 'gender':'male', 'subs': ['Eng', 'Math', 'Sci'], 'marks':(58, 79,63)}
print(my_dict['name'])
print(my_dict['age'])
my_dict['age'] += 3
print(my_dict['age'])
print(my_dict['subs'])
print(my_dict['marks'])
print(my_dict['s... | my_dict = {'name': 'john', 'age': 27, 'gender': 'male', 'subs': ['Eng', 'Math', 'Sci'], 'marks': (58, 79, 63)}
print(my_dict['name'])
print(my_dict['age'])
my_dict['age'] += 3
print(my_dict['age'])
print(my_dict['subs'])
print(my_dict['marks'])
print(my_dict['subs'][1], end='--')
print(my_dict['marks'][1])
d = {}
d['ke... |
simulation_parameters = {
'temperature', 'integrator', 'collisions_rate', 'integration_timestep',
'initial_velocities_to_temperature', 'constraint_tolerance', 'platform', 'cuda_precision'
}
def is_simulation_dict(dictionary):
keys=set(dictionary.keys())
output = (keys <= simulation_parameters)
... | simulation_parameters = {'temperature', 'integrator', 'collisions_rate', 'integration_timestep', 'initial_velocities_to_temperature', 'constraint_tolerance', 'platform', 'cuda_precision'}
def is_simulation_dict(dictionary):
keys = set(dictionary.keys())
output = keys <= simulation_parameters
return output |
"""
isValidIP("0.0.0.0") ==> true
isValidIP("12.255.56.1") ==> true
isValidIP("137.255.156.100") ==> true
isValidIP('') ==> false
isValidIP('abc.def.ghi.jkl') ==> false
isValidIP('123.456.789.0') ==> false
isValidIP('12.34.56') ==> false
isValidIP('01.02.03.04') ==> false
"""
def isValidIP(string):
info = strin... | """
isValidIP("0.0.0.0") ==> true
isValidIP("12.255.56.1") ==> true
isValidIP("137.255.156.100") ==> true
isValidIP('') ==> false
isValidIP('abc.def.ghi.jkl') ==> false
isValidIP('123.456.789.0') ==> false
isValidIP('12.34.56') ==> false
isValidIP('01.02.03.04') ==> false
"""
def is_valid_ip(string):
info = st... |
"""
Regression utils
"""
class Regressor(object):
def __init__(self):
pass
def fit(self):
pass
| """
Regression utils
"""
class Regressor(object):
def __init__(self):
pass
def fit(self):
pass |
# AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"triee": "00_core.ipynb",
"cov": "01_oval_clean.ipynb",
"numpts": "01_oval_clean.ipynb",
"Points": "01_oval_clean.ipynb",
"vlen": "01_oval_clean.ipynb",
"major": "... | __all__ = ['index', 'modules', 'custom_doc_links', 'git_url']
index = {'triee': '00_core.ipynb', 'cov': '01_oval_clean.ipynb', 'numpts': '01_oval_clean.ipynb', 'Points': '01_oval_clean.ipynb', 'vlen': '01_oval_clean.ipynb', 'major': '01_oval_clean.ipynb', 'minor': '01_oval_clean.ipynb', 'x_vec': '01_oval_clean.ipynb', ... |
def findMinHeightTrees(n, edges):
'''
:param n: int
:param edges: List[List[int]]
:return: List[int]
'''
# create n empty set object
tree = [set() for _ in range(n)]
# u as vertex, v denotes neighbor vertices
# set add method ensure no repeat neighbor vertices
for u, v in edges... | def find_min_height_trees(n, edges):
"""
:param n: int
:param edges: List[List[int]]
:return: List[int]
"""
tree = [set() for _ in range(n)]
for (u, v) in edges:
(tree[u].add(v), tree[v].add(u))
(q, nq) = ([x for x in range(n) if len(tree[x]) < 2], [])
while True:
for... |
def solution(number):
sum = 0
for x in range(1,number):
if x % 3 == 0:
sum +=x
elif x % 5 == 0:
sum +=x
elif x % 3 and x % 5 == 0:
continue
return sum | def solution(number):
sum = 0
for x in range(1, number):
if x % 3 == 0:
sum += x
elif x % 5 == 0:
sum += x
elif x % 3 and x % 5 == 0:
continue
return sum |
class AbstractCrawler:
def __init__(self, num, init):
self.num = num
self.init = init
def crawl(self, es, client, process):
raise NotImplementedError("This should be implemented.") | class Abstractcrawler:
def __init__(self, num, init):
self.num = num
self.init = init
def crawl(self, es, client, process):
raise not_implemented_error('This should be implemented.') |
height = int(input())
for i in range(1, height + 1):
value = 3 * height - i - 1
for j in range(1,i+1):
if(i == height):
print(height + j - 1,end=" ")
elif(j == 1):
print(i,end=" ")
elif(j == i):
print(value,end=" ")
else:
... | height = int(input())
for i in range(1, height + 1):
value = 3 * height - i - 1
for j in range(1, i + 1):
if i == height:
print(height + j - 1, end=' ')
elif j == 1:
print(i, end=' ')
elif j == i:
print(value, end=' ')
else:
print(e... |
x = 5
print(type(x));
x = "6"
print(type(x))
x = 5.0
print(type(x))
x = 3.45
print(type(x))
| x = 5
print(type(x))
x = '6'
print(type(x))
x = 5.0
print(type(x))
x = 3.45
print(type(x)) |
class Solution:
def plusOne(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
return list(map(int, str(int(''.join(map(str, digits))) + 1)))
| class Solution:
def plus_one(self, digits):
"""
:type digits: List[int]
:rtype: List[int]
"""
return list(map(int, str(int(''.join(map(str, digits))) + 1))) |
# -*- coding: utf-8 -*-
# Contributors : [srinivas.v@toyotaconnected.co.in,srivathsan.govindarajan@toyotaconnected.co.in,
# harshavardhan.thirupathi@toyotaconnected.co.in,
# ashok.ramadass@toyotaconnected.com ]
"""Utilities for testing used across Zokyo"""
__all__ = ['pytest_err_msg']
def pytest_err_msg(err):
"... | """Utilities for testing used across Zokyo"""
__all__ = ['pytest_err_msg']
def pytest_err_msg(err):
"""Get the error message from an exception that pytest catches
Compatibility function for newer versions of pytest, where ``str(err)``
no longer returns the expected ``__repr__`` of an exception.
"""
... |
"""Knapsack solution using the branch and bound method."""
class Item:
"""Representation of one item from the total set of objects that can be chosen."""
def __init__(self, weight: int, value: int):
# Todo: Make this a dataclass.
self.__weight = weight
self.__value = value
def __r... | """Knapsack solution using the branch and bound method."""
class Item:
"""Representation of one item from the total set of objects that can be chosen."""
def __init__(self, weight: int, value: int):
self.__weight = weight
self.__value = value
def __repr__(self):
return f'weight: {... |
class PythonApiException(Exception):
pass
class RepositoryException(PythonApiException):
pass
| class Pythonapiexception(Exception):
pass
class Repositoryexception(PythonApiException):
pass |
e = 10e-6
for b in range(10, 100):
for a in range(10, b):
r = a / b
a1 = a % 10
a10 = (a // 10) % 10
b1 = b % 10
b10 = (b // 10) % 10
if a1 == b1 and a1 != 0 and b1 != 0:
c = a10
d = b10
elif a1 == b10:
c = a10
... | e = 1e-05
for b in range(10, 100):
for a in range(10, b):
r = a / b
a1 = a % 10
a10 = a // 10 % 10
b1 = b % 10
b10 = b // 10 % 10
if a1 == b1 and a1 != 0 and (b1 != 0):
c = a10
d = b10
elif a1 == b10:
c = a10
d =... |
# https://codeforces.com/contest/520/problem/A
def check_freq(x):
freq = {}
for c in set(x):
freq[c] = x.count(c)
return freq
_ = input()
word = input().lower()
if len(check_freq(word)) == 26:
print("YES")
else:
print("NO")
| def check_freq(x):
freq = {}
for c in set(x):
freq[c] = x.count(c)
return freq
_ = input()
word = input().lower()
if len(check_freq(word)) == 26:
print('YES')
else:
print('NO') |
"""Exceptions module."""
class A10SAError(Exception):
"""Base A10SA Script exception."""
class ParseError(A10SAError):
"""A script parsing error occured."""
| """Exceptions module."""
class A10Saerror(Exception):
"""Base A10SA Script exception."""
class Parseerror(A10SAError):
"""A script parsing error occured.""" |
s=0
for i in range(0,3):
for j in range(0,3):
for k in range(0,3):
s+=1
print(s) | s = 0
for i in range(0, 3):
for j in range(0, 3):
for k in range(0, 3):
s += 1
print(s) |
bags = {}
def get_bags():
with open("7/input.txt", "r") as file:
data = file.read().split('\n')
for line in data:
parts = line.split(" contain ")
color = parts[0].replace(" bags", "")
contains = []
if parts[1] != "no other bags.":
contains_bags = p... | bags = {}
def get_bags():
with open('7/input.txt', 'r') as file:
data = file.read().split('\n')
for line in data:
parts = line.split(' contain ')
color = parts[0].replace(' bags', '')
contains = []
if parts[1] != 'no other bags.':
contains_bags = parts[1].spl... |
load(":common.bzl", "get_nuget_files")
load("//dotnet/private:context.bzl", "make_builder_cmd")
load("//dotnet/private/actions:common.bzl", "cache_set", "declare_caches", "write_cache_manifest")
load("//dotnet/private:providers.bzl", "DotnetRestoreInfo", "MSBuildDirectoryInfo", "NuGetPackageInfo")
def restore(ctx, dot... | load(':common.bzl', 'get_nuget_files')
load('//dotnet/private:context.bzl', 'make_builder_cmd')
load('//dotnet/private/actions:common.bzl', 'cache_set', 'declare_caches', 'write_cache_manifest')
load('//dotnet/private:providers.bzl', 'DotnetRestoreInfo', 'MSBuildDirectoryInfo', 'NuGetPackageInfo')
def restore(ctx, dot... |
def sum_digits(digit):
return sum(int(x) for x in digit if x.isdigit())
print(sum_digits('texto123numero456x7'))
#https://pt.stackoverflow.com/q/42280/101
| def sum_digits(digit):
return sum((int(x) for x in digit if x.isdigit()))
print(sum_digits('texto123numero456x7')) |
"""Top-level package for Butane."""
__author__ = """Travis F. Collins"""
__email__ = 'travis.collins@analog.com'
__version__ = '0.0.1'
| """Top-level package for Butane."""
__author__ = 'Travis F. Collins'
__email__ = 'travis.collins@analog.com'
__version__ = '0.0.1' |
def update_c_deprecated_attributes(main, file):
""" This updates deprecated attributes in the conanfile
Only add attributes here which do have a 1:1 replacement
If there is no direct replacement then extend/write a check script for it
and let the developer decide manually
Automatic r... | def update_c_deprecated_attributes(main, file):
""" This updates deprecated attributes in the conanfile
Only add attributes here which do have a 1:1 replacement
If there is no direct replacement then extend/write a check script for it
and let the developer decide manually
Automatic r... |
#
# PySNMP MIB module NTNTECH-CHASSIS-CONFIGURATION-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NTNTECH-CHASSIS-CONFIGURATION-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:25:24 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using P... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint, constraints_union) ... |
load("@bazel_gazelle//:deps.bzl", "go_repository")
def go_repositories():
go_repository(
name = "com_github_deepmap_oapi_codegen",
importpath = "github.com/deepmap/oapi-codegen",
sum = "h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU=",
version = "v1.8.2",
)
go_repository(
... | load('@bazel_gazelle//:deps.bzl', 'go_repository')
def go_repositories():
go_repository(name='com_github_deepmap_oapi_codegen', importpath='github.com/deepmap/oapi-codegen', sum='h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU=', version='v1.8.2')
go_repository(name='com_github_cyberdelia_templates', importpath... |
def get_days(datetime_1,datetime_2,work_timing,weekends,holidays_list): # Here a datetime without full work time still is count as a day
first_day = datetime_1
days = 1
while(first_day.day < datetime_2.day):
if((first_day.isoweekday() not in weekends) and (first_day.strftime("%Y-%m-%d") not in holid... | def get_days(datetime_1, datetime_2, work_timing, weekends, holidays_list):
first_day = datetime_1
days = 1
while first_day.day < datetime_2.day:
if first_day.isoweekday() not in weekends and first_day.strftime('%Y-%m-%d') not in holidays_list:
days += 1
first_day += datetime.tim... |
class DBController():
def insert():
pass
def connect():
pass
| class Dbcontroller:
def insert():
pass
def connect():
pass |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
12 empirical models of protein evolution adopted from
`PAML 4.9e <http://abacus.gene.ucl.ac.uk/software/paml.html>`_:
"""
cprev10 = """
105
227 357
175 43 4435
669 823 538 10
157 1745 768 400 10
499 152 1055 3691 10 3122
665 243 653 431... | """
12 empirical models of protein evolution adopted from
`PAML 4.9e <http://abacus.gene.ucl.ac.uk/software/paml.html>`_:
"""
cprev10 = '\n\n 105\n 227 357\n 175 43 4435\n 669 823 538 10\n 157 1745 768 400 10\n 499 152 1055 3691 10 3122\n 665 243 653 431 303 133 379\n 66 715 1405 331 441... |
"""Constants for the Sagemcom integration."""
DOMAIN = "sagemcom_fast"
CONF_ENCRYPTION_METHOD = "encryption_method"
CONF_TRACK_WIRELESS_CLIENTS = "track_wireless_clients"
CONF_TRACK_WIRED_CLIENTS = "track_wired_clients"
DEFAULT_TRACK_WIRELESS_CLIENTS = True
DEFAULT_TRACK_WIRED_CLIENTS = True
ATTR_MANUFACTURER = "Sag... | """Constants for the Sagemcom integration."""
domain = 'sagemcom_fast'
conf_encryption_method = 'encryption_method'
conf_track_wireless_clients = 'track_wireless_clients'
conf_track_wired_clients = 'track_wired_clients'
default_track_wireless_clients = True
default_track_wired_clients = True
attr_manufacturer = 'Sagemc... |
def make_move():
board = [input().split() for _ in range(n)]
my_ptr = 'R' if player == 'RED' else 'B'
my_x = my_y = None
for i, row in enumerate(board):
for j, val in enumerate(row):
if val == my_ptr:
my_x = i
my_y = j
delta = [[0, -1, 'L'], [-1, 0... | def make_move():
board = [input().split() for _ in range(n)]
my_ptr = 'R' if player == 'RED' else 'B'
my_x = my_y = None
for (i, row) in enumerate(board):
for (j, val) in enumerate(row):
if val == my_ptr:
my_x = i
my_y = j
delta = [[0, -1, 'L'], [-... |
class Solution:
def largestRectangleArea(self, heights):
"""
:type heights: List[int]
:rtype: int
"""
if len(heights) == 1:
return heights[0]
stack = [] # (index, height)
max_area = 0
for i, height in enumerate(heights):
... | class Solution:
def largest_rectangle_area(self, heights):
"""
:type heights: List[int]
:rtype: int
"""
if len(heights) == 1:
return heights[0]
stack = []
max_area = 0
for (i, height) in enumerate(heights):
if i > 0 and height ... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | class Clientconfig:
"""
Client side configuration of Zeppelin SDK
"""
def __init__(self, zeppelin_rest_url, query_interval=1, knox_sso_url=None):
self.zeppelin_rest_url = zeppelin_rest_url
self.query_interval = query_interval
self.knox_sso_url = knox_sso_url
def get_zeppeli... |
class ImportLine:
def __init__(self, fromString: str, importString: str):
self.__from = fromString
self.__import = importString
def getFrom(self) -> str:
return self.__from
def getImport(self) -> str:
return self.__import
def isSame(self, line2: 'ImportLine') -> b... | class Importline:
def __init__(self, fromString: str, importString: str):
self.__from = fromString
self.__import = importString
def get_from(self) -> str:
return self.__from
def get_import(self) -> str:
return self.__import
def is_same(self, line2: 'ImportLine') -> bo... |
nome = 'Djonatan '
sobrenome = 'Schvambach'
print(nome + sobrenome)
idade = 25
altura = 1.76
e_maior = idade > 18
print('Nome ' + nome + sobrenome + ' Idade ' + str(idade) + ' maior de Idade ? ' + str(e_maior) )
peso = 58
imc = peso / altura ** 2
print(imc)
| nome = 'Djonatan '
sobrenome = 'Schvambach'
print(nome + sobrenome)
idade = 25
altura = 1.76
e_maior = idade > 18
print('Nome ' + nome + sobrenome + ' Idade ' + str(idade) + ' maior de Idade ? ' + str(e_maior))
peso = 58
imc = peso / altura ** 2
print(imc) |
# Source : https://leetcode.com/problems/longest-common-prefix/
# Author : foxfromworld
# Date : 04/10/2021
# First attempt
class Solution:
def longestCommonPrefix(self, strs: List[str]) -> str:
strs.sort(key=len)
result = ""
char = set()
for i in range(len(strs[0])):
... | class Solution:
def longest_common_prefix(self, strs: List[str]) -> str:
strs.sort(key=len)
result = ''
char = set()
for i in range(len(strs[0])):
for j in range(len(strs)):
char.add(strs[j][i])
if len(char) > 1:
return result
... |
{
"targets": [
{
"target_name": "memcachedNative",
"sources": [
"src/init.cc",
"src/client.cpp"
],
"include_dirs": [
"<!(node -e \"require('nan')\")"
],
'link_settings': {
'libraries': [
'<!@(pkg-config --libs libmemcached)'
... | {'targets': [{'target_name': 'memcachedNative', 'sources': ['src/init.cc', 'src/client.cpp'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'link_settings': {'libraries': ['<!@(pkg-config --libs libmemcached)']}}]} |
class InventoryFullError(Exception):
"""Exception raised when player inventory is full"""
pass
| class Inventoryfullerror(Exception):
"""Exception raised when player inventory is full"""
pass |
def sisi():
a = 10.0; b = {}; c = "string"
return a, b, c
sisi() | def sisi():
a = 10.0
b = {}
c = 'string'
return (a, b, c)
sisi() |
s=input().split()
graph_path = list()
graph_path.append(s)
for i in range(len(s)-1):
graph_path.append(input().split())
print('path input done.')
#print(graph_path)
s=input().split()
weight_path = list()
weight_path.append(s)
for i in range(len(s)-1):
weight_path.append(input().split())
print('weight input don... | s = input().split()
graph_path = list()
graph_path.append(s)
for i in range(len(s) - 1):
graph_path.append(input().split())
print('path input done.')
s = input().split()
weight_path = list()
weight_path.append(s)
for i in range(len(s) - 1):
weight_path.append(input().split())
print('weight input done.') |
def word():
word = "CSPIsCool"
x = ""
for i in word:
x += i
print(x)
def rows():
rows = 10
for i in range(1, rows + 1):
for j in range(1, i + 1):
print(i * j, end=' ')
print()
def pattern():
rows = 6
for i in range(0, rows):
for j in range(rows - 1, i, -1):
print(j, '... | def word():
word = 'CSPIsCool'
x = ''
for i in word:
x += i
print(x)
def rows():
rows = 10
for i in range(1, rows + 1):
for j in range(1, i + 1):
print(i * j, end=' ')
print()
def pattern():
rows = 6
for i in range(0, rows):
for j in rang... |
# by adegunlehinabayomi@gmail.com
# ______COVID-19 Impact Estimator_______
reportedCases = data_reported_cases
population = data-population
timeToElapse = data-time-to-elapse
totalHospitalBeds = data-total-hospital-beds
c_i = 0
iBRT = 0
#return reportedCases, population, timeToElapse, totalHospitalBeds
# C... | reported_cases = data_reported_cases
population = data - population
time_to_elapse = data - time - to - elapse
total_hospital_beds = data - total - hospital - beds
c_i = 0
i_brt = 0
def currently_infected(r_c, check):
if check == 'impact':
impact_currently_infected = reportedCases * 10
c_i = impact... |
class Solution(object):
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
counts = {}
for x in nums:
if counts.get(x) is None:
counts[x] = 1
else:
counts[x] += 1
fo... | class Solution(object):
def single_number(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
counts = {}
for x in nums:
if counts.get(x) is None:
counts[x] = 1
else:
counts[x] += 1
for x in counts:
... |
possibleprograms = ["Example.exe",
"ExampleNr2.exe",
"Pavlov-Win64-Shipping.exe"]
programdisplaynames = {
"Example.exe": "Example",
"ExampleNr2.exe": "Whatever name should be displayed",
"Pavlov-Win64-Shipping.exe": "Pavlov"
}
presets = [
[["Spotify.e... | possibleprograms = ['Example.exe', 'ExampleNr2.exe', 'Pavlov-Win64-Shipping.exe']
programdisplaynames = {'Example.exe': 'Example', 'ExampleNr2.exe': 'Whatever name should be displayed', 'Pavlov-Win64-Shipping.exe': 'Pavlov'}
presets = [[['Spotify.exe', 0.0], ['firefox.exe', 0.5]], [['Spotify.exe', 0.5], ['firefox.exe',... |
class _BotCommands:
def __init__(self):
self.StartCommand = 'start'
self.MirrorCommand = 'mirror'
self.UnzipMirrorCommand = 'unzipmirror'
self.TarMirrorCommand = 'tarmirror'
self.CancelMirror = 'cancel'
self.CancelAllCommand = 'cancelall'
self.ListCommand = 'l... | class _Botcommands:
def __init__(self):
self.StartCommand = 'start'
self.MirrorCommand = 'mirror'
self.UnzipMirrorCommand = 'unzipmirror'
self.TarMirrorCommand = 'tarmirror'
self.CancelMirror = 'cancel'
self.CancelAllCommand = 'cancelall'
self.ListCommand = '... |
###############################################################################
# Name: make.py #
# Purpose: Define Makefile syntax for highlighting and other features #
# Author: Cody Precord <cprecord@editra.org> #
... | """
FILE: make.py
AUTHOR: Cody Precord
@summary: Lexer configuration module for Makefiles.
"""
__author__ = 'Cody Precord <cprecord@editra.org>'
__svnid__ = '$Id: make.py 52852 2008-03-27 13:45:40Z CJ... |
def CorsMiddleware(app):
def _set_headers(headers):
headers.append(('Access-Control-Allow-Origin', '*'))
headers.append(('Access-Control-Allow-Methods', '*'))
headers.append(('Access-Control-Allow-Headers', 'origin, content-type, accept'))
return headers
def middleware(environ,... | def cors_middleware(app):
def _set_headers(headers):
headers.append(('Access-Control-Allow-Origin', '*'))
headers.append(('Access-Control-Allow-Methods', '*'))
headers.append(('Access-Control-Allow-Headers', 'origin, content-type, accept'))
return headers
def middleware(environ... |
#IMPRIMIR UMA PALAVRA INSERIDA INVERTIDAMENTE
if __name__ == "__main__":
palavra = input()
for index in range(len(palavra) - 1, -1, -1):
print(palavra[index], end='') | if __name__ == '__main__':
palavra = input()
for index in range(len(palavra) - 1, -1, -1):
print(palavra[index], end='') |
class Solution:
def minMalwareSpread(self, graph: List[List[int]], initial: List[int]) -> int:
if not graph: return -1
N = len(graph)
clean = set(range(N)) - set(initial)
parents = list(range(N))
size = [1] * N
def find(x):
if parents[x] != x:
... | class Solution:
def min_malware_spread(self, graph: List[List[int]], initial: List[int]) -> int:
if not graph:
return -1
n = len(graph)
clean = set(range(N)) - set(initial)
parents = list(range(N))
size = [1] * N
def find(x):
if parents[x] !=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.