This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def r(a,b): | |
al = a[-2:] | |
bl = b[-2:] | |
if len(a)>=2 and len(b) >=2: | |
return al==bl | |
return False | |
f = int(input()) | |
arr = [] | |
for i in range(4): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def r(a,b): | |
al = a[-2:] | |
bl = b[-2:] | |
if len(a)>=2 and len(b) >=2: | |
return al==bl | |
return False | |
def way(a,b,c,d): | |
if r(a,b) and r(c,d): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gip(msk,adrs): | |
ma = [int(i) for i in msk.split(".")] | |
da = [int(i) for i in adrs.split(".")] | |
res = "" | |
for j in range(4): | |
c = ma[j]&da[j] | |
if j!=3: | |
res += str(c) + "." | |
else: | |
res += str(c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dist(ax,ay,bx,by): | |
if ax==bx: | |
return abs(ay-by) | |
elif ay==by: | |
return abs(ax-bx) | |
else: | |
return ((ax-bx)**2+(ay-by)**2)**0.5 | |
def ka(ax,ay,bx,by): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dist(ax,ay,bx,by): | |
return ((ax-bx)**2+(ay-by)**2)**0.5 | |
def abc(ax,ay,bx,by): | |
b = ay-by | |
a = bx-ax | |
c = -a*ay-b*bx; | |
return [a,b,c] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = input() | |
lts = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
if s[0] in lts and s[1:4].isdigit() and s[4] in lts and s[5] in lts: | |
print("Yes") | |
else: | |
print("No") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n, m, v, u = [int(i) for i in input().split()] | |
v -= 1 | |
u -= 1 | |
arr = [[0 for i in range(n)] for j in range(n)] | |
for i in range(m): | |
a, b = [int(i) - 1 for i in input().split()] | |
arr[a][b] = 1 | |
arr[b][a] = 1 | |
k = int(input()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input() | |
a = int(input()) | |
i = 1 | |
while True: | |
b = a^i | |
if b!=a: | |
print(i,b) | |
break | |
i += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input()) | |
a = [int(i) for i in input().split()] | |
c = 0 | |
if n==1: c = a[0] | |
else: c = a[0]^a[1] | |
i = 1 | |
while True: | |
b = c^i | |
if b!=c: | |
print(i,b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n = int(input()) | |
a = [int(i) for i in input().split()] | |
c = 0 | |
for i in a: | |
c = c ^ i | |
i = 1 | |
while True: | |
d = c^i | |
if d not in a and i not in a: |