Search is not available for this dataset
name
stringlengths
2
112
description
stringlengths
29
13k
source
int64
1
7
difficulty
int64
0
25
solution
stringlengths
7
983k
language
stringclasses
4 values
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
for _ in range(int(raw_input())): m = map(int,raw_input().split()) px = m[0] py = m[1] bx = m[2] by = m[3] if px >= bx and py >= by: print "Possible" elif py >= bx and px >= by: print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
T=int(raw_input()) for _ in xrange(T): l = [int(i) for i in raw_input().split()] if l[0]>=l[2] and l[1]>=l[3] or l[0]>=l[3] and l[1]>=l[2]: print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
for _ in range(int(raw_input())): px, py, bx, by = map(int, raw_input().split()) if (px >= bx and py >= by) or (py >= bx and px >= by): print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
t=input() for i in range(0,t): flag=0 px,py,bx,by=map(int,raw_input().split()) if(px>=bx and py>=by): flag=1 elif(px>=by and py>=bx): flag=1 if(flag): print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
n=input() for i in xrange(n): px,py,bx,by=map(int,raw_input().split()) if (px >= bx and py >= by) or(py >= bx and px >= by): print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
def f(s): s=s.split() s=map(int,s) px=s[0] py=s[1] bx=s[2] by=s[3] if px>=bx and py>=by: return "Possible" elif px>=by and py>=bx: return "Possible" else: return "Not Possible" t=int(raw_input()) for i in range(t): s=raw_input() print f(s)
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
t=input() for _ in range(t): a,b,c,d=map(int, raw_input().split()) chk=False if c<=a and d<=b: chk=True elif c<=b and d<=a: chk=True if chk: print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
x=input() for i in range(0,x): c=raw_input() C=c.split() Ax=int(C[0]) Ay=int(C[1]) Bx=int(C[2]) By=int(C[3]) if(Ax>=Ay): Amax=Ax Asmall=Ay else: Amax=Ay Asmall=Ax if(Bx>=By): Bmax=Bx Bsmall=By else: Bmax=By Bsmall=Bx if(Amax>=Bmax and Asmall>=Bsmall): print 'Possible' else: p...
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
noc = input() while noc: noc-=1 px, py, bx, by = map(int,raw_input().split()) if (px >= bx and py >= by) or (px >= by and py >= bx): print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
for tc in xrange(input()): px,py,bx,by=list(map(int,raw_input().split())) if (px>=bx and py>=by) or (px>=by and py>=bx): print('Possible') else: print('Not Possible')
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
t=input() for i in range(t): a=map(int,raw_input().split()) if (a[0]>=a[2] and a[1]>=a[3]) or(a[0]>=a[3] and a[1]>=a[2]) : print "Possible" else : print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
for t in range(input()): a,b,c,d=map(int,raw_input().split()) if (a>=c and b>=d) or (a>=d and b>=c): print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
''' # Read input from stdin and provide input before running code name = raw_input('What is your name?\n') print 'Hi, %s.' % name ''' t = int(raw_input()) for i in range(1,t+1): p = map(int,raw_input().split()) px = p[0] py = p[1] bx = p[2] by = p[3] if(px > py): maxx = px else: maxx = py if(px <= py): m...
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
t=input() for _ in range(t): a,b,c,d=map(int,raw_input().split()) if min(a,b)>=min(c,d) and max(a,b)>=max(c,d) : print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
test=int(raw_input()) while(test): flag=1 arr=map(int,raw_input().split(' ')) if(arr[0]>=arr[2]): if(arr[1]>=arr[3]): flag=0 elif(arr[0]>=arr[3]): if(arr[1]>=arr[2]): flag=0 elif(arr[0]>=arr[3]): if(arr[1]>=arr[2]): flag...
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
T = int(raw_input().strip()) while T>0: line = raw_input().strip() PointList = map(int, line.split(" ")) Px = PointList[0] Py = PointList[1] Bx = PointList[2] By = PointList[3] if (Px>=Bx and Py >=By) or (Py>=Bx and Px >=By): print "Possible" else: print "Not Possible" T = T-1
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
for T in range(input()): data = raw_input().split(' ') pX = int(data[0]) pY = int(data[1]) bX = int(data[2]) bY = int(data[3]) if (pX >= bX and pY >= bY) or (pY >= bX and pX >= bY): print 'Possible' else: print 'Not Possible'
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
class RectangleCoveringEasy: def canCover(self,boardHeight,boardWidth,holeHeight,holeWidth): if boardHeight > holeHeight and boardWidth > holeWidth: return True; elif boardHeight == holeHeight and boardWidth > holeWidth: return True; elif boardWidth == holeWidth ...
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
t = input() while t>0: t-=1 px, py, bx, by = map(int, raw_input().split()) if px >= bx and py >= by or px >= by and py >= bx: print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
for i in range(input()): s=raw_input().split(" ") px=int(s[0]) py=int(s[1]) bx=int(s[2]) by=int(s[3]) if px>=bx and py>=by: print "Possible" elif py>=bx and px>=by: print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
for i in xrange(input()): a,b,c,d=map(int,raw_input().split()) if(a>=c and b>=d) or(a>=d and b>=c): print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
class Rectangle: def canCover(self,boardHeight,boardWidth,holeHeight,holeWidth): if boardHeight > holeHeight and boardWidth > holeWidth: return True; elif boardHeight == holeHeight and boardWidth > holeWidth: return True; elif boardWidth == holeWidth and boardHei...
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
''' # Read input from stdin and provide input before running code name = raw_input('What is your name?\n') print 'Hi, %s.' % name ''' t=int(raw_input()) while t>0: a,b,c,d=[int(x) for x in raw_input().split()] if ((a>=c and b>=d) or (b>=c and a>=d)): print 'Possible' else: print 'Not Possible' t=t-1
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
x = input() for y in range(0,x): a,b,c,d = map(int,raw_input().split()) if (a>=c and b>=d) or (a>=d and b>=c): print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
for _ in xrange(input()): a,b,c,d = map(int, raw_input().split()) if(a>=c and b>=d) or (a>=d and b>=c): print "Possible" else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
T = int(raw_input()) for i in range(0,T): D = map(int,raw_input().split()) if D[0]>=D[2] and D[1]>=D[3]: print "Possible" continue elif D[0]>=D[3] and D[1]>=D[2]: print "Possible" continue else: print "Not Possible"
PYTHON
rajasthans-bawri
Bawris, are wells or ponds in which the water may be reached by descending a set of steps. They may be covered and protected and are often of architectural significance. Rajasthan has a history of maintaining bawris, but now they are of architectural significance hence ASI is interested to save a historic bawris from...
3
0
import sys for __ in range(input()) : px , py , bx , by = map(int,sys.stdin.readline().split()) first , second = 10 , 10 if px>=bx and py>=by: print "Possible" elif px>=by and py>=bx: print "Possible" else : print "Not Possible"
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
test_cases=int(raw_input()) for ite in range(test_cases): given_pair=[int(i) for i in raw_input().split()] num_operations=0 while given_pair!=[1,1] and given_pair!=[1,0] and given_pair!=[0,1]: if given_pair[0]>given_pair[1]: num_operations+=given_pair[0]//given_pair[1] given_pair[0]%=given_pair[1] else: ...
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
t = int(raw_input()) while(t>0): cnt=0 m,n = [int(i) for i in raw_input().split()] x = m y=n while(x>0 and y>0 ): if(x>y): cnt +=x//y x = x%y else: cnt +=y//x y = y%x print cnt-1 t=t-1
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
t=int(raw_input()) for i in range(t): inj=raw_input().split() a=int(inj[0]) b=int(inj[1]) ans=0 while((a>1) and (b>1)): if a>b: ans=ans+a/b a=a%b elif b>a: ans=ans+b/a b=b%a print ans+max(a-1,b-1)
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
t=int(raw_input()) while t >0 : t = t - 1 a,b = map(int, raw_input().split()) aa=a bb=b steps=0 while a>1 and b>1: if a > b: steps = steps + (a/b) a = a%b else: steps = steps + (b/a) b = b%a print steps+(abs(a-b))
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
T = int(raw_input()) while T: T=T-1 a,b=map(int,raw_input().split()) count=0 while a!=b: if a==1: count=count+b-1 break elif b==1: count=count+a-1 break elif a>b: count=count+a/b a=a%b else: count=count+b/a b=b%a print count
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
__author__ = 'siddharth' if __name__ == "__main__": T = int(raw_input()) for t in xrange(T): u, v = map(int, raw_input().split()) CT = 0 while u > 1 or v > 1: CT += u/v CT -= 0 if v != 1 else 1 t = u%v u = v v = t ...
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
''' # Read input from stdin and provide input before running code name = raw_input('What is your name?\n') print 'Hi, %s.' % name ''' #print 'Hello World!' t=int(raw_input()) for i in range(t): a,b=map(int,raw_input().split()) r=0 while([a,b]!=[1,1] and [a,b]!=[0,1] and [a,b]!=[1,0]): if(a>b): r=r+a//b a=(a...
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
def shortest_way(a,b): result = 0 while a>1 or b>1: if a>b: k=a/b a=a-k*b result = result + k else: k=b/a b=b-k*a result = result + k if result>0: result-=1; return result if __name__ == "__main__": t=int(raw_input()) while t>0: inp=map(int,raw_input().split()) (a,b) = (inp[0...
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
def gcd(a,b): if b==0: return a return gcd(b,a%b) t=input() while t>0: t=t-1 a,b=map(int,raw_input().split()) r=0 while a>0 and b>0: if a>b: r=r+a/b a=a%b else: r=r+b/a b=b%a print r-1
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
t=int(raw_input()) for i in range(0,t): x,y=map(int,raw_input().split(" ")) k=0 if x>y: a=x b=y else: a=y b=x while a>1 or b>1: k=k+a/b a=a%b a,b=b,a if a>1 and b==1: k=k+a-b a=1 if x==1: k=y-x if y==1: k=x-y print k
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
n= int(input()) for i in range(n): A,B=map(int,raw_input().split()) result=0 while A > 0 and B > 0: if A > B: result+=A / B A = (A % B) else: result+= B /A B = (B %A) print(result-1)
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
for _ in range(int(raw_input())): a,b=map(int,raw_input().split()) count=0 while a!=b: if a==1: count += b-1 break elif b==1: count += a-1 break elif a>b: count += a/b a=a%b else: count += b/a b=b%a print count
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
tc=int(input()) while tc>0: a,b=map(int,raw_input().split()) rs=0 while a>0 and b>0: if a>b: rs=rs+int(a/b) a=a%b else: rs=rs+int(b/a) b=b%a print rs-1 tc=tc-1
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
''' # Read input from stdin and provide input before running code name = raw_input('What is your name?\n') print 'Hi, %s.' % name ''' T = int(raw_input()) for _ in xrange(T): a, b = map(int, raw_input().split()) count = 0 if a < b: a, b = b, a while b != 0: count += a / b a, b = b, a % b print count - 1
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
t = input() for _ in range(t): a,b=map(int,raw_input().split()) c=0 if a < b: a, b = b, a while b != 0: c += a / b a, b = b, a % b print c -1
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
noc = input() while noc: noc-=1 a, b = map(int, raw_input().split()) c = 0 while a>0 and b>0: if a > b: c += a/b a %= b else: c += b/a b %= a c-=1 print c
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
from math import * t = (int)(raw_input()) while(t!=0): a,b = raw_input().split() a = int(a) b = int(b) count = 0 while(a != 1 and b != 1): if(a > b): c = a/b a = a - b*c count += c else: c = b/a b = b - a*c count += c count += abs(b-a) print count t = t - 1
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
t = int(input()) for x in range(t): a, b = map(int, raw_input().split()) ans = 0 while a > 0 and b > 0: if a > b: ans += a / b a= a % b else: ans += b / a b= b % a print ans - 1
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
#!/usr/bin/python def minMax(a, b): if(a-b>0): max=a min=b else: max=b min=a return max,min T=int(input()) for t in range(0,T): a,b=raw_input().split() a=int(a) b=int(b) count=0 while (True): max,min=minMax(a,b) if(max==1 and min==1): count=count+0 ...
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
t=int(raw_input()) for i in range(t): ab=raw_input().split() a=int(ab[0]) b=int(ab[1]) count=0 while a!=1 and b!=1: if a>b: count+=a/b a=a%b if a==0: break else: count+=b/a b=b%a if b==0: ...
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
t=int(raw_input()) for _ in xrange(t): a,b=map(int,raw_input().split()) ans=0 while True: if a==1 and b==1: break if a>b: ans+=int((a-1)/b) a=a-(int((a-1)/b)*b) else: ans+=int((b-1)/a) b=b-(int((b-1)/a)*a) print(ans)
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
def foo(a,b): if b==0:return 0 else:return foo(b,a%b)+a/b T=int(raw_input()) for _ in xrange(T): a,b=(int(e) for e in raw_input().split()) s=0 print foo(a,b)-1
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
from decimal import Decimal from math import sqrt T = int(raw_input()) while T>0: a,b = list(map(Decimal, raw_input().split())) count=0 if a==b==1: count=0 elif a==1 and not b==1: count=b-1 elif b==1 and not a==1: count=a-1 elif a==1 and b%10==0: count=b-1 elif a==b-1: count=a elif b==a-...
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
for _ in range(input()): a, b = map(int, raw_input().split()) res = 0 while a > 0 and b > 0: if a > b: res += a / b a %= b else: res += b / a b %= a print res - 1
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
# -*- coding: utf-8 -*- """ Created on Tue Sep 8 13:51:03 2015 @author: gangireddy """ # a is always small def minMoves(a, b): #print a, b if a == 0 or b == 0: return -1 elif min(a, b) == a: return b/a + minMoves(a,b%a) else: return a/b + minMoves(a%b,b) tc = int(raw_input())...
PYTHON
shortest-way
See Russian Translation The statement of this problem is quite short , apt and clear. We don't want any coder to spend time in reading a lengthy, boring story that has no connection with the actual problem. The problem states: Given a pair (1,1), your aim is to get a new pair (a,b) in minimum number of operations. ...
3
0
''' # Read input from stdin and provide input before running code name = raw_input('What is your name?\n') print 'Hi, %s.' % name ''' T=int(raw_input()) for i in range(T): pair=[int(i) for i in raw_input().split()] k=0 while pair!=[1,1] and pair!=[1,0] and pair!=[0,1]: if pair[0]>pair[1]: k+=int(pair[0]/pair[1...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
T=int(raw_input()); for i in range(T): N=int(raw_input()); li=map(int,raw_input().split()); count=0; for i in range(len(li)): for j in range(i,len(li)-1): if((li[i]+li[j+1])%2==0 and li[i]!=li[j+1]): count+=1; print count;
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t = int(raw_input()) for tc in xrange(1, t+1): n = int(raw_input()) a = raw_input().split() a = [int(k) for k in a] out = 0 for i in xrange(len(a)): for j in xrange(i+1, len(a)): if (a[i] != a[j]) and ((a[i]+a[j])%2) == 0 : out += 1 print out
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t=int(raw_input()) i=0 while i<t: n=int(raw_input()) a=[int(x) for x in raw_input().split()] b=[] c=[] for j in range(len(a)): if a[j]%2==0: b.append(a[j]) else: c.append(a[j]) c.sort() b.sort() sumi=0 for k in range(len(b)-1): sumi+=le...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t=int(raw_input()) while t>0: t-=1 n=int(raw_input()) arr=[] arr=[int(i) for i in raw_input().split()] count=0 for i in range(0,n-1): for j in range(i,n): if arr[i]!=arr[j]: if (arr[i]%2==0 and arr[j]%2==0) or (arr[i]%2!=0 and arr[j]%2!=0) : count+=1 print(count)
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t=int(raw_input()) while(t): n=int(raw_input()) a=map(int,raw_input().split()) count=0 for i in range(n): for j in range(i+1,n): if (a[i]+a[j])%2==0 and a[i]!=a[j]: count+=1 print(count) t-=1
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
''' # Read input from stdin and provide input before running code n3iTh4N name = raw_input('What is your name?\n') print 'Hi, %s.' % name ''' #print 'Hello World!' n = int(raw_input()) i = 0 while i < n: nn = int(raw_input()) a = [] a += map(int,raw_input().split()) #print a ctr = 0 j = 0 while j < len(a) - 1: ...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t = int(raw_input()) for i in range(t): n = int(raw_input()) l = list(map(int, raw_input().split())) tot = 0 for j in range(len(l)): for y in range(j+1, len(l)): if l[j] != l[y] and (l[j] + l[y]) % 2 == 0: tot += 1 print(tot)
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t=int(raw_input()) for asdasf in range(t): n=int(raw_input()) a=map(int,raw_input().split()) count=0 for i in range (n): for j in range (i+1,n): if ((a[i]+a[j])%2==0 and a[i]!=a[j]) : count+=1 print count
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
from itertools import combinations t = int(raw_input()) for te in xrange(1,t+1): siz = int(raw_input()) lis = map(int,raw_input().split()) count = 0 for mylist in combinations(lis,2): if(mylist[0]!=mylist[1]): if(sum(mylist)%2==0): count+=1 print count
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
from itertools import combinations for _ in range(int(raw_input())): n = int(raw_input()) a = map(int, raw_input().split()) ans = 0 for x, y in combinations(a, 2): if x == y or (x + y) % 2: continue ans += 1 print ans
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
''' # Read input from stdin and provide input before running code name = raw_input('What is your name?\n') print 'Hi, %s.' % name ''' t=int(raw_input()) while(t): n=int(raw_input()) a=map(int,raw_input().split()) count=0 for i in range(n): for j in range(i+1,n): if (a[i]+a[j])%2==0 and a[i]!=a[j]: count+=...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
import itertools count = 0 def converse(temp_line): global count count = 0 for i in temp_line: if ((sum(i)%2==0) and (i[0]!=i[1])): count += 1 al_ = input() for _ in range(al_): curr = input() line = map(int,raw_input().split()) converse(list(itertools.combinations(line, 2))) print count
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t = int(raw_input()) while t: t-=1 n = int(raw_input()) l = [int(x) for x in raw_input().split()] count = 0 for i in range(n): for j in range(i,n): #print l[i],l[j] if l[i]!=l[j] and (l[i]+l[j])%2==0: count+=1 print count
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
def check(li=[]): ll = len(li) count = 0 for l in range(ll): for m in range(l + 1, ll): if li[l] == li[m]: continue if (li[l] + li[m]) % 2 == 0: count += 1 return count tn = input() for _ in range(tn): m = input() mm = raw_input()...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
for i in range(input()): a=input() l=[int(a) for a in raw_input().split()] c=0 for j in range(0,len(l)): for k in range(j+1,len(l)): if(l[j]!=l[k] and (l[j]+l[k])%2==0): c+=1 print(c)
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
for _ in range(input()): n=int(raw_input()) a=map(int,raw_input().split()) count=0 for i in range(n): for j in range(i+1,n): if a[i]!=a[j]: if (a[i]+a[j])%2==0: count+=1 print count
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
''' # Read input from stdin and provide input before running code name = raw_input('What is your name?\n') print 'Hi, %s.' % name ''' def GetCount(l): if (len(l)==1): return 0 n_l = l[:-1] b_l = [i%2==0 for i in l] index=0 totalCount=0 for element in n_l: current_even = element%...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
''' # Read input from stdin and provide input before running code name = raw_input('What is your name?\n') print 'Hi, %s.' % name ''' #print 'Hello World!' T = int(raw_input()) while(T!=0): N = int(raw_input()) a = map(int,raw_input().strip().split()) count = 0 for i in xrange(N): for j in xrange(i+1,N): if (...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
tc = int(raw_input()) for i in range(tc): n = int(raw_input()); inp = map(int,raw_input().split()); cnt=0; for j in range(n): a = inp[j]; for k in range(j+1,n): b = inp[k]; if(a!=b and (a+b)%2==0): cnt+=1; print cnt;
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t = int(raw_input()); for k in range(1,t+1): n = int(input()); a = [int(x) for x in raw_input().split()] count = 0 for i in range(n): for j in range(i+1,n): if a[i] != a[j]: if ((a[i]%2)==0 and (a[j]%2)==0): count += 1; elif ((a[i]%2)!=0 and (a[j]%2)!=0): count += 1; else : pass pri...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
testcount = int(raw_input()) anslist = [] for i in range(0,testcount): listlen = int(raw_input()) itemlist = raw_input().split()[0:listlen] itemlist = [int(l) for l in itemlist] count = 0 for j in range(0,len(itemlist)): for k in itemlist[j+1:]: if (itemlist[j] != k) and ((itemlist[j]+k)%2 == 0): count +=...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
''' # Read input from stdin and provide input before running code name = raw_input('What is your name?\n') print 'Hi, %s.' % name ''' #print 'Hello World!' def thesavior(): T = int(raw_input()) outputlist = [] oappend = outputlist.append for i in range(T): listlen = int(raw_input()) powers = map(int,raw_input(...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t = int(raw_input()) def ncr(n, r): f = 1 for i in range(1, r+1): f *= n-r+i f /= i return f while t: t-=1 n = int(raw_input()) nums = map(int, raw_input().strip().split(" ")) if n == 1: print 0 continue e = [] o = [] for i in nums: if i&1: o.append(i) else: e.append(i) el = len(...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
test = int(raw_input()) while(test): test -=1 n = int(raw_input()) raw = [int(X) for X in raw_input().split()] count = 0 l = len(raw) for i in range(0,l-1): for j in range(i+1,l): if(raw[i]+raw[j])%2 ==0 and raw[i]!=raw[j]: count+=1 print count
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
for _ in range(input()): nos = input() ins = map(int, raw_input().split()) cnt = 0 for i in range(len(ins)-1): for j in range(i+1, len(ins)): if (ins[i] + ins[j]) & 1 == 0 and ins[i] != ins[j]: cnt += 1 print cnt
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t = input() for _ in xrange(t): n = input() num = [int(i) for i in raw_input().split()] ev = 0 od = 0 mx=(10**5)+1 hs=[0]*(mx) for i in num: if(i%2==0): ev+=1 else: od+=1 hs[i]+=1 now = 0 num = list(set(num)) for i in num: i...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t = int(raw_input()) while t: n = int(raw_input()) l = map(int,raw_input().split()) c = 0 h = [] for i in range(0,n-1): k = i+1 for j in range(k,n): v = l[i]+l[j] if (v % 2 == 0) and (l[i] != l[j]): c += 1 print c t -= 1
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t=int(raw_input()) while t>0: t-=1 n=int(raw_input()) arr=[] arr=[int(i) for i in raw_input().split()] count=0 for i in range(0,n-1): for j in range(i,n): if arr[i]!=arr[j]: if (arr[i]+arr[j])%2==0: count+=1 print(count)
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
tc = int(raw_input()) while tc>0: tc = tc - 1 n = int(raw_input()) l = map(int, raw_input().split()) ans = 0 for i in xrange(n): for j in xrange(n): if l[i]==l[j]: pass else: if (l[i]+l[j])%2==0: ans = ans + 1 print ans/2
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
for tc in range(input()): N = input() A = list(map(int, raw_input().split())) count = 0 for i in range(len(A)): for j in range(i+1, len(A)): if A[i] != A[j] and A[i] + A[j] & 1 == 0: count += 1 print count
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
from itertools import combinations T=int(raw_input()) for t in range (0,T): n=int(raw_input()) a=[] a = [int(z) for z in raw_input().split()] c=0 for j in combinations(a,2): if sum(j)%2==0 and j[0]!=j[1]: c=c+1 print c
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
n = int(raw_input()) i = 0 while(i < n): m = [] k = int(raw_input()) l = raw_input().split() for j in l: m.append(int(j)) count = 0 for on in range(0, k): for lm in range(on, k): if ((m[on] + m[lm]) % 2 == 0 and m[on] != m[lm]): count += 1 print count i += 1
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
for _ in range(int(raw_input())): cnt=0 a=[] n=int(raw_input()) p=raw_input() p=p.split() for k in p: a.append(int(k)) for k in a: for i in a: if (k+i)%2==0 and k!=i: cnt+=1 print cnt/2
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t=input() while t: t-=1 n=input() a=map(int,raw_input().split()) odd=[] even=[] a=sorted(a) ans=0 for x in a: for y in a: if (x!=y and (x+y)%2==0): ans+=1 print ans/2
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
for _ in xrange(input()): input() a = map(int, raw_input().split()) count = 0 for i in range(0,len(a)): for j in range(i+1,len(a)): if a[i]%2 == a[j]%2 and a[i] != a[j]: count += 1 print count
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t=input() while t>0: n=input() a=map(int,raw_input().split()) x=0 for i in a: for j in a: if(i+j)%2==0 and i!=j: x=x+1 print x/2 t=t-1
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
'''def deldup(l): li = []; flag=0; for i in range(len(l)): for j in range(len(li)): if l[i]==li[j]: flag=1; break; if flag!=1: li.append(l[i]); flag=0; return li;''' T=int(raw_input()); for i in range(T): N=int(raw_input()); li=map(int,raw_input().split()); count=0; for i in range(len(li)):...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t=input() for _ in xrange(t): l = [0]*(10**5+1) n=input() odd,even=0,0 num_list=map(int,raw_input().split()) for element in num_list: l[element]+=1 if element&1: odd+=1 else: even+=1 ans=(n*(n-1))/2 for element in l: ans-=((element*(element-1))/2) ...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
T = int(raw_input()) def nc2(n): return (n*(n-1))/2 for _ in xrange(T): N = int(raw_input()) A = map(int,raw_input().split()) oc = 0 ec = 0 d = dict() for x in A: if x % 2 == 0: ec += 1 else: oc += 1 if x not in d: d[x] = 1 else: d[x] += 1 #print oc,ec,d ans = nc2(oc) + nc2(ec) for k in d....
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t = int(raw_input()) while t > 0: t = t - 1; n = int(raw_input()) l = map(int, raw_input().split()) ans = 0 for i in range(n): for j in range(n): if l[i] == l[j]: pass else: if (l[i] + l[j]) % 2 == 0: ans = ans + 1 print ans/2
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
for i in range(int(raw_input())): x = int(raw_input()) y = list(map(int, raw_input().split(' '))) t=0 for a in y: for b in y: if a != b and (a+b)%2==0: t+=1 print(t//2)
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
import collections for testCases in range(input()): n = input() s = map(int,raw_input().split()) cntOdd = [] cntEven = [] oddVal = [] evenVal = [] for i in s: if i%2 == 1: cntOdd.append(i) else: cntEven.append(i) oddVal = collections.Counter(cntOdd...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
t=int(input()) while t : c=0 l=int(input()) s=map(int,raw_input().split()) for i in range(0,l-1) : j=i+1 while j < l : if s[i] != s[j] : d = s[i] + s[j] if (d % 2 == 0) : c+=1 j+=1 print c t-=1
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
tCase = int(raw_input()) for times in xrange(tCase): noOfVillains = int(raw_input()) oddPCD, evenPCD = {}, {} thePowers = [int(x) for x in raw_input().split()] oddP, evenP , counterO, counterE= 0,0,0,0 for item in thePowers: if item%2==0: counterE +=1 if item in evenPCD: evenPCD[item]+=1 else: e...
PYTHON
the-savior-3
Fatal Eagle is trying his best to save his city, but he's failing to do so. He knows he needs some external help; some guidance, something... something out of ordinary to defeat this powerful enemy called Mr. XYZ. "Find out the number of pairs in the list you've made, who sum up to an even number!" "Who are you? And w...
3
0
''' # Read input from stdin and provide input before running code name = raw_input('What is your name?\n') print 'Hi, %s.' % name ''' from collections import Counter T=input() for t in range(T): N=input() x=[int(x) for x in raw_input().split()] even=[] odd=[] eve=0 od=0 final=set() i=0 ...
PYTHON
p02543 ACL Contest 1 - Keep Distances
There are N points on a number line, i-th of which is placed on coordinate X_i. These points are numbered in the increasing order of coordinates. In other words, for all i (1 \leq i \leq N-1), X_i < X_{i+1} holds. In addition to that, an integer K is given. Process Q queries. In the i-th query, two integers L_i and R...
6
0
#include <bits/stdc++.h> using namespace std; using Int = long long; const char newl = '\n'; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);} te...
CPP
p02543 ACL Contest 1 - Keep Distances
There are N points on a number line, i-th of which is placed on coordinate X_i. These points are numbered in the increasing order of coordinates. In other words, for all i (1 \leq i \leq N-1), X_i < X_{i+1} holds. In addition to that, an integer K is given. Process Q queries. In the i-th query, two integers L_i and R...
6
0
#pragma region Macros #pragma GCC optimize("O3") #pragma GCC target("avx2,avx") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #define ll long long #define ld long double #define rep2(i, a, b) for(ll i = a; i <= b; ++i) #define rep(i, n) for(ll i = 0; i < n; ++i) #define rep3(i, a, b) for(ll i = a; i >= ...
CPP