content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
# -------------------------------------------------- class: AddonInstallSettings ------------------------------------------------- #
class AddonInstallSettings:
# --------------------------------------------------------- Init --------------------------------------------------------- #
def __init__(
s... | class Addoninstallsettings:
def __init__(self, path: str):
self.path = path
def post_install_action(self, browser, addon_id: str, internal_addon_id: str, addon_base_url: str) -> None:
return None |
'''
Description:
You are given the root of a binary tree with n nodes, where each node is uniquely assigned a value from 1 to n. You are also given a sequence of n values voyage, which is the desired pre-order traversal of the binary tree.
Any node in the binary tree can be flipped by swapping its left and right sub... | """
Description:
You are given the root of a binary tree with n nodes, where each node is uniquely assigned a value from 1 to n. You are also given a sequence of n values voyage, which is the desired pre-order traversal of the binary tree.
Any node in the binary tree can be flipped by swapping its left and right sub... |
installed_extensions = [ 'azext_identitydirmgt_v1_0',
'azext_planner_v1_0',
'azext_identitysignins_v1_0',
'azext_schemaextensions_v1_0',
'azext_mail_v1_0',
'azext_files_v1_0',
'azext_notes_v1_0',
'azext_crossdeviceexperiences_v1_0',
'azext_cloudcommunications_v1_0',
'azext_directoryobjects_v1_0',
'azext_users... | installed_extensions = ['azext_identitydirmgt_v1_0', 'azext_planner_v1_0', 'azext_identitysignins_v1_0', 'azext_schemaextensions_v1_0', 'azext_mail_v1_0', 'azext_files_v1_0', 'azext_notes_v1_0', 'azext_crossdeviceexperiences_v1_0', 'azext_cloudcommunications_v1_0', 'azext_directoryobjects_v1_0', 'azext_usersfunctions_v... |
# Fields for the tables generated from the mysql dump
table_fields = {"commits":
[
"author_id",
"committer_id",
"project_id",
"created_at"
],
"counters":
[
"id",
... | table_fields = {'commits': ['author_id', 'committer_id', 'project_id', 'created_at'], 'counters': ['id', 'date', 'commit_comments', 'commit_parents', 'commits', 'followers', 'organization_members', 'projects', 'users', 'issues', 'pull_requests', 'issue_comments', 'pull_request_comments', 'pull_request_history', 'watche... |
# Leo colorizer control file for factor mode.
# This file is in the public domain.
# Properties for factor mode.
properties = {
"commentEnd": ")",
"commentStart": "(",
"doubleBracketIndent": "true",
"indentCloseBrackets": "]",
"indentNextLines": "^(\\*<<|:).*",
"indentOpenBrackets": "... | properties = {'commentEnd': ')', 'commentStart': '(', 'doubleBracketIndent': 'true', 'indentCloseBrackets': ']', 'indentNextLines': '^(\\*<<|:).*', 'indentOpenBrackets': '[', 'lineComment': '!', 'lineUpClosingBracket': 'true', 'noWordSep': "+-*=><;.?/'"}
factor_main_attributes_dict = {'default': 'null', 'digit_re': '-?... |
# Source : https://leetcode.com/problems/find-the-highest-altitude/
# Author : foxfromworld
# Date : 13/11/2021
# First attempt
class Solution:
def largestAltitude(self, gain: List[int]) -> int:
alt, ret = 0, 0
for g in gain:
alt = alt + g
ret = max(alt, ret)
return... | class Solution:
def largest_altitude(self, gain: List[int]) -> int:
(alt, ret) = (0, 0)
for g in gain:
alt = alt + g
ret = max(alt, ret)
return ret |
def type_I(A, i, j):
# Swap two rows
A[i], A[j] = np.copy(A[j]), np.copy(A[i])
def type_II(A, i, const):
# Multiply row j of A by const
A[i] *= const
def type_III(A, i, j, const):
# Add a constant times row j to row i
A[i] += const*A[j]
| def type_i(A, i, j):
(A[i], A[j]) = (np.copy(A[j]), np.copy(A[i]))
def type_ii(A, i, const):
A[i] *= const
def type_iii(A, i, j, const):
A[i] += const * A[j] |
class Justifier:
def justify(self, textIn):
width = max(map(len, textIn))
return map(lambda s: s.rjust(width), textIn)
| class Justifier:
def justify(self, textIn):
width = max(map(len, textIn))
return map(lambda s: s.rjust(width), textIn) |
tournament = input()
total_played = 0
total_won = 0
total_lost = 0
while tournament != "End of tournaments":
games_per_tournament = int(input())
games_counter = 0
total_played += games_per_tournament
for games in range(1, games_per_tournament + 1):
desi_team = int(input())
other_team ... | tournament = input()
total_played = 0
total_won = 0
total_lost = 0
while tournament != 'End of tournaments':
games_per_tournament = int(input())
games_counter = 0
total_played += games_per_tournament
for games in range(1, games_per_tournament + 1):
desi_team = int(input())
other_team = i... |
CHECKPOINT = 'model/checkpoint.bin'
MODEL_PATH = 'model/model.bin'
input_path = 'input/train.csv'
LR = 0.01
scheduler_threshold = 0.001
scheduler_patience = 2
scheduler_decay_factor = 0.5
embed_dims = 128
hidden_dims = 128
num_layers = 1
bidirectional = False
dropout = 0.2
out_dims = 128
Batch_Size = 64
Epochs = 100... | checkpoint = 'model/checkpoint.bin'
model_path = 'model/model.bin'
input_path = 'input/train.csv'
lr = 0.01
scheduler_threshold = 0.001
scheduler_patience = 2
scheduler_decay_factor = 0.5
embed_dims = 128
hidden_dims = 128
num_layers = 1
bidirectional = False
dropout = 0.2
out_dims = 128
batch__size = 64
epochs = 100
s... |
BASE_URL = "https://www.zhixue.com"
# BASE_URL = "http://localhost:8080"
INFO_URL = f"{BASE_URL}/container/container/student/account/"
# Login
SERVICE_URL = f"{BASE_URL}:443/ssoservice.jsp"
SSO_URL = f"https://open.changyan.com/sso/login?sso_from=zhixuesso&service={SERVICE_URL}"
CHANGE_PASSWORD_URL = f"{BASE_URL}/por... | base_url = 'https://www.zhixue.com'
info_url = f'{BASE_URL}/container/container/student/account/'
service_url = f'{BASE_URL}:443/ssoservice.jsp'
sso_url = f'https://open.changyan.com/sso/login?sso_from=zhixuesso&service={SERVICE_URL}'
change_password_url = f'{BASE_URL}/portalcenter/home/updatePassword/'
test_password_u... |
debug_defs = select({
"//:debug-ast": ["DEBUG_AST"],
"//conditions:default": []
}) + select({
"//:debug-bindings": ["DEBUG_BINDINGS"],
"//conditions:default": []
}) + select({
"//:debug-ctors": ["DEBUG_CTORS"],
"//conditions:default": []
}) + select({
"//:debug-filters": ["DEBUG_FILTER... | debug_defs = select({'//:debug-ast': ['DEBUG_AST'], '//conditions:default': []}) + select({'//:debug-bindings': ['DEBUG_BINDINGS'], '//conditions:default': []}) + select({'//:debug-ctors': ['DEBUG_CTORS'], '//conditions:default': []}) + select({'//:debug-filters': ['DEBUG_FILTERS'], '//conditions:default': []}) + selec... |
_prefix = 'MC__'
JOB_DIR_COMPONENT_PATHS = {
'job_key': _prefix + 'JOB_KEY',
'job_meta': _prefix + 'JOB_META.json',
'job_spec': 'job_spec.json',
'entrypoint': 'entrypoint.sh',
'work_dir': 'work_dir',
'executed_checkpoint': _prefix + 'EXECUTED',
'completed_checkpoint': _prefix + 'COMPLETED',... | _prefix = 'MC__'
job_dir_component_paths = {'job_key': _prefix + 'JOB_KEY', 'job_meta': _prefix + 'JOB_META.json', 'job_spec': 'job_spec.json', 'entrypoint': 'entrypoint.sh', 'work_dir': 'work_dir', 'executed_checkpoint': _prefix + 'EXECUTED', 'completed_checkpoint': _prefix + 'COMPLETED', 'failure_checkpoint': _prefix... |
p=int(input('enter the principal amount'))
n=int(input('enter the number of year'))
r=int(input('enter the rate of interest'))
d=p*n*r/100
print('simple interest=',d)
| p = int(input('enter the principal amount'))
n = int(input('enter the number of year'))
r = int(input('enter the rate of interest'))
d = p * n * r / 100
print('simple interest=', d) |
c = get_config()
c.NotebookApp.ip = '{{IPYTHON_NB_LISTEN_ADDR}}'
c.NotebookApp.port = {{IPYTHON_NB_LISTEN_PORT}}
c.NotebookApp.open_browser = False
c.NotebookApp.notebook_dir = u'{{IPYTHON_NB_DIR}}'
c.NotebookApp.base_url = '{{HTTP_BASE_URL}}/{{IPYTHON_NB_PREFIX}}'
c.NotebookApp.tornado_settings = {'static_url_prefix... | c = get_config()
c.NotebookApp.ip = '{{IPYTHON_NB_LISTEN_ADDR}}'
c.NotebookApp.port = {{IPYTHON_NB_LISTEN_PORT}}
c.NotebookApp.open_browser = False
c.NotebookApp.notebook_dir = u'{{IPYTHON_NB_DIR}}'
c.NotebookApp.base_url = '{{HTTP_BASE_URL}}/{{IPYTHON_NB_PREFIX}}'
c.NotebookApp.tornado_settings = {'static_url_prefix':... |
class Solution:
def XXX(self, intervals: List[List[int]]) -> List[List[int]]:
res=[]
intervals.sort()
res.append(intervals[0])
for i in range(1,len(intervals)):
t=res[-1]
if intervals[i][0]<=t[1]:
res[-1][1]=max(intervals[i][1],res[-1][1])
... | class Solution:
def xxx(self, intervals: List[List[int]]) -> List[List[int]]:
res = []
intervals.sort()
res.append(intervals[0])
for i in range(1, len(intervals)):
t = res[-1]
if intervals[i][0] <= t[1]:
res[-1][1] = max(intervals[i][1], res[-... |
#!/usr/bin/env python
print("Hello World!")
# commnads
# $python hello.py
# Hello World!
# $python hello.py > output.txt
# if file exists, old file is deleted, new file created with same name
# if file doesn't exits, then new file is created
# $python hello.py >> output.txt
# if file exists, then result is appended... | print('Hello World!') |
# Separate the construction of a complex object from its
# representation so that the same construction process can create different representations.
# Parse a complex representation, create one of several targets.
# Allows you to build different kind of object by implementing the Steps,
# to build on particular objec... | class Anything(object):
def __init__(self):
self.build_step_1()
self.build_step_2()
def build_step_1(self):
raise NotImplementedError
def build_step_2(self):
raise NotImplementedError
class Anythinga(Anything):
def build_step_1(self):
pass
def build_step... |
def high_and_low(numbers):
# In this little assignment you are given a string of space separated numbers,
# and have to return the highest and lowest number.
result = [int(x) for x in numbers.split()]
string = str(max(result)) + " " + str(min(result))
return string
print(high_and_low("4 5 29 54 4 ... | def high_and_low(numbers):
result = [int(x) for x in numbers.split()]
string = str(max(result)) + ' ' + str(min(result))
return string
print(high_and_low('4 5 29 54 4 0 -214 542 -64 1 -3 6 -6')) |
class Clustering:
def __init__(self):
self._cluster = {}
def _query(self, jpt):
return self._cluster[jpt] | class Clustering:
def __init__(self):
self._cluster = {}
def _query(self, jpt):
return self._cluster[jpt] |
# https://codeforces.com/problemset/problem/705/A
n = int(input())
love = 'I love it'
hate = 'I hate it'
result = ''
if n == 1:
print('I hate it')
else:
for num in range(1, n + 1):
if num == n:
if num % 2 != 0:
result += hate
else:
result += lov... | n = int(input())
love = 'I love it'
hate = 'I hate it'
result = ''
if n == 1:
print('I hate it')
else:
for num in range(1, n + 1):
if num == n:
if num % 2 != 0:
result += hate
else:
result += love
break
if num % 2 != 0:
... |
#!/usr/bin/python
S = input()
P_score= S.split(" ")
#print (S)
for i in range (0,len(P_score)):
P_score[i]= int(P_score[i])
List_J=[1 for m in range(0,len(P_score))]## set default List_J as "1"
for i in range(0,(len(P_score)-1)):
if P_score[i] < P_score[i+1]:
List_J[i+1] = List... | s = input()
p_score = S.split(' ')
for i in range(0, len(P_score)):
P_score[i] = int(P_score[i])
list_j = [1 for m in range(0, len(P_score))]
for i in range(0, len(P_score) - 1):
if P_score[i] < P_score[i + 1]:
List_J[i + 1] = List_J[i] + 1
i += 1
elif P_score[i] > P_score[i + 1]:
if... |
'''
Contains keyword arguments and their default values
for workflows. Used to auto-complete arguments that
are missing in submitted workflows.
Workflow items with all the given arguments are then
parsed into actual Celery workflows by the workflow
designer.
2020 Benjamin Kellenberger
'''
... | """
Contains keyword arguments and their default values
for workflows. Used to auto-complete arguments that
are missing in submitted workflows.
Workflow items with all the given arguments are then
parsed into actual Celery workflows by the workflow
designer.
2020 Benjamin Kellenberger
"""
d... |
feed_template = '''
<html>
<head>
<title>Carbon Black {{integration_name}} Feed</title>
<style type="text/css">
A:link {color: black;}
A:visited {color: black;}
A:active {color: black;}
A:hover {underline; color: #d02828;}
</style>
<style>
#config
{
font-family:"Trebuchet... | feed_template = '\n<html>\n <head>\n <title>Carbon Black {{integration_name}} Feed</title>\n\n <style type="text/css">\n A:link {color: black;}\n A:visited {color: black;}\n A:active {color: black;}\n A:hover {underline; color: #d02828;}\n </style>\n\n <style>\n #config\n {\n font-fami... |
x=[9,2,10,1,-1,0,0,1]
for i in range(len(x)-1):
for j in range(len(x)-1):
if x[j] > x[j+1]:
x[j],x[j+1] = x[j+1],x[j]
print(x)
x=input()
y={}
for i in range(len(x)):
if not x[i] in y :
y[x[i]]=0
y[x[i]]+=1
print(y)
x=input()
y=len(x)
y-=1
for i in range(round(len(x)/2)):
if not ... | x = [9, 2, 10, 1, -1, 0, 0, 1]
for i in range(len(x) - 1):
for j in range(len(x) - 1):
if x[j] > x[j + 1]:
(x[j], x[j + 1]) = (x[j + 1], x[j])
print(x)
x = input()
y = {}
for i in range(len(x)):
if not x[i] in y:
y[x[i]] = 0
y[x[i]] += 1
print(y)
x = input()
y = len(x)
y -= 1
for... |
#
# PySNMP MIB module IPV4-RIP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IPV4-RIP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 19:45:29 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,... | (ap_ipv4_rip,) = mibBuilder.importSymbols('APENT-MIB', 'apIpv4Rip')
(integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, constraints_intersection, valu... |
# print "Hello" N times
n=int(input())
if n>=0:
for i in range(n):
print("Hello")
else:
print("Invalid input") | n = int(input())
if n >= 0:
for i in range(n):
print('Hello')
else:
print('Invalid input') |
##############################################################################
#
# Copyright (C) BBC 2018
#
##############################################################################
events = [
{
"prodState": "Maintenance",
"firstTime": 1494707632.238,
"device_uuid": "3cb330f3-afb0-4e25... | events = [{'prodState': 'Maintenance', 'firstTime': 1494707632.238, 'device_uuid': '3cb330f3-afb0-4e25-99ef-1902403b9be1', 'eventClassKey': null, 'severity': 5, 'agent': 'zenperfsnmp', 'dedupid': 'rpm01.rbsov.bbc.co.uk||/Status/Snmp|snmp_error|5', 'Location': [{'uid': '/zport/dmd/Locations/RBSOV', 'name': '/RBSOV'}], '... |
# Commodity and Equity Sector mappings
sectmap = {
'commodity_sector_mappings':{
'&6A_CCB':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'AUD'), # AUD
'&6B_CCB':('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'GBP'), # GBP
'&6C_CCB':('Currencies',... | sectmap = {'commodity_sector_mappings': {'&6A_CCB': ('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'AUD'), '&6B_CCB': ('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'GBP'), '&6C_CCB': ('Currencies', 'G10 Currencies', 'G10 Currencies', 'G10 Currencies', 'CAD'), '&6E_CCB': ('Cu... |
# https://app.codesignal.com/arcade/intro/level-1/jwr339Kq6e3LQTsfa
# Write a function that returns the sum of two numbers.
def add(param1: int = 0, param2: int = 0) -> int:
if (
isinstance(param1, int)
and isinstance(param2, int)
and -1000 <= param1 <= 1000
and -1000 <= param2 <= ... | def add(param1: int=0, param2: int=0) -> int:
if isinstance(param1, int) and isinstance(param2, int) and (-1000 <= param1 <= 1000) and (-1000 <= param2 <= 1000):
return param1 + param2
return 0 |
n=int(input())
cus=[int(input()) for i in range(n)]
m=int(input())
price=[int(input()) for i in range(m)]
price.sort(reverse=True)
cus.sort(reverse=True)
answer=0
C,P=0,0
while C<n and P<m:
if cus[C]>=price[P]:
answer+=price[P]
C+=1
P+=1
else:
P+=1
print(answer)
| n = int(input())
cus = [int(input()) for i in range(n)]
m = int(input())
price = [int(input()) for i in range(m)]
price.sort(reverse=True)
cus.sort(reverse=True)
answer = 0
(c, p) = (0, 0)
while C < n and P < m:
if cus[C] >= price[P]:
answer += price[P]
c += 1
p += 1
else:
p += 1... |
# https://adventofcode.com/2021/day/17#part2
def solve(target):
(x1, x2), (y1, y2) = target
count = 0
for i in range(-1000, 1000): # wew, try bruteforce
for j in range(1, x2+1):
hit = check(j, i, target)
if hit:
count += 1
return count
def check(a, b, target):
(x1, x2), (y1, y2)... | def solve(target):
((x1, x2), (y1, y2)) = target
count = 0
for i in range(-1000, 1000):
for j in range(1, x2 + 1):
hit = check(j, i, target)
if hit:
count += 1
return count
def check(a, b, target):
((x1, x2), (y1, y2)) = target
(x, y) = (0, 0)
... |
vegetables = [
{
"type":"fruit",
"items":[
{
"color":"green",
"items":[
"kiwi",
"grape"
]
},
{
"color":"red",
"items":[
"str... | vegetables = [{'type': 'fruit', 'items': [{'color': 'green', 'items': ['kiwi', 'grape']}, {'color': 'red', 'items': ['strawberry', 'apple']}]}, {'type': 'vegs', 'items': [{'color': 'green', 'items': ['lettuce']}, {'color': 'red', 'items': ['pepper']}]}]
a = list(filter(lambda i: i['type'] == 'fruit', vegetables))
print... |
__all__ = ["reservation", "user_info", "calendar"]
for _import in __all__:
__import__(f"{__package__}.{_import}")
| __all__ = ['reservation', 'user_info', 'calendar']
for _import in __all__:
__import__(f'{__package__}.{_import}') |
# Generated by h2py from Include\scintilla.h
# Included from BaseTsd.h
def HandleToUlong(h): return HandleToULong(h)
def UlongToHandle(ul): return ULongToHandle(ul)
def UlongToPtr(ul): return ULongToPtr(ul)
def UintToPtr(ui): return UIntToPtr(ui)
INVALID_POSITION = -1
SCI_START = 2000
SCI_OPTIONAL_STA... | def handle_to_ulong(h):
return handle_to_u_long(h)
def ulong_to_handle(ul):
return u_long_to_handle(ul)
def ulong_to_ptr(ul):
return u_long_to_ptr(ul)
def uint_to_ptr(ui):
return u_int_to_ptr(ui)
invalid_position = -1
sci_start = 2000
sci_optional_start = 3000
sci_lexer_start = 4000
sci_addtext = 200... |
#!/usr/bin/env python3
# https://codeforces.com/problemset/problem/1296/A
def odd(a,n):
odd1 = a[0]%2
if odd1==1 and n%2==1:
return 'YES'
for i in range(1,n):
if a[i]%2 != odd1:
return 'YES'
return 'NO'
t = int(input())
for _ in range(t):
n = int(input())
al = l... | def odd(a, n):
odd1 = a[0] % 2
if odd1 == 1 and n % 2 == 1:
return 'YES'
for i in range(1, n):
if a[i] % 2 != odd1:
return 'YES'
return 'NO'
t = int(input())
for _ in range(t):
n = int(input())
al = list(map(int, input().split()))
print(odd(al, n)) |
def play_game(turns, start, nodes, max_cup_label):
current_cup = start_label
move = 0
while move < turns:
# Snip out a sub graph of length 3
sub_graph_start = nodes[current_cup]
pickup = []
cur = sub_graph_start
for _ in range(3):
pickup.append(cur)
... | def play_game(turns, start, nodes, max_cup_label):
current_cup = start_label
move = 0
while move < turns:
sub_graph_start = nodes[current_cup]
pickup = []
cur = sub_graph_start
for _ in range(3):
pickup.append(cur)
cur = nodes[cur]
dest_cup = c... |
listTotal = []
listPar = []
listImpar = []
for c in range(1, 21):
n = int(input("Digite um numero: "))
if n % 2 == 0:
listTotal.append(n)
listPar.append(n)
else:
listImpar.append(n)
listTotal.append(n)
print(f'{listTotal}\n{listPar}\n{listImpar}') | list_total = []
list_par = []
list_impar = []
for c in range(1, 21):
n = int(input('Digite um numero: '))
if n % 2 == 0:
listTotal.append(n)
listPar.append(n)
else:
listImpar.append(n)
listTotal.append(n)
print(f'{listTotal}\n{listPar}\n{listImpar}') |
# Copyright (c) 2018 Huawei Technologies Co., Ltd.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | class Sdkexception(Exception):
def __init__(self, code=None, message=None):
self._code = code
self._message = message
def __str__(self):
return '[SDKException] Message:%s Code:%s .' % (self.message, self.code)
@property
def code(self):
return self._code
@property
... |
class A:
def f1(self):
print("F1 is working")
def f2(self):
print("F2 is working")
class B():
def f3(self):
print("F3 is working")
def f4(self):
print("F4 is working")
class C(A,B): #Multiple Inheriatance
def f5(self):
print("F5 is working")
a1=A()
a1.... | class A:
def f1(self):
print('F1 is working')
def f2(self):
print('F2 is working')
class B:
def f3(self):
print('F3 is working')
def f4(self):
print('F4 is working')
class C(A, B):
def f5(self):
print('F5 is working')
a1 = a()
a1.f1()
a1.f2()
b1 = b()
b... |
# Input Cases
t = int(input("\nTotal Test Cases : "))
for i in range(1,t+1):
print(f"\n------------ CASE #{i} -------------")
n = int(input("\nTotal Items : "))
m = int(input("Max Capacity : "))
v = [int(i) for i in input("\nValues : ").split(" ")]
w = [int(i) for i in input("Weights : ").split(" ")]
# Ta... | t = int(input('\nTotal Test Cases : '))
for i in range(1, t + 1):
print(f'\n------------ CASE #{i} -------------')
n = int(input('\nTotal Items : '))
m = int(input('Max Capacity : '))
v = [int(i) for i in input('\nValues : ').split(' ')]
w = [int(i) for i in input('Weights : ').split(' ')]
d... |
# https://www.hackerrank.com/challenges/candies/problem
n = int(input())
arr = [int(input()) for _ in range(n)]
candies = [1] * n
for i in range(1, n):
if arr[i - 1] < arr[i]:
candies[i] = candies[i - 1] + 1
for i in range(n - 2, -1, -1):
if arr[i + 1] < arr[i]:
if i - 1 >= 0 and arr[i - 1] <... | n = int(input())
arr = [int(input()) for _ in range(n)]
candies = [1] * n
for i in range(1, n):
if arr[i - 1] < arr[i]:
candies[i] = candies[i - 1] + 1
for i in range(n - 2, -1, -1):
if arr[i + 1] < arr[i]:
if i - 1 >= 0 and arr[i - 1] < arr[i]:
candies[i] = max(candies[i + 1], candi... |
class DataFragment(object):
def length(self):
return 0;
class ConstDataFragment(object):
def __init__(self, name, data):
self.data = data
self.name = name
def length(self):
return len(self.data)
class ChoiceDataFragment(object):
def __init__(self):
pass
... | class Datafragment(object):
def length(self):
return 0
class Constdatafragment(object):
def __init__(self, name, data):
self.data = data
self.name = name
def length(self):
return len(self.data)
class Choicedatafragment(object):
def __init__(self):
pass
clas... |
class SecretsManager:
_boto3 = None
_environment = None
_secrets_manager = None
def __init__(self, boto3, environment):
self._boto3 = boto3
self._environment = environment
if not self._environment.get('AWS_REGION', True):
raise ValueError("To use secrets manager you ... | class Secretsmanager:
_boto3 = None
_environment = None
_secrets_manager = None
def __init__(self, boto3, environment):
self._boto3 = boto3
self._environment = environment
if not self._environment.get('AWS_REGION', True):
raise value_error("To use secrets manager you... |
_base_ = "./FlowNet512_1.5AugCosyAAEGray_AdamW_ClipGrad_AvgMaxMin_Pbr_01_ape.py"
OUTPUT_DIR = "output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_AdamW_ClipGrad_AvgMaxMin_lmPbr_SO/cat"
DATASETS = dict(TRAIN=("lm_pbr_cat_train",), TEST=("lm_real_cat_test",))
# bbnc10
# objects cat Avg(1)
# ad_2 21.06 21.06
#... | _base_ = './FlowNet512_1.5AugCosyAAEGray_AdamW_ClipGrad_AvgMaxMin_Pbr_01_ape.py'
output_dir = 'output/deepim/lmPbrSO/FlowNet512_1.5AugCosyAAEGray_AdamW_ClipGrad_AvgMaxMin_lmPbr_SO/cat'
datasets = dict(TRAIN=('lm_pbr_cat_train',), TEST=('lm_real_cat_test',)) |
# -*- coding: utf-8 -*-
# index.urls
def make_rules():
return []
all_views = {} | def make_rules():
return []
all_views = {} |
data = input()
forum_dict = {}
while not data == 'filter':
topic = data.split(' -> ')[0]
hashtags = data.split(' -> ')[1].split(', ')
if topic in forum_dict.keys():
forum_dict[topic].extend(hashtags)
else:
forum_dict[topic] = hashtags
data = input()
hashtags_reg = input().split(', ... | data = input()
forum_dict = {}
while not data == 'filter':
topic = data.split(' -> ')[0]
hashtags = data.split(' -> ')[1].split(', ')
if topic in forum_dict.keys():
forum_dict[topic].extend(hashtags)
else:
forum_dict[topic] = hashtags
data = input()
hashtags_reg = input().split(', ')... |
def fector(x: int):
if x == 0:
return 1
else:
return x * fector(x - 1)
N = int(input())
print(fector(N)) | def fector(x: int):
if x == 0:
return 1
else:
return x * fector(x - 1)
n = int(input())
print(fector(N)) |
filename=os.path.join(path,'Output','Data','xls','WALIS_spreadsheet.xlsx')
print('Your file will be created in {} '.format(path+'/Output/Data/'))
###### Prepare messages for the readme ######
# First cell
date_string = date.strftime("%d %m %Y")
msg1='This file was exported from WALIS on '+date_string
# Second cell
msg... | filename = os.path.join(path, 'Output', 'Data', 'xls', 'WALIS_spreadsheet.xlsx')
print('Your file will be created in {} '.format(path + '/Output/Data/'))
date_string = date.strftime('%d %m %Y')
msg1 = 'This file was exported from WALIS on ' + date_string
msg2 = 'The data in this file were compiled in WALIS, the World A... |
board_bounding_box = [[[-1245, -795], [-410, 310], [-455, 500.0]],\
[[-1245, -795], [-410, 310], [-545, 500.0]],\
[[-1245, -595], [-410, 310], [-585, 500.0]],\
[[-1345, -595], [-410, 310], [-642, 500.0]]]
min_point_before_moving = [[-1245, -354.048022, -417],\
[-1201.1969772, -300... | board_bounding_box = [[[-1245, -795], [-410, 310], [-455, 500.0]], [[-1245, -795], [-410, 310], [-545, 500.0]], [[-1245, -595], [-410, 310], [-585, 500.0]], [[-1345, -595], [-410, 310], [-642, 500.0]]]
min_point_before_moving = [[-1245, -354.048022, -417], [-1201.1969772, -300, -539], [-1155, -248.09308728, -570], [-11... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/icefire/ws/src/gscam/include;/usr/include/gstreamer-1.0;/usr/include/glib-2.0;/usr/lib/aarch64-linux-gnu/glib-2.0/include".split(';') if "/home/icefire/ws/src/gscam/include;/usr/include/gstreamer... | catkin_package_prefix = ''
project_pkg_config_include_dirs = '/home/icefire/ws/src/gscam/include;/usr/include/gstreamer-1.0;/usr/include/glib-2.0;/usr/lib/aarch64-linux-gnu/glib-2.0/include'.split(';') if '/home/icefire/ws/src/gscam/include;/usr/include/gstreamer-1.0;/usr/include/glib-2.0;/usr/lib/aarch64-linux-gnu/gli... |
n = int(input())
ans = (n * (n + 1)) // 2
ans = 4 * ans
ans = ans - 4 * n
ans = 1 + ans
print(ans)
| n = int(input())
ans = n * (n + 1) // 2
ans = 4 * ans
ans = ans - 4 * n
ans = 1 + ans
print(ans) |
def power_supply(network: list[list], plant: dict, lis=None) -> set:
if not lis: lis = []
net = network.copy()
for key, value in plant.items():
for [a, b] in tuple(net):
if key in [a, b]:
net.remove([a, b])
if value > 0:
lis.append(a if... | def power_supply(network: list[list], plant: dict, lis=None) -> set:
if not lis:
lis = []
net = network.copy()
for (key, value) in plant.items():
for [a, b] in tuple(net):
if key in [a, b]:
net.remove([a, b])
if value > 0:
lis.a... |
class Contact:
all_contacts = []
def __init__(self, name, email):
self.name = name
self.email = email
Contact.all_contacts.append(self)
class Supplier(Contact):
def order(self, order):
print("if this were a real system we would send " f"{order} order to {self.name}")
| class Contact:
all_contacts = []
def __init__(self, name, email):
self.name = name
self.email = email
Contact.all_contacts.append(self)
class Supplier(Contact):
def order(self, order):
print(f'if this were a real system we would send {order} order to {self.name}') |
'''
Created on Oct 22, 2018
@author: casey
'''
class Segment(object):
#
# * Segments make up the tree. There is a base segment, then a root segment, then the tree expands into internal segments, until it gets to leaf segments.
# * These segment types make it easier to traverse the tree during b... | """
Created on Oct 22, 2018
@author: casey
"""
class Segment(object):
def __init__(self, l=0):
self.left = l
self.right = -1
self.link = None
def set_link(self, link):
self.link = link
def get_link(self):
return self.link
def get_left(self):
return s... |
num = int(input("enter the number"))
for i in range(2,num):
if num%i==0:
print("not prime")
break
else:
print("prime") | num = int(input('enter the number'))
for i in range(2, num):
if num % i == 0:
print('not prime')
break
else:
print('prime') |
class TicTacToe:
def __init__(self):
self.tab = ['.','.','.','.','.','.','.','.','.','.']
def curr_state(self): #obecny stan tablicy
return ''.join(self.tab)
def postaw_znak_o(self, x, y): #interfejs dla stawiania znaku przez gracza
if x < 0 or x > 2 or y < 0 or y > 2 or... | class Tictactoe:
def __init__(self):
self.tab = ['.', '.', '.', '.', '.', '.', '.', '.', '.', '.']
def curr_state(self):
return ''.join(self.tab)
def postaw_znak_o(self, x, y):
if x < 0 or x > 2 or y < 0 or (y > 2) or (self.tab[x + y * 3] != '.'):
return 1
self... |
ERR_EXCEED_LIMIT = "Not enough space"
class NotEnoughSpace(Exception):
pass
| err_exceed_limit = 'Not enough space'
class Notenoughspace(Exception):
pass |
class SeriesField(object):
def __init__(self):
self.series = []
def add_serie(self, serie):
self.series.append(serie)
def to_javascript(self):
jsc = "series: ["
for s in self.series:
jsc += s.to_javascript() + "," # the last comma is accepted by javascript... | class Seriesfield(object):
def __init__(self):
self.series = []
def add_serie(self, serie):
self.series.append(serie)
def to_javascript(self):
jsc = 'series: ['
for s in self.series:
jsc += s.to_javascript() + ','
jsc += ']'
return jsc |
self.description = "conflict 'db vs db'"
sp1 = pmpkg("pkg1", "1.0-2")
sp1.conflicts = ["pkg2"]
self.addpkg2db("sync", sp1);
sp2 = pmpkg("pkg2", "1.0-2")
self.addpkg2db("sync", sp2)
lp1 = pmpkg("pkg1")
self.addpkg2db("local", lp1)
lp2 = pmpkg("pkg2")
self.addpkg2db("local", lp2)
self.args = "-S %s --ask=4" % " ".jo... | self.description = "conflict 'db vs db'"
sp1 = pmpkg('pkg1', '1.0-2')
sp1.conflicts = ['pkg2']
self.addpkg2db('sync', sp1)
sp2 = pmpkg('pkg2', '1.0-2')
self.addpkg2db('sync', sp2)
lp1 = pmpkg('pkg1')
self.addpkg2db('local', lp1)
lp2 = pmpkg('pkg2')
self.addpkg2db('local', lp2)
self.args = '-S %s --ask=4' % ' '.join([p.... |
# To check a number is prime or not
num = int(input("Enter a number: "))
check = 0
if(num>=0):
for i in range(1,num+1):
if( (num % i) == 0 ):
check=check+1
if(check==2):
print(num,"is a prime number.")
else:
... | num = int(input('Enter a number: '))
check = 0
if num >= 0:
for i in range(1, num + 1):
if num % i == 0:
check = check + 1
if check == 2:
print(num, 'is a prime number.')
else:
print(num, 'is not a prime number.')
else:
print('========Please Enter a positive number===... |
def func1():
pass
def func2():
pass
a = b = func1
b()
a = b = func2
a()
| def func1():
pass
def func2():
pass
a = b = func1
b()
a = b = func2
a() |
n=int(input());f=True
if n!=3: f=False
a=set()
for _ in range(n):
b,c=map(int,input().split())
a.add(b);a.add(c)
if a!={1,3,4}:
f=False
print((f) and 'Wa-pa-pa-pa-pa-pa-pow!' or 'Woof-meow-tweet-squeek')
| n = int(input())
f = True
if n != 3:
f = False
a = set()
for _ in range(n):
(b, c) = map(int, input().split())
a.add(b)
a.add(c)
if a != {1, 3, 4}:
f = False
print(f and 'Wa-pa-pa-pa-pa-pa-pow!' or 'Woof-meow-tweet-squeek') |
numeros = []
for i in range(1, 1000001):
numeros.append(i)
for numero in numeros:
print(numero) | numeros = []
for i in range(1, 1000001):
numeros.append(i)
for numero in numeros:
print(numero) |
# Event: LCCS Python Fundamental Skills Workshop
# Date: Dec 2018
# Author: Joe English, PDST
# eMail: computerscience@pdst.ie
# Purpose: A program to demonstrate recursion
# A recursive function to add up the first n numbers.
# Example: The sum of the first 5 numbers is 5 + the sum of the first 4 numbers
# S... | def sum_of_n(n):
if n == 0:
return 0
return n + sum_of_n(n - 1)
answer = sum_of_n(5)
print(answer) |
# Problem: https://docs.google.com/document/d/1Sz1cWKsiQzQUOjC76TzFcOQGYEZIPvQuWg6NjQ0B6VA/edit?usp=sharing
def print_roman(number):
dict = {1:"I", 4:"IV", 5:"V", 9:"IX", 10:"X", 40:"XL", 50:"L",
90:"XC", 100:"C", 400:"CD", 500:"D", 900:"CM", 1000:"M"}
for i in sorted(dict, reverse = True):
... | def print_roman(number):
dict = {1: 'I', 4: 'IV', 5: 'V', 9: 'IX', 10: 'X', 40: 'XL', 50: 'L', 90: 'XC', 100: 'C', 400: 'CD', 500: 'D', 900: 'CM', 1000: 'M'}
for i in sorted(dict, reverse=True):
result = number // i
number %= i
while result:
print(dict[i], end='')
... |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def maxDepth(self, p, d=0):
if p is None:
return 0
d = d + 1
d_left = self.maxDepth(p.left, d)
d_right... | class Treenode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def max_depth(self, p, d=0):
if p is None:
return 0
d = d + 1
d_left = self.maxDepth(p.left, d)
d_right = self.maxDepth(p.right, d)
... |
# why does this expression cause problems and what is the fix
# helen o'shea
# 20210203
try:
message = 'I have eaten ' + 99 +' burritos.'
except:
message = 'I have eaten ' + str(99) +' burritos.'
print(message)
| try:
message = 'I have eaten ' + 99 + ' burritos.'
except:
message = 'I have eaten ' + str(99) + ' burritos.'
print(message) |
seconds = 365 * 24 * 60 * 60
for year in [1, 2, 5, 10]:
print(seconds * year)
| seconds = 365 * 24 * 60 * 60
for year in [1, 2, 5, 10]:
print(seconds * year) |
# ------------------------- DESAFIO 005 -------------------------
# Programa para mostrar na tela o sucessor e antecessor de um numero digitado
num = int(input('Digite um Numero: '))
suc = num + 1
ant = num - 1
print('Abaixo seguem os numeros conforme na ordem: \n Antecessor / Numedo Digitado / Sucessor \n {:^10} / ... | num = int(input('Digite um Numero: '))
suc = num + 1
ant = num - 1
print('Abaixo seguem os numeros conforme na ordem: \n Antecessor / Numedo Digitado / Sucessor \n {:^10} / {:^15} / {:^8}'.format(ant, num, suc)) |
# COUNT BY
# This function takes two arguments:
# A list with items to be counted
# The function the list will be mapped to
# This function uses the properties inherent in objects
# to create a new property for each unique value, then
# increase the count of that property each time that
# element appears in ... | def count_by(arr, fn=lambda x: x):
key = {}
for el in map(fn, arr):
key[el] = 0 if el not in key else key[el]
key[el] += 1
return key
print(count_by(['one', 'two', 'three'], len)) |
N, A, B = map(int, input().split())
if (B - A) % 2 == 0:
print('Alice')
else:
print('Borys')
| (n, a, b) = map(int, input().split())
if (B - A) % 2 == 0:
print('Alice')
else:
print('Borys') |
#
# PySNMP MIB module HPN-ICF-ISSU-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HPN-ICF-ISSU-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:39:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection, constraints_union) ... |
def factorial(n):
total = 1
for i in range(1, n+1):
total *= i
return total
if __name__ == '__main__':
f = factorial(10)
print(f)
| def factorial(n):
total = 1
for i in range(1, n + 1):
total *= i
return total
if __name__ == '__main__':
f = factorial(10)
print(f) |
# encoding=utf-8
class LazyDB(object):
def __init__(self):
self.exists = 5
def __getattr__(self, name):
value = 'Value for %s' %name
setattr(self,name,value)
return value
data = LazyDB()
print('Before',data.__dict__)
print('foo',data.foo)
print('After',data.__dict__)
class LogginglazyDB(LazyDB):
def __g... | class Lazydb(object):
def __init__(self):
self.exists = 5
def __getattr__(self, name):
value = 'Value for %s' % name
setattr(self, name, value)
return value
data = lazy_db()
print('Before', data.__dict__)
print('foo', data.foo)
print('After', data.__dict__)
class Logginglazydb... |
winClass = window.get_active_class()
if winClass not in ("code.Code", "emacs.Emacs"):
# Regular window
keyboard.send_keys('<home>')
keyboard.send_keys('<shift>+<end>')
else:
# VS Code
keyboard.send_keys('<ctrl>+l')
| win_class = window.get_active_class()
if winClass not in ('code.Code', 'emacs.Emacs'):
keyboard.send_keys('<home>')
keyboard.send_keys('<shift>+<end>')
else:
keyboard.send_keys('<ctrl>+l') |
#! /usr/bin/env python
###############################################################################
# esp8266_MicroPy_main_boilerplate.py
#
# base main.py boilerplate code for MicroPython running on the esp8266
# Copy relevant parts and/or file with desired settings into main.py on the esp8266
#
# The main.py file... | while True:
time.sleep(1)
pin.value(not pin.value())
time.sleep(1) |
class Angel:
color = "white"
feature = "wings"
home = "Heaven"
class Demon:
color = "red"
feature = "horns"
home = "Hell"
my_angel = Angel()
print(my_angel.color)
print(my_angel.feature)
print(my_angel.home)
my_demon = Demon()
print(my_demon.color)
print(my_demon.feature)
print(my_demon.home... | class Angel:
color = 'white'
feature = 'wings'
home = 'Heaven'
class Demon:
color = 'red'
feature = 'horns'
home = 'Hell'
my_angel = angel()
print(my_angel.color)
print(my_angel.feature)
print(my_angel.home)
my_demon = demon()
print(my_demon.color)
print(my_demon.feature)
print(my_demon.home) |
# uninhm
# https://codeforces.com/contest/1419/problem/A
# greedy
def hasmodulo(s, a):
for i in s:
if int(i) % 2 == a:
return True
return False
for _ in range(int(input())):
n = int(input())
s = input()
if n % 2 == 0:
if hasmodulo(s[1::2], 0):
print(2)
... | def hasmodulo(s, a):
for i in s:
if int(i) % 2 == a:
return True
return False
for _ in range(int(input())):
n = int(input())
s = input()
if n % 2 == 0:
if hasmodulo(s[1::2], 0):
print(2)
else:
print(1)
elif hasmodulo(s[0::2], 1):
... |
agent = dict(
type='TD3_BC',
batch_size=256,
gamma=0.95,
update_coeff=0.005,
policy_update_interval=2,
alpha=2.5,
)
log_level = 'INFO'
eval_cfg = dict(
type='Evaluation',
num=10,
num_procs=1,
use_hidden_state=False,
start_state=None,
save_traj=True,
save_video=True,... | agent = dict(type='TD3_BC', batch_size=256, gamma=0.95, update_coeff=0.005, policy_update_interval=2, alpha=2.5)
log_level = 'INFO'
eval_cfg = dict(type='Evaluation', num=10, num_procs=1, use_hidden_state=False, start_state=None, save_traj=True, save_video=True, use_log=False)
train_mfrl_cfg = dict(on_policy=False) |
# https://codeforces.com/contest/1270/problem/B
# https://codeforces.com/contest/1270/submission/68220722
# https://github.com/miloszlakomy/competitive/tree/master/codeforces/1270B
def solve(A):
for cand in range(len(A)-1):
if abs(A[cand] - A[cand+1]) >= 2:
return cand, cand+2
return None
... | def solve(A):
for cand in range(len(A) - 1):
if abs(A[cand] - A[cand + 1]) >= 2:
return (cand, cand + 2)
return None
t = int(input())
for _ in range(t):
_ = input()
a = [int(x) for x in input().split()]
ans = solve(A)
if ans is None:
print('NO')
else:
prin... |
def identity(x):
return x
def with_max_length(max_length):
return lambda x: x[:max_length] if x else x
def identity_or_none(x):
return None if not x else x
def tipo_de_pessoa(x):
return "J" if x == "PJ" else "F"
def cnpj(x, tipo_pessoa):
return x if tipo_pessoa == "PJ" else None
def cpf(x,... | def identity(x):
return x
def with_max_length(max_length):
return lambda x: x[:max_length] if x else x
def identity_or_none(x):
return None if not x else x
def tipo_de_pessoa(x):
return 'J' if x == 'PJ' else 'F'
def cnpj(x, tipo_pessoa):
return x if tipo_pessoa == 'PJ' else None
def cpf(x, tipo... |
a = 1
b = 2
c = 3
tmp=a
a=b
b=tmp
tmp=c
c=b
b=tmp
| a = 1
b = 2
c = 3
tmp = a
a = b
b = tmp
tmp = c
c = b
b = tmp |
expected_output = {
"cdp": {
"index": {
1: {
"capability": "R S C",
"device_id": "Device_With_A_Particularly_Long_Name",
"hold_time": 134,
"local_interface": "GigabitEthernet1",
"platform": "N9K-9000v",
... | expected_output = {'cdp': {'index': {1: {'capability': 'R S C', 'device_id': 'Device_With_A_Particularly_Long_Name', 'hold_time': 134, 'local_interface': 'GigabitEthernet1', 'platform': 'N9K-9000v', 'port_id': 'Ethernet0/0'}, 2: {'capability': 'S I', 'device_id': 'another_device_with_a_long_name', 'hold_time': 141, 'lo... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def oddEvenList(self, head: ListNode) -> ListNode:
if not head or not head.next: return head
odd = odd_head = head
even = eve... | class Solution:
def odd_even_list(self, head: ListNode) -> ListNode:
if not head or not head.next:
return head
odd = odd_head = head
even = even_head = head.next
while even and even.next:
odd.next = even.next
odd = odd.next
even.next =... |
class Solution:
def decodeString(self, s: str) -> str:
stack = []
stack.append([1, ""])
num = 0
for l in s:
if l.isdigit():
num = num * 10 + ord(l) - ord('0')
elif l == '[':
stack.append([num, ""])
num = 0
... | class Solution:
def decode_string(self, s: str) -> str:
stack = []
stack.append([1, ''])
num = 0
for l in s:
if l.isdigit():
num = num * 10 + ord(l) - ord('0')
elif l == '[':
stack.append([num, ''])
num = 0
... |
pizzas = ['Supreme', 'Stuffed Crust', 'Buffalo Chicken']
friendpizzas = pizzas[:]
pizzas.append("Eggs Benedict Pizza")
friendpizzas.append("Eggs Florentine Pizza")
print("My favorite pizzas are:")
print(pizzas)
print("My friend's favorite pizzas are:")
print(friendpizzas) | pizzas = ['Supreme', 'Stuffed Crust', 'Buffalo Chicken']
friendpizzas = pizzas[:]
pizzas.append('Eggs Benedict Pizza')
friendpizzas.append('Eggs Florentine Pizza')
print('My favorite pizzas are:')
print(pizzas)
print("My friend's favorite pizzas are:")
print(friendpizzas) |
# EDA: Airplanes - Q3
def plot_airplane_type_over_europe(gdf, airplane="B17",
years=[1940, 1941 ,1942, 1943, 1944, 1945],
kdp=False, aoi=europe):
fig = plt.figure(figsize=(16,12))
for e, y in enumerate(years):
_gdf = gdf.loc[(gdf["... | def plot_airplane_type_over_europe(gdf, airplane='B17', years=[1940, 1941, 1942, 1943, 1944, 1945], kdp=False, aoi=europe):
fig = plt.figure(figsize=(16, 12))
for (e, y) in enumerate(years):
_gdf = gdf.loc[(gdf['year'] == y) & (gdf['Aircraft Series'] == airplane)].copy()
_gdf.Country.replace(np.... |
class BaseRelationship:
def __init__(self, name, repository, model, paginated_menu=None):
self.name = name
self.repository = repository
self.model = model
self.paginated_menu = paginated_menu
class OneToManyRelationship(BaseRelationship):
def __init__(self, related_name, name, ... | class Baserelationship:
def __init__(self, name, repository, model, paginated_menu=None):
self.name = name
self.repository = repository
self.model = model
self.paginated_menu = paginated_menu
class Onetomanyrelationship(BaseRelationship):
def __init__(self, related_name, name,... |
#! /usr/bin/env python3
def next_permutation(seq):
k = len(seq) - 1
# Find the largest index k such that a[k] < a[k + 1].
while k >= 0:
if seq[k - 1] >= seq[k]:
k -= 1
else:
k -= 1
break
# No such index exists, the permutation is the last permutati... | def next_permutation(seq):
k = len(seq) - 1
while k >= 0:
if seq[k - 1] >= seq[k]:
k -= 1
else:
k -= 1
break
if k == -1:
raise stop_iteration('Reached final permutation.')
l = len(seq) - 1
while l >= k:
if seq[l] > seq[k]:
... |
a=25
b=5
print("division is ",(a/b))
print("division success")
| a = 25
b = 5
print('division is ', a / b)
print('division success') |
name1 = "Atilla"
name2 = "atilla"
name3 = "ATILLA"
name4 = "AtiLLa"
## Common string functions
print("capitalize",name1.capitalize())
print("capitalize",name2.capitalize())
print("capitalize",name3.capitalize())
print("capitalize",name4.capitalize())
# ends with
if name1.endswith("x"):
print("name1 ends with x ch... | name1 = 'Atilla'
name2 = 'atilla'
name3 = 'ATILLA'
name4 = 'AtiLLa'
print('capitalize', name1.capitalize())
print('capitalize', name2.capitalize())
print('capitalize', name3.capitalize())
print('capitalize', name4.capitalize())
if name1.endswith('x'):
print('name1 ends with x char')
else:
print('name1 does not ... |
# --==[ Settings ]==--
# General
mod = 'mod4'
terminal = 'st'
browser = 'firefox'
file_manager = 'thunar'
font = 'SauceCodePro Nerd Font Medium'
wallpaper = '~/wallpapers/wp1.png'
# Weather
location = {'Mexico': 'Mexico'}
city = 'Mexico City, MX'
# Hardware [/sys/class]
net = 'wlp2s0'
backlight = 'radeon_bl0'
# Col... | mod = 'mod4'
terminal = 'st'
browser = 'firefox'
file_manager = 'thunar'
font = 'SauceCodePro Nerd Font Medium'
wallpaper = '~/wallpapers/wp1.png'
location = {'Mexico': 'Mexico'}
city = 'Mexico City, MX'
net = 'wlp2s0'
backlight = 'radeon_bl0'
colorscheme = 'material_ocean' |
class Solution:
def isValid(self, s: str) -> bool:
stack = []
for i in s:
if i == ')' or i == ']' or i == '}':
if not stack or stack[-1] != i:
return False
stack.pop()
else:
if i == '(':
s... | class Solution:
def is_valid(self, s: str) -> bool:
stack = []
for i in s:
if i == ')' or i == ']' or i == '}':
if not stack or stack[-1] != i:
return False
stack.pop()
else:
if i == '(':
... |
SEARCH_PARAMS = {
"Sect1": "PTO2",
"Sect2": "HITOFF",
"p": "1",
"u": "/netahtml/PTO/search-adv.html",
"r": "0",
"f": "S",
"l": "50",
"d": "PG01",
"Query": "query",
}
SEARCH_FIELDS = {
"document_number": "DN",
"publication_date": "PD",
"title": "TTL",
"abstract": "ABS... | search_params = {'Sect1': 'PTO2', 'Sect2': 'HITOFF', 'p': '1', 'u': '/netahtml/PTO/search-adv.html', 'r': '0', 'f': 'S', 'l': '50', 'd': 'PG01', 'Query': 'query'}
search_fields = {'document_number': 'DN', 'publication_date': 'PD', 'title': 'TTL', 'abstract': 'ABST', 'claims': 'ACLM', 'specification': 'SPEC', 'current_u... |
# Variable Selection Linear Model
Baseline = ['price_lag_1', 'price3_lag_1',
'target_lag_1', 'target3_lag_1',
'tstd_lag_1']
Lags = ['item_id_price_lag_1', 'item_id_price3_lag_1',
'item_id_target_lag_1', 'item_id_target3_lag_1',
'item_id_tstd_lag_1', 'price_lag_1', 'price3_lag_1'... | baseline = ['price_lag_1', 'price3_lag_1', 'target_lag_1', 'target3_lag_1', 'tstd_lag_1']
lags = ['item_id_price_lag_1', 'item_id_price3_lag_1', 'item_id_target_lag_1', 'item_id_target3_lag_1', 'item_id_tstd_lag_1', 'price_lag_1', 'price3_lag_1', 'shop_id_price_lag_1', 'shop_id_price3_lag_1', 'shop_id_target_lag_1', 's... |
path = "."
# Set this to True to fully unlock all maps
# Set this to False to erase all map progress
useFullMaps = True
def reverse_endianness_block2(block):
even = block[::2]
odd = block[1::2]
res = []
for e, o in zip(even, odd):
res += [o, e]
return res
# Initiate base file
data = None
saveFile = [0]... | path = '.'
use_full_maps = True
def reverse_endianness_block2(block):
even = block[::2]
odd = block[1::2]
res = []
for (e, o) in zip(even, odd):
res += [o, e]
return res
data = None
save_file = [0] * 257678
saveFile[:4] = [66, 76, 72, 84]
saveFile[103] = 1
with open(path + '/PCF01.ngd', 'rb... |
# -*- coding: utf-8 -*-
class Screen:
def __init__(self, dim):
self.arena = []
self.dimx = dim[0]+2
self.dimy = dim[1]+2
for x in range(self.dimx):
self.arena.append([])
for y in range(self.dimy):
if x == 0 or x == (self.dimx-1):
self.arena[x].append('-')
elif y == 0 or y == (self.dimy-1):
... | class Screen:
def __init__(self, dim):
self.arena = []
self.dimx = dim[0] + 2
self.dimy = dim[1] + 2
for x in range(self.dimx):
self.arena.append([])
for y in range(self.dimy):
if x == 0 or x == self.dimx - 1:
self.arena[x]... |
km=float(input('Quantos km percorridos: '))
d = float(input('Quantos dias alugado: '))
pago = (d * 60) + (km * 0.15)
print('o total a pagar: r$ {} '.format(pago))
| km = float(input('Quantos km percorridos: '))
d = float(input('Quantos dias alugado: '))
pago = d * 60 + km * 0.15
print('o total a pagar: r$ {} '.format(pago)) |
username ="username" #your reddit username
password = "password" #your reddit password
client_id = "personal use script" #your personal use script
client_secret = "secret" #your secret
| username = 'username'
password = 'password'
client_id = 'personal use script'
client_secret = 'secret' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.