content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
def get_gene_ne(global_variables,gene_dictionary):
values_list = []
# gets the ordered samples
sample_list = global_variables["sample_list"]
for sample in sample_list:
values_list.append(gene_dictionary[sample])
return values_list
| def get_gene_ne(global_variables, gene_dictionary):
values_list = []
sample_list = global_variables['sample_list']
for sample in sample_list:
values_list.append(gene_dictionary[sample])
return values_list |
def sublime():
return [
('MacOS', 'https://download.sublimetext.com/Sublime%20Text%20Build%203126.dmg', 'sublime/sublime.dmg'),
('Windows (32-bit)', 'https://download.sublimetext.com/Sublime%20Text%20Build%203126%20Setup.exe', 'sublime/sublime-x86.exe'), # noqa
('Windows (64-bit)', 'https:... | def sublime():
return [('MacOS', 'https://download.sublimetext.com/Sublime%20Text%20Build%203126.dmg', 'sublime/sublime.dmg'), ('Windows (32-bit)', 'https://download.sublimetext.com/Sublime%20Text%20Build%203126%20Setup.exe', 'sublime/sublime-x86.exe'), ('Windows (64-bit)', 'https://download.sublimetext.com/Sublime... |
#ID of the project
project_id = ""
#List of paths where the folders to check are
project_paths = []
#Destination of the sync, trailing slash
destination_path = ""
##################################
#Postgres database and rw user
##################################
db_host = ""
db_db = ""
db_user = ""
... | project_id = ''
project_paths = []
destination_path = ''
db_host = ''
db_db = ''
db_user = ''
sleep = 180 |
class Solution:
def summaryRanges(self, nums):
if not nums:
return nums
results = []
start = end = nums[0]
for i in nums:
if i != end:
rng = f"{start}->{end-1}" if start != (end - 1) else f"{start}"
results.append(rng)
... | class Solution:
def summary_ranges(self, nums):
if not nums:
return nums
results = []
start = end = nums[0]
for i in nums:
if i != end:
rng = f'{start}->{end - 1}' if start != end - 1 else f'{start}'
results.append(rng)
... |
class Solution:
def totalNQueens(self, n: int) -> int:
def dfs(row):
if row == 0:
return 1
count = 0
for col in range(n):
if col not in col_blacklist and \
row - col not in major_blacklist and \
row + ... | class Solution:
def total_n_queens(self, n: int) -> int:
def dfs(row):
if row == 0:
return 1
count = 0
for col in range(n):
if col not in col_blacklist and row - col not in major_blacklist and (row + col not in minor_blacklist):
... |
N = int(input())
R = []
for i in range(0, N*2) :
if i%2 == 0 : R.append("*")
else : R.append(" ")
for l in range(0, N) :
P1 = P2 = ""
for i in range(0, N) :
P1 += R[i]
print(P1)
for i in range(N*2-1, N-1, -1) :
P2 += R[i]
print(P2) | n = int(input())
r = []
for i in range(0, N * 2):
if i % 2 == 0:
R.append('*')
else:
R.append(' ')
for l in range(0, N):
p1 = p2 = ''
for i in range(0, N):
p1 += R[i]
print(P1)
for i in range(N * 2 - 1, N - 1, -1):
p2 += R[i]
print(P2) |
#
# PySNMP MIB module SYMMCOMMONPTP (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/neermitt/Dev/kusanagi/mibs.snmplabs.com/asn1/SYMMCOMMONPTP
# Produced by pysmi-0.3.4 at Tue Jul 30 11:34:16 2019
# On host NEERMITT-M-J0NV platform Darwin version 18.6.0 by user neermitt
# Using Python version 3.7.4 (default, J... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, value_size_constraint, value_range_constraint, single_value_constraint) ... |
class Solution:
def moveZeroes(self, nums: List[int]) -> None:
non_zeros = [i for i in range(len(nums)) if nums[i] != 0] # List comprehension to keep only numbers that are non -zero
nz = len(non_zeros)
nums[:nz] = [nums[i] for i in non_zeros] # edit the list to add non zero num... | class Solution:
def move_zeroes(self, nums: List[int]) -> None:
non_zeros = [i for i in range(len(nums)) if nums[i] != 0]
nz = len(non_zeros)
nums[:nz] = [nums[i] for i in non_zeros]
nums[nz:] = [0] * (len(nums) - nz) |
DEFAULT_OCR_AUTO_OCR = True
DEFAULT_OCR_BACKEND = 'mayan.apps.ocr.backends.tesseract.Tesseract'
DEFAULT_OCR_BACKEND_ARGUMENTS = {'environment': {'OMP_THREAD_LIMIT': '1'}}
TASK_DOCUMENT_VERSION_PAGE_OCR_RETRY_DELAY = 10
TASK_DOCUMENT_VERSION_PAGE_OCR_TIMEOUT = 10 * 60 # 10 Minutes per page
| default_ocr_auto_ocr = True
default_ocr_backend = 'mayan.apps.ocr.backends.tesseract.Tesseract'
default_ocr_backend_arguments = {'environment': {'OMP_THREAD_LIMIT': '1'}}
task_document_version_page_ocr_retry_delay = 10
task_document_version_page_ocr_timeout = 10 * 60 |
input()
c = int(input())
a = sorted((map(int, input().split())))
a.sort(key= lambda x: x%c)
print(*a) | input()
c = int(input())
a = sorted(map(int, input().split()))
a.sort(key=lambda x: x % c)
print(*a) |
def greet(name):
return "Hello {}".format(name)
print(greet("Alice"))
def greet2(name):
def greet_message():
return "Hello"
return "{} {}".format(greet_message(),name)
print(greet2("Alice"))
def change_name_greet(func):
name = "Alice"
return func(name)
print(change_name_greet(greet))
... | def greet(name):
return 'Hello {}'.format(name)
print(greet('Alice'))
def greet2(name):
def greet_message():
return 'Hello'
return '{} {}'.format(greet_message(), name)
print(greet2('Alice'))
def change_name_greet(func):
name = 'Alice'
return func(name)
print(change_name_greet(greet))
de... |
s = b'abc'; print(s.islower(), s)
s = b'Abc'; print(s.islower(), s)
s = b'ABC'; print(s.islower(), s)
s = b'123'; print(s.islower(), s)
s = b'(_)'; print(s.islower(), s)
s = b'(abc)'; print(s.islower(), s)
s = b'(aBc)'; print(s.islower(), s)
s = bytearray(b'abc'); print(s.islower(), s)
s = bytearray(b'Abc'); print(s.i... | s = b'abc'
print(s.islower(), s)
s = b'Abc'
print(s.islower(), s)
s = b'ABC'
print(s.islower(), s)
s = b'123'
print(s.islower(), s)
s = b'(_)'
print(s.islower(), s)
s = b'(abc)'
print(s.islower(), s)
s = b'(aBc)'
print(s.islower(), s)
s = bytearray(b'abc')
print(s.islower(), s)
s = bytearray(b'Abc')
print(s.islower(), ... |
class Solution:
def maxArea(self, height: List[int]) -> int:
i = 0
j = len(height)-1
res = 0
area = 0
while i < j:
area = min(height[i],height[j])*(j-i)
#print(area)
res = max(res,area)
if height[i]<height[j]:
i+... | class Solution:
def max_area(self, height: List[int]) -> int:
i = 0
j = len(height) - 1
res = 0
area = 0
while i < j:
area = min(height[i], height[j]) * (j - i)
res = max(res, area)
if height[i] < height[j]:
i += 1
... |
explanations = {
'gamma': '''
Proportion of tree modifications that should use mutrel-informed choice for
node to move, rather than uniform choice
''',
'zeta': '''
Proportion of tree modifications that should use mutrel-informed choice for
destination to move node to, rather than uniform choice
... | explanations = {'gamma': '\n Proportion of tree modifications that should use mutrel-informed choice for\n node to move, rather than uniform choice\n ', 'zeta': '\n Proportion of tree modifications that should use mutrel-informed choice for\n destination to move node to, rather than uniform choice\n ', 'i... |
def _impl(_ctx):
pass
bad_attrs = rule(implementation = _impl, attrs = {"1234isntvalid": attr.int()})
| def _impl(_ctx):
pass
bad_attrs = rule(implementation=_impl, attrs={'1234isntvalid': attr.int()}) |
# Copyright (c) 2017 Hristo Iliev <github@hiliev.eu>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of c... | dmu_type_desc = ['unallocated', 'object directory', 'object array', 'packed nvlist', 'packed nvlist size', 'bpobj', 'bpobj header', 'SPA space map header', 'SPA space map', 'ZIL intent log', 'DMU dnode', 'DMU objset', 'DSL directory', 'DSL directory child map', 'DSL dataset snap map', 'DSL props', 'DSL dataset', 'ZFS z... |
def caesar_encode(phrase, shift):
res=[]
for i,j in enumerate(phrase.split()):
res.append("".join(chr(ord("a")+(ord(k)-ord("a")+shift+i)%26) for k in j))
return " ".join(res) | def caesar_encode(phrase, shift):
res = []
for (i, j) in enumerate(phrase.split()):
res.append(''.join((chr(ord('a') + (ord(k) - ord('a') + shift + i) % 26) for k in j)))
return ' '.join(res) |
expected_output = {
'ints': {
'Ethernet 1/1/1': {
'ip_address': 'unassigned',
'ok': True,
'method': 'unset',
'status': 'up',
'protocol': 'up'
},
'Ethernet 1/1/2': {
'ip_address': 'unassigned',
'ok': True,
... | expected_output = {'ints': {'Ethernet 1/1/1': {'ip_address': 'unassigned', 'ok': True, 'method': 'unset', 'status': 'up', 'protocol': 'up'}, 'Ethernet 1/1/2': {'ip_address': 'unassigned', 'ok': True, 'method': 'unset', 'status': 'up', 'protocol': 'up'}, 'Ethernet 1/1/3': {'ip_address': 'unassigned', 'ok': True, 'method... |
class Solution:
def removeElement(self, nums, val):
count = 0
for i in range(len(nums)):
if nums[i] != val:
nums[count] = nums[i]
count += 1
print(count)
return(count)
obj = Solution()
obj.removeElement([3,2,2,3], 3)
obj.removeEl... | class Solution:
def remove_element(self, nums, val):
count = 0
for i in range(len(nums)):
if nums[i] != val:
nums[count] = nums[i]
count += 1
print(count)
return count
obj = solution()
obj.removeElement([3, 2, 2, 3], 3)
obj.removeElement([... |
#!/usr/bin/env python3
class Solution:
def buddStrings(self, A, B):
la, lb = len(A), len(B)
if la != lb:
return False
diff = [i for i in range(la) if A[i] != B[i]]
if len(diff) > 2 or len(diff) == 1:
return False
elif len(diff) == 0 and len(set(A)) ==... | class Solution:
def budd_strings(self, A, B):
(la, lb) = (len(A), len(B))
if la != lb:
return False
diff = [i for i in range(la) if A[i] != B[i]]
if len(diff) > 2 or len(diff) == 1:
return False
elif len(diff) == 0 and len(set(A)) == la:
r... |
print('this is the first line of second.py')
for x in range(20):
print(x)
print('this is the chunk of code added to the fourth branch')
print('Im editing this file in GitHub to see if fetch finds it')
print('adding this code to push to the main on the remote repository') | print('this is the first line of second.py')
for x in range(20):
print(x)
print('this is the chunk of code added to the fourth branch')
print('Im editing this file in GitHub to see if fetch finds it')
print('adding this code to push to the main on the remote repository') |
def count_substring(string, sub_string):
k = len(sub_string)
ans = 0
for i in range(len(string)):
if i+k > len(string):
break
if sub_string == string[i:i+k]:
ans += 1
return ans
if __name__ == '__main__':
string = input().strip()
sub_string = input().stri... | def count_substring(string, sub_string):
k = len(sub_string)
ans = 0
for i in range(len(string)):
if i + k > len(string):
break
if sub_string == string[i:i + k]:
ans += 1
return ans
if __name__ == '__main__':
string = input().strip()
sub_string = input().s... |
print("Hello World")
my_name = input("Whats your name? ")
print("Hello " + my_name)
print('Did you know that your name is ' + str(len(my_name)) + ' letters long!')
| print('Hello World')
my_name = input('Whats your name? ')
print('Hello ' + my_name)
print('Did you know that your name is ' + str(len(my_name)) + ' letters long!') |
default_mapping = {
'Recipient Name': 'recipient_name',
'Recipient DUNS Number': 'recipient_unique_id',
'Awarding Agency': 'awarding_toptier_agency_name',
'Awarding Agency Code': 'awarding_toptier_agency_code',
'Awarding Sub Agency': 'awarding_subtier_agency_name',
'Awarding Sub Agency Code': 'a... | default_mapping = {'Recipient Name': 'recipient_name', 'Recipient DUNS Number': 'recipient_unique_id', 'Awarding Agency': 'awarding_toptier_agency_name', 'Awarding Agency Code': 'awarding_toptier_agency_code', 'Awarding Sub Agency': 'awarding_subtier_agency_name', 'Awarding Sub Agency Code': 'awarding_subtier_agency_co... |
class Reporting(object):
def __init__(self, verbose=False, debug=False):
self.verbose_flag = verbose
self.debug_flag = debug
def error(self, msg):
pass
def debug(self, msg):
pass
def verbose(self, msg):
pass
| class Reporting(object):
def __init__(self, verbose=False, debug=False):
self.verbose_flag = verbose
self.debug_flag = debug
def error(self, msg):
pass
def debug(self, msg):
pass
def verbose(self, msg):
pass |
class Solution:
def isValid(self, s: str) -> bool:
if not s: return True
if len(s) % 2: return False
if s[0] in ']})': return False
maps = {'(':')', '{':'}', '[':']'}
stack = []
for char in s:
if char in '({[':
stack.appen... | class Solution:
def is_valid(self, s: str) -> bool:
if not s:
return True
if len(s) % 2:
return False
if s[0] in ']})':
return False
maps = {'(': ')', '{': '}', '[': ']'}
stack = []
for char in s:
if char in '({[':
... |
command = input()
kids = 0
adults = 0
while command != "Christmas":
peoples_age = int(command)
if peoples_age <= 16:
kids += 1
elif peoples_age > 16:
adults += 1
command = input()
if command == "Christmas":
total_toys_price = kids * 5
total_sweater_price = adults * 15
pri... | command = input()
kids = 0
adults = 0
while command != 'Christmas':
peoples_age = int(command)
if peoples_age <= 16:
kids += 1
elif peoples_age > 16:
adults += 1
command = input()
if command == 'Christmas':
total_toys_price = kids * 5
total_sweater_price = adults * 15
print(f... |
class Solution(object):
def findBestValue(self, arr, target):
arr.sort(reverse = True)
while arr and target >= arr[-1]*len(arr):
temp = arr[-1]
target -= arr.pop()
if not arr:
return temp
res = target / float(len(arr))
if res % 1 > 0.5:
... | class Solution(object):
def find_best_value(self, arr, target):
arr.sort(reverse=True)
while arr and target >= arr[-1] * len(arr):
temp = arr[-1]
target -= arr.pop()
if not arr:
return temp
res = target / float(len(arr))
if res % 1 > 0.5:
... |
class MockRequests:
def __init__(self, ok=True, json_data=None):
self.ok = ok
self.json_data = json_data
self.get_method_called = False
def __call__(self, *args, **kwargs):
self.get_method_called = True
self.response = MockResponse(json_data=self.json_data)
retur... | class Mockrequests:
def __init__(self, ok=True, json_data=None):
self.ok = ok
self.json_data = json_data
self.get_method_called = False
def __call__(self, *args, **kwargs):
self.get_method_called = True
self.response = mock_response(json_data=self.json_data)
ret... |
# -*- coding: utf-8 -*-
class Solution:
def minCostToMoveChips(self, chips):
count_even, count_odd = 0, 0
for chip in chips:
if chip % 2 == 0:
count_even += 1
else:
count_odd += 1
return min(count_even, count_odd)
if __name__ == '_... | class Solution:
def min_cost_to_move_chips(self, chips):
(count_even, count_odd) = (0, 0)
for chip in chips:
if chip % 2 == 0:
count_even += 1
else:
count_odd += 1
return min(count_even, count_odd)
if __name__ == '__main__':
soluti... |
def _copy_cmd(ctx, file_list, target_dir):
dest_list = []
if file_list == None or len(file_list) == 0:
return dest_list
shell_content = ""
batch_file_name = "%s-copy-files.bat" % (ctx.label.name)
bat = ctx.actions.declare_file(batch_file_name)
src_file_list = []
for (src_file, rela... | def _copy_cmd(ctx, file_list, target_dir):
dest_list = []
if file_list == None or len(file_list) == 0:
return dest_list
shell_content = ''
batch_file_name = '%s-copy-files.bat' % ctx.label.name
bat = ctx.actions.declare_file(batch_file_name)
src_file_list = []
for (src_file, relative... |
class Enum(object):
@classmethod
def parse(cls, value):
options = cls.options()
result = []
for k, v in options.items():
if type(v) is not int or v == 0:
continue
if value == 0 or (value & v) == v:
result.append(v)
retur... | class Enum(object):
@classmethod
def parse(cls, value):
options = cls.options()
result = []
for (k, v) in options.items():
if type(v) is not int or v == 0:
continue
if value == 0 or value & v == v:
result.append(v)
return r... |
class Model:
def __init__(self):
pass
class Optimizer:
def __init__(self):
pass
| class Model:
def __init__(self):
pass
class Optimizer:
def __init__(self):
pass |
currency = {
'GDP' : 1.3,
'EUR' : 1.08,
'USD' : 1.0,
'AUD' : 0.66,
'JPY' : 0.0090
}
while True:
intialcur = str(input('Please Enter the currency you want to convert from\n: ')).upper()
while True:
if intialcur in currency:
break
else:
intialcur = str(... | currency = {'GDP': 1.3, 'EUR': 1.08, 'USD': 1.0, 'AUD': 0.66, 'JPY': 0.009}
while True:
intialcur = str(input('Please Enter the currency you want to convert from\n: ')).upper()
while True:
if intialcur in currency:
break
else:
intialcur = str(input('Not in list. Please En... |
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
str_i = str(i)
sum = 0
for j in range(len(str_i)):
sum += int(str_i[j])
if a <= sum <= b:
ans +=i
print(ans)
| (n, a, b) = map(int, input().split())
ans = 0
for i in range(1, n + 1):
str_i = str(i)
sum = 0
for j in range(len(str_i)):
sum += int(str_i[j])
if a <= sum <= b:
ans += i
print(ans) |
VERSION = "0.0.2"
VERSION_GUI = "0.0.2"
VERSION_CUI = "0.0.0"
VERSION_AUDIOCABLE = "0.0.2"
VERSION_ROUTE = "0.0.2"
VERSION_SETINGS = "0.0.1"
CALLBACK_AUDIOCABLE_SELECTED = None
CALLBACK_ROUTE_SELECTED = None
SETTINGS = None
CONFIGURATION = None
PATH_ROOT = ""
PATH_SETTINGS = "" | version = '0.0.2'
version_gui = '0.0.2'
version_cui = '0.0.0'
version_audiocable = '0.0.2'
version_route = '0.0.2'
version_setings = '0.0.1'
callback_audiocable_selected = None
callback_route_selected = None
settings = None
configuration = None
path_root = ''
path_settings = '' |
def xor_reverse(iterable):
lenght = len(iterable)
i = 0
while i < lenght // 2:
iterable[i] ^= iterable[lenght - i - 1]
iterable[lenght - i - 1] ^= iterable[i]
iterable[i] ^= iterable[lenght - i - 1]
i += 1
return iterable
| def xor_reverse(iterable):
lenght = len(iterable)
i = 0
while i < lenght // 2:
iterable[i] ^= iterable[lenght - i - 1]
iterable[lenght - i - 1] ^= iterable[i]
iterable[i] ^= iterable[lenght - i - 1]
i += 1
return iterable |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | def load_arguments(commands_loader, _):
with commands_loader.argument_context('apim api policy') as c:
c.argument('api_id', options_list=['--api-id', '-a'], help='API revision identifier. Must be unique in the current API Management service instance.')
c.argument('xml', options_list=['--xml-value', ... |
# Variables that contain the user credentials to access Twitter API.
ACCESS_TOKEN = "570634225-AnsM63tVCpI4yeFwpj6QfSJTwm3pUx6onf30fI2Z"
ACCESS_TOKEN_SECRET = "ykA5CW0lWpl3VDiIRqJ5rhJjsQc6fyt0pps22tLAywXUJ"
CONSUMER_KEY = "iRwp1I7vH0cBoWNIO5w0uxURN"
CONSUMER_SECRET = "5rA8XDisNbzwTueiCiZG7JXEZe5T4HRiwLbFjWMTWlyNoU35r4... | access_token = '570634225-AnsM63tVCpI4yeFwpj6QfSJTwm3pUx6onf30fI2Z'
access_token_secret = 'ykA5CW0lWpl3VDiIRqJ5rhJjsQc6fyt0pps22tLAywXUJ'
consumer_key = 'iRwp1I7vH0cBoWNIO5w0uxURN'
consumer_secret = '5rA8XDisNbzwTueiCiZG7JXEZe5T4HRiwLbFjWMTWlyNoU35r4' |
def split_data(input, output, validation_percentage=0.1):
num_sets = output.shape[0]
num_validation = int(num_sets * validation_percentage)
return (input[:-num_validation], output[:-num_validation]), (input[-num_validation:], output[-num_validation:])
| def split_data(input, output, validation_percentage=0.1):
num_sets = output.shape[0]
num_validation = int(num_sets * validation_percentage)
return ((input[:-num_validation], output[:-num_validation]), (input[-num_validation:], output[-num_validation:])) |
class Solution:
def maxProfit(self, prices: List[int]) -> int:
# 1st solution
# O(n) time | O(1) space
profit = 0
start = prices[0]
end = start
for i, price in enumerate(prices):
if price >= end and i < len(prices) - 1:
end = price
... | class Solution:
def max_profit(self, prices: List[int]) -> int:
profit = 0
start = prices[0]
end = start
for (i, price) in enumerate(prices):
if price >= end and i < len(prices) - 1:
end = price
else:
if price >= end:
... |
class Stat:
def __init__(self):
self.sum = {}
self.sum_square = {}
self.count = {}
def add(self, key, value):
self.count[key] = self.count.get(key, 0) + 1
self.sum[key] = self.sum.get(key, 0.0) + value
self.sum_square[key] = self.sum_square.get(key, 0.0) + value... | class Stat:
def __init__(self):
self.sum = {}
self.sum_square = {}
self.count = {}
def add(self, key, value):
self.count[key] = self.count.get(key, 0) + 1
self.sum[key] = self.sum.get(key, 0.0) + value
self.sum_square[key] = self.sum_square.get(key, 0.0) + value... |
BUY = 1
SALE = 2
OrderType = [
(BUY, 'BUY'),
(SALE, 'SALE')
] | buy = 1
sale = 2
order_type = [(BUY, 'BUY'), (SALE, 'SALE')] |
num = 1
val = 2
val2 = 333333
val2 = 333
val3 = 55555
| num = 1
val = 2
val2 = 333333
val2 = 333
val3 = 55555 |
oa = ord('a')
def word_score(word):
return sum((ord(letter) - oa + 1) for letter in word)
def high(s):
print(s)
return max(s.split(), key=word_score)
| oa = ord('a')
def word_score(word):
return sum((ord(letter) - oa + 1 for letter in word))
def high(s):
print(s)
return max(s.split(), key=word_score) |
# table definition
table = {
'table_name' : 'adm_tax_cats',
'module_id' : 'adm',
'short_descr' : 'Sales tax categories',
'long_descr' : 'Sales tax categories',
'sub_types' : None,
'sub_trans' : None,
'sequence' : ['seq', [], None],
'tree_params' : None,
'ro... | table = {'table_name': 'adm_tax_cats', 'module_id': 'adm', 'short_descr': 'Sales tax categories', 'long_descr': 'Sales tax categories', 'sub_types': None, 'sub_trans': None, 'sequence': ['seq', [], None], 'tree_params': None, 'roll_params': None, 'indexes': None, 'ledger_col': None, 'defn_company': None, 'data_company'... |
li = []
nli = []
n = int(input())
for i in range(n):
li.append(input())
nli.append([i])
a=0
#print(nli)
for i in range(n-1):
a,b = map(int,input().split())
a-=1
b-=1
nli[a]+=nli[b]
nli[b] = []
res = ""
for i in range(n):
print(li[nli[a][i]],sep='',end='') | li = []
nli = []
n = int(input())
for i in range(n):
li.append(input())
nli.append([i])
a = 0
for i in range(n - 1):
(a, b) = map(int, input().split())
a -= 1
b -= 1
nli[a] += nli[b]
nli[b] = []
res = ''
for i in range(n):
print(li[nli[a][i]], sep='', end='') |
names = ['John', 'Mary']
print(names)
names[0], names[1] = names[1], names[0]
print(names) | names = ['John', 'Mary']
print(names)
(names[0], names[1]) = (names[1], names[0])
print(names) |
number = int(input())
for numbers in range(1111, 9999):
is_Magic = True
number_as_string = str(numbers)
for digit in number_as_string:
if int(digit) == 0:
is_Magic = False
break
elif number % int(digit) != 0:
is_Magic = False
break
if is_Ma... | number = int(input())
for numbers in range(1111, 9999):
is__magic = True
number_as_string = str(numbers)
for digit in number_as_string:
if int(digit) == 0:
is__magic = False
break
elif number % int(digit) != 0:
is__magic = False
break
if is... |
def myfnc(x):
print("inside myfnc", x)
x = 10
print("inside myfnc", x)
x = 20
myfnc(x)
print(x)
| def myfnc(x):
print('inside myfnc', x)
x = 10
print('inside myfnc', x)
x = 20
myfnc(x)
print(x) |
class Solution:
def reverse(self, x: int) -> int:
self.setLimit(x)
result = 0
while x != 0:
tail: int = self.mod10(x)
if self.overflow(result, tail):
return 0
result = result * 10 + tail
x = self.divide10(x)
return resul... | class Solution:
def reverse(self, x: int) -> int:
self.setLimit(x)
result = 0
while x != 0:
tail: int = self.mod10(x)
if self.overflow(result, tail):
return 0
result = result * 10 + tail
x = self.divide10(x)
return resu... |
del_items(0x80114B24)
SetType(0x80114B24, "int NumOfMonsterListLevels")
del_items(0x800A49E4)
SetType(0x800A49E4, "struct MonstLevel AllLevels[16]")
del_items(0x80114820)
SetType(0x80114820, "unsigned char NumsLEV1M1A[4]")
del_items(0x80114824)
SetType(0x80114824, "unsigned char NumsLEV1M1B[4]")
del_items(0x80114828)
S... | del_items(2148616996)
set_type(2148616996, 'int NumOfMonsterListLevels')
del_items(2148157924)
set_type(2148157924, 'struct MonstLevel AllLevels[16]')
del_items(2148616224)
set_type(2148616224, 'unsigned char NumsLEV1M1A[4]')
del_items(2148616228)
set_type(2148616228, 'unsigned char NumsLEV1M1B[4]')
del_items(214861623... |
'''
a = qtd pistas 1
b = qtd pessoas por pistas 9
c = qtd alunos 4
'''
A, B, C = [int(x) for x in input().split()]
if (A*B) > C:
print("S")
else:
print("N")
| """
a = qtd pistas 1
b = qtd pessoas por pistas 9
c = qtd alunos 4
"""
(a, b, c) = [int(x) for x in input().split()]
if A * B > C:
print('S')
else:
print('N') |
global file_object
global min_country
global max_country
def open_file():
global file_object
while True:
# repeatedly prompting for a file name until if its valid
file_name = input('Enter the file name: ')
# checking if file can be opened
try:
file_objec... | global file_object
global min_country
global max_country
def open_file():
global file_object
while True:
file_name = input('Enter the file name: ')
try:
file_object = open(file_name)
break
except:
print('Error: file not Found')
file_object... |
_base_ = [
'../_base_/models/flownet2/flownet2sd.py',
'../_base_/datasets/chairssdhom_384x448.py',
'../_base_/schedules/schedule_s_long.py', '../_base_/default_runtime.py'
]
| _base_ = ['../_base_/models/flownet2/flownet2sd.py', '../_base_/datasets/chairssdhom_384x448.py', '../_base_/schedules/schedule_s_long.py', '../_base_/default_runtime.py'] |
LOAD_CONTENT_CACHE = False
# Uncomment following line if you want document-relative URLs when developing
#RELATIVE_URLS = True
| load_content_cache = False |
number = int(input())
word = input()
save = []
for i in range(number):
current_string = input()
save.append(current_string)
print(save)
for i in range(len(save) -1, -1, -1):
element = save[i]
if word not in element:
save.remove(element)
print(save)
| number = int(input())
word = input()
save = []
for i in range(number):
current_string = input()
save.append(current_string)
print(save)
for i in range(len(save) - 1, -1, -1):
element = save[i]
if word not in element:
save.remove(element)
print(save) |
print("Enter the no of rows: ")
n = int(input())
for i in range(n):
count = 0
flag = 0
for j in range(n):
if(i==j):
flag = 1
if(flag==1):
print(n-count, end=" ")
count+=1
if(flag!=1):
print("1",end=" ")
print()
# Enter the no o... | print('Enter the no of rows: ')
n = int(input())
for i in range(n):
count = 0
flag = 0
for j in range(n):
if i == j:
flag = 1
if flag == 1:
print(n - count, end=' ')
count += 1
if flag != 1:
print('1', end=' ')
print() |
I=input
k=int(I())
l=int(I())
r=1
while k**r<l:r+=1
print(['NO','YES\n'+str(r-1)][k**r==l])
| i = input
k = int(i())
l = int(i())
r = 1
while k ** r < l:
r += 1
print(['NO', 'YES\n' + str(r - 1)][k ** r == l]) |
# Advance Lists
my_list = [1, 2, 3]
# Add element
print('\n# Add element\n')
my_list.append(4)
my_list.append(4)
print(my_list)
# Count element's occurrences
print('\n# Count element\'s occurrences\n')
print(f'2 = {my_list.count(2)}')
print(f'4 = {my_list.count(4)}')
print(f'5 = {my_list.count(5)}')
# Extend
print... | my_list = [1, 2, 3]
print('\n# Add element\n')
my_list.append(4)
my_list.append(4)
print(my_list)
print("\n# Count element's occurrences\n")
print(f'2 = {my_list.count(2)}')
print(f'4 = {my_list.count(4)}')
print(f'5 = {my_list.count(5)}')
print('\n# Extend\n')
x = [1, 2, 3]
x.append([4, 5])
print(f'Use append = {x}')
... |
#!/usr/bin/env python
# coding=utf-8
# author: zengyuetian
content_type_json = {'Content-Type': 'application/json'}
accept_type_json = {'Accept': 'application/json'}
if __name__ == "__main__":
pass | content_type_json = {'Content-Type': 'application/json'}
accept_type_json = {'Accept': 'application/json'}
if __name__ == '__main__':
pass |
#
# %CopyrightBegin%
#
# Copyright Ericsson AB 2013. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
# compliance with the License. You should have received a copy of the
# Erlang Public License along with t... | def get_thread_name(t):
f = gdb.newest_frame()
while f:
if f.name() == 'async_main':
return 'async'
elif f.name() == 'erts_sys_main_thread':
return 'main'
elif f.name() == 'signal_dispatcher_thread_func':
return 'signal_dispatcher'
elif f.name(... |
# 264. Ugly Number II
# Runtime: 173 ms, faster than 54.94% of Python3 online submissions for Ugly Number II.
# Memory Usage: 14.2 MB, less than 73.79% of Python3 online submissions for Ugly Number II.
class Solution:
# Three Pointers
def nthUglyNumber(self, n: int) -> int:
nums = [1]
p2, p3... | class Solution:
def nth_ugly_number(self, n: int) -> int:
nums = [1]
(p2, p3, p5) = (0, 0, 0)
for _ in range(1, n):
n2 = 2 * nums[p2]
n3 = 3 * nums[p3]
n5 = 5 * nums[p5]
nums.append(min(n2, n3, n5))
if nums[-1] == n2:
... |
class Constraints(object):
''' Contains all of the primary and foreign key constraint
names for the given entity as tuples of entities and
relations which are part of constraints '''
def __init__(self, pk_constraints, fk_constraints):
self.pk_constraints = pk_constraints
self.f... | class Constraints(object):
""" Contains all of the primary and foreign key constraint
names for the given entity as tuples of entities and
relations which are part of constraints """
def __init__(self, pk_constraints, fk_constraints):
self.pk_constraints = pk_constraints
self.fk... |
_base_ = [
'../_base_/models/du_pspnet_r50-d8.py', '../_base_/datasets/yantai_st12.py',
'../_base_/runtimes/yantai_runtime.py', '../_base_/schedules/schedule_yantai.py'
]
model = dict(
decode_head=dict(num_classes=4), auxiliary_head=dict(num_classes=4))
test_cfg = dict(mode='whole') | _base_ = ['../_base_/models/du_pspnet_r50-d8.py', '../_base_/datasets/yantai_st12.py', '../_base_/runtimes/yantai_runtime.py', '../_base_/schedules/schedule_yantai.py']
model = dict(decode_head=dict(num_classes=4), auxiliary_head=dict(num_classes=4))
test_cfg = dict(mode='whole') |
class Level:
def __init__(self, ident, desc, nresources):
self.id = ident
self.description = desc
self.networkResources = nresources
| class Level:
def __init__(self, ident, desc, nresources):
self.id = ident
self.description = desc
self.networkResources = nresources |
o = input()
e = input()
ans = ''
for i in range(len(e)):
ans += o[i]
ans += e[i]
if len(o)-len(e) == 1:
ans += o[-1]
print(ans)
| o = input()
e = input()
ans = ''
for i in range(len(e)):
ans += o[i]
ans += e[i]
if len(o) - len(e) == 1:
ans += o[-1]
print(ans) |
{
"targets": [{
"target_name": "mine.uv",
"type": "executable",
"dependencies": [
"mine.uv-lib",
],
"sources": [
"src/main.c",
],
}, {
"target_name": "mine.uv-lib",
"type": "<(library)",
"include_dirs": [ "src" ],
"dependencies": [
"deps/uv/uv.gyp:libuv",
... | {'targets': [{'target_name': 'mine.uv', 'type': 'executable', 'dependencies': ['mine.uv-lib'], 'sources': ['src/main.c']}, {'target_name': 'mine.uv-lib', 'type': '<(library)', 'include_dirs': ['src'], 'dependencies': ['deps/uv/uv.gyp:libuv', 'deps/openssl/openssl.gyp:openssl', 'deps/zlib/zlib.gyp:zlib'], 'direct_depend... |
#
# PySNMP MIB module CISCO-UNIFIED-COMPUTING-SYSFILE-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-UNIFIED-COMPUTING-SYSFILE-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:17:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Usi... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_intersection, value_size_constraint, constraints_union) ... |
def duel1(a, b, c):
k = 0
for _ in range(c):
a = a * 16807 % 2147483647
b = b * 48271 % 2147483647
k += a & 0xffff == b & 0xffff
return k
def duel2(a, b, c):
k = 0
for _ in range(c):
a = a * 16807 % 2147483647
while a & 0x3:
a = a * 16807 % 214748... | def duel1(a, b, c):
k = 0
for _ in range(c):
a = a * 16807 % 2147483647
b = b * 48271 % 2147483647
k += a & 65535 == b & 65535
return k
def duel2(a, b, c):
k = 0
for _ in range(c):
a = a * 16807 % 2147483647
while a & 3:
a = a * 16807 % 2147483647... |
class Solution:
def __init__(self):
self.res = ""
self.maxLen = 0
def naive(self,s):
self.length = len(s)
def loop(start,end):
l,r = start,end
while l>=0 and r<=self.length-1 and s[l]==s[r]:
if r-l+1>self.maxLen:
self.re... | class Solution:
def __init__(self):
self.res = ''
self.maxLen = 0
def naive(self, s):
self.length = len(s)
def loop(start, end):
(l, r) = (start, end)
while l >= 0 and r <= self.length - 1 and (s[l] == s[r]):
if r - l + 1 > self.maxLen:
... |
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
def f():
(some_global): int
print(some_global)
# EXPECTED:
[
...,
LOAD_CONST(Code((1, 0))),
LOAD_CONST('f'),
MAKE_FUNCTION(0),
STORE_NAME('f'),
LOAD_CONST(None),
RETURN_VALUE(0),
CODE_START('f'),
~L... | def f():
(some_global): int
print(some_global)
[..., load_const(code((1, 0))), load_const('f'), make_function(0), store_name('f'), load_const(None), return_value(0), code_start('f'), ~load_const('int')] |
#This program computes compound interest
#Prompt the user to input the inital investment
C = int(input('Enter the initial amount of an investment(C): '))
#Prompt the user to input the yearly rate of interest
r = float(input('Enter the yearly rate of interest(r): '))
#Prompt the user to input the number of years unti... | c = int(input('Enter the initial amount of an investment(C): '))
r = float(input('Enter the yearly rate of interest(r): '))
t = int(input('Enter the number of years until maturation(t): '))
n = int(input('Enter the number of times the interest is compounded per year(n): '))
p = str(round(C * (1 + r / n) ** (t * n), 2))... |
{
"targets": [
{
"target_name": "index",
"sources": [ "epoc.cc"],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
],
"conditions": [
['OS=="mac"', {
"cflags": [ "-m64" ],
"ldflags": [ "-m64" ],
"xcode_settings": {
"OTHER_C... | {'targets': [{'target_name': 'index', 'sources': ['epoc.cc'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'conditions': [['OS=="mac"', {'cflags': ['-m64'], 'ldflags': ['-m64'], 'xcode_settings': {'OTHER_CFLAGS': ['-ObjC++'], 'ARCHS': ['x86_64']}, 'link_settings': {'libraries': ['/Library/Frameworks/edk.framewor... |
def uniqueOccurrences(self, arr: List[int]) -> bool:
m = {}
for i in arr:
if i in m:
m[i] += 1
else:
m[i] = 1
return len(m.values()) == len(set(m.values())) | def unique_occurrences(self, arr: List[int]) -> bool:
m = {}
for i in arr:
if i in m:
m[i] += 1
else:
m[i] = 1
return len(m.values()) == len(set(m.values())) |
# leetcode
class Solution:
def hammingDistance(self, x: int, y: int) -> int:
ans = 0
xor = bin(x^y)[2:]
for l in xor:
if l == '1':
ans += 1
return ans | class Solution:
def hamming_distance(self, x: int, y: int) -> int:
ans = 0
xor = bin(x ^ y)[2:]
for l in xor:
if l == '1':
ans += 1
return ans |
'''
Write a function sumprimes(l) that takes as input a list of integers l and retuns the sum of all the prime numbers in l.
Here are some examples to show how your function should work.
>>> sumprimes([3,3,1,13])
19
'''
def sumprimes(l):
prime_sum = int()
for num in l:
if is_prime(num):
... | """
Write a function sumprimes(l) that takes as input a list of integers l and retuns the sum of all the prime numbers in l.
Here are some examples to show how your function should work.
>>> sumprimes([3,3,1,13])
19
"""
def sumprimes(l):
prime_sum = int()
for num in l:
if is_prime(num):
... |
'''
date : 31/03/2020
description : this module keeps information on print
objects used by editor
author : Celray James CHAWANDA
contact : celray.chawanda@outlook.com
licence : MIT 2020
'''
print_obj_lookup = {
"basin_wb" : "1",
"basin_nb" : "2",
"basin_ls" : "3",
"ba... | """
date : 31/03/2020
description : this module keeps information on print
objects used by editor
author : Celray James CHAWANDA
contact : celray.chawanda@outlook.com
licence : MIT 2020
"""
print_obj_lookup = {'basin_wb': '1', 'basin_nb': '2', 'basin_ls': '3', 'basin_pw': '4', 'basin_... |
load("//scala:scala_cross_version.bzl",
"scala_mvn_artifact",
)
def specs2_version():
return "3.8.8"
def specs2_repositories():
native.maven_jar(
name = "io_bazel_rules_scala_org_specs2_specs2_core",
artifact = scala_mvn_artifact("org.specs2:specs2-core:" + specs2_version()),
sha1 = "495bed0... | load('//scala:scala_cross_version.bzl', 'scala_mvn_artifact')
def specs2_version():
return '3.8.8'
def specs2_repositories():
native.maven_jar(name='io_bazel_rules_scala_org_specs2_specs2_core', artifact=scala_mvn_artifact('org.specs2:specs2-core:' + specs2_version()), sha1='495bed00c73483f4f5f43945fde63c615d... |
class Solution:
def XXX(self, nums: List[int]) -> List[List[int]]:
l = len(nums)
if l <= 1:
return [nums]
total = 1
for i in range(2, l + 1):
total *= i
res = [[] for _ in range(total)]
div = total
for i in range(l):
ni = nu... | class Solution:
def xxx(self, nums: List[int]) -> List[List[int]]:
l = len(nums)
if l <= 1:
return [nums]
total = 1
for i in range(2, l + 1):
total *= i
res = [[] for _ in range(total)]
div = total
for i in range(l):
ni = n... |
#Program for merge sort in linked list
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def append(self, new_value):
new_node = Node(new_value)
if self.head is None:
self.head = new_node
return
curr_node = self.head
... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def append(self, new_value):
new_node = node(new_value)
if self.head is None:
self.head = new_node
return
... |
'''
CoG application-level constants.
'''
SECTION_DEFAULT = 'DEFAULT'
SECTION_ESGF = 'ESGF'
SECTION_EMAIL = 'EMAIL'
SECTION_GLOBUS = 'GLOBUS'
SECTION_PID = 'PID'
# note: use lower case
VALID_MIME_TYPES = { '.bmp': ['image/bmp', 'image/x-windows-bmp'],
'.csv': ['text/plain'],
... | """
CoG application-level constants.
"""
section_default = 'DEFAULT'
section_esgf = 'ESGF'
section_email = 'EMAIL'
section_globus = 'GLOBUS'
section_pid = 'PID'
valid_mime_types = {'.bmp': ['image/bmp', 'image/x-windows-bmp'], '.csv': ['text/plain'], '.doc': ['application/msword'], '.docx': ['application/msword', 'appl... |
#!/usr/bin/env python
# coding: utf-8
# ---
# # Python Basics - Assingment 3 ToDo
#
# ---
# **Exercise 1**
#
# **Task 1** Define a function called **repeat_stuff** that takes in two inputs, **stuff**, and **num_repeats**.
#
# We will want to make this function print a string with stuff repeated num_repeats amount o... | def repeat_stuff(stuff, num_repeats):
for i in range(num_repeats):
print(stuff)
repeat_stuff(input('Input an word: '), int(input('Repeat how many times? ')))
def repeat_stuff(stuff, num_repeats):
return stuff * num_repeats
repeat_stuff(input('Input an word: '), int(input('Repeat how many times? ')))
d... |
sessions = [{
"1": {
"type": "session",
"source": {"id": "scope"},
"id": "1",
'profile': {"id": "1"}
}
}]
profiles = [
{"1": {'id': "1", "traits": {}}},
{"2": {'id': "2", "traits": {}}},
]
class MockStorageCrud:
def __init__(self, index, domain_class_ref, entity):... | sessions = [{'1': {'type': 'session', 'source': {'id': 'scope'}, 'id': '1', 'profile': {'id': '1'}}}]
profiles = [{'1': {'id': '1', 'traits': {}}}, {'2': {'id': '2', 'traits': {}}}]
class Mockstoragecrud:
def __init__(self, index, domain_class_ref, entity):
self.index = index
self.domain_class_ref... |
# Configuration file for opasDataLoader
default_build_pattern = "(bEXP_ARCH1|bSeriesTOC)"
default_process_pattern = "(bKBD3|bSeriesTOC)"
# Global variables (for data and instances)
options = None
# Source codes (books/journals) which should store paragraphs
SRC_CODES_TO_INCLUDE_PARAS = ["GW", "SE"]
# for these code... | default_build_pattern = '(bEXP_ARCH1|bSeriesTOC)'
default_process_pattern = '(bKBD3|bSeriesTOC)'
options = None
src_codes_to_include_paras = ['GW', 'SE']
data_update_prepublication_codes_to_ignore = ['IPL', 'ZBK', 'NLP', 'SE', 'GW'] |
class Recommendation:
def __init__(self, title):
self.title = title
self.wikidata_id = None
self.rank = None
self.pageviews = None
self.url = None
self.sitelink_count = None
def __dict__(self):
return dict(title=self.title,
wikidata_id... | class Recommendation:
def __init__(self, title):
self.title = title
self.wikidata_id = None
self.rank = None
self.pageviews = None
self.url = None
self.sitelink_count = None
def __dict__(self):
return dict(title=self.title, wikidata_id=self.wikidata_id, ... |
class Category:
def __init__(self, category):
self.name = category
self.ledger = [] # Each entry is a dictionary
self.ledger1 = [] # Each entry is an array
self.balance = 0
self.withdrawals = 0
def deposit(self, amt, desc=""):
self.balance += amt
self.... | class Category:
def __init__(self, category):
self.name = category
self.ledger = []
self.ledger1 = []
self.balance = 0
self.withdrawals = 0
def deposit(self, amt, desc=''):
self.balance += amt
self.ledger.append({'amount': amt, 'description': desc})
... |
def extractExpandablefemaleBlogspotCom(item):
'''
DISABLED
Parser for 'expandablefemale.blogspot.com'
'''
return None | def extract_expandablefemale_blogspot_com(item):
"""
DISABLED
Parser for 'expandablefemale.blogspot.com'
"""
return None |
#
# PySNMP MIB module ZYXEL-L3-IP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ZYXEL-L3-IP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:50:32 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, constraints_union, constraints_intersection, value_size_constraint) ... |
##planets = [
## {
## "planet": "Tatooine",
## "visited": False,
## "reachable": ["Dagobah", "Hoth"]
## },
## {
## "planet": "Dagobah",
## "visited": False,
## "reachable": ["Hoth", "Endor"]
## },
## {
## "planet": "Endor",
## "visited": False,
## ... | mylist = [{'trajectory': ['Tatooine', 'Hoth', 'Endor'], 'total_time': 7, 'caught_proba': 0.19}, {'trajectory': ['Tatooine', 'Hoth', 'Endor'], 'total_time': 7, 'caught_proba': 0.18}, {'trajectory': ['Tatooine', 'Hoth', 'Endor'], 'total_time': 7, 'caught_proba': 0}]
def take_caught_proba(elem):
return elem['caught_p... |
# -*- coding: utf-8 -*-
def main():
n, m = map(int, input().split())
xs = sorted(list(map(int, input().split())))
if n >= m:
print(0)
else:
ans = xs[-1] - xs[0]
diff = [0 for _ in range(m - 1)]
for i in range(m - 1):
diff[i] = xs[i + 1] - xs[... | def main():
(n, m) = map(int, input().split())
xs = sorted(list(map(int, input().split())))
if n >= m:
print(0)
else:
ans = xs[-1] - xs[0]
diff = [0 for _ in range(m - 1)]
for i in range(m - 1):
diff[i] = xs[i + 1] - xs[i]
print(ans - sum(sorted(diff, ... |
if True:
pass
if 0:
pass
if 1:
pass
if (1==1) :
pass
if 1 == 2 + - 1 :
pass
if 456 == 244:
pass
if 1 == 0 - 5 + 6 - 1:
pass
if 2 + 2 == 5:
pass
if 23313 + 31313 == 0:
pass
if 2 + 2 == 3 + 1 * 0 + 1 :
pass
if 1 == 1:
pass
if - 1== 2-3 :
pass
if (2 + 2) + 2 == 7:
... | if True:
pass
if 0:
pass
if 1:
pass
if 1 == 1:
pass
if 1 == 2 + -1:
pass
if 456 == 244:
pass
if 1 == 0 - 5 + 6 - 1:
pass
if 2 + 2 == 5:
pass
if 23313 + 31313 == 0:
pass
if 2 + 2 == 3 + 1 * 0 + 1:
pass
if 1 == 1:
pass
if -1 == 2 - 3:
pass
if 2 + 2 + 2 == 7:
pass
if 55 ... |
#
# PySNMP MIB module ALCATEL-IND1-IPX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ALCATEL-IND1-IPX-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:02:31 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... | (routing_ind1_ipx,) = mibBuilder.importSymbols('ALCATEL-IND1-BASE', 'routingIND1Ipx')
(octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, const... |
command = input()
command = command.strip()
tokens = []
numbers = ['0','1','2','3','4','5','6','7','9']
if (command[:4]=="cout" and command[-1]==';'):
index = 4
while(True):
if(command[index]=='<' and command[index+1]=='<'):
index+=2
s=""
while(command[index]!='<' and... | command = input()
command = command.strip()
tokens = []
numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '9']
if command[:4] == 'cout' and command[-1] == ';':
index = 4
while True:
if command[index] == '<' and command[index + 1] == '<':
index += 2
s = ''
while comma... |
result = {
"due-date": "2018-11-13T00:00:00",
"features": [
{
"geometry": {
"coordinates": [
[
[
9.52487,
46.85514
],
[
... | result = {'due-date': '2018-11-13T00:00:00', 'features': [{'geometry': {'coordinates': [[[9.52487, 46.85514], [9.52212, 46.8517], [9.52433, 46.84804], [9.53032, 46.84769], [9.53377, 46.85042], [9.53482, 46.85252], [9.53253, 46.85529], [9.52487, 46.85514]]], 'type': 'Polygon'}, 'properties': {'grade': 'B', 'uic_ref': 1}... |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~... | def keyboard_attributes(object):
def identify(self, inspector):
return inspector.onKeyboardAttributes(self)
def __init__(self):
self.accesskey = ''
self.tabindex = ''
return
__id__ = '$Id: KeyboardAttributes.py,v 1.1 2005/03/20 07:22:58 aivazis Exp $' |
class Solution:
def findLHS(self, nums: list) -> int:
nums.sort()
start_index = 0
l_count = 0
m_count = 0
LHS = 0
for i in range(len(nums)):
if start_index == 0:
l_count = 1
min_num = nums[i]
start_index = 1... | class Solution:
def find_lhs(self, nums: list) -> int:
nums.sort()
start_index = 0
l_count = 0
m_count = 0
lhs = 0
for i in range(len(nums)):
if start_index == 0:
l_count = 1
min_num = nums[i]
start_index = ... |
MAX_WORD_SENTENCE = 40
# VECTORIZATIONS
TDIDF_EMBEDDING = 'tdidf'
TOKENIZER = 'tokenizer'
# IMBALANCE
SMOTE_IMBALANCE = 'smote'
# DATASET TYPES
FINANCIAL_DATASET = 'financial_phrases_bank'
MOVIE_DATASET = 'movie_data'
SST_DATASET = 'sst_dataset'
TWITTER_DATASET = 'twitter_data'
YAHOO_DATASET = 'yahoo_data'
NN_DATASE... | max_word_sentence = 40
tdidf_embedding = 'tdidf'
tokenizer = 'tokenizer'
smote_imbalance = 'smote'
financial_dataset = 'financial_phrases_bank'
movie_dataset = 'movie_data'
sst_dataset = 'sst_dataset'
twitter_dataset = 'twitter_data'
yahoo_dataset = 'yahoo_data'
nn_dataset = 'nn_dataset'
polyglon_dataset = 'polyglon_da... |
__all__ = [
'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn',
'vgg19_bn', 'vgg19',
]
model_urls = {
'vgg11': 'https://download.pytorch.org/models/vgg11-bbd30ac9.pth',
'vgg13': 'https://download.pytorch.org/models/vgg13-c768596a.pth',
'vgg16': 'https://download.pytorch.org/model... | __all__ = ['VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn', 'vgg19_bn', 'vgg19']
model_urls = {'vgg11': 'https://download.pytorch.org/models/vgg11-bbd30ac9.pth', 'vgg13': 'https://download.pytorch.org/models/vgg13-c768596a.pth', 'vgg16': 'https://download.pytorch.org/models/vgg16-397923af.pth', 'vg... |
class BaseDriver(object):
EXECUTABLE_PATH = None
BINARY_PATH = None
def __init__(self):
self._driver = None
@property
def driver(self):
return self._driver
| class Basedriver(object):
executable_path = None
binary_path = None
def __init__(self):
self._driver = None
@property
def driver(self):
return self._driver |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.