python_history
python_history
exit()
import sys
sys.call(date)
sys
x = "123"
x[:-1]
x[:-2]
quit()
version
quit()
hex(4)
hex(04)
hex(4)
exit
exit()
1/6
0.1666666 == (1/6)
0.166666666666666666 == (1/6)
0.16666666666666 == (1/6)
0.16666666666666 == round((1/6), 3)
0.167 == round((1/6), 3)
1.0 == 1
round(1.0, 3)
round(1.1, 3)
exit()
10/6
exit()
3/5
5/8
3/5exit
exit()9
exit()
0 == False
exit()
False == False
exit()
float(6)
int(6.3)
int("6.3")
float("6")
exit()
import sys
sys.getsizeof(0)
sys.getsizeof(100)
sys.getsizeof(str())
sys.getsizeof("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaA")
sys.getsizeof("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
sys.getsizeof(b)
b = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
len(b)
b = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
sys.getsizeof(b)
exit()
import ctypes as ct
ct.pointer
class Name:
def __init__(self):
x = 1
name = Name()
ct.pointer(name)
class Name:
exit()
int(" 01")
exit()
d = {1: 2}
x = d[1]
x = 3
print(d)
d = {"P": {"D":"X"}}
d["P"]["D"]
y = d["P"]["D"]
y = 3
print(d)
from ASTinput import DictWrapper
from ASTinput import DictionaryWrapper
d = DictionaryWrapper
d.GetReference()
d = DictionaryWrapper()
d.GetReference()
x = d.GetReference()
x = {x: {"g": "f"}}
x = {"x": {"g": "f"}}
print(d.dict)
print(d.ict)
print(d.Dict)
x = d.GetReference
exit9)
exit()
from ASTinput import DictionaryWrapper
d = DictionaryWrapper(_
d = DictionaryWrapper()
x = d.GetReference()
x = {"y": "g"}
d.Dict
exit()
d = {"x": "g"}
f = d["x"]
f = "w"
d
d = {"x": {"g": "f"}}
f = d["x"]
f = d.get("x")
f["g"] = "g"
d
g = d
g["x"] = "g"
d
exit()
from ASTinput import Input
self.ProgramDict
ASTinput.ProgramDict
input.ProgramDict
input
input = Input()
input
input.ProgramDict
input.ProgramDict = {"x": {"g" : {"f" : "m"}}}
ref = input.Get((
ref = input.Get()
exit()
from ASTinput import Input
input = Input()
input.ProgramDict = {"x": {"g": {"h": "m"}}}
ref = input.Get()
ref = input.Get("x")
erf
ref
ref["x"] = "g"
ref
input.ProgramDict
input.ProgramDict = {"x": {"f": {"g": "m"}}
input.ProgramDict = {"x": {"f": {"g": "m"}}}
input.SectionReference = ["x", "f"]
input.Get("g")
m = input.Get("g")
m = {"g": "x"}
input.ProgramDict
_start = x
_start = "g"
__ = "g"
!s
exit()
x = 1
y = x
y += 1
x
x = [1]
y = x
y[0] += 1
x
exit9()
exit()
x = [{}]
y = x
y[0] = {"x":"y"}
x
x = [{}
x = [{}]
x = [{"x": "y"}]
y =x
y["x"] = "g"
y[0]["x"] = "g"
x
y = x
x = {"x":"g"}
y = x
y["x"] = "f"
x
import ASTinput.py
import ASTinput
input = ASTinput.input()
input = ASTinput.Input()
input.ReadIn("ifstatement.ast")
input.ASTProgram
exit()
import StandardLibrary
StandardLibrary.Print({"Arguments": {"object": "here"}}
)
StandardLibrary.Print("\"here\""}
StandardLibrary.Print("\"here\"")
exit()
import StandardLibrary
StandardLibrary.Print("\"here\"")
StandardLibrary.Print({"Argument": {"object": "\"here\""}})
StandardLibrary.Print({"object": "\"here\""}, "object")
exit()
li = [[0,1],2]
ptr = li[0][1]
new_list = [ptr]
d = {"field": ptr}
d["field"] = 3
li
ptr = 3
li
li = [[0,1],2]
ptr = li[0][1]
ptr = 3
li
li = [0,1,3]
ptr = li[0]
ptr= = 3
ptr= 3
li
class g:
def __init__(self):
m = 1
def m(g):
g.m += 1
f = g()
m(f)
class g:
def __init__(self):
self.m = 1
f = g()
m(f)
f.m
exit()
"List[int]".split("[")
type(1)
type(1) in [int]
x = str.split
x("m", "m")
x("m")
x("fad", "a")
exit()
class M:
def __init__(self):
self.g = 1
x = M()
class M:
def __init__(self):
self.g = 1
def Get(self):
return self.h
class M:
def __init__(self):
self.g = 1
def Get(self):
return self.g
x = M()
y = x.Get()
y += 1
x.g
class Variable:
def __init__(self, constructor, mutabilty):
self.Value = constructor
self.Mutabilty = mutabilty
def Copy(self):
return Variable(self.Value, self.Mutabilty)
class Variable:
def __init__(self, constructor, mutabilty):
self.Value = constructor
self.Mutabilty = mutabilty
def Copy(self):
return Variable(self.Value, self.Mutabilty)
class Variable:
def __init__(self, constructor, mutability):
self.Value = constructor
self.Mutability
Variable()
class m:
def __init__(self, g):
self.g = g
x = m
x()
x = x(1)
x
exit()
import 15
import 15.py
exit()
2 ** 1000
x = list(str(2**1000))
x
x = list(map(int, x))
sum(x)
exit()
import dis
dis.dis
def add(a, b):
x = a + b
return x
dis.dis(add)
def caller():
add(1,2)
dis.dis(caller)
def caller():
add(1,2)
dis.dis(caller)
dis.dis(add)
def definer():
def add(a, b):
return a + b
dis.dis(definer)
import dis
def add():
res = 1 + 2 + 3 + 4 + 5
return res
x = 1
y = 2
z = 3
a = 4
b = 5
def add():
res = x + y + z + a + b
return res
dis.dis(add)
def add():
x += 1
return x
dis.dis(add)
exit
exit()
def a():
print()
import dis
dis.dis(a)
exit()
bool(5)
import dis
def a(x, y):
return x + y
def b():
return a(1,2)
dis.dis(b)
import dis
def a():
x = 1 + 1
return x
a()
dis.dis(a0
dis.dis(a)
def a():
x = 1
x += 9999
return x
dis.dis(a)
a = [1,2,3,4]
dis.dis(a0
dis.dis(a)
import dis
dis.dis(a)
def b():
a = [1,2,3,"Hel"]
dis.dis(b)
exit()
import itertools
itertools.chain_from_iterable(["abc"]
)
itertools.chain_from_iterable(["abc"])
from itertools import chain
itertools.chain_from_iterable(["abc"])
chainfrom_iterable(["abc"])
chain.from_iterable(["abc"])
list(chain.from_iterable(["abc"]))
list(chain.from_iterable(["ad","bd","cd"]))
[chain.from_iterable(["a", "b", "d"]) if item == "b" else [item] for item in a])
[chain.from_iterable(["a", "b", "d"]) if item == "b" else [item] for item in a]
a = ["b", "c"]
[chain.from_iterable(["a", "b", "d"]) if item == "b" else [item] for item in a]
list([chain.from_iterable(["a", "b", "d"]) if item == "b" else [item] for item in
a])
[list(chain.from_iterable(["a", "b", "d"])) if item == "b" else [item] for item in
a]
list(chain.from_iterable(["a", "b", "d"]) if item == "b" else [item] for item in a)
list(["a"], ["b"]
)
list(["a"], ["b"])
list(chain.from_iterable(["a", "b", "d"] if item == "b" else [item] for item in a))
a = ["xfg", "mgf"]
list(chain.from_iterable(["a", "b", "d"] if item == "b" else [item] for item in a))
list(chain.from_iterable(["a"] for item in a))
b = ["cde"
]
b = ["cde"]
a = ["a", b", "c"]
a = ["a", "b", "c"]
list(chain.from_iterable([[a+b for l in a] for letter in b]))
list(chain.from_iterable([[l+letter for l in a] for letter in b]))
list(chain.from_iterable([[l+letter for l in a] for letter in "cde"]))
list(chain.from_iterable([["ab"], ["ac"]])
)
chain.from_iterable("abc")
list(chain.from_iterable("abc"))
a = ["a", "b", "c"]
b = ["p", "q", "r", "s"]
list( chain.from_iterable( [ [string + letter for string in a ] for letter in
b ] ) )
sum([["a", "b"]], [])
sum([["a", "b"], ["c"]], [])
a = [1,2,3]
b = a[:1]
b
b[0] = 2
a
exit(
)
import random
random.randint(0,0)
a = 0
random.randint(0,a)
exit()
print('\x1b[38;2;255;0;255mMAGENTA\x1b[0mnormal')
print('\x1b[38;2;255;0;255mMAGENTA\x1b[0m')
print('\x1b[38;2;255;0;255mendline\x1b[0m')
print('\x1b[38;2;255;0;255mxeros\x1b[0m')
print('\x1b[38;2;255;0;255mfor x in range(100):\x1b[0m')
exit()
import shutil
shutil.get_terminal_size()
exit()
import shutil
shutil.get_terminal_size()
list(shutil.get_terminal_size())
a = [1,2,3]
a[:-1
]
exit()
choice = input ("Is it ")
CURSOR_UP_ONE = '\x1b[1A'
ERASE_LINE = '\x1b[2K'
print CURSOR_UP_ONE + ERASE_LINE + 'Is it ' + str(choice) + '?'
print(CURSOR_UP_ONE + ERASE_LINE + 'Is it ' + str(choice) + '?')
CURSOR_UP_ONE = '\x1b[1A'
print(CURSOR_UP_ONE + ERASE_LINE + 'Is it ' + str(choice) + '?')
exit()
int(b'\x01')
(b'\x01'
b'\x01'
str(b'\x01')
b'\x01'
list(b'\x01')
list(b'\x00')
exit()
import t
exit()
from t import getchgetggggggggggggggg
exit()
0^0
1^0
1^1
1 &= ~1
a = 1
a &= ~1
a
a &= ~1
a
a = ~1
a
exit()
~1
~0
exit
exit()
import sys
sys.stdin.read(10)
sys.stdin.read(1)
[A
sys.stdin.read(1)
exit()
ord('\x1b')
exit()
import sys
sys.stdin.read()
"ä".upper()
",".lower()
exit()
"ß".upper()
exit()
import platfomr
import platform
platform.__name__
platform.system()
exit()
\x1b[${bg};2;${red};${green};${blue}m\n
print(\x1b[${bg};2;${red};${green};${blue}m\n)
print("\x1b[${bg};2;${red};${green};${blue}m\n")
print("\x1b[${bg};2;{red};${green};${blue}m\n")
e = \e[38;1;1;1;1m
e = "\e[38;1;1;1;1m"
e = "\033[38;1;1;1;1m"
print(e + "Here")
e = "\033[38;1;1;1;100m"
print(e + "Here")
e = "\033[38;2;100;100;100m"
print(e + "Here")
int("AO")
int("1A")
hex("1A")
hex(3)
hex(03)
hex(0x3)
int('0x3)
int('0x3')
int('0x3', 4)
int('10FF00', 16)
int('10', 16)
exit()
a = [input() for _ in range(20)]
#ec0e0e
#ed2e00
#ed4200
#eb5200
#e96000
#e66e00
#e17c00
#dc8800
#d69400
#cf9f00
#c8a900
#c0b400
#b7bd00
#aec700
#a2d100
#95da00
#85e400
#6eed00
#54f600
#24ff00
a
exit()
a = [input() for _ in range(21)]
#ec0e0e
#ed2d00
#ed4000
#ec5000
#ea5e00
#e76b00
#e37800
#de8400
#d88f00
#d29a00
#cca400
#c5ae00
#bdb800
#b4c100
#aaca00
#9fd300
#92dc00
#82e500
#6cee00
#52f700
#24ff00
a
import gradient
exit()
a = [int(l[0] + l[1], 16) for index in range(0, len(l := [list(input()[1:]) for _
in range(21)], 2)]
a = [int(l[0] + l[1], 16) for index in range(0, len(l := ([list(input()[1:] for _
in range(21)]), 2)]
a = [int(l[0] + l[1], 16) for index in range(0, len(l := ([list(input()[1:]) for _
in range(21)]), 2)]
a = [int(l[0] + l[1], 16) for index in range(0, len(l := ([list(input()[1:]) for _
in range(21)])), 2)]
a = [list(input()[1:] for _ in range(21)]
a = [list(input()[1:]) for _ in range(21)]
#ec0e0e
#ed2d00
#ed4000
#ec5000
#ea5e00
#e76b00
#e37800
#de8400
#d88f00
#d29a00
#cca400
#c5ae00
#bdb800
#b4c100
#aaca00
#9fd300
#92dc00
#82e500
#6cee00
#52f700
#24ff00
a
b = [int(a[index] + a[index + 1], 16) for index in range(0, len(a), 2)]
int("ec", 16)
b = [int(a[index] + a[index + 1]) for index in range(0, len(a), 2)]
b = [int(_[index] + _[index + 1], 16) for index in range(0, 6, 2) for _ in a]
b
b = [[int(_[index] + _[index + 1], 16)] for index in range(0, 6, 2) for _ in a]
b
b = [[int(_[index] + _[index + 1], 16) for index in range(0, 6, 2)] for _ in a]
b
import gradient
gradient.format()
from gradient o
from gradient import format
len(format("100", 100))
from gradient import format
len(format("100", 100))
exit()
from gradient import format
len(format("100", 100))
len(format("100", 100).strip())
len(format("100", 100).rstrip())
len(format("10", 100))
len(format("", 100))
len(format("", 10))
len(format("", 0))
len(format("", 1))
len(format("", 2))
len(format("", 3))
gradient
gradient.gradient
from gradient import *
gradient.gradient
exit()
from gradient import *
gradient.x()
x()
exit()
bool("0")
bool("False")
len("\033[38;2;129;133;137;m")
e..................................................................................
...................................................................................
..............................................
len("\033[38;2;255;255;255;m"
exit()
from quizlet import TopBar
1.9/1.6
1.9/1
1.9/1.9
1.9/1
75-0/0.9
75/0.9
83*(1/1.9)
83*(1.9)
83/(0) + 75
0 + 75
0.9 + 75
0.9*-83 + 75
0.9*-(83.33333333333£) + 75
0.9*-(83.3333333333) + 75
0.9*-(83.3) + 75
0.5*-(83.3) + 75
0.2*-(83.3) + 75
0.1*-(83.3) + 75
0.0*-(83.3) + 75
1.5
25/1.5
0.5*(16.6) + 75
1.5*(16.6) + 75
1.1*(16.6) + 75
1.0*(16.6) + 75
0.5*(16.6) + 75
25/1.5
1.5/25
0.06*(100 - 75) + 75
1.06*(100 - 75) + 75
16.6*(1.5) + 75
min(16.6*(1.5) + 75, 100)
min(16.6*(1.5) + 76, 100)
min(int(16.6*(1.5) + 76), 100)
min(int(16.6*(1.1) + 76), 100)
min(int(16.6*(0.666) + 76), 100)
min(int(16.6*(1/0.666) + 76), 100)
(int(16.6*(1/0.666) + 76)
g
int(16.6*(1/0.666)) + 76
int(16.6*(1/0.666)) + 75
int(16.6*(1/0.666)) + 76
exit()
2/3.4
3/3.4
2.1/3.4
2.3/3.4
2.2/3.4
1/2.2/3.4
1/(2.2/3.4)
3.4/2.2
exit()
2.2/3.4
25/16.6
25/1.6
16.6*1.5
1/0.64
exit()
2.2
exit()
a = time.time()
import time
a = time.time()
time.time() -a
int(time.time() - a)
def format_time(a):
return f"{a//60}:{a%60}"
format_time(time.time() - a)
return f"{int(a//60)}:{int(a%60)}"
def format_time(a):
return f"{int(a//60)}:{int(a%60)}"
format_time(time.time() - a)
def format_time(a):
return f"{int(a//60)}:{"0:0=2d".format(int(a%60))}"
format_time(time.time() - a)
def format_time(a):
return f"{int(a//60)}:{"{0:0=2d}".format(int(a%60))}"
format_time(time.time() - a)
def format_time(a):
return f"{"{0:0=2d}".format(int(a//60))}:{"{0:0=2d}".format(int(a%60))}"
format_time(time.time() - a)
a
format_time(time.time() - a)
a -= 50
a -= 500
format_time(time.time() - a)
float(3.4)
float(1.2)
float(1.3)
float(1.3333)
float(1.3)
f"\033[38;2;{32};{218};{218}m" + f"{TopBar.avgTime:.2f}" + f"\
033[38;2;255;255;255m"
f"\033[38;2;{32};{218};{218}m" + f"\033[38;2;255;255;255m"
len(f"\033[38;2;{32};{218};{218}m" + f"\033[38;2;255;255;255m")
exit()
class T:
def __init__(val):
self.val = val
class T:
def __init__(val):
class T:
def __init__(self, val):
self.val = val
a = T(1)
b = a
a = T(2)
v
b
b.val
exit()
min([1]+[2])
bool(0)
bool(2)
bool(-1)
1 * True
1 * False
a = [1,2]
a[True]
a[False]
a = [1,2,3]
a = [1,2,3,4,5]
prev = 2
h = [index for index, _ in a if _ == min(a[:prev] + a[prev+1:])] + [index +
len(a[:prev]) for index, _ in a if _ == min(a[:prev] + a[prev + 1:])]
h = [index for index, _ in enumerate(a) if _ == min(a[:prev] + a[prev+1:])] +
[index + len(a[:prev]) for index, _ in enumerate(a) if _ == min(a[:prev] + a[prev +
1:])]
h
h = [index for index, _ in enumerate(a[:prev]) if _ == min(a[:prev] + a[prev+1:])]
+ [index + len(a[:prev]) for index, _ in enumerate(a[prev+1:]) if _ == min(a[:prev]
+ a[prev + 1:])]
h
h = [index for index, _ in enumerate(a[:prev]) if _ == min(a[:prev] + a[prev+1:])]
+ [index + len(a[:prev]) for index, _ in enumerate(a[prev+1:]) if _ == min(a[:prev]
+ a[prev + 1:])]
a = [1,2,1,3,1,1]
h = [index for index, _ in enumerate(a[:prev]) if _ == min(a[:prev] + a[prev+1:])]
+ [index + len(a[:prev]) for index, _ in enumerate(a[prev+1:]) if _ == min(a[:prev]
+ a[prev + 1:])]
h
h = [index for index, _ in enumerate(a[:prev]) if _ == min(a[:prev] + a[prev+1:])]
+ [index + len(a[:prev]) + 1 for index, _ in enumerate(a[prev+1:]) if _ ==
min(a[:prev] + a[prev + 1:])]
h
x = list([])
x
y = [1,2,3,4]
x = list(y)
x
x.append)5)_
x.append(5)
y
x
kind
aîné
elder
amour l’ (m)
love
s’appeler
to be called
avoir...ans
to be...years old
barbe la
beard
bavard
chatty/talkative
beau/belle/bel
beautiful
beau-père le
step-father
belle-mère la
step-mother
bête
stupid, silly
bouclé
curly
célibataire
single
cheveux les (m)
hair
copain le/copine la
friend, mate
court
short
demi-frère le
half-brother
demi-sœur la
half-sister
se disputer
to argue
dire
to say, tell
égoïste
selfish
ensemble
together
s’entendre (avec)
to get on (with)
fâché
angry
se faire des amis
to make friends
femme la
wife/woman
fille la
daughter/girl
fils le
son
frisé
curly
généreux/généreuse
generous
gentil/gentille
kind, nice
grand-mère la
grandmother
grand-père le
grandfather
grands-parents les (m)
grandparents
gros/grosse
fat
heureux/heureuse
happy
injuste
unfair
jeune
young
joli
pretty
laid
ugly
long/longue
long
lunettes les (f)
glasses
mari le
husband
se marier
naughty
mi-long
medium length
mort
dead
naissance la
birth
né(e) le...
born on the...
nom le
name
paresseux/paresseuse
lazy
partager
to share
partenaire le/la
partner
pénible
annoying
petit ami le
boyfriend
petite amie la
girlfriend
petite-fille la
grand-daughter
petit-fils le
grandson
prénom le
first name
raide
straight
rapports les (m)
relationships
sens de l’humour le
sense of humour
séparé
separated
sortir
to go out
sportif/sportive
sporty
sympa
kind, nice
de taille moyenne
medium height
tante la
aunt
timide
shy
tranquille
quiet, calm
travailleur/travailleuse
hard-working
triste
sad
unique
only
vieux/vieil/vieille
old
yeux les (m)
def x():
while input():
x+=1
print(x)
def x():
x = 0
while input():
x += 1
print(x)
x()
kind
aîné
elder
amour l’ (m)
love
s’appeler
to be called
avoir...ans
to be...years old
barbe la
beard
bavard
chatty/talkative
beau/belle/bel
beautiful
beau-père le
step-father
belle-mère la
step-mother
bête
stupid, silly
bouclé
curly
célibataire
single
cheveux les (m)
hair
copain le/copine la
friend, mate
court
short
demi-frère le
half-brother
demi-sœur la
half-sister
se disputer
to argue
dire
to say, tell
égoïste
selfish
ensemble
together
s’entendre (avec)
to get on (with)
fâché
angry
se faire des amis
to make friends
femme la
wife/woman
fille la
daughter/girl
fils le
son
frisé
curly
généreux/généreuse
generous
gentil/gentille
kind, nice
grand-mère la
grandmother
grand-père le
grandfather
grands-parents les (m)
grandparents
gros/grosse
fat
heureux/heureuse
happy
injuste
unfair
jeune
young
joli
pretty
laid
ugly
long/longue
long
lunettes les (f)
glasses
mari le
husband
se marier
naughty
mi-long
medium length
mort
dead
naissance la
birth
né(e) le...
born on the...
nom le
name
paresseux/paresseuse
lazy
partager
to share
partenaire le/la
partner
pénible
annoying
petit ami le
boyfriend
petite amie la
girlfriend
petite-fille la
grand-daughter
petit-fils le
grandson
prénom le
first name
raide
straight
rapports les (m)
relationships
sens de l’humour le
sense of humour
séparé
separated
sortir
to go out
sportif/sportive
sporty
sympa
kind, nice
de taille moyenne
medium height
tante la
aunt
timide
shy
tranquille
quiet, calm
travailleur/travailleuse
hard-working
triste
sad
unique
only
vieux/vieil/vieille
old
yeux les (m)
exit()
class A:
def __init__(self):
self.x = 1
class B(A):
pass
x = B()
x.x
exit()
a = ["Dog" + str(i) + "\n" for i in range(100)]
a
import math
8 * (10 ** 6)
x = 8 * (10 ** 6)
clear
import sys
new = math.log(x, 2)/math.log(10, 2)
nwe
new
new = math.log(2**x, 2)/math.log(10, 2)
new
new = math.log(x, 2)/math.log(10, 2)
new
v = [[0] * 5] *5
v
v[0][0] = 1
v
exit()
60/10
60/100
1000/60
16.6/100
16.6/1000
1/0.0166
33.3/1000
x = 33.3/1000
1/x
1666
15
1666/15
16.6
1000/16.6
2000/16.6
2000/16.60
2000/16.6/
2000/16.6/1
ms/average_frame_time/(ms/1000)
ms = 3000
average_frame_time = 33.3
ms/average_frame_time/(ms/1000)
average_frame_time = ms/frame_count
frame_count = 90
average_frame_time = ms/frame_count
ms/average_frame_time/(ms/1000)
frame_time/(ms/1000)
frame_count/(ms/1000)
1000/60
1000/120
1000/500
1000/1000
16.6/1000
1000/0.01
exit()
1060312871
1000/1060312871
stopwatch.Elapsed.TotalMilliseconds/1000;
1000/5
200/1000
1920/16
1280/8
120 * 160
1920 * 1080
x = 1920 * 1080
x/=8
x
x /= (10 ** 6)
x
x = 1920 * 1080 * 8
x
x /= 8
x /= ( 10 ** 6)
x
16 * 8
1920/16 * 1080/8
128 * 16200
2 ** 16
2 * 8
2 ** 8
1920 * 1080
4 * 1920 * 1080
x = 8294400
x /= 8
x /= (10 ** 6)
x
2 ** 32
2 ** 16
2400 * 1800
2 ** 32
max_size = 2 ** 32
max_size /= 4000
max_size
max_size * 4000
max_size ** 0.5
max_size ** 2
max_size = 2 ** 32
max_size ** 0.4
max_size = 2 ** 32
max_size ** 0.5
max_pos = 2 ** 32
max_pso
max_pos
max_pos ** 2
max_pos = 2 ** 16
max_pos ** 2
18446744073709551616 ** 0.5
18446744073709551616 * 4 * 4
295147905179352825856 / 8
3.6893488147419103e+19 / (10 ^ 6)
3.6893488147419103e+19 / (10 * 6)
3.6893488147419103e+19 / (10 ** 6)
16 ** 2
2 ** 16
65536 ** 2
16 * 8
2 ** 16
2 ** 16 *2
2 ** 16 ** 2
65536 * 2
65536 ** 2
2 ** 32
4294967296 ** 0.5
65536.0 / 16 * 65536/ 8
2 ** 7
2 ** 1
2 ** 1 - 1
1920*1080
1920/16 * 1280/8
cells = 19200
19200/= (10 ** 6)
19200 /= (10 ** 6)
cells /= (10 ** 6)
cells
exit()
8 * (1920 / 16) * (1080 / 8)
100000 * 3
100000 * 4
10000 * 0.5
100000 * 4
400000 / 2
400000 / (10 ** 6)
100000 * 4
exit()
2 << 5
2 << 4
32 >> 45
32 >> 4
127 >> 2
128 >> 2
128 >> 4
128 / 32
128 >> 5
32 ** 0.5
log(32, 2)
import math
math.log(32, 2)
import time
array = [i for i in range(100000000)]
array = [i for i in range(10000)]
def test_shift():
for i in array:
print(i << 5)
def test_divide():
print(i / 32)
def test_divide():
for i in array:
print(i // 32)
def test():
def test(func):
s = time.time()
func()
print(time.time() - s)
test(test_divide())
s = time.time
s = time.time()
s
time.time() - s
def test(func):
s = time.time
func()
test()
test(print)
test(test_divide())
test(test_divide)
test(test_shift)
print(i << 5)
exit()
def inp():
exit()
[int(input()) for i in range(22)]
98
117
116
32
97
107
101
115
104
97
32
105
115
32
97
32
98
105
116
99
104
exit()
chr("A")
asc("A")
ord("A")
ord("B")
ord("a")
exit()
def hash(key: int):
key ^= key >> 16
key *= For a **fast 32-to-32-bit hashmap** implementation in C, one of the
most common approaches is to use open addressing with a linear or quadratic probing
strategy to resolve collisions. This ensures that the hash map remains fast and
memory efficient.
Here is a simple, efficient 32-to-32 bit hashmap implementation using open
addressing and linear probing in C:
### 1. **Hash Function**
The hash function can be very simple since we are mapping 32-bit numbers to 32-bit
numbers. A direct hash of the number itself or applying a bit-mixing algorithm can
work well.
### 2. **Open Addressing and Probing**
We'll use open addressing with linear probing, meaning that if a collision occurs
(i.e., a hash collision where two numbers produce the same hash), we simply move to
the next slot.
### Code Implementation
```c
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#define MAP_SIZE 1024 // Power of 2 size for better performance with bit masking
// Special marker to indicate empty slots
#define EMPTY_KEY 0xFFFFFFFF
// Hashmap Entry
typedef struct {
uint32_t key;
uint32_t value;
} HashMapEntry;
// The actual hashmap
typedef struct {
HashMapEntry* entries;
size_t size;
} HashMap;
// Hash function (could be more complex, but this is simple and fast)
static inline uint32_t hash_function(uint32_t key) {
// A simple and quick hash function with bit mixing
key ^= key >> 16;
key *= 0x85ebca6b;
key ^= key >> 13;
key *= 0xc2b2ae35;
key ^= key >> 16;
return key;
}
// Initialize the hashmap
HashMap* hashmap_init(size_t size) {
HashMap* map = (HashMap*)malloc(sizeof(HashMap));
map->entries = (HashMapEntry*)malloc(size * sizeof(HashMapEntry));
map->size = size;
2. **Open Addressing**: The hashmap uses open addressing with linear probing to
resolve collisions. If the index generated by the hash function is already taken,
the code simply moves to the next available slot.
3. **Empty Slot Marker**: `EMPTY_KEY` is used to indicate that a slot is empty,
allowing for quick insertion and probing.
4. **Hashmap Operations**:
- `hashmap_insert()`: Inserts a key-value pair by hashing the key, and if there
is a collision, it searches for the next available slot using linear probing.
- `hashmap_get()`: Retrieves the value associated with a given key, probing
linearly if there is a collision.
- `hashmap_free()`: Frees the allocated memory used by the hashmap.
5. **Efficiency**:
- The size of the map is a power of two (`MAP_SIZE = 1024`) to take advantage of
bitwise operations for modular arithmetic.
- Open addressing keeps the hashmap memory compact, and probing is done in
constant time on average.
### Potential Optimizations:
- **Quadratic Probing**: You could replace linear probing with quadratic probing to
reduce clustering and improve performance when the load factor increases.
- **Resize Strategy**: Add a resize mechanism to automatically expand the map when
the load factor exceeds a threshold, though this adds complexity.
- **Load Factor Tuning**: Monitor and maintain a load factor (entries/size) of
around 0.7 to minimize collisions and ensure fast lookups.
def hash(key: int) -> int:
key ^= key >> 16
key *= 0x85ebca6b
key ^= key >> 13
key *= 0xc2b2ae35
key ^= key >> 16
return key
hash(7)
hash(7) & 10
hash(6) & 10
hash(1) & 10
hash(2) & 10
hash(3) & 10
hash(255) & 10
hash(254) & 10
hash(211) & 10
hash(22) & 10
hash(212) & 10
hash(213) & 10
hash(200) & 10
hash(1) & 10
hash(-1) & 10
hash(-1) & 24
hash(-1) & 255
hash(1) & 255
hash() & 255
hash_array: list[list[int]]
24 bits of data
255 * 4
mb = (10 ** 6)
1020 / mb
255 * 255 * 4
255 * 255 * 4 / mb
0.2601 mb
2 ** 24
2 ** 16
2 ** 20
2 ** 22
2 ** 23
2 ** 24
1111 1111
2 ** 78
2 ** 8
256 ** 3 * 4
256 ** 3 * 4 / mb
hash(255) % ( 255 * 255 )
hash(254) % ( 255 * 255 )
hash(251) % ( 255 * 255 )
hash(258) % ( 255 * 255 )
hash(255) % ( 255 * 255 )
hash(0) % ( 255 * 255 )
hash(1) % ( 255 * 255 )
hash(2) % ( 255 * 255 )
hash(255* 255) % ( 255 * 255 )
[hash(i) % ( 255 * 255 ) for i in range(255 * 255)]
l = [hash(i) % ( 255 * 255 ) for i in range(255 * 255)]
l.index(max(l))
l[251
]
255 * 255
65024 * 24
65024 * 24 / mb
height = 1080
width = 1920
max_colours = (height * width)
max_colours
2073600 * 4 / mb
hash(2073600) % (max_colours)
hash(2073599) % (max_colours)
hash(11) % (max_colours)
hash(2) % (max_colours)
every_frame?
255 ** 3
snake <- struct { std::vector<colours>? }
colour struct
32 bit number
iterate over colour struct
2 ** 8
print("\033[38;2;100;100;100m")
print("\033[38;2;100;100;200m")
print("\033[38;2;100;100;20m")
exit()
1920 * 1080
mem_for_byte_per_pix = 1920 * 1080
mem_for_byte_per_pix *= 3
mem_for_byte_per_pix += 1920 * 1080
mem_for_byte_per_pix
x = [1,2,3]
x = [(1,2,3), (4,5,6)]
for i, j, k in x:
print(i, j, k)
exit()
import random
random.randint(0,9)
clear
call = random.randint
data = [int("".join([str(call(0,9)) for i in range(4)])) for _ in range(1000)]
data
max(data)/len(data)
sum(data)/len(data)
data = [int("".join([str(call(0,9)) for i in range(4)])) for _ in range(1000)]
max(data)/len(data)
sum(data)/len(data)
sum(data := [int("".join([str(call(0,9)) for i in range(4)])) for _ in
range(1000)])/len(data)
divisor = 0
divisor = 8
coord= 1
divisor += divisor * (coord == 0)
divisor
coord= 0
divisor += divisor * (coord == 0)
divisor
n = (0, 8)
j = (0, 10)
j = (0, 6)
y =1
x = y += 12
x = y += 1
32 * 1920 * 1080
66355200 / 4
exit()
8+3+4
15 * 1920 * 1080
1920 * 1080 * (3 + 4)
size = 1920 * 1080
size * 3 * 2 + size * 4
size = 649 * 480
size * 3 * 2 + size * 4
size = 640 * 480
size * 3 * 2 + size * 4
size * 3 * 2
size * 3 * 2 + size * 2
size = 1920 * 1080
size * 3 * 2 + size * 2
size * 3 * 2 + size * 1
size * 3 * 2 + size
size * 3 * 2 + size
size = 1920 * 1080
size * 3 + size * 4 + size
size * 3 + size * 4 + 1
1920 * 1090 * size
1920 * 1090 * 3
1920 * 1080
exit()
1920 * 1080]
1920 * 1080
2,073,600
2073600
20 8
20'8
20.
20. * 1
(20. * 2.) 1
(20. * 2.) + 1. * 1
(20. * 2.) + 1. * False
(20. * 2.) + 1. * False + (True * iter * (iter % 2 == 0) for iter in range(100))
(20. * 2.) + 1. * False + sum(True * iter * (iter % 2 == 0) for iter in range(100))
1920 * 1080
1920 * 1080 * 6
12 + 2
exit()
2 ** 8 ** 3
256 ** 3
1920 * 1080
256 ** 3 / 1920 * 1080
(256 ** 3) / (1920 * 1080)
exit()
import dis
def static_typing():
x = int(1)
def dynamic_typing():
x = 1
dis.dis(static_typing)
dis.dis(dynamic_typing)
def test(func):
import time
start = time.time()
for _ in range(y):
func()
print(time.time() - start)
test(static_typing)
y = 100000
test(static_typing)
test(dynamic_typing)
test(static_typing)
y = iterations = 10000000
test(static_typing)
test(dynamic_typing)
statically_typed_var: int = int(1)
statically_typed_var = "string?"
li = [1, 2, 3, 4, 5, 6
]
li = 100 * [1]
li
li[0] = 2
li
class N:
def __init__(self, v):
v = 1
class N:
def __init__(self, v):
self.v = v
li[0] = 100 * [N(1)]
li
li = 100 * [N(1)]
li
li[0] = N(2)
li
def mul_list():
li = 100 * [1]
def comp():
li = [1 for _ in range(100)]
dis.dis(mul_list)
dis.dis(com[p)
dis.dis(comp)
def x(*args):
for arg in args:
print(arg)
x(1, 2 , 3
)
exit()
index % 2
2 % 2
exit()
d = {1: 2}
list(d.values())
exit()
l = [1,2,3]
l.pop()
exit()
ord("a")
ord("a") - 96
ord("z") - 96
chr(1 + 96)
exit()
l = [(1,2), (4, 5)]
l.sorted()
sorted(l)
exit()
float('inf')
exit()
l = [1,2,3]
l[:]
k = l[:]
k.append(1)
l
k
k = l
k.append(1)
l
a = 1
b = a
b += 1
b
a
a = [1,2,3]
b = a
b.append(1)
b
a
a = [1,2,3]
0.3 + 0.4
0.1 + 0.2
import decimal
x = decimal.Decimal(77)
x
int(x(
)
int(x)
y = decimal.Decimal(88888)
decimal.Decimal(0.30
)
decimal.Decimal(0.3) + decimal.Decimal(0.2)
decimal.Decimal(0.3) + decimal.Decimal(0.1)
float(decimal.Decimal(0.2) + decimal.Decimal(0.1))
0.2
0.3
decimal.Decimal(0.3)
0.299999999999999988897769753748434595763683319091796875
print(f"0.1 {:.1f}"
print(f"0.1 {:.1f}")
exit()
ord("a")
ord("z")
exit()
ord("Z")
ord("A")
exit()
import why
MEET ME
shift_char("E", 1)
def shift_char(s, p):
new = ord(s) + p
if new > 90:
new = new - 90 + 64
return chr(new)
shift_char("E", 1)
exit()
"3,2,-1".split()
int(-1)
list(map(int, input().split()))
"3,2,-1"
list(map(int, input().split()))
exit()
l = [1,2,3]
l.remove(1)
l
l = [1,2,3, 1]
l.remove(1)
l
exit()
x = input()
...@..@........@.....@.......@...@..@..@..
x += "@"
x.split("@")
exit()
[-1] * 2
[-1] * 3
[-1] * 4
nodes = [[] for _ in range(10)]
nodes
exit()
{3: 1, 2:1, 1:8}
{3: 1, 2:1, 1:8}.values()
{3: 1, 2:1, 1:8}.keys()
{3:1}.remove(3)
l = [1]
l[2:]
l[1:]
l[0:]
["1 ", "2 "]
x = ["1 ", "2 "]
x = list(map(str.strip, x)))
x = list(map(str.strip, x))
x
y = {1: 2}
y[:]
not None
None
bool(None)
not None
data
class Data:
def __init__():
pass
Data()
class Data:
def __init__():
Data()
class Data:
def __init__(self):
reutnr
class Data:
def __init__(self):
pass
Data()
not Data()
bool(Data())
Data() == True
None == True
None == False
exit(
)
x = {1:2}.values()
exit()
" ".index("{")
" ".find("{")
" ".find(" ")
d = "(until) recently"
d.find("(")
l = d.find("(")
r = d.find(")")
d[:l] + d[r:]
d[:l] + d[r+1:]
d[:l] + d[r+1:].strip()
d = "exit (motorway)"
d[:l] + d[r+1:].strip()
d.find("motorway")
l = d.find("(")
r = d.find(")")
d
d[:l]
d[:l] + d[r:]
d[:l] + d[r + 1:]
d[:l] + d[r + 1:].strip()
(d[:l] + d[r + 1:]).strip()
data = input()
data = data[data.index("/")+1:]
data = input()
1/8
data = input()
data = data[data.index("/")+1:]
data = input()
1/8
data = input()
1/8
data = data[data.index("/")+1:]
data
import math
math.log(8, 2)
def s(string, pos1, pos2):
string = list(string)
string[pos1 - 1], string[pos2 - 1] = string[pos2 - 1], string[pos1 - 1]
return "".join(string)
s("1234", 1, 2)
exit()
def brute(n):
s = 0
for k in range(0, n+1):
for c in str(k):
if k == "7":
def brute(n):
s = 0
for k in range(0, n+1):
for c in str(k):
if c == "7":
s += 1
return s
brute(19297)
brute(1929700000000000)
brute(7)
brute(90)
brute(97)
brute(200)
brute(297)
brute(1000)
brute(1231)
brute(2231)
for _ in range(97)
f_ in range(97)
_ in range(97)
print(_ in range(97))
[_ for _ in range(97)]
brute(9000)
brute(90)
brute(200)
brute(9000)
brute(10000)
9 * 10 ** 2 + 10 ** 3
brute(9000) - brute(200) - brute(90) - brute(7)
3640 - 1900
brute(1000)
brute(2000)
brute(3000)
brute(4000)
brute(9000)
brute(100)
brute(200)
brute(9)
brute(10000)
brute(100000)
7 ** 0
brute(10)
brute(20)
brute(80)
brute(70)
brute(60)
brute(100)
brute(90)
9 * 10 ** 2 + 10
9 * 10 ** 2 + 10 ** 2
9 * 10 ** 2 + (2) * 10 ** 2
brute(1000)
brute(10)
brute(100)
brute(90)
brute(80)
brute(70)
[k for k in range(9000 + 1)]
brute(9000)
import 7.py
exit()
brute(1000)
exir
exit()
import calc.py
s
main(1000)
from calc import main
a
main()
calc.main(100))
calc.main(100)
exit()
from calc import main
1000
main(
10)
main("10")
from calc import main
main(100))
main(100)
main("100")
"100"[:-1]
"100"[:-1][::-1]
from calc import main
main("100")
main("1000")
from calc import main
main("10000")
main("100")
main("10")
exit()
[c for c in enumerate("1000")]
[c for c in enumerate([1, 0, 0, 0])]
exit()
def brute(x):
for k in range(x + 1):
for c in str(k):
s += 1
return s
def brute(x):
s = 0
for k in range(x + 1):
for c in str(k):
s += 1
return s
brute(10000)
brute(1000)
brute(100)
brute(10)
brute(10000000)
brute(100)
def brute(x):
s = 0
for k in range(x + 1):
for c in str(k):
if c == "7":
s += 1
return s
brute(100)
from calc import main
10
main("10000")
main("10007")
main("10077")
brute(77)
main(77)
main("77")
main("87")
main("70")
main(9000)
main("9000")
from calc import main
main("77")
main("7")
from calc import main
main("77")
main("87")
main("80")
brute(80)
brute(77)
brute(75)
brute(76)
brute(77)
brute(6)
brute(7)
brute(18)
brute(88)
brute(77)
main(77)
main("77")
main("90")
main("77")
from calc import main
main("77")
exit()
80/8
l = [1,2,3,4]
l[:int(len(l)/2 + 1]
l[:int(len(l)/2) + 1]
l[:int(len(l)/2)]
l[int(len(l))/2:]
l[int(len(l)/2):]
exit()
h = [False, True]
h.count(False)
exit()
10/(5-3)
x = 5
t = 3
y = 10
15/(5)
exit()
10 * 3/5 - 3
(5 * 3)/(10-5)
(9 * 14)/(9 - 4)
(9 * 14)/(9 - 4)/2
(9 * 4)/(14 - 9)
11.2
exit()
def calc():
a, b = 1, 1
while b < (40 * (10 ** 9)):
a, b = b, a + b
print(b)
calc()
def calc():
a, b = 1, 1
it = 0
while b < (40 * (10 ** 9)):
it += 1
a,b = b, a + b
print(b, it)
calc()
def fib():
ord("A")
ord("a")
ord("z")
ord("Z")
[list(map(int, input().split())) for _ in range(5)]
7 3 7 4
2 8 1 6
9 3 9 2
11 4 0 6
2 2 1 15
exit()
exit()
[x for _ in range(-10, 11)]
[x for x in range(-10, 11)]
len([x for x in range(-10, 11)])
int('inf)
int('inf')
y = "1234567"
y[int(len(y)//2):]
y[:int(len(y)//2)]
int([])
y = "1"
y[:int(len(y)//2)]
int('')
l = ["1", "2"[
]
l = ["1", "2"]
l.find("1")
l.index()
exit()
y = lambda x: x[0]
x([1,2])
y = lambda x: x[1]
x([1,2])
def move_cursor(x: int, y: int) -> None:
print(f"\033[{y};{x}H", end="")
move_cursor(1, 1)
t = (1, 1)
move_cursor(*t)
exit()
def k(x):
y = x
class M:
def __init__(self, x):
y = x
h = (1,1)
M(h)
h = (1,2)
f = M(h)
f.h
f.y
class M:
def __init__(self, x):
self.y = x
f = M(h)
f.y
h = (10,10)
f.y
exit()
import InputHandler
x = (1,2)
y = x
x = None
y
class X:
def __init__():
class X:
def __init__(self):
self.y = 1
class G(X):
def child(self):
return self.y
G()
x = G
x()
def x(1,2):
def x(p, y):
return p * y
f = lambda g: x(1, g)
f(12)
exit()
import InputHandler
asad
well
getch_handler()
getch_handler()()
getch_handler()
getch_handler()()
InputHJandler
InputHandler
InputHandler.getch
InputHandler.getch_handler()
exit
exit()
class A():
b = 1
class B(A):
a = 1
class A():
def g(self):
return A.a
class B(A):
a = 1
class B(A):
a = 1
class A():
def g(self):
return self.a
B().g()
class A():
def g(self):
return __class__.a
B().g()
class A():
a = 2
def g(self):
return self.a
B().g()
class C():
deg g(self):
class C():
def g(self)@
class C():
def g(self):
return getChar(self)
def getChar(x):
return x.character
class D(C):
character = 12
D().g()
class M(C):
character = 1
M().g()
exit()
def x(y, z = 1):
g = 1
x(1, 3)
exit()
import time
time.time()
type(time.time())
exit()
def x(y):
def g(y):
def x(y):
def g(y, m):
return y * m
return lambda j: g(5, j)
x(5)
x(5)(1)
x(5)
100/0.1
100 * 0.1
100 * 0.166
class M():
pass
M()
(M, 1, 2(
(M, 1, 2)
exit()
def func():
return 1
func
fucn
for _ in range(1000):
func
exit()
def a():
return 1
a
aa
a
t = (a, 1, 1)
t
b = 3
c = 1
t = (a, b, c)
t
c = (a, b, c)
t == c
def p():
return lambda _ : a() + _
p()
class A():
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
A(1,2,3)
A(1,2,4)
A(1,2,3)
A(1,2,3) == A(1,2,3)
A(1,2,3) == A(1,2,4)
A(1,2,3) == A(1,2,3)
x = A()
a = A(1,2,3)
b = a
a
b
class A:
def __init__():
self.y = [1,2,3,4]
g = A()
class A:
def __init__(self):
self.y = [1,2,3,4]
g = A()
x = g.y
x
x.append(5)
g.y
type[float]
type[float]x
type[float]
x; type[float]
x: type[float]
x
class A()
class A():
pass
A()
bool(A())
bool(None)
class B:
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
def __eq__(self, other):
class B:
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
def __eq__(self, other):
return all(self.a == other.a, self.b == other.b, self.c == other.c)
B(1,2,3) == B(1,2,3)
class B:
def __eq__(self, other):
return all([self.a == other.a, self.b == other.b, self.c == other.c])
B()
B(1,2,3)
class B:
... def __init__(self, a, b, c):
... self.a = a
... self.b = b
... self.c = c
... def __eq__(self, other):
... return all(self.a == other.a, self.b == other.b, self.c == other.c)
class B:
def __init__(self, a, b, c):
self.a = a
self.b = b
self.c = c
def __eq__(self, other):
return all([self.a == other.a, self.b == other.b, self.c == other.c])
B(1,2,3) == B(1,2,3)
B(1,2,3) == B(1,2,4)
c = {}
c[B(1,2,3)] = 1
exit()
import InputHandler
InputHandler.getch)handler()
InputHandler.getch)h
InputHandler.get
InputHandler.get.
InputHandler.getch_hanlder()
InputHandler.getch_hanld
InputHandler.getch_han
InputHandler.getch_handler
InputHandler.getch_handler()
InputHandler.getch_handler
InputHandler.getch_handler()
exit(()
exit()
from InputHandler import getch_handler as get_input
get_input()
get_input()exit()
exit()
class Position:
def __init__(self, x, y):
self.x = x
self.y = y
class Position:
def __init__(self, x, y):
self.y = y
self.x = x
def __hash__(self):
return hash((self.y, self.x))
data = {}
data[Position(1,2)] = 1
data[Position(1,2)]
exit()
x = (1,2)
def f(a, b):
return
f(*x)
a = {1: 2}
list(a)
1000/0.166
100/0.166
10/0.166
1/0.166
10/0.166
10/0.33
10/0.333
1000/16.6
0.1666
1000/0.1666
1000/16.6
exit()
1/60
1/0.166
10/0.166
[(1,2)] + [(2,3)]
exit()
a = {}
a[1][2] = 3
a[1] = 1
exit()
"\n" in "ada\n"
"\n" in "ada\"
"\n" in "ada"
len("ada\n")
"ada\n"[-1]
bold_print = lambda string: print( '/033[1m' + string )
bold_print("bold")
bold_print = lambda string: print( "/033[1m" + string )
bold_print("bold")
bold_print = lambda string: print( "\033[1m" + string )
bold_print("bold")
bold_print("maidfhsudafuighsdf")
bold_print("for x in range(3")
bold_print("for x in range(3)")
bold_print = lambda string: print( "\u001b[1m" + string )
bold_print("for x in range(3)")
exit()
" ".strip()
len(" ".strip())
exit()
x = fauihfuiasgfiasd"
x = "fauihfuiasgfiasd"
x[::-1]
x[::-1].find("huiaf")
x[::-1].find("hiuaf")
len(x)
len(x) - x[::-1].find(string_to_find := "hiuaf")
len(x) - x[::-1].find(string_to_find := "hiuaf") - len(string_to_find)
len(x) - x[::-1].find(string_to_find := "fiasd"[::-1]) - len(string_to_find)
x = "aba b aba"
len(x) - x[::-1].find(string_to_find := "aba"[::-1]) - len(string_to_find)
exit()
def search_back(string):
def search_back(string, o):
for i in range(len(string) - len(o) - 1, -1, -1):
if string[i:i+len(o)] == o:
return i
search_back("deafinging", "ing")
search_back("deafinginx", "inx")
def search_back(string):
def search_back(string, o):
for i in range(len(string) - len(o) - 1, -1, -1):
def search_back(string, o):
for i in range(len(string) - len(o), -1, - 1):
if string[i:i+len(o)] == o:
return i
search_back("deafinging", "ing")
def search_back(string, o):
for i in range(len(string) - len(o), -1, - 1):
if string[i:i+len(o)] == o:
exit()
"\033[5m" + "a"
"\033[1m" + "a"
"/033[1m" + "a"
"\033[1m" + "a"
print("\033[1m" + "a")
print("\033[5m" + "a")
print("\033[2m" + "a")
exit()
"adasd".replace("a", "b")
"adasd".replace("ad", "b")
"adasd".replace("ada", "b")
"adasd".replace("x", "b")
"adasd".replace("p", "b")
"adasd".replace("se", "b")
exit()
"<C><A>"
"<C><A>".split("<")
"<C><A>".split(">")
"abfahrento leave, to depart".split()
[ord(a) for a in "abfahrento leave, to depart"]
[[ord(a), a] for a in "abfahrento leave, to depart"]
"Zweibettzimmer dastwin bed room".split(chr(0x09))
chr(0x09)
"Zweibettzimmer dastwin bed room".split(\t)
"Zweibettzimmer dastwin bed room".split("\t")
exit()
f = open("unformatted-holidays.german")
f = open("unformatted-holidays.german", "r")
f.readline()
f.readline().split("\t")
exit()
12 * 13
n(n+1)
n = 1
n(n+1)
n * (n + 1)
prev_amount = 1
prev_amount * (2 + 1)
prev_amount * 2
prev_amount = 2
prev_amount * 3)
prev_amount * 3
def get_number_of_divisors(n):
factors = 1
for k in range(2, n+1):
def get_number_of_divisors(n):
factors = 1
for k in range(1, int(n/2)+1):
factors += k
def get_number_of_divisors(n):
factors = 1
for k in range(1, int(n/2)+1):
factors += k
def get_number_of_divisors(n):
factors = 1
for k in range(1, int(n/2)+1):
if n % k == 0:
factors += 1
return factors
get_number_of_divisors(28)
1 * get_number_of_divisors(1 + 1)
a = 1 * get_number_of_divisors(1 + 1)
a = a * get_number_of_divisors(a + 1)
a
a = a * get_number_of_divisors(a + 1)
a
a = 1 * get_number_of_divisors(1 + 1)
a
a = a * get_number_of_divisors(2 + 1)
a
a = a * get_number_of_divisors(3 + 1)
a
exit()
def count(n):
c = 0
for k in range(1, n+1):
if n % c == 0:
def count(n):
c = 0
for k in range(1, n+1):
if n % k == 0:
c += 1
def count(n):
c = 0
for k in range(1, n+1):
if n % k == 0:
c += 1
return c
count(1)
count(2)
count(28)
count(76576500)
int(7/10)
(int(7/10)+1) * 10
exit()
1/885
1/884
sum([[1,2]])
sum([[1,2]], start = [])
sum([[1,[2]]], start = [])
exit()
x = ""
x[0:0]
len(x[0:0])
0 > 0
def read_progress_file(language):
if language.lower() == "french":
file = "progress.french"
elif language.lower() == "german":
file = "progress.german"
else:
raise Exception("Unknown language")
file = open(file, "r")
data = file.readlines()
dictionary = {}
for line in data:
front, back, errors = line.split("-#-")
errors = len(errors.strip())
if front in dictionary:
dictionary[front][back] = errors
else:
dictionary[front] = {}
dictionary[front][back] = errors
file.close()
return dictionary
def read_progress_file(language):
if language.lower() == "french":
file = "progress.french"
elif language.lower() == "german":
file = "progress.german"
else:
raise Exception("Unknown language")
file = open(file, "r")
data = file.readlines()
dictionary = {}
for line in data:
front, back, errors = line.split("-#-")
errors = len(errors.strip())
if front in dictionary:
dictionary[front][back] = errors
else:
dictionary[front] = {}
dictionary[front][back] = errors
file.close()
return dictionary
def read_progress_file(language):
if language.lower() == "french":
file = "progress.french"
elif language.lower() == "german":
file = "progress.german"
else:
raise Exception("Unknown language")
file = open(file, "r")
data = file.readlines()
dictionary = {}
for line in data:
front, back, errors = line.split("-#-")
errors = len(errors.strip())
if front in dictionary:
dictionary[front][back] = errors
else:
dictionary[front] = {}
dictionary[front][back] = errors
file.close()
return dictionary
read_progress_file("french")
def read_progress_file(language):
if language.lower() == "french":
file = "progress.french"
elif language.lower() == "german":
file = "progress.german"
else:
raise Exception("Unknown language")
file = open(file, "r")
data = file.readlines()
dictionary = {}
for line in data:
front, back, errors = line.split("-#-")
errors = int(errors.strip())
if front in dictionary:
dictionary[front][back] = errors
else:
dictionary[front] = {}
dictionary[front][back] = errors
file.close()
def read_progress_file(language):
if language.lower() == "french":
file = "progress.french"
elif language.lower() == "german":
file = "progress.german"
else:
raise Exception("Unknown language")
file = open(file, "r")
data = file.readlines()
dictionary = {}
for line in data:
front, back, errors = line.split("-#-")
errors = int(errors.strip())
if front in dictionary:
dictionary[front][back] = errors
else:
dictionary[front] = {}
dictionary[front][back] = errors
file.close()
return dictionary
read_progress_file("french")
for key in read_progress_file("french"):
print(key)
time.sleep(1)
import time
for key in read_progress_file("french"):
time.sleep(1)
print(key)
for key in read_progress_file("french"):
print(key, read_progress_file("french")[key])
time.sleep(1.5)
for line in open("progress.french"):
print(line)
card = {1: 2}
y = card
y
t[1] = 3
y[1] = 3
card
y = card[:]
y = copy.deepcopy(card)
import copy
y = copy.deepcopy(card)
y
y[1] = 4
card
y
exit()
100
9_99_
9_100_100
exit()
"1111"[3:]
"1111"[:3]
exit()
ways_to_lose = 1 + 2 * 4
ways_to_win = 2 + 1
"C6D44A"[:2]
int("C6D44A"[:2], base=10)
int("C6D44A"[:2], base=16)
int("C6D44A"[:4], base=16)
int("C6D44A"[2:4], base=16)
int("C6D44A"[4:6], base=16)
bool(0)
bool(None)
bool(-1)
bool(300)
import brute
gcd
brute.gcd
brute.gcd(30, 50)
brute.gcd(48, 98)
exit()
import brute
brute.simplify(49, 98)
import brute
brute.simplify(49, 98)
exit()
import brute
brute.simplify(49, 980
brute.simplify(49, 98)
exit()#
import read
read_progress_file
read_progress_file("french")
read.read_progress_file("french")
data = read.read_progress_file("french")
import time
for d in data:
for b in data:
print(d)
time.sleep(1.5)
print(b)
for d in data:
for b in data[d]:
print(d)
time.sleep(1.5)
print(b)
data = read_progress_file("german")
data = read.read_progress_file("german")
for k in data:
for b in data[k]@
for k in data:
for b in data[k]:
print(b)
time.sleep(1.5)
print(k + "\n")
1300 * 1.5
1300 * 1.5
1950/60
1900 * 0.5
950.0/60
300 * 1.5
450 / 60
exit()
import InputHandler
exit()
import InputHandler
import InputHandleredexit()
exit()
import InputHandler
gethc_handler()
InputHandler.getch)_
InputHandler.getch_handler()
def is_prime(k):
for j in range(3, int(k ** 0.5) + 1):
if k % j == 0:
def is_prime(k):
for j in range(3, int(k ** 0.5) + 1, 2):
if k % j == 0:
return False
return True
is_prime(101)
is_prime(12)
is_prime(1)
is_prime(-)
is_prime(-1)
is_prime(0)
def is_truncatable(k):
import math
def is_truncatable(k):
for n in range(math.log(k, 10)):
def is_truncatable(k):
n = math.log(k, 10)
nk = k
for c in range(n):
def is_truncatable(k):
n = math.log(k, 10)
n = int(n)
v = 10 ** n
for c in range(n):
import adsd
adsd.is_truncatable(101)
adsd.is_truncatable(797)
import adsd
adsd.is_truncatable(797)
import adsd
adsd.is_truncatable(797)
import adsd
adsd.is_truncatable(797)
adsd.is_truncatable(101)
adsd.is_truncatable(1#)
adsd.is_truncatable(797)
import adsd
adsd.is_truncatable(797)
adsd.is_truncatable(101)
import adsd
adsd.is_truncatable(797)
adsd.is_truncatable(101)
n = 10
s = 0
g = 0
while s != 11:
if adsd.is_truncatable(n):
s += 1
g += n
n += 1
while s != 11:
if adsd.is_truncatable(n):
s += 1
g += n
n += 1
adsd.is_truncatable(12)
adsd.is_truncatable(11)
adsd.is_truncatable(10)
adsd.is_truncatable(13)
adsd.is_truncatable(23)
n = 11
def f():
while s != 11:
g
g = 0
s = 0
def f():
while True:
n += 1
if adsd.is_truncatable(n):
print(n)
n += 1
import adsd
adsd.is_truncatable(101)
adsd.is_truncatable(999)
adsd.is_truncatable(2)
adsd.is_truncatable(32)
_sum = 0
_number = 11
_count = 0
import adsd
while _count != 11:
if adsd.is_prime(_number):
if adsd.is_truncatable(_number):
_count += 1
_sum += _number
_number += 2
_count
_number
_sum
while s != 11:
if adsd.is_prime(_number):
_sum = 0
_number = 11
_count = 0
while _count != 11:
if adsd.is_prime(_number):
if adsd.is_truncatable(_number):
_count += 1
_sum += _number
print(_number)
_number += 2
def generate_family(n):
n = str(n)
for k in range(10):
if str(k) in n:
for k in range(1, 999_999_999):
pass
for k in range(1, int(999_999_999/2)+1):
pass
for k in range(1, int(999_999_999/2)+1):
if k % 1_000_000 == 0:
print(k)
d * 1 + d * 2 <= 999_999_999
d * 1 * (10 ** (9 - int(10 ** math.log(d, 10))+1)) + d * 2 <= 999_999_999
for k in range(100_000):
import math
for k in range(1, 100_000):
s = ""
d = 0
for k in range(100_000):
s = ""
while len(s) < 9:
for k in range(100_000):
s = ""
x = 1
while len(s) < 9:
s += str(k * x)
x += 1
if len(s) == 9:
d = max(d, int(s))
d
d = 0
f
for k in range(100_0000):
s = ""
x = 1
while len(s) < 9:
s += str(k * x)
x += 1
if len(s) == 9:
d = max(d, int(s))
d
for k in range(100_0000):
|def p38():
for m in range(9876, 9122, -1):
cat = str(m) + str(2*m)
if len(set(cat)) == 9 and '0' not in cat:
return cat
def p38():
for m in range(9876, 9122, -1):
cat = str(m) + str(2 * m)
if len(set(cat)) == 9 and '0' not in cat:
return cat
p38()
for k in range(1, 100):
s = ""
x = 1
while len(s) < 9:
s += str(k * x)
x += 1
if len(s) == 9:
d = max(d, int(s))
d
d = 0
for k in range(1, 100):
s = ""
x = 1
while len(s) < 9:
s += str(k * x)
x += 1
if len(s) == 9:
d = max(d, int(s))
d
for k in range(1, 10_000):
s = ""
x = 1
while len(s) < 9:
s += str(k * x)
x += 1
if len(set(s)) == 9:
d = max(d, int(s))
d
d = 0
for k in range(1, 10_000):
s = ""
x = 1
while len(s) < 9:
s += str(k * x)
x += 1
if len(s) == 9 and len(set(s)) == 9:
d = max(d, int(s))
d
for k in range(1, 10_000):
d = 0
for k in range(1, 10_000):
s = ""
x = 1
while len(s) < 9:
s += str(k * x)
x += 1
if len(s) == 9 and '0' not in s and len(set(s)) == 9:
d = max(d, int(s))
d
for a in range(1, 100):
for b in range(1, 100):
if (c : = (a ** 2 + b ** 2)) + (a ** 2) + (b ** 2) + 2 * a * b + 2 * a
* c + 2 * b * c <= 1000 ** 2:
if (c := (a ** 2 + b ** 2)) + (a ** 2) + (b ** 2) + 2 * a * b + 2 * a *
c + 2 * b * c <= 1000 ** 2:
5 * 7
35 * 4 * 8
35 * 5
35 * 4
exit()
ord("A"(
ord("A")
ord("S")
ord("S") - 19
ord("S") - 64
exit()
import program_44.
import program_44
program_44.is_pentagonal(0)
program_44.is_pentagonal(1)
program_44.is_pentagonal(4)
program_44.is_pentagonal(5)
program_44.is_pentagonal(145)
program_44.is_pentagonal(144)
import program_44
program_44.generate_pentagonal(1)
program_44.generate_pentagonal(2)
program_44.generate_pentagonal(3)
program_44.generate_pentagonal(8)
exit()
import program_45
program_45.is_triangle(15)
program_45.is_triangle(14)
program_45.is_triangle(16)
program_45.is_triangle(16
exit()
14 ** 0.6
14 ** 0.7
14 ** 0.6
14 ** 0.5
17 ** 2
17 ** 2 * 2
17 * 19
17 * 19 * 2
exit()
int(14 ** 0.5)
int(14 ** 0.5) + 1)
int(14 ** 0.5) + 1
int(15 ** 0.5) + 1
exit()
2 * 3 * 5 * 7
exit()
import asd
asd.prime_factors(14)
asd.prime_factors(28)
asd.prime_factors(114)
114/2
asd.prime_factors(57)
def permute(current, target_length):
if len(current) == target_length:
print(current):
def permute(current, target_length):
if len(current) == target_length:
print(current)
else:
permute(current + [0], target_length + 1)
permute(current + [1], target_length + 1)
permute([], 4)
def permute(current, target_length):
if len(current) == target_length:
print(current)
else:
permute(current + [0], target_length)
permute(current + [1], target_length)
permute([], 4)
exit()
494/8
x = input()
Actuellement, nous n’avons pas assez de temps pour déjeuner et participer aux
clubs, donc je rendrais la pause déjeuner plus longue.
J’introduirais la cuisine comme matière, parce que c’est une compétence essentielle
dans la vie, et je suis sûr que tous les étudiants l’apprécieraient.
Je garderais l'uniforme scolaire, parce que c'est important pour notre identité
comme une collège.
Pour rendre la vie des étudiants moins stressante, j’introduirais une nouvelle
règle que les étudiants doivent être informés trois semaines avant une épreuve.
exit()
triangle = lambda x: int((x ** 2 + x)/2))
triangle = lambda x: int((x ** 2 + x)/2)
triangle(11)
triangle(21)
triangle(20)
exit()
f"x{a}"
f"x{a}" % a
"x{a}" % a
"x{a}"
"x{a}" % 1
"x{a}" % "1"
"x{}" % 1
"x%a" % 1
exit()
"%l" % "number"
"%laaaaa" % "number"
exit()
{"a": "b"}.values()
list({"a": "b"}.values())
c = {"a": "b", "c": "d"}
{c[k]: c for k in c}
{c[k]: k for k in c}
exit()
lmc.as
exit()
exec("def main():\n\tprint(\"x\")")
main()
["x", "y"].join()
["x"].join()
["x"].join("")
"".join(["x", "y"]
)
exit()
class variables:
accumulator = 0
counter = 1
number = 0
one = 1
ten = 11
def loop():
variables.accumulator = variables.number
variables.accumulator += variables.counter
print(variables.accumulator);
variables.number = variables.accumulator
variables.accumulator = variables.counter
variables.accumulator += variables.one
variables.counter = variables.accumulator
variables.accumulator = variables.ten
variables.accumulator -= variables.counter
if (variables.accumulator >= 0):
return loop()
exit()
def main():
loop()
main()
"""class variables:
accumulator = 0
counter = 1
number = 0
one = 1
ten = 11
def loop():
variables.accumulator = variables.number
variables.accumulator += variables.counter
print(variables.accumulator);
variables.number = variables.accumulator
variables.accumulator = variables.counter
variables.accumulator += variables.one
variables.counter = variables.accumulator
variables.accumulator = variables.ten
variables.accumulator -= variables.counter
if (variables.accumulator >= 0):
return loop()
exit()
def main():
loop()
main()"""
x = """class variables:
accumulator = 0
counter = 1
number = 0
one = 1
ten = 11
def loop():
variables.accumulator = variables.number
variables.accumulator += variables.counter
print(variables.accumulator);
variables.number = variables.accumulator
variables.accumulator = variables.counter
variables.accumulator += variables.one
variables.counter = variables.accumulator
variables.accumulator = variables.ten
variables.accumulator -= variables.counter
if (variables.accumulator >= 0):
return loop()
exit()
def main():
loop()
main()"""
x
exec(x)
class variables:
accumulator = 1
counter = 0
variables.accumulator = variables.counter
variables.accumulator += 1
variables.counter
variables.accumulator
exit()
print(1) if 1
print(1) if 1 else pass
print(1) if 1 else 0
print(1) if 1 else -1
print(1) if 0 else -1
[print(1) if 1 else -1]
[print(1) if 1 else 0]
[print(1) if 0 else 0]
print("k")
exit()
x = 111111111
(x ** 2 + x)/2
class variables:
accumulator = 0
final = 100
counter = 0
one = 1
iteration = 0
num = 0
def mult():
while True:
variables.accumulator = variables.iteration
if (variables.accumulator == 0):
return end()
variables.accumulator -= variables.one
if (variables.accumulator == 0):
return end()
variables.accumulator = variables.final
variables.accumulator += variables.num
variables.final = variables.accumulator
variables.accumulator = variables.counter
variables.accumulator -= variables.one
variables.counter = variables.accumulator
variables.accumulator -= variables.one
if (variables.accumulator == 0):
return next()
continue
def next():
variables.accumulator = variables.final
variables.num = variables.accumulator
variables.accumulator = variables.iteration
variables.accumulator -= variables.one
variables.iteration = variables.accumulator
variables.counter = variables.accumulator
variables.accumulator -= variables.one
if (variables.accumulator == 0):
return end()
return mult()
def end():
variables.accumulator = variables.final
print(variables.accumulator);
raise Exception()
def oneval():
variables.accumulator = variables.one
print(variables.accumulator);
raise Exception()
def main():
variables.accumulator = final
if (variables.accumulator == 0):
%kreturn oneval()
variables.accumulator -= one
iteration = variables.accumulator
counter = variables.accumulator
variables.accumulator = final
num = variables.accumulator
mult()
variables.accumulator = final
num = variables.accumulator
variables.accumulator = iteration
variables.accumulator -= one
iteration = variables.accumulator
counter = variables.accumulator
variables.accumulator -= one
if (variables.accumulator == 0):
%kreturn end()
return mult()
end()
variables.accumulator = one
print(variables.accumulator);
main()
exit()
x,y,z = "a b c".split()
x
y
z
x,y,z = "a b".split()
x,y,z = "a b c".split()
x, y = [1,2,3]
exit()
type(1, int0
)
type(1, int)
typeof(1, int)
is_type(int, 1)
isinstance(1, int)
exit()
rec = lambda x: rec(x - 1) * x if x != 0 else 1
rec(0)
rec(10)
while True:
print("repeat outer")
while True:
while True:
print("repeat outer")
try:
while True:
print("repeat inner")
raise Exception()
except:
continue
exit()
import bytecode
exit()
def x():
return 1
def y():
return 2
def z():
return
functions = {0: x, 1: y, 2: z}
function = x
while True:
if (result := function()) != None:
function = functions[result]
else:
break
while True:
if (result := function()) != None:
print(result)
function = functions[result]
else:
break
function = x
while True:
if (result := function()) != None:
print(result)
function = functions[result]
else:
break
def execute_function(function):
while True:
if (result := function()) != None:
print(result)
function = functions[result]
else:
break
execute_function(x)
exit()
eval(def end():
variables.accumulator = variables.final
print(variables.accumulator)
exit()
def fac(n):
k = 1
for r in range(1, n+ 1):
k *= r
return r
)
def fac(n):
k = 1
for r in range(1, n+ 1):
k *= r
return k
fac(100))
fac(100)
exit()
2 ** 64
10 ** 11
2 * 16
2 ** 16
2 ** 32
2 ** 54
2 ** 65
exit()
10 ** 1
10 ** 11
def sum_of_divisors(n):
MOD = 10**9
# Initialize the result
result = 0
k = next_k
return result
# Example: Compute for a large number
n = 10**12
print(sum_of_divisors(n))
exit()
563576417282 % 10 ** 9
exit()
563576517282 % (10 ** 9)
d = [0] * (10 ** 11)
exit()
set(1,3,1)
set([1,3,1])
set([1,3,2])
set([(1, 'a'), (3, 'b'),2])
set([(1, 'a'), (3, 'b'), (2, 'c')])
set([(1, 'a'), (3, 'b'), (2, 'c')], sort = lambda x: x[0])
set([(1, 'a'), (3, 'b'), (2, 'c')], key = lambda x: x[0])
set([(1, 'a'), (3, 'b'), (2, 'c')])
set([(1, 'a'), (3, 'b'), (2, 'a')])
set([(1, 'a'), (3, 'b'), (1, 'a')])
set([(2, 'a'), (3, 'b'), (1, 'a')])
sorted(set([1,3,2]))
sorted(set([1,3,2]))e
exit()
.find
"a".find("a")
"a".index("a")
"a".index("n")
"a".find("n")
exit)
exit()
for k, v in [1,2,3,4]:
print(k, v)
for k, v in zip([1,2,3,4]):
print(k,v)
exit()
math.log(16, 2)
import math
math.log(16, 2)
(1) + (2)
(1,) + (2,)
(1,2)[-1]
exit()
{2: 7, 3:7}
max({2: 7, 3:7})
{2: 7, 3:7}
exit()
{1:2, 2:3}.sort()
exit()
1920/768
480 * 0.6
768 * 0.5
288 * 384
1920 * 1080
max([1,2], [2,1], key = lambda x: x[1])
exit()
[1,2][:1]
[1,2][:2 ** 0]
[1,2][:2 ** -1]
exit()
[[]] * 4
exit()
-float('inf')
exit()
int(-float('inf'))
-float('inf') > -float('inf')
-float('inf') == -float('inf')
-float('inf') == -float('inf')e
exit()
[1,2,3][:-3]
[1,2,3][::-3]
[1,2,3][:-1]
[1,2,3][-:-1]
[1,2,3][-1:0]
[1,2,3][::-1][:2]
exit()
a = 1
a = '1
a = '1'
if a == '1'
ip = input().split()
if len(ip) == 4:
try:
if all([0 <= int(k) <= 255 for k in ip]):
print("Valid IP address")
except:
print("Invalid IP address")
else:
print("Invalid IP address")
ip = input().split()
if len(ip) == 4:
try:
if all([0 <= int(k) <= 255 for k in ip]):
print("Valid IP address")
except:
print("Invalid IP address")
else:
print("Invalid IP address")
ip = input().split()
if len(ip) == 4:
try:
if all([0 <= int(k) <= 255 for k in ip]):
print("Valid IP address")
except:
print("Invalid IP address")
else:
print("Invalid IP address")
exit(
)
int("5.1")
5.1 / 0.95
int(5.1 / 0.95) * int(2.0 / 1.5)
_21 = 1
_21
exit()
1 >> 2
1 << 2
34 << 2
34 << 1
34 << 2
33 >> 2
33 >> 1
33 >> 2
33 > 1
33 >> 1
(g := 1) >> 2
g
exit()
x = []
x[0]
exit
exit()