content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class DeviceTreePartitionSlice(object):
"""Implementation of the 'DeviceTree_PartitionSlice' model.
TODO: type model description here.
Attributes:
disk_file_name (string): The disk to use.
length (long|int): The length of data for t... | class Devicetreepartitionslice(object):
"""Implementation of the 'DeviceTree_PartitionSlice' model.
TODO: type model description here.
Attributes:
disk_file_name (string): The disk to use.
length (long|int): The length of data for the LVM volume (for which
this device tree is b... |
class Cell():
def __init__(self):
self.touched = False
self.has_mine = False
self.marked = False
self.value = 0
def _place_mine(self):
self.has_mine = True
def touch(self):
if not self.marked:
self.touched = True
return self.has_mine
... | class Cell:
def __init__(self):
self.touched = False
self.has_mine = False
self.marked = False
self.value = 0
def _place_mine(self):
self.has_mine = True
def touch(self):
if not self.marked:
self.touched = True
return self.has_mine
... |
#
# PySNMP MIB module RUCKUS-VF2825-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RUCKUS-VF2825-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:50:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Ma... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection, constraints_union) ... |
# Created by MechAviv
# ID :: [865090001]
# Commerci Republic : Berry
if sm.hasQuest(17613): # [Commerci Republic] The Minister's Son
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.setStandAloneMode(True)
sm.setSpeakerID(9390241)
sm.rem... | if sm.hasQuest(17613):
sm.curNodeEventEnd(True)
sm.setTemporarySkillSet(0)
sm.setInGameDirectionMode(True, True, False, False)
sm.setStandAloneMode(True)
sm.setSpeakerID(9390241)
sm.removeEscapeButton()
sm.flipDialogue()
sm.setSpeakerType(3)
sm.sendNext('Hey! Keep your paws away from... |
class Solution:
def totalMoney(self, n: int) -> int:
s, m, p, t = 0, 0, 0, 0
while t < n:
if t % 7 == 0:
m += 1
s += m
p = m
else:
p += 1
s += p
t += 1
return s
| class Solution:
def total_money(self, n: int) -> int:
(s, m, p, t) = (0, 0, 0, 0)
while t < n:
if t % 7 == 0:
m += 1
s += m
p = m
else:
p += 1
s += p
t += 1
return s |
SIG_START_DEFAULT = 0
SIG_UNDEF = 'undefined'
class Signal(object):
def __init__(self, name, start_state=None):
self.name = name
if start_state is not None:
self.state = start_state
else:
self.state = SIG_START_DEFAULT
self.previous = self.state
self... | sig_start_default = 0
sig_undef = 'undefined'
class Signal(object):
def __init__(self, name, start_state=None):
self.name = name
if start_state is not None:
self.state = start_state
else:
self.state = SIG_START_DEFAULT
self.previous = self.state
self... |
class Solution:
def replaceWords(self, dict, sentence):
"""
:type dict: List[str]
:type sentence: str
:rtype: str
"""
s = set(dict)
sentence = sentence.split()
for j, w in enumerate(sentence):
for i in range(1, len(w)):
if w... | class Solution:
def replace_words(self, dict, sentence):
"""
:type dict: List[str]
:type sentence: str
:rtype: str
"""
s = set(dict)
sentence = sentence.split()
for (j, w) in enumerate(sentence):
for i in range(1, len(w)):
... |
#
# PySNMP MIB module DE-OPT-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DE-OPT-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:21:56 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, constraints_intersection, constraints_union, value_range_constraint, value_size_constraint) ... |
# Ingredient Adjuster
# Ask user how many cookies he or she wants
cookie = int(input("Enter the amount of cookies you want: "))
sugar = 1.5
oil = 1
pounder = 2.75
print(sugar * cookie, ' gr. sugar.\n',
oil * cookie, ' gr. butter.\n',
pounder * cookie, ' gr. flour.', sep="")
| cookie = int(input('Enter the amount of cookies you want: '))
sugar = 1.5
oil = 1
pounder = 2.75
print(sugar * cookie, ' gr. sugar.\n', oil * cookie, ' gr. butter.\n', pounder * cookie, ' gr. flour.', sep='') |
""" EXAMPLE USAGE:
opts = Opts(environ,
opt('q', default=''),
opt('pages', default=2),
opt('split', default=0),
opt('simple', default=0),
opt('max_topics', default=40),
opt('ncol', default=3),
opt('save', default=False),
opt('load', default=False),
opt('smoothing... | """ EXAMPLE USAGE:
opts = Opts(environ,
opt('q', default=''),
opt('pages', default=2),
opt('split', default=0),
opt('simple', default=0),
opt('max_topics', default=40),
opt('ncol', default=3),
opt('save', default=False),
opt('load', default=False),
opt('smoothing... |
# Advent of Code 2021, Day 17
#
# Simple projectile simulation, with search for
# velocities that achieve highest position, and total
# number of possible velocity values that reach target
# area; just used a simple grid search.
#
# AK, 17/12/2021
# Target area (x range and y range)
T = ((20,30), (-10, -5)) # Samp... | t = ((20, 30), (-10, -5))
t = ((192, 251), (-89, -59))
def within_target(x, y):
return x >= T[0][0] and x <= T[0][1] and (y >= T[1][0]) and (y <= T[1][1])
def simulate(xv, yv):
x = y = 0
highest = -99999
hit_target = False
iter = 0
while iter < 300:
iter += 1
x += xv
y ... |
class Person(object):
def __init__(self, name, age):
self.name=name
self.age=age
def get_person(self,):
return "Hi"
print("hi")
| class Person(object):
def __init__(self, name, age):
self.name = name
self.age = age
def get_person(self):
return 'Hi'
print('hi') |
class Book:
def __init__(self, title, price, author):
self.title = title
self.author = author
self.price = price
def __eq__(self, other):
if not isinstance(other,Book):
raise ValueError("Couldn't compare book to non-book")
return (self.title == other.title an... | class Book:
def __init__(self, title, price, author):
self.title = title
self.author = author
self.price = price
def __eq__(self, other):
if not isinstance(other, Book):
raise value_error("Couldn't compare book to non-book")
return self.title == other.title ... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012, Piston Cloud Computing, Inc.
# 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/li... | def validate(filter, value):
return FILTER_FUNCTIONS.get(filter, lambda v: True)(value)
def validate_int_in_range(min=0, max=None):
def _validator(v):
try:
if max is None:
return min <= int(v)
return min <= int(v) <= max
except ValueError:
re... |
'''
Example 1:
Input: N = 5, arr = {1, 2, 3, 2, 1}
Output: 3
Explaination: Only the number 3 is single.
Example 2:
Input: N = 11, arr = {1, 2, 3, 5, 3, 2, 1, 4, 5, 6, 6}
Output: 4
Explaination: 4 is the only single.
'''
class Solution:
def findSingle(self, N, arr):
# code here
m... | """
Example 1:
Input: N = 5, arr = {1, 2, 3, 2, 1}
Output: 3
Explaination: Only the number 3 is single.
Example 2:
Input: N = 11, arr = {1, 2, 3, 5, 3, 2, 1, 4, 5, 6, 6}
Output: 4
Explaination: 4 is the only single.
"""
class Solution:
def find_single(self, N, arr):
m = 0
for i... |
class RecordNotFound(Exception):
pass
class InvalidLEI(Exception):
pass
class InvalidISIN(Exception):
pass
class NotFound(Exception):
pass
| class Recordnotfound(Exception):
pass
class Invalidlei(Exception):
pass
class Invalidisin(Exception):
pass
class Notfound(Exception):
pass |
N=int(input("Ingresa un numero base pls:"))
M=int(input("Ingresa una potencia pls:"))
print("LOS RESULTADOS SON:")
for i in range(0,M+1):
print(f"{N}^{i} = " + str(N**i)) | n = int(input('Ingresa un numero base pls:'))
m = int(input('Ingresa una potencia pls:'))
print('LOS RESULTADOS SON:')
for i in range(0, M + 1):
print(f'{N}^{i} = ' + str(N ** i)) |
def main():
print("Please enter filename:")
filename = input()
f = open('..\\src\\main\\resources\\assets\\forbidden\\models\\item\\' + filename + '.json', mode='xt')
f.write('{\n')
f.write(' "parent": "forbidden:item/base_item",\n')
f.write(' "textures": {\n')
f.write(' "layer0": "for... | def main():
print('Please enter filename:')
filename = input()
f = open('..\\src\\main\\resources\\assets\\forbidden\\models\\item\\' + filename + '.json', mode='xt')
f.write('{\n')
f.write(' "parent": "forbidden:item/base_item",\n')
f.write(' "textures": {\n')
f.write(' "layer0": "forb... |
#show function logs all attempts on console and in out.txt file
out = open("out.txt", 'w+')
def show(line):
li = ""
for i in line:
for j in i:
li += str(j) + " "
li += "\n"
print(li)
out.write(li)
out.write("\n")
| out = open('out.txt', 'w+')
def show(line):
li = ''
for i in line:
for j in i:
li += str(j) + ' '
li += '\n'
print(li)
out.write(li)
out.write('\n') |
print()
print("-- RELATIONS ------------------------------")
print()
print("GRAPH 1:\n0 0 0\n0 0 0\n0 0 0")
g1 = Graph(3)
print("REFLEXIVITA: " + str(is_reflexive(g1)) + " -> spravna odpoved: False")
print("SYMETRIE: " + str(is_symmetric(g1)) + " -> spravna odpoved: True")
print("ANTISYMETRIE: " + str(is... | print()
print('-- RELATIONS ------------------------------')
print()
print('GRAPH 1:\n0 0 0\n0 0 0\n0 0 0')
g1 = graph(3)
print('REFLEXIVITA: ' + str(is_reflexive(g1)) + ' -> spravna odpoved: False')
print('SYMETRIE: ' + str(is_symmetric(g1)) + ' -> spravna odpoved: True')
print('ANTISYMETRIE: ' + str(is_... |
# Some utility classes to represent a PDB structure
class Atom:
"""
A simple class for an amino acid residue
"""
def __init__(self, type):
self.type = type
self.coords = (0.0, 0.0, 0.0)
# Overload the __repr__ operator to make printing simpler.
def __repr__(self):
ret... | class Atom:
"""
A simple class for an amino acid residue
"""
def __init__(self, type):
self.type = type
self.coords = (0.0, 0.0, 0.0)
def __repr__(self):
return self.type
class Residue:
"""
A simple class for an amino acid residue
"""
def __init__(self, ty... |
class _elastica_numpy:
"""The purpose is to throw deprecation error to people previously
using _elastica_numpy module. Please remove this exception after
v0.3."""
raise ImportError("The module _elastica_numpy is now deprecated.")
| class _Elastica_Numpy:
"""The purpose is to throw deprecation error to people previously
using _elastica_numpy module. Please remove this exception after
v0.3."""
raise import_error('The module _elastica_numpy is now deprecated.') |
# Task 03. Statistics
def add_to_dict(product: str, quantity: int):
if product not in stock:
stock[product] = quantity
else:
stock[product] += quantity
cmd = input()
stock = {}
while not cmd == "statistics":
key = cmd.split(': ')[0]
value = cmd.split(': ')[1]
add_to_dict(key, int(... | def add_to_dict(product: str, quantity: int):
if product not in stock:
stock[product] = quantity
else:
stock[product] += quantity
cmd = input()
stock = {}
while not cmd == 'statistics':
key = cmd.split(': ')[0]
value = cmd.split(': ')[1]
add_to_dict(key, int(value))
cmd = input()... |
'''
This problem was asked by Stripe.
Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well.
For example, the input [3, 4, -1... | """
This problem was asked by Stripe.
Given an array of integers, find the first missing positive integer in linear time and constant space. In other words, find the lowest positive integer that does not exist in the array. The array can contain duplicates and negative numbers as well.
For example, the input [3, 4, -1... |
#Main class
class Characters:
def __init__(self,
name,
lastname,
age,
hp,
title,
language,
race,
weakness
):
# instance variable unique to each instance
... | class Characters:
def __init__(self, name, lastname, age, hp, title, language, race, weakness):
self.__name = name
self.__lastname = lastname
self.__age = age
self.__hp = hp
self.__title = title
self.__race = race
self.__weakness = weakness
self.__lan... |
n = int(input())
b = list(map(int, input().split(' ')))
x = [0]
a = []
a.append(b[0])
x.append(a[0])
i = 1
while i < n:
a.append(b[i]+x[i])
if a[i] > x[i]:
x.append(a[i])
else:
x.append(x[i])
i += 1
str_a = [str(ele) for ele in a]
print(' '.join(str_a)) | n = int(input())
b = list(map(int, input().split(' ')))
x = [0]
a = []
a.append(b[0])
x.append(a[0])
i = 1
while i < n:
a.append(b[i] + x[i])
if a[i] > x[i]:
x.append(a[i])
else:
x.append(x[i])
i += 1
str_a = [str(ele) for ele in a]
print(' '.join(str_a)) |
class Production(object):
def analyze(self, world):
"""Implement your analyzer here."""
def interpret(self, world):
"""Implement your interpreter here."""
class FuncCall(Production):
def __init__(self, token, params):
self.name = token[1]
self.params = params
self.... | class Production(object):
def analyze(self, world):
"""Implement your analyzer here."""
def interpret(self, world):
"""Implement your interpreter here."""
class Funccall(Production):
def __init__(self, token, params):
self.name = token[1]
self.params = params
self... |
"""
A name to avoid typosquating pytest-foward-compatibility
"""
__version__ = "0.1.0"
| """
A name to avoid typosquating pytest-foward-compatibility
"""
__version__ = '0.1.0' |
class Config:
DEBUG = False
SQLURI = 'postgres://tarek:xxx@localhost/db'
"""
>>> from flask import Flask
>>> app = Flask(__name__) ... | class Config:
debug = False
sqluri = 'postgres://tarek:xxx@localhost/db'
"\n>>> from flask import Flask \n>>> app = Flask(__name__) ... |
class Solution:
"""
@param s: A string
@return: the length of last word
"""
def lengthOfLastWord(self, s):
return len(s.strip().split(" ")[-1]) | class Solution:
"""
@param s: A string
@return: the length of last word
"""
def length_of_last_word(self, s):
return len(s.strip().split(' ')[-1]) |
"""
This shows that Lists and Dictionaries are different
"""
listfootball=['messi','inesta','pique','sanchez','suarez','neymar']
listbuzzfeed=['eugene','ashley','keith','ella','sara','chris']
"""
This will return false
"""
print(listbuzzfeed==listfootball)
dictfootball={'name':'lionel','age':'26','country':'argentina... | """
This shows that Lists and Dictionaries are different
"""
listfootball = ['messi', 'inesta', 'pique', 'sanchez', 'suarez', 'neymar']
listbuzzfeed = ['eugene', 'ashley', 'keith', 'ella', 'sara', 'chris']
'\nThis will return false\n'
print(listbuzzfeed == listfootball)
dictfootball = {'name': 'lionel', 'age': '26', 'c... |
"""
......................Static...................................
class Bank():
@staticmethod
def Banking(Attr):
print("Welcome to Banking")
print("It is Static Method")
print("Pass Attribute :",Attr)
BB=Bank()
BB.Banking("Citi")
BB.Banking("BOA")
.........................GarbageColl... | """
......................Static...................................
class Bank():
@staticmethod
def Banking(Attr):
print("Welcome to Banking")
print("It is Static Method")
print("Pass Attribute :",Attr)
BB=Bank()
BB.Banking("Citi")
BB.Banking("BOA")
.........................GarbageColl... |
"""
# The data in these tables were mostly sourced from Free60 and various forums and tools.
# In particular the tool Le Fluffie was helpful
# Some data has been verified, some changed and some has yet to be used.
"""
class STFSHashInfo(object):
""" Whether the block represented by the BlockHashRecord is used, fr... | """
# The data in these tables were mostly sourced from Free60 and various forums and tools.
# In particular the tool Le Fluffie was helpful
# Some data has been verified, some changed and some has yet to be used.
"""
class Stfshashinfo(object):
""" Whether the block represented by the BlockHashRecord is used, fr... |
def valida(digitos):
# digitos = [4,5,7,5,0,8,0,0,0]
# digitos = [11] * 9
i = 1
soma = 0
for x in digitos:
soma = soma +(i * x)
i += 1
return bool( soma % 11 == 0)
print(valida(1)) | def valida(digitos):
i = 1
soma = 0
for x in digitos:
soma = soma + i * x
i += 1
return bool(soma % 11 == 0)
print(valida(1)) |
{
"targets": [{
"target_name": "OpenSSL_EVP_BytesToKey",
"sources": [
"./test/main.cc",
],
"cflags": [
"-Wall",
"-Wno-maybe-uninitialized",
"-Wno-uninitialized",
"-Wno-unused-function",
"-Wextra"
],
"cflags_cc+": [
"-std=c++0x"
],
"include_dirs... | {'targets': [{'target_name': 'OpenSSL_EVP_BytesToKey', 'sources': ['./test/main.cc'], 'cflags': ['-Wall', '-Wno-maybe-uninitialized', '-Wno-uninitialized', '-Wno-unused-function', '-Wextra'], 'cflags_cc+': ['-std=c++0x'], 'include_dirs': ['/usr/local/include', '<!(node -e "require(\'nan\')")'], 'conditions': [["OS=='ma... |
class Car:
"""Unit under test."""
def __init__(self, speed):
self.speed = speed
def getSpeed(self):
return self.speed
def brake(self):
self.speed = 0
| class Car:
"""Unit under test."""
def __init__(self, speed):
self.speed = speed
def get_speed(self):
return self.speed
def brake(self):
self.speed = 0 |
def catalan_number(n):
nm = dm = 1
for k in range(2, n+1):
nm, dm = ( nm*(n+k), dm*k )
return nm/dm
print([catalan_number(n) for n in range(1, 16)])
[1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845]
| def catalan_number(n):
nm = dm = 1
for k in range(2, n + 1):
(nm, dm) = (nm * (n + k), dm * k)
return nm / dm
print([catalan_number(n) for n in range(1, 16)])
[1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845] |
"""Shows options"""
def show_options():
options = ["\nYour options are below.",
"\nEnter: '<rooms>' to show a list of rooms",
"\nEnter: '<create> room_name' to create a room and assign it a name.",
"\nEnter: '<join> room_name' to join an existing chat room.",
... | """Shows options"""
def show_options():
options = ['\nYour options are below.', "\nEnter: '<rooms>' to show a list of rooms", "\nEnter: '<create> room_name' to create a room and assign it a name.", "\nEnter: '<join> room_name' to join an existing chat room.", "\nEnter: '<users>' to list the users' names in your cu... |
"""Constants for pyskyqremote- DE."""
SCHEDULE_URL = "https://www.sky.de/sgtvg/service/getBroadcasts"
LIVE_IMAGE_URL = "https://www.sky.de{0}"
PVR_IMAGE_URL = "https://www.sky.de{0}"
CHANNEL_IMAGE_URL = "https://www.sky.de{0}"
TIMEZONE = "Europe/Berlin"
CHANNEL_URL = "https://raw.githubusercontent.com/RogerSelwyn/skyq... | """Constants for pyskyqremote- DE."""
schedule_url = 'https://www.sky.de/sgtvg/service/getBroadcasts'
live_image_url = 'https://www.sky.de{0}'
pvr_image_url = 'https://www.sky.de{0}'
channel_image_url = 'https://www.sky.de{0}'
timezone = 'Europe/Berlin'
channel_url = 'https://raw.githubusercontent.com/RogerSelwyn/skyq_... |
# Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | load('@com_google_api_codegen//rules_gapic:gapic.bzl', 'gapic_srcjar', 'unzipped_srcjar')
def _cc_gapic_postprocessed_srcjar_impl(ctx):
gapic_zip = ctx.file.gapic_zip
output_main = ctx.outputs.main
output_main_h = ctx.outputs.main_h
output_dir_name = ctx.label.name
output_dir_path = '%s/%s' % (outp... |
NAME = 'weather.py'
ORIGINAL_AUTHORS = [
'Gabriele Ron'
]
ABOUT = '''
A plugin to get the weather of a location
'''
COMMANDS = '''
>>> .weather <city> <country code>
returns the weather
'''
WEBSITE = ''
| name = 'weather.py'
original_authors = ['Gabriele Ron']
about = '\nA plugin to get the weather of a location\n'
commands = '\n>>> .weather <city> <country code>\nreturns the weather\n'
website = '' |
class Node:
def __init__(self, value):
self.value = value
self.next = None
class LinkList:
def __init__(self, value):
node = Node(value)
self.head = node
self.tail = node
self.length = 1
def append(self, value):
node = Node(value)
if self.le... | class Node:
def __init__(self, value):
self.value = value
self.next = None
class Linklist:
def __init__(self, value):
node = node(value)
self.head = node
self.tail = node
self.length = 1
def append(self, value):
node = node(value)
if self.l... |
class node:
def __init__(self,val):
self.val = val
self.next = None
self.prev = None
class mylinkedlist:
def __init__(self):
self.head = None
self.tail = None
self.size = 0
def get(self,index):
if index < 0 or index >= self.size:
... | class Node:
def __init__(self, val):
self.val = val
self.next = None
self.prev = None
class Mylinkedlist:
def __init__(self):
self.head = None
self.tail = None
self.size = 0
def get(self, index):
if index < 0 or index >= self.size:
retu... |
#declaring variable as string
phrase = str(input('Type a phrase: '))
#saving the phrase in lowercase
phrase = phrase.lower()
#presenting amount of lettters 'a'
print('Amount of letters "a": ', phrase.count('a'))
#presenting the position of firt 'a'
print('Firt "A" in position: ', phrase.find('a'))
#presenting the posi... | phrase = str(input('Type a phrase: '))
phrase = phrase.lower()
print('Amount of letters "a": ', phrase.count('a'))
print('Firt "A" in position: ', phrase.find('a'))
print('Last "A" in postion: ', phrase.rfind('a')) |
{
"targets": [
{
"target_name": "json",
"product_name": "json",
"variables": {
"json_dir%": "../"
},
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'conditions': [
['OS=="m... | {'targets': [{'target_name': 'json', 'product_name': 'json', 'variables': {'json_dir%': '../'}, 'cflags!': ['-fno-exceptions'], 'cflags_cc!': ['-fno-exceptions'], 'conditions': [['OS=="mac"', {'xcode_settings': {'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'}}]], 'type': 'static_library', 'include_dirs': ['<(json_dir)/', '<(json_d... |
todos = []
impar = []
par = []
while True:
todos.append(int(input('Digite um valor: ')))
soun = str(input('Quer adicionar mais ? [S/N] ')).strip()[0]
if soun in 'Nn':
break
for n in todos:
if n % 2 == 0:
par.append(n)
for v in todos:
if v % 2 != 0:
impar.append(v)
print('=' *... | todos = []
impar = []
par = []
while True:
todos.append(int(input('Digite um valor: ')))
soun = str(input('Quer adicionar mais ? [S/N] ')).strip()[0]
if soun in 'Nn':
break
for n in todos:
if n % 2 == 0:
par.append(n)
for v in todos:
if v % 2 != 0:
impar.append(v)
print('=' *... |
class Solution(object):
def countAndSay(self, n):
"""
:type n: int
:rtype: str
"""
num = "1"
for _ in range(1, n):
digit = num[0]
count = 1
newNum = ""
for j in range(1, len(num)):
if nu... | class Solution(object):
def count_and_say(self, n):
"""
:type n: int
:rtype: str
"""
num = '1'
for _ in range(1, n):
digit = num[0]
count = 1
new_num = ''
for j in range(1, len(num)):
if num[j] == digit:... |
def print_formatted(N):
width = len(bin(N)[2:])
for i in range(1, N + 1):
print(' '.join(map(lambda x: x.rjust(width), [str(i), oct(i)[2:], hex(i)[2:].upper(), bin(i)[2:]])))
if __name__ == '__main__':
n = int(input())
print_formatted(n) | def print_formatted(N):
width = len(bin(N)[2:])
for i in range(1, N + 1):
print(' '.join(map(lambda x: x.rjust(width), [str(i), oct(i)[2:], hex(i)[2:].upper(), bin(i)[2:]])))
if __name__ == '__main__':
n = int(input())
print_formatted(n) |
class File:
def __init__(self, hash, realName, extension, url):
self.hash = hash
self.realName = realName
self.extension = extension
self.url = url
@staticmethod
def from_DB(record):
return File(record[0], record[1], record[2], record[3])
| class File:
def __init__(self, hash, realName, extension, url):
self.hash = hash
self.realName = realName
self.extension = extension
self.url = url
@staticmethod
def from_db(record):
return file(record[0], record[1], record[2], record[3]) |
""" This module contains the utility functions for the main module. """
def request_type(request):
""" If the request is for multiple addresses, build a str with separator """
if isinstance(request, list):
# If the list is ints convert to string.
to_string = ''.join(str(e) for e in request)
... | """ This module contains the utility functions for the main module. """
def request_type(request):
""" If the request is for multiple addresses, build a str with separator """
if isinstance(request, list):
to_string = ''.join((str(e) for e in request))
request = ','.join(to_string)
return r... |
class TicTacToe:
def __init__(self) -> None:
"""
Create TicTacToe Game logic
"""
self.tic_board = [[" ", " ", " "],
[" ", " ", " "],
[" ", " ", " "]]
self.turn = True
def play(self, x: int, y: int) -> bool:
... | class Tictactoe:
def __init__(self) -> None:
"""
Create TicTacToe Game logic
"""
self.tic_board = [[' ', ' ', ' '], [' ', ' ', ' '], [' ', ' ', ' ']]
self.turn = True
def play(self, x: int, y: int) -> bool:
"""
Playes one move for each player
... |
class Node(object):
def __init__(self, value, parent=None):
self.value = value
self.parent = parent
def __eq__(self, other):
if isinstance(other, Node):
return self.value == other.value
return NotImplemented
def __ne__(self, other):
return not self.__eq_... | class Node(object):
def __init__(self, value, parent=None):
self.value = value
self.parent = parent
def __eq__(self, other):
if isinstance(other, Node):
return self.value == other.value
return NotImplemented
def __ne__(self, other):
return not self.__eq... |
class Vertex:
def __init__(self, id):
self.id = id
self.edges = set()
def outgoing_edges(self):
for edge in self.edges:
successor = edge.get_successor(self)
if successor is not None:
yield edge
| class Vertex:
def __init__(self, id):
self.id = id
self.edges = set()
def outgoing_edges(self):
for edge in self.edges:
successor = edge.get_successor(self)
if successor is not None:
yield edge |
"""
Test cases for micro-grid systems
The following systems are considered
1. AC micro-grid
2. DC micro-grid
3. Hybrid AC/DC micro-grid
"""
| """
Test cases for micro-grid systems
The following systems are considered
1. AC micro-grid
2. DC micro-grid
3. Hybrid AC/DC micro-grid
""" |
# -*- coding: UTF-8 -*-
light = input('input a light')
if light == 'red':
print('GoGoGO')
elif light == 'green':
print('stop')
| light = input('input a light')
if light == 'red':
print('GoGoGO')
elif light == 'green':
print('stop') |
'''
Resources/other/contact
_______________________
Contact information for XL Discoverer.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
'''
__all__ = [
'AUTHOR',
'AUTHOR_EMAIL',
'MAINTAINER',
'MAI... | """
Resources/other/contact
_______________________
Contact information for XL Discoverer.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
"""
__all__ = ['AUTHOR', 'AUTHOR_EMAIL', 'MAINTAINER', 'MAINTAINER_EMAIL']
au... |
# -* coding: utf-8 -*-
"""Numerical polynomial and multivariate polynomial library."""
__version__ = '0.0.1.dev0'
| """Numerical polynomial and multivariate polynomial library."""
__version__ = '0.0.1.dev0' |
# Binary Tree Level Order Traversal - Breadth First Search 1
# Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level).
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
... | class Treenode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def level_traverse(self, node, level):
if level == len(self.levels):
self.levels.append([])
self.levels[level].append(node.v... |
# Seasons.py -- Hass helper python_script to turn a Climate entity into a smart
# thermostat, with support for multiple thermostats each having their own
# schedule.
#
# INPUTS:
# * climate_unit (required): The Climate entity to be controlled
# * global_mode (required): an entity whose state is the desired global clima... | seasons = {('Cold Winter', 'climate.first_floor_heat'): [{'title': 'Ecobee schedule', 'operation': 'heat'}], ('Cold Winter', 'climate.second_floor'): [{'title': 'Ecobee schedule', 'operation': 'heat'}], ('Cold Winter', 'climate.loft_heat'): [{'title': 'Ecobee schedule', 'operation': 'heat'}], ('Winter', 'climate.first_... |
# --------------
# Code starts here
class_1=['Geoffrey Hinton','Andrew Ng','Sebastian Raschka','Yoshua Bengio']
class_2=['Hilary Mason','Carla Gentry','Corinna Cortes']
new_class= class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove('Carla Gentry')
print(new_class)
# ... | class_1 = ['Geoffrey Hinton', 'Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio']
class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes']
new_class = class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
new_class.remove('Carla Gentry')
print(new_class)
courses = {'Math': 65, 'English... |
# Init conventions for input generation
ROT_DIR_REF = -1
CURRENT_DIR_REF = -1
PHASE_DIR_REF = -1
class InputError(Exception):
"""Raised when the input data are incomplete or incorrect"""
pass
| rot_dir_ref = -1
current_dir_ref = -1
phase_dir_ref = -1
class Inputerror(Exception):
"""Raised when the input data are incomplete or incorrect"""
pass |
def join_bash_scripts(scripts):
"""
have the option of creating a wrapper script for every group of bash files
to be run, or just join them on the fly.
"""
if len(scripts) < 2:
raise NotImplementedError
output_script = scripts[0]
for script in scripts[1:]:
output_script = ... | def join_bash_scripts(scripts):
"""
have the option of creating a wrapper script for every group of bash files
to be run, or just join them on the fly.
"""
if len(scripts) < 2:
raise NotImplementedError
output_script = scripts[0]
for script in scripts[1:]:
output_script = out... |
def cria(linhas, colunas):
return {'linhas': linhas, 'colunas': colunas, 'dados': {}}
#[[0,3],[1,2]]
def criaLst(matriz_lst):
linhas = len(matriz_lst) #2
colunas = len(matriz_lst[0]) #2
dados = {} #{(0,1): 3, (1,0):1, (1,1):2}
for i in range(linhas):
for j in range(colunas):
if... | def cria(linhas, colunas):
return {'linhas': linhas, 'colunas': colunas, 'dados': {}}
def cria_lst(matriz_lst):
linhas = len(matriz_lst)
colunas = len(matriz_lst[0])
dados = {}
for i in range(linhas):
for j in range(colunas):
if matriz_lst[i][j] != 0:
dados[i, j]... |
# -*- coding: utf-8 -*-
def main():
n, l = list(map(int, input().split()))
s = input()
tab_count = 1
crash_count = 0
for si in s:
if si == '+':
tab_count += 1
else:
tab_count -= 1
if tab_count > l:
crash_count += 1
... | def main():
(n, l) = list(map(int, input().split()))
s = input()
tab_count = 1
crash_count = 0
for si in s:
if si == '+':
tab_count += 1
else:
tab_count -= 1
if tab_count > l:
crash_count += 1
tab_count = 1
print(crash_count... |
#Autor Manuela Garcia Monsalve
# 28 septiembre 2018
#Esta es la super clase Vehiculo donde se encuentran los atributos de marca, modelo y color que seran
#heredados para las subclases
class Vehiculo():
def __init__(self,marca,color, modelo): #Se generan los atributos para poder ser heredados
self.marca = ... | class Vehiculo:
def __init__(self, marca, color, modelo):
self.marca = marca
self.color = color
self.modelo = modelo
def prender(self):
pass
def arrancar(self):
pass
def apagar(self):
pass |
widget_types = [
"textinput", # Editable text input box
"textupdate", # Read only text update
"led", # On/Off LED indicator
"combo", # Select from a number of choice values
"icon", # This field gives the URL for an icon for the whole Block
"group", # Group node in a TreeView that other fie... | widget_types = ['textinput', 'textupdate', 'led', 'combo', 'icon', 'group', 'table', 'checkbox', 'flowgraph']
def widget(widget_type):
"""Associates a widget with this field"""
assert widget_type in widget_types, 'Got %r, expected one of %s' % (widget_type, widget_types)
tag = 'widget:%s' % widget_type
... |
"""
17 Cupboards - https://codeforces.com/problemset/problem/248/A
"""
n = int(input())
nL, nR = 0, 0
for _ in range(n):
x, y = map(int, input().split())
nL += x
nR += y
print(min(nL, n - nL) + min(nR, n - nR))
| """
17 Cupboards - https://codeforces.com/problemset/problem/248/A
"""
n = int(input())
(n_l, n_r) = (0, 0)
for _ in range(n):
(x, y) = map(int, input().split())
n_l += x
n_r += y
print(min(nL, n - nL) + min(nR, n - nR)) |
def cookie(x):
if isinstance(x, str):
cookie_eater = "Zach"
elif isinstance(x, int) or isinstance(x, float):
cookie_eater = "Monica"
else:
cookie_eater = "the dog"
if x == True or x == False:
cookie_eater = "the dog"
return "Who ate the last cookie? It was %s!" % cookie_eater
print(cookie("Ryan... | def cookie(x):
if isinstance(x, str):
cookie_eater = 'Zach'
elif isinstance(x, int) or isinstance(x, float):
cookie_eater = 'Monica'
else:
cookie_eater = 'the dog'
if x == True or x == False:
cookie_eater = 'the dog'
return 'Who ate the last cookie? It was %s!' % cook... |
result = ''
for line in DATA:
result += line + '\n'
| result = ''
for line in DATA:
result += line + '\n' |
# -*- coding: utf-8 -*-
"""
Model object specification and validation.
"""
| """
Model object specification and validation.
""" |
class Solution:
def maximalRectangle(self, matrix: List[List[str]]) -> int:
dp = [[0] * len(matrix[0]) for i in range(len(matrix))]
for row_i, row in enumerate(matrix):
for col_i, col in enumerate(row):
if col == "0":
dp[row_i][col_i] = 0
... | class Solution:
def maximal_rectangle(self, matrix: List[List[str]]) -> int:
dp = [[0] * len(matrix[0]) for i in range(len(matrix))]
for (row_i, row) in enumerate(matrix):
for (col_i, col) in enumerate(row):
if col == '0':
dp[row_i][col_i] = 0
... |
# variables 4
a = "abc"
b = 1
c = 1.5
d = True
e = 3 + 5j
print("a:", type(a), "b", type(b), "c:", type(c),
"d:", type(d), "e:", type(e))
| a = 'abc'
b = 1
c = 1.5
d = True
e = 3 + 5j
print('a:', type(a), 'b', type(b), 'c:', type(c), 'd:', type(d), 'e:', type(e)) |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold(x1, y1, x2, y2, r1, r2):
distSq = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)
radSumSq = (r1 + r2) * (r1 + ... | def f_gold(x1, y1, x2, y2, r1, r2):
dist_sq = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)
rad_sum_sq = (r1 + r2) * (r1 + r2)
if distSq == radSumSq:
return 1
elif distSq > radSumSq:
return -1
else:
return 0
if __name__ == '__main__':
param = [(11, 36, 62, 64, 50, 4), (87... |
#!/usr/bin/env python
# Task 1
instructions = list()
with open("./dec_2/dec2_input.txt") as f:
instructions = [x for x in f.read().split('\n')]
start_position = [0, 0]
for direction in instructions:
info = direction.split(' ')
vector, length = info[0], int(info[1])
if vector == "forward":
star... | instructions = list()
with open('./dec_2/dec2_input.txt') as f:
instructions = [x for x in f.read().split('\n')]
start_position = [0, 0]
for direction in instructions:
info = direction.split(' ')
(vector, length) = (info[0], int(info[1]))
if vector == 'forward':
start_position[0] += length
e... |
a = input()
s = [int(x) for x in input().split()]
buff = 0
load = False
for num in s:
if num - buff < 0:
load = True
if num - buff >= 30:
print(buff+30)
break
else:
if load:
buff += 5
load = False
else:
buff = num + 5
else:
prin... | a = input()
s = [int(x) for x in input().split()]
buff = 0
load = False
for num in s:
if num - buff < 0:
load = True
if num - buff >= 30:
print(buff + 30)
break
elif load:
buff += 5
load = False
else:
buff = num + 5
else:
print(buff + 30) |
"""File IO."""
def re_readable_read(file):
"""Read file and reset cursor/pointer to allow fast, simple re-read.
Side Effects:
Mutates file stream object passed as argument by moving cursor/pointer
from from position at start of function call and setting it to position
'0'. If file str... | """File IO."""
def re_readable_read(file):
"""Read file and reset cursor/pointer to allow fast, simple re-read.
Side Effects:
Mutates file stream object passed as argument by moving cursor/pointer
from from position at start of function call and setting it to position
'0'. If file stre... |
class OmnipyConfiguration(object):
def __init__(self):
self.mqtt_host = ""
self.mqtt_port = 1883
self.mqtt_clientid = ""
self.mqtt_command_topic = ""
self.mqtt_response_topic = ""
self.mqtt_rate_topic = ""
| class Omnipyconfiguration(object):
def __init__(self):
self.mqtt_host = ''
self.mqtt_port = 1883
self.mqtt_clientid = ''
self.mqtt_command_topic = ''
self.mqtt_response_topic = ''
self.mqtt_rate_topic = '' |
def solution(N):
num = bin(N)[2:].split('1')
if len(num[1:-1]) == 0:
return 0
return len(max(num[1:-1], key=lambda x: len(x)))
| def solution(N):
num = bin(N)[2:].split('1')
if len(num[1:-1]) == 0:
return 0
return len(max(num[1:-1], key=lambda x: len(x))) |
a = int(input())
b = int ( input ( ) )
a = int(input())
| a = int(input())
b = int(input())
a = int(input()) |
class Solution(object):
def shuffle(self, nums, n):
"""
:type nums: List[int]
:type n: int
:rtype: List[int]
"""
shuffled_array = []
for i in range(0, n):
shuffled_array.append(nums[i])
shuffled_array.append(nums[i+n])
return ... | class Solution(object):
def shuffle(self, nums, n):
"""
:type nums: List[int]
:type n: int
:rtype: List[int]
"""
shuffled_array = []
for i in range(0, n):
shuffled_array.append(nums[i])
shuffled_array.append(nums[i + n])
return... |
word = 'Python'
word[0] = 'M'
| word = 'Python'
word[0] = 'M' |
#Operator Name Example
# > Greater than x > y
x = 5
y = 3
print(x > y) # true
| x = 5
y = 3
print(x > y) |
# Copyright (c) 2019-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
def f_gold ( x , y , z ) :
c = 0
while ( x and y and z ) :
x = x - 1
y = y - 1
z = z - 1
... | def f_gold(x, y, z):
c = 0
while x and y and z:
x = x - 1
y = y - 1
z = z - 1
c = c + 1
return c
if __name__ == '__main__':
param = [(23, 98, 25), (87, 55, 94), (35, 90, 29), (25, 9, 41), (93, 22, 39), (52, 42, 96), (95, 88, 26), (91, 64, 51), (75, 1, 6), (96, 44, 76)]
... |
# Voting with delegation.
# Information about voters
voters: public({
# weight is accumulated by delegation
weight: num,
# if true, that person already voted
voted: bool,
# person delegated to
delegate: address,
# index of the voted proposal
vote: num
}[address])
# This is a type for a... | voters: public({weight: num, voted: bool, delegate: address, vote: num}[address])
proposals: public({name: bytes32, vote_count: num}[num])
voter_count: public(num)
chairperson: public(address)
def __init__(_proposalNames: bytes32[5]):
self.chairperson = msg.sender
self.voter_count = 0
for i in range(5):
... |
load(
"@com_googlesource_gerrit_bazlets//tools:junit.bzl",
"junit_tests",
)
def tests(tests):
for src in tests:
name = src[len("tst/"):len(src) - len(".java")].replace("/", "_")
labels = []
timeout = "moderate"
if name.startswith("org_eclipse_jgit_"):
package = n... | load('@com_googlesource_gerrit_bazlets//tools:junit.bzl', 'junit_tests')
def tests(tests):
for src in tests:
name = src[len('tst/'):len(src) - len('.java')].replace('/', '_')
labels = []
timeout = 'moderate'
if name.startswith('org_eclipse_jgit_'):
package = name[len('or... |
#Exam
def solution(N):
if (N > 0) and (N < 1000): #Assume that N is an integer within 1 to 1000
list_of_coded_numbers = [] #List will contain the coded numbers in descending order
while N > 0:
if (N % 2 == 0) and (N % 3 == 0) and (N % 5 == 0):
list_of_coded_numbers.append... | def solution(N):
if N > 0 and N < 1000:
list_of_coded_numbers = []
while N > 0:
if N % 2 == 0 and N % 3 == 0 and (N % 5 == 0):
list_of_coded_numbers.append('CodilityTestCoders')
elif N % 3 == 0 and N % 5 == 0:
list_of_coded_numbers.append('Test... |
#
# This file is part of stac2odc
# Copyright (C) 2020 INPE.
#
# stac2odc is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
#
__version__ = '0.0.1'
| __version__ = '0.0.1' |
"""
LINK: https://leetcode.com/problems/power-of-three/
Given an integer n, return true if it is a power of three. Otherwise, return false.
An integer n is a power of three, if there exists an integer x such that n == 3x.
Example 1:
Input: n = 27
Output: true
Example 2:
Input: n = 0
Output: false
Example 3:
Inpu... | """
LINK: https://leetcode.com/problems/power-of-three/
Given an integer n, return true if it is a power of three. Otherwise, return false.
An integer n is a power of three, if there exists an integer x such that n == 3x.
Example 1:
Input: n = 27
Output: true
Example 2:
Input: n = 0
Output: false
Example 3:
Inpu... |
str = 'X-DSPAM-Confidence:0.8475'
print(str)
colon = str.find(":")
fnum = float(str[colon+1:])
print("Number from string equals:", fnum)
| str = 'X-DSPAM-Confidence:0.8475'
print(str)
colon = str.find(':')
fnum = float(str[colon + 1:])
print('Number from string equals:', fnum) |
# Python > Strings > String Validators
# Identify the presence of alphanumeric characters, alphabetical characters, digits, lowercase and uppercase characters in a string.
#
# https://www.hackerrank.com/challenges/string-validators/problem
#
if __name__ == '__main__':
s = input()
# any alphanumeric characters... | if __name__ == '__main__':
s = input()
print(any((c.isalnum() for c in s)))
print(any((c.isalpha() for c in s)))
print(any((c.isdigit() for c in s)))
print(any((c.islower() for c in s)))
print(any((c.isupper() for c in s))) |
"""
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
a=input()
print(a[0].upper()+a[1:]) | """
*
* Author: Juarez Paulino(coderemite)
* Email: juarez.paulino@gmail.com
*
"""
a = input()
print(a[0].upper() + a[1:]) |
DOMAIN = "airthings"
KEY_API = "api"
PLATFORMS = ("sensor",)
ERROR_LOGIN_FAILED = "login_failed"
| domain = 'airthings'
key_api = 'api'
platforms = ('sensor',)
error_login_failed = 'login_failed' |
'''
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... | """
The MIT License (MIT)
Copyright (c) 2016 WavyCloud
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, p... |
def updatePars():
if not parent().par.Lockbuffermenu:
return
op('output_table_path').cook(force=True)
dat = op('output_table')
if dat.numRows < 2:
return
p = parent().par.Outputbuffer
p.menuNames = dat.col('name')[1:]
p.menuLabels = dat.col('label')[1:]
def onTableChange(dat):
updatePars()
def onValueChang... | def update_pars():
if not parent().par.Lockbuffermenu:
return
op('output_table_path').cook(force=True)
dat = op('output_table')
if dat.numRows < 2:
return
p = parent().par.Outputbuffer
p.menuNames = dat.col('name')[1:]
p.menuLabels = dat.col('label')[1:]
def on_table_change(... |
def error_Check(inputX, inputY, nSamples, initVector, minCost, alpha,
training_epochs, silent, overlap, objFunc,
keepPercent, batchSize, batching):
acceptedObjFuncs = ["", "QUAD"]
if inputX.shape[0] != inputY.shape[0]:
print("Must have the same number of labels... | def error__check(inputX, inputY, nSamples, initVector, minCost, alpha, training_epochs, silent, overlap, objFunc, keepPercent, batchSize, batching):
accepted_obj_funcs = ['', 'QUAD']
if inputX.shape[0] != inputY.shape[0]:
print('Must have the same number of labels and training samples')
return -... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 25 14:06:56 2020
Class to handle coordinates in Hive according to how they are used in the
entomology Hive position editor.
cf.
https://entomology.appspot.com/hive.html?bg=0&board=:w***@bA**@bB***@bG*@bL*@bM*@bP*@bQ**@bS***@wA**@wB***@wG*@wL*@wM*@w... | """
Created on Thu Jun 25 14:06:56 2020
Class to handle coordinates in Hive according to how they are used in the
entomology Hive position editor.
cf.
https://entomology.appspot.com/hive.html?bg=0&board=:w***@bA**@bB***@bG*@bL*@bM*@bP*@bQ**@bS***@wA**@wB***@wG*@wL*@wM*@wP*@wQ**@wS&grid=1
@author: epenjos
"""
class ... |
'''
Kattis - oddgnome
theres probably a smarter way, but i really can't be bothered
Time: O(n^2 log n), Space: O(n)
'''
num_tc = int(input())
for _ in range(num_tc):
arr = list(map(int, input().split()))
n = arr.pop(0)
for i in range(1, n):
new_arr = arr[:i] + arr[i+1:]
if new_arr == s... | """
Kattis - oddgnome
theres probably a smarter way, but i really can't be bothered
Time: O(n^2 log n), Space: O(n)
"""
num_tc = int(input())
for _ in range(num_tc):
arr = list(map(int, input().split()))
n = arr.pop(0)
for i in range(1, n):
new_arr = arr[:i] + arr[i + 1:]
if new_arr == sort... |
def force_bytes(value):
if isinstance(value, bytes):
return value
return str(value).encode('utf-8')
| def force_bytes(value):
if isinstance(value, bytes):
return value
return str(value).encode('utf-8') |
"""
## Questions : EASY
### 1844. [Replace All Digits with Characters](https://leetcode.com/problems/replace-all-digits-with-characters/)
You are given a 0-indexed string s that has lowercase English letters in its even indices and digits in its odd indices.
There is a function shift(c, x), where c is a character and... | """
## Questions : EASY
### 1844. [Replace All Digits with Characters](https://leetcode.com/problems/replace-all-digits-with-characters/)
You are given a 0-indexed string s that has lowercase English letters in its even indices and digits in its odd indices.
There is a function shift(c, x), where c is a character and... |
"""
Event dispatcher for non-browser Events which occur on Widget state changes.
"""
class EventDispatcher(object):
"""
Base class for event notifier.
"""
def __init__(self, name):
super(EventDispatcher, self).__init__()
self.queue = []
self.name = name
def _genTargetFuncName(self):
"""
Returns the... | """
Event dispatcher for non-browser Events which occur on Widget state changes.
"""
class Eventdispatcher(object):
"""
Base class for event notifier.
"""
def __init__(self, name):
super(EventDispatcher, self).__init__()
self.queue = []
self.name = name
def _gen_target_func_nam... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.