content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class FindSumPairs:
def __init__(self, nums1: List[int], nums2: List[int]):
self.nums1 = nums1
self.nums2 = nums2
self.count2 = Counter(nums2)
def add(self, index: int, val: int) -> None:
self.count2[self.nums2[index]] -= 1
self.nums2[index] += val
self.count2[self.nums2[index]] += 1
def... | class Findsumpairs:
def __init__(self, nums1: List[int], nums2: List[int]):
self.nums1 = nums1
self.nums2 = nums2
self.count2 = counter(nums2)
def add(self, index: int, val: int) -> None:
self.count2[self.nums2[index]] -= 1
self.nums2[index] += val
self.count2[s... |
def main(request, response):
name = request.GET.first("name")
source_origin = request.headers.get("origin", None);
response.headers.set("Set-Cookie", name + "=value")
response.headers.set("Access-Control-Allow-Origin", source_origin)
response.headers.set("Access-Control-Allow-Credentials", "true")
| def main(request, response):
name = request.GET.first('name')
source_origin = request.headers.get('origin', None)
response.headers.set('Set-Cookie', name + '=value')
response.headers.set('Access-Control-Allow-Origin', source_origin)
response.headers.set('Access-Control-Allow-Credentials', 'true') |
__all__ = ("InputDataError",)
class InputDataError(ValueError):
pass
| __all__ = ('InputDataError',)
class Inputdataerror(ValueError):
pass |
# 04. Forum Topics
line = input()
forum_dict = {}
# def unique(sequence):
# seen = set()
# return [x for x in sequence if not(x in seen or seen.add(x))]
while not line == "filter":
words = line.split(" -> ")
topic = words[0]
hashtags = words[1].split(", ")
if topic not in forum_dict.keys():
... | line = input()
forum_dict = {}
while not line == 'filter':
words = line.split(' -> ')
topic = words[0]
hashtags = words[1].split(', ')
if topic not in forum_dict.keys():
forum_dict[topic] = hashtags
else:
forum_dict[topic].extend(hashtags)
line = input()
sequence = set(input().sp... |
n=int(input())%2
if n==0:
print("White")
else:
print("Black") | n = int(input()) % 2
if n == 0:
print('White')
else:
print('Black') |
{
'targets' : [
{
'target_name' : 'hdfs3_bindings',
'sources' : [
'src/addon.cc',
'src/HDFileSystem.cc',
'src/HDFile.cc'
],
'xcode_settings': {
'OTHER_CFLAGS': ['-Wno-unused-parameter', '-Wno-unus... | {'targets': [{'target_name': 'hdfs3_bindings', 'sources': ['src/addon.cc', 'src/HDFileSystem.cc', 'src/HDFile.cc'], 'xcode_settings': {'OTHER_CFLAGS': ['-Wno-unused-parameter', '-Wno-unused-result']}, 'cflags': ['-Wall', '-Wextra', '-Wno-unused-parameter', '-Wno-unused-result'], 'include_dirs': ['<!(node -e "require(\'... |
expected_output = {
"max_num_of_service_instances": 32768,
"service_instance": {
2051: {
"pkts_out": 0,
"pkts_in": 0,
"interface": "GigabitEthernet0/0/5",
"bytes_in": 0,
"bytes_out": 0,
},
2052: {
"pkts_out": 0,
... | expected_output = {'max_num_of_service_instances': 32768, 'service_instance': {2051: {'pkts_out': 0, 'pkts_in': 0, 'interface': 'GigabitEthernet0/0/5', 'bytes_in': 0, 'bytes_out': 0}, 2052: {'pkts_out': 0, 'pkts_in': 0, 'interface': 'GigabitEthernet0/0/5', 'bytes_in': 0, 'bytes_out': 0}, 2053: {'pkts_out': 0, 'pkts_in'... |
# Generated by h2py from /usr/include/sys/socket.h
NC_TPI_CLTS = 1
NC_TPI_COTS = 2
NC_TPI_COTS_ORD = 3
NC_TPI_RAW = 4
SOCK_STREAM = NC_TPI_COTS
SOCK_DGRAM = NC_TPI_CLTS
SOCK_RAW = NC_TPI_RAW
SOCK_RDM = 5
SOCK_SEQPACKET = 6
SO_DEBUG = 0x0001
SO_ACCEPTCONN = 0x0002
SO_REUSEADDR = 0x0004
SO_KEEPALIVE = 0x0008
SO_DONTROUTE... | nc_tpi_clts = 1
nc_tpi_cots = 2
nc_tpi_cots_ord = 3
nc_tpi_raw = 4
sock_stream = NC_TPI_COTS
sock_dgram = NC_TPI_CLTS
sock_raw = NC_TPI_RAW
sock_rdm = 5
sock_seqpacket = 6
so_debug = 1
so_acceptconn = 2
so_reuseaddr = 4
so_keepalive = 8
so_dontroute = 16
so_broadcast = 32
so_useloopback = 64
so_linger = 128
so_oobinlin... |
pkgname = "xev"
pkgver = "1.2.4"
pkgrel = 0
build_style = "gnu_configure"
hostmakedepends = ["pkgconf"]
makedepends = ["libxrandr-devel"]
pkgdesc = "Display X events"
maintainer = "q66 <q66@chimera-linux.org>"
license = "MIT"
url = "https://xorg.freedesktop.org"
source = f"$(XORG_SITE)/app/{pkgname}-{pkgver}.tar.bz2"
s... | pkgname = 'xev'
pkgver = '1.2.4'
pkgrel = 0
build_style = 'gnu_configure'
hostmakedepends = ['pkgconf']
makedepends = ['libxrandr-devel']
pkgdesc = 'Display X events'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'MIT'
url = 'https://xorg.freedesktop.org'
source = f'$(XORG_SITE)/app/{pkgname}-{pkgver}.tar.bz2'
s... |
class SectionModel(Query):
def __init__(self, db):
self.db = db
self.table_name = "section"
super(SectionModel, self).__init__() | class Sectionmodel(Query):
def __init__(self, db):
self.db = db
self.table_name = 'section'
super(SectionModel, self).__init__() |
funcs = [
"abs", "all", "any", "ascii", "bin", "callable", "chr", "compile",
"delattr", "dir", "divmod", "eval", "exec", "exit", "format", "getattr",
"globals", "hasattr", "hash", "help", "hex", "id", "input", "isinstance",
"issubclass", "iter", "len", "locals", "max", "min", "next", "oct",
"open", ... | funcs = ['abs', 'all', 'any', 'ascii', 'bin', 'callable', 'chr', 'compile', 'delattr', 'dir', 'divmod', 'eval', 'exec', 'exit', 'format', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'isinstance', 'issubclass', 'iter', 'len', 'locals', 'max', 'min', 'next', 'oct', 'open', 'ord', 'pow', 'print'... |
#
# PySNMP MIB module CISCO-STP-EXTENSIONS-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-STP-EXTENSIONS-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:56:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.... | (integer, octet_string, object_identifier) = mibBuilder.importSymbols('ASN1', 'Integer', 'OctetString', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, single_value_constraint, constraints_union, value_range_constraint, constraints_intersection) ... |
class ParseException(Exception):
pass
class RollbackException(Exception):
pass
| class Parseexception(Exception):
pass
class Rollbackexception(Exception):
pass |
lista=[]
datos=int(input("Ingrese numero de datos: "))
for i in range(0,datos):
alt=float(input("Ingrese las alturas: "))
lista.append(alt)
print("La altura maxima es: ", max(lista)) | lista = []
datos = int(input('Ingrese numero de datos: '))
for i in range(0, datos):
alt = float(input('Ingrese las alturas: '))
lista.append(alt)
print('La altura maxima es: ', max(lista)) |
#
# Building script for ipcamera application
#
{
'includes': ['build/common.gypi'],
'targets' : [
{
'target_name': 'camerartc',
'type': 'executable',
'include_dirs': [
'../third_party/webrtc/modules/interface',
],
'dependencies': [
'libjing... | {'includes': ['build/common.gypi'], 'targets': [{'target_name': 'camerartc', 'type': 'executable', 'include_dirs': ['../third_party/webrtc/modules/interface'], 'dependencies': ['libjingle.gyp:libjingle_peerconnection', '<(DEPTH)/third_party/jsoncpp/jsoncpp.gyp:jsoncpp'], 'sources': ['camerartc/main.cpp', 'camerartc/pee... |
# -*- coding: utf-8 -*-
def test_del_first_group(app):
app.session.login(username = "admin", password = "secret")
app.group.delete_first_group()
app.session.logout() | def test_del_first_group(app):
app.session.login(username='admin', password='secret')
app.group.delete_first_group()
app.session.logout() |
class DataNotFound(RuntimeError):
pass
class DataError(RuntimeError):
pass
class InvalidAge(RuntimeError):
pass
class InvalidMeasurement(RuntimeError):
pass | class Datanotfound(RuntimeError):
pass
class Dataerror(RuntimeError):
pass
class Invalidage(RuntimeError):
pass
class Invalidmeasurement(RuntimeError):
pass |
# check modulo matches python definition
# this tests compiler constant folding
print(123 % 7)
print(-123 % 7)
print(123 % -7)
print(-123 % -7)
a = 321
b = 19
print(a % b)
print(a % -b)
print(-a % b)
print(-a % -b)
a = 987654321987987987987987987987
b = 19
print(a % b)
print(a % -b)
print(-a % b)
print(-a % -b)
| print(123 % 7)
print(-123 % 7)
print(123 % -7)
print(-123 % -7)
a = 321
b = 19
print(a % b)
print(a % -b)
print(-a % b)
print(-a % -b)
a = 987654321987987987987987987987
b = 19
print(a % b)
print(a % -b)
print(-a % b)
print(-a % -b) |
class Judge:
def __init__(self, trial, comparator):
self.trial = trial
self.comparator = comparator
def judge(self, inputs, default):
results = {input: self.trial(input) for input in inputs}
eligible = {input: result for input, result in results.items() if result is not None}
... | class Judge:
def __init__(self, trial, comparator):
self.trial = trial
self.comparator = comparator
def judge(self, inputs, default):
results = {input: self.trial(input) for input in inputs}
eligible = {input: result for (input, result) in results.items() if result is not None}... |
class Solution:
def rob(self, nums: List[int]) -> int:
if len(nums) == 0:
return 0
elif len(nums) == 1:
return nums[0]
elif len(nums) == 2:
return max(nums[0], nums[1])
scores = [0] * len(nums)
scores[0] = nums[0]
scores[1] = n... | class Solution:
def rob(self, nums: List[int]) -> int:
if len(nums) == 0:
return 0
elif len(nums) == 1:
return nums[0]
elif len(nums) == 2:
return max(nums[0], nums[1])
scores = [0] * len(nums)
scores[0] = nums[0]
scores[1] = nums[... |
class BinarySearchTree:
class Node:
def __init__(self, value):
self.left = None
self.right = None
self.value = value
def __init__(self):
self.root = None
def add(self, value):
if self.root:
self._add(value, self.root)
... | class Binarysearchtree:
class Node:
def __init__(self, value):
self.left = None
self.right = None
self.value = value
def __init__(self):
self.root = None
def add(self, value):
if self.root:
self._add(value, self.root)
else:
... |
# program to find whether it contains an additive sequence or not.
class Solution(object):
# DFS: iterative implement.
def is_additive_number(self, num):
length = len(num)
for i in range(1, int(length/2+1)):
for j in range(1, int((length-i)/2 + 1)):
first, second, others ... | class Solution(object):
def is_additive_number(self, num):
length = len(num)
for i in range(1, int(length / 2 + 1)):
for j in range(1, int((length - i) / 2 + 1)):
(first, second, others) = (num[:i], num[i:i + j], num[i + j:])
if self.isValid(first, second... |
class Solution:
def backspaceCompare(self, S: str, T: str) -> bool:
s = []; t = []
for i in range(len(S)):
if S[i] == "#":
if len(s) > 0:
s.pop(-1)
else:
s.append(S[i])
for i in range(len(T)):
if T[i] == ... | class Solution:
def backspace_compare(self, S: str, T: str) -> bool:
s = []
t = []
for i in range(len(S)):
if S[i] == '#':
if len(s) > 0:
s.pop(-1)
else:
s.append(S[i])
for i in range(len(T)):
if... |
N = int(input())
before = input()
after = input()
if N % 2 == 0:
print("Deletion succeeded" if before == after else "Deletion failed")
else:
find = True
for i in range(len(before)):
if before[i] == after[i]:
find = False
break
print("Deletion succeeded" if find else "Del... | n = int(input())
before = input()
after = input()
if N % 2 == 0:
print('Deletion succeeded' if before == after else 'Deletion failed')
else:
find = True
for i in range(len(before)):
if before[i] == after[i]:
find = False
break
print('Deletion succeeded' if find else 'Dele... |
class Actor:
def __init__(self, sess, learning_rate,action_dim,action_bound):
self.sess = sess
self.action_dim = action_dim
self.action_bound = action_bound
self.learning_rate = learning_rate
# input current state, output action to be taken
self.a = self.build_neural... | class Actor:
def __init__(self, sess, learning_rate, action_dim, action_bound):
self.sess = sess
self.action_dim = action_dim
self.action_bound = action_bound
self.learning_rate = learning_rate
self.a = self.build_neural_network(S, scope='eval_nn', trainable=True)
se... |
class ParserError(Exception):
pass
| class Parsererror(Exception):
pass |
r = int(input())
w = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
m = [0]
for i in range(1, r + 1):
m.append(max([x[0] + m[i - x[1]] for x in zip(c, w) if x[1] <= i], default = 0))
print(m)
| r = int(input())
w = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
m = [0]
for i in range(1, r + 1):
m.append(max([x[0] + m[i - x[1]] for x in zip(c, w) if x[1] <= i], default=0))
print(m) |
'''"Template" day module for AoC 2015'''
def run(args):
print(f'day0: {args}')
| """"Template" day module for AoC 2015"""
def run(args):
print(f'day0: {args}') |
'''
@Author: Hata
@Date: 2020-07-26 03:41:32
@LastEditors: Hata
@LastEditTime: 2020-07-28 21:31:17
@FilePath: \LeetCode\116.py
@Description: https://leetcode-cn.com/problems/populating-next-right-pointers-in-each-node/
'''
class Solution:
def connect(self, root: 'Node') -> 'Node':
if root is None:
... | """
@Author: Hata
@Date: 2020-07-26 03:41:32
@LastEditors: Hata
@LastEditTime: 2020-07-28 21:31:17
@FilePath: \\LeetCodeN.py
@Description: https://leetcode-cn.com/problems/populating-next-right-pointers-in-each-node/
"""
class Solution:
def connect(self, root: 'Node') -> 'Node':
if root is None:
... |
class Solution:
# Iterative
def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
if not root:
return None
stack = [root]
while len(stack) > 0:
currentNode = stack.pop()
currentNode.left, currentNode.right = currentNode.right,... | class Solution:
def invert_tree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
if not root:
return None
stack = [root]
while len(stack) > 0:
current_node = stack.pop()
(currentNode.left, currentNode.right) = (currentNode.right, currentNode.left)
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
# A number n is called deficient if the sum... | class Abundant:
def __init__(self):
self.abundants = []
def generate_abindant_numbers(self, maxValue):
for number in range(maxValue):
if number % 1000 == 0:
print('GEN: itt jarunk:', number)
total = 0
for divisor in range(1, number / 2 + 1):
... |
def returnHazards(map):
hazards = []
for x_index, x in enumerate(map):
for y_index, y in enumerate(x):
if y == 'x':
hazards.append({"x":x_index,"y":y_index})
return hazards | def return_hazards(map):
hazards = []
for (x_index, x) in enumerate(map):
for (y_index, y) in enumerate(x):
if y == 'x':
hazards.append({'x': x_index, 'y': y_index})
return hazards |
result = 0
boxIds = []
with open("input.txt", "r") as input:
for line in input:
line = line.strip()
boxIds.append(line)
count2 = 0
count3 = 0
for boxId in boxIds:
flag2 = True
flag3 = True
for c in set(boxId):
n = boxId.count(c)
if n == 2 and flag2:
count2 +... | result = 0
box_ids = []
with open('input.txt', 'r') as input:
for line in input:
line = line.strip()
boxIds.append(line)
count2 = 0
count3 = 0
for box_id in boxIds:
flag2 = True
flag3 = True
for c in set(boxId):
n = boxId.count(c)
if n == 2 and flag2:
count2 +... |
class Solution(object):
def XXX(self, n):
g5=5**0.5
b=(((1+g5)/2)**(n+1)-((1-g5)/2)**(n+1))/g5
return int(round(b))
| class Solution(object):
def xxx(self, n):
g5 = 5 ** 0.5
b = (((1 + g5) / 2) ** (n + 1) - ((1 - g5) / 2) ** (n + 1)) / g5
return int(round(b)) |
names = []
addr = 0x148 + 0x4E4
while addr <= 0x148 + 0x7FC:
names.append('\t' + Name(Dword(addr)) + ' = ')
addr += 8
with open('names.txt', 'w') as f:
f.write('\n'.join(names))
| names = []
addr = 328 + 1252
while addr <= 328 + 2044:
names.append('\t' + name(dword(addr)) + ' = ')
addr += 8
with open('names.txt', 'w') as f:
f.write('\n'.join(names)) |
prenom = input("Votre prenom svp ")
langue = input("Votre langue: ") # Langue devait etre "francais" ou "anglais"
if langue == "francais":
print("Bonjour %s" % prenom)
elif langue == "anglais":
print("Hello %s" % prenom)
else:
print("ERREUR")
| prenom = input('Votre prenom svp ')
langue = input('Votre langue: ')
if langue == 'francais':
print('Bonjour %s' % prenom)
elif langue == 'anglais':
print('Hello %s' % prenom)
else:
print('ERREUR') |
class Solution:
# @param A : list of list of integers
# @return an integer
def cnt(self, A, mid):
l = 0
r = len(A)-1
while l <= r:
m = (l+r)//2
if A[m] <= mid:
l = m+1
else:
r = m-1
return l
def findMed... | class Solution:
def cnt(self, A, mid):
l = 0
r = len(A) - 1
while l <= r:
m = (l + r) // 2
if A[m] <= mid:
l = m + 1
else:
r = m - 1
return l
def find_median(self, A):
l = 1
r = 1000000000
... |
# raider.io api configuration
RIO_MAX_PAGE = 5
# need to update in templates/stats_table.html
# need to update in templates/compositions.html
# need to update in templates/navbar.html
RIO_SEASON = "season-sl-3"
WCL_SEASON = 3
WCL_PARTITION = 1
# config
RAID_NAME = "Sepulcher of the First Ones"
# for heroic week,... | rio_max_page = 5
rio_season = 'season-sl-3'
wcl_season = 3
wcl_partition = 1
raid_name = 'Sepulcher of the First Ones'
min_key_level = 16
max_raid_difficulty = 'Mythic' |
__all__ = [
'plotting',
'misc',
'colors',
'tables',
'nodes',
'containers',
'values',
'basic',
'textures',
'drawing',
]
__version__ = '1.1.1'
| __all__ = ['plotting', 'misc', 'colors', 'tables', 'nodes', 'containers', 'values', 'basic', 'textures', 'drawing']
__version__ = '1.1.1' |
'''
Q: Popular star patterns
Pattern 1:
*
**
***
****
*****
******
Pattern 2:
* * * * * *
* * * * *
* * * *
* * *
* *
*
Pattern 3:
*
***
*****
*******
*********
Pattern 4:
*
... | """
Q: Popular star patterns
Pattern 1:
*
**
***
****
*****
******
Pattern 2:
* * * * * *
* * * * *
* * * *
* * *
* *
*
Pattern 3:
*
***
*****
*******
*********
Pattern 4:
*
... |
class Guild:
__slots__ = ('id', 'name', 'icon', 'owner', 'client_is_owner', 'permissions', 'region', 'afk_channel',
'afk_timeout', 'verification_level', 'roles', 'emojis', 'system_channel', 'features',
'mfa_level', 'created', 'large', 'member_count', 'voice_states', 'members', 'chann... | class Guild:
__slots__ = ('id', 'name', 'icon', 'owner', 'client_is_owner', 'permissions', 'region', 'afk_channel', 'afk_timeout', 'verification_level', 'roles', 'emojis', 'system_channel', 'features', 'mfa_level', 'created', 'large', 'member_count', 'voice_states', 'members', 'channels', 'max_members', 'vanity_url... |
q_data = [
{"question": "Japan was part of the Allied Powers during World War I.", "correct_answer": "True",
"incorrect_answers": ["False"]}, {"category": "History", "type": "boolean", "difficulty": "easy",
"question": "The Tiananmen Square protests of 1989 were held in H... | q_data = [{'question': 'Japan was part of the Allied Powers during World War I.', 'correct_answer': 'True', 'incorrect_answers': ['False']}, {'category': 'History', 'type': 'boolean', 'difficulty': 'easy', 'question': 'The Tiananmen Square protests of 1989 were held in Hong Kong.', 'correct_answer': 'False', 'incorrect... |
def func(s):
one = 0
zero = 0
for i in range(len(s)):
if i > 0 and s[i] == s[i-1] : continue
if s[i] == "1":
one += 1
else :
zero += 1
return min(one,zero)
s = input()
print(func(s))
| def func(s):
one = 0
zero = 0
for i in range(len(s)):
if i > 0 and s[i] == s[i - 1]:
continue
if s[i] == '1':
one += 1
else:
zero += 1
return min(one, zero)
s = input()
print(func(s)) |
# n points
def lerp_line(pt0, pt1, n):
pts = []
for i in range(n + 1):
t = i / float(n)
pt = pt0 * t + pt1 * (1.0 - t)
pts.append(pt)
return pts
def pole_to_lines(pt0, pt1, color=[0, 255, 0], n=20):
lines = []
pts = lerp_line(pt0, pt1, n)
for pt in pts:
lines.ap... | def lerp_line(pt0, pt1, n):
pts = []
for i in range(n + 1):
t = i / float(n)
pt = pt0 * t + pt1 * (1.0 - t)
pts.append(pt)
return pts
def pole_to_lines(pt0, pt1, color=[0, 255, 0], n=20):
lines = []
pts = lerp_line(pt0, pt1, n)
for pt in pts:
lines.append([pt[0],... |
class MetaData:
'''
convert to dynamically adding attributes by passing in **kwargs and
setting each key value pair
attention will need to be given for when this class is used in other processes
to make sure they know the attributes that exists with each class
however, not necessary just now
... | class Metadata:
"""
convert to dynamically adding attributes by passing in **kwargs and
setting each key value pair
attention will need to be given for when this class is used in other processes
to make sure they know the attributes that exists with each class
however, not necessary just now
... |
# A non-empty zero-indexed array A consisting of N integers is given.
#
# A permutation is a sequence containing each element from 1 to N once, and
# only once.
#
# For example, array A such that:
# A = [4, 1, 3, 2]
# is a permutation, but array A such that:
# A = [4, 1, 3]
# is not a permutation, because value... | def solution(A):
n = len(A)
if N == 1:
if A[0] == 1:
return 1
else:
return 0
count = {}
for i in range(N):
if A[i] not in count:
count[A[i]] = 0
count[A[i]] += 1
if count[A[i]] > 1:
return 0
values = count.keys()... |
while(True):
jars = [int(x) for x in input().split()]
if sum(jars) == 0:
break
if sum(jars) == 13:
print("Never speak again.")
elif jars[0] > jars[1]:
print("To the convention.")
elif jars[1] > jars[0]:
print("Left beehind.")
elif jars[1] == jars[0]:
print... | while True:
jars = [int(x) for x in input().split()]
if sum(jars) == 0:
break
if sum(jars) == 13:
print('Never speak again.')
elif jars[0] > jars[1]:
print('To the convention.')
elif jars[1] > jars[0]:
print('Left beehind.')
elif jars[1] == jars[0]:
print(... |
DATE_PATTERNS = ["%d.%m.%Y", "%Y-%m-%d", "%y-%m-%d", "%Y-%m-%dT%H:%M:%S",
"%Y-%m-%d %H:%M:%S",
"%d.%m.%Y %H:%M"]
DEFAULT_DICT_SHARE = 70
SUPPORTED_FILE_TYPES = ['xls', 'xlsx', 'csv', 'xml', 'json', 'jsonl', 'yaml', 'tsv', 'sql', 'bson']
DEFAULT_OPTIONS = {'encoding' : 'utf8',
... | date_patterns = ['%d.%m.%Y', '%Y-%m-%d', '%y-%m-%d', '%Y-%m-%dT%H:%M:%S', '%Y-%m-%d %H:%M:%S', '%d.%m.%Y %H:%M']
default_dict_share = 70
supported_file_types = ['xls', 'xlsx', 'csv', 'xml', 'json', 'jsonl', 'yaml', 'tsv', 'sql', 'bson']
default_options = {'encoding': 'utf8', 'delimiter': ',', 'limit': 1000} |
'''
This solution was submitted by Team: eyeCoders_UOP
during ACES Coders v8 2020
Team lead: Rusiru Thushara thusharakart@gmail.com
The solution runs in O(n)
'''
def getline():return [float(x) for x in input().strip().split(' ')]
c,e,n,s0 = getline()
arr, lst = [], []
m = c/s0
for i in range(int(n)):
x,s = ... | """
This solution was submitted by Team: eyeCoders_UOP
during ACES Coders v8 2020
Team lead: Rusiru Thushara thusharakart@gmail.com
The solution runs in O(n)
"""
def getline():
return [float(x) for x in input().strip().split(' ')]
(c, e, n, s0) = getline()
(arr, lst) = ([], [])
m = c / s0
for i in range(in... |
# TODO: Make this a relative path
local_url = "/home/garrison/Code/blogengine/output"
remote_url = "http://www.example.com"
site_title = "My Vanilla Blog"
site_description = "The really cool blog in which I write about stuff"
copy_rst = False
disqus_shortname = "mydisqusshortname"
| local_url = '/home/garrison/Code/blogengine/output'
remote_url = 'http://www.example.com'
site_title = 'My Vanilla Blog'
site_description = 'The really cool blog in which I write about stuff'
copy_rst = False
disqus_shortname = 'mydisqusshortname' |
in_code = 'abcdefghijklmnopqrstuvwxyz'
out_code = '9128645!@#$%^&*()/.,;:~|[]'
code = str.maketrans(in_code, out_code)
print('this is encrypted!'.translate(code))
| in_code = 'abcdefghijklmnopqrstuvwxyz'
out_code = '9128645!@#$%^&*()/.,;:~|[]'
code = str.maketrans(in_code, out_code)
print('this is encrypted!'.translate(code)) |
# Question:5
countNumber = input("Enter the string ")
print ("Original string is : " + countNumber)
res = len(countNumber.split())
print ("Number of words in string is : " + str(res))
| count_number = input('Enter the string ')
print('Original string is : ' + countNumber)
res = len(countNumber.split())
print('Number of words in string is : ' + str(res)) |
class Solution:
def __init__(self):
self.result = None
def findMax(self, root):
if root == None:
return 0
# find max for left and right node
left = self.findMax(root.left)
right = self.findMax(root.right)
# can either go straight down i.e. from root... | class Solution:
def __init__(self):
self.result = None
def find_max(self, root):
if root == None:
return 0
left = self.findMax(root.left)
right = self.findMax(root.right)
max_straight = max(max(left, right) + root.val, root.val)
max_curved = max(left... |
class DatasetVO:
def __init__(self):
self._id = None
self._name = ""
self._folder = ""
self._description = ""
self._data_type = ""
self._size = 0
self._count = 0
@property
def count(self):
return self._count
@count.setter
def count(se... | class Datasetvo:
def __init__(self):
self._id = None
self._name = ''
self._folder = ''
self._description = ''
self._data_type = ''
self._size = 0
self._count = 0
@property
def count(self):
return self._count
@count.setter
def count(s... |
class TembaException(Exception):
def __str__(self):
return self.message
class TembaConnectionError(TembaException):
message = "Unable to connect to host"
class TembaBadRequestError(TembaException):
def __init__(self, errors):
self.errors = errors
def __str__(self):
msgs = []... | class Tembaexception(Exception):
def __str__(self):
return self.message
class Tembaconnectionerror(TembaException):
message = 'Unable to connect to host'
class Tembabadrequesterror(TembaException):
def __init__(self, errors):
self.errors = errors
def __str__(self):
msgs = []... |
DEFAULT_WINDOW_SIZE = 32
DEFAULT_THRESHOLD_MIN_BASIC = 45.39
DEFAULT_THRESHOLD_MAX_BASIC = 46.0
DEFAULT_THRESHOLD_MIN_ABS = 50.32
DEFAULT_THRESHOLD_MAX_ABS = 52.96
DEFAULT_THRESHOLD_MIN_WITHOUT_GC = 11.28
DEFAULT_THRESHOLD_MAX_WITHOUT_GC = 11.42
DEFAULT_MEAN_GC = 0.46354823199323626
DEFAULT_MAX_EVALUE = 0.00445
DEFAULT... | default_window_size = 32
default_threshold_min_basic = 45.39
default_threshold_max_basic = 46.0
default_threshold_min_abs = 50.32
default_threshold_max_abs = 52.96
default_threshold_min_without_gc = 11.28
default_threshold_max_without_gc = 11.42
default_mean_gc = 0.46354823199323625
default_max_evalue = 0.00445
default... |
# @desc Add a short description or instruction here. This will show up at the top of the exercise.
def function_name(parameter): # give your function a name and parameter(s)
# have it do stuff
return # what does it return? This will be what the user types when they predict the result.
def main():
... | def function_name(parameter):
return
def main():
print(function_name(parameter1))
print(function_name(parameter2))
print(function_name(parameter3))
print(function_name(parameter4))
if __name__ == '__main__':
main() |
s = input()
g1 = {}
for i in range(1, len(s)):
g1[s[i-1: i+1]] = g1.get(s[i-1: i+1], 0) + 1
s = input()
g2 = set()
for i in range(1, len(s)):
g2.add(s[i-1: i+1])
print(sum([g1[g] for g in frozenset(g1.keys()) & g2]))
| s = input()
g1 = {}
for i in range(1, len(s)):
g1[s[i - 1:i + 1]] = g1.get(s[i - 1:i + 1], 0) + 1
s = input()
g2 = set()
for i in range(1, len(s)):
g2.add(s[i - 1:i + 1])
print(sum([g1[g] for g in frozenset(g1.keys()) & g2])) |
# Code Demo for 13 Lecture
# Working with Python Strings
# CIS 135 - Code Demo File
# Lecture example showing string contatenation
firstName = "Peter"
lastName = "Parker"
print("\nString Contcatenation in Pyton uses the + operator")
print(f'First Name = {firstName}')
print(f'Last Name = {lastName}')
print(... | first_name = 'Peter'
last_name = 'Parker'
print('\nString Contcatenation in Pyton uses the + operator')
print(f'First Name = {firstName}')
print(f'Last Name = {lastName}')
print("Peter Parker can be concatenated as 'firstName' + ' ' + 'lastName'")
print('Hello,', firstName + ' ' + lastName)
jjc = 'Joliet Junior College... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/10/17 21:35
# @Author : jacson
# @FileName: file_from_pycharm.py
print("hello world!!!") | print('hello world!!!') |
def percentual(qtde, total):
return (100 * qtde) / total
n = int(input())
c = r = s = 0
for i in range(n):
val, tipo = input().split()
qtde = int(val)
if tipo == 'C':
c += qtde
if tipo == 'R':
r += qtde
if tipo == 'S':
s += qtde
total = c + r + s
print('Total: {} c... | def percentual(qtde, total):
return 100 * qtde / total
n = int(input())
c = r = s = 0
for i in range(n):
(val, tipo) = input().split()
qtde = int(val)
if tipo == 'C':
c += qtde
if tipo == 'R':
r += qtde
if tipo == 'S':
s += qtde
total = c + r + s
print('Total: {} cobaias'... |
# See: http://django-suit.readthedocs.org/en/develop/
SUIT_CONFIG = {
# header
'ADMIN_NAME': 'Augeo',
# 'HEADER_DATE_FORMAT': 'l, j. F Y',
# 'HEADER_TIME_FORMAT': 'H:i',
} | suit_config = {'ADMIN_NAME': 'Augeo'} |
def convert(my_str):
my_list = list(my_str.split(' '))
return my_list
values = {}
times = {}
weights = {}
ids = []
f = open('crime_scene.txt')
my_lines = f.readlines()
stripped_lines = [line.strip() for line in my_lines]
f.close()
N = int(stripped_lines[1])
w = int(convert(stripped_lines[0])[0])... | def convert(my_str):
my_list = list(my_str.split(' '))
return my_list
values = {}
times = {}
weights = {}
ids = []
f = open('crime_scene.txt')
my_lines = f.readlines()
stripped_lines = [line.strip() for line in my_lines]
f.close()
n = int(stripped_lines[1])
w = int(convert(stripped_lines[0])[0])
t = int(convert... |
class Command:
def exec(self, ob):
met = getattr(self, "on"+type(ob).__name__)
return met(ob)
def onNode(self, a):
pass
def onConnection(self, a):
pass
def onGenome(self, a):
pass
| class Command:
def exec(self, ob):
met = getattr(self, 'on' + type(ob).__name__)
return met(ob)
def on_node(self, a):
pass
def on_connection(self, a):
pass
def on_genome(self, a):
pass |
FILTER_ACTION_ON_CHOICES = (
('entry', 'On Entry'),
('exit', 'On Exit'),
)
FILTER_ACTION_TYPE_CHOICES = (
('eml', 'Send Email Notification'),
('sms', 'Send SMS Notification'),
('slk', 'Send Slack Notification'),
('cus', 'Custom Action'),
('drv', 'Derive Stream Action'),
('rpt', 'Report... | filter_action_on_choices = (('entry', 'On Entry'), ('exit', 'On Exit'))
filter_action_type_choices = (('eml', 'Send Email Notification'), ('sms', 'Send SMS Notification'), ('slk', 'Send Slack Notification'), ('cus', 'Custom Action'), ('drv', 'Derive Stream Action'), ('rpt', 'Report Generation Action'), ('smry', 'Summar... |
# countup.py
# http://asu-compmethodsphysics-phy494.github.io/ASU-PHY494//2017/01/19/03_Introduction_to_Python_2/#the-while-loop
tmax = 10.
t, dt = 0, 2.
while t <= tmax:
print("time " + str(t))
t += dt
print("Finished")
| tmax = 10.0
(t, dt) = (0, 2.0)
while t <= tmax:
print('time ' + str(t))
t += dt
print('Finished') |
'''
Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Created on Apr 9, 2014
@author: dfleck
'''
class MessageCache(list):
'''
Holds a list of tuples (envelope, message)
'''
def __contains__(self, otherEnvelope):
#print("\... | """
Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Created on Apr 9, 2014
@author: dfleck
"""
class Messagecache(list):
"""
Holds a list of tuples (envelope, message)
"""
def __contains__(self, otherEnvelope):
for value in self:
... |
class Request:
def __init__(self):
self.timeout = 5000
def get_params(self):
return {}
def get_body(self):
return {}
| class Request:
def __init__(self):
self.timeout = 5000
def get_params(self):
return {}
def get_body(self):
return {} |
a = ['a', 'b', 'c', 'd']
print("This is a list", a)
print("It is", len(a), "elements length.")
print("Let's check if element 'd' is in the list:", 'd' in a)
print("This should be the maximun value of the list", max(a))
print("This should be the minnimun value of the list", min(a))
print("This is a list, item ... | a = ['a', 'b', 'c', 'd']
print('This is a list', a)
print('It is', len(a), 'elements length.')
print("Let's check if element 'd' is in the list:", 'd' in a)
print('This should be the maximun value of the list', max(a))
print('This should be the minnimun value of the list', min(a))
print('This is a list, item by item: '... |
def soft_update_network(target, source, tau):
for target_param, source_param in zip(target.parameters(), source.parameters()):
target_param.data.copy_(
target_param.data * (1 - tau) + source_param.data * tau
)
def hard_update_network(target, source):
target.load_state_dict(source.... | def soft_update_network(target, source, tau):
for (target_param, source_param) in zip(target.parameters(), source.parameters()):
target_param.data.copy_(target_param.data * (1 - tau) + source_param.data * tau)
def hard_update_network(target, source):
target.load_state_dict(source.state_dict()) |
words = {
'i': 520,
'am': 100,
'batman': 20,
'hello': 100
}
# iterate over keys
# for key in words.keys():
# print(key)
# for key in words:
# print(key)
# iterate over values
# words_keys = words.keys()
# print(words_keys)
# words_values = words.values()
# print(words_values)
# for value i... | words = {'i': 520, 'am': 100, 'batman': 20, 'hello': 100}
for (key, value) in words.items():
print(key, value) |
SECRET = "very secret key"
DEBUG = False
LOG_FILE = "log"
LOG_FORMAT = '''
Message type: %(levelname)s
Location: %(pathname)s:%(lineno)d
Module: %(module)s
Function: %(funcName)s
Time: %(asctime)s
Message:
%(message)s
'''
SENDGRID_APIKEY = "BLAABLAA"
RECEIPTS_FOL... | secret = 'very secret key'
debug = False
log_file = 'log'
log_format = '\nMessage type: %(levelname)s\nLocation: %(pathname)s:%(lineno)d\nModule: %(module)s\nFunction: %(funcName)s\nTime: %(asctime)s\n\nMessage:\n\n%(message)s\n'
sendgrid_apikey = 'BLAABLAA'
receipts_... |
CONTAINERS_DISCOVERY_LOCK_KEY = 'containers_discovery.lock'
CONTAINERS_DISCOVERY_LAST_UPDATE_KEY = 'containers_discovery.last_update'
CONTAINERS_DISCOVERY_DATA_KEY = 'containers_discovery.data'
RESOURCES_DISCOVERY_LOCK_KEY = 'resources_discovery.lock'
RESOURCES_DISCOVERY_LAST_UPDATE_KEY = 'resources_discovery.last_upd... | containers_discovery_lock_key = 'containers_discovery.lock'
containers_discovery_last_update_key = 'containers_discovery.last_update'
containers_discovery_data_key = 'containers_discovery.data'
resources_discovery_lock_key = 'resources_discovery.lock'
resources_discovery_last_update_key = 'resources_discovery.last_upda... |
class ScraperFactoryException(Exception):
pass
class SpiderNotFoundError(ScraperFactoryException):
pass
class InvalidUrlError(ScraperFactoryException):
pass
| class Scraperfactoryexception(Exception):
pass
class Spidernotfounderror(ScraperFactoryException):
pass
class Invalidurlerror(ScraperFactoryException):
pass |
class Solution:
def findRelativeRanks(self, score: List[int]) -> List[str]:
sorted_score = sorted(score,reverse=True)
rankings = {}
for i in range(len(sorted_score)):
if i == 0: rankings[sorted_score[i]] = 'Gold Medal'
elif i == 1: rankings[sorted_score[i]] = 'Silver ... | class Solution:
def find_relative_ranks(self, score: List[int]) -> List[str]:
sorted_score = sorted(score, reverse=True)
rankings = {}
for i in range(len(sorted_score)):
if i == 0:
rankings[sorted_score[i]] = 'Gold Medal'
elif i == 1:
... |
for j in range(1, 9):
for i in range(1,j+1):
print("%d * %d = %d" % (i,j,i*j),end="\t")
print()
| for j in range(1, 9):
for i in range(1, j + 1):
print('%d * %d = %d' % (i, j, i * j), end='\t')
print() |
# Relationship instance name
JSON_RELATIONSHIP_INTERACT_WITH = "interaction"
JSON_RUN_TIME = "runtime"
JSON_DEPLOYMENT_TIME = "deploymenttime"
JSON_NODE_DATABASE = "datastore"
JSON_NODE_SERVICE= "service"
JSON_NODE_MESSAGE_BROKER = "messagebroker"
JSON_NODE_MESSAGE_ROUTER = "messagerouter"
JSON_NODE_MESSAGE_ROUTER_KS... | json_relationship_interact_with = 'interaction'
json_run_time = 'runtime'
json_deployment_time = 'deploymenttime'
json_node_database = 'datastore'
json_node_service = 'service'
json_node_message_broker = 'messagebroker'
json_node_message_router = 'messagerouter'
json_node_message_router_kservice = 'kservice'
json_node_... |
'''
06 - Binning data
When the data on the x axis is a continuous value, it can
be useful to break it into different bins in order to get
a better visualization of the changes in the data.
For this exercise, we will look at the relationship between
tuition and the Undergraduate population abbreviated as UG in ... | """
06 - Binning data
When the data on the x axis is a continuous value, it can
be useful to break it into different bins in order to get
a better visualization of the changes in the data.
For this exercise, we will look at the relationship between
tuition and the Undergraduate population abbreviated as UG in ... |
N = int(input())
c=1
res=[]
for i in range (1,int((N+2)/2)):
if N%i == 0:
res.append(i)
c+=1
res.append(N)
print(c)
print(*res)
| n = int(input())
c = 1
res = []
for i in range(1, int((N + 2) / 2)):
if N % i == 0:
res.append(i)
c += 1
res.append(N)
print(c)
print(*res) |
#program to get string which is n
word = input('Enter numbers \n')
texts = list(word)
print(f'{texts}')
numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
integer = ""
for i in texts:
if i in numbers:
integer += i
print(integer)
| word = input('Enter numbers \n')
texts = list(word)
print(f'{texts}')
numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
integer = ''
for i in texts:
if i in numbers:
integer += i
print(integer) |
#Programming I
#######################
# Mission 6.1 #
# Task List #
#######################
#Background
#==========
#After his success in the driverless vehicle, Tom
#ventures into private investigation services. To keep
#track of his progress on the cases, he like to
#create a task list dynamicall... | def generate_tasklist(num):
for i in range(1, num + 1):
if i % 7 == 1:
print('Day | Task(s)')
print(str(i) + ' | ')
else:
print(str(i) + ' | ')
generate_tasklist(num) |
class Node:
def __init__(self,data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head=None
def print_llist(self):
temp = self.head
while temp:
print(temp.data)
temp=temp.next
lli... | class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linkedlist:
def __init__(self):
self.head = None
def print_llist(self):
temp = self.head
while temp:
print(temp.data)
temp = temp.next
llist = linked_list()
llist... |
input_repository = '/home/alog0/taeha/Spark/Count_caching/input/All_uncache_1'
count = 0
with open(input_repository, 'r', encoding='utf-8-sig') as data_file:
while True:
line = data_file.readline()
if not line:
break
line_split = line.split(':')
path = line_split[0]
num = line_split[1]
count += int(num... | input_repository = '/home/alog0/taeha/Spark/Count_caching/input/All_uncache_1'
count = 0
with open(input_repository, 'r', encoding='utf-8-sig') as data_file:
while True:
line = data_file.readline()
if not line:
break
line_split = line.split(':')
path = line_split[0]
... |
# Distribute Candy
# https://www.interviewbit.com/problems/distribute-candy/
#
# There are N children standing in a line. Each child is assigned a rating value.
#
# You are giving candies to these children subjected to the following requirements:
# Each child must have at least one candy.
# Children with a higher rati... | class Solution:
def candy(self, A):
candies = [1]
for i in range(1, len(A)):
candies.append(candies[-1] + 1 if A[i] > A[i - 1] else 1)
result = candies[-1]
for i in range(len(A) - 2, -1, -1):
curr = candies[i + 1] + 1 if A[i] > A[i + 1] else 1
res... |
# coding: utf-8
##############################################################################
# Copyright (C) 2018 Microchip Technology Inc. and its subsidiaries.
#
# Subject to your compliance with these terms, you may use Microchip software
# and any derivatives exclusively with Microchip products. It is your
... | project_path = 'config/' + Variables.get('__CONFIGURATION_NAME') + '/gfx/driver/ili9488'
gfx_driver_h = comp.createFileSymbol('GFX_DRIVER_H', None)
GFX_DRIVER_H.setSourcePath('../../templates/gfx_driver.h.ftl')
GFX_DRIVER_H.setDestPath('gfx/driver/')
GFX_DRIVER_H.setOutputName('gfx_driver.h')
GFX_DRIVER_H.setProjectPat... |
class DiskQueueLength(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_disk_queue_length(idx_name)
class DiskQueueLengthColumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_disks()
| class Diskqueuelength(object):
def read_get(self, name, idx_name, unity_client):
return unity_client.get_disk_queue_length(idx_name)
class Diskqueuelengthcolumn(object):
def get_idx(self, name, idx, unity_client):
return unity_client.get_disks() |
#3-1
# names = ['will', 'jess', 'jacob', 'adam']
# for name in names:
# print(name.title())
#3-2
names = ['will', 'jess', 'jacob', 'adam']
for name in names:
print(f"Hello, {name.title()}")
| names = ['will', 'jess', 'jacob', 'adam']
for name in names:
print(f'Hello, {name.title()}') |
class Student:
def __init__(self):
self.name = 'Mohan'
self.age = 10
self.country = 'India'
def mydelete(self):
del self.age
myobj1 = Student()
print("Before deleting: ")
print(myobj1.__dict__)
del myobj1.country # deleting outside of the class
print("After del... | class Student:
def __init__(self):
self.name = 'Mohan'
self.age = 10
self.country = 'India'
def mydelete(self):
del self.age
myobj1 = student()
print('Before deleting: ')
print(myobj1.__dict__)
del myobj1.country
print('After deleting outside of the class: ')
print(myobj1.__dic... |
# Multiple Comparisons
# the way vs. the better way
# simplify chained comparison
# Manas Dash
# Raksha Bhandhan day of 2020
time_of_the_day = 6
day_of_the_week = 'mon'
# this way
if time_of_the_day < 12 and time_of_the_day > 6:
print('Good morning')
# a better way
if 6 < time_of_the_day < 12:
print('Good morning... | time_of_the_day = 6
day_of_the_week = 'mon'
if time_of_the_day < 12 and time_of_the_day > 6:
print('Good morning')
if 6 < time_of_the_day < 12:
print('Good morning')
if day_of_the_week == 'Mon' or day_of_the_week == 'Wed' or day_of_the_week == 'Fri' or (day_of_the_week == 'Sun'):
print('its just a week day'... |
app.stepsPerSecond = 60
s = 5; d = Circle(200, 200, 25, fill='purple')
def onKeyHold(keys):
# Movement Control
if ('right' in keys): d.centerX += s
if ('left' in keys): d.centerX -= s
if ('up' in keys): d.centerY -= s
if ('down' in keys): d.centerY += s
# Edge Movement
if (d.left >= app.ri... | app.stepsPerSecond = 60
s = 5
d = circle(200, 200, 25, fill='purple')
def on_key_hold(keys):
if 'right' in keys:
d.centerX += s
if 'left' in keys:
d.centerX -= s
if 'up' in keys:
d.centerY -= s
if 'down' in keys:
d.centerY += s
if d.left >= app.right:
d.right... |
# Q1
def is_Empty(stack):
if stack == []:
return True
else:
return False
def pop(stack):
if is_Empty(stack):
print("Underflow")
else:
item = stack.pop()
print(item, 'is popped')
if len(stack) == 0:
top = None
else:
... | def is__empty(stack):
if stack == []:
return True
else:
return False
def pop(stack):
if is__empty(stack):
print('Underflow')
else:
item = stack.pop()
print(item, 'is popped')
if len(stack) == 0:
top = None
else:
top = len(s... |
class LinkedListNode:
def __init__(self, val):
self.val = val
self.next = None
def intersection(a, b):
nodes = set()
while a is not None:
nodes.add(a.val)
a = a.next
while b is not None:
if b.val in nodes:
return b.val
b = b.next
retur... | class Linkedlistnode:
def __init__(self, val):
self.val = val
self.next = None
def intersection(a, b):
nodes = set()
while a is not None:
nodes.add(a.val)
a = a.next
while b is not None:
if b.val in nodes:
return b.val
b = b.next
return N... |
# TODO
class A:
def __init__(self, value):
self.value = value
def __matmul__(self, other):
print('__matmul__')
return A(self.value * other.value)
def __imatmul__(self, other):
print('__imatmul__')
self.value *= other.value
return self
a = A(1)
b = A(2)
p... | class A:
def __init__(self, value):
self.value = value
def __matmul__(self, other):
print('__matmul__')
return a(self.value * other.value)
def __imatmul__(self, other):
print('__imatmul__')
self.value *= other.value
return self
a = a(1)
b = a(2)
print((a @ ... |
__author__ = 'Tierprot'
class MutGen():
AA_voc = ["G", "A", "V", "L", "I", "P", "F", "Y", "W", "S",
"T", "C", "M", "N", "Q", "K", "R", "H", "D", "E"]
def __init__(self, input_file, vocabulary=None, positions=None):
try:
main_name, main_sequence = MutGen.load_seq(inp... | __author__ = 'Tierprot'
class Mutgen:
aa_voc = ['G', 'A', 'V', 'L', 'I', 'P', 'F', 'Y', 'W', 'S', 'T', 'C', 'M', 'N', 'Q', 'K', 'R', 'H', 'D', 'E']
def __init__(self, input_file, vocabulary=None, positions=None):
try:
(main_name, main_sequence) = MutGen.load_seq(input_file)
sel... |
for _ in range(int(input())):
k, q = map(int, input().split())
mot = sorted(list(map(int, input().split())))
sat = sorted(list(map(int, input().split())))
qs = []
for i in range(q):
qs.append(int(input()))
gen = [mot[i]+sat[j] for i in range(k) for j in range(min(k, 10001//(i+1)))]
... | for _ in range(int(input())):
(k, q) = map(int, input().split())
mot = sorted(list(map(int, input().split())))
sat = sorted(list(map(int, input().split())))
qs = []
for i in range(q):
qs.append(int(input()))
gen = [mot[i] + sat[j] for i in range(k) for j in range(min(k, 10001 // (i + 1))... |
# This example uses python classes for addition
class Numbers(object):
def __init__(self):
self.sum = 0
def add(self,x):
# Addtion funciton
self.sum += x
def total(self):
# Returns the total of the sum
return self.sum
if __name__ == "__main__":
# Prints 12 on the terminal when t... | class Numbers(object):
def __init__(self):
self.sum = 0
def add(self, x):
self.sum += x
def total(self):
return self.sum
if __name__ == '__main__':
add = numbers()
add.add(5)
add.add(7)
y = add.total()
print('Total Sum : ', y) |
class CheckFileGenerationEnum:
GENERATED_SUCCESS = "generated_success"
GENERATED_EMPTY = "generated_empty"
NOT_GENERATED = "not_generated"
# try to find the internal value and return
def __getattr__(self, name):
if name in self:
return name
raise AttributeError
# p... | class Checkfilegenerationenum:
generated_success = 'generated_success'
generated_empty = 'generated_empty'
not_generated = 'not_generated'
def __getattr__(self, name):
if name in self:
return name
raise AttributeError
def __setattr__(self, key, value):
raise val... |
value = '6'
if value == '7':
print('The value is 7')
elif value == '8':
print('The value is 8')
else:
print('The value is not one we are looking for')
print('Finished!')
| value = '6'
if value == '7':
print('The value is 7')
elif value == '8':
print('The value is 8')
else:
print('The value is not one we are looking for')
print('Finished!') |
def json_dates_handler(obj):
if hasattr(obj, 'isoformat'):
return obj.isoformat()
return str(obj)
| def json_dates_handler(obj):
if hasattr(obj, 'isoformat'):
return obj.isoformat()
return str(obj) |
#Dock download & install
def getDocker():
run('sudo apt-get update')
run('sudo apt-get install -y docker.io')
run('sudo docker pull sn1k/submodulo-alberto')
#Ejecucion de docker
def runDocker():
run('sudo docker run -p 80:80 -i -t sn1k/submodulo-alberto')
| def get_docker():
run('sudo apt-get update')
run('sudo apt-get install -y docker.io')
run('sudo docker pull sn1k/submodulo-alberto')
def run_docker():
run('sudo docker run -p 80:80 -i -t sn1k/submodulo-alberto') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.