content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#Unique Nickname
while True:
online = input("Online now: ")
nickname = input("Nickname: ")
online_list = online.split(" ")
if nickname not in online_list:
print("Welcome, {}!".format(nickname))
else:
print("Sorry, that nickname is taken.")
| while True:
online = input('Online now: ')
nickname = input('Nickname: ')
online_list = online.split(' ')
if nickname not in online_list:
print('Welcome, {}!'.format(nickname))
else:
print('Sorry, that nickname is taken.') |
class Code:
SUCCESS = 0
NO_PARAM = 1
ERROR =-1
msg = {
SUCCESS: "success",
NO_PARAM: "param error",
ERROR:"error"
} | class Code:
success = 0
no_param = 1
error = -1
msg = {SUCCESS: 'success', NO_PARAM: 'param error', ERROR: 'error'} |
# DROP TABLES
songplay_table_drop = "DROP TABLE IF EXISTS f_songplays;"
user_table_drop = "DROP TABLE IF EXISTS d_users;"
song_table_drop = "DROP TABLE IF EXISTS d_songs;"
artist_table_drop = "DROP TABLE IF EXISTS d_artists;"
time_table_drop = "DROP TABLE IF EXISTS d_times;"
# CREATE TABLES
user_table_create = ("CRE... | songplay_table_drop = 'DROP TABLE IF EXISTS f_songplays;'
user_table_drop = 'DROP TABLE IF EXISTS d_users;'
song_table_drop = 'DROP TABLE IF EXISTS d_songs;'
artist_table_drop = 'DROP TABLE IF EXISTS d_artists;'
time_table_drop = 'DROP TABLE IF EXISTS d_times;'
user_table_create = 'CREATE TABLE IF NOT EXISTS d_users ... |
def insert_sort(unsorted):
sorted = []
while unsorted:
x = unsorted.pop()
len_sorted = len(sorted)
for i in range(len_sorted):
if sorted[i] >= x:
sorted.insert(i, x)
break
if len_sorted == len(sorted):
sorted.append(x)
... | def insert_sort(unsorted):
sorted = []
while unsorted:
x = unsorted.pop()
len_sorted = len(sorted)
for i in range(len_sorted):
if sorted[i] >= x:
sorted.insert(i, x)
break
if len_sorted == len(sorted):
sorted.append(x)
r... |
words = {}
first_line = input().split()
iterations = int(first_line[0])
for i in range(int(first_line[1])):
line = input().split()
words[int(line[0])] = line[1]
for n in range(1, iterations+1):
o = ""
for i, word in words.items():
if n % i == 0:
o += word
print(o if o else n)
| words = {}
first_line = input().split()
iterations = int(first_line[0])
for i in range(int(first_line[1])):
line = input().split()
words[int(line[0])] = line[1]
for n in range(1, iterations + 1):
o = ''
for (i, word) in words.items():
if n % i == 0:
o += word
print(o if o else n) |
class BackendError(Exception):
pass
class ThreadStoppedError(Exception):
pass
| class Backenderror(Exception):
pass
class Threadstoppederror(Exception):
pass |
class Solution:
def arrayStringsAreEqual(self, word1: List[str], word2: List[str]) -> bool:
s1 = "".join(word1)
s2 = "".join(word2)
return s1 == s2
| class Solution:
def array_strings_are_equal(self, word1: List[str], word2: List[str]) -> bool:
s1 = ''.join(word1)
s2 = ''.join(word2)
return s1 == s2 |
def matrix_sum(matrix):
total_sum = 0
for row in matrix:
total_sum += sum(row)
return total_sum
rows_count, columns_count = [int(x) for x in input().split(', ')]
matrix = []
for _ in range(rows_count):
row = [int(x) for x in input().split(', ')]
matrix.append(row)
print(matrix_sum(matrix... | def matrix_sum(matrix):
total_sum = 0
for row in matrix:
total_sum += sum(row)
return total_sum
(rows_count, columns_count) = [int(x) for x in input().split(', ')]
matrix = []
for _ in range(rows_count):
row = [int(x) for x in input().split(', ')]
matrix.append(row)
print(matrix_sum(matrix))... |
# generated from catkin/cmake/template/pkg.context.pc.in
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/home/graspinglab/carla-ros-bridge/Paresh-Soni-F110-2020/soni_f110_ws/src/f110-skeletons-spring2020/system/vesc/vesc_driver/include".split(';') if "/home/graspinglab/carla-ros-bridge/Paresh-Soni-F110-2... | catkin_package_prefix = ''
project_pkg_config_include_dirs = '/home/graspinglab/carla-ros-bridge/Paresh-Soni-F110-2020/soni_f110_ws/src/f110-skeletons-spring2020/system/vesc/vesc_driver/include'.split(';') if '/home/graspinglab/carla-ros-bridge/Paresh-Soni-F110-2020/soni_f110_ws/src/f110-skeletons-spring2020/system/ves... |
#!/usr/bin/python3
def multiple_returns(sentence):
"returns a tuple with the length of a string and its first character"
"if the sentence is empty, the first character should be equal to None"
if sentence == "":
return (0, None)
return (len(sentence), sentence[0])
| def multiple_returns(sentence):
"""returns a tuple with the length of a string and its first character"""
'if the sentence is empty, the first character should be equal to None'
if sentence == '':
return (0, None)
return (len(sentence), sentence[0]) |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vi: ts=4 sw=4
################################################################################
# Short-term settings (specific to a particular user/experiment) can
# be placed in this file. You may instead wish to make a copy of this file in
# the user's data directory, ... | if False:
m = 1000.0
cm = 10.0
mm = 1.0
um = 0.001
nm = 1e-06
inch = 25.4
pixel = 0.172
deg = 1.0
rad = np.degrees(1.0)
mrad = np.degrees(0.001)
urad = np.degrees(1e-06)
def get_default_stage():
return stg
class Sampletsaxs(SampleTSAXS_Generic):
def __init__(self, ... |
# -*- coding: utf-8 -*-
n = 0
a = 0
g = 0
d = 0
while n!=4:
n = int(input())
if n==1:
a += 1
if n==2:
g += 1
if n==3:
d += 1
print('''MUITO OBRIGADO
Alcool: {}
Gasolina: {}
Diesel: {}'''.format(a, g, d))
| n = 0
a = 0
g = 0
d = 0
while n != 4:
n = int(input())
if n == 1:
a += 1
if n == 2:
g += 1
if n == 3:
d += 1
print('MUITO OBRIGADO\nAlcool: {}\nGasolina: {}\nDiesel: {}'.format(a, g, d)) |
class TableNotFoundException(Exception):
def __init__(self, database, table):
self.database = database
self.table = table
Exception.__init__(self, "table not find %s.%s" % (database, table))
| class Tablenotfoundexception(Exception):
def __init__(self, database, table):
self.database = database
self.table = table
Exception.__init__(self, 'table not find %s.%s' % (database, table)) |
# CALCULATE CANADIAN SALES TAX
# If the province is Alberta or Nunavut charge 5%
# If the province is Ontario charge 13%
# If only one of the conditions will ever occur you can use a single if statement with elif
province = input("What province do you live in? ")
tax = 0
if province == 'Alberta':
tax = 0.05
elif... | province = input('What province do you live in? ')
tax = 0
if province == 'Alberta':
tax = 0.05
elif province == 'Nunavut':
tax = 0.05
elif province == 'Ontario':
tax = 0.13
print(tax)
province = input('What province do you live in? ')
tax = 0
if province == 'Alberta':
tax = 0.05
elif province == 'Nunav... |
#!/usr/bin/env python
#coding=utf-8
__author__ = 'vzer'
class Base_Config(object):
#app config
SECRET_KEY=""
POST_PRE_PAGE=6
REGISTERCODE=""
DEBUG = True
#mysql config
MYSQL_DB = ""
MYSQL_USER = ""
MYSQL_PASS = ""
MYSQL_HOST = ""
MYSQL_PORT =0
SQLALCHEMY_DATABASE_URI =... | __author__ = 'vzer'
class Base_Config(object):
secret_key = ''
post_pre_page = 6
registercode = ''
debug = True
mysql_db = ''
mysql_user = ''
mysql_pass = ''
mysql_host = ''
mysql_port = 0
sqlalchemy_database_uri = 'mysql://%s:%s@%s:%s/%s' % (MYSQL_USER, MYSQL_PASS, MYSQL_HOST, ... |
ES_HOST = 'localhost:9200'
ES_INDEX = 'pending-upheno_ontology'
ES_DOC_TYPE = 'phenotype'
API_PREFIX = 'upheno_ontology'
API_VERSION = ''
| es_host = 'localhost:9200'
es_index = 'pending-upheno_ontology'
es_doc_type = 'phenotype'
api_prefix = 'upheno_ontology'
api_version = '' |
servo_a_pw = [[-90.0, 2463]
[-86.4, 2423]
[-72.0, 2263]
[-56.6, 2093]
[-43.2, 2013]
[-28.8, 1793]
[-14.4, 1646]
[0.0, 1436]
[14.4, 1276]
[28.8, 1096]
[43.2, 916]
[56.... | servo_a_pw = [[-90.0, 2463][-86.4, 2423][-72.0, 2263][-56.6, 2093][-43.2, 2013][-28.8, 1793][-14.4, 1646][0.0, 1436][14.4, 1276][28.8, 1096][43.2, 916][56.6, 746][72.0, 586][72.0, 590][90.0, 390]] |
#!/usr/bin/python3
#https://practice.geeksforgeeks.org/problems/a-simple-fraction/0
def sol(n, d):
res = []
r = {}
i = int(n/d)
rem = n%d
res.append(i)
if rem:
res.append(".")
r[rem] = 0
p = 1
while rem:
div = rem*10
q = div//d
rem = div%d
... | def sol(n, d):
res = []
r = {}
i = int(n / d)
rem = n % d
res.append(i)
if rem:
res.append('.')
r[rem] = 0
p = 1
while rem:
div = rem * 10
q = div // d
rem = div % d
res.append(q)
if rem in r:
res.append(')')
... |
class Solution:
def validMountainArray(self, arr: List[int]) -> bool:
if len(arr) < 3:
return False
if arr[1] < arr[0]:
return False
n = len(arr)
i = 1
while i < n and arr[i] > arr[i-1]:
i += 1
if i >= n:
return False
... | class Solution:
def valid_mountain_array(self, arr: List[int]) -> bool:
if len(arr) < 3:
return False
if arr[1] < arr[0]:
return False
n = len(arr)
i = 1
while i < n and arr[i] > arr[i - 1]:
i += 1
if i >= n:
return Fal... |
'''
Create the Control class:
Deal with hazards
Forwarding
Branch handling
'''
class Control(object):
def __init__(self, ForwardStatus):
self.DataHazardFlag=False
self.ControlHazardFlag=False
self.forwardFlag=ForwardStatus
'''
Forward keys:
0: Inactive
1: Execution forward
... | """
Create the Control class:
Deal with hazards
Forwarding
Branch handling
"""
class Control(object):
def __init__(self, ForwardStatus):
self.DataHazardFlag = False
self.ControlHazardFlag = False
self.forwardFlag = ForwardStatus
'\n Forward keys:\n 0: Inactive\n 1: Execution f... |
l = ["he", "hi", "hello", "hi"]
r = [k for k in l if 'gene' in k or 'dis' in k]
print(r)
with open('project2_test.txt', 'r') as f:
prefix = 'gene'
for line in f:
r = filter(lambda x: x.startswith(prefix), list(line.split()))
print(list(r))
| l = ['he', 'hi', 'hello', 'hi']
r = [k for k in l if 'gene' in k or 'dis' in k]
print(r)
with open('project2_test.txt', 'r') as f:
prefix = 'gene'
for line in f:
r = filter(lambda x: x.startswith(prefix), list(line.split()))
print(list(r)) |
# Author: Asif Ali Mehmuda
# Email: asif.mehmuda9@gmail.com
# This file exposes some of the common mathematical functions
def add_nums(num1, num2):
return num1 + num2
# Subtract two numbers
def sub_nums(num1, num2):
return num1 - num2
# Subtract two numbers such that the smaller number is always subtracted... | def add_nums(num1, num2):
return num1 + num2
def sub_nums(num1, num2):
return num1 - num2
def abs_diff(num1, num2):
if num1 < num2:
(num1, num2) = (num2, num1)
return num1 - num2 |
count = 1
while True:
a = input()
if a == '0':
break
if count > 1:
print()
numbers = input()
print("Instancia", count)
if a in numbers:
print("verdadeira")
else:
print("falsa")
count += 1 | count = 1
while True:
a = input()
if a == '0':
break
if count > 1:
print()
numbers = input()
print('Instancia', count)
if a in numbers:
print('verdadeira')
else:
print('falsa')
count += 1 |
string = "Janet Asimov"
pattern = re.compile(r"(?<!Isaac )Asimov") # Will match any Asimov except Isaac, and only keep "Asimov"
result = re.search(pattern, string)
if result is not None:
print("Substring '{0}' was found in the range {1}".format(result.group(), result.span())) | string = 'Janet Asimov'
pattern = re.compile('(?<!Isaac )Asimov')
result = re.search(pattern, string)
if result is not None:
print("Substring '{0}' was found in the range {1}".format(result.group(), result.span())) |
#
# PySNMP MIB module RM2-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RM2-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:49:40 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15)... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, single_value_constraint, value_size_constraint, constraints_intersection) ... |
nk=list(map(int,input().split()))
n=nk[0]
k=nk[1]
l=list(map(int,input().split()))
f=0
for i in range(len(l)-1):
if(l[i]+l[i+1]==k):
print('yes')
f=1
break
if(f==0):
print('no')
| nk = list(map(int, input().split()))
n = nk[0]
k = nk[1]
l = list(map(int, input().split()))
f = 0
for i in range(len(l) - 1):
if l[i] + l[i + 1] == k:
print('yes')
f = 1
break
if f == 0:
print('no') |
class Point():
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return f"({self.x}, {self.y})"
class Edge():
def __init__(self, v1, v2):
self.v1 = v1
self.v2 = v2
def __repr__(self):
return f"{self.v1}-{self.v2}"
def ... | class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __repr__(self):
return f'({self.x}, {self.y})'
class Edge:
def __init__(self, v1, v2):
self.v1 = v1
self.v2 = v2
def __repr__(self):
return f'{self.v1}-{self.v2}'
def point_x(point):
... |
# -*- coding: utf-8 -*-
class Route(object):
def __init__(self, base_url=None):
self.base_url = base_url
self.handlers = []
def __call__(self, url, **kwds):
name = kwds.pop('name', None)
if self.base_url:
url = '/' + self.base_url.strip('/') + '/' + url.lstrip('/')... | class Route(object):
def __init__(self, base_url=None):
self.base_url = base_url
self.handlers = []
def __call__(self, url, **kwds):
name = kwds.pop('name', None)
if self.base_url:
url = '/' + self.base_url.strip('/') + '/' + url.lstrip('/')
def _(cls):
... |
class Solution:
def groupThePeople(self, groupSizes):
match = {}
for idx, groupSize in enumerate(groupSizes):
if groupSize in match:
match[groupSize].append(idx)
else:
match[groupSize] = [idx]
ans = []
for groupSize, m in match... | class Solution:
def group_the_people(self, groupSizes):
match = {}
for (idx, group_size) in enumerate(groupSizes):
if groupSize in match:
match[groupSize].append(idx)
else:
match[groupSize] = [idx]
ans = []
for (group_size, m) ... |
def to_postfix(infix):
priority = {'*': 1,
'/': 1,
'^': 1,
'+': 0,
'-': 0,
'(': 0
}
res = ''
stack = []
for x in infix:
if x.isdigit():
res += x
elif x == '(':
stack.a... | def to_postfix(infix):
priority = {'*': 1, '/': 1, '^': 1, '+': 0, '-': 0, '(': 0}
res = ''
stack = []
for x in infix:
if x.isdigit():
res += x
elif x == '(':
stack.append(x)
elif x in '*/^+-':
if not stack or stack[-1] == '(':
... |
# A list is symmetric if the first row is the same as the first column,
# the second row is the same as the second column and so on. Write a
# procedure, symmetric, which takes a list as input, and returns the
# boolean True if the list is symmetric and False if it is not.
def symmetric(base_list):
list_length = l... | def symmetric(base_list):
list_length = len(base_list)
for row in base_list:
if len(row) != list_length:
return False
for i in range(list_length):
for j in range(list_length):
if base_list[i][j] != base_list[j][i]:
return False
return True
print(sy... |
f = open("C:/Users/Username/Documents/2020_aoc/03.txt", "r")
l = f.read().split("\n")
grid = []
for line in l:
grid.append(line*200)
def slope_change(right_inc, down_inc):
hor = ver = found = 0
while ver + down_inc < len(grid):
hor += right_inc
ver += down_inc
if gr... | f = open('C:/Users/Username/Documents/2020_aoc/03.txt', 'r')
l = f.read().split('\n')
grid = []
for line in l:
grid.append(line * 200)
def slope_change(right_inc, down_inc):
hor = ver = found = 0
while ver + down_inc < len(grid):
hor += right_inc
ver += down_inc
if grid[ver][hor] ==... |
class BaseIOException(Exception):
pass
class InvalidFitFile(BaseIOException):
pass
| class Baseioexception(Exception):
pass
class Invalidfitfile(BaseIOException):
pass |
#Lucia Saura 25/03/2018
# euler 5
# source https://www.youtube.com/watch?v=EMTcsNMFS_g
def euler5 (ni): #first create a function
for i in range (11,21): #loop trough the numbers from 11 to 21 (if it is divisible by 11 to 20 is also from 1 to 10)
if ni % i ==0: #if the number is divisible by the number in ... | def euler5(ni):
for i in range(11, 21):
if ni % i == 0:
continue
else:
return False
return True
x = 2520
while not euler5(x):
x += 2520
print(x) |
def divisors(integer):
integer = abs(integer)
divisor = []
for candidate in range(integer//2):
if integer % (candidate+1) == 0:
divisor.append(candidate+1)
return divisor
alist = divisors(10)
print(alist) | def divisors(integer):
integer = abs(integer)
divisor = []
for candidate in range(integer // 2):
if integer % (candidate + 1) == 0:
divisor.append(candidate + 1)
return divisor
alist = divisors(10)
print(alist) |
class GenericTurbine(object):
def __init__(self, loc, RD, W):
self.loc = loc # Location in Space
self.RD = RD # Rotor Diameter
self.W = W # Width of influence | class Genericturbine(object):
def __init__(self, loc, RD, W):
self.loc = loc
self.RD = RD
self.W = W |
#
# PySNMP MIB module IBM-OSA-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/IBM-OSA-MIB
# Produced by pysmi-0.3.4 at Wed May 1 13:51:11 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar 27 2019, 0... | (object_identifier, integer, octet_string) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'Integer', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_range_constraint, value_size_constraint, constraints_union, constraints_intersection) ... |
def diff_strings_rec(source, target, dp={}):
dp_key = (source, target)
if dp_key in dp:
return dp[dp_key]
if not source and not target:
result = []
dp[dp_key] = (0, result)
return dp[dp_key]
if not source:
result = ["+" + ch for ch in target]
dp[dp_key] = ... | def diff_strings_rec(source, target, dp={}):
dp_key = (source, target)
if dp_key in dp:
return dp[dp_key]
if not source and (not target):
result = []
dp[dp_key] = (0, result)
return dp[dp_key]
if not source:
result = ['+' + ch for ch in target]
dp[dp_key] ... |
# Using list to print hello world
my_list = ["H", "e", "l", "l", "o", " ", "W", "o", "r", "l", "d"]
s = ""
for i in my_list:
s = s + i
print(s)
| my_list = ['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd']
s = ''
for i in my_list:
s = s + i
print(s) |
# EASY
# Two pointer
# --> if < tar
# <-- if > tar
# Time O(N) Space O(1)
class Solution:
def twoSum(self, numbers: List[int], target: int) -> List[int]:
left,right = 0, len(numbers)-1
while left < right:
if numbers[left] + numbers[right] == target:
return [... | class Solution:
def two_sum(self, numbers: List[int], target: int) -> List[int]:
(left, right) = (0, len(numbers) - 1)
while left < right:
if numbers[left] + numbers[right] == target:
return [left + 1, right + 1]
elif numbers[left] + numbers[right] < target:
... |
#Polimorfismo
# #Es la capacidad que tienen los objetos en
# #diferentes clases para usar un comportamiento
# #o atributo del mismo nombre pero con diferente valor
#
# # Por ejemplo
#class Auto:
# rueda = 4
# def desplazamiento(self):
# print("el auto se esta desplazando sobre 4 ruegas")
#
#class Moto:
# ... | class Animales:
def __init__(self, nombre):
self.nombre = nombre
def tipo_animal(self):
pass
class Leon(Animales):
def tipo_animal(self):
print('animal salvaje')
class Perro(Animales):
def tipo_animal(self):
print('animal domestico')
nuevo_animal = leon('Simba')
nue... |
rows_total = 0
rows_masked = 0
ret = 0
profileret = 0
| rows_total = 0
rows_masked = 0
ret = 0
profileret = 0 |
class Dicotomia():
def __init__(self, tabla) -> None:
self.fin = len(tabla) - 1
self.tabla = tabla
self.tablaordenada =[]
def bubbleSort(self):
for i in range(0, self.fin):
for j in range(0, self.fin - i):
if self.tabla[j] > self.tabla[j + 1]:
... | class Dicotomia:
def __init__(self, tabla) -> None:
self.fin = len(tabla) - 1
self.tabla = tabla
self.tablaordenada = []
def bubble_sort(self):
for i in range(0, self.fin):
for j in range(0, self.fin - i):
if self.tabla[j] > self.tabla[j + 1]:
... |
s = "12010000000000111100000000"
for _ in range(int(input())):
ans = 0
k = input()
for i in k:
if i != " ":
ans += int(s[ord(i) - 65])
print(ans) | s = '12010000000000111100000000'
for _ in range(int(input())):
ans = 0
k = input()
for i in k:
if i != ' ':
ans += int(s[ord(i) - 65])
print(ans) |
def init_dashboard(bot):
@bot.dashboard.route
async def get_stats(data):
channels_list = []
for guild in bot.guilds:
for channel in guild.channels:
channels_list.append(channel)
return {
"status": "200",
"message": "all is ok",
... | def init_dashboard(bot):
@bot.dashboard.route
async def get_stats(data):
channels_list = []
for guild in bot.guilds:
for channel in guild.channels:
channels_list.append(channel)
return {'status': '200', 'message': 'all is ok', 'guilds': str(len(bot.guilds)), ... |
n = int(input().strip())
scores = [int(scores_temp) for scores_temp in input().strip().split(' ')]
m = int(input().strip())
alice = [int(alice_temp) for alice_temp in input().strip().split(' ')]
ranking = [scores[0]]
for itm in scores:
if itm != ranking[-1]:
ranking.append(itm)
inx = len(ranking) - 1
fo... | n = int(input().strip())
scores = [int(scores_temp) for scores_temp in input().strip().split(' ')]
m = int(input().strip())
alice = [int(alice_temp) for alice_temp in input().strip().split(' ')]
ranking = [scores[0]]
for itm in scores:
if itm != ranking[-1]:
ranking.append(itm)
inx = len(ranking) - 1
for it... |
def RemovesNthDupicate(array, n):
hashTable = {}
i = 0
while i < len(array):
if array[i] in hashTable:
hashTable[array[i]] += 1
if hashTable[array[i]] == n:
hashTable[array[i]] = 1
array.pop(i)
else:
... | def removes_nth_dupicate(array, n):
hash_table = {}
i = 0
while i < len(array):
if array[i] in hashTable:
hashTable[array[i]] += 1
if hashTable[array[i]] == n:
hashTable[array[i]] = 1
array.pop(i)
else:
hashTable[array[i]] =... |
# Limbs
LEG_UPPER_RIGHT = (24,26)
LEG_LOWER_RIGHT = (26,28)
UPPER_BODY_RIGHT = (12,24)
ARM_UPPER_RIGHT = (12,14)
ARM_LOWER_RIGHT = (14,16)
FOOT_RIGHT = (28,32)
LIMBS_ALL = [LEG_UPPER_RIGHT,UPPER_BODY_RIGHT,ARM_UPPER_RIGHT,ARM_LOWER_RIGHT,FOOT_RIGHT]
# Joints
ANKLE_RIGHT = (26,28,32)
ELBOW_RIGHT = (12,14,16)
SHOULDER... | leg_upper_right = (24, 26)
leg_lower_right = (26, 28)
upper_body_right = (12, 24)
arm_upper_right = (12, 14)
arm_lower_right = (14, 16)
foot_right = (28, 32)
limbs_all = [LEG_UPPER_RIGHT, UPPER_BODY_RIGHT, ARM_UPPER_RIGHT, ARM_LOWER_RIGHT, FOOT_RIGHT]
ankle_right = (26, 28, 32)
elbow_right = (12, 14, 16)
shoulder_right... |
#
# PySNMP MIB module CISCO-SYS-INFO-LOG-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CISCO-SYS-INFO-LOG-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 17:57:12 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (d... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, value_range_constraint, value_size_constraint, single_value_constraint, constraints_intersection) ... |
#
# PySNMP MIB module HUAWEI-SERVER-IBMC-MIB (http://pysnmp.sf.net)
# ASN.1 source file:///home/jhzhang/test/snmp/HUAWEI-SERVER-iBMC-MIB.txt
# Produced by pysmi-0.0.7 at Mon Apr 3 12:24:09 2017
# On host localhost.localdomain platform Linux version 3.10.0-123.el7.x86_64 by user root
# Using Python version 2.7.5 (defau... | (integer, object_identifier, octet_string) = mibBuilder.importSymbols('ASN1', 'Integer', 'ObjectIdentifier', 'OctetString')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_union, single_value_constraint, constraints_intersection, value_size_constraint, value_range_constraint) ... |
n,m = list(map(int,input().split()))
cost = list(map(int,input().split()))
ans=0
for i in range(m):
f,s = list(map(int,input().split()))
ans += min(cost[f-1],cost[s-1])
print(ans) | (n, m) = list(map(int, input().split()))
cost = list(map(int, input().split()))
ans = 0
for i in range(m):
(f, s) = list(map(int, input().split()))
ans += min(cost[f - 1], cost[s - 1])
print(ans) |
'''
| Write a program to show if the entered character is uppercase or lowercase. |
|---------------------------------------------------------------------------------------------|
| Usage of isalpha(), islower() and isupper() |
'''
n = input("Enter charac... | """
| Write a program to show if the entered character is uppercase or lowercase. |
|---------------------------------------------------------------------------------------------|
| Usage of isalpha(), islower() and isupper() |
"""
n = input('Enter charact... |
# Program 8 : multiply two matrices
# take a 3x3 matrix
A = [[12, 7, 3],
[4, 5, 6],
[7, 8, 9]]
# take a 3x4 matrix
B = [[5, 8, 1, 2],
[6, 7, 3, 0],
[4, 5, 9, 1]]
result = [[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]]
# iterating by row of A
for i in range(len(A)):
# iterating by coloum by B
for j in rang... | a = [[12, 7, 3], [4, 5, 6], [7, 8, 9]]
b = [[5, 8, 1, 2], [6, 7, 3, 0], [4, 5, 9, 1]]
result = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
for i in range(len(A)):
for j in range(len(B[0])):
for k in range(len(B)):
result[i][j] += A[i][k] * B[k][j]
for r in result:
print(r) |
API_SECRET = 'fluffernutterpie'
# google reCAPTCHA sign-up
# https://www.google.com/recaptcha/admin
RECAPTCHA_KEY = '6LedVBUUAAAAANb2vWVUSByvl66ob3k9r-zSruCu'
RECAPTCHA_PRIVATE_KEY = '6LedVBUUAAAAALWe4MQ2VJQhI9rKi6GJTukS6Hrl'
| api_secret = 'fluffernutterpie'
recaptcha_key = '6LedVBUUAAAAANb2vWVUSByvl66ob3k9r-zSruCu'
recaptcha_private_key = '6LedVBUUAAAAALWe4MQ2VJQhI9rKi6GJTukS6Hrl' |
list1 = [12,3,5,-5,-6,-1]
for i in list1:
if i >= 0:
print (i)
list2 = [12,4,-95,3]
for num in list2:
if num >= 0:
print (" [ ",num," ] ")
| list1 = [12, 3, 5, -5, -6, -1]
for i in list1:
if i >= 0:
print(i)
list2 = [12, 4, -95, 3]
for num in list2:
if num >= 0:
print(' [ ', num, ' ] ') |
class Point:
def __init__(self, x, y):
self.x = float(x)
self.y = float(y)
def collinear(self, p, q):
if p.x - self.x == 0 and q.x - self.x == 0:
return True
if p.x - self.x == 0 or q.x - self.x == 0:
return False
m1 = (p.y-self.y)/(p.x-self.x)
m2 = (q.y-self.y)/(q.x-self.x)
return m1 == m2
... | class Point:
def __init__(self, x, y):
self.x = float(x)
self.y = float(y)
def collinear(self, p, q):
if p.x - self.x == 0 and q.x - self.x == 0:
return True
if p.x - self.x == 0 or q.x - self.x == 0:
return False
m1 = (p.y - self.y) / (p.x - sel... |
bash('''
echo "hello"
''')
bash('''
for i in $(seq 1 10);
do
echo $i
sleep 2
done
''')
| bash('\n\n\necho "hello"\n\n')
bash('\nfor i in $(seq 1 10);\ndo\n echo $i\n sleep 2\ndone\n') |
# This script generates a theorem for them Z3 SAT solver. The output of this program
# is designed to be the input for http://rise4fun.com/z3
# The output of z3 is the coordinates of the queens for a solution to the N Queen problem :)
#Prints an assert statement
def zassert(x):
print("( assert ( {} ) )".format(x)... | def zassert(x):
print('( assert ( {} ) )'.format(x))
def zdeclare(x, type='Int'):
print('( declare-const {} {} )'.format(x, type))
def generate(N, G):
zdeclare('N')
zdeclare('G')
zassert('= N {}'.format(N))
zassert('= G {}'.format(G))
queens_x = ['P{}_x'.format(n) for n in range(0, N)]
... |
# cook your dish here
try:
t = int(input())
for _ in range(t):
r, c, k = map(int, input().rstrip().split(' '))
if r <= k:
start_row = 1
else:
start_row = r-k
if c <= k:
start_col = 1
else:
start_col = c-k
if r+k >= 8... | try:
t = int(input())
for _ in range(t):
(r, c, k) = map(int, input().rstrip().split(' '))
if r <= k:
start_row = 1
else:
start_row = r - k
if c <= k:
start_col = 1
else:
start_col = c - k
if r + k >= 8:
... |
'''Defines data and parameters in an easily resuable format.'''
# Common sequence alphabets.
ALPHABETS = {
'dna': 'ATGCNatgcn-',
'rna': 'AUGCNaugcn',
'peptide': 'ACDEFGHIKLMNPQRSTVWYXacdefghiklmnpqrstvwyx'}
COMPLEMENTS = {
'dna': {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G', 'N': 'N', 'a': 't',
... | """Defines data and parameters in an easily resuable format."""
alphabets = {'dna': 'ATGCNatgcn-', 'rna': 'AUGCNaugcn', 'peptide': 'ACDEFGHIKLMNPQRSTVWYXacdefghiklmnpqrstvwyx'}
complements = {'dna': {'A': 'T', 'T': 'A', 'G': 'C', 'C': 'G', 'N': 'N', 'a': 't', 't': 'a', 'g': 'c', 'c': 'g', 'n': 'n', '-': '-'}, 'rna': {'... |
# Created by MechAviv
# White Heaven Sun Damage Skin | (2433828)
if sm.addDamageSkin(2433828):
sm.chat("'White Heaven Sun Damage Skin' Damage Skin has been added to your account's damage skin collection.")
sm.consumeItem() | if sm.addDamageSkin(2433828):
sm.chat("'White Heaven Sun Damage Skin' Damage Skin has been added to your account's damage skin collection.")
sm.consumeItem() |
def expose(board, x, y):
if not board[y][x].flagged:
board[y][x].exposed = True
#debug print(x, y, sep='\t')
if x == 0 or x == len(board[0]) - 1 or y == 0 or y == len(board) - 1 or board[y][x].mine:
return 0
if board[y][x].neighbours == 0:
if board[y-1][x-1].exposed is Fals... | def expose(board, x, y):
if not board[y][x].flagged:
board[y][x].exposed = True
if x == 0 or x == len(board[0]) - 1 or y == 0 or (y == len(board) - 1) or board[y][x].mine:
return 0
if board[y][x].neighbours == 0:
if board[y - 1][x - 1].exposed is False:
expose(board, x - ... |
number = 5
numbers = [1,2,3,4,5]
# if statement
if number == 5:
print(number)
if len(numbers) == 5:
print(numbers[3])
if number in numbers: # if 3 in [1,2,3,4,5]
print("3 is here")
# elif and else statement
if number == 3:
print("is 3")
elif number == 5:
print("is 5")
else:
print("not 3 & 5... | number = 5
numbers = [1, 2, 3, 4, 5]
if number == 5:
print(number)
if len(numbers) == 5:
print(numbers[3])
if number in numbers:
print('3 is here')
if number == 3:
print('is 3')
elif number == 5:
print('is 5')
else:
print('not 3 & 5') |
memo = {
0: 0,
1: 1,
2: 1,
}
def fib(n):
if n in memo:
return memo[n]
val = fib(n-1) + fib(n-2)
memo[n] = val
return val
print(fib(35))
| memo = {0: 0, 1: 1, 2: 1}
def fib(n):
if n in memo:
return memo[n]
val = fib(n - 1) + fib(n - 2)
memo[n] = val
return val
print(fib(35)) |
# coding: utf-8
__version__ = '0.12.0'
| __version__ = '0.12.0' |
# -*- coding: utf-8 -*-
# Caching
# https://docs.djangoproject.com/en/3.2/topics/cache/
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'unique-snowflake',
},
'staticfiles': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache... | caches = {'default': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'unique-snowflake'}, 'staticfiles': {'BACKEND': 'django.core.cache.backends.locmem.LocMemCache', 'LOCATION': 'unique-snowflake'}} |
x, a, b = map(int, input().split())
if b <= a:
print('delicious')
elif b - a <= x:
print('safe')
else:
print('dangerous')
| (x, a, b) = map(int, input().split())
if b <= a:
print('delicious')
elif b - a <= x:
print('safe')
else:
print('dangerous') |
class Args(object):
def __init__(self):
self.seed = 0
self.experiment = None
self.network = None
self.approach = None
self.parameter = []
self.taskcla = None
self.comment = None
self.log_dir = None
global args
args = Args()
| class Args(object):
def __init__(self):
self.seed = 0
self.experiment = None
self.network = None
self.approach = None
self.parameter = []
self.taskcla = None
self.comment = None
self.log_dir = None
global args
args = args() |
list1=[12,-7,5,64,-14]
for num in list1:
if num>=0:
print(num,end=" ")
list2=[12,14,-95,3]
for num in list2:
if num>=0:
print(num,end=" ")
| list1 = [12, -7, 5, 64, -14]
for num in list1:
if num >= 0:
print(num, end=' ')
list2 = [12, 14, -95, 3]
for num in list2:
if num >= 0:
print(num, end=' ') |
#Three character NHGIS codes to postal abbreviations
state_codes = {
'530':'WA',
'100':'DE',
'110':'DC',
'550':'WI',
'540':'WV',
'150':'HI',
'120':'FL',
'560':'WY',
'720':'PR',
'340':'NJ',
'350':'NM',
'480':'TX',
'220':'LA',
'370':'NC',
'380':'ND',
'310':'NE',
'470':'TN',
'360':'NY',
'420':'PA',
'02... | state_codes = {'530': 'WA', '100': 'DE', '110': 'DC', '550': 'WI', '540': 'WV', '150': 'HI', '120': 'FL', '560': 'WY', '720': 'PR', '340': 'NJ', '350': 'NM', '480': 'TX', '220': 'LA', '370': 'NC', '380': 'ND', '310': 'NE', '470': 'TN', '360': 'NY', '420': 'PA', '020': 'AK', '320': 'NV', '330': 'NH', '510': 'VA', '080':... |
def uniquePaths(m: int, n: int) -> int:
dp = [[0 for _ in range(m)] for _ in range(n)]
for i in range(m):
dp[0][i] = 1
for j in range(n):
dp[j][0] = 1
for i in range(1, n):
for j in range(1, m):
dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
return... | def unique_paths(m: int, n: int) -> int:
dp = [[0 for _ in range(m)] for _ in range(n)]
for i in range(m):
dp[0][i] = 1
for j in range(n):
dp[j][0] = 1
for i in range(1, n):
for j in range(1, m):
dp[i][j] = dp[i - 1][j] + dp[i][j - 1]
return dp[-1][-1]
if __name__... |
if __name__ == "__main__":
base_path = "/data4/dheeraj/hashtag/all/Twitter/"
f_tweets = open(base_path + "train_post.txt", "r")
f_tags = open(base_path + "train_tag.txt", "r")
tweets = f_tweets.readlines()
tags = f_tags.readlines()
f_tags.close()
f_tweets.close()
tweets = tweets[:100]
... | if __name__ == '__main__':
base_path = '/data4/dheeraj/hashtag/all/Twitter/'
f_tweets = open(base_path + 'train_post.txt', 'r')
f_tags = open(base_path + 'train_tag.txt', 'r')
tweets = f_tweets.readlines()
tags = f_tags.readlines()
f_tags.close()
f_tweets.close()
tweets = tweets[:100]
... |
#
# PySNMP MIB module IPMROUTE-STD-MIB (http://pysnmp.sf.net)
# ASN.1 source http://mibs.snmplabs.com:80/asn1/IPMROUTE-STD-MIB
# Produced by pysmi-0.0.7 at Sun Feb 14 00:18:06 2016
# On host bldfarm platform Linux version 4.1.13-100.fc21.x86_64 by user goose
# Using Python version 3.5.0 (default, Jan 5 2016, 17:11:52)... | (octet_string, integer, object_identifier) = mibBuilder.importSymbols('ASN1', 'OctetString', 'Integer', 'ObjectIdentifier')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(value_size_constraint, value_range_constraint, single_value_constraint, constraints_union, constraints_intersection) ... |
# Problem 4: Dutch National Flag Problem
def sort_zero_one_two(input_list):
# We define 4 variables for the low, middle, high, and temporary values
lo_end = 0
hi_end = len(input_list) - 1
mid = 0
tmp = None
if len(input_list) <= 0 or input_list[mid] < 0:
return "The list is either empty... | def sort_zero_one_two(input_list):
lo_end = 0
hi_end = len(input_list) - 1
mid = 0
tmp = None
if len(input_list) <= 0 or input_list[mid] < 0:
return 'The list is either empty or invalid.'
while mid <= hi_end:
if input_list[mid] == 0:
tmp = input_list[lo_end]
... |
# coding=utf-8
BTC_BASED_COINS = {
'PIVX': {
'ip': '',
'port': 3000,
'url': ''
}
}
ETHEREUM_BASED_COINS = ['ETH', 'BNB', 'SENT']
ADDRESS = ''.lower()
PRIVATE_KEY = ''
FEE_PERCENTAGE = 0.01
TOKENS = [
{
'address': ADDRESS,
'decimals': 18,
'logo_url': 'https://... | btc_based_coins = {'PIVX': {'ip': '', 'port': 3000, 'url': ''}}
ethereum_based_coins = ['ETH', 'BNB', 'SENT']
address = ''.lower()
private_key = ''
fee_percentage = 0.01
tokens = [{'address': ADDRESS, 'decimals': 18, 'logo_url': 'https://s2.coinmarketcap.com/static/img/coins/64x64/1027.png', 'name': 'Ethereum', 'price_... |
# It must be here to retrieve this information from the dummy
core_universal_identifier = 'd9d94986-ea14-11e0-bd1d-00216a5807c8'
core_universal_identifier_human = 'Consumer'
db_database = "WebLabTests"
weblab_db_username = 'weblab'
weblab_db_password = 'weblab'
debug_mode = True
#########################
# G... | core_universal_identifier = 'd9d94986-ea14-11e0-bd1d-00216a5807c8'
core_universal_identifier_human = 'Consumer'
db_database = 'WebLabTests'
weblab_db_username = 'weblab'
weblab_db_password = 'weblab'
debug_mode = True
server_hostaddress = 'weblab.deusto.es'
server_admin = 'weblab@deusto.es'
mail_notification_enabled = ... |
if __name__ == '__main__':
n, m = list(map(int, input().split(" ")))
arr = list(map(int, input().split(" ")))
set_a = set(map(int, input().split(" ")))
set_b = set(map(int, input().split(' ')))
print(sum([1 if e in set_a else -1 if e in set_b else 0 for e in arr]))
| if __name__ == '__main__':
(n, m) = list(map(int, input().split(' ')))
arr = list(map(int, input().split(' ')))
set_a = set(map(int, input().split(' ')))
set_b = set(map(int, input().split(' ')))
print(sum([1 if e in set_a else -1 if e in set_b else 0 for e in arr])) |
# Given a binary tree, find a minimum path sum from root to a leaf.
# For example, the minimum path in this tree is [10, 5, 1, -1], which has sum 15.
# 10
# / \
# 5 5
# \ \
# 2 1
# /
# -1
class Node:
def __init__(self, value, left=None, right=None):
self.value ... | class Node:
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
def min_path(node):
path_values = []
def search_path(node, path=0):
path += node.value
if node.left is None and node.right is None:
path... |
expected_output = {
"interface": {
"GigabitEthernet3.90": {
"interface": "GigabitEthernet3.90",
"neighbors": {
"FE80::5C00:40FF:FEFF:209": {
"age": "22",
"ip": "FE80::5C00:40FF:FEFF:209",
"link_layer_address"... | expected_output = {'interface': {'GigabitEthernet3.90': {'interface': 'GigabitEthernet3.90', 'neighbors': {'FE80::5C00:40FF:FEFF:209': {'age': '22', 'ip': 'FE80::5C00:40FF:FEFF:209', 'link_layer_address': '5e00.40ff.0209', 'neighbor_state': 'STALE'}}}}} |
class Solution:
def rob(self, nums: List[int]) -> int:
dp = [num for num in nums]
for i in range(2, len(nums)):
dp[i] += max(dp[:i-1])
return max(dp)
| class Solution:
def rob(self, nums: List[int]) -> int:
dp = [num for num in nums]
for i in range(2, len(nums)):
dp[i] += max(dp[:i - 1])
return max(dp) |
print("Statements")
print("Statement does something, while expression is something")
2*2 # this is an expression, it will not do anything if not using interactive interpreter.
print(2*2) #this is an statement, it does print
x=3 #this is also an statement, it has no values to print out, but x is already assigned.
| print('Statements')
print('Statement does something, while expression is something')
2 * 2
print(2 * 2)
x = 3 |
# This problem was recently asked by Google:
# Given a sorted list, create a height balanced binary search tree,
# meaning the height differences of each node can only differ by at most 1.
class Node:
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
se... | class Node:
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
def __str__(self):
answer = str(self.value)
if self.left:
answer += str(self.left)
if self.right:
answer += str(self.righ... |
#---------------------------------------------------------------------------------------------------
# Tiparoj
#---------------------------------------------------------------------------------------------------
c.fonts.completion.category = "bold 8pt monospace"
c.fonts.completion.entry = "8pt monospace"
c.fonts.debug... | c.fonts.completion.category = 'bold 8pt monospace'
c.fonts.completion.entry = '8pt monospace'
c.fonts.debug_console = '8pt monospace'
c.fonts.downloads = '8pt monospace'
c.fonts.hints = 'bold 8pt monospace'
c.fonts.keyhint = '8pt monospace'
c.fonts.messages.error = '8pt monospace'
c.fonts.messages.info = '8pt monospace... |
_base_ = 'ranksort_cascade_rcnn_r50_fpn_1x_coco.py'
model = dict(roi_head=dict(stage_loss_weights=[1, 0.50, 0.25]))
| _base_ = 'ranksort_cascade_rcnn_r50_fpn_1x_coco.py'
model = dict(roi_head=dict(stage_loss_weights=[1, 0.5, 0.25])) |
{
"targets": [
{
"target_name": "pcap_binding",
'win_delay_load_hook': 'true',
"sources": [ "npcap_binding.cpp","npcap_session.cpp"],
"include_dirs": ["npcap/Include","<!@(node -p \"require('node-addon-api').include\")"],
"libraries": [
"<(module_root_dir)/npcap/Lib/x64/Packe... | {'targets': [{'target_name': 'pcap_binding', 'win_delay_load_hook': 'true', 'sources': ['npcap_binding.cpp', 'npcap_session.cpp'], 'include_dirs': ['npcap/Include', '<!@(node -p "require(\'node-addon-api\').include")'], 'libraries': ['<(module_root_dir)/npcap/Lib/x64/Packet.lib', '<(module_root_dir)/npcap/Lib/x64/wpcap... |
class Config(object):
# game setting
row_size = 6
column_size = 6
piece_in_line = 4
black_first = True
max_num_round = 36
# mcts
temperature = 1.0
playout_times = 100 # num of simulations for each move
c_puct = 5.
# data
num_games_per_generation = 10
... | class Config(object):
row_size = 6
column_size = 6
piece_in_line = 4
black_first = True
max_num_round = 36
temperature = 1.0
playout_times = 100
c_puct = 5.0
num_games_per_generation = 10
batch_size = 32
buffer_size = 10000
data_buffer_size = 10000
epoch_per_dataset =... |
# Demonstrate how to use dictionary comprehensions
def main():
# define a list of temperature values
ctemps = [0, 12, 34, 100]
# Use a comprehension to build a dictionary
tempDict = {t: (t * 9/5) + 32 for t in ctemps if t < 100}
print(tempDict)
print(tempDict[12])
# Merge two dictionarie... | def main():
ctemps = [0, 12, 34, 100]
temp_dict = {t: t * 9 / 5 + 32 for t in ctemps if t < 100}
print(tempDict)
print(tempDict[12])
team1 = {'Jones': 24, 'Jameson': 18, 'Smith': 58, 'Burns': 7}
team2 = {'White': 12, 'Macke': 88, 'Perce': 4}
new_team = {k: v for team in (team1, team2) for (k... |
class Config():
def __init__(self):
self.type = "a2c"
self.gamma = 0.99
self.learning_rate = 0.001
self.entropy_beta = 0.01
self.batch_size = 128
| class Config:
def __init__(self):
self.type = 'a2c'
self.gamma = 0.99
self.learning_rate = 0.001
self.entropy_beta = 0.01
self.batch_size = 128 |
width = const(7)
height = const(12)
data = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x10\x10\x10\x10\x00\x00\x10\x00\x00\x00\x00lHH\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14\x14(|(|(PP\x00\x00\x00\x108@@8Hp\x10\x10\x00\x00\x00 P \x0cp\x08\x14\x08\x00\x00\x00\x00\x00\x00\x18 TH4\x00\x00\x00\x00\x10\x10\... | width = const(7)
height = const(12)
data = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x10\x10\x10\x10\x00\x00\x10\x00\x00\x00\x00lHH\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14\x14(|(|(PP\x00\x00\x00\x108@@8Hp\x10\x10\x00\x00\x00 P \x0cp\x08\x14\x08\x00\x00\x00\x00\x00\x00\x18 TH4\x00\x00\x00\x00\x10\x10\x... |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def binaryTreePaths(self, root: TreeNode) -> List[str]:
if not root: return []
result = []
... | class Solution:
def binary_tree_paths(self, root: TreeNode) -> List[str]:
if not root:
return []
result = []
if root.left or root.right:
for path in self.binaryTreePaths(root.left):
result.append(str(root.val) + '->' + path)
for path in se... |
class Solution:
def calculate(self, s: str) -> int:
inner, outer, result, opt = 0, 0, 0, '+'
for c in s+'+':
if c == ' ': continue
if c.isdigit():
inner = 10*inner + int(c)
continue
if opt == '+':
result += outer
... | class Solution:
def calculate(self, s: str) -> int:
(inner, outer, result, opt) = (0, 0, 0, '+')
for c in s + '+':
if c == ' ':
continue
if c.isdigit():
inner = 10 * inner + int(c)
continue
if opt == '+':
... |
client_id="You need to fill this"
client_secret="You need to fill this"
user_agent="You need to fill this"
username="You need to fill this"
password="You need to fill this" | client_id = 'You need to fill this'
client_secret = 'You need to fill this'
user_agent = 'You need to fill this'
username = 'You need to fill this'
password = 'You need to fill this' |
targets = [int(target) for target in input().split()]
command = input().split()
while "End" not in command:
index = int(command[1])
if "Shoot" in command:
power = int(command[2])
if 0 <= index < len(targets):
targets[index] -= power
if targets[index] <= 0:
... | targets = [int(target) for target in input().split()]
command = input().split()
while 'End' not in command:
index = int(command[1])
if 'Shoot' in command:
power = int(command[2])
if 0 <= index < len(targets):
targets[index] -= power
if targets[index] <= 0:
... |
class Group(object):
def __init__(self, _name):
self.name = _name
self.groups = []
self.users = []
def add_group(self, group):
self.groups.append(group)
def add_user(self, user):
self.users.append(user)
def get_groups(self):
return self.groups
def ... | class Group(object):
def __init__(self, _name):
self.name = _name
self.groups = []
self.users = []
def add_group(self, group):
self.groups.append(group)
def add_user(self, user):
self.users.append(user)
def get_groups(self):
return self.groups
def... |
letter="Sai Teja";
for i in letter:
print(i);
| letter = 'Sai Teja'
for i in letter:
print(i) |
def add_one(num):
return (-(~num))
print(add_one(3))
print(add_one(99)) | def add_one(num):
return -~num
print(add_one(3))
print(add_one(99)) |
# Global constants that will be used all along the program
# Port paths
ODRIVE_USB_PORT_PATH = ""
REHASTIM_USB_PORT_PATH = ""
USB_DRIVE_PORT_PATH = ""
| odrive_usb_port_path = ''
rehastim_usb_port_path = ''
usb_drive_port_path = '' |
#!/usr/bin/env python3
class Solution:
def xorOperation(self, n: int, start: int) -> int:
res = start
for i in range(1,n):
res^=start+2*i
return res
## Intuition:
#
# - As per the requirements of the problem, we don't need to return the array itself.
# - So, we can free up any ... | class Solution:
def xor_operation(self, n: int, start: int) -> int:
res = start
for i in range(1, n):
res ^= start + 2 * i
return res |
# dude, this is a comment
# some more
hello
def dude():
yes
awesome;
# Here we have a comment
def realy_awesome(): # hi there
in_more
same_level
def one_liner(): first; second # both inside one_liner
back_down
last_statement
# dude, this is a comment
# some more
hello
if 1:... | hello
def dude():
yes
awesome
def realy_awesome():
in_more
same_level
def one_liner():
first
second
back_down
last_statement
hello
if 1:
yes
awesome
if 'hello':
in_more
same_level
if ['dude', 'dudess'].horsie():
... |
# https://open.kattis.com/problems/oddgnome
n = int(input())
for _ in range(n):
gnomes = list(map(int, input().split()))[1:]
for i in range(1, len(gnomes) - 1):
if gnomes[i + 1] > gnomes[i - 1]:
if gnomes[i] < gnomes[i - 1] and gnomes[i] < gnomes[i + 1]:
print(i + 1)
... | n = int(input())
for _ in range(n):
gnomes = list(map(int, input().split()))[1:]
for i in range(1, len(gnomes) - 1):
if gnomes[i + 1] > gnomes[i - 1]:
if gnomes[i] < gnomes[i - 1] and gnomes[i] < gnomes[i + 1]:
print(i + 1)
break
if gnomes[i] > gno... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.