Skip to content

Instantly share code, notes, and snippets.

View rjshekar90's full-sized avatar

Raja Shekar rjshekar90

View GitHub Profile
from itertools import combinations
s,k=input().split(' ')
s=list(s)
s.sort()
for i in range(1,int(k)+1):
for j in list(combinations(s,i)):
print(*j, sep='')
from itertools import permutations
s,k = input().split(" ")
per = permutations(sorted(s), int(k))
[print (*i, sep="") for i in per]
from itertools import product
A=list(map(int,input().split()))
B=list(map(int,input().split()))
print(*product(A,B))
*******************************************
A = map(int,raw_input().split())
import cmath
a = complex(raw_input())
print abs(complex(a))
print cmath.phase(complex(a))
a = set(map(int, raw_input().split()))
for i in range (int(input())):
b = set(map(int, raw_input().split()))
answer = set(b - a)
if(len(answer)) == 0:
if len(a) > len(b):
ans = "True"
else : ans = "False"
print ans
for i in range(int(input())):
a = int(input()); A = set(input().split())
b = int(input()); B = set(input().split())
if(len(A.difference(B))==0):
print("True")
else:
print("False")
from collections import Counter
input()
print {v: k for k, v in Counter(map(int, raw_input().split())).iteritems()}[1]
N = int(input())
A = set(map(int, input().split()))
k = int(input())
for i in range(k):
command = input().split()
S = set(map(int, input().split()))
if command[0] == 'intersection_update':
A.intersection_update(S)
a = int(input())
x = set(map(int, input().split()))
b = int(input())
y = set(map(int, input().split()))
z = x.symmetric_difference(y)
a = int(input())
x = set(map(int, input().split()))
b = int(input())
y = set(map(int, input().split()))
z = x.difference(y)