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
a, b = map(int, raw_input().split()) | |
print a*4 + b*2 |
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,t,u = map(len,raw_input().split()) | |
print "valid" if s==5 and t==7 and u==5 else "invalid" |
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,k,m,r = map(int, raw_input().split()) | |
s = sorted((input() for i in xrange(n-1)), reverse=True) | |
sk = sum(s[:k]) | |
sk1 = sum(s[:k-1]) | |
if sk>=r*k: | |
print "0" | |
else: | |
p = r*k-sk1 | |
print p if 0<=p<=m else "-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
#include<iostream> | |
#include<string> | |
#include<vector> | |
#include<queue> | |
#include<stack> | |
#include<map> | |
#include<set> | |
#include<algorithm> | |
#include<functional> | |
#include<cstdio> |
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
# 69Byte | |
n=input();s=map(input,[""]*n);print"Pass"if sum(s)<2*n*s[0]else"Fail" |
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
# -*- encoding: utf-8 -*- | |
import urllib2, time, os | |
import itertools, random | |
import socket | |
urlopen = urllib2.urlopen | |
random.seed() | |
rand = random.randint | |
randf = random.random |
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
# -*- encoding: utf-8 -*- | |
u""" | |
Unlambdaをpython上で実行するプログラム | |
""" | |
import sys | |
import inspect | |
import greenlet | |
# User Exception | |
class UnlambdaSyntaxError(Exception): |
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
# -*- encoding: utf-8 -*- | |
# 以下を参考にさせていただきました | |
# http://anond.hatelabo.jp/20151220172711 | |
class BitMatrix: | |
def __init__(self, n=0, m=0, l=8): | |
self.n = n; self.m = m | |
self.mat = [[0] * ((m+l-1)/l) for i in xrange((n+l-1)/l)] | |
self.l = l | |
self.mask = 2**(l**2)-1 | |
self.nr = range((n+l-1)/l) |
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
# encoding: utf-8 | |
from collections import Counter | |
def SAIS(lst, num): | |
l = len(lst) | |
if l<2: return lst+[0] | |
lst = lst + [0] | |
l += 1 | |
res = [None] * l | |
# L-type(t[i] = 0) or S-type(t[i] = 1) | |
# s{i} < s{i+1} --> iはS-type |
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
# TLE(http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=1843450) | |
# もうちょっと高速化したい | |
import sys | |
readline = sys.stdin.readline | |
from bisect import bisect, bisect_right | |
from itertools import chain | |
n = input() | |
n0 = 2**n.bit_length() | |
data = [None]*(n0*2) | |
# セグメント木の構築 |
OlderNewer