This file contains hidden or 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
| for t in range(input()): | |
| input() | |
| lst = map(int, raw_input().split()) | |
| l = len(lst) | |
| i = 0 | |
| while i < l - 1 and lst[i] >= lst[i+1]: | |
| i += 1 | |
| while i < l - 1 and lst[i] <= lst[i+1]: | |
| i += 1 | |
| print "Yes" if i == l - 1 else "No" |
This file contains hidden or 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
| from collections import Counter, OrderedDict | |
| class OrderedCounter(Counter, OrderedDict): | |
| pass | |
| [print(*c) for c in OrderedCounter(sorted(input())).most_common(3)] |
This file contains hidden or 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
| if __name__ == '__main__': | |
| N = int(raw_input()) | |
| arr = [] | |
| for i in range(N): | |
| s = raw_input().split() | |
| for i in range(1,len(s)): | |
| s[i] = int(s[i]) | |
| if s[0] == "append": | |
| arr.append(s[1]) |
This file contains hidden or 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
| if __name__ == '__main__': | |
| n = raw_input() | |
| print hash(tuple([int(i) for i in raw_input().split()])) |
This file contains hidden or 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
| if __name__ == '__main__': | |
| x, y, z, n = int(input()), int(input()), int(input()), int(input()) | |
| print ([[a,b,c] for a in range(0,x+1) for b in range(0,y+1) for c in range(0,z+1) if a + b + c != n ]) |
This file contains hidden or 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
| if __name__ == '__main__': | |
| n = int(raw_input()) | |
| arr = map(int, raw_input().split()) | |
| print sorted(list(set(arr)))[-2] |
This file contains hidden or 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
| marksheet = [] | |
| for _ in range(0,int(input())): | |
| marksheet.append([input(), float(input())]) | |
| second_highest = sorted(list(set([marks for name, marks in marksheet])))[1] | |
| print('\n'.join([a for a,b in sorted(marksheet) if b == second_highest])) |
This file contains hidden or 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(raw_input()) | |
| mydict = {} | |
| for line in range(n): | |
| info = raw_input().split(" ") | |
| score = map(float, info[1:]) | |
| mydict[info[0]] = sum(score) / float(len(score)) | |
| print "%.2f" % round(mydict[raw_input()],2) |
This file contains hidden or 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 swap_case(s): | |
| return s.swapcase() |
This file contains hidden or 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 split_and_join(line): | |
| # write your code here | |
| return("-".join(line.split())) |