content stringlengths 7 1.05M | fixed_cases stringlengths 1 1.28M |
|---|---|
#WAP to accept a string from user and replace all occurrances of first character except for the first character.
name = input("Please enter a string: ")
replaceToken = input("Please enter token to replace: ")
print (name)
name2 = name[0] + name[1:].replace(name[0], replaceToken)
print (name2) | name = input('Please enter a string: ')
replace_token = input('Please enter token to replace: ')
print(name)
name2 = name[0] + name[1:].replace(name[0], replaceToken)
print(name2) |
#!/usr/bin/python3
class Unit:
bydgoszcz = "040410661011"
warszawa = "071412865011"
krakow = "011212161011"
lodz = "051011661011"
wroclaw = "030210564011"
poznan = "023016264011"
gdansk = "042214361011"
szczecin = "023216562011"
lublin = "060611163011"
bialystok = "062013761011... | class Unit:
bydgoszcz = '040410661011'
warszawa = '071412865011'
krakow = '011212161011'
lodz = '051011661011'
wroclaw = '030210564011'
poznan = '023016264011'
gdansk = '042214361011'
szczecin = '023216562011'
lublin = '060611163011'
bialystok = '062013761011'
katowice = '012... |
VERSION = '0.0.1'
DIR_KIND = {
'cache': {'search': '__pycache__', 'help': 'Delete the pycache folders'},
'egg': {'search': 'egg-info', 'help': 'Delete the egg folders'},
}
FILE_KIND = {
'pyc': {'search': '.pyc', 'help': 'Delete the pyc files'},
}
| version = '0.0.1'
dir_kind = {'cache': {'search': '__pycache__', 'help': 'Delete the pycache folders'}, 'egg': {'search': 'egg-info', 'help': 'Delete the egg folders'}}
file_kind = {'pyc': {'search': '.pyc', 'help': 'Delete the pyc files'}} |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def addTwoNumbers(l1: ListNode, l2: ListNode) -> ListNode:
tmp = 0
result = ListNode(0)
dummy = result
while l1 or l2:
v = tmp
if l1:
v += l1.val
... | class Listnode:
def __init__(self, x):
self.val = x
self.next = None
def add_two_numbers(l1: ListNode, l2: ListNode) -> ListNode:
tmp = 0
result = list_node(0)
dummy = result
while l1 or l2:
v = tmp
if l1:
v += l1.val
l1 = l1.next
if ... |
class ComplexPolynomialIterationData(object):
iteration_values = None
exploded_indexes = None
remaining_indexes = None
def __init__(self, iteration_values, exploded_indexes, remaining_indexes):
self.iteration_values = iteration_values
self.exploded_indexes = exploded_indexes
se... | class Complexpolynomialiterationdata(object):
iteration_values = None
exploded_indexes = None
remaining_indexes = None
def __init__(self, iteration_values, exploded_indexes, remaining_indexes):
self.iteration_values = iteration_values
self.exploded_indexes = exploded_indexes
sel... |
begin = int(input())
ending = int(input())
point = int(input())
left = min(begin, ending)
right = max(begin, ending)
distance_left = abs(left - point)
distance_right = abs(right - point)
min_distance = min(distance_left, distance_right)
if left <= point <= right:
print("in")
else:
print("out")
print(min_dis... | begin = int(input())
ending = int(input())
point = int(input())
left = min(begin, ending)
right = max(begin, ending)
distance_left = abs(left - point)
distance_right = abs(right - point)
min_distance = min(distance_left, distance_right)
if left <= point <= right:
print('in')
else:
print('out')
print(min_distanc... |
# Esercizio n. 5
# Visualizzare tutti i numeri dispari compresi fra 1 e 50.
n_min = 1
n_max = 50
print("I numeri dispari compresi tra", n_min, "e", n_max, "sono:")
n = n_min
while n <= n_max:
if n % 2 != 0:
print(n, "\t")
n = n + 1
| n_min = 1
n_max = 50
print('I numeri dispari compresi tra', n_min, 'e', n_max, 'sono:')
n = n_min
while n <= n_max:
if n % 2 != 0:
print(n, '\t')
n = n + 1 |
def cheer(n):
'return a string with a silly cheer based on n'
if n <= 1:
return "Hurrah!"
else:
return "Hip " + cheer(n - 1)
x = cheer(5)
print(x)
| def cheer(n):
"""return a string with a silly cheer based on n"""
if n <= 1:
return 'Hurrah!'
else:
return 'Hip ' + cheer(n - 1)
x = cheer(5)
print(x) |
a = 12
print(f"a is {a}")
print(f"Data Type of a is {type(a)}")
b = 3.1415926
print(f"b is {b}")
print(f"Data Type of b is {type(b)}")
c = "message"
print(f"c is {c}")
print(f"Data Type of c is {type(c)}")
d = True
print(f"d is {d}")
print(f"Data Type of d is {type(d)}")
e = None
print(f"e is {e}")
print(f"Data Typ... | a = 12
print(f'a is {a}')
print(f'Data Type of a is {type(a)}')
b = 3.1415926
print(f'b is {b}')
print(f'Data Type of b is {type(b)}')
c = 'message'
print(f'c is {c}')
print(f'Data Type of c is {type(c)}')
d = True
print(f'd is {d}')
print(f'Data Type of d is {type(d)}')
e = None
print(f'e is {e}')
print(f'Data Type of... |
def detectLoop(head):
if head == None:
return False
start = head
next_next_start = head.next
if next_next_start == None:
return False
next_next_start = head.next.next
while next_next_start != None:
start = start.next
next_next_start = next_next_... | def detect_loop(head):
if head == None:
return False
start = head
next_next_start = head.next
if next_next_start == None:
return False
next_next_start = head.next.next
while next_next_start != None:
start = start.next
next_next_start = next_next_start.next
... |
'''
Problem 22
@author: Kevin Ji
'''
def get_value_of_letter(letter):
return ord(letter.upper()) - 64
def get_value_of_word(word):
value = 0
for char in word:
value += get_value_of_letter(char)
return value
# Parse the file, and place the names into a list
file = open("problem_22_names.t... | """
Problem 22
@author: Kevin Ji
"""
def get_value_of_letter(letter):
return ord(letter.upper()) - 64
def get_value_of_word(word):
value = 0
for char in word:
value += get_value_of_letter(char)
return value
file = open('problem_22_names.txt', 'r')
names_text = file.read()
names = sorted(names... |
class Solution:
def maxProfit(self, prices: List[int]) -> int:
i = 0
profit = 0
flag = 0
while i<(len(prices)-1):
if prices[i] < prices[i+1] and flag==0:
profit -= prices[i]
flag = 1
elif prices[i] > prices[i+1] and flag==1:
... | class Solution:
def max_profit(self, prices: List[int]) -> int:
i = 0
profit = 0
flag = 0
while i < len(prices) - 1:
if prices[i] < prices[i + 1] and flag == 0:
profit -= prices[i]
flag = 1
elif prices[i] > prices[i + 1] and fl... |
#List slicing
my_list = [0,1,2,3,4,5,6,7,8,9]
print("list = ",my_list)
print("my_list[0:]",my_list[0:])
print("my_list[:]",my_list[:])
print("my_list[:-1]",my_list[:-1])
print("my_list[1:5]",my_list[1:5])
#list(start:end:step)
print("my_list[1::3]",my_list[1::3])
print("my_list[-1:1:-1]",my_list[-1:1:-1])
sample_ur... | my_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
print('list = ', my_list)
print('my_list[0:]', my_list[0:])
print('my_list[:]', my_list[:])
print('my_list[:-1]', my_list[:-1])
print('my_list[1:5]', my_list[1:5])
print('my_list[1::3]', my_list[1::3])
print('my_list[-1:1:-1]', my_list[-1:1:-1])
sample_url = 'https://mydomain.co... |
#
# @lc app=leetcode.cn id=253 lang=python3
#
# [253] meeting-rooms-ii
#
None
# @lc code=end | None |
'''
Assigning values to the grid
The grid will look like this:
0,0 | 0,1 | 0,2 | 0,3 | 0,4 | 0,5 | 0,6
1,0 | 1,1 | 1,2 | 1,3 | 1,4 | 1,5 | 1,6
2,0 | 2,1 | 2,2 | 2,3 | 2,4 | 2,5 | 2,6
3,0 | 3,1 | 3,2 | 3,3 | 3,4 | 3,5 | 3,6
4,0 | 4,1 | 4,2 | 4,3 | 4,4 | 4,5 | 4,6
5,0 | 5,1 | 5,2 | 5,3 | 5,4 | 5,5 | 5,6
'''
N... | """
Assigning values to the grid
The grid will look like this:
0,0 | 0,1 | 0,2 | 0,3 | 0,4 | 0,5 | 0,6
1,0 | 1,1 | 1,2 | 1,3 | 1,4 | 1,5 | 1,6
2,0 | 2,1 | 2,2 | 2,3 | 2,4 | 2,5 | 2,6
3,0 | 3,1 | 3,2 | 3,3 | 3,4 | 3,5 | 3,6
4,0 | 4,1 | 4,2 | 4,3 | 4,4 | 4,5 | 4,6
5,0 | 5,1 | 5,2 | 5,3 | 5,4 | 5,5 | 5,6
"""
(... |
__version__ = '0.1.2'
def version_info():
return tuple([int(i) for i in __version__.split('.')])
| __version__ = '0.1.2'
def version_info():
return tuple([int(i) for i in __version__.split('.')]) |
set1 = set()
set1.add(1)
set2 = {1, 2, 3}
print(set1)
print(set1 | set2)
print(set1 & set2)
| set1 = set()
set1.add(1)
set2 = {1, 2, 3}
print(set1)
print(set1 | set2)
print(set1 & set2) |
youtubePlaylists = [
"PLxAzjHbHvNcUvcajBsGW2VI6fyIWa4sVl", # ProbablePrime
"PLjux6EKYfu0045V_-s5l9biu55fzbWFAO", # Deloious Jax
"PLoAvz0_U4_3wuXXrl8IbyJIYZFdeIgyHm", # Frooxius
"PLSa764cPPsV9saKq_9Sb_izfwgI9cY-8u", # CuriosVR.. coffee
"PLWhfKbDgR4zD-o31sgHqesncjt49Jxou7", # AMoB tutorials
"... | youtube_playlists = ['PLxAzjHbHvNcUvcajBsGW2VI6fyIWa4sVl', 'PLjux6EKYfu0045V_-s5l9biu55fzbWFAO', 'PLoAvz0_U4_3wuXXrl8IbyJIYZFdeIgyHm', 'PLSa764cPPsV9saKq_9Sb_izfwgI9cY-8u', 'PLWhfKbDgR4zD-o31sgHqesncjt49Jxou7', 'PLFYjCoKo3ivA67rj20lIsmUG2AQoavYHG', 'PLwitPMCdx0xu2KQ7vwoccaPUp-31qfdjK', 'PLSB-6Ok84ZR0Ow4ziNWuFLGTgf3M1JD... |
def rotate(list, no_rotation):
return list[no_rotation:] + list[:no_rotation]
def message_processor(message):
message = message.upper()
message = message.replace(" ", "")
return message
def select_rotor(rotor_model):
rotor_i_list = ['E','K','M','F','L','G','D','Q','V','Z','N','T','O','W','Y','... | def rotate(list, no_rotation):
return list[no_rotation:] + list[:no_rotation]
def message_processor(message):
message = message.upper()
message = message.replace(' ', '')
return message
def select_rotor(rotor_model):
rotor_i_list = ['E', 'K', 'M', 'F', 'L', 'G', 'D', 'Q', 'V', 'Z', 'N', 'T', 'O', ... |
x=int(input())
count=0
for i in range(1,x):
if(x%i==0):
count+=1
if(count!=2):
print("yes")
else:
print("no")
| x = int(input())
count = 0
for i in range(1, x):
if x % i == 0:
count += 1
if count != 2:
print('yes')
else:
print('no') |
print("Hello world!");
print("Hello everybody!");
print("Hello!")
print("Hello my dear friend!")
print("Glad to see you!") | print('Hello world!')
print('Hello everybody!')
print('Hello!')
print('Hello my dear friend!')
print('Glad to see you!') |
# https://cses.fi/problemset/task/1092
n = int(input())
if n % 4 in [1, 2]:
print('NO')
exit()
s1, s2 = '', ''
if n % 4 == 0:
x = n // 2 + 1
for i in range(1, x, 2):
s1 += str(i) + ' ' + str(n - i + 1) + ' '
s2 += str(i + 1) + ' ' + str(n - i) + ' '
else:
s1 = '1 2'
s2 = '3'
... | n = int(input())
if n % 4 in [1, 2]:
print('NO')
exit()
(s1, s2) = ('', '')
if n % 4 == 0:
x = n // 2 + 1
for i in range(1, x, 2):
s1 += str(i) + ' ' + str(n - i + 1) + ' '
s2 += str(i + 1) + ' ' + str(n - i) + ' '
else:
s1 = '1 2'
s2 = '3'
for i in range(4, n, 4):
s1... |
TEST = "test_input.txt"
INPUT = "input.txt"
def read_file(filename):
return open(filename, "r").readlines()
def process_task_1(data):
return len(data)
def process_task_2(data):
return len(data)
def test():
data = read_file(TEST)
assert process_task_1(data) == 0
assert process_task_2(data... | test = 'test_input.txt'
input = 'input.txt'
def read_file(filename):
return open(filename, 'r').readlines()
def process_task_1(data):
return len(data)
def process_task_2(data):
return len(data)
def test():
data = read_file(TEST)
assert process_task_1(data) == 0
assert process_task_2(data) ==... |
#Enter a number and count its digits.
n=int(input("Enter a no.:"))
count=0
a=0
ans=0
while n!=0:
n=n//10
count=count+1
print("Total no. of digits in the number=",count)
| n = int(input('Enter a no.:'))
count = 0
a = 0
ans = 0
while n != 0:
n = n // 10
count = count + 1
print('Total no. of digits in the number=', count) |
# This module defines strings containing XPM data that matches
# Golly's built-in icons (see the XPM data in wxalgos.cpp).
# The strings are used by icon-importer.py and icon_exporter.py.
circles = '''
XPM
/* width height num_colors chars_per_pixel */
"31 31 5 1"
/* colors */
". c #000000"
"B c #404040"
"C c #808080"
... | circles = '\nXPM\n/* width height num_colors chars_per_pixel */\n"31 31 5 1"\n/* colors */\n". c #000000"\n"B c #404040"\n"C c #808080"\n"D c #C0C0C0"\n"E c #FFFFFF"\n/* icon for state 1 */\n"..............................."\n"..............................."\n"..........BCDEEEEEDCB.........."\n".........CEEEEEEEEEEEC.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def is_valid(s: str) -> bool:
bracket_pairs = {')': '(', '}': '{', ']': '['}
stack = []
for c in s:
if c in bracket_pairs:
if not stack or stack.pop() != bracket_pairs[c]:
return False
else:
stack.append(... | def is_valid(s: str) -> bool:
bracket_pairs = {')': '(', '}': '{', ']': '['}
stack = []
for c in s:
if c in bracket_pairs:
if not stack or stack.pop() != bracket_pairs[c]:
return False
else:
stack.append(c)
return not stack |
####### Modules of SSS dataset #######
def euler_to_rotation(euler):
ex = euler[0]
ey = euler[1]
ez = euler[2]
rx = np.array([[1,0,0],[0,np.cos(ex),-1*np.sin(ex)],[0,np.sin(ex),np.cos(ex)]])
ry = np.array([[np.cos(ey),0,np.sin(ey)],[0,1,0],[-1*np.sin(ey),0,np.cos(ey)]])
rz = np.array([[np.cos(e... | def euler_to_rotation(euler):
ex = euler[0]
ey = euler[1]
ez = euler[2]
rx = np.array([[1, 0, 0], [0, np.cos(ex), -1 * np.sin(ex)], [0, np.sin(ex), np.cos(ex)]])
ry = np.array([[np.cos(ey), 0, np.sin(ey)], [0, 1, 0], [-1 * np.sin(ey), 0, np.cos(ey)]])
rz = np.array([[np.cos(ez), -1 * np.sin(ez),... |
__init__ = ["SpectrographUI_savejsondict","SpectrographUI_loadjsondict"]
def SpectrographUI_savejsondict(self,jdict):
'''Autogenerated code from ui's make/awk trick.'''
jdict['compLampSwitch'] = self.compLampSwitch.isChecked()
jdict['flatLampSwitch'] = self.flatLampSwitch.isChecked()
jdict['heater1Switch'] ... | __init__ = ['SpectrographUI_savejsondict', 'SpectrographUI_loadjsondict']
def spectrograph_ui_savejsondict(self, jdict):
"""Autogenerated code from ui's make/awk trick."""
jdict['compLampSwitch'] = self.compLampSwitch.isChecked()
jdict['flatLampSwitch'] = self.flatLampSwitch.isChecked()
jdict['heater1S... |
X_threads = 128*8
Y_threads = 1
Invoc_count = 9
start_index = 95
end_index = 107
src_list = []
SHARED_MEM_USE = False
total_shared_mem_size = 1024
domi_list = [89]
domi_val = [0] | x_threads = 128 * 8
y_threads = 1
invoc_count = 9
start_index = 95
end_index = 107
src_list = []
shared_mem_use = False
total_shared_mem_size = 1024
domi_list = [89]
domi_val = [0] |
#encoding:utf-8
subreddit = 'crackwatch'
t_channel = '@r_crackwatch'
def send_post(submission, r2t):
return r2t.send_simple(submission)
| subreddit = 'crackwatch'
t_channel = '@r_crackwatch'
def send_post(submission, r2t):
return r2t.send_simple(submission) |
# -*- coding: utf-8 -*-
def implicit_scope(func):
def wrapper(*args):
args[0].scope.append({})
ans = func(*args)
args[0].scope.pop()
return ans
return wrapper
class Solution(object):
def __init__(self):
self.scope = [{}]
@implicit_scope
def evaluate(self,... | def implicit_scope(func):
def wrapper(*args):
args[0].scope.append({})
ans = func(*args)
args[0].scope.pop()
return ans
return wrapper
class Solution(object):
def __init__(self):
self.scope = [{}]
@implicit_scope
def evaluate(self, expression):
if ... |
# coding: utf-8
'''
Package exceptions.
'''
class NoSuchContent(Exception): pass
class ContentSyntaxError(Exception): pass
| """
Package exceptions.
"""
class Nosuchcontent(Exception):
pass
class Contentsyntaxerror(Exception):
pass |
old_SYMBOL_INFO = _SYMBOL_INFO
class _SYMBOL_INFO(old_SYMBOL_INFO):
@property
def tag(self):
return SymTagEnum.mapper[self.Tag] | old_symbol_info = _SYMBOL_INFO
class _Symbol_Info(old_SYMBOL_INFO):
@property
def tag(self):
return SymTagEnum.mapper[self.Tag] |
class Solution:
def largestTriangleArea(self, points: List[List[int]]) -> float:
result = 0
lenList = len(points)
for i in range(lenList-2):
x1, y1 = points[i]
for j in range(lenList-1):
x2, y2 = points[j]
for k in range(lenList):
... | class Solution:
def largest_triangle_area(self, points: List[List[int]]) -> float:
result = 0
len_list = len(points)
for i in range(lenList - 2):
(x1, y1) = points[i]
for j in range(lenList - 1):
(x2, y2) = points[j]
for k in range(len... |
class ProfileError(Exception):
def __init__(self, code: str):
self.code = code
class ProfileNotFoundError(ProfileError):
def __init__(self, code: str):
super().__init__(code)
def __str__(self):
return f"Profile {self.code} not found"
class ProfileAlreadyExistsError(ProfileError)... | class Profileerror(Exception):
def __init__(self, code: str):
self.code = code
class Profilenotfounderror(ProfileError):
def __init__(self, code: str):
super().__init__(code)
def __str__(self):
return f'Profile {self.code} not found'
class Profilealreadyexistserror(ProfileError)... |
class GotoAckPacket:
def __init__(self):
self.type = "GOTOACK"
self.time = 0
def write(self, writer):
writer.writeInt32(self.time)
def read(self, reader):
self.time = reader.readInt32()
| class Gotoackpacket:
def __init__(self):
self.type = 'GOTOACK'
self.time = 0
def write(self, writer):
writer.writeInt32(self.time)
def read(self, reader):
self.time = reader.readInt32() |
#
# PySNMP MIB module EXTREME-OSPF-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/EXTREME-BASE-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 18:53:03 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default, Mar ... | (object_identifier, octet_string, integer) = mibBuilder.importSymbols('ASN1', 'ObjectIdentifier', 'OctetString', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(single_value_constraint, value_size_constraint, constraints_union, value_range_constraint, constraints_intersection) ... |
class IndigoDevice:
def __init__(self, id, name):
self.id = id
self.name = name
self.states = {}
self.states_meta = {}
self.pluginProps = {}
self.image = None
self.brightness = 0
def updateStateOnServer(self, key, value, uiValue=None, decimalPlaces=0):
... | class Indigodevice:
def __init__(self, id, name):
self.id = id
self.name = name
self.states = {}
self.states_meta = {}
self.pluginProps = {}
self.image = None
self.brightness = 0
def update_state_on_server(self, key, value, uiValue=None, decimalPlaces=0)... |
# Nama : Eraraya Morenzo Muten
# NIM : 16520002
# Tanggal : 26 Maret 2021
# Program EmpatInteger
# Input: 4 integer: A, B, C, D
# Output: Sifat integer dari A, B, C, D (positif/negatif/nol)
# Jika semua integer positif, tampilkan:
# nilai maksimum, minimum, dan mean olympic
# KAMUS
# variabel... | def cek_integer(x):
if x > 0:
print('POSITIF')
elif x < 0:
print('NEGATIF')
elif x == 0:
print('NOL')
def max(a, b, c, d):
return max(a, b, c, d)
def min(a, b, c, d):
return min(a, b, c, d)
def is_all_positif(a, b, c, d):
return a > 0 and b > 0 and (c > 0) and (d > 0)
... |
username = 'ENTER YOUR E-MAIL ID HERE'
password = 'ENTER YOUR PASSWORD HERE'
entry_nodeIp = 'http://py4e-data.dr-chuck.net/json?'
gmaps_api_key = 42
user_agents_list = ["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36",
"Mozilla/5.0 (Windows NT ... | username = 'ENTER YOUR E-MAIL ID HERE'
password = 'ENTER YOUR PASSWORD HERE'
entry_node_ip = 'http://py4e-data.dr-chuck.net/json?'
gmaps_api_key = 42
user_agents_list = ['Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', 'Mozilla/5.0 (Windows NT 10.0; ... |
# uninhm
# https://atcoder.jp/contests/abc183/tasks/abc183_a
# implementation
print(max(0, int(input())))
| print(max(0, int(input()))) |
d1 = {42: 100}
d2 = {'abc': 'fob'}
d3 = {1e1000: d1}
s = set([frozenset([2,3,4])])
class C(object):
abc = 42
def f(self): pass
cinst = C()
class C2(object):
abc = 42
def __init__(self):
self.oar = 100
self.self = self
def __repr__(self):
return 'myrepr'
... | d1 = {42: 100}
d2 = {'abc': 'fob'}
d3 = {1e309: d1}
s = set([frozenset([2, 3, 4])])
class C(object):
abc = 42
def f(self):
pass
cinst = c()
class C2(object):
abc = 42
def __init__(self):
self.oar = 100
self.self = self
def __repr__(self):
return 'myrepr'
def... |
url = "https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Hurdle%202&url=worlds%2Ftutorial_en%2Fhurdle2.json"
def turn_right():
turn_left()
turn_left()
turn_left()
def hurdle():
move()
turn_left()
move()
turn_right()
move()
turn_rig... | url = 'https://reeborg.ca/reeborg.html?lang=en&mode=python&menu=worlds%2Fmenus%2Freeborg_intro_en.json&name=Hurdle%202&url=worlds%2Ftutorial_en%2Fhurdle2.json'
def turn_right():
turn_left()
turn_left()
turn_left()
def hurdle():
move()
turn_left()
move()
turn_right()
move()
turn_rig... |
class Test:
def __init__(self, text):
self.text = text
def text(self):
return self.text
| class Test:
def __init__(self, text):
self.text = text
def text(self):
return self.text |
# Instruments
SST_INSTRUMENT = 'SST'
POEMAS_INSTRUMENT = 'POEMAS'
# File types
TRK_TYPE = 'TRK'
RBD_TYPE = 'RBD'
# Instrument Types
AVAILABLE_SST_TYPES = {
RBD_TYPE: ["bi", "rs", "rf"]
}
AVAILABLE_POEMAS_TYPES = {
TRK_TYPE: ["TRK"]
}
INSTRUMENT_TO_TYPE_MAP = {
SST_INSTRUMENT: AVAILABLE_SST_TYPES,
POEM... | sst_instrument = 'SST'
poemas_instrument = 'POEMAS'
trk_type = 'TRK'
rbd_type = 'RBD'
available_sst_types = {RBD_TYPE: ['bi', 'rs', 'rf']}
available_poemas_types = {TRK_TYPE: ['TRK']}
instrument_to_type_map = {SST_INSTRUMENT: AVAILABLE_SST_TYPES, POEMAS_INSTRUMENT: AVAILABLE_POEMAS_TYPES}
objects_not_from_same_instrume... |
def get_sunday():
return 'Sunday'
def get_monday():
return 'Monday'
def get_tuesday():
return 'Tuesday'
def get_default():
return 'Unknown'
day = 4
switcher = {
0 : get_sunday,
1 : get_monday,
2 : get_tuesday
}
day_name = switcher.get(day,get_default)()
print(day_name) | def get_sunday():
return 'Sunday'
def get_monday():
return 'Monday'
def get_tuesday():
return 'Tuesday'
def get_default():
return 'Unknown'
day = 4
switcher = {0: get_sunday, 1: get_monday, 2: get_tuesday}
day_name = switcher.get(day, get_default)()
print(day_name) |
CONFIG_FILENAMES = [
'.vintrc.yaml',
'.vintrc.yml',
'.vintrc',
]
| config_filenames = ['.vintrc.yaml', '.vintrc.yml', '.vintrc'] |
# -------------- This file adds actual expected results to submission file -----------------#
f=open('submission.csv','r')
g=open('testHistory.csv','r') # ts.csv generated before
h=open('res.csv','w+')
lines=f.readlines()
i=0
for line in g.readlines():
k=line.split(',')
toWrite=k[5]
h.write... | f = open('submission.csv', 'r')
g = open('testHistory.csv', 'r')
h = open('res.csv', 'w+')
lines = f.readlines()
i = 0
for line in g.readlines():
k = line.split(',')
to_write = k[5]
h.write(lines[i][0:-1] + ',' + toWrite + '\n')
i += 1
h.close()
f.close()
g.close() |
IRIS_BYPASS=False
AWS_REGION = "us-west-1"
IRIS_SNS_TOPIC = "iris-topic"
IRIS_SQS_APP_QUEUE = "iris-test-queue"
IRIS_POLL_INTERVAL = 20
| iris_bypass = False
aws_region = 'us-west-1'
iris_sns_topic = 'iris-topic'
iris_sqs_app_queue = 'iris-test-queue'
iris_poll_interval = 20 |
# This dictionary is to define metrics that we should extract data from and then
# their exposed name as predicted metric
metrics = {
'actual_metric_name1': 'actual_metric_name1_predict',
'actual_metric_name2': 'actual_metric_name2_predict'
}
#
prom_url = 'http://localhost/'
expose_port = 8000
# interval in ... | metrics = {'actual_metric_name1': 'actual_metric_name1_predict', 'actual_metric_name2': 'actual_metric_name2_predict'}
prom_url = 'http://localhost/'
expose_port = 8000
interval = 30
chunk_size = 24 |
def print_hello():
print("hello!")
def print_goodbye():
print("goodbye!") | def print_hello():
print('hello!')
def print_goodbye():
print('goodbye!') |
n = int(input())
primary = []
secondary = []
matrix = []
for _ in range(n):
matrix.append([int(x) for x in input().split()])
for r in range(n):
primary.append(matrix[r][r])
secondary.append(matrix[r][n - 1 -r])
sum_p = (sum([x for x in primary]))
sum_s = (sum([x for x in secondary]))
print(abs(sum_p-sum... | n = int(input())
primary = []
secondary = []
matrix = []
for _ in range(n):
matrix.append([int(x) for x in input().split()])
for r in range(n):
primary.append(matrix[r][r])
secondary.append(matrix[r][n - 1 - r])
sum_p = sum([x for x in primary])
sum_s = sum([x for x in secondary])
print(abs(sum_p - sum_s)) |
# replace with the label of class for which you are interested in building the lexicon;
# this should be the same as the label in your input files
positive_class_label = "on-topic"
# replace the label for the examples that do not belong to the topic of interest
# this should be the same as the label in your input file... | positive_class_label = 'on-topic'
negative_class_label = 'off-topic'
lexicon_size = 400 |
def loadfile(name):
values = []
f = open(name, "r")
for x in f:
values.append(x)
return values
def day2():
depth = 0
position = 0
depth2 = 0
for i in range(0, len(values)):
value = values[i].split()
if value[0] == "forward":
position += int(value[1])
... | def loadfile(name):
values = []
f = open(name, 'r')
for x in f:
values.append(x)
return values
def day2():
depth = 0
position = 0
depth2 = 0
for i in range(0, len(values)):
value = values[i].split()
if value[0] == 'forward':
position += int(value[1])
... |
# THIS FILE IS GENERATED FROM NUMPY SETUP.PY
short_version = '1.10.4'
version = '1.10.4'
full_version = '1.10.4'
git_revision = 'e46c2d78a27f25e66624a818276be57ef9458e60'
release = True
if not release:
version = full_version
| short_version = '1.10.4'
version = '1.10.4'
full_version = '1.10.4'
git_revision = 'e46c2d78a27f25e66624a818276be57ef9458e60'
release = True
if not release:
version = full_version |
# Define a Subtraction Function
def sub(num1, num2):
return num1 - num2
| def sub(num1, num2):
return num1 - num2 |
baseurl='\t\t\t<input name="marriageLine" type="radio" id="marriageLine%s" value="%s" /><label for="marriageLine%s"><img src="images/marriageLine/%s.jpg" height=195 width=150></label>'
for i in range(1, 18):
url = baseurl % (i,i,i,i)
print(url+"\n") | baseurl = '\t\t\t<input name="marriageLine" type="radio" id="marriageLine%s" value="%s" /><label for="marriageLine%s"><img src="images/marriageLine/%s.jpg" height=195 width=150></label>'
for i in range(1, 18):
url = baseurl % (i, i, i, i)
print(url + '\n') |
class Duck:
def swim(self):
print("Duck is swimming!")
def layEggs(self):
print("Duck is laying eggs!")
class Fish:
def swim(self):
print("Fish is swimming!")
def layEggs(self):
print("Fish is laying eggs!")
class Diver:
def swim(self):
... | class Duck:
def swim(self):
print('Duck is swimming!')
def lay_eggs(self):
print('Duck is laying eggs!')
class Fish:
def swim(self):
print('Fish is swimming!')
def lay_eggs(self):
print('Fish is laying eggs!')
class Diver:
def swim(self):
print('A human... |
class main:
a = ''
def func(self):
s = ''
b = '\n\n\ntareq\n\n\n'
for i in b:
if i != '\n':
s += i
print(s)
ii = main()
ii.func()
| class Main:
a = ''
def func(self):
s = ''
b = '\n\n\ntareq\n\n\n'
for i in b:
if i != '\n':
s += i
print(s)
ii = main()
ii.func() |
def lambda_handler(event, context):
message = event['Records'][0]['Sns']['Message']
print("handle message: " + message)
webhook_url = 'https://hookb.in/RZYdoJVodkcREEj72WqV'
http = urllib3.PoolManager()
r = http.request(
'POST',
webhook_url,
body=message.encode('utf-8'),
... | def lambda_handler(event, context):
message = event['Records'][0]['Sns']['Message']
print('handle message: ' + message)
webhook_url = 'https://hookb.in/RZYdoJVodkcREEj72WqV'
http = urllib3.PoolManager()
r = http.request('POST', webhook_url, body=message.encode('utf-8'), headers={'Content-Type': 'app... |
class Descritor:
def __init__(self, obj, set=None, get=None, delete=None):
self.obj = obj
self.set = set
self.get = get
self.delete = delete
def __set__(self, obj, val):
print('Estou setando algo')
self.obj = val
def __get__(self, obj, tipo=None):
pr... | class Descritor:
def __init__(self, obj, set=None, get=None, delete=None):
self.obj = obj
self.set = set
self.get = get
self.delete = delete
def __set__(self, obj, val):
print('Estou setando algo')
self.obj = val
def __get__(self, obj, tipo=None):
p... |
# -*- coding: utf-8 -*-
A = int(input())
B = int(input())
PROD = (A*B)
print("PROD =", PROD) | a = int(input())
b = int(input())
prod = A * B
print('PROD =', PROD) |
class Persona:
cedula = 0
nombre = ''
telefono = 0
voto = 0
def __init__(self, cd, nm, tl, vt):
self.cedula = cd
self.nombre = nm
self.telefono = tl
self.voto = vt
def getCedula(self):
return self.cedula
def getNombre(self):
return self.nomb... | class Persona:
cedula = 0
nombre = ''
telefono = 0
voto = 0
def __init__(self, cd, nm, tl, vt):
self.cedula = cd
self.nombre = nm
self.telefono = tl
self.voto = vt
def get_cedula(self):
return self.cedula
def get_nombre(self):
return self.no... |
def stingy(total_lambs):
stingyList = [1, 1]
x, total = 2, 2
while x <= total_lambs:
value = stingyList[x-1] + stingyList[x-2]
stingyList.append(value)
total += int(stingyList[x])
if total > total_lambs:
break
x+= 1
return len(stingyList)
def generou... | def stingy(total_lambs):
stingy_list = [1, 1]
(x, total) = (2, 2)
while x <= total_lambs:
value = stingyList[x - 1] + stingyList[x - 2]
stingyList.append(value)
total += int(stingyList[x])
if total > total_lambs:
break
x += 1
return len(stingyList)
de... |
class Account:
def __init__(self):
self.__blocked: bool = False
self.__bound: int = 1000000
self.__balance: int = 0
self.__max_credit: int = -1000
def deposit(self, _sum: int) -> bool:
if self.__blocked :
return False
if _sum < 0 or _sum > self.__bou... | class Account:
def __init__(self):
self.__blocked: bool = False
self.__bound: int = 1000000
self.__balance: int = 0
self.__max_credit: int = -1000
def deposit(self, _sum: int) -> bool:
if self.__blocked:
return False
if _sum < 0 or _sum > self.__boun... |
def process_sql_file(file_name):
file, string = open(file_name, "r"), ''
# for line in file, remove comments, space out '(' and ')', add line to output string:
for line in file:
line = line.rstrip()
line = line.split('//')[0]
line = line.split('--')[0]
line = line.replace('(... | def process_sql_file(file_name):
(file, string) = (open(file_name, 'r'), '')
for line in file:
line = line.rstrip()
line = line.split('//')[0]
line = line.split('--')[0]
line = line.replace('(', ' ( ')
line = line.replace(')', ' ) ')
string += ' ' + line
file.... |
# Membership, identity, and logical operations
x=[1,2,3]
y=[1,2,3]
print(x==y) #test equivalance
print(x is y) #test object identity
x=y # assignment
print(x is y) | x = [1, 2, 3]
y = [1, 2, 3]
print(x == y)
print(x is y)
x = y
print(x is y) |
'''
Created on Nov 20, 2014
This is a dummy to solve dependencies from error.py
@author: Tim Gerhard
'''
# The webfrontend does not dump errors. If this function is called anywhere, this simply doesn't matter.
def dumpError(error):
return | """
Created on Nov 20, 2014
This is a dummy to solve dependencies from error.py
@author: Tim Gerhard
"""
def dump_error(error):
return |
la_liga_goals = 43
champions_league_goals = 10
copa_del_rey_goals = 5
total_goals = la_liga_goals + champions_league_goals + copa_del_rey_goals | la_liga_goals = 43
champions_league_goals = 10
copa_del_rey_goals = 5
total_goals = la_liga_goals + champions_league_goals + copa_del_rey_goals |
# Write a program that reads a temperature value and the letter C for Celsius or F for
# Fahrenheit. Print whether water is liquid, solid, or gaseous at the given temperature
# at sea level.
type = str(input("Enter the temperature type, C for celsius or F for fahrenheit: "))
temperature = float(input("Enter the temper... | type = str(input('Enter the temperature type, C for celsius or F for fahrenheit: '))
temperature = float(input('Enter the temperature: '))
if type == 'C':
if temperature >= 0 and temperature < 100:
print('Water is liquid.')
elif temperature >= 100:
print('Water is gaseous.')
else:
pr... |
def mike():
print("hola")
mike()
mike()
mike()
mike()
mike()
| def mike():
print('hola')
mike()
mike()
mike()
mike()
mike() |
# Python3 program to count triplets with
# sum smaller than a given value
# Function to count triplets with sum smaller
# than a given value
def countTriplets(arr, n, sum):
# Sort input array
arr.sort()
# Initialize result
ans = 0
# Every iteration of loop counts triplet with
# first element... | def count_triplets(arr, n, sum):
arr.sort()
ans = 0
for i in range(0, n - 2):
j = i + 1
k = n - 1
while j < k:
if arr[i] + arr[j] + arr[k] >= sum:
k = k - 1
else:
ans += k - j
j = j + 1
return ans
if __name__... |
class UnknownResponseType(Exception):
pass
class UnknownDatetime(Exception):
pass
| class Unknownresponsetype(Exception):
pass
class Unknowndatetime(Exception):
pass |
t=int(input())
for i in range(t):
s=int(input())
m=s%12
if m==1:
print(s+11,'WS')
elif m==2:
print(s+9,'MS')
elif m==3:
print(s+7,'AS')
elif m==4:
print(s+5,'AS')
elif m==5:
print(s+3,'MS')
elif m==6:
print(s+1,'WS')
elif m==7:
... | t = int(input())
for i in range(t):
s = int(input())
m = s % 12
if m == 1:
print(s + 11, 'WS')
elif m == 2:
print(s + 9, 'MS')
elif m == 3:
print(s + 7, 'AS')
elif m == 4:
print(s + 5, 'AS')
elif m == 5:
print(s + 3, 'MS')
elif m == 6:
prin... |
def mergeSortedArrays(L, R):
sorted_array = []
i = j = 0
while i < len(L) and j < len(R):
if L[i] < R[j]:
sorted_array.append(L[i])
i += 1
else:
sorted_array.append(R[j])
j += 1
# When we run out of elements in either L or M,
#... | def merge_sorted_arrays(L, R):
sorted_array = []
i = j = 0
while i < len(L) and j < len(R):
if L[i] < R[j]:
sorted_array.append(L[i])
i += 1
else:
sorted_array.append(R[j])
j += 1
while i < len(L):
sorted_array.append(L[i])
... |
"abcd".startswith("ab") #returns True
"abcd".endswith("zn") #returns False
"bb" in "abab" #returns False
"ab" in "abab" #returns True
loc = "abab".find("bb") #returns -1
loc = "abab".find("ab") #returns 0
loc = "abab".find("ab",loc+1) #returns 2
| 'abcd'.startswith('ab')
'abcd'.endswith('zn')
'bb' in 'abab'
'ab' in 'abab'
loc = 'abab'.find('bb')
loc = 'abab'.find('ab')
loc = 'abab'.find('ab', loc + 1) |
SOLVERS = (
{
'type': 'local',
'name': 'leo3',
'pretty-name': 'Leo III',
'version': '1.4',
'command': 'leo3 %s -t %d',
},
{
'type': 'local',
'name': 'cvc4',
'command': 'cvc4 --output-lang tptp --produce-models --tlimit=%md %s',
},
... | solvers = ({'type': 'local', 'name': 'leo3', 'pretty-name': 'Leo III', 'version': '1.4', 'command': 'leo3 %s -t %d'}, {'type': 'local', 'name': 'cvc4', 'command': 'cvc4 --output-lang tptp --produce-models --tlimit=%md %s'}, {'type': 'local', 'name': 'picosat', 'command': './solvers/picosat-tptp.sh -L %d %s'}, {'type': ... |
SEED_URLS = [
"https://www.microsoft.com/en-ca/p/immortals-fenyx-rising/c07kjzrh0l7s?activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/grand-theft-auto-v-premium-edition/C496CLVXMJP8?wa=wsignin1.0&lc=4105&activetab=pivot:overviewtab",
"https://www.microsoft.com/en-ca/p/far-cry-5/br7x7mvbbqkm?... | seed_urls = ['https://www.microsoft.com/en-ca/p/immortals-fenyx-rising/c07kjzrh0l7s?activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/grand-theft-auto-v-premium-edition/C496CLVXMJP8?wa=wsignin1.0&lc=4105&activetab=pivot:overviewtab', 'https://www.microsoft.com/en-ca/p/far-cry-5/br7x7mvbbqkm?activetab=piv... |
# salva no copiateste.txt o mesmo conteudo do teste.txt
with open('teste.txt', 'r') as arquivolido:
with open('copiateste.txt', 'w') as arquivocriado:
for linha in arquivolido:
arquivocriado.write(linha)
| with open('teste.txt', 'r') as arquivolido:
with open('copiateste.txt', 'w') as arquivocriado:
for linha in arquivolido:
arquivocriado.write(linha) |
class Event:
def __init__(self, event_type, time, direction, intersection):
self.event_type = event_type
self.time = time
self.direction = direction
self.intersection = intersection
| class Event:
def __init__(self, event_type, time, direction, intersection):
self.event_type = event_type
self.time = time
self.direction = direction
self.intersection = intersection |
#write import statement for reverse string function
'''
10 points
Write a main function to ....
Loop as long as user types y.
Prompt user for a string (assume user will always give you good data).
Pass the string to the reverse string function and display the reversed string
'''
| """
10 points
Write a main function to ....
Loop as long as user types y.
Prompt user for a string (assume user will always give you good data).
Pass the string to the reverse string function and display the reversed string
""" |
day = str(input())
if (day == "Monday") or (day == "Tuesday") or (day == "Friday"):
print("12")
elif (day == "Wednesday") or (day == "Thursday"):
print("14")
else:
print("16") | day = str(input())
if day == 'Monday' or day == 'Tuesday' or day == 'Friday':
print('12')
elif day == 'Wednesday' or day == 'Thursday':
print('14')
else:
print('16') |
def two_fer(name=""):
if not name.strip():
return "One for you, one for me."
else:
return "One for {}, one for me.".format(name)
| def two_fer(name=''):
if not name.strip():
return 'One for you, one for me.'
else:
return 'One for {}, one for me.'.format(name) |
class Args:
def __init__(self, config, checkpoint):
self.cfg = config
self.checkpoint = checkpoint
self.sp = True
self.detector = "yolo"
self.inputpath = "./"
self.inputlist = ""
self.inputimg = ""
self.outputpath = "examples/res/"
self.save_im... | class Args:
def __init__(self, config, checkpoint):
self.cfg = config
self.checkpoint = checkpoint
self.sp = True
self.detector = 'yolo'
self.inputpath = './'
self.inputlist = ''
self.inputimg = ''
self.outputpath = 'examples/res/'
self.save_i... |
PANDA_MODELS = dict(
gt_joints='dream-panda-gt_joints--495831',
predict_joints='dream-panda-predict_joints--173472',
)
KUKA_MODELS = dict(
gt_joints='dream-kuka-gt_joints--192228',
predict_joints='dream-kuka-predict_joints--990681',
)
BAXTER_MODELS = dict(
gt_joints='dream-baxter-gt_joints--510055... | panda_models = dict(gt_joints='dream-panda-gt_joints--495831', predict_joints='dream-panda-predict_joints--173472')
kuka_models = dict(gt_joints='dream-kuka-gt_joints--192228', predict_joints='dream-kuka-predict_joints--990681')
baxter_models = dict(gt_joints='dream-baxter-gt_joints--510055', predict_joints='dream-baxt... |
n = int(input())
narr = list(map(int,input().split()))
ev,od = 0,0
for i in range(n):
if narr[i]%2==0: ev+=narr[i]
else: od+=narr[i]
print(od-ev) | n = int(input())
narr = list(map(int, input().split()))
(ev, od) = (0, 0)
for i in range(n):
if narr[i] % 2 == 0:
ev += narr[i]
else:
od += narr[i]
print(od - ev) |
# Here we assume that cs_array has the dimensions (n_bins, n_chans, n_seg)
# Where n_chans is the number of channels of interest
## cs_array has been filtered before this step
cs_avg = np.mean(cs_array, axis=-1)
## Take the IFFT of the cross spectrum to get the CCF
ccf_avg = fftpack.ifft(cs_avg, axis=0).real
ccf_arra... | cs_avg = np.mean(cs_array, axis=-1)
ccf_avg = fftpack.ifft(cs_avg, axis=0).real
ccf_array = fftpack.ifft(cs_array, axis=0).real
ccv_avg *= 2.0 / np.float(n_bins) / ref_rms
ccf_array *= 2.0 / np.float(n_bins) / ref_rms
ccf_resid = (ccf_array.T - ccf_avg.T).T
sample_var = np.sum(ccf_resid ** 2, axis=2) / (meta_dict['n_se... |
int_list = list(map(int, input().split()))
movement = int(input())
for i in range(movement):
int_list.append(int_list[0])
int_list.remove(int_list[0])
print(int_list)
| int_list = list(map(int, input().split()))
movement = int(input())
for i in range(movement):
int_list.append(int_list[0])
int_list.remove(int_list[0])
print(int_list) |
total = 0
count = 0
average = 0
smallest = None
largest = None
print('before largest:', largest)
while True:
inp = input('>')
if inp == "done":
break
try:
if float(inp):
total += float(inp)
count += 1
new_value = float(inp)
if largest is None o... | total = 0
count = 0
average = 0
smallest = None
largest = None
print('before largest:', largest)
while True:
inp = input('>')
if inp == 'done':
break
try:
if float(inp):
total += float(inp)
count += 1
new_value = float(inp)
if largest is None o... |
#
# PySNMP MIB module Nortel-MsCarrier-MscPassport-AlarmMIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/Nortel-MsCarrier-MscPassport-AlarmMIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:19:28 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
#... | (octet_string, object_identifier, integer) = mibBuilder.importSymbols('ASN1', 'OctetString', 'ObjectIdentifier', 'Integer')
(named_values,) = mibBuilder.importSymbols('ASN1-ENUMERATION', 'NamedValues')
(constraints_intersection, single_value_constraint, value_range_constraint, constraints_union, value_size_constraint) ... |
def insertion_sort(a):
for i in range (1,len(a)):
c=a[i]
k=i-1
while (k>=0) and (c<=a[k]) :
a[k+1] = a[k]
k=k-1
a[k+1] = c
n=int(input("Enter No. Of Elements in List :-s "))
a=[i for i in range (n)]
print ("Enter the Elements one after the other :... | def insertion_sort(a):
for i in range(1, len(a)):
c = a[i]
k = i - 1
while k >= 0 and c <= a[k]:
a[k + 1] = a[k]
k = k - 1
a[k + 1] = c
n = int(input('Enter No. Of Elements in List :-s '))
a = [i for i in range(n)]
print('Enter the Elements one after the other... |
total = int(input())
b_num = 0
b_x = 0
b_y = 0
for i in range(total):
num, x, y = map(int, input().split())
mn = num - b_num
mx = abs(x - b_x)
my = abs(y - b_y)
if mn < mx + my:
print("No")
exit()
else:
if b_num % 2 == (mx + my) % 2:
mn = num
b_... | total = int(input())
b_num = 0
b_x = 0
b_y = 0
for i in range(total):
(num, x, y) = map(int, input().split())
mn = num - b_num
mx = abs(x - b_x)
my = abs(y - b_y)
if mn < mx + my:
print('No')
exit()
elif b_num % 2 == (mx + my) % 2:
mn = num
b_x = x
b_y = y... |
# uninhm
# https://atcoder.jp/contests/abc164/tasks/abc164_c
# dictionary
a = {}
ans = 0
n = int(input())
for _ in range(n):
i = input()
ans += a.get(i, 1)
a[i] = 0
print(ans)
| a = {}
ans = 0
n = int(input())
for _ in range(n):
i = input()
ans += a.get(i, 1)
a[i] = 0
print(ans) |
class UnionFind:
def __init__(self, size):
self.parent = list(range(size))
self.component = [[i] for i in range(size)]
def root(self, i):
if self.parent[i] != i:
self.parent[i] = self.root(self.parent[i])
return self.parent[i]
def unite(self, i, j):
i, j = self.root(i), self.root(j... | class Unionfind:
def __init__(self, size):
self.parent = list(range(size))
self.component = [[i] for i in range(size)]
def root(self, i):
if self.parent[i] != i:
self.parent[i] = self.root(self.parent[i])
return self.parent[i]
def unite(self, i, j):
(i,... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class TClassStatic(object):
obj_num = 0
def __init__(self, data):
self.data = data
TClassStatic.obj_num += 1
def printself(self):
print("self.data: ", self.data)
@staticmethod
def smethod():
print("the number of obj is : "... | class Tclassstatic(object):
obj_num = 0
def __init__(self, data):
self.data = data
TClassStatic.obj_num += 1
def printself(self):
print('self.data: ', self.data)
@staticmethod
def smethod():
print('the number of obj is : ', TClassStatic.obj_num)
@classmethod
... |
# This code is connected with '18 - Modules.py'
def kgs_to_lbs(weight):
return 2.20462 * weight
def lbs_t_kgs(weight):
return 0.453592 * weight
| def kgs_to_lbs(weight):
return 2.20462 * weight
def lbs_t_kgs(weight):
return 0.453592 * weight |
n=int(input())
arr=[]
game=True
for i in range(n):
arr.append((input()))
for j in range(n):
if "OO" in arr[j]:
print("YES")
ind=arr[j].index("OO")
if ind==0 and arr[j][ind+1]=="O":
arr[j]="++|"+arr[j][3]+arr[j][4]
if ind==3 and arr[j][ind+1]=="O":
arr[j]=arr[j][0]+arr[j][1]+"|"+"++"
game=False
break... | n = int(input())
arr = []
game = True
for i in range(n):
arr.append(input())
for j in range(n):
if 'OO' in arr[j]:
print('YES')
ind = arr[j].index('OO')
if ind == 0 and arr[j][ind + 1] == 'O':
arr[j] = '++|' + arr[j][3] + arr[j][4]
if ind == 3 and arr[j][ind + 1] == '... |
class A:
def spam(self):
print('A.spam')
class B(A):
def spam(self):
print('B.spam')
super().spam() # Call parent spam()
class C:
def __init__(self):
self.x = 0
class D(C):
def __init__(self):
super().__init__()
self.y = 1
d = D()
print(d.y)
class Bas... | class A:
def spam(self):
print('A.spam')
class B(A):
def spam(self):
print('B.spam')
super().spam()
class C:
def __init__(self):
self.x = 0
class D(C):
def __init__(self):
super().__init__()
self.y = 1
d = d()
print(d.y)
class Base:
def __init... |
foo = [25, 68, 'bar', 89.45, 789, 'spam', 0, 'last item']
print(foo[0], ' FIRST ITEM')
print(foo[len(foo) - 1], ' LAST ITEM') | foo = [25, 68, 'bar', 89.45, 789, 'spam', 0, 'last item']
print(foo[0], ' FIRST ITEM')
print(foo[len(foo) - 1], ' LAST ITEM') |
# Copyright 2017 Citrix Systems
#
# 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 agr... | def set_host_enabled(session, enabled):
args = {'enabled': enabled}
return session.call_plugin('xenhost.py', 'set_host_enabled', args)
def get_host_uptime(session):
return session.call_plugin('xenhost.py', 'host_uptime', {})
def get_host_data(session):
return session.call_plugin('xenhost.py', 'host_da... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.