text
stringlengths 37
1.41M
|
---|
c=input()
d=input()
if c[0]==d[2] and c[1]==d[1] and c[2]==d[0]:
print("YES")
else:
print("NO")
|
total_nights = int(input())
first_nights = int(input())
first_rate = int(input())
extra_rate = int(input())
if total_nights <= first_nights:
total = total_nights * first_rate
else:
total = (first_nights * first_rate) + ((total_nights - first_nights) * extra_rate)
print(total)
|
from decimal import Decimal
a,b,c = list(map(Decimal,input().split()))
d = Decimal('0.5')
A = a ** d
B = b ** d
C = c ** d
if A + B < C:
print('Yes')
else:
print('No')
|
x = input()
y = x.split(" ")
y[0] = int(y[0])
y[1] = int(y[1])
if y[0] < y[1]:
print("a < b")
elif y[0] > y[1]:
print("a > b")
else:
print("a == b") |
n=int(input())
k=int(input())
given_integer=1
#Option A:-To Increase The Value By double
#Option B:-To Increase Value By K
for i in range(0,n):
given_integer=min(given_integer*2,given_integer+k)
print(int(given_integer))
|
a,b,c =raw_input().split()
a,b,c = map(int,(a,b,c))
if a < b < c:
print 'Yes'
else:
print 'No' |
n = list(input())
ans = 0
for i in range(2**(len(n)-1)):
plus = [""]*(len(n))
fomula = ""
for j in range(len(n)-1):
if(i>>j & 1):
plus[j] = "+"
for i in range(len(n)):
fomula += n[i] + plus[i]
ans += eval(fomula)
print(ans)
|
def gcds(*numbers):
from math import gcd
from functools import reduce
return reduce(gcd, numbers)
def resolve():
K = int(input())
ans = 0
import itertools
for i, j, k in itertools.combinations_with_replacement(range(1, K+1), 3):
l = len(set([i, j, k]))
mu = 1
if l == 3:
mu = 6
elif l == 2:
mu = 3
ans += gcds(i, j, k) * mu
print(ans)
if '__main__' == __name__:
resolve() |
# 142 A
n = int(input())
odd = 0
for i in range(1, n+1):
if i % 2 != 0:
odd += 1
x = odd/n
print('%.10f' % x) |
s = input()
counter = 0
max_counter = 0
for c in s:
if c in 'ACGT':
counter += 1
else:
counter = 0
if max_counter < counter:
max_counter = counter
print(max_counter) |
import math
def div(x, y): #x>y
A = 1
for i in range(1, int(math.sqrt(x))+1):
if x % i == 0 and y % i == 0:
A = max(A, i)
j = int(x/i)
if x % j == 0 and y % j == 0:
A = max(A, j)
return A
x, y = map(int, input().split(" "))
print(div(x,y))
|
import string
import sys
input_str = sys.stdin.read()
for i in range(26):
char = string.ascii_lowercase[i]
CHAR = string.ascii_uppercase[i]
cnt = input_str.count(char) + input_str.count(CHAR)
print("{0} : {1}".format(char, cnt)) |
s = str(input())
list_s = list(s)
ans = "No"
for i in range(len(s)-1):
if list_s[i] == "A" and list_s[i+1] == "C":
ans = "Yes"
break
print(ans) |
A = int(input())
x = list(map(int, input().split()))
kotae='APPROVED'
for i in range(len(x)):
if x[i]%2==0:
if x[i]%3==0 or x[i]%5==0:
pass
else:
kotae='DENIED'
print(kotae)
|
n = input().split()
a = int(n[0])
b = int(n[1])
if a < b:
print("a < b")
elif a > b:
print("a > b")
elif a == b:
print("a == b") |
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
# divisors.sort()
return divisors
import math
def is_prime(n):
if n == 1: return False
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return False
return True
a,b = map(int,input().split())
a_list = make_divisors(a)
b_list = make_divisors(b)
a_b_and = set(a_list) & set(b_list)
a_b_and = list(a_b_and)
count = 1
for a_b in a_b_and:
if is_prime(a_b) == True:
count += 1
print(count) |
s = list(input().split())
if set(s) == set(["1","9","7","4"]):
print("YES")
else:
print("NO") |
def main():
n = input()
m = int(n[-1])
hon = [2, 4, 5, 7, 9]
pon = [0, 1, 6, 8]
if m in hon:
print('hon')
elif m in pon:
print('pon')
else:
print('bon')
if __name__ == '__main__':
main() |
X, Y = map(str, input().split())
if X > Y: print(">")
elif X == Y: print("=")
else: print("<") |
s=[int(input()) for x in range(10)]
print(sorted(s)[-1])
print(sorted(s)[-2])
print(sorted(s)[-3]) |
#coding:UTF-8
def GCD(x,y):
d=0
if x < y:
d=y
y=x
x=d
if y==0:
print(x)
else:
GCD(y,x%y)
if __name__=="__main__":
a=input()
x=int(a.split(" ")[0])
y=int(a.split(" ")[1])
GCD(x,y) |
def pair(n,count):
l=[];su=0
for i in range(0,len(n),2):
sub=list()
sub.append(n[i:i+2])
su=su+sub[0][0]
l.append(sub)
return(su)
def ip11(): return int(input())
def ip22(): return [int(_) for _ in input().split()]
def main():
ip1=ip11()
ip2=ip22()
ip2.sort()
print(pair(ip2,ip1))
return
if __name__ == '__main__':
main() |
N = int(input())
if N <= 2:
print(0)
else:
print(int(N / 3)) |
#https://atcoder.jp/contests/abc109/tasks/abc109_b
import collections
N = int(input())
Word_List = []
SP = ""
for i in range(N):
CW = str(input())
if i == 0:
Word_List.append(CW)
SP = CW[-1]
elif SP != CW[0]:
print("No")
break
else:
Word_List.append(CW)
SP = CW[-1]
else:
Word_List = collections.Counter(Word_List)
if len(Word_List) != N:
print("No")
else:
print("Yes") |
room = [[[],[],[]],[[],[],[]],[[],[],[]],[[],[],[]]]
for i in range(4):
for j in range(3):
for k in range(10):
room[i][j].append(0)
n = int(input())
for _ in range(n):
b, f, r, v = map(int, input().split())
room[b-1][f-1][r-1] += v
for i in range(4):
for j in range(3):
print(" "+" ".join(map(str, room[i][j])))
if i != 3: print("#"*20) |
x = int(input())
Y = x%9
if (Y == 0):
print("Yes")
else:
print("No") |
S = input()
f = 0
for i in range(len(S)-1):
if S[i] == S[i+1]:
f = 1
if f == 0:
print('Good')
else:
print('Bad') |
import math
import sys
def gcd(a,b):
if b==0:
return a
return gcd(b, a%b)
def lcm(a,b):
return a/gcd(a,b)*b
for l in sys.stdin:
a=list(map(int,l.split()))
print("%d %d"%(gcd(a[0],a[1]),lcm(a[0],a[1])))
|
s = input()
diff = 0
for i in range(len(s)):
if i % 2 == 0:
if s[i] == "R" or s[i] == "U" or s[i] == "D":
continue
else:
diff += 1
if i % 2 == 1:
if s[i] == "L" or s[i] == "U" or s[i] == "D":
continue
else:
diff += 1
if diff == 0:
print("Yes")
else:
print("No") |
S = input()
A = []
for s in S:
if s=="0" or s=="1":
A.append(s)
else:
A = A[:len(A)-1]
print(*A,sep="") |
if __name__ == '__main__':
param_seconds = int(raw_input())
seconds_per_hour = 60 * 60
h = param_seconds / seconds_per_hour
rest_seconds = param_seconds - h * seconds_per_hour
m = rest_seconds / 60
rest_seconds -= m * 60
print "%s:%s:%s" % (h, m, rest_seconds) |
l = list(map(int,input().split()))
if l[1] < l[2]:
print(0)
elif l[0] > l[3]:
print(0)
else:
l.sort()
print(l[2]-l[1]) |
def resolve():
'''
code here
'''
import collections
S = input()
cnt_S_dict = collections.Counter(S)
num = len(S)
if num == 1:
res = 'YES'
elif num == 2:
if len(cnt_S_dict.keys()) == 2:
res = 'YES'
else:
res = 'NO'
else:
if len(cnt_S_dict.keys()) <= 2:
res = 'NO'
else:
num_a = cnt_S_dict['a']
num_b = cnt_S_dict['b']
num_c = cnt_S_dict['c']
if abs(num_a - num_b) <= 1 and abs(num_a - num_c) <= 1 and abs(num_b - num_c) <= 1:
res = 'YES'
else:
res = 'NO'
print(res)
if __name__ == "__main__":
resolve()
|
for i in range(int(input())):
a,b,c = map(int, input().split())
if a**2 + b**2 == c**2 or a**2+c**2 == b**2 or b**2+c**2 == a**2:
print("YES")
else:
print("NO") |
while True:
a, op, b = input().split() # 3変数ともに文字列として読み込む
a = int(a) # a を整数に変換
b = int(b) # b を整数に変換
if op == '?':
break
elif op == '+':
print("%d"%(a+b))
elif op == '-':
print("%d"%(a-b))
elif op == '/':
print("%d"%(a/b))
else:
print("%d"%(a*b))
|
def Cukky(a,b):
if a%2 == 0:
a = a/2
else:
a = (a-1)/2
b += a
return a,b
A,B,K = map(int,input().rstrip().split(' '))
for i in range(K):
if i%2 != 0:
B,A = Cukky(B,A)
else:
A,B = Cukky(A,B)
print("{} {}".format(int(A),int(B))) |
a=input()
e=a[len(a)-1:len(a)]
if e == "s":
print(a+"es")
else:
print(a+"s") |
s=str(input())
print(s if len(s)==2 else s[::-1]) |
o = input()
e = input()
for i in range(max(len(o), len(e))):
# print(len(o), len(e), i)
if len(o) > i:
print(o[i], end="", sep="")
if len(e) > i:
print(e[i], end="", sep="")
print() |
X = int(input())
H = X // 3600
X = X%3600
M = X // 60
X %= 60
print(str(H)+":"+str(M)+":"+str(X))
|
from string import ascii_uppercase
N = int(input())
S = input()
num2alpha = {i: a for i, a in enumerate(ascii_uppercase)}
alpha2num = {a: i for i, a in enumerate(ascii_uppercase)}
ans = ""
for s in S:
num = (alpha2num[s] + N) % 26
ans += num2alpha[num]
print(ans)
|
#!/usr/bin/python
import sys
t = raw_input()
for i in range(int(t)):
x = [int(s) for s in raw_input().split()]
x.sort()
if x[0] ** 2 + x[1] ** 2 == x[2] ** 2:
print "YES"
else:
print "NO" |
n = int(input())
S = list(map(int, input().split()))
c = 0
def merge(left, mid, right):
global c
L = S[left:mid] + [float('inf')]
R = S[mid:right] + [float('inf')]
i, j = 0, 0
for k in range(left, right):
if L[i] <= R[j]:
S[k] = L[i]
i += 1
else:
S[k] = R[j]
j += 1
c += right - left
def merge_sort(left, right):
if left + 1 < right:
mid = (left + right) // 2
merge_sort(left, mid)
merge_sort(mid, right)
merge(left, mid, right)
merge_sort(0, n)
print(*S)
print(c)
|
s=input()
print(["consonant","vowel"][s=="a" or s=="i" or s=="u" or s=="e" or s=="o"]) |
s = input()
ans = 'Yes'
if s[2] != s[3]:
ans = 'No'
if s[4] != s[5]:
ans = 'No'
print(ans) |
a=raw_input().lower()
c=0
while 1:
b=raw_input()
if b=='END_OF_TEXT':break
for i in b.lower().split():
if i==a:c+=1
print c |
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
def solve():
s = set([x for x in input()])
n = len(s)
if n == 4 or (n == 2 and ('S' in s and 'N' in s or 'W' in s and 'E' in s)):
print("Yes")
else:
print("No")
t = 1
# t = int(input())
for case in range(1,t+1):
ans = solve()
"""
4
1 2
2 4
1 3
3
2 2 4
4 5 6
6
1 2
2 3
3 4
4 5
4 6
3
3 5 6
2 17 31 5 11
"""
|
def check():
S = input()
T = input()
S *= 2
for i in range(len(T)):
if S[i:i+len(T)]==T:
return 'Yes'
return 'No'
print(check()) |
def bubble_sort(A, N):
flag = True
c = 0
i = 0
while flag:
flag = False
for j in range(N-1, i, -1):
if A[j] < A[j-1]:
A[j], A[j-1] = A[j-1], A[j]
c += 1
flag = True
i += 1
print " ".join(map(str, A))
print c
N = int(raw_input())
A = map(int, raw_input().split())
bubble_sort(A, N) |
x = int(input())
for i in range(1,x+1):
if i % 3 == 0 or i % 10 == 3 or '3' in str(i):
print(" {}".format(i),end='')
print() |
def dijkstra(s):
import heapq
dist=[inf for i in range(n)] #sからの距離のリスト
dist[s]=0
mirai=[True for i in range(n)] #Trueなら未確定
mirai[s]=False
queue=[] #こいつがheapqになる
for kyori,to in G[s]:
heapq.heappush(queue , kyori*10**6+to) #重みと行先を1つの変数で表してる!
while queue:
minedge= heapq.heappop(queue)
#miraiがTrueのやつ(未確定なやつ)から最小距離のものをさがす
if not mirai[minedge%(10**6)]: continue
#距離が小さいものから"確定"していく
v=minedge%(10**6) #最小距離の頂点
dist[v] = minedge//(10**6) #その距離
mirai[v]=False
for kyori,to in G[v]:
if mirai[to]:
heapq.heappush(queue, (kyori+dist[v])*(10**6)+to)
#queueに入る数は、必ず「sからの」距離と行先を持っている
return dist
n,m=map(int,input().split())
inf=10**10
G=[[] for i in range(n)]
HEN=[]
for i in range(m):
a,b,c=map(int,input().split())
a-=1;b-=1
G[a].append((c,b))
G[b].append((c,a))
HEN.append((a,b,c))
MIN=[[10**10]*n for i in range(n)]
for i in range(n):
MIN[i]=dijkstra(i)
ans=0
for a,b,c in HEN:
for s in range(n):
if MIN[s][a]+c == MIN[s][b]:
break
if MIN[s][b]+c == MIN[s][a]:
break
else:
ans+=1
print(ans)
|
n=int(input())
a=1
b=1
i=0
while i<n:
a,b=b,a+b
i+=1
print(a)
|
from math import *
def distance (p,n,x,y):
dis = 0.0
if p == "inf":
for i in range(0,n) :
if dis < abs(x[i]-y[i]):
dis = abs(x[i]-y[i])
else :
for i in range(0,n) :
dis += abs(x[i]-y[i])**p
dis = dis ** (1.0/p)
return dis
if __name__ == '__main__' :
n = int(input())
x = map(int,raw_input().split())
y = map(int,raw_input().split())
print distance(1,n,x,y)
print distance(2,n,x,y)
print distance(3,n,x,y)
v = distance('inf',n,x,y)
print "%.6f" % v |
dic = {"1":"9","9":"1"}
n = list(input())
for i in range(0,3,1):
n[i]=dic[n[i]]
print("".join(n)) |
import re
s = input()
if len(s) > 9:
print ("NO")
else:
p = 'A?KIHA?BA?RA?'
r = re.compile(p)
result = r.match(s)
if result:
print ("YES")
else:
print ("NO") |
grid = []
for i in range(3):
grid.append(list(map(int, input().split())))
b = grid[0]
a = (0, grid[1][1]-b[1], grid[2][2]-b[2])
for i in range(3):
for j in range(3):
if a[i]+b[j] != grid[i][j]:
print('No')
exit(0)
print('Yes')
|
a,b = input().strip().split()
ret = ""
if a == "H":
ret = b
else:
if b == "H":
ret = "D"
else:
ret = "H"
print(ret) |
S=input()
sn = "N" in S
se = "E" in S
ss = "S" in S
sw = "W" in S
if (sn==ss) and (se==sw):
print("Yes")
else:
print("No") |
n = int(input())
fib = [0] * (n + 1)
if n == 0 or n == 1:
print(1)
exit()
fib[0] = 1
fib[1] = 1
for i in range(2, n + 1):
fib[i] = fib[i - 1] + fib[i -2]
print(fib[-1])
|
# coding: utf-8
def main():
X = int(input())
C = X // 100
print([0, 1][X >= C * 100 and X <= C * 105])
if __name__ == "__main__":
main()
|
str = input()
nums = str.split()
if nums[0] == "0" or nums[1] == "0":
print("error")
else:
turn = float(nums[0]) / float(nums[1]) + 0.9
if turn < 1:
turn = 1
print(int(turn)) |
s = input()
k = int(input())
SUBSTRINGS = set()
for i in range(len(s)):
for j in range(i + 1, i + 6):
SUBSTRINGS.add(s[i:j])
SUBSTRINGS = sorted(SUBSTRINGS)
print(SUBSTRINGS[k - 1])
|
'''A - Multiple of 2 and N
https://atcoder.jp/contests/abc102/tasks/abc102_a
>>> main(3)
6
>>> main(10)
10
>>> main(999999999)
1999999998'''
def main(n):
if n % 2 == 0:
print(n)
else:
print(n*2)
if __name__ == "__main__":
n = int(input())
main(n)
|
x,y = [int(x) for x in input().split()]
if (0<=x<=5):
print(0)
elif (5<x<13):
print(y//2)
else:
print(y)
|
st = str(input())
if "A" <= st <= "Z":
ans = "A"
elif "a" <= st <= "z":
ans = "a"
print(ans) |
# -*- coding: utf-8 -*-
moji=[]
moji.append("eraser")
moji.append("erase")
moji.append("dreamer")
moji.append("dream")
user = "erasedream"
user = int(input())
result = user
count = 1
while result != 0:
result += user
result %= 360
count += 1
print(count,end="")
|
S = input()
print("{}".format("Yes" if (S[2] == S[3]) and (S[4] == S[5]) else "No")) |
a = input()
if len(a) == 3:
a = a[::-1]
print(a) |
A,B,C=map(int,input().split())
if B/A<0:
print(0)
elif B/A>=C:
print(C)
else:
print(int(B/A)) |
num = int(input())
print(num + (num*num) + (num*num*num)) |
from collections import Counter
N = int(input())
S = []
for i in range(N):
s = input()
S.append(s)
S = Counter(S)
print(len(S)) |
def main():
s=input()
x = s.find("C")
y = s.find("F")
if x<0 or y<0:
print("No")
return 0
while x<len(s):
if s[x]=="F":
print("Yes")
return 0
x+=1
print("No")
main()
|
# -*- coding: utf-8 -*-
a,b,c = [int(i) for i in input().split()]
if 1 <= a and b and c <= 100:
if b - a == c - b:
print("YES")
else:
print("NO") |
while True:
cards = raw_input()
if cards == '-':
break
shuffle_num = int(raw_input())
counter = 0
while counter < shuffle_num:
h = int(raw_input())
cards = cards[h:] + cards[:h]
counter += 1
print(cards) |
a=int(input())
b=int(input())
c=int(input())
if a<b:
a,b=b,a
if c%a==0:
print(c//a)
else:
print(c//a+1)
|
x = int(input())
if x <= 3:
print(x)
exit()
ans = 0
for i in range(2, int(x**0.5)+1):
s = i
t = 1
while s < x:
t += 1
s = i**t
if ans < s and s <= x: ans = s
print(ans) |
hotel=int(input())
hotel2=int(input())
hotel3=int(input())
hotel4=int(input())
if hotel > hotel2:
sum1=int(hotel2)*int(hotel3)
hotel5=int(hotel)-int(hotel2)
sum2=int(hotel5)*int(hotel4)
fee=int(sum1)+int(sum2)
else:
fee=int(hotel)*int(hotel3)
print(str(fee)) |
# coding:utf-8
import sys
def call(n):
i = 1
sys.stdout.write(' ')
while i <= n:
x = i
if x % 3 == 0:
print i,
if i <= n:
i += 1
continue
while x != 0:
if x % 10 == 3:
print i,
if i <= n:
break
x = int(x / 10)
i += 1
else:
print
n = input()
call(n)
|
import math
n = float( input() )
L = 2*math.pi*n
S = n * n * math.pi
print("%.6f"%(S),"%.6f"%(L)) |
def dice():
dnum = list(map(int,input().split()))
up = dnum[0]
un = dnum[5]
ri = dnum[2]
le = dnum[3]
fr = dnum[1]
ba = dnum[4]
tmp = int(0)
tmp2 = int(0)
ordertmp = input()
order = list(ordertmp)
for x in order :
if (x == "S"):
tmp = fr
tmp2 = un
fr = up
up = ba
un = tmp
ba = tmp2
elif (x == "N"):
tmp = un
tmp2 = up
up = fr
un = ba
fr = tmp
ba = tmp2
elif (x == "E"):
tmp = up
tmp2 = un
up = le
un = ri
ri = tmp
le = tmp2
elif (x == "W"):
tmp = un
tmp2 = up
up = ri
un = le
ri = tmp
le = tmp2
print(up)
dice()
|
S = input()
hi = []
for i in range(5):
hi.append("hi"*(i+1))
print("Yes" if S in hi else "No") |
# -*- coding: utf-8 -*-
def main():
Num = input().split()
area = int(Num[0]) * int(Num[1])
sur = 2 * (int(Num[0])+int(Num[1]))
print(area, sur)
if __name__ == '__main__':
main() |
#!/usr/bin/env python3
import sys
input = iter(sys.stdin.read().splitlines()).__next__
W, H, x, y = map(int, input().split())
area = W*H / 2
if x*2 == W and y*2 == H:
print('%f 1' % (area))
else:
print('%f 0' % (area))
|
from copy import deepcopy
def solve():
N,A,B,C,D = map(lambda x:int(x)-1, input().split())
field_orig = list(input())
field = deepcopy(field_orig)
if C < D:
if existsContinuousRocks(field,A,B,C,D):
print('No')
else:
print('Yes')
else:
if not existsContinuousRocks(field,A,B,C,D) \
and existsContinuousDots(field,A,B,C,D):
print('Yes')
else:
print('No')
def existsContinuousRocks(field, A, B, C, D):
for i in range(A, min(max(C,D), len(field)-1)):
if field[i] == '#' and field[i+1] == '#':
return True
return False
def existsContinuousDots(field,A,B,C,D):
for i in range(B-1,min(D, len(field)-2)):
if field[i] == '.' and field[i+1] == '.' and field[i+2] == '.':
return True
return False
if __name__ == '__main__':
solve() |
S = input()
OK = False
if S=='KIHBR':
OK = True
elif S=='KIHBRA':
OK = True
elif S=='KIHBAR':
OK = True
elif S=='KIHBARA':
OK = True
elif S=='KIHABR':
OK = True
elif S=='KIHABRA':
OK = True
elif S=='KIHABAR':
OK = True
elif S=='KIHABARA':
OK = True
elif S=='AKIHBR':
OK = True
elif S=='AKIHBRA':
OK = True
elif S=='AKIHBAR':
OK = True
elif S=='AKIHBARA':
OK = True
elif S=='AKIHABR':
OK = True
elif S=='AKIHABRA':
OK = True
elif S=='AKIHABAR':
OK = True
elif S=='AKIHABARA':
OK = True
print('YES' if OK else 'NO')
|
a, b = map(str, input().split())
if a == b: print("H")
else: print("D") |
H, W = map(int, input().split())
res = []
for i in range(H+2):
if i == 0 or i == H+1:
l = '#'*(W+2)
res.append(l)
else:
a = input()
a = '#' + a + '#'
res.append(a)
for i in res:
print(i)
|
def insertionSort(lst, n):
for i in range(1, n):
v = lst[i]
j = i - 1
while j >= 0 and lst[j] > v:
lst[j+1] = lst[j]
j = j - 1
lst[j+1] = v
print(" ".join([str(n) for n in lst]))
if __name__ == "__main__":
n = int(input())
lst = [int(n) for n in input().split()]
print(" ".join([str(n) for n in lst]))
insertionSort(lst, n) |
x=sorted(list(input()))
if x[0]==x[1] and x[1]!=x[2] and x[2]==x[3]:
print("Yes")
else:
print("No") |
"""
偶数:偶数+偶数 or 奇数+奇数
奇数:偶数+奇数
"""
def the_number_of_even_pairs():
# 入力
N, M = map(int, input().split())
# 初期処理
list_N = [0] * N
list_M = [1] * M
even_pairs_count = 0
# 判別処理
# 偶数+偶数
for _ in range(N):
even_pairs_count += len(list_N)-1
list_N.pop(0)
# 奇数+奇数
for _ in range(M):
even_pairs_count += len(list_M)-1
list_M.pop(0)
# 結果
return even_pairs_count
result = the_number_of_even_pairs()
print(result) |
a = input()
s = a.find(' ')
a+= "."
b = a[s+1:-1]
a= a[0:s]
a=int(a)
b=int(b)
c= int(b/2)
if a>12:
print(b)
elif a<=12 and a>=6:
print(c)
else:
print(0) |
for x in range(1, 10):
for y in range(1, 10):
print(x , "x" , y , "=" , x*y, sep = "")
|
n = int(input())
s = str(n)
sl = list(s)
if sl[0]==sl[1] and sl[1] ==sl[2]:
print("Yes")
elif sl[1]==sl[2] and sl[2] ==sl[3]:
print("Yes")
else:
print("No") |
print("YES" if "".join(sorted(input().split()))=='1479' else "NO") |
#!/usr/bin/env python
# coding: utf-8
def ri():
return int(input())
def rl():
return list(input().split())
def rli():
return list(map(int, input().split()))
days = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
def main():
s = input()
print(days[s])
if __name__ == '__main__':
main()
|
S = input()
flag = False
for s in S:
if s == "C":
flag = True
if flag:
if s == "F":
print("Yes")
break
else:
print("No")
|
a,b=map(int,input().split())
def lcm(a,b):#最小公倍数
ori_a=a
ori_b=b
while b!=0:
a,b=b,a%b
return (ori_a*ori_b)//a
ans=lcm(a,b)
print(ans) |
s = input()
chars = [0, 0, 0]
for i in range(len(s)):
if s[i] == "a":
chars[0] += 1
elif s[i] == "b":
chars[1] += 1
else:
chars[2] += 1
chars = sorted(chars)
if chars[0] == chars[1]:
if chars[1] == chars[2]:
print("YES")
elif chars[2] == chars[1] + 1:
print("YES")
else:
print("NO")
elif (chars[1] == chars[2]) and (chars[0] == chars[1] - 1):
print("YES")
else:
print("NO") |
a = input()
if str.isupper(a):
print('A')
elif str.islower(a):
print('a') |
import sys
import string
sentence = sys.stdin.read().lower()
for c in string.ascii_lowercase:
print('{} : {}'.format(c, sentence.count(c))) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.