content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
CHUNK_SIZE = 16
CHUNK_SIZE_PIXELS = 256
RATTLE_DELAY = 10
RATTLE_RANGE = 3 | chunk_size = 16
chunk_size_pixels = 256
rattle_delay = 10
rattle_range = 3 |
def solution(string, markers):
string = string.split('\n')
result = ''
for line in string:
for character in line:
if character not in markers:
result += character
else:
result = result[:-1]
break
result += '\n'
... | def solution(string, markers):
string = string.split('\n')
result = ''
for line in string:
for character in line:
if character not in markers:
result += character
else:
result = result[:-1]
break
result += '\n'
retur... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
errno.py
Error Code Define
Copyright: All Rights Reserved 2019-2019
History:
1 2019-07-14 Liu Yu (source@liuyu.com) Initial Version
'''
SUCCESS = 'SUCC'
ERROR_SUCCESS = SUCCESS
FAIL = 'FAIL'
ERROR = FAIL
ERROR_INVALID = 'INVALID'
ERROR_UNSUPPORT = 'UNSU... | """
errno.py
Error Code Define
Copyright: All Rights Reserved 2019-2019
History:
1 2019-07-14 Liu Yu (source@liuyu.com) Initial Version
"""
success = 'SUCC'
error_success = SUCCESS
fail = 'FAIL'
error = FAIL
error_invalid = 'INVALID'
error_unsupport = 'UNSUPPORT' |
# Write a Python program to add leading zeroes to a string
String = 'hello'
print(String.rjust(9, '0'))
| string = 'hello'
print(String.rjust(9, '0')) |
class InputMode:
def __init__(self):
pass
def GetTitle(self):
return ""
def TitleHighlighted(self):
return True
def GetHelpText(self):
return None
def OnMouse(self, event):
pass
def OnKeyDown(self, event):
pass
def OnKe... | class Inputmode:
def __init__(self):
pass
def get_title(self):
return ''
def title_highlighted(self):
return True
def get_help_text(self):
return None
def on_mouse(self, event):
pass
def on_key_down(self, event):
pass
def on_key_up(self,... |
src = Split('''
hal_test.c
''')
component = aos_component('hal_test', src)
component.add_cflags('-Wall')
component.add_cflags('-Werror')
| src = split('\n hal_test.c\n')
component = aos_component('hal_test', src)
component.add_cflags('-Wall')
component.add_cflags('-Werror') |
class resizable_array:
def __init__(self,arraysize):
self.arraysize = arraysize
self.array = [None for i in range(self.arraysize)]
self.temp =1
def __insert(self,value):
for i in range(len(self.array)):
if self.array[i] == None:
self.array[i] = valu... | class Resizable_Array:
def __init__(self, arraysize):
self.arraysize = arraysize
self.array = [None for i in range(self.arraysize)]
self.temp = 1
def __insert(self, value):
for i in range(len(self.array)):
if self.array[i] == None:
self.array[i] = va... |
qt=int(input())
for i in range(qt):
jogadores=input().split()
nome1=str(jogadores[0])
escolha1=str(jogadores[1])
nome2 = str(jogadores[2])
escolha2 = str(jogadores[3])
numeros=input().split()
numerosJ1=int(numeros[0])
numerosJ2=int(numeros[1])
if escolha1=="PAR" and escolha2=="IMP... | qt = int(input())
for i in range(qt):
jogadores = input().split()
nome1 = str(jogadores[0])
escolha1 = str(jogadores[1])
nome2 = str(jogadores[2])
escolha2 = str(jogadores[3])
numeros = input().split()
numeros_j1 = int(numeros[0])
numeros_j2 = int(numeros[1])
if escolha1 == 'PAR' and... |
class VertexPaint:
use_group_restrict = None
use_normal = None
use_spray = None
| class Vertexpaint:
use_group_restrict = None
use_normal = None
use_spray = None |
@app.post('/login')
def login(response: Response):
...
token = manager.create_access_token(
data=dict(sub=user.email)
)
manager.set_cookie(response, token)
return response | @app.post('/login')
def login(response: Response):
...
token = manager.create_access_token(data=dict(sub=user.email))
manager.set_cookie(response, token)
return response |
print("Pass statement in Python");
for i in range (1,11,1):
if(i==3):
i = i + 1;
pass;
else:
print(i);
i = i + 1;
| print('Pass statement in Python')
for i in range(1, 11, 1):
if i == 3:
i = i + 1
pass
else:
print(i)
i = i + 1 |
# Runtime error
N = int(input())
X = list(map(int, input().split())) # Memory problem
tot = sum(X)
visited = [False for k in range(N)]
currentStar = 0
while True:
if currentStar < 0 or currentStar > N-1:
break
else:
visited[currentStar] = True
if X[currentStar] >= 1:
if X[... | n = int(input())
x = list(map(int, input().split()))
tot = sum(X)
visited = [False for k in range(N)]
current_star = 0
while True:
if currentStar < 0 or currentStar > N - 1:
break
else:
visited[currentStar] = True
if X[currentStar] >= 1:
if X[currentStar] % 2 == 0:
... |
n = int(input())
for i in range(n):
dieta = list(input())
cafe = list(input())
almoco = list(input())
todos = cafe + almoco
cheat = False
for comido in todos:
if comido in dieta:
dieta.remove(comido)
else:
cheat = True
if not cheat:
print("".join(sorted(dieta)))
else:
print("CHEATER")
| n = int(input())
for i in range(n):
dieta = list(input())
cafe = list(input())
almoco = list(input())
todos = cafe + almoco
cheat = False
for comido in todos:
if comido in dieta:
dieta.remove(comido)
else:
cheat = True
if not cheat:
print(''.jo... |
first_name = input("Enter you name")
last_name = input("Enter you surname")
past_year = input("MS program start year?")
a = 2 + int(past_year)
print(f"{first_name} {last_name} {past_year} you are graduate in {a}") | first_name = input('Enter you name')
last_name = input('Enter you surname')
past_year = input('MS program start year?')
a = 2 + int(past_year)
print(f'{first_name} {last_name} {past_year} you are graduate in {a}') |
# --------------
# Code starts here
class_1 = ['Geoffrey Hinton','Andrew Ng', 'Sebastian Raschka', 'Yoshua Bengio']
#print(class_1)
class_2 = ['Hilary Mason', 'Carla Gentry', 'Corinna Cortes']
#print(class_2)
new_class = class_1 + class_2
print(new_class)
new_class.append('Peter Warden')
print(new_class)
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... |
class Solution:
def validateStackSequences(self, pushed: List[int], popped: List[int]) -> bool:
if not pushed and not popped:
return True
aux = []
idx = 0
for _ in pushed:
aux.append(_)
while aux and aux[-1] == popped[idx]:
aux.pop(... | class Solution:
def validate_stack_sequences(self, pushed: List[int], popped: List[int]) -> bool:
if not pushed and (not popped):
return True
aux = []
idx = 0
for _ in pushed:
aux.append(_)
while aux and aux[-1] == popped[idx]:
aux... |
widget = WidgetDefault()
widget.border = "None"
commonDefaults["GroupBoxWidget"] = widget
def generateGroupBoxWidget(file, screen, box, parentName):
name = box.getName()
file.write(" %s = leGroupBoxWidget_New();" % (name))
generateBaseWidget(file, screen, box)
writeSetStringAssetName(file, name,... | widget = widget_default()
widget.border = 'None'
commonDefaults['GroupBoxWidget'] = widget
def generate_group_box_widget(file, screen, box, parentName):
name = box.getName()
file.write(' %s = leGroupBoxWidget_New();' % name)
generate_base_widget(file, screen, box)
write_set_string_asset_name(file, n... |
# Problem Statement Link: https://www.hackerrank.com/challenges/the-minion-game/problem
def minion_game(w):
s = k = 0
v = ['A', 'E', 'I', 'O', 'U']
for x in range( len(w) ):
if w[x] in v:
k += (len(w)-x)
else:
s += (len(w)-x)
if s == k: print("Draw")
el... | def minion_game(w):
s = k = 0
v = ['A', 'E', 'I', 'O', 'U']
for x in range(len(w)):
if w[x] in v:
k += len(w) - x
else:
s += len(w) - x
if s == k:
print('Draw')
elif s > k:
print('Stuart', s)
else:
print('Kevin', k)
if __name__ == '... |
a = 10
print(a)
| a = 10
print(a) |
def stations_level_over_threshold(stations, tol): #2B part 2
stationList = []
for station in stations:
if station.typical_range_consistent() and station.latest_level != None:
if station.relative_water_level() > tol:
stationList.append((station, station.relative_water_level()... | def stations_level_over_threshold(stations, tol):
station_list = []
for station in stations:
if station.typical_range_consistent() and station.latest_level != None:
if station.relative_water_level() > tol:
stationList.append((station, station.relative_water_level()))
sort... |
lanches = ['X-Bacon','X-Tudo','X-Calabresa', 'CalaFrango','X-Salada','CalaFrango','X-Bacon','CalaFrango']
lanches_finais = []
print('Estamos sem CalaFrango')
while 'CalaFrango' in lanches:
lanches.remove('CalaFrango')
while lanches:
preparo = lanches.pop()
print('Preparei seu lanche de {}'.format(preparo)... | lanches = ['X-Bacon', 'X-Tudo', 'X-Calabresa', 'CalaFrango', 'X-Salada', 'CalaFrango', 'X-Bacon', 'CalaFrango']
lanches_finais = []
print('Estamos sem CalaFrango')
while 'CalaFrango' in lanches:
lanches.remove('CalaFrango')
while lanches:
preparo = lanches.pop()
print('Preparei seu lanche de {}'.format(prep... |
# -*- coding: utf-8 -*-
# list of system groups ordered descending by rights in application
groups = ['wheel', 'sudo', 'users']
| groups = ['wheel', 'sudo', 'users'] |
def escreva(frase):
a = len(frase)+2
print('~'*(a+2))
print(f' {frase}')
print('~' * (a + 2))
escreva('Gustavo Guanabara')
escreva('Curso de Python no YouTube')
escreva('CeV')
| def escreva(frase):
a = len(frase) + 2
print('~' * (a + 2))
print(f' {frase}')
print('~' * (a + 2))
escreva('Gustavo Guanabara')
escreva('Curso de Python no YouTube')
escreva('CeV') |
# Find the set of maximums and minimums in a series,
# with some tolerance for multiple max or minimums
# if some highest or lowest values in a series are
# tolerance_threshold away
def find_maxs_or_mins_in_series(series, kind, tolerance_threshold):
isolated_globals = []
if kind == "max":
global_max_or_min = s... | def find_maxs_or_mins_in_series(series, kind, tolerance_threshold):
isolated_globals = []
if kind == 'max':
global_max_or_min = series.max()
else:
global_max_or_min = series.min()
for (idx, val) in series.items():
if val == global_max_or_min or abs(global_max_or_min - val) < tole... |
load("//cipd/internal:cipd_client.bzl", "cipd_client_deps")
def cipd_deps():
cipd_client_deps()
| load('//cipd/internal:cipd_client.bzl', 'cipd_client_deps')
def cipd_deps():
cipd_client_deps() |
class State:
def __init__(self):
self.pixel = None
self.keyboard = None
self.keyboard_layout = None
pass
def start(self):
pass
def end(self):
pass
def onTick(self):
pass
def onButtonPress(self):
pass
def onButtonRelease(self):
... | class State:
def __init__(self):
self.pixel = None
self.keyboard = None
self.keyboard_layout = None
pass
def start(self):
pass
def end(self):
pass
def on_tick(self):
pass
def on_button_press(self):
pass
def on_button_release(s... |
def convert( s: str, numRows: int) -> str:
print('hi')
# Algorithm:
# Output: Linearize the zig zagged string matrix
# input: string and number of rows in which to make the string zag zag
# Algorithm steps:
# d and nd list /diagonal and nondiagonal lists
#remove all prints if pasting in leetc... | def convert(s: str, numRows: int) -> str:
print('hi')
if numRows == 1:
return s
step = 1
pos = 1
lines = {}
for c in s:
if pos not in lines:
print(pos, 'im pos', 'and im step', step)
lines[pos] = c
print(lines, 'when pos not in lines')
... |
class Solution:
def reconstructQueue(self, people: list) -> list:
if not people:
return []
def func(x):
return -x[0], x[1]
people.sort(key=func)
new_people = [people[0]]
for i in people[1:]:
new_people.insert(i[1], i)
return new_p... | class Solution:
def reconstruct_queue(self, people: list) -> list:
if not people:
return []
def func(x):
return (-x[0], x[1])
people.sort(key=func)
new_people = [people[0]]
for i in people[1:]:
new_people.insert(i[1], i)
return ne... |
class Post():
def __init__(self, userIden, content, timestamp, image=None, score='0', replies=None):
self.userIden = userIden
self.content = content
self.timestamp = timestamp
self.image = image
self.score = score
self.replies = [] if not replies else replies
| class Post:
def __init__(self, userIden, content, timestamp, image=None, score='0', replies=None):
self.userIden = userIden
self.content = content
self.timestamp = timestamp
self.image = image
self.score = score
self.replies = [] if not replies else replies |
def radix_sort(alist, base=10):
if alist == []:
return
def key_factory(digit, base):
def key(alist, index):
return ((alist[index]//(base**digit)) % base)
return key
largest = max(alist)
exp = 0
while base**exp <= largest:
alist = counting_sort(alist, bas... | def radix_sort(alist, base=10):
if alist == []:
return
def key_factory(digit, base):
def key(alist, index):
return alist[index] // base ** digit % base
return key
largest = max(alist)
exp = 0
while base ** exp <= largest:
alist = counting_sort(alist, bas... |
N, *A = map(int, open(0).read().split())
result = 0
for i in range(2, 1000):
t = 0
for a in A:
if a % i == 0:
t += 1
result = max(result, t)
print(result)
| (n, *a) = map(int, open(0).read().split())
result = 0
for i in range(2, 1000):
t = 0
for a in A:
if a % i == 0:
t += 1
result = max(result, t)
print(result) |
#{
#Driver Code Starts
#Initial Template for Python 3
# } Driver Code Ends
#User function Template for python3
# Function to calculate average
def calc_average(nums):
# Your code here
mini = min(nums)
maxi = max(nums)
n = len(nums)
s = sum(nums)-mini-maxi
s = s//(n-2)
return s
#{ ... | def calc_average(nums):
mini = min(nums)
maxi = max(nums)
n = len(nums)
s = sum(nums) - mini - maxi
s = s // (n - 2)
return s
def main():
testcases = int(input())
while testcases > 0:
size_arr = int(input())
a = input().split()
arr = list()
for i in range... |
# in file: models/db_custom.py
db.define_table('company', Field('name', notnull = True, unique = True), format = '%(name)s')
db.define_table(
'contact',
Field('name', notnull = True),
Field('company', 'reference company'),
Field('picture', 'upload'),
Field('email', requires = IS_EMAIL()),
Field('phone... | db.define_table('company', field('name', notnull=True, unique=True), format='%(name)s')
db.define_table('contact', field('name', notnull=True), field('company', 'reference company'), field('picture', 'upload'), field('email', requires=is_email()), field('phone_number', requires=is_match('[\\d\\-\\(\\) ]+')), field('add... |
def main():
i = 0
while True:
print(i)
i += 1
if i > 5:
break
j = 10
while j < 100:
print(j)
j += 10
while 1:
print(j + i)
break
while 0.1:
print(j + i)
break
while 0:
print("This never executes")... | def main():
i = 0
while True:
print(i)
i += 1
if i > 5:
break
j = 10
while j < 100:
print(j)
j += 10
while 1:
print(j + i)
break
while 0.1:
print(j + i)
break
while 0:
print('This never executes')
... |
'''
Synchronization phenomena in networked dynamics
'''
def kuramoto(G, k: float, w: Callable):
'''
Kuramoto lattice
k: coupling gain
w: intrinsic frequency
'''
phase = gds.node_gds(G)
w_vec = np.array([w(x) for x in phase.X])
phase.set_evolution(dydt=lambda t, y: w_vec + k * phase.div(np.sin(phase.grad())))
... | """
Synchronization phenomena in networked dynamics
"""
def kuramoto(G, k: float, w: Callable):
"""
Kuramoto lattice
k: coupling gain
w: intrinsic frequency
"""
phase = gds.node_gds(G)
w_vec = np.array([w(x) for x in phase.X])
phase.set_evolution(dydt=lambda t, y: w_vec + k * phase.div(np.sin(phase... |
def Markov1_3D_BC_taper_init(particle, fieldset, time):
# Initialize random velocity magnitudes in the isopycnal plane
u_iso_prime_abs = ParcelsRandom.normalvariate(0, math.sqrt(fieldset.nusquared))
v_iso_prime_abs = ParcelsRandom.normalvariate(0, math.sqrt(fieldset.nusquared))
# (double) derivativ... | def markov1_3_d_bc_taper_init(particle, fieldset, time):
u_iso_prime_abs = ParcelsRandom.normalvariate(0, math.sqrt(fieldset.nusquared))
v_iso_prime_abs = ParcelsRandom.normalvariate(0, math.sqrt(fieldset.nusquared))
sx = -drhodx / drhodz
sy = -drhody / drhodz
sabs = math.sqrt(Sx ** 2 + Sy ** 2)
... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def verticalTraversalRec(self, root, row, col, columns):
if not root:
return
co... | class Solution:
def vertical_traversal_rec(self, root, row, col, columns):
if not root:
return
columns[col].append((row, root.val))
self.verticalTraversalRec(root.left, row + 1, col - 1, columns)
self.verticalTraversalRec(root.right, row + 1, col + 1, columns)
def v... |
'''
Author: Shuailin Chen
Created Date: 2021-09-14
Last Modified: 2021-09-25
content:
'''
_base_ = [
'../_base_/models/deeplabv3_r50a-d8.py',
'../_base_/datasets/sn6_sar_pro.py', '../_base_/default_runtime.py',
'../_base_/schedules/schedule_20k.py'
]
model = dict(
decode_head=dict(num_classes=2), auxi... | """
Author: Shuailin Chen
Created Date: 2021-09-14
Last Modified: 2021-09-25
content:
"""
_base_ = ['../_base_/models/deeplabv3_r50a-d8.py', '../_base_/datasets/sn6_sar_pro.py', '../_base_/default_runtime.py', '../_base_/schedules/schedule_20k.py']
model = dict(decode_head=dict(num_classes=2), auxiliary_head=dict(num... |
# encoding=utf-8
d = dict(one=1, two=2)
d1 = {'one': 1, "two": 2}
d2 = dict()
d2['one'] = 1
d2['two'] = 2
# [(key,value), (key, value)]
my_dict = {}.setdefault().append(1)
print(my_dict[1]) | d = dict(one=1, two=2)
d1 = {'one': 1, 'two': 2}
d2 = dict()
d2['one'] = 1
d2['two'] = 2
my_dict = {}.setdefault().append(1)
print(my_dict[1]) |
@app.route('/home')
def home():
return redirect(url_for('about', name='World'))
@app.route('/about/<name>')
def about(name):
return f'Hello {name}' | @app.route('/home')
def home():
return redirect(url_for('about', name='World'))
@app.route('/about/<name>')
def about(name):
return f'Hello {name}' |
def Naturals(n):
yield n
yield from Naturals(n+1)
s = Naturals(1)
print("Natural #s", next(s), next(s), next(s), next(s))
def sieve(s):
n = next(s)
yield n
yield from sieve(i for i in s if i%n != 0)
p = sieve(Naturals(2))
print("Prime #s", next(p), next(p), next(p), \
next(p), next(p), next(p)... | def naturals(n):
yield n
yield from naturals(n + 1)
s = naturals(1)
print('Natural #s', next(s), next(s), next(s), next(s))
def sieve(s):
n = next(s)
yield n
yield from sieve((i for i in s if i % n != 0))
p = sieve(naturals(2))
print('Prime #s', next(p), next(p), next(p), next(p), next(p), next(p),... |
##
## parse argument
##
## written by @ciku370
##
def toxic(wibu_bau,bawang):
shit = bawang.split(',')
dan_buriq = 0
result = {}
for i in wibu_bau:
if i in shit:
try:
result.update({wibu_bau[dan_buriq]:wibu_bau[dan_buriq+1]})
except IndexError:
... | def toxic(wibu_bau, bawang):
shit = bawang.split(',')
dan_buriq = 0
result = {}
for i in wibu_bau:
if i in shit:
try:
result.update({wibu_bau[dan_buriq]: wibu_bau[dan_buriq + 1]})
except IndexError:
continue
dan_buriq += 1
retur... |
for linha in range(5):
for coluna in range(3):
if (linha == 0 and coluna == 0) or (linha == 4 and coluna == 0):
print(' ', end='')
elif linha == 0 or linha == 4 or coluna == 0:
print('*', end='')
else:
print(' ', end='')
print()
| for linha in range(5):
for coluna in range(3):
if linha == 0 and coluna == 0 or (linha == 4 and coluna == 0):
print(' ', end='')
elif linha == 0 or linha == 4 or coluna == 0:
print('*', end='')
else:
print(' ', end='')
print() |
IV = bytearray.fromhex("391e95a15847cfd95ecee8f7fe7efd66")
CT = bytearray.fromhex("8473dcb86bc12c6b6087619c00b6657e")
# Hashes from the description of challenge
ORIGINAL_MESSAGE = bytearray.fromhex(
"464952455f4e554b45535f4d454c4121") # FIRE_NUKES_MELA!
ALTERED_MESSAGE = bytearray.fromhex(
"53454e445f4e55444... | iv = bytearray.fromhex('391e95a15847cfd95ecee8f7fe7efd66')
ct = bytearray.fromhex('8473dcb86bc12c6b6087619c00b6657e')
original_message = bytearray.fromhex('464952455f4e554b45535f4d454c4121')
altered_message = bytearray.fromhex('53454e445f4e554445535f4d454c4121')
altered_iv = bytearray()
for i in range(16):
ALTERED_... |
#Check String
'''To check if a certain phrase or character is present in a string, we can use the keyword in.'''
#Check if "free" is present in the following text:
txt = "The best things in life are free!"
print("free" in txt)
txt = "Hello buddie owo!"
if "owo" in txt:
print("Yes, 'owo' is present.")
'''
Terminal... | """To check if a certain phrase or character is present in a string, we can use the keyword in."""
txt = 'The best things in life are free!'
print('free' in txt)
txt = 'Hello buddie owo!'
if 'owo' in txt:
print("Yes, 'owo' is present.")
"\nTerminal:\nTrue\nYes, 'owo' is present.\n" |
testes = int(input())
casos = []
for x in range(testes):
casos_ = input().split()
casos.append(casos_)
for x in range(testes):
a = int(casos[x][0])
b = int(casos[x][1])
print(a+b)
| testes = int(input())
casos = []
for x in range(testes):
casos_ = input().split()
casos.append(casos_)
for x in range(testes):
a = int(casos[x][0])
b = int(casos[x][1])
print(a + b) |
# led-control WS2812B LED Controller Server
# Copyright 2021 jackw01. Released under the MIT License (see LICENSE for details).
default = {
0: {
'name': 'Sunset Light',
'mode': 0,
'colors': [
[
0.11311430089613972,
1,
1
... | default = {0: {'name': 'Sunset Light', 'mode': 0, 'colors': [[0.11311430089613972, 1, 1], [0.9936081381405101, 0.6497928024431981, 1], [0.9222222222222223, 0.9460097254004577, 1], [0.7439005234662223, 0.7002515180395283, 1], [0.6175635842715993, 0.6474992244615467, 1]]}, 10: {'name': 'Sunset Dark', 'mode': 0, 'colors':... |
class Solution:
def myAtoi(self, s: str) -> int:
s = s.strip(' ')
s = s.rstrip('.')
lens = len(s)
if (not s) or s[0].isalpha() or (lens == 1 and not s[0].isdecimal()):
return 0
string, i = '', 0
if s[0] in {'-', '+'}:
i = 1
string... | class Solution:
def my_atoi(self, s: str) -> int:
s = s.strip(' ')
s = s.rstrip('.')
lens = len(s)
if not s or s[0].isalpha() or (lens == 1 and (not s[0].isdecimal())):
return 0
(string, i) = ('', 0)
if s[0] in {'-', '+'}:
i = 1
st... |
while(True):
try:
n,k=map(int,input().split())
text=input()
except EOFError:
break
p=0
for i in range(1,n):
if text[0:i]==text[n-i:n]:
p=i
#print(p)
s=text+text[p:]*(k-1)
print(s) | while True:
try:
(n, k) = map(int, input().split())
text = input()
except EOFError:
break
p = 0
for i in range(1, n):
if text[0:i] == text[n - i:n]:
p = i
s = text + text[p:] * (k - 1)
print(s) |
class ExileError(Exception):
pass
class SCardError(ExileError):
pass
class YKOATHError(ExileError):
pass
| class Exileerror(Exception):
pass
class Scarderror(ExileError):
pass
class Ykoatherror(ExileError):
pass |
class Team:
def __init__(self, client):
self.client = client
async def info(self):
result = await self.client.api_call('GET', 'team.info')
return result['team']
| class Team:
def __init__(self, client):
self.client = client
async def info(self):
result = await self.client.api_call('GET', 'team.info')
return result['team'] |
def chunk_string(string, chunk_size=450):
# Limit = 462, cutting off at 450 to be safe.
string_chunks = []
while len(string) != 0:
current_chunk = string[0:chunk_size]
string_chunks.append(current_chunk)
string = string[len(current_chunk):]
return string_chunks
| def chunk_string(string, chunk_size=450):
string_chunks = []
while len(string) != 0:
current_chunk = string[0:chunk_size]
string_chunks.append(current_chunk)
string = string[len(current_chunk):]
return string_chunks |
def maiusculas(frase):
palavra = ''
for letra in frase:
if ord(letra) >= 65 and ord(letra) <= 90:
palavra += letra
return palavra
def maiusculas2(frase):
palavra = ''
for letra in frase:
if letra.isupper():
palavra += letra
return palavra
| def maiusculas(frase):
palavra = ''
for letra in frase:
if ord(letra) >= 65 and ord(letra) <= 90:
palavra += letra
return palavra
def maiusculas2(frase):
palavra = ''
for letra in frase:
if letra.isupper():
palavra += letra
return palavra |
# SQRT(X) LEETCODE SOLUTION:
# creating a class.
class Solution(object):
# creating a function to solve the problem.
def mySqrt(self, x):
# declaring a variable to track the output.
i = 0
# creating a while-loop to run while the output variable squared is less than or equa... | class Solution(object):
def my_sqrt(self, x):
i = 0
while i * i <= x:
i += 1
return i - 1 |
with open("input_blocks.txt") as file:
content = file.read()
for idx, block in enumerate(content.strip().split("---\n")):
with open(f"blocks/{idx+1}.txt", "w") as file:
print(block.rstrip(), file=file) | with open('input_blocks.txt') as file:
content = file.read()
for (idx, block) in enumerate(content.strip().split('---\n')):
with open(f'blocks/{idx + 1}.txt', 'w') as file:
print(block.rstrip(), file=file) |
# Defining a Function
def iterPower(base, exp):
# Making an Iterative Call
result = 1
while exp > 0:
result *= base
exp -= 1
return result
| def iter_power(base, exp):
result = 1
while exp > 0:
result *= base
exp -= 1
return result |
class Solution:
def isSolvable(self, words, result) -> bool:
for word in words:
if len(word) > len(result):
return False
words = [word[::-1] for word in words]
result = result[::-1]
c2i = [-1] * 26
i2c = [False] * 10
def dfs(idx, digit, s)... | class Solution:
def is_solvable(self, words, result) -> bool:
for word in words:
if len(word) > len(result):
return False
words = [word[::-1] for word in words]
result = result[::-1]
c2i = [-1] * 26
i2c = [False] * 10
def dfs(idx, digit, ... |
def findMin(l):
min = -1
for i in l:
print (i)
if i<min:
min = i
print("the lowest value is: ",min)
l=[12,0,15,-30,-24,40]
findMin(l)
| def find_min(l):
min = -1
for i in l:
print(i)
if i < min:
min = i
print('the lowest value is: ', min)
l = [12, 0, 15, -30, -24, 40]
find_min(l) |
{
"targets": [
{
"target_name": "towerdef",
"sources": [ "./cpp/towerdef_Main.cpp",
"./cpp/towerdef.cpp",
"./cpp/towerdef_Map.cpp",
"./cpp/towerdef_PathMap.cpp",
"./cpp/towerdef_Structure.cpp",
"./cpp/... | {'targets': [{'target_name': 'towerdef', 'sources': ['./cpp/towerdef_Main.cpp', './cpp/towerdef.cpp', './cpp/towerdef_Map.cpp', './cpp/towerdef_PathMap.cpp', './cpp/towerdef_Structure.cpp', './cpp/towerdef_oneTileStruct.cpp', './cpp/towerdef_Struct_Wall.cpp', './cpp/Grid.cpp', './cpp/GameMap.cpp', './cpp/PointList.cpp'... |
def main():
T = int(input())
case_id = 1
while case_id <= T:
num = int(input())
if num == 0:
print("Case #{case_id}: INSOMNIA".format(case_id=case_id))
case_id += 1
continue
all_nums = []
res = 0
cur_num = num
while... | def main():
t = int(input())
case_id = 1
while case_id <= T:
num = int(input())
if num == 0:
print('Case #{case_id}: INSOMNIA'.format(case_id=case_id))
case_id += 1
continue
all_nums = []
res = 0
cur_num = num
while len(all_... |
#POO 2 - POLIFORMISMO
#
class Coche():
def desplazamiento(self):
print("Me desplazo utilizando cuatro ruedas")
class Moto():
def desplazamiento(self):
print("Me Desplazo utilizando dos Ruedas")
class Camion():
def desplazamiento(self):
print("Me Desplazo utilizando seis Rue... | class Coche:
def desplazamiento(self):
print('Me desplazo utilizando cuatro ruedas')
class Moto:
def desplazamiento(self):
print('Me Desplazo utilizando dos Ruedas')
class Camion:
def desplazamiento(self):
print('Me Desplazo utilizando seis Ruedas')
def desplazamientovehiculo(v... |
a=int(input('Enter first number:'))
b=int(input('Enter second number:'))
a=a+b
b=a-b
a=a-b
print('After swaping first number is=',a)
print('After swaping second number is=',b)
| a = int(input('Enter first number:'))
b = int(input('Enter second number:'))
a = a + b
b = a - b
a = a - b
print('After swaping first number is=', a)
print('After swaping second number is=', b) |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: papi
class Side(object):
Sell = -1
None_ = 0
Buy = 1
| class Side(object):
sell = -1
none_ = 0
buy = 1 |
class DriverTarget:
bone_target = None
data_path = None
id = None
id_type = None
transform_space = None
transform_type = None
| class Drivertarget:
bone_target = None
data_path = None
id = None
id_type = None
transform_space = None
transform_type = None |
N = int(input())
road_ends = []
barns_list = []
for x in range(0, N):
barns_list.append(x)
for x in range(0, N):
road_ends.append(-1)
for x in range(0, N-1):
temp_list = input().split()
road_ends[int(temp_list[1])-1] = int(temp_list[0])-1
for x in range(0, N):
wasthere = []
... | n = int(input())
road_ends = []
barns_list = []
for x in range(0, N):
barns_list.append(x)
for x in range(0, N):
road_ends.append(-1)
for x in range(0, N - 1):
temp_list = input().split()
road_ends[int(temp_list[1]) - 1] = int(temp_list[0]) - 1
for x in range(0, N):
wasthere = []
for y in range(... |
def grade(arg, key):
if "flag{1_h4v3_4_br41n}".lower() == key.lower():
return True, "You are not insane!"
else:
return False, "..."
| def grade(arg, key):
if 'flag{1_h4v3_4_br41n}'.lower() == key.lower():
return (True, 'You are not insane!')
else:
return (False, '...') |
def selection_form(data, target, name, radio=False):
body = ''
for i in data:
body += '<input value="{0}" name="{1}" type="{2}"> {0}</br>'.format(i, name, 'radio' if radio else 'checkbox')
body += '</br><input type="submit" value="Submit">'
return '<form method="post" action="{0}">{1}</form>'.format(target, body)... | def selection_form(data, target, name, radio=False):
body = ''
for i in data:
body += '<input value="{0}" name="{1}" type="{2}"> {0}</br>'.format(i, name, 'radio' if radio else 'checkbox')
body += '</br><input type="submit" value="Submit">'
return '<form method="post" action="{0}">{1}</form>'.fo... |
def resolve():
'''
code here
'''
N = int(input())
As = [int(item) for item in input().split()]
Bs = [int(item) for item in input().split()]
Ds = [a - b for a, b in zip(As, Bs)]
cnt_minus = 0
total_minus = 0
minus_list = []
cnt_plus_to_drow = 0
plus_list = []
for i... | def resolve():
"""
code here
"""
n = int(input())
as = [int(item) for item in input().split()]
bs = [int(item) for item in input().split()]
ds = [a - b for (a, b) in zip(As, Bs)]
cnt_minus = 0
total_minus = 0
minus_list = []
cnt_plus_to_drow = 0
plus_list = []
for ite... |
# We your solution for 1.4 here!
def is_prime(x):
t=1
while t<x:
if x%t==0:
if t!=1 and t!=x:
return False
t=t+1
return True
print(is_prime(5191))
| def is_prime(x):
t = 1
while t < x:
if x % t == 0:
if t != 1 and t != x:
return False
t = t + 1
return True
print(is_prime(5191)) |
{
"targets": [
{
"target_name": "knit_decoder",
"sources": ["src/main.cpp", "src/context.hpp", "src/worker.hpp"],
"include_dirs" : [
"<!(node -e \"require('nan')\")"
],
"cflags_cc!": ["-fno-rtti", "-fno-exceptions"],
"cflags!": ["-fno-exceptions", "-Wall", "-std=c++11"]... | {'targets': [{'target_name': 'knit_decoder', 'sources': ['src/main.cpp', 'src/context.hpp', 'src/worker.hpp'], 'include_dirs': ['<!(node -e "require(\'nan\')")'], 'cflags_cc!': ['-fno-rtti', '-fno-exceptions'], 'cflags!': ['-fno-exceptions', '-Wall', '-std=c++11'], 'xcode_settings': {'OTHER_CPLUSPLUSFLAGS': ['-std=c++1... |
class Properties:
def __init__(self, client):
self.client = client
def search(self, params={}):
url = '/properties'
property_params = {'property': params}
return self.client.request('GET', url, property_params)
| class Properties:
def __init__(self, client):
self.client = client
def search(self, params={}):
url = '/properties'
property_params = {'property': params}
return self.client.request('GET', url, property_params) |
class Solution:
def longestPalindrome(self, s: str) -> int:
total = 0
for i in collections.Counter(list(s)).values():
total += i // 2 * 2
if i % 2 == 1 and total % 2 == 0:
total += 1
return total | class Solution:
def longest_palindrome(self, s: str) -> int:
total = 0
for i in collections.Counter(list(s)).values():
total += i // 2 * 2
if i % 2 == 1 and total % 2 == 0:
total += 1
return total |
def build_question_context(rendered_block, form):
question = rendered_block["question"]
context = {
"block": rendered_block,
"form": {
"errors": form.errors,
"question_errors": form.question_errors,
"mapped_errors": form.map_errors(),
"answer_erro... | def build_question_context(rendered_block, form):
question = rendered_block['question']
context = {'block': rendered_block, 'form': {'errors': form.errors, 'question_errors': form.question_errors, 'mapped_errors': form.map_errors(), 'answer_errors': {}, 'fields': {}}}
answer_ids = []
for answer in quest... |
class Product:
def __init__(self, id, isOwner, name, description, main_img):
self.id = id
self.isOwner = isOwner
self.name = name
self.description = description
self.main_img = main_img
self.images = []
self.stock = {}
self.price = {}
def add_imag... | class Product:
def __init__(self, id, isOwner, name, description, main_img):
self.id = id
self.isOwner = isOwner
self.name = name
self.description = description
self.main_img = main_img
self.images = []
self.stock = {}
self.price = {}
def add_ima... |
# File: difference_of_squares.py
# Purpose: To find th difference of squares of first n numbers
# Programmer: Amal Shehu
# Course: Exercism
# Date: Saturday 3rd September 2016, 01:50 PM
def sum_of_squares(number):
return sum([i**2 for i in range(1, number+1)])
def square_of_sum(number):
... | def sum_of_squares(number):
return sum([i ** 2 for i in range(1, number + 1)])
def square_of_sum(number):
return sum(range(1, number + 1)) ** 2
def difference(number):
return square_of_sum(number) - sum_of_squares(number) |
class InvalidOperationError(BaseException):
pass
class Node():
def __init__(self, value, next = None):
self.value = value
self.next = next
class AnimalShelter():
def __init__(self):
self.front = None
self.rear = None
def __str__(self):
# FRONT -> { a } -> {... | class Invalidoperationerror(BaseException):
pass
class Node:
def __init__(self, value, next=None):
self.value = value
self.next = next
class Animalshelter:
def __init__(self):
self.front = None
self.rear = None
def __str__(self):
if self.front == None:
... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
# If-else-if flow control.
marks = 84
if 80 < marks and 100 >= marks:
print("A")
elif 60 < marks and 80 >= marks:
print("B")
elif 50 < marks and 60 >= marks:
print("C")
elif 35 < marks and 50 >= marks:
print("S")
else:
print("F")
# Iteration/loop flo... | marks = 84
if 80 < marks and 100 >= marks:
print('A')
elif 60 < marks and 80 >= marks:
print('B')
elif 50 < marks and 60 >= marks:
print('C')
elif 35 < marks and 50 >= marks:
print('S')
else:
print('F')
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
for num in my_list:
print(num)
for num in my_list:
... |
symbol748 = {}
def _update(code_748, code_gbk, numchars):
for i in range(numchars):
symbol748[code_748 + i] = code_gbk + i
_update(0x8EFF, 0x8E8F, 1) # 8EFF -> 8E8F
_update(0x94FF, 0x94DA, 1) # 94FF -> 94DA
_update(0x95FF, 0x95F1, 1) # 95FF -> 95F1
_update(0x9680, 0xB17E, 1) # 9680 -> B17E
_update... | symbol748 = {}
def _update(code_748, code_gbk, numchars):
for i in range(numchars):
symbol748[code_748 + i] = code_gbk + i
_update(36607, 36495, 1)
_update(38143, 38106, 1)
_update(38399, 38385, 1)
_update(38528, 45438, 1)
_update(38529, 46206, 1)
_update(38530, 46462, 1)
_update(38531, 45665, 1)
_update(4... |
# The method below seems to yield correct result but will end in TLE for large cases.
# def candy(ratings) -> int:
# n = len(ratings)
# candies = [0]*n
# while True:
# changed = False
# for i in range(1, n):
# if ratings[i-1] < ratings[i] and candies[i-1]... | def candy(ratings) -> int:
n = len(ratings)
last_one = 1
num_candies = 1
last_le = 0
last_big_diff = []
for i in range(1, n):
if ratings[i] > ratings[i - 1]:
num_candies += last_one + 1
last_one += 1
last_le = i
elif ratings[i] == ratings[i - 1... |
def InsertionSort(array):
for i in range(1,len(array)):
current = array[i]
j = i-1
while(j >= 0 and current < array[j]):
array[j+1] = array[j]
j -= 1
array[j+1] = current
array = [32,33,1,0,23,98,-19,15,7,-52,76]
print("Before sort: ")
print(*array,sep=', ')
print("After sort: ")
InsertionSort(array)
pri... | def insertion_sort(array):
for i in range(1, len(array)):
current = array[i]
j = i - 1
while j >= 0 and current < array[j]:
array[j + 1] = array[j]
j -= 1
array[j + 1] = current
array = [32, 33, 1, 0, 23, 98, -19, 15, 7, -52, 76]
print('Before sort: ')
print(*... |
HTTP_OK = 200
HTTP_UNAUTHORIZED = 401
HTTP_FOUND = 302
HTTP_BAD_REQUEST = 400
HTTP_NOT_FOUND = 404
HTTP_SERVICE_UNAVAILABLE = 503
| http_ok = 200
http_unauthorized = 401
http_found = 302
http_bad_request = 400
http_not_found = 404
http_service_unavailable = 503 |
x=int(input("enter x1"))
y=int(input("enter x2"))
c=x*y
print(c)
| x = int(input('enter x1'))
y = int(input('enter x2'))
c = x * y
print(c) |
coordinates_E0E1E1 = ((126, 112),
(126, 114), (126, 115), (126, 130), (126, 131), (127, 113), (127, 115), (127, 131), (128, 92), (128, 115), (128, 116), (128, 121), (128, 131), (129, 92), (129, 116), (129, 118), (129, 119), (129, 131), (130, 92), (130, 117), (130, 122), (130, 131), (131, 87), (131, 89), (131, 90), (1... | coordinates_e0_e1_e1 = ((126, 112), (126, 114), (126, 115), (126, 130), (126, 131), (127, 113), (127, 115), (127, 131), (128, 92), (128, 115), (128, 116), (128, 121), (128, 131), (129, 92), (129, 116), (129, 118), (129, 119), (129, 131), (130, 92), (130, 117), (130, 122), (130, 131), (131, 87), (131, 89), (131, 90), (1... |
books = input().split("&")
while True:
commands = input().split(" | ")
if commands[0] == "Done":
print(", ".join(books))
break
elif commands[0] == "Add Book":
book_name = commands[1]
if book_name not in books:
ins = books.insert(0, book_name)
else:
... | books = input().split('&')
while True:
commands = input().split(' | ')
if commands[0] == 'Done':
print(', '.join(books))
break
elif commands[0] == 'Add Book':
book_name = commands[1]
if book_name not in books:
ins = books.insert(0, book_name)
else:
... |
'''
This utility is for Custom Exceptions.
a) Stop_Test_Exception
You can raise a generic exceptions using just a string.
This is particularly useful when you want to end a test midway based on some condition.
'''
class Stop_Test_Exception(Exception):
def __init__(self,message):
self.message=message
... | """
This utility is for Custom Exceptions.
a) Stop_Test_Exception
You can raise a generic exceptions using just a string.
This is particularly useful when you want to end a test midway based on some condition.
"""
class Stop_Test_Exception(Exception):
def __init__(self, message):
self.message = message
... |
class Node:
def __init__(self, value):
self.val = value
self.next = self.prev = None
class MyLinkedList(object):
def __init__(self):
self.__head = self.__tail = Node(-1)
self.__head.next = self.__tail
self.__tail.prev = self.__head
self.__size = 0
def get(... | class Node:
def __init__(self, value):
self.val = value
self.next = self.prev = None
class Mylinkedlist(object):
def __init__(self):
self.__head = self.__tail = node(-1)
self.__head.next = self.__tail
self.__tail.prev = self.__head
self.__size = 0
def get(... |
class NotFound(Exception):
pass
class HTTPError(Exception):
pass
| class Notfound(Exception):
pass
class Httperror(Exception):
pass |
#!/usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'liyiqun'
# microsrv_linkstat_url = 'http://127.0.0.1:32769/microsrv/link_stat'
# microsrv_linkstat_url = 'http://127.0.0.1:33710/microsrv/link_stat'
# microsrv_linkstat_url = 'http://10.9.63.208:7799/microsrv/ms_link/link/links'
# microsrv_linkstat_url = '... | __author__ = 'liyiqun'
te_flow_rest_port = 34770
te_sched_rest_port = 34773
te_protocol = 'http://'
te_host_port_divider = ':'
openo_ms_url_prefix = '/openoapi/microservices/v1/services'
openo_dm_url_prefix = '/openoapi/drivermgr/v1/drivers'
openo_esr_url_prefix = '/openoapi/extsys/v1/sdncontrollers'
openo_brs_url_pref... |
class QgisCtrl():
def __init__(self, iface):
super(QgisCtrl, self).__init__()
self.iface = iface | class Qgisctrl:
def __init__(self, iface):
super(QgisCtrl, self).__init__()
self.iface = iface |
def add_numbers(a, b):
return a + b
def two_n_plus_one(a):
return 2 * a + 1 | def add_numbers(a, b):
return a + b
def two_n_plus_one(a):
return 2 * a + 1 |
'''
## Question
### 13. [Roman to Integer](https://leetcode.com/problems/palindrome-number/)
Roman numerals are represented by seven different symbols: `I, V, X, L, C, D and M` .
| | |
|**Symbol**|**Value**|
|:--:|:--:|
|I|1|
|V|5|
|X|10|
|L|50|
|C|100|
|D|500|
|M|1000|
For example, `two` is written as `II` in Rom... | """
## Question
### 13. [Roman to Integer](https://leetcode.com/problems/palindrome-number/)
Roman numerals are represented by seven different symbols: `I, V, X, L, C, D and M` .
| | |
|**Symbol**|**Value**|
|:--:|:--:|
|I|1|
|V|5|
|X|10|
|L|50|
|C|100|
|D|500|
|M|1000|
For example, `two` is written as `II` in Rom... |
# Lesson 2
class FakeSocket:
# These variables belong to the CLASS, not the instance!
DEFAULT_IP = '127.0.0.1'
DEFAULT_PORT = 12345
# instance methods can access instance, class, and static variables and methods.
def __init__(self, ip=DEFAULT_IP, port=DEFAULT_PORT):
# These variables belong... | class Fakesocket:
default_ip = '127.0.0.1'
default_port = 12345
def __init__(self, ip=DEFAULT_IP, port=DEFAULT_PORT):
if self.ip_is_valid(ip):
self._ip = ip
else:
self._ip = FakeSocket.DEFAULT_IP
self._ip = self.__class__.DEFAULT_IP
self._port = p... |
class CacheItem:
def __init__(self, id, value, compValue=1, order = 1) -> None:
self.id = id
self.compValue = compValue
self.value = value
self.order = order
class PriorityQueue:
items = []
def add(self, item: CacheItem):
self.items.append(item)
se... | class Cacheitem:
def __init__(self, id, value, compValue=1, order=1) -> None:
self.id = id
self.compValue = compValue
self.value = value
self.order = order
class Priorityqueue:
items = []
def add(self, item: CacheItem):
self.items.append(item)
self.sort()
... |
def greaterThan(a, b):
flag = True
count = 0
for i in range(3):
if a[i] < b[i]:
flag = False
break
if a[i] > b[i]:
count += 1
if not flag or count < 1:
return False
else:
return True
t = int(input())
for _ in range(t):
l = []
for i in range(3):
l.append(list(map(int,... | def greater_than(a, b):
flag = True
count = 0
for i in range(3):
if a[i] < b[i]:
flag = False
break
if a[i] > b[i]:
count += 1
if not flag or count < 1:
return False
else:
return True
t = int(input())
for _ in range(t):
l = []
... |
i = 11
print(i)
j = 12
print(j)
f = 12.34
print(f)
g = -0.99
print(g)
s = "Hello, World"
print(s)
print(s[0])
print(s[:5])
print(s[7:12])
l = [2,3,4,5,7,11]
print(l) | i = 11
print(i)
j = 12
print(j)
f = 12.34
print(f)
g = -0.99
print(g)
s = 'Hello, World'
print(s)
print(s[0])
print(s[:5])
print(s[7:12])
l = [2, 3, 4, 5, 7, 11]
print(l) |
# https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
class Solution:
def maxProfit(self, prices: list[int]) -> int:
max_price = prices[-1]
max_profit = 0
idx = len(prices) - 2 # Start from the penultimate item
while idx >= 0:
curr_price = prices[idx]
... | class Solution:
def max_profit(self, prices: list[int]) -> int:
max_price = prices[-1]
max_profit = 0
idx = len(prices) - 2
while idx >= 0:
curr_price = prices[idx]
profit = max_price - curr_price
if profit > max_profit:
max_profit... |
##### CLASSE ARBRE #####
class Arbre:
#Initialise l'arbre
def __init__(self):
#Valeur de l'arbre
self.valeur = 0
#Fils gauche
self.gauche = None
#Fils droit
self.droit = None
#Position de l'arbre
self.position = Position()
def __str__(self):
return "["+s... | class Arbre:
def __init__(self):
self.valeur = 0
self.gauche = None
self.droit = None
self.position = position()
def __str__(self):
return '[' + str(self.gauche) + ',' + str(self.droit) + ']'
def __len__(self):
return len(self.gauche) + len(self.droit)
... |
class A:
def func():
pass
class B:
def func():
pass
class C(B,A):
pass
c=C()
c.func() | class A:
def func():
pass
class B:
def func():
pass
class C(B, A):
pass
c = c()
c.func() |
class Graph:
def __init__(self, nodes):
self.node = {i: set([]) for i in range(nodes)}
def addEdge(self, src, dest, dir=False):
self.node[src].add(dest)
if not dir:
self.node[dest].add(src) # for undirected edges
class Solution:
def hasCycle(self, graph):
whitese... | class Graph:
def __init__(self, nodes):
self.node = {i: set([]) for i in range(nodes)}
def add_edge(self, src, dest, dir=False):
self.node[src].add(dest)
if not dir:
self.node[dest].add(src)
class Solution:
def has_cycle(self, graph):
whiteset = set(graph.node... |
epochs = 500
batch_size = 25
dropout = 0.2
variables_device = "/cpu:0"
processing_device = "/cpu:0"
sequence_length = 20 # input timesteps
learning_rate = 1e-3
prediction_length = 2 # expected output sequence length
embedding_dim = 5 # input dimension total number of features in our case
## BOSHLTD/ MICO same....
C... | epochs = 500
batch_size = 25
dropout = 0.2
variables_device = '/cpu:0'
processing_device = '/cpu:0'
sequence_length = 20
learning_rate = 0.001
prediction_length = 2
embedding_dim = 5
companies = ['EICHERMOT', 'BOSCHLTD', 'MARUTI', 'ULTRACEMCO', 'HEROMOTOCO', 'TATAMOTORS', 'BPCL', 'AXISBANK', 'TATASTEEL', 'ZEEL', 'CIPLA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.