content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
number=0
list1=[]
wnumber=0
lnumber=0
while number<7:
winnumber=input().upper()
number+=1
list1.append(winnumber)
for i in list1:
if 'W' == i:
wnumber+=1
else:
lnumber+=1
if wnumber>=5:
print('1')
elif wnumber<=4 and wnumber>=3:
print('2')
elif wnum... | number = 0
list1 = []
wnumber = 0
lnumber = 0
while number < 7:
winnumber = input().upper()
number += 1
list1.append(winnumber)
for i in list1:
if 'W' == i:
wnumber += 1
else:
lnumber += 1
if wnumber >= 5:
print('1')
elif wnumber <= 4 and wnumber >= 3:
print('2')
elif wnumber... |
#!/usr/bin/env python3
steps = 316
circ_buffer = [0]
pos = 0
num = 0
for cnt in range(1, 50000001):
pos = (pos + steps) % cnt
if pos == 0:
num = cnt
pos += 1
print(num)
| steps = 316
circ_buffer = [0]
pos = 0
num = 0
for cnt in range(1, 50000001):
pos = (pos + steps) % cnt
if pos == 0:
num = cnt
pos += 1
print(num) |
# 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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under th... | class Dbcolumn:
def __init__(self, name: str, type: str, description: str=None, ordinal_position: int=None):
self.name = name
self.type = type
self.description = description
self.ordinal_position = ordinal_position
def __eq__(self, other):
return self.name == other.name... |
#Kunal Gautam
#Codewars : @Kunalpod
#Problem name: Sum of Odd Numbers
#Problem level: 7 kyu
def row_sum_odd_numbers(n):
return n**3
| def row_sum_odd_numbers(n):
return n ** 3 |
class Solution:
def XXX(self, nums: List[int]) -> None:
rgb = [0, 0, 0]
for i in nums:
rgb[i] += 1
nums[:rgb[0]] = [0 for _ in range(rgb[0])]
nums[rgb[0]:rgb[0] + rgb[1]] = [1 for _ in range(rgb[1])]
nums[rgb[0] + rgb[1]:] = [2 for _ in range(rgb[2])]
| class Solution:
def xxx(self, nums: List[int]) -> None:
rgb = [0, 0, 0]
for i in nums:
rgb[i] += 1
nums[:rgb[0]] = [0 for _ in range(rgb[0])]
nums[rgb[0]:rgb[0] + rgb[1]] = [1 for _ in range(rgb[1])]
nums[rgb[0] + rgb[1]:] = [2 for _ in range(rgb[2])] |
def orelse(*iters):
found = False
for iter in iters:
for elem in iter:
found = True
yield elem
if found:
break
def extract(it, pred):
extracted = []
def filtered_it():
nonlocal extracted
for elem in it:
if pred(elem):
... | def orelse(*iters):
found = False
for iter in iters:
for elem in iter:
found = True
yield elem
if found:
break
def extract(it, pred):
extracted = []
def filtered_it():
nonlocal extracted
for elem in it:
if pred(elem):
... |
# -*- coding: utf-8 -*-
competidores, n_voltas = list(map(int, input().split()))
competidor_1 = list(map(int, input().split()))
melhor_tempo = sum(competidor_1)
vencedor = 1
for i in range(1, competidores):
competidor_i = list(map(int, input().split()))
tempo_i = sum(competidor_i)
if (tempo_i < melhor_tem... | (competidores, n_voltas) = list(map(int, input().split()))
competidor_1 = list(map(int, input().split()))
melhor_tempo = sum(competidor_1)
vencedor = 1
for i in range(1, competidores):
competidor_i = list(map(int, input().split()))
tempo_i = sum(competidor_i)
if tempo_i < melhor_tempo:
melhor_tempo ... |
DEFAULT_BRANCH = "unstable"
GITREPOS = {}
GITREPOS["builders_extra"] = [
"https://github.com/threefoldtech/jumpscaleX_builders",
"%s" % DEFAULT_BRANCH,
"JumpscaleBuildersExtra",
"{DIR_BASE}/lib/jumpscale/JumpscaleBuildersExtra",
]
GITREPOS["installer"] = [
"https://github.com/threefoldtech/jumpsca... | default_branch = 'unstable'
gitrepos = {}
GITREPOS['builders_extra'] = ['https://github.com/threefoldtech/jumpscaleX_builders', '%s' % DEFAULT_BRANCH, 'JumpscaleBuildersExtra', '{DIR_BASE}/lib/jumpscale/JumpscaleBuildersExtra']
GITREPOS['installer'] = ['https://github.com/threefoldtech/jumpscaleX_core', '%s' % DEFAULT_... |
#!/usr/bin/env python
script_version = "0.21"
processed_comp_list = []
spdx_lics = []
# The name of a custom attribute which should override the default package supplier
SBOM_CUSTOM_SUPPLIER_NAME = "PackageSupplier"
usage_dict = {
"SOURCE_CODE": "CONTAINS",
"STATICALLY_LINKED": "STATIC_LINK",
"DYNAMICALL... | script_version = '0.21'
processed_comp_list = []
spdx_lics = []
sbom_custom_supplier_name = 'PackageSupplier'
usage_dict = {'SOURCE_CODE': 'CONTAINS', 'STATICALLY_LINKED': 'STATIC_LINK', 'DYNAMICALLY_LINKED': 'DYNAMIC_LINK', 'SEPARATE_WORK': 'OTHER', 'MERELY_AGGREGATED': 'OTHER', 'IMPLEMENTATION_OF_STANDARD': 'OTHER', ... |
gos_file = open('GOS.csv')
gos_lines = gos_file.readlines()
gos_file.close()
gos_map = {}
for l in gos_lines[1:]:
sl = l.split(',')
gos_map[int(sl[0])] = int(sl[1])
observe_file = open('rf_observ - Copy.csv')
obs_lines = observe_file.readlines()
observe_file.close()
obs_tot_map = {}
obs_rea_map = {}
obs_pre_map ... | gos_file = open('GOS.csv')
gos_lines = gos_file.readlines()
gos_file.close()
gos_map = {}
for l in gos_lines[1:]:
sl = l.split(',')
gos_map[int(sl[0])] = int(sl[1])
observe_file = open('rf_observ - Copy.csv')
obs_lines = observe_file.readlines()
observe_file.close()
obs_tot_map = {}
obs_rea_map = {}
obs_pre_map... |
class Solution:
def maxNumberOfBalloons(self, text: str) -> int:
b = text.count('b')
a = text.count('a')
l = int(text.count('l') / 2)
o = int(text.count('o') / 2)
n = text.count('n')
f = [b, a, l, o, n]
return min(f)
class Solution:
def maxNumberOfB... | class Solution:
def max_number_of_balloons(self, text: str) -> int:
b = text.count('b')
a = text.count('a')
l = int(text.count('l') / 2)
o = int(text.count('o') / 2)
n = text.count('n')
f = [b, a, l, o, n]
return min(f)
class Solution:
def max_number_of... |
#!/usr/bin/env python
files = [ "oiio-logo-no-alpha.png", "oiio-logo-with-alpha.png" ]
for f in files:
command += rw_command (OIIO_TESTSUITE_IMAGEDIR, f)
| files = ['oiio-logo-no-alpha.png', 'oiio-logo-with-alpha.png']
for f in files:
command += rw_command(OIIO_TESTSUITE_IMAGEDIR, f) |
# Enter your code here. Read input from STDIN. Print output to STDOUT
# Take 2 input sets A and B
input()
A = set(map(int, input().split()))
input()
B = set(map(int, input().split()))
# Print union by set.union
print(len(A.union(B)))
| input()
a = set(map(int, input().split()))
input()
b = set(map(int, input().split()))
print(len(A.union(B))) |
# -*- coding: utf-8 -*-
def main():
n, w = map(int, input().split())
ws = [0 for _ in range(n)]
vs = [0 for _ in range(n)]
inf = 10 ** 12
dp = [[inf for _ in range(((n + 1) * 10 ** 3) + 1)] for _ in range(n + 1)]
for i in range(n):
wi, vi = map(int, input().split())
... | def main():
(n, w) = map(int, input().split())
ws = [0 for _ in range(n)]
vs = [0 for _ in range(n)]
inf = 10 ** 12
dp = [[inf for _ in range((n + 1) * 10 ** 3 + 1)] for _ in range(n + 1)]
for i in range(n):
(wi, vi) = map(int, input().split())
ws[i] = wi
vs[i] = vi
d... |
class DayOfAGossipingBusDriver(object):
def __init__(self, drivers, gossip_universe):
self.drivers = drivers
self.gossip_universe = gossip_universe
def one_minute_passed(self):
self.share_gossips_between_all_drivers()
self.all_drivers_drive()
def share_gossips_between_all_d... | class Dayofagossipingbusdriver(object):
def __init__(self, drivers, gossip_universe):
self.drivers = drivers
self.gossip_universe = gossip_universe
def one_minute_passed(self):
self.share_gossips_between_all_drivers()
self.all_drivers_drive()
def share_gossips_between_all_... |
# Example which shows using ANSI color codes to print color to the terminal
# window.
def color(this_color, string):
return "\033[" + this_color + "m" + string + "\033[0m"
for i in range(30, 38):
c = str(i)
print('This is %s' % color(c, 'color ' + c))
c = '1;' + str(i)
print('This is %s' % color(... | def color(this_color, string):
return '\x1b[' + this_color + 'm' + string + '\x1b[0m'
for i in range(30, 38):
c = str(i)
print('This is %s' % color(c, 'color ' + c))
c = '1;' + str(i)
print('This is %s' % color(c, 'color ' + c)) |
# @Author : guopeiming
# @Contact : guopeiming2016@{qq, gmail, 163}.com
oovKey = '<unk>'
oovId = 0
padKey = '<pad>'
padId = 1
BOS = '<BOS>'
EOS = '<EOS>'
APP = 0
SEG = 1
actionPadId = 2
bertAttr = 'bert'
embeddings_layer_keyword = 'embeddings'
EPSILON = 1e-10
MAX_OOV_NUM = 1500
| oov_key = '<unk>'
oov_id = 0
pad_key = '<pad>'
pad_id = 1
bos = '<BOS>'
eos = '<EOS>'
app = 0
seg = 1
action_pad_id = 2
bert_attr = 'bert'
embeddings_layer_keyword = 'embeddings'
epsilon = 1e-10
max_oov_num = 1500 |
class BaseTestCSVUpload(object):
def test_generate_username_from_email(self):
reader = [['', 'cleartext$password', 'rohith@openwisp.com', 'Rohith', 'ASRK']]
batch = self.radius_batch_model.objects.create()
batch.add(reader)
self.assertEqual(self.radius_batch_model.objects.all().count... | class Basetestcsvupload(object):
def test_generate_username_from_email(self):
reader = [['', 'cleartext$password', 'rohith@openwisp.com', 'Rohith', 'ASRK']]
batch = self.radius_batch_model.objects.create()
batch.add(reader)
self.assertEqual(self.radius_batch_model.objects.all().coun... |
a3, a2, a1 = int(input()), int(input()), int(input())
b3, b2, b1 = int(input()), int(input()), int(input())
a_total = a3 * 3 + a2 * 2 + a1
b_total = b3 * 3 + b2 * 2 + b1
if a_total > b_total:
print("A")
elif a_total == b_total:
print("T")
else:
print("B")
| (a3, a2, a1) = (int(input()), int(input()), int(input()))
(b3, b2, b1) = (int(input()), int(input()), int(input()))
a_total = a3 * 3 + a2 * 2 + a1
b_total = b3 * 3 + b2 * 2 + b1
if a_total > b_total:
print('A')
elif a_total == b_total:
print('T')
else:
print('B') |
def indval(x):
return '@' + str(x)
def immval(x):
return '#' + str(x) | def indval(x):
return '@' + str(x)
def immval(x):
return '#' + str(x) |
class FeatureExtractor(object):
def __init__(self, files):
self.files = files
def retrieve_coords(self):
return self._retrieve_coords()
def retrieve_dihedrals(self):
return self._retrieve_dihedrals()
| class Featureextractor(object):
def __init__(self, files):
self.files = files
def retrieve_coords(self):
return self._retrieve_coords()
def retrieve_dihedrals(self):
return self._retrieve_dihedrals() |
# quicksort algorithms for linked list
class ListNode:
def __init__(self, val, next=None):
self.val = val
self.next = next
def __repr__(self):
rv = str(self.val)
if self.next:
rv = rv + ' -> ' + repr(self.next)
return rv
def qsort(start, end=None):
if... | class Listnode:
def __init__(self, val, next=None):
self.val = val
self.next = next
def __repr__(self):
rv = str(self.val)
if self.next:
rv = rv + ' -> ' + repr(self.next)
return rv
def qsort(start, end=None):
if start is end or start.next is end:
... |
class Solution:
def romanToInt(self, s: str) -> int:
d = {'I':1, 'V':5, 'X':10,'L':50,'C':100, 'D':500,'M':1000, 'IV':4, 'IX':9, 'XL':40, 'XC':90,'CD':400, 'CM':900}
i, res = 0, 0
while i < len(s):
twoDig = s[i:i+2]
oneDig = s[i... | class Solution:
def roman_to_int(self, s: str) -> int:
d = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000, 'IV': 4, 'IX': 9, 'XL': 40, 'XC': 90, 'CD': 400, 'CM': 900}
(i, res) = (0, 0)
while i < len(s):
two_dig = s[i:i + 2]
one_dig = s[i]
... |
cont=0
soma=0
numero=int(input("Digite um numero: "))
while cont <=10:
soma = soma + cont*2
cont = cont +1
print (soma)
| cont = 0
soma = 0
numero = int(input('Digite um numero: '))
while cont <= 10:
soma = soma + cont * 2
cont = cont + 1
print(soma) |
a = input('please input a number: ')
b = input('please input a second number: ')
ax = a
bx = b
a = bx
b = ax
print(a)
print(b)
| a = input('please input a number: ')
b = input('please input a second number: ')
ax = a
bx = b
a = bx
b = ax
print(a)
print(b) |
def ex7():
running = True
while running:
try:
user_input = int(input("Enter an integer: "))
if user_input < 2 or str(user_input) == 0:
print("Invalid input")
if user_input == 1:
print(f"Btw the integer {user_input} is no... | def ex7():
running = True
while running:
try:
user_input = int(input('Enter an integer: '))
if user_input < 2 or str(user_input) == 0:
print('Invalid input')
if user_input == 1:
print(f'Btw the integer {user_input} is not a prim... |
class Column:
def __init__(self, key, label, auto=False):
self.key = key
self.label = label
self.auto = auto
def get_json(self):
return {"key": self.key, "label": self.label}
def render(self, val):
return val if val else ""
class AggrColumn(Column):
def __init... | class Column:
def __init__(self, key, label, auto=False):
self.key = key
self.label = label
self.auto = auto
def get_json(self):
return {'key': self.key, 'label': self.label}
def render(self, val):
return val if val else ''
class Aggrcolumn(Column):
def __ini... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
d = {
'Michael': 95,
'Bob': 75,
'Tracy': 85,
'95':95,
90:90,
'stanford':100
}
print('d[\'Michael\'] =', d['Michael'])
print('d[\'Bob\'] =', d['Bob'])
print('d[\'Tracy\'] =', d['Tracy'])
print('d[\'95\'] =',d['95'])
print('d[90] =',d[90])
print('d[s... | d = {'Michael': 95, 'Bob': 75, 'Tracy': 85, '95': 95, 90: 90, 'stanford': 100}
print("d['Michael'] =", d['Michael'])
print("d['Bob'] =", d['Bob'])
print("d['Tracy'] =", d['Tracy'])
print("d['95'] =", d['95'])
print('d[90] =', d[90])
print('d[stanford] =', d['stanford'])
print("d.get('Thomas', -1) =", d.get('Thomas', -1... |
class Solution:
def get_balls(self, arr):
def dfs(i, j, r, c):
if(i == r):
return j
curr = arr[i][j]
if(curr == 1 and (j+1 == c or arr[i][j+1] == -1)):
return -1
elif(curr == -1) and (j-1<0 or arr[i][j-1] == 1):
... | class Solution:
def get_balls(self, arr):
def dfs(i, j, r, c):
if i == r:
return j
curr = arr[i][j]
if curr == 1 and (j + 1 == c or arr[i][j + 1] == -1):
return -1
elif curr == -1 and (j - 1 < 0 or arr[i][j - 1] == 1):
... |
pkgname = "libxrandr"
pkgver = "1.5.2"
pkgrel = 0
build_style = "gnu_configure"
configure_args = ["--enable-malloc0returnsnull"]
hostmakedepends = ["pkgconf"]
makedepends = ["xorgproto", "libxext-devel", "libxrender-devel"]
pkgdesc = "X RandR Library from X.org"
maintainer = "q66 <q66@chimera-linux.org>"
license = "MIT... | pkgname = 'libxrandr'
pkgver = '1.5.2'
pkgrel = 0
build_style = 'gnu_configure'
configure_args = ['--enable-malloc0returnsnull']
hostmakedepends = ['pkgconf']
makedepends = ['xorgproto', 'libxext-devel', 'libxrender-devel']
pkgdesc = 'X RandR Library from X.org'
maintainer = 'q66 <q66@chimera-linux.org>'
license = 'MIT... |
class Solution:
def numSimilarGroups(self, A):
def explore(s):
visited.add(s)
for v in edges[s]:
if v not in visited: explore(v)
res, edges, visited = 0, {}, set()
if len(A) >= 2 * len(A[0]):
strs = set(A)
for s in A:
... | class Solution:
def num_similar_groups(self, A):
def explore(s):
visited.add(s)
for v in edges[s]:
if v not in visited:
explore(v)
(res, edges, visited) = (0, {}, set())
if len(A) >= 2 * len(A[0]):
strs = set(A)
... |
class Restaurant():
def __init__(self,name,type):
self.restaurant_name = name
self.cuisine_type = type
def describe_restaurant(self):
print("Nombre: ", self.restaurant_name)
print("Tipo de cocina: ", self.cuisine_type)
def open_restaurant(self):
print("That ... | class Restaurant:
def __init__(self, name, type):
self.restaurant_name = name
self.cuisine_type = type
def describe_restaurant(self):
print('Nombre: ', self.restaurant_name)
print('Tipo de cocina: ', self.cuisine_type)
def open_restaurant(self):
print('That the res... |
N, Q = map(int,input().split())
A = [0] + list(map(int,input().split()))
# print(N, Q)
# print(A)
# print("----")
for i in range(Q):
t, x, y = map(int,input().split())
if t == 1:
A[x] = A[x] ^ y
if t == 2:
xor_list = A[x:-1] + [y]
for j in range(len(xor_list)-1):
res = ... | (n, q) = map(int, input().split())
a = [0] + list(map(int, input().split()))
for i in range(Q):
(t, x, y) = map(int, input().split())
if t == 1:
A[x] = A[x] ^ y
if t == 2:
xor_list = A[x:-1] + [y]
for j in range(len(xor_list) - 1):
res = xor_list[j] ^ xor_list[j + 1]
... |
def validate_x(w: int, x: int, r: int) -> bool:
if r <= x <= w - r:
return True
return False
def validate_y(h: int, y: int, r: int) -> bool:
if r <= y <= h - r:
return True
return False
def resolve():
w, h, x, y, r = map(int, input().split())
if validate_x(w, x, r) and valid... | def validate_x(w: int, x: int, r: int) -> bool:
if r <= x <= w - r:
return True
return False
def validate_y(h: int, y: int, r: int) -> bool:
if r <= y <= h - r:
return True
return False
def resolve():
(w, h, x, y, r) = map(int, input().split())
if validate_x(w, x, r) and valida... |
def swap_bits(num, i, j):
if (num>>i & 1) != (num>>j & 1):
num ^= ((1<<i) | (1<<j))
return num
num = 129
for x in range(num, num+10):
print(bin(x), bin(swap_bits(x, 1, 2)))
| def swap_bits(num, i, j):
if num >> i & 1 != num >> j & 1:
num ^= 1 << i | 1 << j
return num
num = 129
for x in range(num, num + 10):
print(bin(x), bin(swap_bits(x, 1, 2))) |
# -*- coding: utf-8 -*-
INPUT_PATH = "../data/data_reduced.json"
OUTPUT_PATH = "../data/recommendations.json"
NUM_RECS = 5 | input_path = '../data/data_reduced.json'
output_path = '../data/recommendations.json'
num_recs = 5 |
# Done by Carlos Amaral (2020/09/19)
taxi_ride_info = ["da7a62fce04", 180, 1.1, True]
print("The data type for the taxi_ride_info variable is: ", type(taxi_ride_info))
print("The data type for the first element of taxi_ride_info is: ", type(taxi_ride_info[0]))
print("The data type for the second element of taxi_rid... | taxi_ride_info = ['da7a62fce04', 180, 1.1, True]
print('The data type for the taxi_ride_info variable is: ', type(taxi_ride_info))
print('The data type for the first element of taxi_ride_info is: ', type(taxi_ride_info[0]))
print('The data type for the second element of taxi_ride_info is: ', type(taxi_ride_info[1]))
pr... |
class Solution:
def sumNumbers(self, root ):
self.result = 0
self.preOrder(root,0)
return self.result
def preOrder(self,root,tmp):
if not root:
return
if not root.left and not root.right:
# sum here
self.result += tmp*10 + root.val
... | class Solution:
def sum_numbers(self, root):
self.result = 0
self.preOrder(root, 0)
return self.result
def pre_order(self, root, tmp):
if not root:
return
if not root.left and (not root.right):
self.result += tmp * 10 + root.val
retur... |
# -*- coding: utf-8 -*-
# Copyright 2019 Carsten Blank
#
# 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
#
# Unless required by applicable la... | result = {'simulation': {'qobj': {'qobj_id': 'sim_product_state_2_copies_20190610T110047Z', 'config': {'shots': 8192, 'memory_slots': 2, 'max_credits': 315, 'memory': False, 'n_qubits': 7}, 'experiments': [{'instructions': [{'name': 'u3', 'params': [0.0, -1.5707963267948966, 1.5707963267948966], 'texparams': ['0.0', '-... |
class Solution:
def tribonacci(self, n: int) -> int:
if n == 0 or n == 1:
return n
t0, t1, t2 = 0, 1, 1
for i in range(n - 2):
t2, t1, t0 = t2 + t1 + t0, t2, t1
return t2
| class Solution:
def tribonacci(self, n: int) -> int:
if n == 0 or n == 1:
return n
(t0, t1, t2) = (0, 1, 1)
for i in range(n - 2):
(t2, t1, t0) = (t2 + t1 + t0, t2, t1)
return t2 |
# -*- coding: utf-8 -*-
'''
This module is obsolete.
'''
PLUGS = [
("caps", "http://nsap.intra.cea.fr/caps-doc/"),
("qmri", "https://bioproj.extra.cea.fr/redmine/projects/qmri/publishing/"),
("funtk", "https://bioproj.extra.cea.fr/redmine/projects/funtk/publishing/"),
("pclinfmri", "")
]
| """
This module is obsolete.
"""
plugs = [('caps', 'http://nsap.intra.cea.fr/caps-doc/'), ('qmri', 'https://bioproj.extra.cea.fr/redmine/projects/qmri/publishing/'), ('funtk', 'https://bioproj.extra.cea.fr/redmine/projects/funtk/publishing/'), ('pclinfmri', '')] |
#!/usr/bin/env python3
def enb():
print("enb command line comming soon")
| def enb():
print('enb command line comming soon') |
#Given a string in which the letter h occurs at least two times,
# reverse the sequence of characters enclosed between the first and last appearances.
s = input()
i1 = s.find('h')
print(s.find('h'))
i2 = s.rfind('h')
print(s.rfind('h'))
sh = s[i1:(i2+1)]
new_s = s[:i1] + sh[::-1] + s[(i2+1):]
print(new_s) | s = input()
i1 = s.find('h')
print(s.find('h'))
i2 = s.rfind('h')
print(s.rfind('h'))
sh = s[i1:i2 + 1]
new_s = s[:i1] + sh[::-1] + s[i2 + 1:]
print(new_s) |
#!/usr/bin/env python
# BST
class Node:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
def insert(self, data):
if self.data:
if data < self.data:
if self.left is None:
self.left = Node(data)
... | class Node:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
def insert(self, data):
if self.data:
if data < self.data:
if self.left is None:
self.left = node(data)
else:
... |
URL = "url"
IOTA = "iota"
DOC = "document"
URL_TYPES = [URL, IOTA, DOC]
| url = 'url'
iota = 'iota'
doc = 'document'
url_types = [URL, IOTA, DOC] |
# unexpected indent
#a = 1
# + 2
# + 3
# invalid syntax
#a = 1 +
# 2 +
# 3
a = 1 + \
2 + \
3
print(a)
| a = 1 + 2 + 3
print(a) |
class DeltaCalculator:
def __init__(self):
self._values = {}
def delta(self, key, value):
last = self._values.get(key)
self._values[key] = value
if last is None:
return None
return value - last
| class Deltacalculator:
def __init__(self):
self._values = {}
def delta(self, key, value):
last = self._values.get(key)
self._values[key] = value
if last is None:
return None
return value - last |
def save_user(backend, user, response, *args, **kwargs) -> None:
if user and not user.is_staff:
user.is_staff = True
user.save()
| def save_user(backend, user, response, *args, **kwargs) -> None:
if user and (not user.is_staff):
user.is_staff = True
user.save() |
def snake_case_key(key: str) -> str:
assert isinstance(key, str)
new_key = key[0]
for char in key[1:]:
if char.isupper():
new_key += "_{char}".format(char=char.lower())
elif char == "-":
new_key += "__"
else:
new_key += char
return new_key
| def snake_case_key(key: str) -> str:
assert isinstance(key, str)
new_key = key[0]
for char in key[1:]:
if char.isupper():
new_key += '_{char}'.format(char=char.lower())
elif char == '-':
new_key += '__'
else:
new_key += char
return new_key |
#!/usr/bin/env python3
if __name__ == '__main__':
width = 1001
cur = 1
cur_w = 3
ans = 1
while cur_w <= width:
ans += 4 * cur + 10 * (cur_w - 1)
cur += 4 * (cur_w - 1)
cur_w += 2
print(ans)
| if __name__ == '__main__':
width = 1001
cur = 1
cur_w = 3
ans = 1
while cur_w <= width:
ans += 4 * cur + 10 * (cur_w - 1)
cur += 4 * (cur_w - 1)
cur_w += 2
print(ans) |
BROKER_URL = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
CELERY_IMPORTS = ("octavious.parallelizer.celery", )
CELERY_TASK_RESULT_EXPIRES = 300
| broker_url = 'redis://localhost:6379/0'
celery_result_backend = 'redis://localhost:6379/0'
celery_imports = ('octavious.parallelizer.celery',)
celery_task_result_expires = 300 |
def quick_sort(lst):
aux_quick_sort(lst, 0, len(lst) - 1)
return lst
def aux_quick_sort(lst, start, end):
if start >= end:
return
pivot_pos = partition(lst, start, end)
aux_quick_sort(lst, start, pivot_pos - 1)
aux_quick_sort(lst, pivot_pos + 1, end)
def partition(lst, start, end):
... | def quick_sort(lst):
aux_quick_sort(lst, 0, len(lst) - 1)
return lst
def aux_quick_sort(lst, start, end):
if start >= end:
return
pivot_pos = partition(lst, start, end)
aux_quick_sort(lst, start, pivot_pos - 1)
aux_quick_sort(lst, pivot_pos + 1, end)
def partition(lst, start, end):
... |
settings = {
"WIDTH": 200,
"HEIGHT": 66,
"CHANNELS": 3,
"BALANCE_MODE": 'RESAMPLE',
"DEFAULT_TRAIN_FILE_DIRECTORY": 'D:/train_data/raw/',
"DEFAULT_TRAIN_FILE": 'D:/train_data/raw/training_data_{}.npy',
"DEFAULT_TRAIN_FILE_PROCESSED_DIRECTORY": 'D:/train_data/processed/',
"DEFAULT_TRAIN_F... | settings = {'WIDTH': 200, 'HEIGHT': 66, 'CHANNELS': 3, 'BALANCE_MODE': 'RESAMPLE', 'DEFAULT_TRAIN_FILE_DIRECTORY': 'D:/train_data/raw/', 'DEFAULT_TRAIN_FILE': 'D:/train_data/raw/training_data_{}.npy', 'DEFAULT_TRAIN_FILE_PROCESSED_DIRECTORY': 'D:/train_data/processed/', 'DEFAULT_TRAIN_FILE_PROCESSED': 'D:/train_data/pr... |
# Agent Template.
#
# Copy this agent.py in your model dir (e.g. models/mymodel/agent.py)
# and implement predict(state) method to start
class Agent():
def __init__(self, **kwargs):
# initialize anything you need.
# e.g. load pre-trained model
pass
def predict(self, state):
# ... | class Agent:
def __init__(self, **kwargs):
pass
def predict(self, state):
action = 1
return action |
# The famous Hello, world! problem written in python.
# Author: Adrian Sypos
# Date: 21/09/2017
print("Hello, world!") | print('Hello, world!') |
def myPow(self,x,n):
if n<0:
x=1/x
n=-n
pow=1
while n:
if n&1:
pow*=x
x*=x
n>>=1
return pow
def myPow2(self,x,n):
if not n:
return 1
if n<0:
return 1/self.myPow2(x,-n)
if n%2:
return x*self.myPow2(... | def my_pow(self, x, n):
if n < 0:
x = 1 / x
n = -n
pow = 1
while n:
if n & 1:
pow *= x
x *= x
n >>= 1
return pow
def my_pow2(self, x, n):
if not n:
return 1
if n < 0:
return 1 / self.myPow2(x, -n)
if n % 2:
return x... |
#
# PySNMP MIB module COLUBRIS-VIRTUAL-AP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/COLUBRIS-VIRTUAL-AP-MIB
# Produced by pysmi-0.3.4 at Wed May 1 12:25:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_size_constraint, single_value_constraint, constraints_intersection, value_range_constraint) ... |
def can_build(env, platform):
return env["tools"]
def configure(env):
pass
def get_doc_path():
return "doc_classes"
def get_doc_classes():
return [
"VGColor",
"VGGradient",
"VGLinearGradient",
"VGMeshRenderer",
"VGPaint",
"VGPath",
"VGRadialG... | def can_build(env, platform):
return env['tools']
def configure(env):
pass
def get_doc_path():
return 'doc_classes'
def get_doc_classes():
return ['VGColor', 'VGGradient', 'VGLinearGradient', 'VGMeshRenderer', 'VGPaint', 'VGPath', 'VGRadialGradient', 'VGRenderer', 'EditorSceneImporterSVG'] |
def can_partition(num):
s = sum(num)
if s % 2 != 0: # if 's' is a an odd number, we can't have two subsets with same total
return False
s = int(s / 2) # we are trying to find a subset of given numbers that has a total sum of 's/2'.
n = len(num)
dp = [[False for x in range(s + 1)] for y in... | def can_partition(num):
s = sum(num)
if s % 2 != 0:
return False
s = int(s / 2)
n = len(num)
dp = [[False for x in range(s + 1)] for y in range(n)]
for i in range(0, n):
dp[i][0] = True
for j in range(1, s + 1):
dp[0][j] = num[0] == j
for i in range(1, n):
... |
text = input("Enter text: ")
count = 0
for char in text:
if char == "a":
count +=1
if char == "e":
count += 2
if char == "i":
count += 3
if char == "o":
count += 4
if char == "u":
count += 5
print(count) | text = input('Enter text: ')
count = 0
for char in text:
if char == 'a':
count += 1
if char == 'e':
count += 2
if char == 'i':
count += 3
if char == 'o':
count += 4
if char == 'u':
count += 5
print(count) |
'''
Author : MiKueen
Level : Easy
Problem Statement : Happy Number
Write an algorithm to determine if a number n is "happy".
A happy number is a number defined by the following process: Starting with any positive integer,
replace the number by the sum of the squares of its digits, and repeat the process until the num... | """
Author : MiKueen
Level : Easy
Problem Statement : Happy Number
Write an algorithm to determine if a number n is "happy".
A happy number is a number defined by the following process: Starting with any positive integer,
replace the number by the sum of the squares of its digits, and repeat the process until the num... |
# Maximum Subarray: https://leetcode.com/problems/maximum-subarray/
# Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.
# A subarray is a contiguous part of an array.
# This problem is actually kind of like a dynamic programming pr... | class Solution:
def max_sub_array(self, nums) -> int:
result = nums[0]
cur_sum = nums[0]
for i in range(1, len(nums)):
cur_sum = max(curSum + nums[i], nums[i])
result = max(curSum, result)
return result |
x = float(input())
if x <= 400.00:
s = x * 1.15
r = s - x
p = 15
if 400.01 <= x <= 800.00:
s = x * 1.12
r = s - x
p = 12
if 800.01 <= x <= 1200.00:
s = x * 1.10
r = s - x
p = 10
if 1200.01 <= x <= 2000.00:
s = x * 1.07
r = s - x
p = 7
if x > 2000.00:
s = x * 1.04
... | x = float(input())
if x <= 400.0:
s = x * 1.15
r = s - x
p = 15
if 400.01 <= x <= 800.0:
s = x * 1.12
r = s - x
p = 12
if 800.01 <= x <= 1200.0:
s = x * 1.1
r = s - x
p = 10
if 1200.01 <= x <= 2000.0:
s = x * 1.07
r = s - x
p = 7
if x > 2000.0:
s = x * 1.04
r = s ... |
for k in range(int(input())):
D1 = input()
D2, D3, D4, D5 = tuple(input().split())
D6 = input()
probs = 0
if D1 == '*' and D6 == '*': probs += 1
if D2 == '*' and D4 == '*': probs += 1
if D3 == '*' and D5 == '*': probs += 1
print(48 if probs == 3 else 8 if probs == 2 else 2 if probs ==... | for k in range(int(input())):
d1 = input()
(d2, d3, d4, d5) = tuple(input().split())
d6 = input()
probs = 0
if D1 == '*' and D6 == '*':
probs += 1
if D2 == '*' and D4 == '*':
probs += 1
if D3 == '*' and D5 == '*':
probs += 1
print(48 if probs == 3 else 8 if probs ... |
patches = [
# Remove attribute property EventIntegrationAssociation and Metadata
{
"op": "remove",
"path": "/PropertyTypes/AWS::AppIntegrations::EventIntegration.EventIntegrationAssociation",
},
{
"op": "remove",
"path": "/PropertyTypes/AWS::AppIntegrations::EventIntegrat... | patches = [{'op': 'remove', 'path': '/PropertyTypes/AWS::AppIntegrations::EventIntegration.EventIntegrationAssociation'}, {'op': 'remove', 'path': '/PropertyTypes/AWS::AppIntegrations::EventIntegration.Metadata'}] |
print ('\033[35m Bem vindo a calculadora do Luis \n')
n1 = int(input('\033[33m Digite um valor: '))
n2 = int(input('\033[34m Digite outro numero: '))
s = n1 + n2
#print('A soma vale:',s)
#print ('A soma entre ',n1,'e ',n2,' eh ',s)
print ('\033[31m A soma entre {} e {} vale {}'.format(n1,n2,s)) | print('\x1b[35m Bem vindo a calculadora do Luis \n')
n1 = int(input('\x1b[33m Digite um valor: '))
n2 = int(input('\x1b[34m Digite outro numero: '))
s = n1 + n2
print('\x1b[31m A soma entre {} e {} vale {}'.format(n1, n2, s)) |
def sum():
result = 21 + 14
print("Inside the function : ", result)
return result
total = sum()
print("Outside the function : ", total )
def print_info( name, age = 35 ):
print("Name: ", name)
print("Age ", age)
return
print_info( age=50, name="miki" )
print_info( name="miki" ) | def sum():
result = 21 + 14
print('Inside the function : ', result)
return result
total = sum()
print('Outside the function : ', total)
def print_info(name, age=35):
print('Name: ', name)
print('Age ', age)
return
print_info(age=50, name='miki')
print_info(name='miki') |
palavras = ('APRENDER', 'ESTUDAR', 'PROGRAMAR', 'AUTOMATIZAR', 'ANALISTA DE TESTES', 'PYTHON', 'ROBOT FRAMEWORK')
for c in palavras:
print(f'\nNa palavra {c.upper()} temos ',end='')
for vogal in c:
if vogal.lower() in 'aeiou':
print(vogal.lower(), end='') | palavras = ('APRENDER', 'ESTUDAR', 'PROGRAMAR', 'AUTOMATIZAR', 'ANALISTA DE TESTES', 'PYTHON', 'ROBOT FRAMEWORK')
for c in palavras:
print(f'\nNa palavra {c.upper()} temos ', end='')
for vogal in c:
if vogal.lower() in 'aeiou':
print(vogal.lower(), end='') |
russian_word_list = []
abkhazian_word_list = []
outputfile = 'ab-ru-probability.dic'
output = open(outputfile,"w+")
cyrillic_encoding="utf-8"
probability = 0.9
#read the russian word into the list
with open('../draft/dictionary_prescript.ru', 'r+',encoding=cyrillic_encoding) as f:
russian_word_list = f.read().spl... | russian_word_list = []
abkhazian_word_list = []
outputfile = 'ab-ru-probability.dic'
output = open(outputfile, 'w+')
cyrillic_encoding = 'utf-8'
probability = 0.9
with open('../draft/dictionary_prescript.ru', 'r+', encoding=cyrillic_encoding) as f:
russian_word_list = f.read().splitlines()
with open('../draft/dicti... |
num1 = 10
num2 = 3
result = num1 / num2
print(result)
# 10//3 # ==> 3
print(10//3); | num1 = 10
num2 = 3
result = num1 / num2
print(result)
print(10 // 3) |
ipDDN = "192.168.0.1"
octets = ipDDN.split(".")
#convert ddn to int
ip = int(octets[0]) << 24
ip += int(octets[1]) << 16
ip += int(octets[2]) << 8
ip += int(octets[3])
print(ip) | ip_ddn = '192.168.0.1'
octets = ipDDN.split('.')
ip = int(octets[0]) << 24
ip += int(octets[1]) << 16
ip += int(octets[2]) << 8
ip += int(octets[3])
print(ip) |
# Write a program to turn a number into its English name
# Assume that the number is positive below 1000
# for more info on this quiz, go to this url: http://www.programmr.com/word-representation-number
ones = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
teens = ["ten", "eleven", "... | ones = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
teens = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']
decade = ['', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']
def first(num... |
# https://www.codewars.com/kata/exclamation-marks-series-number-17-put-the-exclamation-marks-and-question-marks-to-the-balance-are-they-balanced/train/python
leftString = '!!'
rightString = '??'
def balance(left, right):
if ((left.count('!') * 2) + (left.count('?') * 3)) == ((right.count('!') * 2) + (right.count('... | left_string = '!!'
right_string = '??'
def balance(left, right):
if left.count('!') * 2 + left.count('?') * 3 == right.count('!') * 2 + right.count('?') * 3:
return 'Balance'
elif left.count('!') * 2 + left.count('?') * 3 > right.count('!') * 2 + right.count('?') * 3:
return 'Left'
elif lef... |
input_file = "" #file location
def print_all(f):
print(f.read())
def rewind(f):
f.seek(0)
def print_a_line(line_count, f):
print(line_count, f.readline())
current_file = open(input_file)
print("First let's print the whole file:\n")
print_all(current_file)
print("Now let's rewind, kid of like a tape.... | input_file = ''
def print_all(f):
print(f.read())
def rewind(f):
f.seek(0)
def print_a_line(line_count, f):
print(line_count, f.readline())
current_file = open(input_file)
print("First let's print the whole file:\n")
print_all(current_file)
print("Now let's rewind, kid of like a tape.")
rewind(current_fi... |
#!/usr/bin/env python3
# add one level of indentation to code
def indent(code):
return [ " " + l for l in code ]
# remove one level of indentation from code
def unindent(code):
cs = []
for l in code:
if l != "" and l[0:4] != " ":
print("Malformed conditional code '" + l[0:4] +"'"... | def indent(code):
return [' ' + l for l in code]
def unindent(code):
cs = []
for l in code:
if l != '' and l[0:4] != ' ':
print("Malformed conditional code '" + l[0:4] + "'")
assert False
cs.append(l[4:])
return cs
def demangle_execute_asl(code):
tops ... |
BATCH_SIZE = 64
EPOCHS = 100
IMG_WIDTH = 1801
IMG_HEIGHT = 32
NUM_CHANNELS = 3
NUM_CLASSES = 2
NUM_REGRESSION_OUTPUTS = 24
K_NEGATIVE_SAMPLE_RATIO_WEIGHT = 4
INPUT_SHAPE = (IMG_HEIGHT, IMG_WIDTH, NUM_CHANNELS)
PREDICTION_FILE_NAME = 'objects_obs1_lidar_predictions.csv'
PREDICTION_MD_FILE_NAME = 'objects_obs1_metadata.... | batch_size = 64
epochs = 100
img_width = 1801
img_height = 32
num_channels = 3
num_classes = 2
num_regression_outputs = 24
k_negative_sample_ratio_weight = 4
input_shape = (IMG_HEIGHT, IMG_WIDTH, NUM_CHANNELS)
prediction_file_name = 'objects_obs1_lidar_predictions.csv'
prediction_md_file_name = 'objects_obs1_metadata.c... |
class MinHeap:
def __init__(self, array):
# Do not edit the line below.
self.heap = self.buildHeap(array)
def buildHeap(self, array):
# Write your code here.
pass
def siftDown(self):
# Write your code here.
pass
def siftUp(self):
# Write your co... | class Minheap:
def __init__(self, array):
self.heap = self.buildHeap(array)
def build_heap(self, array):
pass
def sift_down(self):
pass
def sift_up(self):
pass
def peek(self):
pass
def remove(self):
pass
def insert(self, value):
... |
NAMES = ["Bill", "Richie", "Ben", "Eddie", "Mike", "Beverly"]
while True:
searched_name = input("Give a member of The Losers' Club: ")
if searched_name is "":
break
elif (searched_name in NAMES) is True:
print("Correct!")
else:
print("Wrong!")
| names = ['Bill', 'Richie', 'Ben', 'Eddie', 'Mike', 'Beverly']
while True:
searched_name = input("Give a member of The Losers' Club: ")
if searched_name is '':
break
elif (searched_name in NAMES) is True:
print('Correct!')
else:
print('Wrong!') |
# -*- coding: utf-8 -*-
# @Author: Mujib
# @Date: 2017-07-15 15:05:13
# @Last Modified by: Mujib
# @Last Modified time: 2017-07-15 15:20:03
actualString = 'Monster truck rally. 4pm. Monday'
print( 'This is upperCase >>> ' + actualString.upper() )
print( '---------------------------------------------' )
print( 'T... | actual_string = 'Monster truck rally. 4pm. Monday'
print('This is upperCase >>> ' + actualString.upper())
print('---------------------------------------------')
print('This is lowerCase >>> ' + actualString.lower())
print('---------------------------------------------')
print('Is string ends with ".jpg" >>> ')
print(ac... |
cffi_template = '''from cffi import FFI
def link_clib(block_cell_name):
ffi = FFI()
ffi.cdef(r\'\'\'{{headers}}\'\'\')
C = ffi.dlopen('{{dynlib_file}}')
return ffi, C
''' | cffi_template = "from cffi import FFI\ndef link_clib(block_cell_name):\n ffi = FFI()\n ffi.cdef(r'''{{headers}}''')\n C = ffi.dlopen('{{dynlib_file}}')\n return ffi, C\n" |
class Store:
def __init__(self, name, categories):
self.name = name
self.categories = categories
def __str__(self):
output = f"{self.name}\n"
for idx, category in enumerate(self.categories):
output += " " + str(idx+1) + ", " + category + "\n"
return ... | class Store:
def __init__(self, name, categories):
self.name = name
self.categories = categories
def __str__(self):
output = f'{self.name}\n'
for (idx, category) in enumerate(self.categories):
output += ' ' + str(idx + 1) + ', ' + category + '\n'
return outp... |
'''
Gui/Views/Dialogs
_________________
Subset of views that are specifically for QDialog and QMessageBox
classes.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
'''
__all__ = [
'base',
'export',
'f... | """
Gui/Views/Dialogs
_________________
Subset of views that are specifically for QDialog and QMessageBox
classes.
:copyright: (c) 2015 The Regents of the University of California.
:license: GNU GPL, see licenses/GNU GPLv3.txt for more details.
"""
__all__ = ['base', 'export', 'findreplace', '... |
_base_ = [
'../../_base_/models/tanet_r50.py', '../../_base_/default_runtime.py'
]
# dataset settings
dataset_type = 'VideoDataset'
data_root = '/home/petros/Datasets/hmdb51/videos'
data_root_val = '/home/petros/Datasets/hmdb51/videos'
ann_file_train = '/home/petros/Datasets/hmdb51/hmdb51_train_split_1_videos.txt'... | _base_ = ['../../_base_/models/tanet_r50.py', '../../_base_/default_runtime.py']
dataset_type = 'VideoDataset'
data_root = '/home/petros/Datasets/hmdb51/videos'
data_root_val = '/home/petros/Datasets/hmdb51/videos'
ann_file_train = '/home/petros/Datasets/hmdb51/hmdb51_train_split_1_videos.txt'
ann_file_val = '/home/pet... |
class Solution:
def search(self, nums, target):
low , high = 0 , len(nums)-1
while low <= high:
mid = low + (high-low) // 2 # if high is greater than low
if nums[mid] == target:
return mid
if nums[mid] > target: # if target is smaller ignore righ... | class Solution:
def search(self, nums, target):
(low, high) = (0, len(nums) - 1)
while low <= high:
mid = low + (high - low) // 2
if nums[mid] == target:
return mid
if nums[mid] > target:
high = mid - 1
else:
... |
# empt_dict = {'01': '31', '02': '29', '03': '31', '04': '30', '05': '31', '06': '30', '07': '31', '08': '31', '09': '30', '10': '31', '11': '30', '12': '31'}
# date = '06_04'
def get_last_seven(date_input):
dict_input = {'01': '31', '02': '29', '03': '31', '04': '30', '05': '31', '06': '30', '07': '31', '08': ... | def get_last_seven(date_input):
dict_input = {'01': '31', '02': '29', '03': '31', '04': '30', '05': '31', '06': '30', '07': '31', '08': '31', '09': '30', '10': '31', '11': '30', '12': '31'}
dates_to_grab = []
current_date = date_input.split('_')
month = current_date[0]
day = current_date[1]
mont... |
class Point():
def __init__(self, input1, input2):
self.x = input1
self.y = input2
p = Point(2, 8)
# PRINT THE X&Y-VALUES OF THE POINT
print(p.x)
print(p.y)
# CREATED A CLASS (Flight which takes capacity as input)
class FLight():
# FUNCTION FOR CAPACITY
def __init__(self, capacity):
... | class Point:
def __init__(self, input1, input2):
self.x = input1
self.y = input2
p = point(2, 8)
print(p.x)
print(p.y)
class Flight:
def __init__(self, capacity):
self.capacity = capacity
self.passengers = []
def add_passenger(self, name):
if not self.open_seats()... |
fact = 1
n = int(input('Enter the no you want to factorial \t'))
for i in range(1,n+1):
fact = fact*i
print('FACTORIAL Of ',n,"is",fact)
| fact = 1
n = int(input('Enter the no you want to factorial \t'))
for i in range(1, n + 1):
fact = fact * i
print('FACTORIAL Of ', n, 'is', fact) |
entries = [
{
'env-title': 'mujoco-half-cheetah',
'score': 1668.58,
},
{
'env-title': 'mujoco-hopper',
'score': 2316.16,
},
{
'env-title': 'mujoco-inverted-pendulum',
'score': 809.43,
},
{
'env-title': 'mujoco-swimmer',
'score':... | entries = [{'env-title': 'mujoco-half-cheetah', 'score': 1668.58}, {'env-title': 'mujoco-hopper', 'score': 2316.16}, {'env-title': 'mujoco-inverted-pendulum', 'score': 809.43}, {'env-title': 'mujoco-swimmer', 'score': 111.19}, {'env-title': 'mujoco-inverted-double-pendulum', 'score': 7102.91}, {'env-title': 'mujoco-rea... |
class Solution:
def isStable(self, board, numRows, numCols):
positions = set()
for row in range(numRows):
for col in range(numCols):
if board[row][col]:
if col > 1 and (board[row][col] == board[row][col-1] == board[row][col-2]):
... | class Solution:
def is_stable(self, board, numRows, numCols):
positions = set()
for row in range(numRows):
for col in range(numCols):
if board[row][col]:
if col > 1 and board[row][col] == board[row][col - 1] == board[row][col - 2]:
... |
s = 0
for x in range(1, 10+1):
s = s+x
print("x:", x, "sum:", s)
| s = 0
for x in range(1, 10 + 1):
s = s + x
print('x:', x, 'sum:', s) |
class Solution:
def findMaxForm(self, strs: List[str], m: int, n: int) -> int:
'''
T: O(len(strs) * m * n) and S: (m * n)
'''
dp = [[0 for _ in range(n+1)] for _ in range(m+1)]
for s in strs:
count = collections.Counter(s)
for i in range(m, co... | class Solution:
def find_max_form(self, strs: List[str], m: int, n: int) -> int:
"""
T: O(len(strs) * m * n) and S: (m * n)
"""
dp = [[0 for _ in range(n + 1)] for _ in range(m + 1)]
for s in strs:
count = collections.Counter(s)
for i in range(m, coun... |
expected_output={
'interfaces': {
'HundredGigE1/0/21': {
'neighbors': {
'3.3.3.3': {
'priority': 0,
'state': 'FULL/ -',
'dead_time': '00:00:35',
'interface_id': 23
}
}
}
}
}
| expected_output = {'interfaces': {'HundredGigE1/0/21': {'neighbors': {'3.3.3.3': {'priority': 0, 'state': 'FULL/ -', 'dead_time': '00:00:35', 'interface_id': 23}}}}} |
config = {
"cmip6": {
"base_dir": "/badc/cmip6/data/CMIP6",
"facets": "mip_era activity_id institution_id source_id experiment_id member_id table_id variable_id grid_label version".split(),
"scan_depth": 5,
"mappings": {"variable": "variable_id", "project": "mip_era"}
},
"cmi... | config = {'cmip6': {'base_dir': '/badc/cmip6/data/CMIP6', 'facets': 'mip_era activity_id institution_id source_id experiment_id member_id table_id variable_id grid_label version'.split(), 'scan_depth': 5, 'mappings': {'variable': 'variable_id', 'project': 'mip_era'}}, 'cmip5': {'base_dir': '/badc/cmip5/data/cmip5', 'fa... |
'''
Created on May 12, 2022
@author: mballance
'''
class PoolSize(object):
def __init__(self, sz):
self._sz = sz
def __int__(self):
return self._sz | """
Created on May 12, 2022
@author: mballance
"""
class Poolsize(object):
def __init__(self, sz):
self._sz = sz
def __int__(self):
return self._sz |
n = int(input())
for i in range (97 , 97 + n ):
for m in range (97, 97 + n):
for k in range (97, 97 + n):
print(chr(i) + chr(m) + chr(k)) | n = int(input())
for i in range(97, 97 + n):
for m in range(97, 97 + n):
for k in range(97, 97 + n):
print(chr(i) + chr(m) + chr(k)) |
def trainer(model, data):
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
(x, y) = data('train')
def result(epochs, batch_size):
model.fit(x, y, batch_size=batch_size, epochs=epochs, validation_split=0.1)
return model
return result
| def trainer(model, data):
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
(x, y) = data('train')
def result(epochs, batch_size):
model.fit(x, y, batch_size=batch_size, epochs=epochs, validation_split=0.1)
return model
return result |
# print([callable(getattr(__builtins__, attr)) for attr in dir(__builtins__)])
print([(attr,type(getattr(__builtins__, attr))) for attr in dir(__builtins__)])
# print 'hello'*100
| print([(attr, type(getattr(__builtins__, attr))) for attr in dir(__builtins__)]) |
#criar um programa que leia um valor em metros e o exiba convertido em centimetros e milimetros.
m = float(input('Digite um valor em metros: '))
km = m/1000
hm = m/100
dam= m/10
dm = m*10
cm = m*100
mm = m*1000
print("A medida de {} metros corresponde a {:.0f} dm, {:.0f} cm e {:.0f} mm".format(m, dm, cm, mm))
print... | m = float(input('Digite um valor em metros: '))
km = m / 1000
hm = m / 100
dam = m / 10
dm = m * 10
cm = m * 100
mm = m * 1000
print('A medida de {} metros corresponde a {:.0f} dm, {:.0f} cm e {:.0f} mm'.format(m, dm, cm, mm))
print('A medida de {} metros corresponde a {} km, {} hm e {} dam'.format(m, km, hm, dam)) |
_base_ = './cascade_rcnn_r50_fpn_20e_coco.py'
# The new config inherits a base config to highlight the necessary modification
_base_ = 'mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_coco.py'
# We also need to change the num_classes in head to match the dataset's annotation
model = dict(
roi_head=dict(
... | _base_ = './cascade_rcnn_r50_fpn_20e_coco.py'
_base_ = 'mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_coco.py'
model = dict(roi_head=dict(bbox_head=dict(num_classes=6), mask_head=dict(num_classes=6)))
dataset_type = 'COCODataset'
classes = ('badge', 'person', 'glove', 'wrongglove', 'operatingbar', 'powerchecker')
d... |
BASE_URL = 'http://api.statbank.dk/v1'
DELIMITER = ';'
DEFAULT_LANGUAGE = 'da'
LOCALES = {'da': 'en_DK.UTF-8',
'en': 'en_US.UTF-8'}
| base_url = 'http://api.statbank.dk/v1'
delimiter = ';'
default_language = 'da'
locales = {'da': 'en_DK.UTF-8', 'en': 'en_US.UTF-8'} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.