code1
stringlengths 16
427k
| code2
stringlengths 16
427k
| similar
int64 0
1
| pair_id
int64 6.82M
181,637B
⌀ | question_pair_id
float64 101M
180,471B
⌀ | code1_group
int64 2
299
| code2_group
int64 2
299
|
---|---|---|---|---|---|---|
n = int(input())
c = {}
m = 0
for i in range(n):
s = input()
if s in c:
c[s] += 1
else:
c[s] = 1
if m < c[s]:
m = c[s]
ans = []
for i in c:
if m == c[i]:
ans.append(i)
ans = sorted(ans)
for i in ans:
print(i)
| N = int(input())
dct = {}
for i in range(N):
s = input()
if not s in dct:
dct[s] = 1
else:
dct[s] += 1
m = max(dct.values())
for s in sorted(k for k in dct if dct[k] == m):
print(s) | 1 | 70,069,599,164,432 | null | 218 | 218 |
while True:
H, W = [int(x) for x in input().split()]
if H == W == 0:
break
for i in range(H):
if i == 0 or i == H - 1:
print('#'*W)
else:
print(''.join(['#' if c == 0 or c == W - 1 else '.' for c in range(W)]))
print() | import sys
class Dice(object):
def __init__(self, dice):
self.__dice = dice
def roll_north(self):
self.__dice = (self.__dice[1], self.__dice[5], self.__dice[2],
self.__dice[3], self.__dice[0], self.__dice[4])
def roll_south(self):
self.__dice = (self.__dice[4], self.__dice[0], self.__dice[2],
self.__dice[3], self.__dice[5], self.__dice[1])
def roll_west(self):
self.__dice = (self.__dice[2], self.__dice[1], self.__dice[5],
self.__dice[0], self.__dice[4], self.__dice[3])
def roll_east(self):
self.__dice = (self.__dice[3], self.__dice[1], self.__dice[0],
self.__dice[5], self.__dice[4], self.__dice[2])
def number(self, face_id):
return self.__dice[face_id - 1]
dice = Dice([int(i) for i in sys.stdin.readline().split()])
command = sys.stdin.readline().strip()
for c in command:
if c == "N":
dice.roll_north()
elif c == "S":
dice.roll_south()
elif c == "W":
dice.roll_west()
elif c == "E":
dice.roll_east()
print(dice.number(1)) | 0 | null | 529,776,859,140 | 50 | 33 |
import math
def merge(S, left, mid, right) -> int:
# n1 = mid - left
# n2 = right - mid
L = S[left: mid]
R = S[mid: right]
# for i in range(n1):
# L.append(S[left + i])
L.append(math.inf)
# for i in range(n2):
# R.append(S[mid + i])
R.append(math.inf)
i = 0
j = 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
return right - left
def merge_sort(S, left, right):
count = 0
if left + 1 < right:
mid = int((left + right) / 2)
count += merge_sort(S, left, mid)
count += merge_sort(S, mid, right)
count += merge(S, left, mid, right)
return count
def main():
n = int(input())
S = list(map(int, input().split()))
count = 0
count = merge_sort(S, 0, n)
print(*S)
print(count)
if __name__ == "__main__":
main()
| N, K = map(int, input().split())
P = int(1e9+7)
cnt = [0]*(K+1)
ans = 0
for i in range(K, 0, -1):
c = pow(K//i, N, P) - sum(cnt[::i])
cnt[i] = c
ans = (ans+i*c)%P
print(ans%P)
| 0 | null | 18,479,804,682,350 | 26 | 176 |
n = int(input())
a_list = list(map(int, input().split()))
ans_list =[0]*n
for i in range(n):
ans_list[a_list[i]-1] = i+1
print(*ans_list) | N, K = map(int, input().split())
heights = list(map(int, input().split()))
qualified = 0
for height in heights:
if height >= K:
qualified += 1
print(qualified)
| 0 | null | 179,440,052,989,890 | 299 | 298 |
a,b,c = map(int, raw_input().split(" "))
print "Yes" if a < b < c else "No" | import math
a, b, n = map(int, input().split())
x = min(b - 1, n)
ans = math.floor(a * x / b) - a * math.floor(x / b)
print(ans) | 0 | null | 14,199,603,906,768 | 39 | 161 |
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())
N, M = map(int, input().split())
A = list(sorted(map(int, input().split())))
S = sum(A)
acc = [0] * (N + 1)
for i in range(1, N + 1):
acc[i] = acc[i - 1] + A[i - 1]
def check(x):
total = 0
cnt = 0
for a in A:
l = -1
r = N
while r - l > 1:
m = (l + r) // 2
if A[m] + a >= x:
r = m
else:
l = m
cnt += N - r
total += acc[N] - acc[r]
total += a * (N - r)
return (total, cnt)
left = 0
right = 10 ** 6
while right - left > 1:
mid = (left + right) // 2
res = check(mid)
if res[1] >= M:
left = mid
else:
right = mid
res = check(left)
ans = res[0]
print(ans - (res[1] - M) * left)
| X = int(input())
deposit = 100
c = 0
while deposit < X:
deposit = deposit + deposit//100
c += 1
print(c)
| 0 | null | 67,353,553,571,748 | 252 | 159 |
t = input()
ans = []
for i in t:
if i == "?":
i = "D"
ans.append(i)
print("".join(ans)) | a= input()
c=""
for i in range(0, len(a)):
if a[i]=="?":
c=c+"D"
else:
c=c+a[i]
print(c) | 1 | 18,419,160,562,020 | null | 140 | 140 |
N, K = map(int, input().split())
ans = 0
bigint = 10**9+7
for k in range(K,N+2):
ans += N-k+2+(N-k+1)*(k-1)
ans %= bigint
print(ans) | n = int(input())
s = [input() for _ in range(n)]
l = 0
r = 0
m = []
def fin():
print("No")
exit()
for word in s:
stack = []
for e in word:
if stack and stack[-1] == "(" and e == ")":
stack.pop()
else:
stack.append(e)
if stack:
if stack[0] == ")" and stack[-1] == "(":
m.append(stack)
elif stack[0] == ")":
r += len(stack)
else:
l += len(stack)
ml = []
mm = 0
mr = []
for word in m:
ll = word.index("(")
rr = len(word) - ll
if ll > rr:
mr.append([ll, rr])
elif ll < rr:
ml.append([ll, rr])
else:
mm = max(mm, ll)
ml.sort()
for ll, rr in ml:
l -= ll
if l < 0:
fin()
l += rr
mr.sort(key=lambda x: x[1])
for ll, rr in mr:
r -= rr
if r < 0:
fin()
r += ll
if mm <= l or mm <= r:
if l == r:
print("Yes")
exit()
fin()
| 0 | null | 28,435,779,580,000 | 170 | 152 |
n = int(input())
maximum_profit = -10**9
r0 = int(input())
r_min = r0
for i in range(1, n):
r1 = int(input())
if r0 < r_min:
r_min = r0
profit = r1 - r_min
if profit > maximum_profit:
maximum_profit = profit
r0 = r1
print(maximum_profit) | n,m = [int(i) for i in input().split()]
a = [[int(i) for i in input().split()] for j in range(n)]
b = [0 for i in range(m)]
c = [0 for i in range(n)]
for i in range(m):
b[i] = int(input())
for i in range(n):
for j in range(m):
c[i] += a[i][j] * b[j]
print('\n'.join(map(str,c))) | 0 | null | 590,476,149,450 | 13 | 56 |
url = "https://atcoder.jp//contests/abc156/tasks/abc156_a"
def main():
n, r = list(map(int, input().split()))
print(r) if n >= 10 else print(r + 100 * (10 - n))
if __name__ == '__main__':
main()
| import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)
N = int(input())
Ds = list(mapint())
if Ds[0]!=0:
print(0)
exit(0)
Ds.sort()
mod = 998244353
from collections import Counter
c = Counter(Ds)
dmax = Ds[-1]
if c[0]>1:
print(0)
else:
ans = 1
for i in range(1, dmax+1):
ans *= pow(c[i-1], c[i], mod)
ans %= mod
print(ans) | 0 | null | 109,535,438,489,842 | 211 | 284 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
n, m, p = map(int, sys.stdin.readline().split())
mat_a = list()
mat_b = list()
for i in range(n):
mat_a.append(list(map(int, sys.stdin.readline().split())))
for i in range(m):
mat_b.append(list(map(int, sys.stdin.readline().split())))
mat_c = [[0 for i in range(p)] for k in range(n)]
for row in range(n):
for col in range(p):
for k in range(m):
mat_c[row][col] += mat_a[row][k]*mat_b[k][col]
str_x = list(map(str, mat_c[row]))
print(' '.join(str_x))
| #0からiまでのSを2019で割ったときのあまりを調べる
#A%mod =a,B$mod=aなら(A-B)%mod=0
from collections import Counter
S = input()
dp = [0]
mod = 2019
for i in reversed(range(len(S))):
dp.append(dp[-1]%mod+pow(10,len(S)-i-1,mod)*int(S[i]))
dp[-1]%=mod
count = Counter(dp)
ans = 0
for key,val in count.items():
if val>=2:
ans += val*(val-1)//2
print(ans) | 0 | null | 16,224,518,305,788 | 60 | 166 |
n = int(input())
s = str(input())
w = s[0]
num = 0
for i in range(1,n):
if w[0] == s[i]:
w += s[i]
else:
num += 1
w = s[i]
num += 1
print(num) | import sys
# import bisect
# import numpy as np
# from collections import deque
from collections import deque
# map(int, sys.stdin.read().split())
# import heapq
import bisect
import math
def input():
return sys.stdin.readline().rstrip()
def main():
N =int(input())
S = input()
pre ="A"
count=0
for i in S:
if i !=pre:
count+=1
pre = i
print(count)
if __name__ == "__main__":
main()
| 1 | 169,991,756,645,740 | null | 293 | 293 |
import collections
n=int(input())
S=input()
c=collections.Counter(S)
ans=c['R']*c['B']*c['G']
hiku=0
for i in range(n):
for d in range(n):
j=i+d
k=j+d
if k>n-1:
break
if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
hiku+=1
print(ans-hiku) | # import sys
# input = sys.stdin.readline
import collections
def main():
n = int(input())
s = input()
a_list = []
for i in range(n):
if s[i] == "W":
a_list.append(0)
else:
a_list.append(1)
r_count = sum(a_list)
print(r_count - sum(a_list[0:r_count]))
def input_list():
return list(map(int, input().split()))
def input_list_str():
return list(map(str, input().split()))
if __name__ == "__main__":
main()
| 0 | null | 21,075,705,129,702 | 175 | 98 |
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
b = [int(input()) for _ in range(N)]
field = 0
for v in b:
for i in range(9):
if A[i // 3][i % 3] == v:
field = field | (1 << i)
ans = False
for v in sum([[273,84],sum([[73<<i,7<<i*3]for i in range(3)],[])],[]):
ans = ans or field&v==v;
print('Yes' if ans else 'No')
| N = int(input())
S = input()
ans = ''
for i in S:
num = (ord(i) + N)
if num > 90:
num = 64 + num % 90
ans += chr(num)
print(ans)
| 0 | null | 97,166,619,601,360 | 207 | 271 |
import numpy as np
N=int(input())
A=np.array([int(x) for x in input().split()])
ans=0
M=pow(10,9)+7
for i in range(100):
one=int(np.sum((A>>i)&1))
zero=N-one
ans+=(one*zero)*pow(2,i)
ans%=M
#print(one,zero)
print(ans) | n = int(input())
a = list(map(int, input().split()))
mod = 10**9 + 7
pows = [pow(2, i, mod) for i in range(60)]
count = [0]*60
num = [0]*60
ans = 0
for i in range(n):
bit = a[i]
for g in range(60):
if bit % 2 == 1:
count[g] += 1
num[g] += i+1 - count[g]
else:
num[g] += count[g]
bit //= 2
for i in range(60):
ans += num[i]*pows[i]
print(ans % mod)
| 1 | 122,899,696,826,296 | null | 263 | 263 |
x = 'abcdefghijklmnopqrstuvwxyz'
c = str(input())
for i,data in enumerate(x):
if data == c:
print(x[i+1])
break | def main():
N = int(input())
A = list(map(int, input().split()))
SUM = 1
if 0 in A:
print(0)
return
for a in A:
SUM = SUM * a
if SUM > 1000000000000000000:
print(-1)
return
print(SUM)
main() | 0 | null | 54,461,391,646,130 | 239 | 134 |
N = int(input())
S = input()
current = ""
ans = ""
for s in S:
if s != current:
current = s
ans += s
print(len(ans))
# print(ans)
| #!/usr/bin python3
# -*- coding: utf-8 -*-
def main():
N = int(input())
S = input()
nw = S[0]
ret = 1
for i in range(1,N):
if nw == S[i]:
continue
else:
nw = S[i]
ret += 1
print(ret)
if __name__ == '__main__':
main() | 1 | 170,455,190,454,320 | null | 293 | 293 |
X = int(input())
ans = 0
money = 100
for i in range(1, 10**18):
money = (money * 101) // 100
if money >= X:
ans = i
break
print(ans) | from decimal import (Decimal, ROUND_DOWN)
x=Decimal(input())
year = 0
money = 100
while money < x:
money += Decimal(money / 100).quantize(Decimal('0'), rounding=ROUND_DOWN)
year += 1
print(year)
| 1 | 27,127,733,140,950 | null | 159 | 159 |
n, x, m = map(int, input().split())
a = []
check = [-1] * m
i = 0
while check[x] == -1:
a.append(x)
check[x] = i
x = x * x % m
i += 1
if n <= i:
print(sum(a[:n]))
else:
print(
sum(a[:check[x]])
+ (n - check[x]) // (i - check[x]) * sum(a[check[x]:])
+ sum(a[check[x] : check[x] + (n - check[x]) % (i - check[x])])) | X,Y=map(int,input().split());m=4-min(X,Y)
if X==Y==1:print(10**6)
elif X<=3and Y<=3:print(((4-X)+(4-Y))*10**5)
else:print(m*10**5if m>=0else 0) | 0 | null | 71,878,884,014,912 | 75 | 275 |
def main():
n = int(input())
a_lst = list(map(int, input().split()))
q = int(input())
bc_lst = [list(map(int, input().split())) for _ in range(q)]
a_max = max(a_lst)
bc_max = 0
for i in range(q):
b = bc_lst[i][0]
c = bc_lst[i][1]
bc_max = max(b, bc_max)
bc_max = max(c, bc_max)
maximum = max(a_max, bc_max)
count_lst = [0] * maximum
for i in range(n):
a = a_lst[i]
count_lst[a - 1] += 1
tmp = sum(a_lst)
for i in range(q):
b = bc_lst[i][0]
c = bc_lst[i][1]
count = count_lst[b - 1]
tmp += count * (c - b)
count_lst[b - 1] = 0
count_lst[c - 1] += count
print(tmp)
if __name__ == '__main__':
main() | n,r=map(int,input().split())
ans = r
if n<10:
ans = r+100*(10-n)
print(ans) | 0 | null | 37,943,875,769,308 | 122 | 211 |
from collections import deque
import sys
def bfs(graph, N, start):
visited = [0] * N
visited[start] = 1
que = deque([start])
while que:
node = que.popleft()
for n in graph[node]:
if not visited[n]:
visited[n] = node + 1
que.append(n)
return visited
input = sys.stdin.readline
def main():
N, M = map(int, input().split())
graph = [[] for _ in range(N)]
for i in range(M):
A, B = map(lambda n: int(n) - 1, input().split())
graph[A].append(B)
graph[B].append(A)
visited = bfs(graph, N, 0)[1:]
if all(visited):
print("Yes")
print(*visited, sep="\n")
else:
print("No")
main() | from collections import deque
N,M=map(int,input().split())
haba=[[] for i in range(N+1)]
for i in range(M):
A,B=map(int,input().split())
haba[A].append(B)
haba[B].append(A)
kyori=[-1]*(N+1)
kyori[0]=0
kyori[1]=0
que=deque()
que.append(1)
while que:
kari=que.popleft()
for i in haba[kari]:
if kyori[i]!=-1:
continue
kyori[i]=kari
que.append(i)
ans=kyori[2:]
print("Yes")
for i in range(len(ans)):
print(ans[i]) | 1 | 20,463,528,055,908 | null | 145 | 145 |
cnt = 0
n = int(raw_input())
A = [int(raw_input()) for _ in range(n)]
G = [1] if n < 5 else [1, 4]
while G[-1]*3+1 <= n/3: G.append(G[-1]*3+1)
if n > 256: G.append(n/10*9+G[-1]%2+(n/10*9-1)%2)
G.reverse()
def insersionSort(g):
global cnt
for i in range(g, n):
v = A[i]
j = i - g
while j >= 0 and A[j] > v:
A[j+g] = A[j]
j = j - g
cnt += 1
A[j+g] = v
def shellSort():
for g in G:
insersionSort(g)
shellSort()
print len(G)
print " ".join(map(str, G))
print cnt
print "\n".join(map(str, A)) | def insertionSort(arr,step):
count = 0
for i in range(step, len(arr)):
j = i
while j >= step and arr[j] < arr[j-step]:
count += 1
t = arr[j]
arr[j] = arr[j-step]
arr[j-step] = t
j -= step
return count
def shellSort(arr):
gaps = [776591, 345152, 153401, 68178, 30301, 13467, 5985, 2660, 1182, 525, 233, 103, 46, 20, 9, 4, 1]
m = 0
count = 0
for step in gaps:
if step > len(arr):
continue
m += 1
count += insertionSort(arr, step)
print(m)
print(" ".join(map(str, gaps[len(gaps)-m:])))
print(count)
for num in arr:
print(num)
arr = list()
for _ in range(int(input())):
arr.append(int(input()))
shellSort(arr)
| 1 | 31,253,380,000 | null | 17 | 17 |
N = int(input())
nums = list(map(int,input().split()))
count = 0
current_max = nums[0]
for i in range(len(nums)-1):
nv = nums[i+1]
if nv > current_max:
current_max = nv
else:
count += (current_max - nv)
print(count) | N, M, L = map(int, raw_input().split())
nm = [map(int, raw_input().split()) for n in range(N)]
ml = [map(int, raw_input().split()) for m in range(M)]
ml_t = []
for l in range(L):
tmp = []
for m in range(M):
tmp.append(ml[m][l])
ml_t.append(tmp)
for n in range(N):
tmp1 = nm[n]
col = [0]*L
for l in range(L):
tmp2 = ml_t[l]
for m in range(M):
col[l] += tmp1[m] * tmp2[m]
print ' '.join(map(str, col)) | 0 | null | 2,985,306,083,104 | 88 | 60 |
a,b,k = map(int,input().split())
t1 = min(a,k)
k -= t1
a -= t1
t2 = min(b,k)
k -= t2
b -= t2
print(a,b) | A, B, K = map(int, input().split())
if A >= K:
A = A - K
else:
B = B - (K - A)
A = 0
if B < 0:
B = 0
print(str(A) + " " + str(B)) | 1 | 104,267,819,183,908 | null | 249 | 249 |
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() | import itertools
import functools
import math
def OK():
N = int(input())
sum = 0
cnt = 0
for i in range(1,N+1):
for j in range(1,N+1):
chk = math.gcd(i,j)
for k in range(1,N+1):
sum += math.gcd(chk,k)
print(sum)
OK()
| 1 | 35,522,812,695,708 | null | 174 | 174 |
#coding:utf-8
n = int(input().rstrip())
toku =[0,0]
narabe = []
for i in range(n):
taro, hana = input().rstrip().split()
if taro == hana:
toku[0] +=1
toku[1] +=1
else:
narabe = [taro, hana]
narabe.sort()
toku[0] += narabe.index(taro)*3
toku[1] += narabe.index(hana)*3
print(" ".join(list(map(str,toku)))) | n = int(input())
a = list(map(int, input().split()))
b = set(a)
a.sort()
if len(a) != len(b):
print("NO")
else:
print("YES") | 0 | null | 37,934,792,220,722 | 67 | 222 |
import itertools
N,K = map(int,input().split())
A = list(map(int,input().split()))
for i in range(K):
TEMP = [0]*(N+1)
for j in range(N):
TEMP[max(0,j-A[j])] +=1
TEMP[min(N,j+A[j]+1)] -=1
A = list(itertools.accumulate(TEMP))
if A[0] == N and A[N-1] == N:
break
A.pop()
print(*A) | n,k,*A=map(int,open(0).read().split());e=enumerate
for _ in '_'*min(k,99):
S=[0]*(n+1)
B=[0]*(n+1)
for i,a in e(A):S[max(0,i-a)]+=1;S[min(n,i+a+1)]-=1
for i,s in e(S[:-1]):B[i+1]=B[i]+s
A=B[1:]
print(*A) | 1 | 15,460,593,239,080 | null | 132 | 132 |
# #
# author : samars_diary #
# 13-09-2020 │ 11:26:57 #
# #
import sys, os.path
#if(os.path.exists('input.txt')):
#sys.stdin = open('input.txt',"r")
#sys.stdout = open('output.txt',"w")
sys.setrecursionlimit(10 ** 5)
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))
#print=sys.stdout.write
def solve():
d,t,s=mii()
if d/s<=t:
print('Yes')
else: print('No')
solve() | # 入力
D, T, S = input().split()
# 以下に回答を記入
D = int(D)
T = int(T)
S = int(S)
if T * S >= D:
print('Yes')
else:
print('No') | 1 | 3,528,706,079,470 | null | 81 | 81 |
n=int(input())
vec=[0 for _ in range(10050)]
for x in range(1,105):
for y in range (1,105):
for z in range (1 , 105):
sum= x*x + y*y + z*z + x*y +y*z + z*x
if sum<10050:
vec[sum]+=1
for i in range(1,n+1):
print(vec[i]) | def solve(n):
D = {k: 0 for k in range(1, n+1)}
m = int(n**0.5)
for x in range(1, m+1):
for y in range(1, m+1):
for z in range(1, m+1):
k = x**2 + y**2 + z**2 + x*y + y*z + z*x
if k <= n:
D[k] += 1
else:
break
for k in range(1, n+1):
print(D[k])
n = int(input())
solve(n)
| 1 | 7,959,442,168,678 | null | 106 | 106 |
n = int(input())
ans = 0
for i in range(1, n):
for j in range(1, n):
if i*j>=n:
break
ans += 1
print(ans) | d = input().split()
n = int(input())
r_list = []
i = 0
while n > i:
t, f = map(str, input().split())
tf = str(d.index(t)) + str(d.index(f))
if tf == "12" or tf == "24" or tf == "43" or tf == "31":
r_list.append(1)
elif tf == "20" or tf == "03" or tf == "35" or tf == "52":
r_list.append(2)
elif tf == "01" or tf == "15" or tf == "54" or tf == "40":
r_list.append(3)
elif tf == "10" or tf == "51" or tf == "45" or tf == "04":
r_list.append(4)
elif tf == "02" or tf == "30" or tf == "53" or tf == "25":
r_list.append(5)
elif tf == "21" or tf == "42" or tf == "34" or tf == "13":
r_list.append(6)
i += 1
for r in r_list:
print(d[r-1])
| 0 | null | 1,432,094,706,088 | 73 | 34 |
import sys
input = sys.stdin.readline
def main():
N, K, S = map(int, input().split())
if S == 10 ** 9:
ans = [S] * K + [1] * (N - K)
else:
ans = [S] * K + [10 ** 9] * (N - K)
print(" ".join(map(str, ans)))
if __name__ == "__main__":
main()
| n,k,s = map(int,input().split())
if s == 10**9:
ans = [1]*n
for i in range(k):
ans [i] = s
else:
ans = [s+1]*n
for i in range(k):
ans[i] = s
for i in ans:
print(i,end = " ")
| 1 | 90,857,235,990,862 | null | 238 | 238 |
N = int(input())
A = list(map(int,input().split()))
mod = pow(10,9)+7
ok = 1
import math
from functools import reduce
def lcm_base(x, y):
return (x * y) // math.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
LCM = lcm_list(A)
import numpy as np
B = np.array(A)
C = LCM//B
print(sum(C)%mod) | """
最小公倍数LCMを求めて、LCMを各Aで除した商を合計すればよい
"""
from math import gcd
def lcm(a,b):
return a*b//gcd(a,b)
def main():
mod = 10**9 +7
N = int(input())
A = list(map(int,input().split()))
l = A[0]
for i in range(1,N):
l = lcm(l,A[i])
ans = 0
for a in A:
ans += l//a
print(ans%mod)
main() | 1 | 88,063,750,724,480 | null | 235 | 235 |
A, B = list(map(int,input().split()))
if A - 2 * B >= 0:
print(A - 2 * B)
else:
print(0) | abc = input().split()
if(int(abc[0]) < int(abc[1]) and int(abc[1]) < int(abc[2])):
print('Yes')
else:
print('No') | 0 | null | 83,272,024,215,040 | 291 | 39 |
import numpy as np
a,b,h,m = list(map(int,input().split()))
theta = abs(h/12-11*m/720)*2*np.pi
print(np.sqrt((a*a+b*b-2*a*b*np.cos(theta)))) | import math
a,b,h,m = map(int, input().split())
xh = a*math.cos((60*h+m)/360*math.pi)
yh = a*math.sin((60*h+m)/360*math.pi)
xm = b*math.cos(m/30*math.pi)
ym = b*math.sin(m/30*math.pi)
print( ((xh-xm)**2+(yh-ym)**2)**0.5 ) | 1 | 19,897,558,582,370 | null | 144 | 144 |
# walking takahashi
def walk(X, K, D):
abX = abs(X)
if abX >= K*D:
return abX - K*D
itr = round(abX/D)
ret = K - itr
res = abs(abX - D*itr)
if (ret % 2) == 0:
return res
return abs(res - D)
if __name__ == "__main__":
inputs = list(map(int, input().split()))
print(walk(inputs[0], inputs[1], inputs[2]))
| s = input()
if s[-1] == 's':
s = s + "es"
else:
s = s + 's'
print(s)
| 0 | null | 3,819,121,803,740 | 92 | 71 |
# region header
import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**6)
INF = float('inf')
MOD = 10 ** 9 + 7
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rf(): return float(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]
def rf_(): return [float(_) for _ in rs().split()]
def divisors(n, sortedresult=True):
div = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
div.append(i)
if i != n // i:
div.append(n//i)
if sortedresult:
div.sort()
return div
# endregion
S = list(rs())
ans = 0
tmp = 0
cnt = 0
f = 1
for i in range(len(S)):
if S[i] == '<':
if f:
cnt += 1
else:
ans += cnt * (cnt - 1) // 2
ans += max(tmp, cnt)
cnt = 1
f = 1
else:
if f:
ans += cnt * (cnt - 1) // 2
tmp = cnt
cnt = 1
f = 0
else:
cnt += 1
ans += cnt * (cnt - 1) // 2
if f:
ans += cnt
else:
ans += max(tmp, cnt)
print(ans) | s = input()
l, count = [], 0
for i in s:
if i=='>': count+=1
else:
if count: l.append(count)
count = 0
if count: l.append(count); count = 0
j = 0
ans = []
if s[0]=='<': ans.append(0)
else:
ans.append(l[0])
l[0]-=1
for i in range(len(s)):
if s[i]=='<': ans.append(ans[-1]+1)
else:
if i==0: ans.append(ans[-1]-1); continue
if l[j]==0: j+=1
if ans[-1]>=l[j]:
l[j]-=1
ans.append(l[j])
else:
ans[-1]=l[j]
l[j]-=1
ans.append(l[j])
print(sum(ans))
| 1 | 157,080,440,873,850 | null | 285 | 285 |
n, q = list(map(int, input().split()))
que = []
for i in range(n):
p, t = input().split()
que.append([p, int(t)])
total = 0
while True:
if q >= que[0][1]:
total += que[0][1]
print(que[0][0], total)
que.pop(0)
else:
total += q
que[0][1] -= q
que.append(que[0])
que.pop(0)
if len(que) == 0:
break
| nq = str(input()).split()
n = int(nq[0])
q = int(nq[1])
p = [str(input()).split() for i in range(n)]
p = [(str(i[0]), int(i[1])) for i in p]
ans = []
time = 0
while len(p) != 0:
t = p.pop(0)
if t[1] > q:
#p = [(s[0], s[1], s[2]+q) for s in p]
time += q
p.append((t[0], t[1]-q))
elif t[1] <= q:
#p = [(s[0], s[1], s[2]+t[1]) for s in p]
ans.append((t[0], t[1]+time))
time += t[1]
for t in ans:
print('{0} {1}'.format(t[0], t[1])) | 1 | 43,943,160,792 | null | 19 | 19 |
while True:
n = map(int, raw_input().split())
if (n[0] == 0) & (n[1] == 0):
break
print "%d %d" % (min(n), max(n)) | c = 0
while True:
a = input().split(' ')
x = int(a[0])
y = int(a[1])
if (x or y) == 0:
break;
elif x < y:
print(x,y)
elif x > y:
print(y,x)
elif x == y:
print(x,y)
c += 1 | 1 | 532,946,622,780 | null | 43 | 43 |
r=int(input())
print(2*(22/7)*r) | from collections import deque
from copy import deepcopy
# 初期入力
import sys
input = sys.stdin.readline
H,W = (int(i) for i in input().split())
map_initial =[["#"]*(W+2) for i in range(H+2)] #周囲を壁にするため+2
for h in range(1,H+1):
map_initial[h] =["#"] +list(input().strip()) +["#"]
def BSF(x,y):
dist =0
map =deepcopy(map_initial)
if map[x][y] =="#":
return dist
dq =set()
dq.add((x,y))
dq_sarch =set()
while len(dq) >0:
h,w =dq.pop()
map[h][w] ="#" #通り済を壁にする
if map[h+1][w]==".":
dq_sarch.add((h+1,w))
if map[h-1][w]==".":
dq_sarch.add((h-1,w))
if map[h][w+1]==".":
dq_sarch.add((h,w+1))
if map[h][w-1]==".":
dq_sarch.add((h,w-1))
if len(dq)==0:
dq =deepcopy(dq_sarch)
dq_sarch.clear()
dist +=1
#print(h,w,dist,end="\t")
return dist-1
#スタート位置を全探索し、最長距離を探す
dist_all =[]
for i in range(1,H+1):
for j in range(1,W+1):
dist_all.append(BSF(i,j) )
print(max(dist_all)) | 0 | null | 63,181,547,761,180 | 167 | 241 |
a,b = map(int,input().split())
if(a-(2*b)<0):
print(0)
else:
print(a-(2*b)) | import numpy as np
n=int(input())
d_i = list(map(int, input().split()))
d=np.array(d_i)
out=0
for i in range(1,n):
a=d_i.pop(0)
d_i.append(a)
out+=np.dot(d,np.array(d_i))
print(int(out/2)) | 0 | null | 166,942,837,557,782 | 291 | 292 |
def main():
x = int(input())
now = 100
ans = 0
while True:
now = now * 101 // 100
ans += 1
if now >= x:
break
print(ans)
if __name__ == "__main__":
main()
| a=int(input())
c=100
x=0
while c<a:
c=c+c//100
x=x+1
print(x) | 1 | 27,093,754,543,604 | null | 159 | 159 |
import math
X=int(input())
print(360//math.gcd(360, X)) | import sys
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
def main():
from collections import deque
import bisect
n, k = map(int, readline().split())
a = list(map(int, readline().split()))
a.sort()
que = deque()
if n == k:
que.extend(a)
elif a[-1] < 0 and k % 2 == 1:
que.extend(a)
for _ in range(n - k):
que.popleft()
else:
pos_ = []
neg_ = []
for x in a:
if x >= 0:
pos_.append(x)
else:
neg_.append(x)
pos = deque(sorted(pos_, reverse=True))
neg = deque((sorted(neg_)))
while len(que) < k:
if len(pos) >= 2:
pp = pos[0] * pos[1]
else:
pp = -1
if len(neg) >= 2:
np = neg[0] * neg[1]
else:
np = -1
if (pp > np) or len(que) == (k-1):
que.append(pos.popleft())
else:
que.append(neg.popleft())
que.append(neg.popleft())
while len(que) > 1:
que.append(que.popleft() * que.popleft())
print(que.popleft() % MOD)
if __name__ == '__main__':
main()
| 0 | null | 11,268,005,932,028 | 125 | 112 |
X, Y = map(int, input().split())
print(400000*(X==1)*(Y==1) + max(0, 400000-100000*X) + max(0, 400000-100000*Y)) | H,W,K = map(int,input().split())
array = [ list(input()) for k in range(H)]
ans = 0
for bit_row in range(2**H):
for bit_line in range(2**W):
count = 0
for i in range(H):
for j in range(W):
if ( bit_row >> i ) & 1 == 0 and ( bit_line >> j ) & 1 == 0:
if array[i][j] == '#':
count += 1
if count == K:
ans += 1
print( ans ) | 0 | null | 74,550,873,938,552 | 275 | 110 |
n,k=map(int,input().split())
p=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(n):
p[i]-=1
ans=max(c)
for i in range(n):
f=i
r=0
l=[]
while True:
f=p[f]
l.append(c[f])
r+=c[f]
if f==i:
break
t=0
for j in range(len(l)):
t+=l[j]
ret=t
if r>0:
e=(k-j-1)//len(l)
ret+=r*e
ans=max(ans,ret)
print(ans)
| N, K = map(int, input().split())
P = [0] + list(map(int, input().split()))
C = [0] + list(map(int, input().split()))
#マスに与えられたスコアが全部負だった場合には,その中で最もダメージの小さいマスを一つ踏んで終わる。
C_max = max(C[1:])
if C_max < 0:
print(C_max)
exit()
ans = 0
done = [False] * (N + 1) #チェック済みのマスはTrueにしていく。(loopはバラバラの構成員で構成されてるので。)
#loopの構成員をもらう。 -→ loopの中でマスaから始まりマスbで止まる操作をする場合の最大スコアを数える。
#の順番で解く。
for i in range(1, N + 1):
if done[i]:
continue
#マスiがチェック済みの場合には何もせずiを次に進める。(continue)
loop = [i] #ここにloopの構成員が記録される。iは最初から入れておく。
now = P[i] #iから一歩進んだマスを起点として,loop構成員の記録を開始する。
while now != i:
loop.append(now)
done[now] = True
now = P[now]
#今立っているマスがiでない場合は,loop構成員リストに記録して,doneをTrueにして,足を一歩進める。
#print(loop)
#loopの構成員のメモが完了!
L = len(loop)
S = sum(C[v] for v in loop) #loopを一周した時のスコア
for a_ind in range(L):
a = loop[a_ind]
score_ab = -C[a]
#例えば[3, 6, 4, 7]のloopがあった時,a = 3→6→4→7 と移っていきたいので,a_ind = 0→1→2...として,a = loop[0]→loop[1]→loop[2]→loop[3]とする。bもまた然り。
for b_ind in range(a_ind, a_ind + L):#aから数週してaに戻るプレイも可能なので,b == aとなる場合も含んでおかなければならない。
dist_ab = b_ind - a_ind
if dist_ab > K:
break
b = loop[b_ind % L]
score_ab += C[b]
max_score = score_ab + max(0, S) * ((K - dist_ab) // L)
#スコアの最大値は,
# S > 0の場合,[aからbまで移動した時のスコア] + S * [可能な限りloopを周回する] (周回した方が得なので)
# S < 0の場合,[aからbまで移動した時のスコア] (周回した方が損なので)
#上の場合分けの切り替えを max(0, S) で行っている!地味にすごい!
ans = max(ans, max_score)
print(ans) | 1 | 5,427,678,650,478 | null | 93 | 93 |
K,N=map(int,input().split())
array=input().split()
A=[]
for i in array:
A.append(int(i))
dist=[]
for i in range(N):
if i!=N-1:
dist.append(A[i+1]-A[i])
else:
dist.append((K-A[i])+A[0])
dist=sorted(dist)
ans=0
for i in range(N-1):
ans+=dist[i]
print(ans) | N,K=map(int,input().split())
A=list(map(int,input().split()))
B=[N-A[K-1]+A[0]]
for i in range(K-1):
b=A[i+1]-A[i]
B.append(b)
B.sort()
print(sum(B)-B[K-1]) | 1 | 43,591,952,593,364 | null | 186 | 186 |
k = int(input())
lis = [1,2,3,4,5,6,7,8,9]
i = 0
while i<9:
X = []
for L in lis:
if i == 0 or L >= 10**i:
s = str(L)
if s[-1] == "0":
X.append(10*L)
X.append(10*L+1)
elif s[-1] == "9":
X.append(10*L+8)
X.append(10*L+9)
else:
X.append(10*L+int(s[-1])-1)
X.append(10*L+int(s[-1]))
X.append(10*L+int(s[-1])+1)
for x in X:
lis.append(x)
i += 1
print(lis[k-1]) | K=int(input())
if K<=9:
print(K)
else:
p=1
dp,old=[[1]*10],[0,1]
n=9
while K>n:
old=dp[p-1]
tmp=[0]*10
for i in range(1,9):
tmp[i]=old[i-1]+old[i]+old[i+1]
tmp[9]=old[8]+old[9]
tmp[0]=old[0]+old[1]
dp.append(tmp)
p+=1
n+=sum(tmp[1:])
ans=0
n-=sum(tmp[1:])
K-=n
c=2
for i in range(p-1,-1,-1):
if c!=0:
c-=1
while K>dp[i][c]:
K-=dp[i][c]
c+=1
ans+=c*10**i
print(ans) | 1 | 40,229,545,116,280 | null | 181 | 181 |
import sys
input_data = input()
input_numbers = input_data.split()
if __name__ == '__main__':
a = int(input_numbers[0])
b = int(input_numbers[1])
c = int(input_numbers[2])
if (a < b) and (b < c) :
print('Yes')
else :
print('No')
| a=map(int, raw_input().split())
if a[0]<a[1]<a[2]:
print("Yes")
else :
print("No") | 1 | 398,868,386,430 | null | 39 | 39 |
n = int(input())
S = input()
a = ord('A')
z = ord('Z')
ans = ''
for s in S:
if ord(s) + n <= 90:
ans += chr(ord(s) + n)
else:
ans += chr(a + ord(s) + n - z - 1)
print(ans)
| N = int(input())
S = input()
base = ord("A")
ans = ""
for i in range(len(S)):
p = (ord(S[i])-base)
s = (p+N) % 26
ans += chr(s+base)
print(ans) | 1 | 134,461,099,404,252 | null | 271 | 271 |
_fib = [0] * 45
def fib(n):
if n < 2:
return 1
if _fib[n] > 0:
return _fib[n]
_fib[n] = fib(n-1) + fib(n-2)
return _fib[n]
n = int(input())
print(fib(n))
| N = int(input())
def memorize(f) :
cache = {}
def helper(*args) :
if args not in cache :
cache[args] = f(*args)
return cache[args]
return helper
@memorize
def fibonacci(n):
if n == 0 or n == 1:
return 1
res = fibonacci(n - 2) + fibonacci(n - 1)
return res
print(fibonacci(N))
| 1 | 1,998,059,940 | null | 7 | 7 |
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)
count=0
for i in range(n-2):
for j in range(i+1,n-1):
for k in range(j+1,n):
if l[i]<l[j]+l[k] and l[i]!=l[j]!=l[k]:
count+=1
print(count) | N,M=map(int, input().split())
a=[0]*(N+1)
w=[0]*(N+1)
for _ in range(M):
p,s=input().split()
p=int(p)
if s=='AC':
a[p]=1
else:
if a[p]==0:
w[p]+=1
a2=0
w2=0
for n in range(N+1):
if a[n]==1:
a2+=a[n]
w2+=w[n]
print(a2, w2)
| 0 | null | 49,497,727,345,570 | 91 | 240 |
def pow(x,n):
res = 1
for _ in range(n):
res *= x
return max(1,res)
def main():
N = int(input())
lists = [0 for i in range(N+1)]
temp = list(map(int,input().split()))
for elem in temp:
lists[elem] += 1
ans = 1
if(lists[0] != 1 or temp[0] != 0):
ans = 0
else:
sum = 1
for i in range(1,N):
ans *= pow(lists[i-1],lists[i])
sum += lists[i]
if(sum == N):
break
if(lists[i] == 0):
if(sum != N):
ans = 0
break
ans %= 998244353
print(ans)
if __name__ == "__main__":
main() | from collections import Counter
N = int(input())
D = list(map(int, input().split()))
c = Counter(D)
mod = 998244353
L = list(set(D[:]))
L.sort(reverse=True)
if (D[0] != 0):
print(0)
exit()
if (c[0] > 1):
print(0)
exit()
if (N == 1):
print(1)
exit()
ans = []
for i in L:
if (i == 0):
break
else:
ans.append(c[i - 1] ** c[i])
# print(ans)
if (len(ans) == 0):
print(0)
exit()
multi_ans = 1
for i in ans:
multi_ans *= i
print(multi_ans % mod)
| 1 | 154,269,453,646,912 | null | 284 | 284 |
import numpy as np
X = int(input())
def make_divisors(n):
lower_divisors , upper_divisors = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n//i)
i += 1
return lower_divisors + upper_divisors[::-1]
div = make_divisors(X)
for i in range(len(div)):
x = div[i]
z = x**4 - X/x
if z%5 == 0:
s = z / 5
if x**4 - 4*s >=0:
y1 =( -x**2 + np.sqrt(x**4 - 4 * s)) / 2
y2 =( -x**2 - np.sqrt(x**4 - 4 * s)) / 2
B1 = (-x + np.sqrt(x**2 + 4*y1))/2
if B1.is_integer():
B = B1
A = B + x
break
B12 = (-x + np.sqrt(x**2 + 4*y2))/2
if B12.is_integer():
B = B12
A = B + x
break
B2 = (-x - np.sqrt(x**2 + 4*y1))/2
if B2.is_integer():
B = B2
A = B + x
break
B21 = (-x - np.sqrt(x**2 + 4*y2))/2
if B21.is_integer():
B = B21
A = B + x
break
print(int(A),int(B))
| def main():
def find(target):
if parent[target] < 0:
return target
else:
parent[target] = find(parent[target])
return parent[target]
def is_same(x, y):
return find(x) == find(y)
def union(x, y):
root_x = find(x)
root_y = find(y)
if root_x == root_y:
return
if parent[root_x] > parent[root_y]:
root_x, root_y = root_y, root_x
parent[root_x] += parent[root_y]
parent[root_y] = root_x
# 今回これ使わないけど、どこに誰がいるのかはこれでわかる
def members(n, x):
root = find(x)
return [i for i in range(n) if find(i) == root]
def get_size(x):
return -parent[find(x)]
def get_root():
return [i for i, root in enumerate(parent) if root < 0]
n, m = map(int, input().split())
parent = [-1 for _ in range(n)]
for _ in range(m):
a, b = map(lambda x: int(x) - 1, input().split())
union(a, b)
ans = len(get_root()) - 1
print(ans)
if __name__ == '__main__':
main() | 0 | null | 14,022,701,157,532 | 156 | 70 |
import base64
import subprocess
import gzip
exe_bin = b'\x1f\x8b\x08\x00<0J_\x02\xff\xddZi\x93\xb2<\xb3\xfe-\x96K\xa9SV!\xe2V\xb8\x81\xa0(\n\x82\xb2\xc8\x07\x15\xdcw\x1d\xdcQ\x7f\xfb\xcb2\xf7\xc4\x9b\x919\xcfSu\xde\xf3\xe1\xe4\xc3L\x9b\x8bt:I\xa7\xbb\xd3\xc9\xb8XD`H\xf7\xf3\x08\x04\x8a\xf1\x98\x05!\x9e\xcf\xc6\x8f\x9bt\xabbW\xd1\xebn(`S:<\xbc\xb5\xc0\xb7\xf4Z\r*p\xa1X\xcbe\xf9f\xf2\x14\xef\x95\xf4T\x9ceT\x04\xb4xG\xf5\xafU\xa1\xef\xa2\xe0\xf5\x12\xcd|I`\xf0\t\x9bK\rJ\xa5\xcev\xd5;*\xf3\xec\xdd\xdb.\xca\x16\x1cP\xf1\xddv\x91\x84~-\x97\xb2!p.\n\x82\xe2\xb8\xf4\xc2\xc5\x1a\x96\xac-\x07N\x9d\xac\xadS\x01\x17\xf5\xf9\x0c\x19N\x83\xf4\xadR\xec\xb8\xb9\xe8z\r\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\xbc\xe6@\x01\x05\xb2~\xbf\xeb\xdf\x1c>\xcf\xf7.~ G\x01(\'9\xef\xf5.\x08P\xabu\xf5\xecw\xf1\x03Y\r@\xbd\x9b\xfb\x97\xbb\xe8oj;J\xea\xa8\x8b\x1f8\xb1\x00J\x9c\x8e\x16\x15O\xf9\\\xef_\\\xfc\xc09\x05P\xaekm\xcf\xf9\xd3\xb9B\xe9\xe9\xb2W\xe0$\x07(\xd7U\xb7\'?\xeb\xca4\xed\xe2\xf7\xfbk\xaf\xdf\xf9\xdd\xa4R\xa3\xe1\xe2\x07\xf29\x80*\xa39n\xe2\xb9\x1e/\xf7\xce\xbb\x0c\':\xb7\xeb\xdf9\xe9\xd7\x17`\x7f^\x85\xbd\x9b\xfbw\xeb\x1b\x19\xf663\xe7>\xfe\x9b\x1f8\x9f\x0f7\x07}\xfd\xaf\xf4\xc5\xba\xae>8K\xfb\x923\x07/\xf7\xfe\xbc\xe6\x03\xef\xf5\x80\x1e\x00.@z\'\x0fb\xcf\xdf\x9b\x1c\xfc\x84P>\xcf\x9e\xfb\xe3\x9d|\x05j\x1f\t\xb8\xf8\xbd\x9c\x1b\xe3W\xbc\xfa\x0f\xe6\xef\xe5\xcd\x84u\x81\xe7\x00\xdf\xfc^N\xa9D\xe4C\xfa\xb2\xd4\xfb^\xc8\xd5\x16\xbc\xef\x04\xa5\xe7\xc7\xee\x05[>\xfb\x99\x8b{G}\xf3#*\xa9\xce\xc4\xdb\xde\xbb(\xaf\xfb-z\x9b-9+]*\x93\xb9"\x88\x00\xc8Q\'\xb8xg\xff\x9c}\xf9\xf7\x1b\x8c\x17\xef<\x0c\\c_\x9e\x98\x9bu\xff\x81?J\x8e\x94\x08\xe5\xc9o\xefO\xd5\xe9\xbf\xf2C\xff\x13\xbf\xff\x00\xd1\x89Y\xb8\xa2+\x00\x00'
exe_bin = base64.b85decode(gzip.decompress(exe_bin))
with open("./kyomu", 'wb') as f:
f.write(exe_bin)
subprocess.run(["chmod +x ./kyomu"], shell=True)
subprocess.run(["./kyomu"], shell=True) | import bisect
def main():
N = int(input())
S = input()
R, G, B = [], [], []
for i, s in enumerate(S):
if s == 'R':
R.append(i)
elif s == 'G':
G.append(i)
else:
B.append(i)
global ans
ans = 0
count(R, G, B)
count(R, B, G)
count(G, R, B)
count(G, B, R)
count(B, R, G)
count(B, G, R)
print(ans)
def count(I, J, K):
global ans
for j in J:
i_list = I[:bisect.bisect_left(I, j)]
k_list = set(K[bisect.bisect_right(K, j):])
remove = len([i for i in i_list if (2 * j - i) in k_list])
ans += len(i_list) * len(k_list) - remove
if __name__ == '__main__':
main()
| 0 | null | 21,084,261,010,878 | 95 | 175 |
S = input()
Q = int(input())
now = 1
head = ''
last = ''
for _ in range(Q):
query = input().split()
if query[0] == '1':
now = now * -1
if query[0] == '2':
if now * (int(query[1])-1.5) == 0.5:
last += query[2]
else:
head += query[2]
ans = head[::-1] + S + last
if now == 1:
print(ans)
else:
print(ans[::-1]) | # -*- coding: utf-8 -*-
#############
# Libraries #
#############
import sys
input = sys.stdin.readline
import math
#from math import gcd
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache
#############
# Constants #
#############
MOD = 10**9+7
INF = float('inf')
AZ = "abcdefghijklmnopqrstuvwxyz"
#############
# Functions #
#############
######INPUT######
def I(): return int(input().strip())
def S(): return input().strip()
def IL(): return list(map(int,input().split()))
def SL(): return list(map(str,input().split()))
def ILs(n): return list(int(input()) for _ in range(n))
def SLs(n): return list(input().strip() for _ in range(n))
def ILL(n): return [list(map(int, input().split())) for _ in range(n)]
def SLL(n): return [list(map(str, input().split())) for _ in range(n)]
######OUTPUT######
def P(arg): print(arg); return
def Y(): print("Yes"); return
def N(): print("No"); return
def E(): exit()
def PE(arg): print(arg); exit()
def YE(): print("Yes"); exit()
def NE(): print("No"); exit()
#####Shorten#####
def DD(arg): return defaultdict(arg)
#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)
######Combination######
kaijo_memo = []
def kaijo(n):
if(len(kaijo_memo) > n): return kaijo_memo[n]
if(len(kaijo_memo) == 0): kaijo_memo.append(1)
while(len(kaijo_memo) <= n): kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
return kaijo_memo[n]
gyaku_kaijo_memo = []
def gyaku_kaijo(n):
if(len(gyaku_kaijo_memo) > n): return gyaku_kaijo_memo[n]
if(len(gyaku_kaijo_memo) == 0): gyaku_kaijo_memo.append(1)
while(len(gyaku_kaijo_memo) <= n): gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
return gyaku_kaijo_memo[n]
def nCr(n,r):
if n == r: return 1
if n < r or r < 0: return 0
ret = 1
ret = ret * kaijo(n) % MOD
ret = ret * gyaku_kaijo(r) % MOD
ret = ret * gyaku_kaijo(n-r) % MOD
return ret
######Factorization######
def factorization(n):
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
if temp%i==0:
cnt=0
while temp%i==0:
cnt+=1
temp //= i
arr.append([i, cnt])
if temp!=1: arr.append([temp, 1])
if arr==[]: arr.append([n, 1])
return arr
#####MakeDivisors######
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)
return divisors
#####MakePrimes######
def make_primes(N):
max = int(math.sqrt(N))
seachList = [i for i in range(2,N+1)]
primeNum = []
while seachList[0] <= max:
primeNum.append(seachList[0])
tmp = seachList[0]
seachList = [i for i in seachList if i % tmp != 0]
primeNum.extend(seachList)
return primeNum
#####GCD#####
def gcd(a, b):
while b: a, b = b, a % b
return a
#####LCM#####
def lcm(a, b):
return a * b // gcd (a, b)
#####BitCount#####
def count_bit(n):
count = 0
while n:
n &= n-1
count += 1
return count
#####ChangeBase#####
def base_10_to_n(X, n):
if X//n: return base_10_to_n(X//n, n)+[X%n]
return [X%n]
def base_n_to_10(X, n):
return sum(int(str(X)[-i-1])*n**i for i in range(len(str(X))))
def base_10_to_n_without_0(X, n):
X -= 1
if X//n: return base_10_to_n_without_0(X//n, n)+[X%n]
return [X%n]
#####IntLog#####
def int_log(n, a):
count = 0
while n>=a:
n //= a
count += 1
return count
#############
# Main Code #
#############
class BIT:
def __init__(self, logn):
self.n = 1<<logn
self.data = [0]*(self.n+1)
self.el = [0]*(self.n+1)
def sum(self, i):
s = 0
while i > 0:
s += self.data[i]
i -= i & -i
return s
def add(self, i, x):
# assert i > 0
self.el[i] += x
while i <= self.n:
self.data[i] += x
i += i & -i
def get(self, i, j=None):
if j is None:
return self.el[i]
return self.sum(j) - self.sum(i)
def bisect(self, x):
w = i = 0
k = self.n
while k:
if i+k <= self.n and w + self.data[i+k] <= x:
w += self.data[i+k]
i += k
k >>= 1
return i+1
N = I()
A = list(S())
Q = I()
dic = {l:BIT(int_log(N,2)+1) for l in AZ}
for i in range(N):
s = A[i]
dic[s].add(i+1,1)
def change(i,y):
prev = A[i-1]
if prev == y:
pass
else:
A[i-1] = y
dic[prev].add(i,-1)
dic[y].add(i,1)
def count(x,y):
ret = 0
for l in AZ:
if dic[l].sum(x-1) != dic[l].sum(y):
ret += 1
print(ret)
for _ in range(Q):
t,x,y = SL()
if t == "1":
change(int(x),y)
else:
count(int(x),int(y))
| 0 | null | 59,665,982,316,288 | 204 | 210 |
s = input()
n = len(s)
c = 0
for i in range(int((n - 1)/2)):
if (s[i] != s[n - 1 - i]):
c = 1
x = int((n - 1)/2)
for i in range(x):
if (s[i] != s[x - 1 - i]):
c = 1
if (c == 1):
print("No")
else:
print("Yes")
| def is_palindrome(text):
l = len(text)
for i in range(l // 2 if l % 2 == 0 else (l + 1) // 2):
if text[i] != text[l - 1 - i]:
return False
return True
s = input()
q1 = is_palindrome(text=s)
q2 = is_palindrome(text=s[0:(len(s) - 1) // 2])
q3 = is_palindrome(text=s[(len(s) + 3) // 2 - 1:len(s)])
print("Yes" if q1 and q2 and q3 else "No") | 1 | 46,159,642,819,332 | null | 190 | 190 |
def cal(XL):
N = len(XL)
XL.sort(key = lambda x:x[0])
for i in range(N):
XL[i] = [XL[i][0],XL[i][0]-XL[i][1],XL[i][0]+XL[i][1]]
OP = [XL[0]]
for i in range(1,N):
if OP[len(OP)-1][2] > XL[i][1]:
if OP[len(OP)-1][2] < XL[i][2]:
#右方向により腕が伸びている方がより邪魔
pass
else:
OP.pop()
OP.append(XL[i])
else:
OP.append(XL[i])
return len(OP)
def main():
N = int(input())
XL = [list(map(int,input().split())) for _ in range(N)]
ans = cal(XL)
print(ans)
if __name__ == "__main__":
main()
| s = input()[::-1]
dataset = [0]*2019
dataset[0] = 1
n = 0
d = 1
for i in s:
n += int(i) * d
a = n % 2019
dataset[a] += 1
d *= 10
d %= 2019
count = 0
for i in dataset:
count += i * (i-1) // 2
print(count) | 0 | null | 60,542,838,092,700 | 237 | 166 |
N = int(input())
if N % 2 == 0 :
print("{}".format(N//2-1))
else:
print("{}".format(N//2)) | #import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline
def main():
n=int(input())
ans=0
for i in range(1,n):
if (i!=n-i and i<n-i):
ans+=1
elif i>n-1:
break
print(ans)
if __name__ == '__main__':
main()
| 1 | 153,531,527,780,000 | null | 283 | 283 |
n = int(input())
l = list(sorted(map(int, input().split())))
x = 0
if n >= 3:
for k in range(n - 2):
for j in range(k + 1):
for i in range(j + 1):
if l[i] < l[j + 1] < l[k + 2] and l[i] + l[j + 1] > l[k + 2]:
x += 1
print(x) | import sys
sys.setrecursionlimit(300000)
from itertools import combinations
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')
N = I()
L = LMI()
ans = 0
for a, b, c in combinations(L, 3):
if a == b or b == c or c == a:
continue
if a + b > c and b + c > a and c + a > b:
ans += 1
print(ans)
| 1 | 5,077,110,221,762 | null | 91 | 91 |
while True:
H, W = map(int, input().split())
if H == 0 and W == 0:
break
for i in range(H):
for j in range(W):
if i == 0 or i == (H - 1) or j == 0 or j == (W - 1):
print('#', end='')
else:
print('.', end='')
print()
print()
| while True:
H, W = map(int, input().split())
if not(H or W):
break
print('#' * W)
for i in range(H-2):
print('#' + '.' * (W - 2) + '#')
print('#' * W, end='\n\n') | 1 | 834,679,068,828 | null | 50 | 50 |
h,n=map(int,input().split())
INF=10**18
dp=[INF]*(h+1)
dp[0]=0
for _ in range(n):
a,b=map(int,input().split())
for i in range(h+1):
dp[min(i+a,h)]=min(dp[min(i+a,h)],dp[i]+b)
print(dp[h]) | def s_print(s, line):
a, b = map(int, line.split()[1:])
print(s[a:b + 1])
return s
def s_reverse(s, line):
a, b = map(int, line.split()[1:])
return s[:a] + s[a:b + 1][::-1] + s[b + 1:]
def s_replace(s, line):
ls = line.split()
a, b = map(int, ls[1:3])
rep = ls[-1]
return s[:a] + rep + s[b + 1:]
func_dict = {'pri': s_print, 'rev': s_reverse, 'rep': s_replace}
s, q = input(), int(input())
while q:
line = input()
s = func_dict[line[:3]](s, line)
q -= 1 | 0 | null | 41,446,231,426,090 | 229 | 68 |
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
def calcScore(t, s, c):
scores = [0]*26
lasts = [0]*26
for i in range(1, len(t)):
scores[t[i]] += s[i][t[i]]
dif = i - lasts[t[i]]
scores[t[i]] -= c[t[i]] * dif * (dif-1) // 2
lasts[t[i]] = i
for i in range(26):
dif = len(t) - lasts[i]
scores[i] -= c[i] * dif * (dif-1) // 2
return scores
def update(socre, day, t, q):
p = t[day]
t[day] = q
scores[p] = 0
scores[q] = 0
lasts = [0]*26
for i in range(1, len(t)):
if t[i] == p or t[i] == q:
scores[t[i]] += s[i][t[i]]
dif = i - lasts[t[i]]
scores[t[i]] -= c[t[i]] * dif * (dif-1) // 2
lasts[t[i]] = i
for i in [p, q]:
dif = len(t) - lasts[i]
scores[i] -= c[i] * dif * (dif-1) // 2
return scores
def greedy(c, s):
day_lim = len(s)
socres = [0]*26
t = [0]*day_lim
lasts = [0]*26
for i in range(1, day_lim):
pls = [v for v in socres]
mns = [v for v in socres]
for j in range(26):
pls[j] += s[i][j]
mns[j] -= c[j] * (i - lasts[j])
sum_mns = sum(mns)
pt = sum_mns - mns[0] + pls[0]
idx = 0
for j in range(1, 26):
tmp = sum_mns - mns[j] + pls[j]
if pt < tmp:
pt = tmp
idx = j
t[i] = idx
lasts[idx] = i
for j in range(26):
if j == idx:
socres[j] = pls[j]
else:
socres[j] = mns[j]
return socres, t
D = int(input())
c = list(map(int, input().split()))
s = [[0]*26 for _ in range(D+1)]
for i in range(1, D+1):
s[i] = list(map(int, input().split()))
scores, t = greedy(c, s)
for v in t[1:]:
print(v+1) | for i in range(365):
print(26-i%26) | 1 | 9,666,514,762,870 | null | 113 | 113 |
print(int(input())**2) | ans = 0
s = []
for i in range(int(input())):
a,b = map(int,input().split())
if a==b:
ans += 1
s.append(ans)
else:
ans = 0
if len(s)!=0 and max(s)>=3:
print('Yes')
elif len(s)==0:
print('No')
else:
print('No') | 0 | null | 73,539,990,026,336 | 278 | 72 |
def calc(X):
A = 1
B = 1
if X == 0:
return A,B
else:
l_bound = 1
h_bound = 200
for i in range(l_bound,h_bound):
for j in range(0,i+1):
if i ** 5 - j ** 5 == X:
A = i
B = j
return A,B
if i ** 5 + j ** 5 == X:
A = i
B = -j
return A,B
def resolve():
X = int(input())
A,B = calc(X)
print(str(A) + " " + str(B))
resolve() | from collections import deque
n = int(input())
d = deque()
for _i in range(n):
line = input().split()
order = line[0]
if order in ('insert', 'delete'):
key = line[1]
if order == 'insert':
d.appendleft(key)
elif order == 'delete':
try:
d.remove(key)
except ValueError:
pass
elif order == 'deleteFirst':
d.popleft()
elif order == 'deleteLast':
d.pop()
else:
raise ValueError('Invalid order: {order}')
print(' '.join(d))
| 0 | null | 12,691,407,663,928 | 156 | 20 |
def main():
from collections import deque
K = int(input())
if K <= 9:
print(K)
return
q = deque()
for i in range(1, 10):
q.append(i)
count = 9
while True:
get_num = q.popleft()
for i in range(-1, 2):
add_num = get_num % 10 + i
if 0 <= add_num and add_num <= 9:
q.append(get_num * 10 + add_num)
count += 1
if count == K:
print(q.pop())
return
if __name__ == '__main__':
main() | # Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx): return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
toret = {}
for tup in temp:
toret[tup[0]] = tup[1]
return toret
def sortDictWithKey(passedDic):
return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
'''
1,2,3,4,5,6,7,8,9,10,11,12,21,22,23,32,33,34,43,44,45,54,55,56,65,66,67,76,77,78,87,88,89,98,99,100 (36)
101,110,111,112,121,122,123,210,211,212,221,222,223,232,233,234,
1
10
11
12
100
101
110
111
112
121
122
123
1000
1001
1002
'''
#precomp:
nums = []
def precomp(i):
temp = str(i)
x=[-1,0,1]
for j in range(3):
foo = int(temp[-1])+x[j]
if(foo>=0 and foo<=9):
toadd = int(temp+str(foo))
if (i > 3234566667):
return
nums.append(toadd)
precomp(toadd)
for i in range(1, 10):
nums.append(i)
precomp(i)
nums.sort()
k = INT()
print(nums[k-1])
# k = INT()
| 1 | 39,787,402,880,064 | null | 181 | 181 |
def main():
a_lst = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b_lst = [int(input()) for _ in range(n)]
appear = [[False for _ in range(3)] for _ in range(3)]
is_bingo = False
for b in b_lst:
for r in range(3):
for c in range(3):
if a_lst[r][c] == b:
appear[r][c] = True
for r in range(3):
if appear[r][0] == True and appear[r][1] == True and appear[r][2] == True:
is_bingo = True
for c in range(3):
if appear[0][c] == True and appear[1][c] == True and appear[2][c] == True:
is_bingo = True
if appear[0][0] == True and appear[1][1] == True and appear[2][2] == True:
is_bingo = True
if appear[0][2] == True and appear[1][1] == True and appear[2][0] == True:
is_bingo = True
if is_bingo:
ans = "Yes"
else:
ans = "No"
print(ans)
if __name__ == "__main__":
main()
| MOD = 998244353
N = int(input())
D = list(map(int,input().split()))
lis = [0] * (max(D)+1)
if D[0] != 0:
print(0)
exit()
for i in D:
lis[i] += 1
if lis[0] == 0 or lis[0] > 1:
print(0)
exit()
ans = 1
for i in range(1,len(lis)):
ans *= pow(lis[i-1],lis[i], MOD)
ans %= MOD
print(ans)
| 0 | null | 107,882,929,906,092 | 207 | 284 |
X, Y = map(int, input().split())
print(400000*(X==1)*(Y==1) + max(0, 400000-100000*X) + max(0, 400000-100000*Y)) | x, y = map(int, input().split())
def shokin(z):
if z == 1:
return 300000
elif z == 2:
return 200000
elif z == 3:
return 100000
else:
return 0
v = 0
if x == 1 and y == 1:
v = 400000
print(shokin(x)+shokin(y)+v) | 1 | 140,517,008,319,048 | null | 275 | 275 |
N= int(input())
a = [0]*110000
if N == 2:
print(2)
else:
for i in range(2,N):
k = i
j = 2
while k<110000:
a[k]+=1
k = int((k/(j-1))*j)
j+=1
for i in range(N,110001):
if a[i]>0:
continue
elif a[i]==0:
print(i)
break | import math
x = int(input())
ans =x
for j in range(x,2*x):
flag=1
for i in range(2,int(math.sqrt(x))+1):
if x%i==0:
flag=0
if flag==1:
print(x)
exit(0)
x+=1 | 1 | 105,646,433,940,828 | null | 250 | 250 |
x = int(input())
flag = 0
for a in range(x):
b5 = a**5 - x
for b in range(120):
if abs(b5) == int(b**5):
if b5 < 0:
b = -b
flag = 1
break
if flag:
break
print(a, int(b))
| def main():
x = int(input())
a, b = 1, 0
while True:
for b in reversed(range(-a + 1, a)):
# print(a, b)
q = a**5 - b**5
if q == x:
print(f'{a} {b}')
return
a += 1
main() | 1 | 25,386,744,334,748 | null | 156 | 156 |
import math
N = int(input())
ans = [0]*(N+1)
Nruto = math.sqrt(N)
Nruto = math.floor(Nruto)+1
for x in range(1, Nruto):
for y in range(1, Nruto):
for z in range(1, Nruto):
n = x**2+y**2+z**2+x*y+y*z+z*x
if n <= N:
ans[n] += 1
for i in range(1, N+1):
print(ans[i])
| N = int(input())
ans = [0] * N
for i in range(1, 101):
for j in range(1, 101):
for k in range(1, 101):
tmp = i**2+j**2+k**2+i*j+j*k+k*i
if tmp <= N:
ans[tmp-1] += 1
print(*ans, sep='\n') | 1 | 7,991,805,430,344 | null | 106 | 106 |
#!/usr/bin/env python3
import sys
def solve(a: int):
poly = a + a**2 + a**3
return poly
# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools (tips: You use the default template now. You can remove this line by using your custom template)
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
a = int(next(tokens)) # type: int
print(solve(a))
if __name__ == '__main__':
main()
| def main():
import math
s = int(input())
mod = 10**9+7
c = s//3
ans = 0
for i in range(1,c+1):
l = s - i*3
ans += (math.factorial(l+i-1)//math.factorial(l)//math.factorial(i-1)) % mod
print(ans%mod)
if __name__ == "__main__":
main() | 0 | null | 6,772,054,715,840 | 115 | 79 |
n=int(input())
p=10**9+7
A=list(map(int,input().split()))
binA=[]
for i in range(n):
binA.append(format(A[i],"060b"))
exp=[1]
for i in range(60):
exp.append((exp[i]*2)%p)
ans=0
for i in range(60):
num0=0
num1=0
for j in range(n):
if binA[j][i]=="0":
num0+=1
else:
num1+=1
ans=(ans+num0*num1*exp[59-i])%p
print(ans)
| N = int(input())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
ones = 0
for a in A:
# 数列Aの全要素の(二進法表記の)i桁目の1の数を集計する
if a & (1 << i):
ones += 1
# Aの要素から任意の2つを選んで排他的論理和をとってできた数列をBとすると、
# 数列Bの全要素のi桁目の合計は、(Aのi桁目の1の数)*(0の数)となる
# 選んだ2つのAの要素が(0,1)の組み合わせになっている場合(XOR)だけに、Bの桁を構成する要素になるため
ans = (ans + ones * (N - ones) * (1 << i)) % mod
print(ans) | 1 | 123,339,575,167,350 | null | 263 | 263 |
a,b,c=(int(x) for x in input().split())
print(c,a,b) | str = input()
cnt = 0
if str[0]=="R" and str[1]=="R" and str[2]=="R":
cnt = 3
elif (str[0]=="R" and str[1]=="R") or (str[1]=="R" and str[2]=="R"):
cnt = 2
elif str[0]=="R" or str[1]=="R" or str[2]=="R":
cnt = 1
print(cnt) | 0 | null | 21,398,154,266,582 | 178 | 90 |
n = int(input())
Nlist = input().split()
for i in range(n-1):
print(Nlist[n-i-1],end=" ")
print(Nlist[0]) | _, lis = input(), list(input().split())[::-1]
print(*lis)
| 1 | 973,281,846,610 | null | 53 | 53 |
def main():
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9+7
#main code here!
h,w,k=MI()
cake=[SI() for i in range(h)]
last=[-1 for i in range(w)]
for i in range(w):
for j in range(h):
if cake[j][i]=="#":
last[i]=j
lis=[[0]*w for i in range(h)]
ans=0
for i in range(w):
if last[i]==-1:
continue
if last[i]!=-1:
ans+=1
for j in range(h):
lis[j][i]=ans
if cake[j][i]=="#":
if last[i]!=j:
ans+=1
#print(lis)
pos=[]
for i in range(w):
if last[i]!=-1:
pos.append(i)
pos.append(w)
for i in range(w):
if last[i]==-1:
u=pos[bisect_left(pos,i)]
#print(u)
if u!=w:
for j in range(h):
lis[j][i]=lis[j][u]
else:
for j in range(h):
lis[j][i]=lis[j][pos[-2]]
for i in range(h):
print(*lis[i])
#print(lis)
if __name__=="__main__":
main()
| H,W,K=map(int,input().split())
smat=[[1 if x=="#" else 0 for x in input()] for _ in range(H)]
#print(smat)
answer_mat=[[0]*W for _ in range(H)]
cnt=1
lastrow_exist=-1
for i in range(H):
row_num=sum(smat[i])
if row_num==0:
continue
elif row_num==1:
for j in range(W):
for ii in range(lastrow_exist+1,i+1):
answer_mat[ii][j]=cnt
cnt+=1
lastrow_exist=i
else:
berry_list=[0]*W
isFirst=True
for j in range(W):
if smat[i][j]==1:
if not isFirst:
cnt+=1
else:
isFirst=False
berry_list[j]=cnt
for j in range(W):
for ii in range(lastrow_exist+1,i+1):
answer_mat[ii][j]=berry_list[j]
cnt+=1
lastrow_exist=i
if lastrow_exist<H-1:
for j in range(W):
for ii in range(lastrow_exist+1,H):
answer_mat[ii][j]=answer_mat[lastrow_exist][j]
for i in range(H):
print(*answer_mat[i]) | 1 | 143,868,461,467,266 | null | 277 | 277 |
W = input()
counter = 0
T = []
while True:
string = input()
if string == "END_OF_TEXT":
break
else:
T.append(string)
for i in range(len(T)):
memo = T[i].split()
for j in range(len(memo)):
if memo[j].lower() == W:
counter += 1
print(counter) | # 19-String-Finding_a_Word.py
# ?????????????´¢
# ??????????????? W ??¨?????? T ????????????????????????T ??????????????? W ?????°???????????????????????°?????????????????????????????????
# ?????? T ????????????????????????????????????????????§????????????????????????????????? Ti ??¨????????????
# ???????????? Ti ?????????????????? W ??¨??????????????????????????°??????????????????
# ???????????§????????¨?°???????????????\???????????????
# Constraints
# W????????????????????????10????¶????????????????
# T??????????????????????????????????????????1000????¶????????????????
# Input
# ?????????????????? W ????????????????????????
# ?¶???????????????°????????????????????£??????????????????????????????
# END_OF_TEXT ??¨??????????????????????????????????????????????????????
# Output
# ?????? W ?????°???????????????????????????
# Sample Input
# computer
# Nurtures computer scientists and highly-skilled computer engineers
# who will create and exploit "knowledge" for the new era.
# Provides an outstanding computer environment.
# END_OF_TEXT
# Sample Output
# 3
# Note
import re
count=0
w = input().lower()
while 1:
string = input()
if string=="END_OF_TEXT":
break;
string=string.lower().split()
for i in string:
count += w==i
print(count) | 1 | 1,825,346,543,200 | null | 65 | 65 |
n, m, l = map(int, raw_input().split(" "))
a = [map(int, raw_input().split(" ")) for j in range(n)]
b = [map(int, raw_input().split(" ")) for i in range(m)]
c = [[0 for k in range(l)] for j in range(n)]
for j in range(n):
for k in range(l):
for i in range(m):
c[j][k] += a[j][i] * b[i][k]
for j in range(n):
print " ".join(map(str, (c[j]))) | n, m, l = map(int, input().split())
A, B = [], []
for _ in range(n):
A.append(list(map(int, input().split())))
for _ in range(m):
B.append(list(map(int, input().split())))
C = []
B_T = list(zip(*B))
for a_row in A:
C.append([sum(a * b for a, b, in zip(a_row, b_column)) for b_column in B_T])
for row in C:
print(' '.join(map(str, row))) | 1 | 1,431,964,749,600 | null | 60 | 60 |
x,y = map(int,input().split(" "))
def gdp(x,y):
if x > y:
big = x
small = y
else:
big = y
small = x
if big%small == 0:
print(small)
return
else:
gdp(small,big%small)
gdp(x,y)
| a, b = map(int, input().split())
def gcd(a, b):
if a == b:
return a
big = max(a, b)
small = min(a, b)
while not big % small == 0:
big, small = small, big%small
return small
print(gcd(a, b))
| 1 | 8,234,503,940 | null | 11 | 11 |
K, N = list(map(int, input().split()))
houses = list(map(int, input().split()))
min_dist = K
for i in range(N):
if i == 0:
dist = houses[-1] - houses[i]
else:
dist = houses[i] - houses[i-1]
dist = K - dist
if dist < min_dist:
min_dist = dist
print(min_dist) | K,N=map(int,input().split())
Alist=list(map(int,input().split()))
Alist+=[Alist[0]+K]
diflist=[Alist[i+1]-Alist[i] for i in range(N)]
print(K-max(diflist)) | 1 | 43,321,200,148,948 | null | 186 | 186 |
def abc160c_traveling_salesman_around_lake():
k, n = map(int, input().split())
a = list(map(int, input().split()))
total = 0
max_distance = 0
for i in range(n - 1):
total += a[i + 1] - a[i]
max_distance = max(max_distance, a[i + 1] - a[i])
total += k - a[n - 1] + a[0]
max_distance = max(max_distance, k - a[n - 1] + a[0])
print(total-max_distance)
abc160c_traveling_salesman_around_lake() | K, N = list(map(lambda x: int(x), input().split(" ")))
A = list(map(lambda a: int(a), input().split(" ")))
D = [A[i + 1] - A[i] if i < len(A) - 1 else K - A[i] + A[0] for i in range(len(A))]
D.sort()
print(K - D[-1]) | 1 | 43,367,757,591,848 | null | 186 | 186 |
from sys import stdin,stdout #
import math #
import heapq #
#
t = 1 #
def aint(): #
return int(input().strip()) #
def lint(): #
return list(map(int,input().split())) #
def fint(): #
return list(map(int,stdin.readline().split())) #
#
########################################################
def main():
n=aint()
l=lint()
ans=0
for i in range(0,n,2):
if l[i]%2:
ans+=1
print(ans)
return
#t=int(input())
########################################################
for i in range(t): #
#print("Case #"+str(i+1)+":",end=" ") #
main() # | n = input().strip()
h = list(map(int, input().strip().split()))
m = 0
for i in range(len(h)):
d = h[i - 1] - h[i]
if i > 0 and d >= 0:
m += d
h[i] += d
print(m) | 0 | null | 6,111,400,400,288 | 105 | 88 |
N = int(input())
a = list(map(int, input().split()))
S = 0
for aa in a:
S ^= aa
ans = ""
for ai in a:
ans += f'{str(S ^ ai)} '
print(ans.rstrip())
| # pypy
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
R, C, K = map(int, readline().split())
rcv = list(map(int, read().split()))
rc2v = {}
for rr, cc, vv in zip(rcv[::3], rcv[1::3], rcv[2::3]):
rc2v[(rr, cc)] = vv
dp = [[0]*4 for c in range(C+1)]
for r in range(1, R+1):
for c in range(1, C+1):
v = rc2v[(r, c)] if (r, c) in rc2v else 0
dp[c][0] = max(dp[c-1][0], max(dp[c]))
dp[c][1] = max(dp[c-1][1], dp[c][0] + v)
dp[c][2] = max(dp[c-1][2], dp[c-1][1] + v)
dp[c][3] = max(dp[c-1][3], dp[c-1][2] + v)
print(max(dp[-1])) | 0 | null | 9,028,936,788,752 | 123 | 94 |
ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
x = ni()
if x>=30:
f=True
else:
f=False
yn(f)
| tem = int(input())
if tem >= 30:
print("Yes")
else:
print("No") | 1 | 5,740,500,651,020 | null | 95 | 95 |
for val in range(input()):
x = map(int,raw_input().split(' '))
x.sort()
if x[0]**2+x[1]**2==x[2]**2: print 'YES'
else: print 'NO' | import sys
def main():
input = sys.stdin.buffer.readline
a, b, c = map(int, input().split())
print("Yes" if 4 * a * b < (c - a - b) ** 2 and c - a - b > 0 else "No")
if __name__ == "__main__":
main()
| 0 | null | 25,675,077,602,304 | 4 | 197 |
def solve():
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
ans = sum(H[:max(N-K,0)])
return ans
print(solve()) | N = int(input())
hen = []
hen = list(int(x) for x in input().split())
hen.sort()
#print(hen)
#hen_u = set(hen)
#print(hen_u)
tri = 0
for a in hen:
for b in hen:
if(a == b)or (a > b):
continue
for c in hen:
if(a == c)or(b == c) or (a > c) or (b > c):
continue
if(a+b >c)and(b+c >a)and(c+a >b):
tri += 1
print(tri) | 0 | null | 42,007,489,004,200 | 227 | 91 |
import random
import time
def search(day, c, s):
schedule = []
satisfy = []
score = 0
date = [0] * 26
for d in range(day):
tmp = 0
contest = 0
nmax = -float('inf')
for i in range(26):
tmp += c[i] * (d + 1 - date[i])
for i in range(26):
tmp2 = s[d][i] - tmp + c[i] * (d + 1 - date[i])
if nmax < tmp2:
nmax = tmp2
contest = i
satisfy.append(tmp - c[contest] * (d + 1 - date[contest]))
date[contest] = d + 1
schedule.append(contest)
score += s[d][contest] - satisfy[d]
return score, schedule, satisfy
def change(day, contest,D, c, s, schedule, satisfy):
ret = 0
date = [0] * 26
for d in range(D):
if d == day:
now = contest + 1
date[now - 1] = d + 1
else:
now = schedule[d] + 1
date[now - 1] = d + 1
if d < day:
ret += satisfy[d]
continue
tmp = 0
for i in range(26):
tmp += c[i] * (d+1 - date[i])
ret += tmp
satisfy[d] = tmp
return ret
def Main():
D = int(input())
c = tuple(map(int, input().split()))
s = [tuple(map(int, input().split())) for _ in range(D)]
dissatisfy=[]
schedule = []
score = 0
start = time.time()
ans, schedule, dissatisfy = search(D, c, s)
for i in range(D):
score += s[i][schedule[i]]
while time.time() - start < 1.95:
contest = random.randint(0, 25)
day = random.randint(0, D - 1)
if schedule[day] == contest:
continue
save = dissatisfy.copy()
dec2 = change(day,contest,D,c, s, schedule, dissatisfy)
score2 = score - s[day][schedule[day]] + s[day][contest]
if ans < score2 - dec2:
ans = score2 - dec2
score = score2
schedule[day] = contest
else:
dissatisfy = save
for i in range(D):
print(schedule[i] + 1)
if __name__ == "__main__":
Main() | from random import randint
import sys
input = sys.stdin.readline
INF = 9223372036854775808
def calc_score(D, C, S, T):
"""
開催日程Tを受け取ってそこまでのスコアを返す
コンテストi 0-indexed
d 0-indexed
"""
score = 0
last = [0]*26 # コンテストiを前回開催した日
for d, t in enumerate(T):
last[t] = d + 1
for i in range(26):
score -= (d + 1 - last[i]) * C[i]
score += S[d][t]
return score
def update_score(D, C, S, T, score, ct, ci):
"""
ct日目のコンテストをコンテストciに変更する
スコアを差分更新する
ct: change t 変更日 0-indexed
ci: change i 変更コンテスト 0-indexed
"""
last = [0]*26 # コンテストiを前回開催した日,0-indexed:1-indexed
for d in range(ct):
last[T[d]] = d + 1
prei = T[ct] # 変更前に開催する予定だったコンテストi
score -= S[ct][prei]
score += S[ct][ci]
return score
def evaluate(D, C, S, T, k):
"""
d日目終了時点での満足度を計算し,
d + k日目終了時点での満足度の減少も考慮する
"""
score = 0
last = [0]*26
for d, t in enumerate(T):
last[t] = d + 1
for i in range(26):
score -= (d + 1 - last[i]) * C[i]
score += S[d][t]
for d in range(len(T), min(len(T) + k, D)):
for i in range(26):
score -= (d + 1 - last[i]) * C[i]
return score
def greedy(D, C, S):
Ts = []
for k in range(5, 13):
T = [] # 0-indexed
max_score = -INF
for d in range(D):
# d+k日目終了時点で満足度が一番高くなるようなコンテストiを開催する
max_score = -INF
best_i = 0
for i in range(26):
T.append(i)
score = evaluate(D, C, S, T, k)
if max_score < score:
max_score = score
best_i = i
T.pop()
T.append(best_i)
Ts.append((max_score, T))
return max(Ts, key=lambda pair: pair[0])
def local_search(D, C, S, score, T):
for k in range(4000):
ct = randint(0, D-1)
ci = randint(0, 25)
ori = T[ct]
T[ct] = ci
new_score = calc_score(D, C, S, T)
# 差分更新がバグってそう
if score < new_score:
score = new_score
else:
T[ct] = ori
return T
if __name__ == '__main__':
D = int(input())
C = [int(i) for i in input().split()]
S = [[int(i) for i in input().split()] for j in range(D)]
init_score, T = greedy(D, C, S)
T = local_search(D, C, S, init_score, T)
for t in T:
print(t+1)
| 1 | 9,728,361,627,670 | null | 113 | 113 |
N = int(input())
for i in range(N):
a, b, c = map(int, input().split())
sort = sorted([a, b, c])
if sort[0]**2 + sort[1]**2 == sort[2]**2:
print("YES")
else:
print("NO") | print "\n".join(s for s in map(lambda x:x[0]+x[1]==x[2] and 'YES' or 'NO', [sorted(int(x)**2 for x in raw_input().split(' ')) for i in range(int(raw_input()))])) | 1 | 250,676,000 | null | 4 | 4 |
import sys
sys.setrecursionlimit(10 ** 8)
ni = lambda: int(sys.stdin.readline())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
ns = lambda: sys.stdin.readline().rstrip()
MOD = 10 ** 9 + 7
N, K = nm()
def solve():
ans = 0
tbl = [0] * (K + 1)
for i in range(K, 0, -1):
m = K // i
p = pow(m, N, MOD)
j = 2
while j * i <= K:
p += MOD - tbl[j * i] % MOD
p %= MOD
j += 1
tbl[i] = p
ans += i * p % MOD
ans %= MOD
return ans
print(solve())
| N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))
visited = [0] * (N + 1)
route = [0] * (N + 1)
next_ = 1
count = 0
for i in range(K + 1):
if visited[next_] != 0:
x = visited[next_]
count = (K - (x - 1)) % (i + 1 - x) + x
print(route[count])
exit()
visited[next_] = i + 1
route[i + 1] = next_
next_ = A[next_]
print(route[K + 1])
| 0 | null | 29,711,581,782,840 | 176 | 150 |
N,K=map(int,input().split())
MOD=10**9+7
B=[0 for i in range(K+1)]
for i in range(K+1)[::-1]:
if i==0: continue
B[i]=pow((K//i),N,MOD)
t=i*2
while t<=K:
B[i]-=B[t]
t+=i
ans=0
for i in range(K+1):
ans+=i*B[i]
ans%=MOD
print(ans) | if input()=="0":
print(1)
else:
print(0) | 0 | null | 19,999,724,124,800 | 176 | 76 |
N, A, B = map(int, input().split())
dif = abs(A - B)
ans = 0
if dif % 2 == 0:
ans = dif // 2
else:
ans = min(A - 1, N - B) + 1 + dif // 2
print(ans) | #coding: utf-8
import sys
def gojo(a,b):
if b % a == 0:
return a
else:
return gojo(b % a, a)
for line in sys.stdin:
l = map(int,line.split())
l.sort()
a = l[0]
b = l[1]
print gojo(a,b),a*b/gojo(a,b) | 0 | null | 54,681,975,124,582 | 253 | 5 |
S = list(input())
T = list(input())
count = 0
for i in range(len(S)):
if S[i] != T[i]:
count += 1
break
if count == 0:
print("Yes")
else:
print("No") | S=input()
T=input()
yes=True
l=len(S)
for i in range(0,l):
if S[i]!=T[i]:
yes=False
break
if yes:
print("Yes")
else:
print("No")
| 1 | 21,415,328,921,628 | null | 147 | 147 |
import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip() # input string
ni = lambda: int(readline().rstrip()) # input int
nm = lambda: map(int, readline().split()) # input multiple int
nl = lambda: list(map(int, readline().split())) # input multiple int to list
n, k, s = nm()
ans_h = [str(s) for _ in range(k)]
if s==10**9 :
ans_t = ['1' for _ in range(n-k)]
else:
ans_t = [str(s+1) for _ in range(n-k)]
print(' '.join(ans_h + ans_t)) | n, m, l = map(int, input().split())
mat_a = []
mat_b = []
for i in range(n):
mat_a.append(list(map(int, input().split())))
for j in range(m):
mat_b.append(list(map(int, input().split())))
for p in range(n):
mat_c = []
for q in range(l):
sum = 0
for r in range(m):
sum += mat_a[p][r] * mat_b[r][q]
mat_c.append(sum)
print(' '.join(map(str, mat_c)))
| 0 | null | 46,059,126,074,160 | 238 | 60 |
n,a,b=map(int,input().split())
mod=10**9+7
def power_func(a,n,mod):
bi=str(format(n,"b"))
res=1
for i in range(len(bi)):
res=(res*res)%mod
if bi[i]=='1':
res=(res*a)%mod
return res
def cmb1(x,y,mod):
l=1
for g in range(x+1-y,x+1):
l*=g
l%=mod
for k in range(1,y+1):
l*=power_func(k,mod-2,mod)
l%=mod
return l
return ans
ans=power_func(2,n,mod)-1
ans1=cmb1(n,a,mod)
ans2=cmb1(n,b,mod)
print((ans-ans1-ans2)%mod) | H = [[0] * 3 for i in range(3)]
A = [[0] * 3 for i in range(3)]
A[0][0],A[0][1],A[0][2] = map(int,input().split())
A[1][0],A[1][1],A[1][2] = map(int,input().split())
A[2][0],A[2][1],A[2][2] = map(int,input().split())
N = int(input())
for i in range(N):
ball = int(input())
for l in range(3):
for c in range(3):
if A[l][c] == ball:
H[l][c] = 1
#print(H)
flag = 0
for l in range(3):
if H[l][0] ==1 and H[l][1] ==1 and H[l][2] ==1:
flag =1
for c in range(3):
if H[0][c] ==1 and H[1][c] ==1 and H[2][c] ==1:
flag =1
if H[0][0]==1 and H[1][1]==1 and H[2][2]== 1:
flag = 1
if H[2][0]==1 and H[1][1]==1 and H[0][2]== 1:
flag = 1
if flag == 1:
print("Yes")
else:
print("No")
#A[2][1] = 10
#print(A)
#print(flag) | 0 | null | 62,947,157,603,782 | 214 | 207 |
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
def main():
INF = 10**9
H, W = input_nums()
ss = [input() for _ in range(H)]
dp = [[0]*W for _ in range(H)]
if ss[0][0] == '#': dp[0][0] = 1
for h in range(H):
for w in range(W):
if (h, w) == (0, 0): continue
u = l = INF
if h-1>=0:
u = dp[h-1][w]
if ss[h][w] == '#' and ss[h-1][w] == '.': u += 1
if w-1>=0:
l = dp[h][w-1]
if ss[h][w] == '#' and ss[h][w-1] == '.': l += 1
dp[h][w] = min(u, l)
print(dp[H-1][W-1])
if __name__ == '__main__':
main()
| n = list(map(int,input().split()))
ans = n[1] * n[3]
ans = max(n[0]*n[2],ans)
ans = max(n[0]*n[3],ans)
ans = max(n[1]*n[2],ans)
ans = max(n[1]*n[3],ans)
print(ans) | 0 | null | 26,008,503,679,168 | 194 | 77 |
while True:
a,b=map(int,input().split())
if (a==0 and b==0):
break
if a>b:
swap=a
a=b
b=swap
print('%d %d'%(a,b))
| while True:
x,y = map(int,raw_input().split())
if x+y == 0:
break
elif x>y:
print y,x
else:
print x,y | 1 | 518,399,402,588 | null | 43 | 43 |
import math
a,b,n=map(int,input().split())
def f(x):
return math.floor(a*x/b)-a*(math.floor(x/b))
if n>=(b-1):
print(f(b-1))
else:
print(f(n)) | from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF = float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353
A, B, N = map(int, input().split())
if N >= B-1:
print(A*(B-1)//B)
else:
print(A*N//B) | 1 | 28,021,401,032,860 | null | 161 | 161 |
import sys
readline = sys.stdin.readline
import math
# 最短距離をワーシャルフロイドで求める
# 最短距離がL以下の街には燃料1で行けるので、辺を貼り直してワーシャルフロイド
N,M,L = map(int,readline().split())
import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse.csgraph import floyd_warshall
from scipy.sparse.csgraph import csgraph_from_dense
INF = 10 ** 9 + 1
G = [[INF for i in range(N)] for j in range(N)]
for i in range(M):
a,b,c = map(int,readline().split())
G[a - 1][b - 1] = c
G[b - 1][a - 1] = c
G = csgraph_from_dense(G, null_value=INF)
d = floyd_warshall(G)
EG = [[INF for i in range(N)] for j in range(N)]
for i in range(N):
for j in range(N):
if d[i][j] <= L:
EG[i][j] = 1
EG = csgraph_from_dense(EG, null_value=INF)
d = floyd_warshall(EG)
Q = int(readline())
for i in range(Q):
s,t = map(int,readline().split())
if d[s - 1][t - 1] != math.inf:
print(int(d[s - 1][t - 1] - 1))
else:
print(-1) | import math
def Koch(Px, Py, Qx, Qy, n) :
if n == 0 :
return
else :
Ax = (2 * Px + Qx) / 3
Ay = (2 * Py + Qy) / 3
Bx = (Px + 2 * Qx) / 3
By = (Py + 2 * Qy) / 3
Cx = Ax + (Bx - Ax) * math.cos(math.pi/3) - (By - Ay) * math.sin(math.pi/3)
Cy = Ay + (Bx - Ax) * math.sin(math.pi/3) + (By - Ay) * math.cos(math.pi/3)
Koch(Px, Py, Ax, Ay, n-1)
print(Ax, Ay)
Koch(Ax, Ay, Cx, Cy, n-1)
print(Cx, Cy)
Koch(Cx, Cy, Bx, By, n-1)
print(Bx, By)
Koch(Bx, By, Qx, Qy, n-1)
n = int(input())
print(0, 0.00000000)
Koch(0.00000000, 0.00000000, 100.00000000, 0.00000000, n)
print(100.00000000, 0.00000000)
| 0 | null | 87,067,373,732,764 | 295 | 27 |
#ALDS1_3-B Elementary data structures - Queue
n,q = [int(x) for x in input().split()]
Q=[]
for i in range(n):
Q.append(input().split())
t=0
res=[]
while Q!=[]:
if int(Q[0][1])<=q:
res.append([Q[0][0],int(Q[0][1])+t])
t+=int(Q[0][1])
else:
Q.append([Q[0][0],int(Q[0][1])-q])
t+=q
del Q[0]
for i in res:
print(i[0]+" "+str(i[1])) | n = int(input())
def fib(i):
if i<=1: return 1
else:
a=0
b=1
for i in range(n+1):
c=b+a
b=a
a=c
return c
print(fib(n))
| 0 | null | 23,108,441,060 | 19 | 7 |
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
MOD = 10**9+7
N = int(input())
A = list(map(int,input().split()))
L = A[0]
for i in range(1,N):
g = math.gcd(L,A[i])
L = L*A[i]//g
ans = 0
L %= MOD
for i in range(N):
ans += (L*pow(A[i],MOD-2,MOD))
ans %= MOD
print(ans) | n, k = map(int, input().split())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
plus = []
minus = []
for i in a:
if i >= 0: plus.append(i)
if i < 0: minus.append(-i)
plus.sort(reverse=True)
minus.sort(reverse=True)
ans = 1
if k == n:
for x in a:
ans = (ans * x) % mod
elif n == len(plus):
for x in plus[:k]:
ans = (ans * x) % mod
elif n == len(minus):
if k % 2 == 1:
ans = -1
minus.sort()
for x in minus[:k]:
ans = (ans * x) % mod
else:
i, j = 0, 0
if k % 2 == 1:
ans = plus[0]
i += 1
while i + j != k:
x_p = plus[i] * plus[i + 1] if i < len(plus) - 1 else 0
x_m = minus[j] * minus[j + 1] if j < len(minus) - 1 else 0
if x_p > x_m:
ans = (ans * x_p) % mod
i += 2
else:
ans = (ans * x_m) % mod
j += 2
print(ans) | 0 | null | 48,519,292,104,710 | 235 | 112 |
import math
r = float(input())
print('{:.6f}'.format(r ** 2 * math.pi), '{:.6f}'.format(2 * r * math.pi))
| import math
r, pi= float(input()), math.pi
print("{} {}".format(pi * r * r, 2 * pi * r))
| 1 | 656,744,358,062 | null | 46 | 46 |
a, b = map(int, input().split())
print(a // b, a % b, "{:f}".format(a / b)) | a,b=map(int, input().split())
print("{0} {1} {2:.8f}".format(a//b,a%b,a/b))
| 1 | 600,925,498,770 | null | 45 | 45 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.