content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
class dotHierarchicList_t(object):
# no doc
aObjects = None
ModelFatherObject = None
nObjects = None
ObjectsLeftToGet = None
OperationType = None
| class Dothierarchiclist_T(object):
a_objects = None
model_father_object = None
n_objects = None
objects_left_to_get = None
operation_type = None |
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def swapPairs(self, head: ListNode) -> ListNode:
if not head:
return None
if not head.next:
return head
tem... | class Listnode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def swap_pairs(self, head: ListNode) -> ListNode:
if not head:
return None
if not head.next:
return head
temp = head.next
head.next = s... |
RED = images.create_image("""
. # # # .
. # # # .
. . . . .
. . . . .
. . . . .
""")
RED_YELLOW = images.create_image("""
. # # # .
. # # # .
. # # # .
. . . . .
. . . . .
""")
YELLOW = images.create_image("""
. . . . .
. # # # .
. # # # .
. . . . .
. . . . .
""")
GREEN = images.create_image("""
. . . . .
. . . . .
. ... | red = images.create_image('\n. # # # .\n. # # # .\n. . . . .\n. . . . .\n. . . . .\n')
red_yellow = images.create_image('\n. # # # .\n. # # # .\n. # # # .\n. . . . .\n. . . . .\n')
yellow = images.create_image('\n. . . . .\n. # # # .\n. # # # .\n. . . . .\n. . . . .\n')
green = images.create_image('\n. . . . .\n. . . .... |
# Lemoneval Project
# Author: Abhabongse Janthong <6845502+abhabongse@users.noreply.github.com>
"""Validator classes for each parameter in exercise frameworks."""
class BaseValidator(object):
"""Defines a callable object which checks if the given value is valid."""
__slots__ = ("name",)
def __init__(sel... | """Validator classes for each parameter in exercise frameworks."""
class Basevalidator(object):
"""Defines a callable object which checks if the given value is valid."""
__slots__ = ('name',)
def __init__(self, *, name=None):
self.name = name
def __call__(self, value, target):
"""Chec... |
# Source found at: https://datatables.net/extensions/scroller/examples/initialisation/large_js_source.html
def generate_html_page(file_path, prj_name, title, df):
"""
Write a dataframe to a HTML page.
:param file_path: File path to save the HTML file.
:param prj_name: Project name for the title.
... | def generate_html_page(file_path, prj_name, title, df):
"""
Write a dataframe to a HTML page.
:param file_path: File path to save the HTML file.
:param prj_name: Project name for the title.
:param title: Title for the title.
:param df: Dataframe for the data to display.
:return:
"""
... |
pytest_plugins = "pytester"
LEAKING_TEST = """
import threading
import time
def test_leak():
for i in range(2):
t = threading.Thread(
target=time.sleep,
args=(0.5,),
name="leaked-thread-%d" % i)
t.daemon = True
t.start()
"""
INI_ENABLED = """
[pytest]
t... | pytest_plugins = 'pytester'
leaking_test = '\nimport threading\nimport time\n\ndef test_leak():\n for i in range(2):\n t = threading.Thread(\n target=time.sleep,\n args=(0.5,),\n name="leaked-thread-%d" % i)\n t.daemon = True\n t.start()\n'
ini_enabled = '\n[pyte... |
'''
Factorial (hacker challenge). Write a function factorial() that returns the
factorial of the given number. For example, factorial(5) should return 120.
Do this using recursion; remember that factorial(n) = n * factorial(n-1).
'''
def factorial(n):
if n == 1 or n == 0:
return 1
if n == 2:
... | """
Factorial (hacker challenge). Write a function factorial() that returns the
factorial of the given number. For example, factorial(5) should return 120.
Do this using recursion; remember that factorial(n) = n * factorial(n-1).
"""
def factorial(n):
if n == 1 or n == 0:
return 1
if n == 2:
... |
def infini(y : int) -> int:
x : int = y
while x >= 0:
x = x + 1
return x
def f(x : int) -> int:
return x + 1
| def infini(y: int) -> int:
x: int = y
while x >= 0:
x = x + 1
return x
def f(x: int) -> int:
return x + 1 |
def changeConf(xmin=2., xmax=16., resolution=2, Nxx=1000, Ntt=20000, \
every_scalar_t=10, every_aaray_t=100, \
amplitud=0.1, sigma=1, x0=9., Boundaries=0, Metric=1):
conf = open('input.par','w')
conf.write('¶meters')
conf.write('xmin = ' + str(xmin) + '\n... | def change_conf(xmin=2.0, xmax=16.0, resolution=2, Nxx=1000, Ntt=20000, every_scalar_t=10, every_aaray_t=100, amplitud=0.1, sigma=1, x0=9.0, Boundaries=0, Metric=1):
conf = open('input.par', 'w')
conf.write('¶meters')
conf.write('xmin = ' + str(xmin) + '\n')
conf.write('xmax = ' + str(xmax) + '\n')
... |
class Day3:
def part1(self):
with open(r'C:\Coding\AdventOfCode\AOC2019\Data\Data3.txt') as f:
lines = f.read().splitlines()
firstPath = lines[0].split(',')
secondPath = lines[1].split(',')
firstPathCoordinates = self.wiresPositionsDictionary(firstPath)
secondPa... | class Day3:
def part1(self):
with open('C:\\Coding\\AdventOfCode\\AOC2019\\Data\\Data3.txt') as f:
lines = f.read().splitlines()
first_path = lines[0].split(',')
second_path = lines[1].split(',')
first_path_coordinates = self.wiresPositionsDictionary(firstPath)
s... |
# --------------------------------------
#! /usr/bin/python
# File: 283. Move Zeros.py
# Author: Kimberly Gao
class Solution:
def _init_(self,name):
self.name = name
# My 1st solution: (Run time: 68ms(29.57%)) (2 pointer)
# Memory Usage: 15.4 MB (61.79%)
def moveZeros1(self, nums):
slo... | class Solution:
def _init_(self, name):
self.name = name
def move_zeros1(self, nums):
slow = 0
for fast in range(len(nums)):
if nums[fast] != 0:
nums[slow] = nums[fast]
slow += 1
for fast in range(slow, len(nums)):
nums[fa... |
"""
# Definition for a Node.
class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
"""
class Solution:
def connect(self, root: 'Node') -> 'Node':
d... | """
# Definition for a Node.
class Node:
def __init__(self, val: int = 0, left: 'Node' = None, right: 'Node' = None, next: 'Node' = None):
self.val = val
self.left = left
self.right = right
self.next = next
"""
class Solution:
def connect(self, root: 'Node') -> 'Node':
... |
'''
Created on Nov 3, 2018
@author: nilson.nieto
'''
list_numeros =input("Ingrese varios numeros separados por espacio : ").split(" , ")
for i in list_numeros:
print(i) | """
Created on Nov 3, 2018
@author: nilson.nieto
"""
list_numeros = input('Ingrese varios numeros separados por espacio : ').split(' , ')
for i in list_numeros:
print(i) |
def getVariableType(v):
""" Replacing bools with ints for Python compatibility """
vType = v['Type']
vType = vType.replace('bool', 'int')
vType = vType.replace('std::function<void(korali::Sample&)>', 'std::uint64_t')
return vType
def getCXXVariableName(v):
cVarName = ''
for name in v:
cVarName += na... | def get_variable_type(v):
""" Replacing bools with ints for Python compatibility """
v_type = v['Type']
v_type = vType.replace('bool', 'int')
v_type = vType.replace('std::function<void(korali::Sample&)>', 'std::uint64_t')
return vType
def get_cxx_variable_name(v):
c_var_name = ''
for name i... |
def get_fuel(mass):
return int(mass / 3) - 2
def get_fuel_including_fuel(mass):
total = 0
while True:
fuel = get_fuel(mass)
if fuel <= 0:
break
total += fuel
mass = fuel
return total
# Part one
with open('input') as f:
print(sum(
get_fuel(
... | def get_fuel(mass):
return int(mass / 3) - 2
def get_fuel_including_fuel(mass):
total = 0
while True:
fuel = get_fuel(mass)
if fuel <= 0:
break
total += fuel
mass = fuel
return total
with open('input') as f:
print(sum((get_fuel(int(line)) for line in f)))... |
class Manager:
def __init__(self):
self.worker = None
def set_worker(self, worker):
assert "Worker" in [el.__name__ for el in worker.__class__.__mro__], "'worker' must be of type Worker"
self.worker = worker
def manage(self):
if self.worker is not None:
self.wo... | class Manager:
def __init__(self):
self.worker = None
def set_worker(self, worker):
assert 'Worker' in [el.__name__ for el in worker.__class__.__mro__], "'worker' must be of type Worker"
self.worker = worker
def manage(self):
if self.worker is not None:
self.wo... |
N, K = map(int, input().split())
A = [0]
total = 0
a = list(map(int, input().split()))
ans = 0
m = {0: 1}
for x in a:
total += x
count = m.get(total - K, 0)
ans += count
m[total] = m.get(total, 0) + 1
A.append(total)
print(ans) | (n, k) = map(int, input().split())
a = [0]
total = 0
a = list(map(int, input().split()))
ans = 0
m = {0: 1}
for x in a:
total += x
count = m.get(total - K, 0)
ans += count
m[total] = m.get(total, 0) + 1
A.append(total)
print(ans) |
"""
This module will be having the locators of all the
food listing page which comes after clicks on
start ordering button
"""
class FoodSelectionPageLocators:
""" food selection class """
place_order_dialog_box_button = "//button[text()='Ok! Place Order']"
total_product_items = "//div/div/div[contains(@cl... | """
This module will be having the locators of all the
food listing page which comes after clicks on
start ordering button
"""
class Foodselectionpagelocators:
""" food selection class """
place_order_dialog_box_button = "//button[text()='Ok! Place Order']"
total_product_items = "//div/div/div[contains(@c... |
class Solution:
def findMaxAverage(self, nums: List[int], k: int) -> float:
# sliding window, O(N) time, O(1) space
globMax = tempMax = sum(nums[:k])
for i in range(k, len(nums)):
tempMax += (nums[i] - nums[i-k])
globMax = max(tempMax, globMax)
return globMax ... | class Solution:
def find_max_average(self, nums: List[int], k: int) -> float:
glob_max = temp_max = sum(nums[:k])
for i in range(k, len(nums)):
temp_max += nums[i] - nums[i - k]
glob_max = max(tempMax, globMax)
return globMax / k |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class ChangeEnum(object):
"""Implementation of the 'Change' enum.
TODO: type enum description here.
Attributes:
KPROTECTIONJOBNAME: TODO: type description here.
KPROTECTIONJOBDESCRIPTION: TODO: type description here.
KPROTECT... | class Changeenum(object):
"""Implementation of the 'Change' enum.
TODO: type enum description here.
Attributes:
KPROTECTIONJOBNAME: TODO: type description here.
KPROTECTIONJOBDESCRIPTION: TODO: type description here.
KPROTECTIONJOBSOURCES: TODO: type description here.
KPROT... |
#Task 4: Login functionality
# In its parameter list, define three parameters: database, username, and password.
def login(database, username, password):
if username in dict.keys(database) and database[username] == password:
print("Welcome back: ", username)
elif username in dict.keys(database) or pass... | def login(database, username, password):
if username in dict.keys(database) and database[username] == password:
print('Welcome back: ', username)
elif username in dict.keys(database) or password in dict.values(database):
print('Check your credentials again!')
else:
print('Something w... |
H, W = map(int, input().split())
N = 0
a_map = []
for i in range(H):
a = list(map(int, input().split()))
a_map.append(a)
result = []
for i in range(H):
for j in range(W):
if a_map[i][j]%2==1:
if j < W - 1:
N += 1
result.append([i + 1, j + 1, i + 1, j + 2])... | (h, w) = map(int, input().split())
n = 0
a_map = []
for i in range(H):
a = list(map(int, input().split()))
a_map.append(a)
result = []
for i in range(H):
for j in range(W):
if a_map[i][j] % 2 == 1:
if j < W - 1:
n += 1
result.append([i + 1, j + 1, i + 1, j... |
class Stairs:
def designs(self, maxHeight, minWidth, totalHeight, totalWidth):
c = 0
for r in xrange(1, maxHeight + 1):
if totalHeight % r == 0:
n = totalHeight / r
if (
n > 1
and totalWidth % (n - 1) == 0
... | class Stairs:
def designs(self, maxHeight, minWidth, totalHeight, totalWidth):
c = 0
for r in xrange(1, maxHeight + 1):
if totalHeight % r == 0:
n = totalHeight / r
if n > 1 and totalWidth % (n - 1) == 0 and (totalWidth / (n - 1) >= minWidth):
... |
# Solve the Equation
class Solution(object):
def solveEquation(self, equation):
"""
:type equation: str
:rtype: str
"""
left, right = equation.split('=')
a1, b1 = self.get_coefficients(left)
a2, b2 = self.get_coefficients(right)
a, b = a1 - a2, b2 - b... | class Solution(object):
def solve_equation(self, equation):
"""
:type equation: str
:rtype: str
"""
(left, right) = equation.split('=')
(a1, b1) = self.get_coefficients(left)
(a2, b2) = self.get_coefficients(right)
(a, b) = (a1 - a2, b2 - b1)
... |
# $Filename$
# $Authors$
# Last Changed: $Date$ $Committer$ $Revision-Id$
#
# Copyright (c) 2003-2011, German Aerospace Center (DLR)
# All rights reserved.
#
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are
#met:
#
... | """
Contains wrapper class around the property representation used in the core package.
"""
__version__ = '$Revision-Id:$'
class Propertydescription(object):
"""
Wrapper around the internal property representation giving restricted access to
the relevant parameters.
All instance variables are read-on... |
length = int(raw_input())
s = raw_input()
n = length / 4
A = T = G = C = 0
for i in s:
if i == 'A':
A += 1
elif i == 'T':
T += 1
elif i == 'G':
G += 1
else:
C += 1
res = 0
if A != n or C != n or G != n or T != n:
res = length
l = 0
for r in xrange(length):
... | length = int(raw_input())
s = raw_input()
n = length / 4
a = t = g = c = 0
for i in s:
if i == 'A':
a += 1
elif i == 'T':
t += 1
elif i == 'G':
g += 1
else:
c += 1
res = 0
if A != n or C != n or G != n or (T != n):
res = length
l = 0
for r in xrange(length):
... |
class JellyBean:
def __init__( self, mass = 0 ):
self.mass = mass
def __add__( self, other ):
other_mass = other.mass
other.mass = 0
return JellyBean( self.mass + other_mass )
def __sub__( self, other ):
self_mass = self.mass
self.mass -= other.mass
def... | class Jellybean:
def __init__(self, mass=0):
self.mass = mass
def __add__(self, other):
other_mass = other.mass
other.mass = 0
return jelly_bean(self.mass + other_mass)
def __sub__(self, other):
self_mass = self.mass
self.mass -= other.mass
def __str__... |
class PlayerAlreadyHasItemError(Exception):
pass
class PlayerNotInitializedError(Exception):
pass
| class Playeralreadyhasitemerror(Exception):
pass
class Playernotinitializederror(Exception):
pass |
# Preferences defaults
PREFERENCES_PATH = "./config/preferences.json"
PREFERENCES_DEFAULTS = {
'on_time': 1200,
'off_time': 300
}
# Bot configureation
DISCORD_TOKEN = "from https://discord.com/developers"
ADMIN_ID = 420
USER_ID = 999
DEV_MODE = True
PREFIX = '!!'
PREFIXES = ('johnsmith ', 'john smith ')
COGS_L... | preferences_path = './config/preferences.json'
preferences_defaults = {'on_time': 1200, 'off_time': 300}
discord_token = 'from https://discord.com/developers'
admin_id = 420
user_id = 999
dev_mode = True
prefix = '!!'
prefixes = ('johnsmith ', 'john smith ')
cogs_list = ['cogs.misc', 'cogs.testing', 'cogs.admin'] |
# has_good_credit = True
# has_criminal_record = True
#
# if has_good_credit and not has_criminal_record:
# print("Eligible for loan")
# temperature = 35
#
# if temperature > 30:
# print("It's a hot day")
# else:
# print("It's not a hot day")
name = "ddddddddddddddddddddddddddddddddddddddddddddddddddddddd... | name = 'dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'
if len(name) < 3:
print('Name must be at least 3 characters long')
elif len(name) > 50:
print('Name cannot be more than 50 characters long')
else:
print('Name looks good!') |
x = ''
while True:
x = input()
print(x)
if x == 'end':
break
print('end') | x = ''
while True:
x = input()
print(x)
if x == 'end':
break
print('end') |
# -*- coding: utf-8 -*-
def main():
s = sorted([input() for _ in range(15)])
print(s[6])
if __name__ == '__main__':
main()
| def main():
s = sorted([input() for _ in range(15)])
print(s[6])
if __name__ == '__main__':
main() |
class Calculadora(object):
"""docstring for Calculadora"""
memoria = 10
def suma(a, b):
return a + b
def resta(a, b):
return a - b
def multiplicacion(a, b):
return a * b
def division(a, b):
return a / b
@classmethod
def numerosPrimos(cls, limite):
rango = range(2, limite)
return [primo for prim... | class Calculadora(object):
"""docstring for Calculadora"""
memoria = 10
def suma(a, b):
return a + b
def resta(a, b):
return a - b
def multiplicacion(a, b):
return a * b
def division(a, b):
return a / b
@classmethod
def numeros_primos(cls, limite):
... |
# Perulangan pada set dan dictionary
print('\n==========Perulangan Pada Set==========')
set_integer = {10, 20, 30, 40, 50}
# Cara pertama
for item in set_integer:
print(item, end=' ')
print('')
# Cara kedua
for i in range(len(set_integer)):
print(list(set_integer)[i], end=' ')
print('')
# Cara ketiga
i = 0... | print('\n==========Perulangan Pada Set==========')
set_integer = {10, 20, 30, 40, 50}
for item in set_integer:
print(item, end=' ')
print('')
for i in range(len(set_integer)):
print(list(set_integer)[i], end=' ')
print('')
i = 0
while i < len(set_integer):
print(list(set_integer)[i], end=' ')
i = i + 1
... |
def word_time(word, elapsed_time):
return [word, elapsed_time]
p0 = [word_time('START', 0), word_time('What', 0.2), word_time('great', 0.4), word_time('luck', 0.8)]
p1 = [word_time('START', 0), word_time('What', 0.6), word_time('great', 0.8), word_time('luck', 1.19)]
p0
p1 | def word_time(word, elapsed_time):
return [word, elapsed_time]
p0 = [word_time('START', 0), word_time('What', 0.2), word_time('great', 0.4), word_time('luck', 0.8)]
p1 = [word_time('START', 0), word_time('What', 0.6), word_time('great', 0.8), word_time('luck', 1.19)]
p0
p1 |
# Definition for singly-linked list.
# class LinkedListNode:
# def __init__(self, value = 0, next = None):
# self.value = value
# self.next = next
class Solution:
def containsCycle(self, head):
if not head or not head.next:
return False
current = head
... | class Solution:
def contains_cycle(self, head):
if not head or not head.next:
return False
current = head
s = set()
while current:
if id(current) in s:
return True
s.add(id(current))
current = current.next
retur... |
def inf():
while True:
yield
for _ in inf():
input('>')
| def inf():
while True:
yield
for _ in inf():
input('>') |
def grep(pattern):
print("Searching for", pattern)
while True:
line = (yield)
if pattern in line:
print(line)
search = grep('coroutine')
next(search)
search.send("I love you")
search.send("Don't you love me")
search.send("I love coroutines")
| def grep(pattern):
print('Searching for', pattern)
while True:
line = (yield)
if pattern in line:
print(line)
search = grep('coroutine')
next(search)
search.send('I love you')
search.send("Don't you love me")
search.send('I love coroutines') |
def conf():
return {
"id":"discord",
"description":"this is the discord c360 component",
"enabled":False,
} | def conf():
return {'id': 'discord', 'description': 'this is the discord c360 component', 'enabled': False} |
"""Custom errors and exceptions."""
class MusicAssistantError(Exception):
"""Custom Exception for all errors."""
class ProviderUnavailableError(MusicAssistantError):
"""Error raised when trying to access mediaitem of unavailable provider."""
class MediaNotFoundError(MusicAssistantError):
"""Error rais... | """Custom errors and exceptions."""
class Musicassistanterror(Exception):
"""Custom Exception for all errors."""
class Providerunavailableerror(MusicAssistantError):
"""Error raised when trying to access mediaitem of unavailable provider."""
class Medianotfounderror(MusicAssistantError):
"""Error raised ... |
S = input()
l = len(S)
nhug = 0
for i in range(l//2):
if S[i] != S[l-1-i]:
nhug += 1
print(nhug)
| s = input()
l = len(S)
nhug = 0
for i in range(l // 2):
if S[i] != S[l - 1 - i]:
nhug += 1
print(nhug) |
class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def greet(self):
print("Hi there! I'm {}, {} years old!".format(self.name, self.age))
maria = Person("Maria Popova", 25)
pesho = Person("Pesho", 27)
print(maria)
# name = Maria Popova
# age = 25 | class Person:
def __init__(self, name, age):
self.name = name
self.age = age
def greet(self):
print("Hi there! I'm {}, {} years old!".format(self.name, self.age))
maria = person('Maria Popova', 25)
pesho = person('Pesho', 27)
print(maria) |
class Solution:
def maxNumber(self, nums1, nums2, k):
def merge(arr1, arr2):
res, i, j = [], 0, 0
while i < len(arr1) and j < len(arr2):
if arr1[i:] >= arr2[j:]:
res.append(arr1[i])
i += 1
else:
... | class Solution:
def max_number(self, nums1, nums2, k):
def merge(arr1, arr2):
(res, i, j) = ([], 0, 0)
while i < len(arr1) and j < len(arr2):
if arr1[i:] >= arr2[j:]:
res.append(arr1[i])
i += 1
else:
... |
def sudoku2(grid):
seen = set()
# Iterate through grid
for i in range(len(grid)):
for j in range(len(grid[i])):
current_value = grid[i][j]
if current_value != ".":
if (
(current_value + " found in row " + str(i)) in seen
... | def sudoku2(grid):
seen = set()
for i in range(len(grid)):
for j in range(len(grid[i])):
current_value = grid[i][j]
if current_value != '.':
if current_value + ' found in row ' + str(i) in seen or current_value + ' found in column ' + str(j) in seen or current_val... |
"""Constants for the tankerkoenig integration."""
DOMAIN = "tankerkoenig"
NAME = "tankerkoenig"
CONF_FUEL_TYPES = "fuel_types"
CONF_STATIONS = "stations"
FUEL_TYPES = ["e5", "e10", "diesel"]
| """Constants for the tankerkoenig integration."""
domain = 'tankerkoenig'
name = 'tankerkoenig'
conf_fuel_types = 'fuel_types'
conf_stations = 'stations'
fuel_types = ['e5', 'e10', 'diesel'] |
FEATURES = 'FEATURES'
AUTH_GITHUB = 'AUTH_GITHUB'
AUTH_GITLAB = 'AUTH_GITLAB'
AUTH_BITBUCKET = 'AUTH_BITBUCKET'
AUTH_AZURE = 'AUTH_AZURE'
AFFINITIES = 'AFFINITIES'
ARCHIVES_ROOT = 'ARCHIVES_ROOT'
DOWNLOADS_ROOT = 'DOWNLOADS_ROOT'
ADMIN = 'ADMIN'
NODE_SELECTORS = 'NODE_SELECTORS'
TOLERATIONS = 'TOLERATIONS'
ANNOTATIONS ... | features = 'FEATURES'
auth_github = 'AUTH_GITHUB'
auth_gitlab = 'AUTH_GITLAB'
auth_bitbucket = 'AUTH_BITBUCKET'
auth_azure = 'AUTH_AZURE'
affinities = 'AFFINITIES'
archives_root = 'ARCHIVES_ROOT'
downloads_root = 'DOWNLOADS_ROOT'
admin = 'ADMIN'
node_selectors = 'NODE_SELECTORS'
tolerations = 'TOLERATIONS'
annotations ... |
# Emma is playing a new mobile game that starts with consecutively numbered clouds. Some of the clouds are thunderheads and others are cumulus. She can jump on any cumulus cloud having a number that is equal to the number of the current cloud plus or . She must avoid the thunderheads. Determine the minimum number of j... | def jumping_on_clouds(c):
if len(c) == 1:
return 0
if len(c) == 2:
return 0 if c[1] == 1 else 1
if c[2] == 1:
return 1 + jumping_on_clouds(c[1:])
if c[2] == 0:
return 1 + jumping_on_clouds(c[2:])
print(jumping_on_clouds([0, 0, 0, 0, 1, 0]))
array = [0, 0, 0, 0, 1, 0]
prin... |
def func(*args):
print(args)
print(*args)
a = [1, 2, 3]
# here "a" is passed as tuple of list: ([1, 2, 3],)
func(a)
# print(args) -> ([1, 2, 3],)
# print(*args) -> [1, 2, 3]
# here "a" is passed as tuple of integers: (1, 2, 3)
func(*a)
# print(args) -> (1, 2, 3)
# print(*args) -> 1 2 3
| def func(*args):
print(args)
print(*args)
a = [1, 2, 3]
func(a)
func(*a) |
def main():
while True:
n,m = map(int, input().split())
if n==0 and m==0:
break
D = [9] * n
H = [0] * m
for d in range(n):
D[d] = int(input())
for k in range(m):
H[k] = int(input())
D.sort() #... | def main():
while True:
(n, m) = map(int, input().split())
if n == 0 and m == 0:
break
d = [9] * n
h = [0] * m
for d in range(n):
D[d] = int(input())
for k in range(m):
H[k] = int(input())
D.sort()
H.sort()
g... |
# Default Configurations
DEFAULT_PYTHON_PATH = '/usr/bin/python'
DEFAULT_STD_OUT_LOG_LOC = '/usr/local/bin/log/env_var_manager.log'
DEFAULT_STSD_ERR_LOG_LOC = '/usr/local/bin/log/env_var_manager.log'
DEFAULT_START_INTERVAL = 120
| default_python_path = '/usr/bin/python'
default_std_out_log_loc = '/usr/local/bin/log/env_var_manager.log'
default_stsd_err_log_loc = '/usr/local/bin/log/env_var_manager.log'
default_start_interval = 120 |
n=int(input())
students={}
for k in range(0,n):
name = input()
grade=float(input())
if not name in students:
students[name]=[grade]
else:
students[name].append(grade)
for j in students:
gradesCount=len(students[j]); gradesSum=0
for k in range(0,len(students[j])):
... | n = int(input())
students = {}
for k in range(0, n):
name = input()
grade = float(input())
if not name in students:
students[name] = [grade]
else:
students[name].append(grade)
for j in students:
grades_count = len(students[j])
grades_sum = 0
for k in range(0, len(students[j])... |
def problem_2():
"By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms."
sequence = [1]
total, sequence_next = 0, 0
# While the next term in the Fibonacci sequence is under 4000000...
while(sequence_next < 4000000):
... | def problem_2():
"""By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms."""
sequence = [1]
(total, sequence_next) = (0, 0)
while sequence_next < 4000000:
sequence_next = sequence[len(sequence) - 1] + sequence[len(seque... |
#
# PySNMP MIB module HUAWEI-VPLS-TNL-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/HUAWEI-VPLS-TNL-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:49:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, constraints_union, value_size_constraint, single_value_constraint, value_range_constraint) ... |
print('a sequence from 0 to 2')
for i in range(3):
print(i)
print('----------------------')
print('a sequence from 2 to 4')
for i in range(2, 5):
print(i)
print('----------------------')
print('a sequence from 2 to 8 with a step of 2')
for i in range(2, 9, 2):
print(i)
'''
Output:
a seque... | print('a sequence from 0 to 2')
for i in range(3):
print(i)
print('----------------------')
print('a sequence from 2 to 4')
for i in range(2, 5):
print(i)
print('----------------------')
print('a sequence from 2 to 8 with a step of 2')
for i in range(2, 9, 2):
print(i)
'\nOutput:\na sequence from 0 to 2\n0\... |
class MockResponse:
def __init__(self, status_code, data):
self.status_code = status_code
self.data = data
def json(self):
return self.data
class AuthenticationMock:
def get_token(self):
pass
def get_headers(self):
return {"Authorization": "Bearer token"}... | class Mockresponse:
def __init__(self, status_code, data):
self.status_code = status_code
self.data = data
def json(self):
return self.data
class Authenticationmock:
def get_token(self):
pass
def get_headers(self):
return {'Authorization': 'Bearer token'}
de... |
#Creating a Tuple
newtuple = 'a','b','c','d'
print(newtuple)
# Tuple with 1 element
tupple = 'a',
print(tupple)
newtuple1 = tuple('abcd')
print(newtuple1)
print("------------------")
#Accessing Tuples
newtuple = 'a','b','c','d'
print(newtuple[1])
print(newtuple[-1])
#Traversing a Tuple
for i in newtuple:
print(... | newtuple = ('a', 'b', 'c', 'd')
print(newtuple)
tupple = ('a',)
print(tupple)
newtuple1 = tuple('abcd')
print(newtuple1)
print('------------------')
newtuple = ('a', 'b', 'c', 'd')
print(newtuple[1])
print(newtuple[-1])
for i in newtuple:
print(i)
print('------------------')
print('b' in newtuple) |
my_favorite_things = {'food': ['burgers', 'pho', 'mangoes'], 'basketball': ['dribbling', 'passing', 'shooting']}
# A list uses square brackets while a dictionary uses curly braces.
my_favorite_things['movies'] = ['Avengers', 'Star Wars']
# my_favorite_things of movies is value
# A square bracket after a variable allows... | my_favorite_things = {'food': ['burgers', 'pho', 'mangoes'], 'basketball': ['dribbling', 'passing', 'shooting']}
my_favorite_things['movies'] = ['Avengers', 'Star Wars']
print(my_favorite_things['food'])
appliances = ['lamp', 'toaster', 'microwave']
print(appliances[1])
appliances[1] = 'blender'
print(appliances)
my_fa... |
#
# @lc app=leetcode id=2 lang=python
#
# [2] Add Two Numbers
#
# @lc code=start
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution(object):
def addTwoNumbers(self, l1, l2):
"""
:type... | class Listnode(object):
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution(object):
def add_two_numbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ListNode
"""
if l1 == None:
re... |
def get_words_indexes(words_indexes_dictionary, review):
words = review.split(' ')
words_indexes = set()
for word in words:
if word in words_indexes_dictionary:
word_index = words_indexes_dictionary[word]
words_indexes.add(word_index)
return words_indexe... | def get_words_indexes(words_indexes_dictionary, review):
words = review.split(' ')
words_indexes = set()
for word in words:
if word in words_indexes_dictionary:
word_index = words_indexes_dictionary[word]
words_indexes.add(word_index)
return words_indexes |
bool_expected_methods = [
'__abs__',
'__add__',
'__and__',
'__bool__',
'__ceil__',
'__class__',
'__delattr__',
'__dir__',
'__divmod__',
'__doc__',
'__eq__',
'__float__',
'__floor__',
'__floordiv__',
'__format__',
'__ge__',
'__getattribute__',
'__ge... | bool_expected_methods = ['__abs__', '__add__', '__and__', '__bool__', '__ceil__', '__class__', '__delattr__', '__dir__', '__divmod__', '__doc__', '__eq__', '__float__', '__floor__', '__floordiv__', '__format__', '__ge__', '__getattribute__', '__getnewargs__', '__gt__', '__hash__', '__index__', '__init__', '__init_subcl... |
#the program calculates the average of numbers whose input is in the form of a string
def average():
numbers = str(input("Enter a string of numbers: "))
numbers = numbers.split()
numbers2 = []
total = 0
for number in numbers:
number = int(number)
total += number
... | def average():
numbers = str(input('Enter a string of numbers: '))
numbers = numbers.split()
numbers2 = []
total = 0
for number in numbers:
number = int(number)
total += number
numbers2.append(number)
avg = total // len(numbers2)
print(avg)
average() |
class Solution:
def twoSum(self, nums: List[int], target: int) -> List[int]:
num_dict = {}
for i, num in enumerate(nums):
n = target - num
if n not in num_dict:
num_dict[num] = i
else:
return [num_dict[n], i]
| class Solution:
def two_sum(self, nums: List[int], target: int) -> List[int]:
num_dict = {}
for (i, num) in enumerate(nums):
n = target - num
if n not in num_dict:
num_dict[num] = i
else:
return [num_dict[n], i] |
def pick_arr(arr, b):
nums = arr[:b]
idxsum = sum(nums)
maxsum = idxsum
for i in range(b):
remove = nums.pop()
add = arr.pop()
idxsum = idxsum - remove + add
maxsum = max(maxsum, idxsum)
return maxsum
print(pick_arr([5,-2,3,1,2], 3))
| def pick_arr(arr, b):
nums = arr[:b]
idxsum = sum(nums)
maxsum = idxsum
for i in range(b):
remove = nums.pop()
add = arr.pop()
idxsum = idxsum - remove + add
maxsum = max(maxsum, idxsum)
return maxsum
print(pick_arr([5, -2, 3, 1, 2], 3)) |
#!/usr/bin/env python
# encoding: utf-8
class HashInterface(object):
@staticmethod
def hash(*arg):
pass
| class Hashinterface(object):
@staticmethod
def hash(*arg):
pass |
class Solution:
def solve(self, nums):
ans = [-1]*len(nums)
unmatched = []
for i in range(len(nums)):
while unmatched and unmatched[0][0] < nums[i]:
ans[heappop(unmatched)[1]] = nums[i]
heappush(unmatched, [nums[i], i])
for i in range(len(nu... | class Solution:
def solve(self, nums):
ans = [-1] * len(nums)
unmatched = []
for i in range(len(nums)):
while unmatched and unmatched[0][0] < nums[i]:
ans[heappop(unmatched)[1]] = nums[i]
heappush(unmatched, [nums[i], i])
for i in range(len(nu... |
'''
Created on Aug 30, 2012
@author: philipkershaw
'''
| """
Created on Aug 30, 2012
@author: philipkershaw
""" |
SETTINGS = {
'gee': {
'service_account': None,
'privatekey_file': None,
}
}
| settings = {'gee': {'service_account': None, 'privatekey_file': None}} |
def fibonacci(n):
"""
Def: In mathematics, the Fibonacci numbers are the numbers in the following
integer sequence, called the Fibonacci sequence, and characterized by the
fact that every number after the first two is the sum of the two preceding
ones: `0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,... | def fibonacci(n):
"""
Def: In mathematics, the Fibonacci numbers are the numbers in the following
integer sequence, called the Fibonacci sequence, and characterized by the
fact that every number after the first two is the sum of the two preceding
ones: `0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,... |
# Fried Chicken Damage Skin
success = sm.addDamageSkin(2435960)
if success:
sm.chat("The Fried Chicken Damage Skin has been added to your account's damage skin collection.")
# sm.consumeItem(2435960)
| success = sm.addDamageSkin(2435960)
if success:
sm.chat("The Fried Chicken Damage Skin has been added to your account's damage skin collection.") |
# -*- coding: utf-8 -*-
# Tests for the different contrib/localflavor/ form fields.
localflavor_tests = r"""
# USZipCodeField ##############################################################
USZipCodeField validates that the data is either a five-digit U.S. zip code or
a zip+4.
>>> from django.contrib.localflavor.us.fo... | localflavor_tests = '\n# USZipCodeField ##############################################################\n\nUSZipCodeField validates that the data is either a five-digit U.S. zip code or\na zip+4.\n>>> from django.contrib.localflavor.us.forms import USZipCodeField\n>>> f = USZipCodeField()\n>>> f.clean(\'60606\')\nu\'606... |
class Solution(object):
def decompressRLElist(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
new = []
for i in range(len(nums)/2):
new += nums[2*i] * [nums[2*i+1]]
return new | class Solution(object):
def decompress_rl_elist(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
new = []
for i in range(len(nums) / 2):
new += nums[2 * i] * [nums[2 * i + 1]]
return new |
# -*- coding: utf-8 -*-
BADREQUEST = 400
UNAUTHORIZED = 401
FORBIDDEN = 403
GONE = 410
TOOMANYREQUESTS = 412
class DnsdbException(Exception):
def __init__(self, message, errcode=500, detail=None, msg_ch=u''):
self.message = message
self.errcode = errcode
self.detail = detail
self.... | badrequest = 400
unauthorized = 401
forbidden = 403
gone = 410
toomanyrequests = 412
class Dnsdbexception(Exception):
def __init__(self, message, errcode=500, detail=None, msg_ch=u''):
self.message = message
self.errcode = errcode
self.detail = detail
self.msg_ch = msg_ch
s... |
#create class
class Event:
#create class variables
def __init__(self , eventId , eventType , themeColor , location):
self.eventId = eventId
self.eventType = eventType
self.themeColor = themeColor
self.location = location
#define class functions
def displayEventDetails(se... | class Event:
def __init__(self, eventId, eventType, themeColor, location):
self.eventId = eventId
self.eventType = eventType
self.themeColor = themeColor
self.location = location
def display_event_details(self):
print()
print('Event Type = ' + self.eventType)
... |
class Piece:
def __init__(self, row, col):
self.clicked = False
self.numAround = -1
self.flagged = False
self.row, self.col = row, col
def setNeighbors(self, neighbors):
self.neighbors = neighbors
def getNumFlaggedAround(self):
num = 0
for n in self... | class Piece:
def __init__(self, row, col):
self.clicked = False
self.numAround = -1
self.flagged = False
(self.row, self.col) = (row, col)
def set_neighbors(self, neighbors):
self.neighbors = neighbors
def get_num_flagged_around(self):
num = 0
for n... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
@AUTHOR:Joselyn Zhao
@CONTACT:zhaojing17@foxmail.com
@HOME_PAGE:joselynzhao.top
@SOFTWERE:PyCharm
@FILE:del.py
@TIME:2020/4/29 19:57
@DES:
'''
dict = {'shuxue':99,'yuwen':99,'yingyu':99}
print('shuxue:',dict['shuxue'])
print('yuwen:',dict['yuwen'])
print('yingyu:',dict['yin... | """
@AUTHOR:Joselyn Zhao
@CONTACT:zhaojing17@foxmail.com
@HOME_PAGE:joselynzhao.top
@SOFTWERE:PyCharm
@FILE:del.py
@TIME:2020/4/29 19:57
@DES:
"""
dict = {'shuxue': 99, 'yuwen': 99, 'yingyu': 99}
print('shuxue:', dict['shuxue'])
print('yuwen:', dict['yuwen'])
print('yingyu:', dict['yingyu'])
dict['wuli'] = 100
dict['hu... |
# Input is square matrix A whose rows are sorted lists.
# Returns a list B by merging all rows into a single list.
#
# Goal: O(n^2 log n)
# Actually O(n^2 log(n^2)) but since log(n^2) == 2log(n) and constant factors can be ignored => O(2log(n)) can be relaxed to O(log(n))
def mergesort(Sublists):
sublists_count=l... | def mergesort(Sublists):
sublists_count = len(Sublists)
if sublists_count is 0:
return Sublists
elif sublists_count is 1:
return Sublists[0]
k = sublists_count // 2
first_half = mergesort(Sublists[:k])
second_half = mergesort(Sublists[k:])
return merge(first_half, second_half... |
# !/usr/bin/env python3
# -*- coding:utf-8 -*-
#
# Author: Flyaway - flyaway1217@gmail.com
# Blog: zhouyichu.com
#
# Python release: 3.4.5
#
# Date: 2017-02-28 13:43:07
# Last modified: 2017-03-01 17:02:35
"""
Database for DIRT
"""
class Path:
"""Path is the real data structure that store in the database.
""... | """
Database for DIRT
"""
class Path:
"""Path is the real data structure that store in the database.
"""
def __init__(self, path, slotX, slotY):
self._path = path
self._slot = dict()
self._slot['slotX'] = dict()
self._slot['slotY'] = dict()
self._slot['slotX'][slotX... |
def non_contiguous_motif(str1, dna_list):
index = -1
num = 0
for i in str1:
for j in dna_list:
index+= 1
if i == j:
num = index
return num
| def non_contiguous_motif(str1, dna_list):
index = -1
num = 0
for i in str1:
for j in dna_list:
index += 1
if i == j:
num = index
return num |
#!/usr/bin/env python
NAME = 'Microsoft ISA Server'
def is_waf(self):
detected = False
r = self.invalid_host()
if r is None:
return
if r.reason in self.isaservermatch:
detected = True
return detected
| name = 'Microsoft ISA Server'
def is_waf(self):
detected = False
r = self.invalid_host()
if r is None:
return
if r.reason in self.isaservermatch:
detected = True
return detected |
#
# PySNMP MIB module Unisphere-Data-L2F-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Unisphere-Data-L2F-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 21:24:37 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, value_size_constraint, constraints_intersection, single_value_constraint) ... |
# -*- coding: utf-8 -*-
# Docstring
"""Run the Full create_MW_potential_2014 set of scripts."""
__author__ = "Nathaniel Starkman"
__all__ = [
"main",
]
###############################################################################
# IMPORTS
###################################################################... | """Run the Full create_MW_potential_2014 set of scripts."""
__author__ = 'Nathaniel Starkman'
__all__ = ['main'] |
enu = 3
zenn = 0
for ai in range(enu, -1, -1):
zenn += ai*ai*ai
print(zenn)
| enu = 3
zenn = 0
for ai in range(enu, -1, -1):
zenn += ai * ai * ai
print(zenn) |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
File for Message object and associated functions.
The Message object's key function is to prevent users from editing... | """
File for Message object and associated functions.
The Message object's key function is to prevent users from editing fields in an action
or observation dict unintentionally.
"""
class Message(dict):
"""
Class for observations and actions in ParlAI.
Functions like a dict, but triggers a RuntimeError w... |
deck = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King', 'Ace']
value = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
deck_values = dict(zip(deck, value))
hand = [input() for _ in range(6)]
hand_values = [deck_values.get(card) for card in hand]
print(sum(hand_values) / 6)
| deck = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King', 'Ace']
value = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
deck_values = dict(zip(deck, value))
hand = [input() for _ in range(6)]
hand_values = [deck_values.get(card) for card in hand]
print(sum(hand_values) / 6) |
"""Codon to amino acid dictionary"""
codon_to_aa = {
"TTT": "F",
"TTC": "F",
"TTA": "L",
"TTG": "L",
"TCT": "S",
"TCC": "S",
"TCA": "S",
"TCG": "S",
"TAT": "Y",
"TAC": "Y",
"TAA": "*",
"TAG": "*",
"TGT": "C",
"TGC": "C",
"TGA": "*",
"TGG": "W",
"CTT": ... | """Codon to amino acid dictionary"""
codon_to_aa = {'TTT': 'F', 'TTC': 'F', 'TTA': 'L', 'TTG': 'L', 'TCT': 'S', 'TCC': 'S', 'TCA': 'S', 'TCG': 'S', 'TAT': 'Y', 'TAC': 'Y', 'TAA': '*', 'TAG': '*', 'TGT': 'C', 'TGC': 'C', 'TGA': '*', 'TGG': 'W', 'CTT': 'L', 'CTC': 'L', 'CTA': 'L', 'CTG': 'L', 'CCT': 'P', 'CCC': 'P', 'CCA... |
# -*- coding: utf-8 -*-
class RedirectError(Exception):
def __init__(self, response):
self.response = response
class NotLoggedInError(Exception):
pass
class SessionNotFreshError(Exception):
pass | class Redirecterror(Exception):
def __init__(self, response):
self.response = response
class Notloggedinerror(Exception):
pass
class Sessionnotfresherror(Exception):
pass |
class Cell(object):
def __init__(self):
self.neighbours = [None for _ in range(8)]
self.current_state = False
self.next_state = False
self.fixed = False
def count_neighbours(self) -> int:
count = 0
for n in self.neighbours:
if n.current_state:
... | class Cell(object):
def __init__(self):
self.neighbours = [None for _ in range(8)]
self.current_state = False
self.next_state = False
self.fixed = False
def count_neighbours(self) -> int:
count = 0
for n in self.neighbours:
if n.current_state:
... |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: aghast_generated
class DimensionOrder(object):
c_order = 0
fortran_order = 1
| class Dimensionorder(object):
c_order = 0
fortran_order = 1 |
def specialPolynomial(x, n):
s = 1
k = 0
while s <= n:
k += 1
s += x**k
return k-1
if __name__ == '__main__':
input0 = [2, 10, 1, 3]
input1 = [5, 111111110, 100, 140]
expectedOutput = [1, 7, 99, 4]
assert len(input0) == len(expectedOutput), '# input0 = {}, # expectedOutput = {}'.format(len(input0), len(exp... | def special_polynomial(x, n):
s = 1
k = 0
while s <= n:
k += 1
s += x ** k
return k - 1
if __name__ == '__main__':
input0 = [2, 10, 1, 3]
input1 = [5, 111111110, 100, 140]
expected_output = [1, 7, 99, 4]
assert len(input0) == len(expectedOutput), '# input0 = {}, # expecte... |
class TermGroupScope:
"""Specifies the values different group types can take within the termStore."""
global_ = 0
system = 1
siteCollection = 2
unknownFutureValue = 3
| class Termgroupscope:
"""Specifies the values different group types can take within the termStore."""
global_ = 0
system = 1
site_collection = 2
unknown_future_value = 3 |
def render_q(world, q_learner):
qvalues_list = []
for h in range(world.height):
row = []
qvalues_row = []
for w in range(world.width):
loc = torch.LongTensor([h, w])
c = world.get_at(loc)
# print('c', c)
if c == '' or c == 'A':
... | def render_q(world, q_learner):
qvalues_list = []
for h in range(world.height):
row = []
qvalues_row = []
for w in range(world.width):
loc = torch.LongTensor([h, w])
c = world.get_at(loc)
if c == '' or c == 'A':
world.set_agent_loc(loc)... |
__all__ = [
"deployment_pb2",
"repository_pb2",
"status_pb2",
"yatai_service_pb2_grpc",
"yatai_service_pb2",
]
| __all__ = ['deployment_pb2', 'repository_pb2', 'status_pb2', 'yatai_service_pb2_grpc', 'yatai_service_pb2'] |
class UnresolvedChild(Exception):
"""
Exception raised when children should be lazyloaded first
"""
pass
class TimeConstraintError(Exception):
"""
Exception raised when it is not possble to satisfy timing constraints
"""
pass
| class Unresolvedchild(Exception):
"""
Exception raised when children should be lazyloaded first
"""
pass
class Timeconstrainterror(Exception):
"""
Exception raised when it is not possble to satisfy timing constraints
"""
pass |
def solve():
N = int(input())
V = list(map(int, input().split()))
V1 = sorted(V[::2])
V2 = sorted(V[1::2])
flag = -1
for i in range(1, N):
i_ = i // 2
# if i&1: print('Check {} {}'.format(V1[i_], V2[i_]))
# if i&1==0: print('Check {} {}'.format(V2[i_-1], V1[i_]))
... | def solve():
n = int(input())
v = list(map(int, input().split()))
v1 = sorted(V[::2])
v2 = sorted(V[1::2])
flag = -1
for i in range(1, N):
i_ = i // 2
if i & 1 and V1[i_] > V2[i_] or (i & 1 == 0 and V2[i_ - 1] > V1[i_]):
flag = i - 1
break
print('OK') ... |
"""
This file contains mappings:
parameters_names_mapping - Mapping of Tcl/Tk command attributes
to methods of Qt/own objects.
Own objects are included because
of implementation details such as
menu problem (see ... | """
This file contains mappings:
parameters_names_mapping - Mapping of Tcl/Tk command attributes
to methods of Qt/own objects.
Own objects are included because
of implementation details such as
menu problem (see ... |
def target(x0, sink):
print(f'input: {x0}')
while True:
task = yield
x0 = task(x0)
sink.send(x0)
def sink():
try:
while True:
x = yield
except GeneratorExit:
print(f'final output: {x}')
| def target(x0, sink):
print(f'input: {x0}')
while True:
task = (yield)
x0 = task(x0)
sink.send(x0)
def sink():
try:
while True:
x = (yield)
except GeneratorExit:
print(f'final output: {x}') |
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def deleteDuplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if not head:
return None
... | class Listnode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
def delete_duplicates(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if not head:
return None
fake_head = list_node(None... |
def data_cart(request):
total_cart=0
total_items=0
if request.user.is_authenticated and request.session.__contains__('cart'):
for key, value in request.session['cart'].items():
if not key == "is_modify" and not key == 'id_update':
total_cart = total_... | def data_cart(request):
total_cart = 0
total_items = 0
if request.user.is_authenticated and request.session.__contains__('cart'):
for (key, value) in request.session['cart'].items():
if not key == 'is_modify' and (not key == 'id_update'):
total_cart = total_cart + float(v... |
# int: Minimum number of n-grams occurence to be retained
# All Ngrams that occur less than n times are removed
# default value: 0
ngram_min_to_be_retained = 0
# real: Minimum ratio n-grams to skip
# (will be chosen among the ones that occur rarely)
# expressed as a ratio of the cumulated histogram
# default value: 0... | ngram_min_to_be_retained = 0
ngram_min_rejected_ratio = 0
gram_size = 3
files_path = '/u/lisa/db/babyAI/textual_v2'
file_name_train_amat = 'BABYAI_gray_4obj_64x64.train.img'
file_name_valid_amat = 'BABYAI_gray_4obj_64x64.valid.img'
file_name_test_amat = 'BABYAI_gray_4obj_64x64.test.img'
image_size = 32 * 32
file_name_t... |
customcb = {'_smps_flo': ["#000000",
"#000002",
"#000004",
"#000007",
"#000009",
"#00000b",
"#00000d",
"#000010",
"#000012",
"#000014",
"#000016",
"#000019",
"#00001b",
"#00001d",
"#00001f",
"#000021",
"#000024",
"#000026",
"#000028",
"#00002a"... | customcb = {'_smps_flo': ['#000000', '#000002', '#000004', '#000007', '#000009', '#00000b', '#00000d', '#000010', '#000012', '#000014', '#000016', '#000019', '#00001b', '#00001d', '#00001f', '#000021', '#000024', '#000026', '#000028', '#00002a', '#00002d', '#00002f', '#000031', '#000033', '#000036', '#000038', '#00003a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.