Skip to content

Instantly share code, notes, and snippets.

View zigzackey's full-sized avatar

Keita Yamazaki zigzackey

View GitHub Profile
ope = {"+": lambda a, b: b + a,
"-": lambda a, b: b - a,
"*": lambda a, b: b * a}
stack = []
for c in input().split():
if c in ope:
stack.append(ope[c](stack.pop(), stack.pop()))
else:
stack.append(int(c))
def push(x):
global stack
stack.append(x)
def pop():
global stack
ret = stack.pop()
return ret
from collections import deque
if __name__ == '__main__':
n, q = map(int, input().split())
Q = deque()
for i in range(n):
name, time = input().split()
Q.append([name, int(time)])
# -*- coding: utf-8 -*-
from collections import deque
if __name__ == '__main__':
n = int(input())
L = deque()
for i in range(n):
cmdline = input().split()
# -*- coding: utf-8 -*-
if __name__ == '__main__':
l = input()
S1, S2 = [], []
sum = 0
n = len(l)
for i in range(n):
def linearSearch(A, n, key):
i = 0
A.append(key)
while (A[i] != key):
i += 1
del A[n]
return i != n
def binarySearch(A, n, key):
left = 0
right = n
while (left < right):
mid = (left + right) // 2
if (key == A[mid]):
return 1
if (key > A[mid]):
left = mid + 1
if __name__ == '__main__':
n = int(input())
dic = set()
for i in range(n):
Cmd, Key = input().split()
if Cmd == "insert":
dic.add(Key)
else:
def check(P):
global k, T, n
i = 0
for j in range(k):
s = 0
while s + T[i] <= P:
s += T[i]
i += 1
if (i == n):
# -*- coding: utf-8 -*-
class ExhaustiveSearch:
def solve(self, A, M):
for m in M:
if self.search(0, m):
print("yes")
else:
print("no")