content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class Plugin(object):
pass
class TextCommand(Plugin):
pass
class WindowCommand(Plugin):
pass
class EventListener(Plugin):
pass
| class Plugin(object):
pass
class Textcommand(Plugin):
pass
class Windowcommand(Plugin):
pass
class Eventlistener(Plugin):
pass |
def f(x):
return 2*x
def g(x, b):
a = 3*b
return f(2) + a
def h(x, y, s=None):
if s is not None:
return f(2) + g(f(2)) + x + y
else:
return f(2) + g(f(2)) + x*y
class Teste:
def __init__(self):
pass
def method_a(self):
pass
def method_b(self):
... | def f(x):
return 2 * x
def g(x, b):
a = 3 * b
return f(2) + a
def h(x, y, s=None):
if s is not None:
return f(2) + g(f(2)) + x + y
else:
return f(2) + g(f(2)) + x * y
class Teste:
def __init__(self):
pass
def method_a(self):
pass
def method_b(self):
... |
#! /usr/bin/env python3
# -*- encoding: utf-8 -*-
"""
Singleton design pattern
"""
def singleton(klass):
"""
Singleton decorator
"""
class Decorator(klass):
# pylint: disable=too-few-public-methods
def __init__(self, *args, **kwargs):
if hasattr(klass, '__init__'):
... | """
Singleton design pattern
"""
def singleton(klass):
"""
Singleton decorator
"""
class Decorator(klass):
def __init__(self, *args, **kwargs):
if hasattr(klass, '__init__'):
klass.__init__(self, *args, **kwargs)
def __repr__(self):
return klas... |
class Functor:
def __init__(self, function, args, kwargs):
self.__function = function
self.__args = args
self.__kwargs = kwargs
def __call__(self):
return self.__function(*self.__args, **self.__kwargs)
| class Functor:
def __init__(self, function, args, kwargs):
self.__function = function
self.__args = args
self.__kwargs = kwargs
def __call__(self):
return self.__function(*self.__args, **self.__kwargs) |
pantheon = {
0: 'Holobore, Spirit of Asceticism',
1: 'Vomitrax, Spirit of Decadence',
2: 'Godzamok, Spirit of Ruin',
3: 'Cyclius, Spirit of Ages',
4: 'Selebrak, Spirit of Festivities',
5: 'Dotjeiess, Spirit of Creation',
6: 'Muridal, Spirit of Labor',
7: 'Jeremy, Spirit of Industry',
... | pantheon = {0: 'Holobore, Spirit of Asceticism', 1: 'Vomitrax, Spirit of Decadence', 2: 'Godzamok, Spirit of Ruin', 3: 'Cyclius, Spirit of Ages', 4: 'Selebrak, Spirit of Festivities', 5: 'Dotjeiess, Spirit of Creation', 6: 'Muridal, Spirit of Labor', 7: 'Jeremy, Spirit of Industry', 8: 'Mokalsium, Mother Spirit', 9: 'S... |
# Solution from https://stackoverflow.com/questions/13387125/how-to-link-with-intersphinx-to-django-specific-constructs-like-settings # noqa
def setup(app):
app.add_crossref_type(
directivename="setting",
rolename="setting",
indextemplate="pair: %s; setting",
)
| def setup(app):
app.add_crossref_type(directivename='setting', rolename='setting', indextemplate='pair: %s; setting') |
input = """
1 2 1 1 3
1 4 1 1 5
1 6 1 1 7
1 8 1 1 9
1 8 2 0 9 10
1 11 1 0 12
1 11 1 0 13
1 6 2 0 7 11
1 12 1 0 14
1 4 2 0 5 12
1 13 1 0 15
1 2 2 0 3 13
1 16 4 0 2 4 6 8
1 10 1 0 16
1 11 1 0 16
1 14 1 0 16
1 12 1 0 16
1 15 1 0 16
1 13 1 0 16
1 1 1 1 16
1 17 1 0 16
1 18 1 0 16
1 19 2 0 3 13
1 19 1 0 14
1 20 2 0 5 12
1 20... | input = '\n1 2 1 1 3\n1 4 1 1 5\n1 6 1 1 7\n1 8 1 1 9\n1 8 2 0 9 10\n1 11 1 0 12\n1 11 1 0 13\n1 6 2 0 7 11\n1 12 1 0 14\n1 4 2 0 5 12\n1 13 1 0 15\n1 2 2 0 3 13\n1 16 4 0 2 4 6 8\n1 10 1 0 16\n1 11 1 0 16\n1 14 1 0 16\n1 12 1 0 16\n1 15 1 0 16\n1 13 1 0 16\n1 1 1 1 16\n1 17 1 0 16\n1 18 1 0 16\n1 19 2 0 3 13\n1 19 1 0... |
class Map:
def __init__(self):
self.x = 0
self.y = 0
self.map = {}
self.deliver_present()
def move(self, command):
if command == '^':
self.y -= 1
elif command == '>':
self.x += 1
elif command == 'v':
self.y += 1
... | class Map:
def __init__(self):
self.x = 0
self.y = 0
self.map = {}
self.deliver_present()
def move(self, command):
if command == '^':
self.y -= 1
elif command == '>':
self.x += 1
elif command == 'v':
self.y += 1
... |
"""
===============================================================================
Created on Feb 30, 2020
@author: Ramin Mehdizad Tekiyeh
This code is written in Python 3.7.4 , Spyder 3.3.6
===============================================================================
"""
# work dir
MainDir=''
... | """
===============================================================================
Created on Feb 30, 2020
@author: Ramin Mehdizad Tekiyeh
This code is written in Python 3.7.4 , Spyder 3.3.6
===============================================================================
"""
main_dir = ''
str_input = ''
args = ''
... |
#
# PySNMP MIB module ONEACCESS-VLAN-CONFIG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/ONEACCESS-VLAN-CONFIG-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:34:44 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, constraints_intersection, constraints_union, value_size_constraint, single_value_constraint) ... |
def birthdayCakeCandles(ar):
count = 0
max_ar = max(ar)
for i in range(len(ar)):
if ar[i] == max_ar:
count+=1
return count
| def birthday_cake_candles(ar):
count = 0
max_ar = max(ar)
for i in range(len(ar)):
if ar[i] == max_ar:
count += 1
return count |
number = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(number)
print(number[6])
mixed = ["apple", "orange", "grapes", "watermelon"]
print(mixed)
mixed[1] = 0x55
print(mixed)
mixed[2] = 10
print(mixed)
mixed.append(True)
print(mixed)
mixed.append(0b100010)
print(mixed)
mixed.append("characters")
print(mixed)
ok = list("charac... | number = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(number)
print(number[6])
mixed = ['apple', 'orange', 'grapes', 'watermelon']
print(mixed)
mixed[1] = 85
print(mixed)
mixed[2] = 10
print(mixed)
mixed.append(True)
print(mixed)
mixed.append(34)
print(mixed)
mixed.append('characters')
print(mixed)
ok = list('characters')
pri... |
def multiCheck(inA, inB, inC=2):
outA = inA * inB
if outA % inC == 0:
return True
else:
return False
def plusArr(inA, inB):
outA = inA + inB
arr = []
for i in range(outA+1):
arr.append(i)
return arr
| def multi_check(inA, inB, inC=2):
out_a = inA * inB
if outA % inC == 0:
return True
else:
return False
def plus_arr(inA, inB):
out_a = inA + inB
arr = []
for i in range(outA + 1):
arr.append(i)
return arr |
def get_all_combinations(source, size):
if size > len(source):
raise ValueError('size is greater than source')
if size <= 1 or len(source) <= 2:
return source
if not isinstance(source, list):
source = list(source)
def build_combinations(source, size):
if size == len(sou... | def get_all_combinations(source, size):
if size > len(source):
raise value_error('size is greater than source')
if size <= 1 or len(source) <= 2:
return source
if not isinstance(source, list):
source = list(source)
def build_combinations(source, size):
if size == len(sou... |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
# FORMAT_VERSION_NUMBER: Version number for identifying the export file format output. This
# number is shared between `export` and `export-dep-as-jar` task, so it should be changed
# when... | default_export_version = '1.1.0' |
#!/usr/bin/env python
#
# License: BSD
# https://raw.githubusercontent.com/splintered-reality/py_trees/devel/LICENSE
#
##############################################################################
# Documentation
##############################################################################
"""
Visitors are entitie... | """
Visitors are entities that can be passed to a tree implementation
(e.g. :class:`~py_trees.trees.BehaviourTree`) and used to either visit
each and every behaviour in the tree, or visit behaviours as the tree is
traversed in an executing tick. At each behaviour, the visitor
runs its own method on the behaviour to do ... |
def f():
print("ok")
s=yield 6
print(s)
print("ok2")
yield
gen=f()
# print(gen)
# next(gen)
RET=gen.__next__()
print(RET)
# next(gen)
gen.send(5)
| def f():
print('ok')
s = (yield 6)
print(s)
print('ok2')
yield
gen = f()
ret = gen.__next__()
print(RET)
gen.send(5) |
def Settings( **kwargs ):
return {
'flags': [ '-x', 'c', '-std=c17', '-W', '-Wall', '-DAPPNAME', '-DVERSION',
'-I.'
],
}
| def settings(**kwargs):
return {'flags': ['-x', 'c', '-std=c17', '-W', '-Wall', '-DAPPNAME', '-DVERSION', '-I.']} |
#
# PySNMP MIB module XYPLEX-IPX-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/XYPLEX-IPX-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:46:26 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) ... |
# -*- coding: utf-8 -*-
"""
2016-06-17, 2016M-1.0 lzj
Utilities for pipeline, general operations
This part including angle operations
"""
def dms2dec (dms, delimiter=":") :
""" Transform deg:min:sec format angle to decimal format
args:
dms: sexagesimal angle string, format +/-dd:mm:ss.xxx
... | """
2016-06-17, 2016M-1.0 lzj
Utilities for pipeline, general operations
This part including angle operations
"""
def dms2dec(dms, delimiter=':'):
""" Transform deg:min:sec format angle to decimal format
args:
dms: sexagesimal angle string, format +/-dd:mm:ss.xxx
delimiter: char sep... |
def findLongestSubarray(array: [str]) -> [str]:
if not array:
return []
dp = [0] * len(array)
dp[0] = 1 if (array[0] >= "A" and array[0] <= "Z") or (array[0] >= "a" and array[0] <= "z") else -1
for i in range(1, len(array)):
dp[i] = dp[i - 1] + 1 if (array[i] >= "A" and array[i] <= "Z") ... | def find_longest_subarray(array: [str]) -> [str]:
if not array:
return []
dp = [0] * len(array)
dp[0] = 1 if array[0] >= 'A' and array[0] <= 'Z' or (array[0] >= 'a' and array[0] <= 'z') else -1
for i in range(1, len(array)):
dp[i] = dp[i - 1] + 1 if array[i] >= 'A' and array[i] <= 'Z' or... |
class MealConfig():
def __init__(self, duration, target_weight, weight_per_bite):
self.duration = duration
self.target_weight = target_weight
self.weight_per_bite = weight_per_bite
| class Mealconfig:
def __init__(self, duration, target_weight, weight_per_bite):
self.duration = duration
self.target_weight = target_weight
self.weight_per_bite = weight_per_bite |
config={
"--confidence-digits":[2,int],
"--decode-mbr":["true",str],
"--frame-shift":[0.01,float],
"--inv-acoustic-scale":[1.0,float],
"--print-silence":["true",str],
} | config = {'--confidence-digits': [2, int], '--decode-mbr': ['true', str], '--frame-shift': [0.01, float], '--inv-acoustic-scale': [1.0, float], '--print-silence': ['true', str]} |
class Event:
def __init__(self, state, action, reward, state_next, done):
self.state = state
self.action = action
self.reward = reward
self.state_next = state_next
self.done = done
| class Event:
def __init__(self, state, action, reward, state_next, done):
self.state = state
self.action = action
self.reward = reward
self.state_next = state_next
self.done = done |
#!/usr/bin/python3
def roman_to_int(roman_string):
"converts a roman numeral to an integer"
if type(roman_string) is not str or roman_string is None:
return (0)
total = 0
r_dic = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000}
for idx in range(len(roman_string)):
i... | def roman_to_int(roman_string):
"""converts a roman numeral to an integer"""
if type(roman_string) is not str or roman_string is None:
return 0
total = 0
r_dic = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000}
for idx in range(len(roman_string)):
i = r_dic.get(roman... |
# Loops allow you to execute code over and over again, which
# is where much of the power of programmming lies
# While loops execute as long as the condition is true.
# Be careful with these, because it is easy to create an
# infinite loop!
i = 0
while i < 10:
print(f"{i} is not yet 10.")
# increment i. if i ... | i = 0
while i < 10:
print(f'{i} is not yet 10.')
i = i + 1
i = 0
while i < 10:
print(f'{i} is not yet 10.')
i += 1 |
PLACE_CATEGORIES = (
(0, "undefined"),
(1000, "accounting"),
(1100, "airport"),
(1200, "amusement_park"),
(1300, "aquarium"),
(1400, "art_gallery"),
(1500, "atm"),
(1600, "bakery"),
(1700, "bank"),
(1800, "bar"),
(1900, "beauty_salon"),
(2000, "bicycle_store"),
(2100,... | place_categories = ((0, 'undefined'), (1000, 'accounting'), (1100, 'airport'), (1200, 'amusement_park'), (1300, 'aquarium'), (1400, 'art_gallery'), (1500, 'atm'), (1600, 'bakery'), (1700, 'bank'), (1800, 'bar'), (1900, 'beauty_salon'), (2000, 'bicycle_store'), (2100, 'book_store'), (2200, 'bowling_alley'), (2300, 'bus_... |
#!/usr/bin/env python
"""
Problem 1:
* Find the sum of all the natural numbers below 1000 that are multiples
of 3 or 5.
Modifications:
* The two factors and highest number are variables and can be changed.
* An array is used instead of a generator so that the
contents may be viewed or altered at any time.
"""
... | """
Problem 1:
* Find the sum of all the natural numbers below 1000 that are multiples
of 3 or 5.
Modifications:
* The two factors and highest number are variables and can be changed.
* An array is used instead of a generator so that the
contents may be viewed or altered at any time.
"""
__author__ = 'Nick Irw... |
# Problem:
# Write a program that enters an integer and calculates the Fibonacci nth number.
# The zero figure of Fibonacci is 1, the first one is also 1, and the next is the sum of the previous two.
n = int(input())
a = 1
b = 2
for i in range(1, n):
new_b = a + b
a = b
b = new_b
print(a)
| n = int(input())
a = 1
b = 2
for i in range(1, n):
new_b = a + b
a = b
b = new_b
print(a) |
class Opcode:
CMP_OP = (
"<",
"<=",
"==",
"!=",
">",
">=",
"in",
"not in",
"is",
"is not",
"exception match",
"BAD",
)
HAVE_ARGUMENT = 90 # Opcodes from here have an argument:
EXTENDED_ARG = 144
CODEUNIT... | class Opcode:
cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is', 'is not', 'exception match', 'BAD')
have_argument = 90
extended_arg = 144
codeunit_size = 2
def __init__(self) -> None:
self.hasconst: set[int] = set()
self.hasname: set[int] = set()
self.hasjrel... |
def weightnode(a):
w = 2**(len(a)) - 1
for (scale, i) in enumerate(a):
w = w + (i)*(2**(len(a)-scale-1))
return(w)
| def weightnode(a):
w = 2 ** len(a) - 1
for (scale, i) in enumerate(a):
w = w + i * 2 ** (len(a) - scale - 1)
return w |
"""
Tools to make working with exceptions easier.
"""
def try_with_context(error_context, f, *args, **kwargs):
"""
Non-lazy version of `try_with_lazy_context`. Everything
is the same except `error_context` should be a string.
"""
return try_with_lazy_context(lambda: error_context,
... | """
Tools to make working with exceptions easier.
"""
def try_with_context(error_context, f, *args, **kwargs):
"""
Non-lazy version of `try_with_lazy_context`. Everything
is the same except `error_context` should be a string.
"""
return try_with_lazy_context(lambda : error_context, f, *args, **kwar... |
def binary_search(item_list, item):
first = 0
last = len(item_list) - 1
while first <= last:
mid = first + (last - first) // 2
if item_list[mid] == item:
return True
else:
if item < item_list[mid]:
last = mid - 1
else:
first = mid + 1
return False
# arr = [1, 6, 5,... | def binary_search(item_list, item):
first = 0
last = len(item_list) - 1
while first <= last:
mid = first + (last - first) // 2
if item_list[mid] == item:
return True
elif item < item_list[mid]:
last = mid - 1
else:
first = mid + 1
retur... |
def bubble_sort(l):
tam = len(l)
for i in range(tam):
trocou = False
for j in range(tam-1):
if l[j] > l[j+1]:
l[j], l[j+1] = l[j+1], l[j]
trocou = True
if not trocou:
return
if __name__ == '__main__':
l = [3, 44, 38, 5, 47, 15, 36, 26, 27, 2, 46, 4, 19, 50, 48]
print('---- * BUBBLE SORT * ----... | def bubble_sort(l):
tam = len(l)
for i in range(tam):
trocou = False
for j in range(tam - 1):
if l[j] > l[j + 1]:
(l[j], l[j + 1]) = (l[j + 1], l[j])
trocou = True
if not trocou:
return
if __name__ == '__main__':
l = [3, 44, 38,... |
class clr:
reset = "\u001b[0m"
black = "\u001b[30m"
bblack = "\u001b[30;1m"
red = "\u001b[31m"
bred = "\u001b[31;1m"
green = "\u001b32m"
bgreen = "\u001b[32;1m"
yellow = "\u001b[33m"
byellow = "\u001b[33;1m"
blue = "\u001b[34m"
bblue = "\u001b[34;1m"
magenta =... | class Clr:
reset = '\x1b[0m'
black = '\x1b[30m'
bblack = '\x1b[30;1m'
red = '\x1b[31m'
bred = '\x1b[31;1m'
green = '\x1b32m'
bgreen = '\x1b[32;1m'
yellow = '\x1b[33m'
byellow = '\x1b[33;1m'
blue = '\x1b[34m'
bblue = '\x1b[34;1m'
magenta = '\x1b[35m'
bmagenta = '\x1b[3... |
kSupportedMetadataTypes = ( str, int, float, bool, type(None) )
## @name Management States
## @see @ref python.Manager.Manager.managemetPolicy
## @{
## The Manager has no interest in participating in the management of this kind
## of entity, or a supplied specification is not publishable to a specific
## entity refe... | k_supported_metadata_types = (str, int, float, bool, type(None))
k_ignored = 0
k_managed = 1
k_exclusive = 3
k_state_mask = 7
k_will_manage_path = 8
k_supports_batch_operations = 16
k_field__item_type = 'fnItemType'
k_field__display_name = 'displayName'
k_field__metadata = 'metadata'
k_field__small_icon = 'smallIcon'
k... |
"""
Create a method take that accepts a list/array and a number n,
and returns a list/array array of the first n elements from the list/array.
"""
def take(arr,n):
return [x for index, x in enumerate(arr) if index < n]
| """
Create a method take that accepts a list/array and a number n,
and returns a list/array array of the first n elements from the list/array.
"""
def take(arr, n):
return [x for (index, x) in enumerate(arr) if index < n] |
class Reindeer:
def __init__(self, name, speed, time_before_rest, rest_time):
self.__name = name
self.__speed = int(speed)
self.__time_before_rest = int(time_before_rest)
self.__rest_time = int(rest_time)
self.__current_position = 0
self.__time_without_resting = 0
self.__is_resting = False
self.__time_... | class Reindeer:
def __init__(self, name, speed, time_before_rest, rest_time):
self.__name = name
self.__speed = int(speed)
self.__time_before_rest = int(time_before_rest)
self.__rest_time = int(rest_time)
self.__current_position = 0
self.__time_without_resting = 0
... |
#model.connection
class ConnectionSettings(object):
def __init__(self):
self.driver = None
self.dbcname = None
self.database = None
self.uid = None
self.pwd = None
self.quietmode = None
def set_connection_data(self, data):
self.driver = data['Driver']
... | class Connectionsettings(object):
def __init__(self):
self.driver = None
self.dbcname = None
self.database = None
self.uid = None
self.pwd = None
self.quietmode = None
def set_connection_data(self, data):
self.driver = data['Driver']
self.dbcname... |
# Copyright 2020 BlueCat Networks (USA) Inc. and its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
"""Modules for working with BlueCat products."""
| """Modules for working with BlueCat products.""" |
def merge_sort(list):
'''
Sorts a list in ascending order
Returns a new sorted list
Runs in O(n log n) time
Divide : Find the midpoint of list and divide into sublists
Conquer : Recursively sort the sublists created from previous step
Combine : Merge the sorted sublists created in previous s... | def merge_sort(list):
"""
Sorts a list in ascending order
Returns a new sorted list
Runs in O(n log n) time
Divide : Find the midpoint of list and divide into sublists
Conquer : Recursively sort the sublists created from previous step
Combine : Merge the sorted sublists created in previous s... |
class ChudaException(Exception):
pass
class EmptyCommandNameException(ChudaException):
message = "The command_name attribute is required and cannot be empty"
class ArgumentNotFoundException(ChudaException):
message = "Argument {} not found"
def __init__(self, arg_name):
super().__init__(self.... | class Chudaexception(Exception):
pass
class Emptycommandnameexception(ChudaException):
message = 'The command_name attribute is required and cannot be empty'
class Argumentnotfoundexception(ChudaException):
message = 'Argument {} not found'
def __init__(self, arg_name):
super().__init__(self.... |
# -*- coding: utf-8 -*-
class QaymModel(object):
"""
base class from which all Qaym models will initiate
"""
def __init__(self, **kwargs):
self.param_defaults = {}
@classmethod
def from_json(cls, data, **kwargs):
"""
Create a new instance from a JSON dict
"""
... | class Qaymmodel(object):
"""
base class from which all Qaym models will initiate
"""
def __init__(self, **kwargs):
self.param_defaults = {}
@classmethod
def from_json(cls, data, **kwargs):
"""
Create a new instance from a JSON dict
"""
data_copy = data.c... |
def age_assignment(*args, **ages):
res_dict = {}
names = [name for name in args]
while names:
for name in names:
for key in ages.keys():
if name[0] == key:
res_dict[name] = ages[key]
names.remove(name)
return res_dict
print(ag... | def age_assignment(*args, **ages):
res_dict = {}
names = [name for name in args]
while names:
for name in names:
for key in ages.keys():
if name[0] == key:
res_dict[name] = ages[key]
names.remove(name)
return res_dict
print(age_... |
class Solution:
def threeSumClosest(self, nums, target):
l, m = len(nums) - 1, sum(nums[:3])
if l < 3:
return 0
nums.sort()
for i in range(l - 1):
if i and nums[i] == nums[i - 1]:
continue
j, k = i + 1, l
while j < k:
... | class Solution:
def three_sum_closest(self, nums, target):
(l, m) = (len(nums) - 1, sum(nums[:3]))
if l < 3:
return 0
nums.sort()
for i in range(l - 1):
if i and nums[i] == nums[i - 1]:
continue
(j, k) = (i + 1, l)
whil... |
"""
##############################
Mf_track (``models.mf_track``)
##############################
"""
class Mf_track():
"""
Base class for tracking MF fitted model across multiple runs of the factorizations or tracking
the residuals error across iterations of single/multiple runs.
Th... | """
##############################
Mf_track (``models.mf_track``)
##############################
"""
class Mf_Track:
"""
Base class for tracking MF fitted model across multiple runs of the factorizations or tracking
the residuals error across iterations of single/multiple runs.
The pu... |
file = open("2.txt", "r")
##part 1
finalH = 0
finalD = 0
for line in file:
split = line.split()
if (split[0] == "forward"):
finalH += int(split[1])
elif(split[0] == "down"):
finalD += int(split[1])
elif(split[0] == "up"):
finalD -= int(split[1])
print(finalH * finalD)
#... | file = open('2.txt', 'r')
final_h = 0
final_d = 0
for line in file:
split = line.split()
if split[0] == 'forward':
final_h += int(split[1])
elif split[0] == 'down':
final_d += int(split[1])
elif split[0] == 'up':
final_d -= int(split[1])
print(finalH * finalD)
final_h = 0
final_d... |
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': '/tmp/daspi.db',
}
}
# the place where this raspberry pi is installed
THIS_PLACE_PK = 1
| databases = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': '/tmp/daspi.db'}}
this_place_pk = 1 |
def get_vericication_code(phone):
'''
Returns vericition code from a phone numbe.
'''
return phone[-6:]
| def get_vericication_code(phone):
"""
Returns vericition code from a phone numbe.
"""
return phone[-6:] |
class Comentarios:
def __init__(self,id,idU,comentario,fecha):
self.id=id
self.idU=idU
self.comentario=comentario
self.fecha=fecha
| class Comentarios:
def __init__(self, id, idU, comentario, fecha):
self.id = id
self.idU = idU
self.comentario = comentario
self.fecha = fecha |
# We have a list of points on the plane. Find the K closest points to the origin (0, 0).
# (Here, the distance between two points on a plane is the Euclidean distance.)
# You may return the answer in any order.
# The answer is guaranteed to be unique (except for the order that it is in.)
# Example 1:
# Input: p... | class Solution1:
def k_closest(self, points: List[List[int]], K: int) -> List[List[int]]:
closest = [{'item': points[x], 'index': x, 'square': points[x][0] * points[x][0] + points[x][1] * points[x][1]} for x in range(0, len(points))]
return [i['item'] for i in sorted(closest, key=lambda k: k['squar... |
class TestMetaClass(type):
def __init__(cls, clsName, bases, clsBody):
super().__init__(clsName, bases, clsBody)
print('TestMetaClass.__init__() is called')
def new_func(self):
print("new_func() is called")
cls.func_x = new_func
class TestClass(metaclass=TestMetaClass):... | class Testmetaclass(type):
def __init__(cls, clsName, bases, clsBody):
super().__init__(clsName, bases, clsBody)
print('TestMetaClass.__init__() is called')
def new_func(self):
print('new_func() is called')
cls.func_x = new_func
class Testclass(metaclass=TestMetaClass)... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 11 09:30:37 2020
@author: ahmad
"""
def solution_1(A):
leastNumber = 1000000
reqNumber = 1
#handling for empty array
if len(A)==0:
return 1
for n in range(1,len(A)+2):
if n in A:
pass
else:
reqNumber = ... | """
Created on Thu Jun 11 09:30:37 2020
@author: ahmad
"""
def solution_1(A):
least_number = 1000000
req_number = 1
if len(A) == 0:
return 1
for n in range(1, len(A) + 2):
if n in A:
pass
else:
req_number = n
if reqNumber <= leastNumber:
... |
class Node:
def __init__(self,data):
self.data=data
self.next=None
class LinkedList:
def __init__(self):
self.head=None
def push(self,x):
node = Node(x)
node.next=self.head
self.head=node
def insertAfter(self,y,x):
if y is None:
... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def push(self, x):
node = node(x)
node.next = self.head
self.head = node
def insert_after(self, y, x):
if y is None:... |
class Views(object):
MARKERS_HEBREW_VIEW = """SELECT cbs.markers.id,
cbs.markers.provider_and_id,
cbs.markers.provider_code,
cbs.provider_code.provider_code_hebrew,
cbs.mar... | class Views(object):
markers_hebrew_view = "SELECT cbs.markers.id,\n cbs.markers.provider_and_id,\n cbs.markers.provider_code,\n cbs.provider_code.provider_code_hebrew,\n cbs.m... |
class Solution:
_len = lambda self, num: len(str(num))
def findNumbers(self, nums) -> int:
return len([num for num in nums if not self._len(num) % 2]) | class Solution:
_len = lambda self, num: len(str(num))
def find_numbers(self, nums) -> int:
return len([num for num in nums if not self._len(num) % 2]) |
class Solution:
def XXX(self, height: List[int]) -> int:
L=len(height)
start=0
end=L-1
s=min(height[0],height[L-1])*(L-1)
while(start<end):
if height[start]>height[end]:
end-=1
t=min(height[start],height[end])*(end-start)
... | class Solution:
def xxx(self, height: List[int]) -> int:
l = len(height)
start = 0
end = L - 1
s = min(height[0], height[L - 1]) * (L - 1)
while start < end:
if height[start] > height[end]:
end -= 1
t = min(height[start], height[en... |
class Solution:
def findDisappearedNumbers(self, nums: List[int]) -> List[int]:
j = 1
n = len(nums)
res = []
nums.sort()
i = 0
arr = [-1] *(n + 1 )
for n in nums :
arr[n] = 1
for i in range(1,len(arr)):
if arr[i] == -1 :
... | class Solution:
def find_disappeared_numbers(self, nums: List[int]) -> List[int]:
j = 1
n = len(nums)
res = []
nums.sort()
i = 0
arr = [-1] * (n + 1)
for n in nums:
arr[n] = 1
for i in range(1, len(arr)):
if arr[i] == -1:
... |
class MyTransformer(object):
"""
Router template.
"""
def __init__(self):
"""
Add any initialization parameters. These will be passed at runtime from the graph definition parameters defined in your seldondeployment kubernetes resource manifest.
"""
print("Initializ... | class Mytransformer(object):
"""
Router template.
"""
def __init__(self):
"""
Add any initialization parameters. These will be passed at runtime from the graph definition parameters defined in your seldondeployment kubernetes resource manifest.
"""
print('Initializing')... |
class BaseTrader( object ):
def __init__( self, uid ):
self.uid = uid
def send_order( self, order ):
pass
def cancel_order( self, order ):
pass
| class Basetrader(object):
def __init__(self, uid):
self.uid = uid
def send_order(self, order):
pass
def cancel_order(self, order):
pass |
class EdgeSetGraph:
def __init__(self, V = (), E = ()):
self._V = set()
self._E = set()
for v in V: self.addvertex(v)
for u,v in E: self.addedge(u,v)
def vertices(self):
return iter(self._V)
def edges(self):
return iter(self._E)
def addvertex(self, v):
... | class Edgesetgraph:
def __init__(self, V=(), E=()):
self._V = set()
self._E = set()
for v in V:
self.addvertex(v)
for (u, v) in E:
self.addedge(u, v)
def vertices(self):
return iter(self._V)
def edges(self):
return iter(self._E)
... |
n = input()
if n==n[::-1]:
print("YES")
else:
print("NO")
| n = input()
if n == n[::-1]:
print('YES')
else:
print('NO') |
# Copyright 2020 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | """Logic for generating Clang module map files."""
def _add_headers(*, headers, kind, content, relative_to_dir, back_to_root_path):
content.add_all([(file, relative_to_dir, back_to_root_path) for file in headers], format_each=' {} "%s"'.format(kind), map_each=_header_info_mapper)
def write_module_map(actions, ... |
def normalize(population):
max_cost = max(p.cost for p in population)
for p in population:
p.fitness = max_cost - p.cost | def normalize(population):
max_cost = max((p.cost for p in population))
for p in population:
p.fitness = max_cost - p.cost |
# linked list implementation
# author: D1N3SHh
# https://github.com/D1N3SHh/algorithms
class Linked_list():
def __init__(self):
self.head = None
self.tail = None
def __repr__(self):
node = self.head
nodes = []
while node is not None:
nodes.append(node.data)... | class Linked_List:
def __init__(self):
self.head = None
self.tail = None
def __repr__(self):
node = self.head
nodes = []
while node is not None:
nodes.append(node.data)
node = node.next
nodes.append('None')
return ''.join(str(node... |
X = int(input())
H = int(input())
M = int(input())
print(X//60+H+(X%60+M)//60)
print((X%60+M)%60)
| x = int(input())
h = int(input())
m = int(input())
print(X // 60 + H + (X % 60 + M) // 60)
print((X % 60 + M) % 60) |
"""Contains transformer configuration information
"""
# The version number of the transformer
TRANSFORMER_VERSION = '2.0'
# The transformer description
TRANSFORMER_DESCRIPTION = 'Provides OpenDroneMap functionality'
# Short name of the transformer
TRANSFORMER_NAME = 'opendronemap'
# The sensor associated with the t... | """Contains transformer configuration information
"""
transformer_version = '2.0'
transformer_description = 'Provides OpenDroneMap functionality'
transformer_name = 'opendronemap'
transformer_sensor = 'rgb'
transformer_type = 'opendronemap'
author_name = 'Chris Schnaufer'
author_email = 'schnaufer@email.arizona.edu'
co... |
libros_imprimir = int(input())
cartuchos_tinta = int(input())
print(cartuchos_tinta-libros_imprimir*3)
| libros_imprimir = int(input())
cartuchos_tinta = int(input())
print(cartuchos_tinta - libros_imprimir * 3) |
number = 3
while True:
user_input = input('Play the Game...? (Y/n). ').lower()
if user_input == 'n':
break
user_number = int(input("Guess a numba."))
if user_number == number:
print('You figured it out~!')
elif abs(number - user_number) == 1:
print('Ohh... so close. Just 1... | number = 3
while True:
user_input = input('Play the Game...? (Y/n). ').lower()
if user_input == 'n':
break
user_number = int(input('Guess a numba.'))
if user_number == number:
print('You figured it out~!')
elif abs(number - user_number) == 1:
print('Ohh... so close. Just 1 of... |
# -*- coding: utf-8 -*-
# Exceptions module
class MaxRetriesAttempted(Exception):
pass
class ChartNotFound(ValueError):
pass
class SpaceNotFound(ValueError):
pass
class TooManyStreamsFound(ValueError):
pass
class NoStreamsFound(ValueError):
pass
class MissingRequiredConfig(ValueError):
... | class Maxretriesattempted(Exception):
pass
class Chartnotfound(ValueError):
pass
class Spacenotfound(ValueError):
pass
class Toomanystreamsfound(ValueError):
pass
class Nostreamsfound(ValueError):
pass
class Missingrequiredconfig(ValueError):
pass |
# Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
# Compile comprehensions as using their own inner scope
# (i.e. as lambdas).
COMPREHENSION_SCOPE = True
| comprehension_scope = True |
REQUEST_BASE = "http://{ip}:{port}{url}"
REQUEST_BASE_WITH_URL = "https://{base_url}{url}"
RESPONSE_OK = 200
RESPONSE_OK_WITH_NO_CONTENT = 204
RESPONSE_PARTIAL_OK = 206
RESPONSE_INVALID_INPUT = 400
RESPONSE_INTERNAL_ERROR = 500
MODEL_NOT_EXIST = {
"error": "model not exist"
}
TRAIN_DATA_NOT_EXIST = {
"error":... | request_base = 'http://{ip}:{port}{url}'
request_base_with_url = 'https://{base_url}{url}'
response_ok = 200
response_ok_with_no_content = 204
response_partial_ok = 206
response_invalid_input = 400
response_internal_error = 500
model_not_exist = {'error': 'model not exist'}
train_data_not_exist = {'error': 'index not e... |
class GopherStyleUriParser(UriParser):
"""
A customizable parser based on the Gopher scheme.
GopherStyleUriParser()
"""
def ZZZ(self):
"""hardcoded/mock instance of the class"""
return GopherStyleUriParser()
instance=ZZZ()
"""hardcoded/returns an instance of the class"""
| class Gopherstyleuriparser(UriParser):
"""
A customizable parser based on the Gopher scheme.
GopherStyleUriParser()
"""
def zzz(self):
"""hardcoded/mock instance of the class"""
return gopher_style_uri_parser()
instance = zzz()
'hardcoded/returns an instance of the class' |
class Solution:
def letterCombinations(self, digits: str) -> List[str]:
if not digits: return []
phone = ['', '', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']
def backtrack(combination, next_digits):
if not next_digits:
output.append(combination)
... | class Solution:
def letter_combinations(self, digits: str) -> List[str]:
if not digits:
return []
phone = ['', '', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz']
def backtrack(combination, next_digits):
if not next_digits:
output.append(co... |
#
# PySNMP MIB module PDN-MPE-DSLAM-SYSTEM-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/PDN-MPE-DSLAM-SYSTEM-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:39:19 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, constraints_union, constraints_intersection, single_value_constraint) ... |
__version__ = "0.7.5"
def exitIf(doExit, Exception, msg):
if doExit:
raise Exception(msg)
| __version__ = '0.7.5'
def exit_if(doExit, Exception, msg):
if doExit:
raise exception(msg) |
""" This is a library of standard chess pieces and functions showing the possible moves of each."""
def white_pawn(position):
attacked = {None}
capture = {None}
if (56 < position < 65):
print("You must promote to a new queen, rook, bishop or knight")
if (8 < position < 57):
attacked... | """ This is a library of standard chess pieces and functions showing the possible moves of each."""
def white_pawn(position):
attacked = {None}
capture = {None}
if 56 < position < 65:
print('You must promote to a new queen, rook, bishop or knight')
if 8 < position < 57:
attacked.add(pos... |
ERR_NOT_FOUND = b'\x6A\x88'
ERRORCODES = {
b'\x62\x83': "The card is locked", # in responce to select ISD command
b'\x63\x00': "Authentication of host cryptogram failed",
b'\x64\x00': "No specific diagnosis",
b'\x65\x81': "Memory failure",
b'\x67\x00': "Wrong length in Lc",
b'\x68\x81': "Logica... | err_not_found = b'j\x88'
errorcodes = {b'b\x83': 'The card is locked', b'c\x00': 'Authentication of host cryptogram failed', b'd\x00': 'No specific diagnosis', b'e\x81': 'Memory failure', b'g\x00': 'Wrong length in Lc', b'h\x81': 'Logical channel not supported or is not active', b'h\x82': 'Secure messaging not supporte... |
"""
Module: 'uwebsocket' on esp32 1.11.0
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-132-gc24d81119 on 2019-07-08', machine='ESP32 module with ESP32')
# Stubber: 1.2.0
class websocket:
''
def close():
pass
def ioctl():
pass
def read():
pass
... | """
Module: 'uwebsocket' on esp32 1.11.0
"""
class Websocket:
""""""
def close():
pass
def ioctl():
pass
def read():
pass
def readinto():
pass
def readline():
pass
def write():
pass |
def main():
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
b1 = l[:n//2]
b2 = l[n//2:]
if n%2==0:
print(n//2 -1)
else:
print(n//2)
i1 = 0
i2 = 0
for i in range(n):
if i%2==1:
print(b1[i1], end=' ')
i1 += 1
... | def main():
n = int(input())
l = list(map(int, input().split()))
l = sorted(l)
b1 = l[:n // 2]
b2 = l[n // 2:]
if n % 2 == 0:
print(n // 2 - 1)
else:
print(n // 2)
i1 = 0
i2 = 0
for i in range(n):
if i % 2 == 1:
print(b1[i1], end=' ')
... |
for variavel in range(1,6,1):
print(variavel)
| for variavel in range(1, 6, 1):
print(variavel) |
BOOT = [(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7),
(1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7),
(2, 0), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (2, 7),
(3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (3, 7),
(4, 0), (4, 1), (4, 2), ... | boot = [(0, 0), (0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (2, 0), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (2, 7), (3, 0), (3, 1), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), (3, 7), (4, 0), (4, 1), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), ... |
'''
Will sum all numbers typed infinitely, while the flag 999 isn't typed
'''
n = 0 # number
s = 0 # sum
c = 0 # counter
print('Type 999 to stop and get the result;')
n = int(input('Type a number: '))
while n != 999:
s = s + n
c += 1
n = int(input('Type other number: '))
print(f'The sum of the typed numb... | """
Will sum all numbers typed infinitely, while the flag 999 isn't typed
"""
n = 0
s = 0
c = 0
print('Type 999 to stop and get the result;')
n = int(input('Type a number: '))
while n != 999:
s = s + n
c += 1
n = int(input('Type other number: '))
print(f'The sum of the typed numbers were {s}.')
print(f'The ... |
{
'targets': [{
'target_name': 'wasi',
'sources': [
'src/binding.cc',
],
'cflags': [ '-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter', '-fno-exceptions' ],
'cflags_cc': [ '-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter', '-fno-exceptions' ],
}],
}
| {'targets': [{'target_name': 'wasi', 'sources': ['src/binding.cc'], 'cflags': ['-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter', '-fno-exceptions'], 'cflags_cc': ['-Werror', '-Wall', '-Wextra', '-Wpedantic', '-Wunused-parameter', '-fno-exceptions']}]} |
class PangramChecker(object):
def __init__(self):
pass
def checkIfPangram(self,pangramContender):
target = []
for i in range(97,97+26):
target.append(chr(i))
print("\n> '"+pangramContender+"'")
test = pangramContender # defensiv... | class Pangramchecker(object):
def __init__(self):
pass
def check_if_pangram(self, pangramContender):
target = []
for i in range(97, 97 + 26):
target.append(chr(i))
print("\n> '" + pangramContender + "'")
test = pangramContender
test = test.replace(' ... |
# First 3 digits
first = ['00[1-9]','0[1-9][0-9]','[1-5][0-9][0-9]','6[0-5][0-9]','66[0-5]','66[7-9]','6[7-9][0-9]','[7-8][0-9][0-9]']
# /00[1-9]|
# 0[1-9][0-9]|
# [1-5][0-9][0-9]|
# 6[0-5][0-9]|
# 66[0-5]|
# 66[7-9]|
# 6[7-9][0-9]|
# [7-8][0-9][0-9]/
# Middle 2 digits
middle = ['[0-9... | first = ['00[1-9]', '0[1-9][0-9]', '[1-5][0-9][0-9]', '6[0-5][0-9]', '66[0-5]', '66[7-9]', '6[7-9][0-9]', '[7-8][0-9][0-9]']
middle = ['[0-9][1-9]', '[1-9][0-9]']
last = ['[0-9][0-9][0-9][1-9]', '[0-9][0-9][1-9][0-9]', '[0-9][1-9][0-9][0-9]', '[1-9][0-9][0-9][0-9]']
dash = '\\-?'
for a in first:
for b in middle:
... |
class EnvConfiguration:
def __init__(self, encoding, agent_pos, agent_dir, goal_pos, carrying):
self.encoding, self.agent_pos, self.agent_dir, self.goal_pos, self.carrying = encoding, agent_pos, agent_dir, goal_pos, carrying
def get_configuration(self):
return self.encoding, self.agent_pos, self... | class Envconfiguration:
def __init__(self, encoding, agent_pos, agent_dir, goal_pos, carrying):
(self.encoding, self.agent_pos, self.agent_dir, self.goal_pos, self.carrying) = (encoding, agent_pos, agent_dir, goal_pos, carrying)
def get_configuration(self):
return (self.encoding, self.agent_po... |
class Solution:
def pancakeSort(self, A):
"""
:type A: List[int]
:rtype: List[int]
"""
if not A:
return []
mx = max(A)
if A[-1] == mx:
return self.pancakeSort(A[:-1])
else:
idx = A.index(mx)
A[:idx + 1] =... | class Solution:
def pancake_sort(self, A):
"""
:type A: List[int]
:rtype: List[int]
"""
if not A:
return []
mx = max(A)
if A[-1] == mx:
return self.pancakeSort(A[:-1])
else:
idx = A.index(mx)
A[:idx + 1]... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=undefined-variable, unused-argument, function-redefined
@given('we have behave installed')
def step_impl(context):
pass
@when('we implement a test')
def step_impl(context):
assert True is not False
@then('behave will test it for us!')
def ste... | @given('we have behave installed')
def step_impl(context):
pass
@when('we implement a test')
def step_impl(context):
assert True is not False
@then('behave will test it for us!')
def step_impl(context):
assert context.failed is False |
"""2020-06-04 migration"""
name = "20200406_users_collection"
dependencies = ['20201105_initial']
def upgrade(db):
db.create_collection('users')
| """2020-06-04 migration"""
name = '20200406_users_collection'
dependencies = ['20201105_initial']
def upgrade(db):
db.create_collection('users') |
analyses = {
'disc': {
'uniform': [
0.468877,
0.332034,
0.259316,
0.233952,
0.211749,
0.192004,
0.178491,
0.170319,
0.159315,
0.149968,
0.143227,
0.13512,
0.129949,
0.12344,
0.120321,
0.11659,
0.112459,
0.109368,
0.106636,
0.104736,
0.102531,
0.099388... | analyses = {'disc': {'uniform': [0.468877, 0.332034, 0.259316, 0.233952, 0.211749, 0.192004, 0.178491, 0.170319, 0.159315, 0.149968, 0.143227, 0.13512, 0.129949, 0.12344, 0.120321, 0.11659, 0.112459, 0.109368, 0.106636, 0.104736, 0.102531, 0.0993883, 0.0973859, 0.095242, 0.0938528, 0.0913264, 0.0901231, 0.0884946, 0.08... |
a, b = map(int, input().split())
if abs(a) == abs(b):
print('Draw')
elif abs(a) > abs(b):
print('Bug')
else:
print('Ant')
| (a, b) = map(int, input().split())
if abs(a) == abs(b):
print('Draw')
elif abs(a) > abs(b):
print('Bug')
else:
print('Ant') |
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 4 20:48:38 2018
@author: James Jiang
"""
all_lines = [line.rstrip('\n') for line in open('Data.txt')]
all_containers = [int(i) for i in all_lines]
all_containers.sort(reverse=True)
total_number = 2**(len(all_containers))
count = 0
min_nums = []
i = 0
while i < total_... | """
Created on Thu Jan 4 20:48:38 2018
@author: James Jiang
"""
all_lines = [line.rstrip('\n') for line in open('Data.txt')]
all_containers = [int(i) for i in all_lines]
all_containers.sort(reverse=True)
total_number = 2 ** len(all_containers)
count = 0
min_nums = []
i = 0
while i < total_number:
number_bin = bin... |
###############################################################################
# Licensed Materials - Property of IBM
# ZOSLIB
# (C) Copyright IBM Corp. 2020. All Rights Reserved.
# US Government Users Restricted Rights - Use, duplication
# or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
#########... | {'targets': [{'target_name': 'zoslib', 'type': 'static_library', 'defines': ['_UNIX03_THREADS', '_UNIX03_SOURCE', '_UNIX03_WITHDRAWN', '_OPEN_SYS_IF_EXT', '_OPEN_SYS_SOCK_IPV6', '_OPEN_MSGQ_EXT', '_XOPEN_SOURCE_EXTENDED', '_ALL_SOURCE', '_LARGE_TIME_API', '_OPEN_SYS_FILE_EXT', '_AE_BIMODAL', 'PATH_MAX=1023', '_ENHANCED... |
expected_output = {
"vrf": {
"local_ldp_identifier": "10.94.1.1:0",
"vrfs": [
{
"vrf_name": "default",
"interfaces": [
{
"interface": "TenGigE0/3/0/0",
"xmit": "True",
... | expected_output = {'vrf': {'local_ldp_identifier': '10.94.1.1:0', 'vrfs': [{'vrf_name': 'default', 'interfaces': [{'interface': 'TenGigE0/3/0/0', 'xmit': 'True', 'recv': 'True', 'vrf_hex': '0x60000000', 'source_ip_addr': '10.120.0.1', 'transport_ip_addr': '10.94.1.1', 'hello_interval_ms': '5000', 'hello_due_time_ms': '... |
# generated from genmsg/cmake/pkg-genmsg.context.in
messages_str = "/root/ros_catkin_ws/src/ros_comm/roscpp/msg/Logger.msg"
services_str = "/root/ros_catkin_ws/src/ros_comm/roscpp/srv/Empty.srv;/root/ros_catkin_ws/src/ros_comm/roscpp/srv/GetLoggers.srv;/root/ros_catkin_ws/src/ros_comm/roscpp/srv/SetLoggerLevel.srv"
pk... | messages_str = '/root/ros_catkin_ws/src/ros_comm/roscpp/msg/Logger.msg'
services_str = '/root/ros_catkin_ws/src/ros_comm/roscpp/srv/Empty.srv;/root/ros_catkin_ws/src/ros_comm/roscpp/srv/GetLoggers.srv;/root/ros_catkin_ws/src/ros_comm/roscpp/srv/SetLoggerLevel.srv'
pkg_name = 'roscpp'
dependencies_str = ''
langs = 'genc... |
class ClimbingRoute:
def __init__(self, name: str, length: int, grade: str):
self.name = name
self.length = length
self.grade = grade
def __str__(self):
return f"{self.name}, length {self.length} metres, grade {self.grade}"
class ClimbingArea:
def __init__(self, name: str):... | class Climbingroute:
def __init__(self, name: str, length: int, grade: str):
self.name = name
self.length = length
self.grade = grade
def __str__(self):
return f'{self.name}, length {self.length} metres, grade {self.grade}'
class Climbingarea:
def __init__(self, name: str... |
# Site meta
SITE_NAME = 'Xolentum Web Wallet'
PROJECT_NAME = 'The Xolentum Project'
PROJECT_WEB = 'https://www.xolentum.org'
# Daemon
DAEMON_PROTO = 'http'
DAEMON_HOST = 'localhost'
DAEMON_PORT = 13580
DAEMON_USER = ''
DAEMON_PASS = ''
# Wallets
WALLET_DIR = './data/wallets'
XOLENTUM_IMAGE = 'xolentum/xolentum:latest... | site_name = 'Xolentum Web Wallet'
project_name = 'The Xolentum Project'
project_web = 'https://www.xolentum.org'
daemon_proto = 'http'
daemon_host = 'localhost'
daemon_port = 13580
daemon_user = ''
daemon_pass = ''
wallet_dir = './data/wallets'
xolentum_image = 'xolentum/xolentum:latest'
password_salt = 'salt here'
sec... |
"""
[E] We are given an unsorted array containing 'n+1' numbers taken from the range 1 to n.
The array has only one duplicate but it can be repeated multiple times. Find that
duplicate number without using any extra space. You are, however, allowed to modify
the input array.
Example 1:
Input: [1, 4, 4, 3, 2]
Out... | """
[E] We are given an unsorted array containing 'n+1' numbers taken from the range 1 to n.
The array has only one duplicate but it can be repeated multiple times. Find that
duplicate number without using any extra space. You are, however, allowed to modify
the input array.
Example 1:
Input: [1, 4, 4, 3, 2]
Outpu... |
# Source : https://leetcode.com/problems/implement-strstr/
# Author : William Heryanto
# Date : 2021-02-01
###############################################################################
#
# Implement strStr().
#
# Return the index of the first occurrence of needle in haystack, or `-1` if
# `needle` is not part of `... | class Solution:
def str_str(self, haystack: str, needle: str) -> int:
if not needle:
return 0
len_n = len(needle)
len_h = len(haystack)
for i in range(len_h - len_n + 1):
if haystack[i:i + len_n] == needle:
return i
return -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.