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
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
def main(): | |
n = int(input()) | |
S = [input() for i in range(n)] | |
S.sort() | |
for i, s in enumerate(S): | |
if s[0] != '!': | |
idx_s2 = i | |
break |
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
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
def main(): | |
n = int(input()) | |
XY = [[int(_) for _ in input().split()] for i in range(n)] | |
ans = 0 | |
for i in range(n): | |
x_i = XY[i][0] | |
y_i = XY[i][1] | |
for j in range(i + 1, n): |
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
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
def main(): | |
a, b = input().split() | |
s_a = int(a[0]) + int(a[1]) + int(a[2]) | |
s_b = int(b[0]) + int(b[1]) + int(b[2]) | |
print(max(s_a, s_b)) | |
if __name__=='__main__': | |
main() |
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
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
from fractions import gcd | |
class seg(): | |
def __init__(self,init_val): | |
self.n=len(init_val) | |
self.ide_ele= 0 #単位元 | |
self.num=2**(self.n-1).bit_length() #n以上の最小の2のべき乗 | |
self.seg=[self.ide_ele]*2*self.num | |
for i in range(self.n): |
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
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
class UnionFind(): | |
def __init__(self, n): | |
self.n=n | |
self.parents=[-1]*n # 親(uf.find()で経路圧縮して根)の番号。根の場合は-(そのグループの要素数) | |
def find(self,x): | |
#グループの根を返す | |
if self.parents[x]<0:return x | |
else: |
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
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
def main(): | |
a, b, c, d = map(int,input().split()) | |
if max(a, c) <= min(b,d): | |
print("Yes") | |
else: | |
print("No") | |
if __name__=='__main__': |
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
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
def main(): | |
k = int(input()) | |
ans = "" | |
for i in range(k): | |
ans += "ACL" | |
print(ans) | |
if __name__=='__main__': |
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
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
from operator import itemgetter | |
def main(): | |
n = int(input()) | |
XY = [tuple(map(int,input().split())) for i in range(n)] | |
XY.sort() | |
ans = 0 | |
SXY = [[0,0,0] for i in range(n)] | |
for i in range(n): |
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
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
class mod_comb3: | |
def __init__(self,mod=10**9+7,n_max=1): | |
self.mod,self.n_max=mod,n_max | |
self.fact,self.inv,self.factinv=[1,1],[0,1],[1,1] | |
if 1<n_max:setup_table(n_max) | |
def comb(self,n,r): | |
if r<0 or n<r:return 0 | |
if self.n_max<n:self.setup_table(n) |
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
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
def main(): | |
n = int(input()) | |
mod = 10**9+7 | |
print((pow(10,n,mod)-2*pow(9,n,mod)+pow(8,n,mod))%mod) | |
if __name__=='__main__': | |
main() |