code1
stringlengths 16
427k
| code2
stringlengths 16
427k
| similar
int64 0
1
| pair_id
int64 2
178,025B
⌀ | question_pair_id
float64 27.1M
177,113B
⌀ | code1_group
int64 1
297
| code2_group
int64 1
297
|
---|---|---|---|---|---|---|
N = int(input())
S = list(input())
R = []
G = []
B = [0 for _ in range(N)]
b_cnt = 0
for i in range(N):
if S[i] == 'R':
R.append(i)
elif S[i] == 'G':
G.append(i)
else:
B[i] = 1
b_cnt += 1
answer = 0
for r in R:
for g in G:
answer += b_cnt
if (g-r)%2 == 0 and B[(r+g)//2] == 1:
answer -= 1
if 0 <= 2*g-r < N and B[2*g-r] == 1:
answer -= 1
if 0 <= 2*r-g < N and B[2*r-g] == 1:
answer -= 1
print(answer)
|
import sys
p = 0
for line in sys.stdin:
ls = line.strip('\n')
if p == 0:
if ls =='-': break
letters = ls
p = 1
elif p == 1:
m = int(ls)
p =2
elif p == 2:
h = int(ls)
letters = letters[h:] + letters[:h]
if m > 1:
m -= 1
else:
print letters
p = 0
| 0 | null | 19,129,551,231,758 | 175 | 66 |
# http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4647653#1
import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
class Graph:
def __init__(self, n, dictated=False, decrement=True, edge=[]):
self.n = n
self.dictated = dictated
self.decrement = decrement
self.edge = [set() for _ in range(self.n)]
self.parent = [-1]*self.n
self.info = [-1]*self.n
for x, y in edge:
self.add_edge(x,y)
def add_edge(self,x,y):
if self.decrement:
x -= 1
y -= 1
self.edge[x].add(y)
if self.dictated == False:
self.edge[y].add(x)
def add_adjacent_list(self,i,adjacent_list):
if self.decrement:
self.edge[i] = set(map(lambda x:x-1, adjacent_list))
else:
self.edge[i] = set(adjacent_list)
def path_detector(self, start=0, time=0):
"""
:param p: スタート地点
:return: 各点までの距離と何番目に発見したかを返す
"""
edge2= []
for i in range(self.n):
edge2.append(sorted(self.edge[i], reverse=True))
p, t = start, time
self.parent[p] = -2
full_path = [(p + self.decrement,t)]
while True:
if edge2[p]:
q = edge2[p].pop()
if q == self.parent[p] and not self.dictated:
""" 逆流した時の処理 """
""""""""""""""""""""
continue
if self.parent[q] != -1:
""" サイクルで同一点を訪れた時の処理 """
""""""""""""""""""""
continue
self.parent[q] = p
p, t = q, t + 1
full_path.append((p + self.decrement, t))
else:
""" 探索完了時の処理 """
full_path.append((p + self.decrement, t))
""""""""""""""""""""
if p == start and t == time:
break
p, t = self.parent[p], t-1
""" 二度目に訪問時の処理 """
""""""""""""""""""""
return full_path
def path_list(self):
"""
:return: 探索経路を返す。
"""
self.parent = [-1]*self.n
res = []
for p in range(self.n):
if self.parent[p] == -1:
res.append(self.path_detector(start=p, time=1))
return res
def draw(self):
"""
:return: グラフを可視化
"""
import matplotlib.pyplot as plt
import networkx as nx
if self.dictated:
G = nx.DiGraph()
else:
G = nx.Graph()
for x in range(self.n):
for y in self.edge[x]:
G.add_edge(x + self.decrement, y + self.decrement)
nx.draw_networkx(G)
plt.show()
def make_graph(dictated=False, decrement=True):
"""
自己ループの無いグラフを生成。N>=2
:param dictated: True = 有効グラフ
:param decrement: True = 1-indexed
:return:
"""
import random
N = random.randint(2, 5)
if N > 2:
M_max = (3*N-6)*(1+dictated)
else:
M_max = 1
graph = Graph(N, dictated, decrement)
for _ in range(random.randint(0,M_max)):
graph.add_edge(*random.sample(range(decrement, N+decrement), 2))
return graph
##################################################################
# 入力が隣接リストの場合
##################################################################
N = int(input()) # 頂点数
graph = Graph(N,dictated=True, decrement=True)
for i in range(N): # [[頂点1と連結している頂点の集合], [頂点2と連結している頂点の集合],...]
points = list(map(int, input().split()))[2:]
graph.add_adjacent_list(i, points)
data = graph.path_list()
from itertools import chain
data = list(chain.from_iterable(data))
res = [[i+1,0,0] for i in range(N)]
for time, a in enumerate(data, start=1):
i = a[0] - 1
if res[i][1]:
res[i][2] = time
else:
res[i][1] = time
for a in res:
print(*a)
|
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_11_B&lang=ja
import sys
input = sys.stdin.readline
N = int(input())
G = [[a-1 for a in list(map(int, input().split()))[2:]] for _ in [0]*N]
visited = [0]*N
history = [[] for _ in [0]*N]
k = 0
def dfs(v=0, p=-1):
global k
visited[v] = 1
k += 1
history[v].append(k)
for u in G[v]:
if u == p or visited[u]:
continue
dfs(u, v)
k += 1
history[v].append(k)
for i in range(N):
if not visited[i]:
dfs(i)
for i, h in enumerate(history):
print(i+1, *h)
| 1 | 3,007,466,742 | null | 8 | 8 |
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import bisect
import heapq
import itertools
import math
from collections import Counter, defaultdict, deque
from copy import deepcopy
from decimal import Decimal
from math import gcd
from operator import add, itemgetter, mul, xor
def cmb(n,r,mod):
bunshi=1
bunbo=1
for i in range(r):
bunbo = bunbo*(i+1)%mod
bunshi = bunshi*(n-i)%mod
return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]
#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#つまりlist[i] < x となる i の個数
#bisect.bisect_right(list, key)はlistのなかでkey以下の数字がいくつあるかを返す
#つまりlist[i] <= x となる i の個数
#これを応用することで
#len(list) - bisect.bisect_left(list,key)はlistのなかでkey以上の数字がいくつあるかを返す
#len(list) - bisect.bisect_right(list,key)はlistのなかでkeyより大きい数字がいくつあるかを返す
#これらを使うときはあらかじめlistをソートしておくこと!
k = I()
d = deque([1,2,3,4,5,6,7,8,9])
for i in range(k):
num = d.popleft()
if num%10 != 0:
d.append(10*num + (num%10) -1)
d.append(10*num + (num%10))
if num%10 != 9:
d.append(10*num + (num%10) + 1)
print(num)
|
k = int(input())
num=[1,2,3,4,5,6,7,8,9]
if k<10:
print(num[k-1])
exit()
ans=9
def hantei():
global ans
ans+=1
if ans==k:
print(num[-1])
exit()
for i in range(10**10):
hitoketa=num[0]%10
if hitoketa==0:
num.append(10*num[0]+0)
hantei()
num.append(10*num[0]+1)
hantei()
num.pop(0)
elif hitoketa==9:
num.append(10*num[0]+8)
hantei()
num.append(10*num[0]+9)
hantei()
num.pop(0)
else:
num.append(10*num[0]+(hitoketa-1))
hantei()
num.append(10*num[0]+(hitoketa))
hantei()
num.append(10*num[0]+(hitoketa+1))
hantei()
num.pop(0)
| 1 | 39,983,892,235,912 | null | 181 | 181 |
H, W = map(int, input().split())
if H >= 2 and W >= 2:
if H % 2 == 0:
print((H * W) // 2)
else:
print(((H - 1) * W) // 2 + (W + 1) // 2)
else:
print(1)
|
H,W = map(int,input().split())
if H == 1 or W == 1:
print(1)
exit(0)
else:
result = H * W
if result % 2 == 0:
print(result // 2)
else:
print(result // 2 + 1)
| 1 | 50,581,025,610,460 | null | 196 | 196 |
#<ABC151>
#<A>
s = input()
s = ord(s)
s = s + 1
print(chr(s))
|
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, log
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
from decimal import Decimal
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7
from decimal import *
#階乗#
lim = 10**6 #必要そうな階乗の限界を入力
fact = [1] * (lim+1)
for n in range(1, lim+1):
fact[n] = n * fact[n-1] % mod
#階乗の逆元#
fact_inv = [1]*(lim+1)
fact_inv[lim] = pow(fact[lim], mod-2, mod)
for n in range(lim, 0, -1):
fact_inv[n-1] = n*fact_inv[n]%mod
def C(n, r):
return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod
X, Y = MAP()
a = (Decimal("2")*Decimal(str(X))-Decimal(str(Y)))/Decimal("3")
b = (Decimal("2")*Decimal(str(Y))-Decimal(str(X)))/Decimal("3")
if a%1 == b%1 == 0 and 0 <= a and 0 <= b:
print(C(int(a+b), int(a)))
else:
print(0)
| 0 | null | 120,965,361,742,110 | 239 | 281 |
class UnionFind:
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = self.find(x)
y = self.find(y)
if x == y:
return
if self.parents[x] > self.parents[y]:
x, y = y, x
self.parents[x] += self.parents[y]
self.parents[y] = x
def size(self, x):
return -self.parents[self.find(x)]
def same(self, x, y):
return self.find(x) == self.find(y)
def members(self, x):
root = self.find(x)
return [i for i in range(self.n) if self.find(i) == root]
def roots(self):
return [i for i, x in enumerate(self.parents) if x < 0]
def group_count(self):
return len(self.roots())
def all_group_members(self):
return {r: self.members(r) for r in self.roots()}
def __str__(self):
return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
def main():
N, M = list(map(int, input().split()))
paths = [list(map(int, input().split())) for _ in range(M)]
result = solve(N, paths)
print(result)
def solve(N, paths) -> int:
uf = UnionFind(N)
for x, y in paths:
uf.union(x - 1, y - 1)
return uf.group_count() - 1
if __name__ == '__main__':
main()
|
import math
a, b, c = map(float,input().split())
c = math.radians(c)
S = (1/2) * a * b * math.sin(c)
d = math.sqrt((a ** 2) + (b ** 2) - (2 * a * b * math.cos(c)))
L = a + b + d
H = (2 * S) / a
print(S,L,H)
| 0 | null | 1,213,842,649,500 | 70 | 30 |
# coding: utf-8
def main():
_ = int(input())
A = list(map(int, input().split()))
ans = 0
tmp = 0
total = sum(A)
for a in A:
tmp += a
if tmp >= total // 2:
ans = min(2 * tmp - total, total - 2 * (tmp - a))
break
print(ans)
if __name__ == "__main__":
main()
|
import sys
import collections
import bisect
def main():
n = int(input())
AList = list(map(int, input().split()))
ASum = sum(AList)
c = 0
for i in range(n):
c += AList[i]
if c >= ASum / 2:
k = i
break
ans = min(2 * c - ASum, ASum - 2 * c + 2 * AList[k])
print(ans)
if __name__ == '__main__':
main()
| 1 | 142,194,428,936,478 | null | 276 | 276 |
import math
a, b, C = map(int, input().split())
C = math.radians(C)
S = a * b * math.sin(C) * 0.5
c = math.sqrt(a * a + b * b - 2 * a * b * math.cos(C))
L = a + b + c
h = 2 * S / a
print(S, L, h)
|
import sys
def solve():
input = sys.stdin.readline
R, C, K = map(int, input().split())
item = [[0 for _ in range(C)] for r in range(R)]
for _ in range(K):
r, c, k = map(int, input().split())
item[r-1][c-1] = k
DP = [[[-1 for _ in range(C)] for r in range(R)] for i in range(4)]
DP[0][0][0] = 0
for r in range(R):
for c in range(C):
for i in range(4):
if DP[i][r][c] > -1:
if r + 1 < R:
DP[0][r+1][c] = max(DP[0][r+1][c], DP[i][r][c])
if c + 1 < C:
DP[i][r][c+1] = max(DP[i][r][c+1], DP[i][r][c])
if i < 3 and item[r][c] > 0:
if r + 1 < R: DP[0][r+1][c] = max(DP[0][r+1][c], DP[i][r][c] + item[r][c])
if c + 1 < C: DP[i+1][r][c+1] = max(DP[i+1][r][c+1], DP[i][r][c] + item[r][c])
ans = DP[3][R-1][C-1]
for i in range(3): ans = max(ans, DP[i][R-1][C-1] + item[R-1][C-1])
print(ans)
return 0
if __name__ == "__main__":
solve()
| 0 | null | 2,859,973,574,304 | 30 | 94 |
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy
sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()
def main():
h,w=LI()
l=[]
l.append('.'*(w+1))
for _ in range(h):
x='.'
x+=S()
l.append(x)
dp=[[inf]*(w+10) for _ in range(h+10)]
if l[1][1]=='#':
dp[1][1]=1
else:
dp[1][1]=0
for i in range(1,h+1):
for j in range(1,w+1):
if i==1 and j==1:
continue
if l[i][j]=='#':
if l[i-1][j]=='.':
dp[i][j]=min(dp[i][j],dp[i-1][j]+1)
else:
dp[i][j]=min(dp[i][j],dp[i-1][j])
if l[i][j-1]=='.':
dp[i][j]=min(dp[i][j],dp[i][j-1]+1)
else:
dp[i][j]=min(dp[i][j],dp[i][j-1])
else:
dp[i][j]=min(dp[i-1][j],dp[i][j-1])
# print(dp)
return dp[h][w]
# main()
print(main())
|
from collections import deque
h,w=map(int,input().split())
field=[["*" for i in range(w+2)]]+[["*"]+list(input())+["*"] for i in range(h)]+[["*" for i in range(w+2)]]
cost=[[500 for i in range(w+2)] for j in range(h+2)]
cost[1][1]=0
ans=0
for i in range(1,h+1):
for j in range(1,w+1):
color=field[i][j]
if color=="." and field[i][j+1]=="#":
cost[i][j+1]=min(cost[i][j]+1,cost[i][j+1])
else:cost[i][j+1]=min(cost[i][j],cost[i][j+1])
if color=="." and field[i+1][j]=="#":
cost[i+1][j]=min(cost[i][j]+1,cost[i+1][j])
else:cost[i+1][j]=min(cost[i][j],cost[i+1][j])
print(cost[h][w] if field[1][1]=="." else cost[h][w]+1)
| 1 | 49,337,906,355,738 | null | 194 | 194 |
print((int(input())) ** 3)
|
def main():
a = input()
print a**3
return 0
main()
| 1 | 276,340,275,050 | null | 35 | 35 |
def main():
N = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
ans = a[0]
t = N - 2
for i in range(1, N):
for _ in range(2):
if t > 0:
ans += a[i]
t -= 1
print(ans)
if __name__ == "__main__":
main()
|
n=int(input())
c= sorted(list(map(int, input().split())), reverse=True)
l = len(c)
m = l//2
ans = c[0]
if l%2 == 0:
for i in range(1,m):
ans += 2*c[i]
else:
for i in range(1,m):
ans += 2*c[i]
ans += c[m]
print(ans)
| 1 | 9,203,339,691,172 | null | 111 | 111 |
from itertools import combinations
import numpy as np
N = int(input())
D = list(map(int, input().split()))
List = np.array(list(combinations(D,2)))
print(sum(np.product(List, axis = 1)))
|
n = int(input())
d = list(map(int, input().split()))
s = 0
for i in range(n):
for j in range(n):
if i < j:
s += (d[i] * d[j])
print(s)
| 1 | 168,119,050,141,858 | null | 292 | 292 |
from fractions import gcd
from datetime import date, timedelta
from heapq import*
import math
from collections import defaultdict, Counter, deque
import sys
from bisect import *
import itertools
import copy
sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
def modpow(a, n, mod):
res = 1
while n > 0:
if n & 1:
res = res * a % mod
a = a * a % mod
n >>= 1
return res
def main():
n = int(input())
if n % 2 == 0:
print((n - 1) // 2)
else:
print(n//2)
if __name__ == '__main__':
main()
|
def solve(n):
return (n - 1) // 2
assert solve(4) == 1
assert solve(999999) == 499999
n = int(input())
print(solve(n))
| 1 | 153,028,586,582,750 | null | 283 | 283 |
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
a=INT()
print(a+a**2+a**3)
if __name__ == '__main__':
do()
|
a = int(input())
sum = a + a*a +a*a*a
print(sum)
| 1 | 10,267,751,382,460 | null | 115 | 115 |
str = input().split();
a = int(str[0]);
b = int(str[1]);
c = int(str[2]);
if a < b & b < c:
print("Yes");
else:
print("No");
|
import sys
#a,b=map(int,input().split())
a,b,c=map(int,input().split())
if a<b:
if b<c:
print("Yes")
sys.exit()
print("No")
| 1 | 393,375,563,562 | null | 39 | 39 |
#condig: UTF-8
while True:
try:
n = map(int, raw_input().split())
s = len(str(n[0] + n[1]))
print s
except Exception:
break
|
import sys
[print(len(str(sum([int(y) for y in x.split(" ")])))) for x in sys.stdin]
| 1 | 74,364,228 | null | 3 | 3 |
k = int(input())
a, b = map(int, input().split())
check = False
for i in range(a, b + 1):
if i % k == 0:
check = True
print("OK" if check else "NG")
|
x = input()
if x == "ABC":
print("ARC")
else:
print("ABC")
| 0 | null | 25,395,188,729,962 | 158 | 153 |
X, Y = map(int, input().split())
for k in range(X+1):
t = X - k
if k*4 + t*2 == Y:
print("Yes")
exit()
print("No")
|
import sys
import math
def isprime(n):
if n == 2:
return 1
if n < 2 or n % 2 == 0:
return 0
i = 3
while i <= math.sqrt(n):
if n % i == 0:
return 0
i += 2
return 1
n = int(input())
p = 0
for i in map(int, sys.stdin.readlines()):
p += isprime(i)
print(p)
| 0 | null | 6,851,980,952,228 | 127 | 12 |
#!/usr/bin/env python3
import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def root(x):
if par[x] == x:
return x
par[x] = root(par[x])
return par[x]
def union(x,y):
x = root(x)
y = root(y)
if rank[x] < rank[y]:
par[x] = y
else:
par[y] = x
if rank[x] == rank[y]:
rank[x] += 1
n, m = LI()
par = [i for i in range(n)]
rank = [0] * n
for _ in range(m):
a, b = LI()
if root(a-1) != root(b-1):
union(a-1, b-1)
s = set()
for i in range(n):
s.add(root(i))
ans = len(s)-1
print(ans)
|
inputs = input().split(" ")
stack = []
for str in inputs:
if str.isdigit():
stack.append(int(str))
else:
b = stack.pop()
a = stack.pop()
if str == '+':
stack.append(a + b)
elif str == '-':
stack.append(a - b)
elif str == '*':
stack.append(a * b)
print(stack.pop())
| 0 | null | 1,163,253,479,780 | 70 | 18 |
import numpy as np
a,b,h,m=[int(i) for i in input().split()]
def get_angle(h,m):
long_angle=2*np.pi*m/60
short_angle=2*np.pi*h/12+(2*np.pi/12)*m/60
big_angle=max(long_angle,short_angle)
small_angle = min(long_angle, short_angle)
angle=min(big_angle-small_angle,2*np.pi-big_angle+small_angle)
return angle
def yogen(a,b,theta):
ans=a**2+b**2-2*a*b*np.cos(theta)
return ans**0.5
print(yogen(a,b,get_angle(h,m)))
|
N, M = map(int, input().split())
# if N is odd
if M & 1:
odd_head = 1
odd_tail = M + 1
even_head = M + 2
even_tail = M + 2 + M - 1
while odd_tail - odd_head > 0:
print(odd_head, odd_tail)
odd_head += 1
odd_tail -= 1
while even_tail - even_head > 0:
print(even_head, even_tail)
even_head += 1
even_tail -= 1
else:
odd_head = 1
odd_tail = 1 + (M - 1)
even_head = M + 1
even_tail = M + 1 + M
while odd_tail - odd_head > 0:
print(odd_head, odd_tail)
odd_head += 1
odd_tail -= 1
while even_tail - even_head > 0:
print(even_head, even_tail)
even_head += 1
even_tail -= 1
| 0 | null | 24,430,025,910,888 | 144 | 162 |
R, C, K = map(int, input().split())
item = [[0 for _ in range(C + 1)] for _ in range(R + 1)]
for _ in range(K):
r, c, v = map(int, input().split())
item[r][c] = v
# 多次元配列を生成する際、使いたい引数を逆順で書くと上手くいく
# dp = [[[0 for _ in range(4)] for _ in range(C + 1)] for _ in range(R + 1)]
# とするとTLEだった。(R+1)*4(C+1)だと通るみたいだが、あまり本質的ではない気がする。
# 以下ではdp0,dp1,dp2,dp3という4つの配列を作ることにする。
dp0 = [[0 for _ in range(C + 1)]for _ in range(R + 1)]
dp1 = [[0 for _ in range(C + 1)]for _ in range(R + 1)]
dp2 = [[0 for _ in range(C + 1)]for _ in range(R + 1)]
dp3 = [[0 for _ in range(C + 1)]for _ in range(R + 1)]
for i in range(R + 1):
for j in range(C + 1):
# 下に移動する場合、アイテムの個数はリセットされる
if i <= R - 1:
# 移動先のアイテムを取らない場合
dp0[i + 1][j] = max(dp0[i + 1][j],
dp0[i][j],
dp1[i][j],
dp2[i][j],
dp3[i][j])
# 移動先のアイテムを取る場合
dp1[i + 1][j] = max(dp1[i + 1][j],
dp0[i][j] + item[i + 1][j],
dp1[i][j] + item[i + 1][j],
dp2[i][j] + item[i + 1][j],
dp3[i][j] + item[i + 1][j])
# 右に移動する場合、アイテムの個数は維持される
if j <= C - 1:
dp0[i][j + 1] = max(dp0[i][j + 1],
dp0[i][j])
dp1[i][j + 1] = max(dp1[i][j + 1],
dp1[i][j])
dp2[i][j + 1] = max(dp2[i][j + 1],
dp2[i][j])
dp3[i][j + 1] = max(dp3[i][j + 1],
dp3[i][j])
# 現在のアイテム数が3未満(0 or 1 or 2)の場合、移動先のアイテムをとることが可能 [k + 1], now + item[i][j + 1])
dp1[i][j + 1] = max(dp1[i][j + 1],
dp0[i][j] + item[i][j + 1])
dp2[i][j + 1] = max(dp2[i][j + 1],
dp1[i][j] + item[i][j + 1])
dp3[i][j + 1] = max(dp3[i][j + 1],
dp2[i][j] + item[i][j + 1])
# 最終的にR行で取るアイテムの個数についてそれぞれ調べる、3個が最適とは限らない
ans = max(dp0[-1][-1], dp1[-1][-1], dp2[-1][-1], dp3[-1][-1])
print(ans)
|
x,y=map(int,input().split())
if x==y==1:
print(1000000);exit()
A=[300000,200000,100000]+[0]*1000
print(A[x-1]+A[y-1])
| 0 | null | 73,138,299,724,280 | 94 | 275 |
import itertools
N, M, Q = map(int, input().split())
l = [i for i in range(1, M+1)]
qus = []
As = []
for _ in range(Q):
b = list(map(int, input().split()))
qus.append(b)
for v in itertools.combinations_with_replacement(l, N):
a = list(v)
A = 0
for q in qus:
pre = a[q[1]-1] - a[q[0]-1]
if pre == q[2]:
A += q[3]
As.append(A)
print(max(As))
|
N = int(input())
A = list(map(int, input().split(' ')))
const = 1000000007
ans = 0
total = sum(A)
for i in range(N):
total -= A[i]
ans += A[i] * total
print(ans%const)
| 0 | null | 15,638,364,708,160 | 160 | 83 |
def kuku(a, b):
return a*b if max(a, b) < 10 else -1
def main():
a, b = map(int, input().split())
print(kuku(a, b))
if __name__ == '__main__':
main()
|
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
s=input()
n=len(s)
K=int(input())
dp_0=[[0]*(K+1) for _ in range(n+1)]
dp_1=[[0]*(K+1) for _ in range(n+1)]
dp_0[0][0]=1
for i in range(n):
for j in range(K+1):
for k in range(2):
nd=int(s[i])-0
for d in range(10):
ni=i+1
nj=j
if d!=0:nj+=1
if nj>K:continue
if k==0:
if d>nd:continue
if d<nd:dp_1[ni][nj]+=dp_0[i][j]
else:dp_0[ni][nj]+=dp_0[i][j]
else:dp_1[ni][nj]+=dp_1[i][j]
print(dp_0[n][K]+dp_1[n][K])
if __name__=='__main__':
main()
| 0 | null | 117,581,740,640,700 | 286 | 224 |
m = map(int,raw_input().split())
if m[0] < m[1]:
print "a" + " < " + "b"
elif m[0] == m[1]:
print "a" + " == " + "b"
elif m[0] > m[1]:
print "a" + " > " + "b"
|
a, b = map(int, input().split())
if a < b:
print('a < b')
elif a == b:
print('a == b')
else:
print('a > b')
| 1 | 350,860,662,252 | null | 38 | 38 |
n = int(input())
s = input()
if n % 2 == 1:
print('No')
else:
cnt = 0
for i in range(0, n // 2):
cnt += (s[i] == s[i + n // 2])
if(cnt == n // 2):
print('Yes')
else:
print('No')
|
n=int(input())
s=input()
s1=n//2
ans="No"
if n&1!=1:
if s[:s1]==s[s1:]:
ans="Yes"
print(ans)
| 1 | 146,862,627,007,668 | null | 279 | 279 |
import sys
def solve():
input = sys.stdin.readline
N = int(input())
S = input().strip("\n")
Left = [set() for _ in range(N)]
Right = [set() for _ in range(N)]
Left[0] |= {S[0]}
Right[N-1] |= {S[N-1]}
for i in range(1, N):
Left[i] = Left[i-1] | {S[i]}
Right[N-i-1] = Right[N-i] | {S[N-i-1]}
used = set()
for i in range(1, N - 1):
mid = S[i]
for l in Left[i-1]:
for r in Right[i+1]:
used |= {l + mid + r}
print(len(used))
return 0
if __name__ == "__main__":
solve()
|
n=int(input())
s=input()
from itertools import product
cnt=0
for i,j in product("0123456789",repeat=2):
try:
ind_i=s.index(i)
except:
continue
try:
ind_j=s.rindex(j)
except:
continue
if ind_i>ind_j:
continue
for k in "0123456789":
cnt+=(k in s[ind_i+1:ind_j])
print(cnt)
| 1 | 128,172,901,862,500 | null | 267 | 267 |
S = raw_input()
areas = []
stack = []
for i,c in enumerate(S):
if c == "\\":
stack.append(i)
elif c == "/":
if len(stack) > 0:
j = stack.pop()
area = i-j
while len(areas) > 0:
p,a = areas.pop()
if j < p:
area += a
else:
areas.append((p, a))
break
areas.append((j, area))
A = map(lambda x:x[1], areas)
print sum(A)
if len(A) == 0:
print "0"
else:
print len(A), " ".join(map(str, A))
|
landform = [c for c in input()]
down = []
areas = []
for i in range(len(landform)):
if landform[i] == '\\':
down.append(i)
if landform[i] == '/':
if down:
pair = down.pop()
area = i - pair
while areas and areas[-1][0] > pair:
area += areas.pop()[1]
areas.append([pair, area])
sum_area = 0
for area in areas:
sum_area += area[1]
print(sum_area)
ans = []
ans.append(str(len(areas)))
ans += [str(area[1]) for area in areas]
print(' '.join(ans))
| 1 | 55,693,182,244 | null | 21 | 21 |
import math
def sieve_of_erastosthenes(num):
is_prime = [True for i in range(num+1)]
is_prime[0] = False
is_prime[1] = False
for i in range(2, int(num**0.5) + 1):
if not is_prime[i]:
continue
for j in range(i * 2, num + 1, i):
is_prime[j] = False
return [i for i in range(num + 1) if is_prime[i]]
N = int(input())
A = [int(i) for i in input().split()]
ans = math.gcd(A[0], A[1])
tmp = math.gcd(A[0], A[1])
for i in range(2, N):
ans = math.gcd(ans, A[i])
if ans > 1:
print('not coprime')
exit()
maxA = max(A)
l = sieve_of_erastosthenes(maxA)
B = [False for i in range(maxA+1)]
for i in range(N):
B[A[i]] = True
flag = False
for each in l:
tmp = each
counter = 0
while True:
if B[tmp]:
counter += 1
tmp += each
if tmp > maxA:
break
if counter > 1:
flag = True
break
if flag:
print('setwise coprime')
else:
print('pairwise coprime')
|
def main():
x = int(input())
print((2199 - x) // 200)
if __name__ == '__main__':
main()
| 0 | null | 5,405,145,028,778 | 85 | 100 |
def solve(n,s):
cnt = 0
for i in range(len(s)-2):
if "ABC" == s[i:i+3]:
cnt+=1
return cnt
n = int(input())
s = input()
ans = solve(n,s)
print(ans)
|
import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7
N, M = rl()
if N == M:
print('Yes')
else:
print('No')
| 0 | null | 91,410,436,777,118 | 245 | 231 |
# 入力
N = int(input())
A = list(map(int, input().split()))
R = max(A)
prime_factor_counter = [0]*(R+1)
# D[x]にxを割り切れる最初の素数を格納
# 次に行う素因数分解で試し割りのムダを削減するための前準備
D = [0]*(R+1)
for i in range(2, R+1):
if D[i]:
continue
n = i
while n < R+1:
if D[n] == 0:
D[n] = i
n += i
# 素因数分解し、素因子をカウント
# ex: 12 => 2と3のカウントを+1する
for a in A:
tmp = a
while tmp > 1:
prime_factor = D[tmp]
prime_factor_counter[prime_factor] += 1
while tmp%prime_factor == 0:
tmp //= prime_factor
# 回答出力
if max(prime_factor_counter) < 2:
print('pairwise coprime')
elif max(prime_factor_counter) - A.count(1) < N:
print('setwise coprime')
else:
print('not coprime')
|
m,d=map(int,input().split())
n,e=map(int,input().split())
print(1 if m!=n else 0)
| 0 | null | 64,204,871,719,460 | 85 | 264 |
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()
a,b,x = I()
if (a**2*b)<=2*x:
c = 2*(a**2*b-x)/a**3
else:
c = (a*b**2)/(2*x)
print(math.degrees(math.atan(c)))
|
from math import degrees, atan
a, b, x = map(int, input().split())
if a * a * b < x * 2:
c = 2 * (a * a * b - x) / a ** 3
else:
c = a * b * b / (2 * x)
print(degrees(atan(c)))
| 1 | 162,737,060,440,162 | null | 289 | 289 |
A, V = map(int,input().split())
B, W = map(int,input().split())
T = int(input())
if (V <= W):
print("NO")
elif(T < abs(A - B)/(V-W)):
print("NO")
else:
print("YES")
|
A,V=map(int, input().split())
B,W=map(int, input().split())
T=int(input())
if W>=V:
print("NO")
quit()
SA=abs(A-B)
IDOU=V-W
IDOUTARN=IDOU*T
ANS=SA-IDOUTARN
if ANS<=0:
print("YES")
else:
print("NO")
| 1 | 15,109,838,569,868 | null | 131 | 131 |
# coding: utf-8
ring = input()
pattern = input()
ring *= 2
if pattern in ring:
print('Yes')
else:
print('No')
|
S = input()
P = input()
for i in range(len(S)):
if P in S[i:] + S[:i]:
print("Yes")
exit()
print("No")
| 1 | 1,733,575,909,472 | null | 64 | 64 |
data = input()
x = []
x = data.split()
a = int(x[0])
b = int(x[1])
if(a > b):
print("a > b")
elif(a < b):
print("a < b")
else:
print('a == b')
|
t = raw_input()
s = t.split()
if s[0] == s[1]:
print "a == b"
else:
if int(s[0]) > int(s[1]):
print "a > b"
else:
print "a < b"
| 1 | 349,073,290,738 | null | 38 | 38 |
s = input()
cut = [0]
for i in range(len(s)-1):
if(s[i:i+2] == '><'):
cut.append(i+1)
cut.append(len(s)+1)
ans = 0
for i in range(len(cut)-1):
ss = s[cut[i]:cut[i+1]]
left = ss.count('<')
right = ss.count('>')
ans += left*(left+1)//2 + right*(right+1)//2 - min(left,right)
print(ans)
|
S = input()
ans = [0]*(len(S)+1)
for i in range(len(S)):
if S[i] == "<":
ans[i+1] = max(ans[i+1], ans[i]+1)
for i in range(len(S)):
i = len(S)-1 - i
if S[i] == ">":
ans[i] = max(ans[i],ans[i+1]+1)
print(sum(ans))
| 1 | 156,882,456,261,078 | null | 285 | 285 |
n,a,b = map(int,input().split())
if (a+b) % 2 == 0:
print(b - (a+b)//2)
else:
if a <= n-b+1:
b -= a
print(a + b-(1+b)//2)
else:
a += n-b+1
print(n-b+1 + n - (n+a)//2)
|
N = str(input())
if '7' in N:
print('Yes')
else:
print('No')
| 0 | null | 72,205,855,589,452 | 253 | 172 |
import sys
input = sys.stdin.readline
N = int(input())
AB = [[int(i) for i in input().split()] for _ in range(N)]
AB.sort()
ans = 0
if N & 1:
l = AB[N//2][0]
AB.sort(key=lambda x: x[1])
ans = AB[N // 2][1] - l + 1
else:
l = (AB[N // 2][0], AB[N // 2 - 1][0])
AB.sort(key=lambda x: x[1])
r = (AB[N // 2][1], AB[N // 2 - 1][1])
ans = sum(r) - sum(l) + 1
print(ans)
|
S,W = map(int,input().split())
print(("safe","unsafe")[W >= S])
| 0 | null | 23,402,281,075,448 | 137 | 163 |
N = int(input())
AB = [[int(_) for _ in input().split()] for _ in range(N)]
A = sorted([a for a, b in AB])
B = sorted([b for a, b in AB])
ans = B[N // 2] + B[(N - 1) // 2] - (A[N // 2] + A[(N - 1) // 2])
if N % 2:
ans //= 2
ans += 1
print(ans)
|
k=int(input())
u='ACL'
print(u*k)
| 0 | null | 9,727,367,916,512 | 137 | 69 |
from math import gcd
n=int(input())
l=list(map(int,input().split()))
mal=max(l)
e=[i for i in range(mal+1)]
x=2
while x*x <= mal:
if x == e[x]:
for m in range(x, len(e), x):
if e[m] == m:
e[m] = x
x+=1
#print(e)
s=set()
f=0
for i in l:
st = set()
while i > 1:
st.add(e[i])
i//=e[i]
if not s.isdisjoint(st):
f=1
break
s |= st
if f==0:
print('pairwise coprime')
exit()
p=l[0]
for i in range(1,n):
p=gcd(p,l[i])
if p==1:
print('setwise coprime')
else:
print('not coprime')
|
import math
from functools import reduce
def getD(num):
input_list = [2 if i % 2 == 0 else i for i in range(num+1)]
input_list[0] = 0
bool_list = [False if i % 2 == 0 else True for i in range(num+1)]
sqrt = int(math.sqrt(num))
for serial in range(3, sqrt + 1, 2):
if bool_list[serial]:
for s in range(serial ** 2, num+1, serial):
if bool_list[s]:
input_list[s] = serial
bool_list[s] = False
return input_list
N = int(input())
A = list(map(int, input().split()))
D = getD(max(A))
flag = True
d_set = set()
for a in A:
while a != 1:
d = D[a]
if d in d_set:
flag = False
break
else:
d_set.add(d)
while a > 1 and a % d == 0:
a = a // d
if not(flag):
break
if flag:
print('pairwise coprime')
exit()
if reduce(math.gcd, A) == 1:
print('setwise coprime')
else:
print('not coprime')
| 1 | 4,096,283,107,862 | null | 85 | 85 |
import math
a, b, x = map(int, input().split())
if x == (a**2*b)/2:
print(45)
elif x > (a**2*b)/2:
print(math.degrees(math.atan((2*(b-x/(a**2)))/a)))
else:
print(math.degrees(math.atan(a*b**2/(2*x))))
|
import math
a,b,x = map(int,input().split())
if b*a**2 == x:
print(0)
exit()
s = 2*x/(a*b)
if s < a:
print(math.atan(b/s)/math.pi*180)
else:
s = 2*b-2*x/(a**2)
print(90-math.atan(a/s)/math.pi*180)
| 1 | 163,239,942,058,940 | null | 289 | 289 |
x, k, d = map(int, input().split())
t = min(abs(x)//d, k)
u = abs(x)-d*t
print(abs(u-d*((k-t)%2)))
|
n= int(input())
ans=(n+1)//2
print(ans)
| 0 | null | 31,919,813,368,058 | 92 | 206 |
def cross_section_area(data):
area = 0;
sections = [];
stack = [];
for i in range(len(data)):
if data[i] == '\\':
stack.append(i);
elif data[i] == '/' and len(stack) > 0:
j = stack.pop();
section_area = i - j;
area += section_area;
while len(sections) > 0 and sections[-1][0] > j:
section_area += sections[-1][1];
sections.pop();
sections.append([j, section_area]);
print(area);
print(len(sections), *[n[1] for n in sections]);
cross_section_area(input());
|
def cal_water(floods):
fstack = []
astack = []
i = 0
for flood in floods:
if flood == '\\':
fstack.append(i)
elif flood == '/' and len(fstack) > 0:
s = fstack.pop(-1)
area = (i - s) * 1
while len(astack) > 0 and astack[-1][0] > s:
_, a = astack.pop(-1)
area += a
astack.append((s, area))
else:
pass
i += 1
tot = 0
tot_area = 0
out = ''
while len(astack) > 0:
_, area = astack.pop()
tot += 1
tot_area += area
out = ' ' + str(area) + out
print(tot_area)
print(str(tot) + out)
if __name__ == '__main__':
floods = input()
cal_water(floods)
| 1 | 58,493,462,820 | null | 21 | 21 |
def i1():
return int(input())
def i2():
return [int(i) for i in input().split()]
[n,p]=i2()
s=input()
if p==2 or p==5:
x1=0
for i in range(n):
if int(s[i])%p==0:
x1+=i+1
print(x1)
else:
t=0
x2=0
d={0:1}
a=1
for i in range(n)[::-1]:
t+=int(s[i])*a
t%=p
a*=10
a%=p
if t in d:
x2+=d[t]
d[t]+=1
else:
d[t]=1
print(x2)
|
import itertools
def main():
# n = int(input())
h, w, k = map(int, input().split())
# a = list(map(int, input().split()))
# s = input()
c = []
for i in range(h):
c.append(list(input()))
total = 0
for i in list(itertools.chain.from_iterable(c)):
if i == "#":
total += 1
ans = 0
for i in range(2**h):
for j in range(2**w):
count = 0
for ii in range(h):
for jj in range(w):
if (i >> ii & 1 or j >> jj & 1) and c[ii][jj] == "#":
count += 1
if total - count == k:
ans += 1
print(ans)
if __name__ == '__main__':
main()
| 0 | null | 33,718,835,424,456 | 205 | 110 |
def main():
s = (input())
l = ['x' for i in range(len(s))]
print(''.join(l))
main()
|
from collections import deque, defaultdict
N = int(input())
ab = [list(map(int, input().split())) for _ in range(N - 1)]
d = [0] * (N + 1)
G = [[] for _ in range(N + 1)]
for a, b in ab:
d[a] += 1
d[b] += 1
G[a].append(b)
G[b].append(a)
print(max(d))
color = defaultdict(int)
q = deque([[1, 0]])
seen = [0] * (N + 1)
while q:
v, c = q.popleft()
seen[v] = 1
tem = 1
for u in G[v]:
if seen[u]:
continue
if tem == c:
tem += 1
q.append([u, tem])
i, j = min(v, u), max(v, u)
color[(i, j)] = tem
tem += 1
for a, b in ab:
i, j = min(a, b), max(a, b)
print(color[(i, j)])
| 0 | null | 104,538,609,569,110 | 221 | 272 |
from collections import deque
N = int(input())
c = [chr(ord("a") + i) for i in range(26)]
q = deque("a")
ans = []
while q:
s = q.pop()
if len(s) == N:
ans.append(s)
continue
for x in c[:c.index(max(s)) + 2]:
q.append(s + x)
[print(a) for a in sorted(ans)]
|
import math
import sys
readline = sys.stdin.readline
def main():
n = int(readline().rstrip())
A = list(map(int, readline().rstrip().split()))
cnt = 0
for a in range(n):
if ((a + 1) * A[a]) % 2 == 1:
cnt += 1
print(cnt)
if __name__ == '__main__':
main()
| 0 | null | 29,950,223,826,162 | 198 | 105 |
n, d = map(int, input().split())
number = 0
for i in range(n):
x, y = map(int, input().split())
distance = x ** 2 + y ** 2
if distance <= d ** 2:
number += 1
print(number)
|
N,D = map(int,input().split())
cnt = 0
for i in range(N):
if sum(map(lambda x:x**2,map(int,input().split())))**0.5 <= D:
cnt += 1
print(cnt)
| 1 | 5,894,545,578,050 | null | 96 | 96 |
N,M,L = map(int,input().split())
A = [list(map(int,input().split()))for i in range(N)]
B = [list(map(int,input().split()))for i in range(M)]
ANS = [[0]*L for i in range(N)]
for x in range(N):
for y in range(L):
for z in range(M):
ANS[x][y]+=B[z][y]*A[x][z]
for row in range(N):
print("%d"%ANS[row][0],end="")
for col in range(1,L):
print(" %d"%(ANS[row][col]),end="")
print()
|
from math import pi
r = float(input())
print(round(r * r * pi, 7), round(2 * pi * r, 7))
| 0 | null | 1,027,737,344,670 | 60 | 46 |
n,k=map(int,input().split())
h=input()
cnt=0
for i in range(n):
if h[i]=="1":
cnt+=1
else:
cnt=0
if cnt>=k:
print(-1)
exit()
h=h[::-1]
h+="0"
idx=0
ans=[]
while 1:
if idx+k>=n:
ans.append(n-idx)
break
for i in range(k,0,-1):
if h[idx+i]=="0":
ans.append(i)
idx+=i
break
ans=reversed(ans)
print(" ".join([str(x) for x in ans]))
|
MAX = 10**6+100
MOD = 10**9+7
fact = [0]*MAX #fact[i]: i!
inv = [0]*MAX #inv[i]: iの逆元
finv = [0]*MAX #finv[i]: i!の逆元
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fact[i] = fact[i-1]*i%MOD
inv[i] = MOD-inv[MOD%i]*(MOD//i)%MOD
finv[i] = finv[i-1]*inv[i]%MOD
def C(n, r):
if n<r:
return 0
if n<0 or r<0:
return 0
return fact[n]*(finv[r]*finv[n-r]%MOD)%MOD
X, Y = map(int, input().split())
ans = 0
for i in range(X+1):
if (X-i)%2==0 and (X-i)//2==Y-2*i:
ans += C(Y-i, i)
print(ans)
| 0 | null | 144,201,321,528,740 | 274 | 281 |
def nabeatsu(n):
if(n % 3 == 0):
return True
temp = n
while(temp > 0):
if(temp % 10 == 3):
return True
temp = temp // 10
return False
x = int(input())
for i in range(x):
if(nabeatsu(i + 1)):
print(' ', end = '')
print(i + 1, end = '')
print()
|
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
INF = float('inf')
def main():
s = map(int, input()[::-1])
mod = 2019
counts = [0] * mod
counts[0] = 1
t = 0
x = 1
for num in s:
t = (t + num * x) % mod
counts[t] += 1
x = (x * 10) % mod
ans = 0
for count in counts:
if count > 1:
ans += count * (count - 1) // 2
print(ans)
if __name__ == '__main__':
main()
| 0 | null | 15,777,416,301,698 | 52 | 166 |
x,y = map(int,input().split())
if(x+y==2):
print(1000000)
else:
answer = 0
if(x==2):
answer+=200000
elif(x==3):
answer+=100000
elif(x==1):
answer+=300000
if(y==2):
answer+=200000
elif(y==3):
answer+=100000
elif(y==1):
answer+=300000
print(answer)
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
?´???°
?´???°??? 1 ??¨????????°??????????????§????????????????????¶??°????´???°??¨?¨?????????????
n ????????´??°???????????????????????????????????????????´???°?????°???????????????????????°????????????????????????????????????
"""
import math
def isPrime(x):
""" ??¨???????????????????¢¨?´???°?????? """
if x == 2: # ??¶??°??§?´???°??????????????°
return True
if x % 2 == 0: # 2??\????????¶??°????´???°??§?????????
return False
rx = int(math.sqrt(x)) + 1
for i in range(3, rx, 2): # ?????????????????°?????????????????????
if x % i == 0:
return False
return True
# ?????????
n = int(input().strip())
a = []
for i in range(n):
a.append(int(input().strip()))
cnt = 0
for i in a:
if isPrime(i) == True:
cnt += 1
print(cnt)
| 0 | null | 70,241,217,961,628 | 275 | 12 |
def nCr(n, r, mod):
x, y = 1, 1
for r_ in range(1, r+1):
x = x*(n+1-r_)%mod
y = y*r_%mod
return x*pow(y, mod-2, mod)%mod
x, y = map(int, input().split())
mod = 10**9+7
if (x+y)%3 or 2*x<y or 2*y<x:
print(0)
else:
print(nCr((x+y)//3,(2*x-y)//3, mod))
|
# ABC145 D
X,Y=map(int,input().split())
a,b=-1,-1
if not (2*X-Y)%3:
b=(2*X-Y)//3
if not (2*Y-X)%3:
a=(2*Y-X)//3
N=10**6
p=10**9+7
f,finv,inv=[0]*N,[0]*N,[0]*N
def nCr_init(L,p):
for i in range(L+1):
if i<=1:
f[i],finv[i],inv[i]=1,1,1
else:
f[i]=(f[i-1]*i)%p
inv[i]=(p-inv[p%i]*(p//i))%p
finv[i]=(finv[i-1]*inv[i])%p
def nCr(n,r,p):
if 0<=r<=n and 0<=n:
return (f[n]*finv[n-r]*finv[r])%p
else:
return 0
nCr_init(a+b+1,p)
if a>=0 and b>=0:
print(nCr(a+b,b,p))
else:
print(0)
| 1 | 149,678,878,574,636 | null | 281 | 281 |
import queue
N=int(input())
M=[input().split()[2:]for _ in[0]*N]
q=queue.Queue();q.put(0)
d=[-1]*N;d[0]=0
while q.qsize()>0:
u=q.get()
for v in M[u]:
v=int(v)-1
if d[v]<0:d[v]=d[u]+1;q.put(v)
for i in range(N):print(i+1,d[i])
|
def main():
musics = int(input())
title = []
time = []
for _ in range(musics):
s, t = input().split()
title.append(s)
time.append(int(t))
last_song = input()
for i in range(musics):
if title[i] == last_song:
print(sum(time[i + 1:]))
break
if __name__ == '__main__':
main()
| 0 | null | 48,621,288,664,870 | 9 | 243 |
n=int(input())
A=sorted(list(map(int,input().split())))
ans=0
if n==1 : print(0);exit()
for i in range(n-1):
# if i==0 : ans+=A[-1];continue
ans+=A[-((i+1)//2+1)]
print(ans)
|
n=int(input())
a=list(map(int,input().split()))
a.sort(reverse=True)
ans=a[0]
ch=1
for i in range(1,n):
if ch==n-1:
break
else:
ans+=a[i]
ch+=1
if ch==n-1:
break
else:
ans+=a[i]
ch+=1
print(ans)
| 1 | 9,213,368,843,812 | null | 111 | 111 |
import sys
x,y = map(int,input().split())
for i in range(x+1):
for j in range(x-i+1):
if i+j == x and (i*2)+(j*4) == y:
print("Yes")
sys.exit()
print("No")
|
def bubble(A, N):
c = 0
flag = True
while flag:
flag = False
for j in range(N-1, 0, -1):
if A[j] < A[j-1]:
A[j], A[j-1] = A[j-1], A[j]
c += 1
flag = True
return A, c
if __name__ == "__main__":
N = int(input())
A = [int(i) for i in input().split()]
A, c = bubble(A, N)
print (*A)
print (c)
| 0 | null | 6,823,533,548,940 | 127 | 14 |
N = int(input())
cc = map(int,input().split())
min_num = N
count = 0
for i in cc:
if i <= min_num:
min_num = i
count += 1
print(count)
|
N = int(input())
P = list(map(int,input().split()))
a = 0
s = 10**6
for p in P:
if p<s:
a+=1
s = min(s,p)
print(a)
| 1 | 85,287,784,946,378 | null | 233 | 233 |
N = int(input())
A = [int(x) for x in input().split()]
if 0 in A :
print("0")
exit()
result = 1
for i in range(N) :
result *= A[i]
if result > 10**18 :
print("-1")
exit()
print(result)
|
a,b = map(int, raw_input().split())
print '%d %d %.5f'%(a/b, a%b, (1.0)*a/b)
| 0 | null | 8,324,509,110,038 | 134 | 45 |
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
n, *a = map(int, read().split())
r = 0
minp = a[0]
for i1 in range(n):
if minp >= a[i1]:
r += 1
minp = a[i1]
print(r)
if __name__ == '__main__':
main()
|
k=int(input())
l=["ACL"]*k
print("".join(l))
| 0 | null | 44,064,802,233,760 | 233 | 69 |
n,a,b=list(map(int,input().split()))
#2^n-nCa-nCbを求める
#冪乗を求める関数を求める
#2のn乗をmで割ったあまりを求める
def pow(a,n,m):
if n==0:
return 1
else:
k=pow(a*a%m,n//2,m)
if n%2==1:
k=k*a%m
return k
#次は組み合わせを計算する
#まずは前処理をする
inv=[0 for i in range(200001)]
finv=[0 for i in range(200001)]
inv[1]=1
finv[1]=1
for i in range(2,200001):
#逆元の求め方p=(p//a)*a+p%a a^(-1)=-(p//a)*(p%a)^(-1)
inv[i]=(-(1000000007//i)*inv[1000000007%i])%1000000007
finv[i]=finv[i-1]*inv[i]%1000000007
#nが10^7程度であればnCk=n!*(k!)*((n-k)!)を求めればいい
#nがそれより大きい時は間に合わない。ここでkが小さいことに着目すると
#nCk=n*(n-1).....*(n-k+1)*(k!)^(-1)で求められることがわかる
a_num=1
b_num=1
for i in range(n-a+1,n+1):
a_num=i*a_num%1000000007
for i in range(n-b+1,n+1):
b_num=i*b_num%1000000007
print((pow(2,n,1000000007)-1-a_num*finv[a]-b_num*finv[b])%1000000007)
|
# input
n,a,b = list(map(int,input().split()))
p=10**9+7
#全体の組み合わせの数:All
all_ = pow(2,n,p)
#n本からi本選ぶ組み合わせの数:C[i],i:0~b
C_=[1]*(b+10)
for i in range(1,b+1):
C_[i] = (C_[i-1] * (n-i+1)%p * pow(i,p-2,p))%p
# C_
ans = (all_-C_[a]-C_[b])%p
print(ans-1)
| 1 | 66,545,731,761,458 | null | 214 | 214 |
INPUT = list(map(int, input().split()))
print(INPUT[0]*INPUT[1])
|
a = [int(i) for i in input().split()]
if (a[0] == a[1] and a[0] != a[2]) or (a[0] == a[2] and a[0] != a[1]) or (a[2] == a[1] and a[2] != a[0]):
print('Yes')
else:
print('No')
| 0 | null | 42,110,726,125,950 | 133 | 216 |
n, m = map(int, input().split())
a = []
b = []
for i in range(n):
a += [list(map(int, input().split()))]
a[i] += [sum(a[i])]
for i in range(m+1):
b += [sum(x[i] for x in a)]
a += [b]
for i in range(n+1):
print(*a[i])
|
# -*- coding:utf-8 -*-
N,K = map(int,input().split())
ans = N % K
if abs(ans - K) < ans:
ans = abs(ans - K)
print(ans)
| 0 | null | 20,477,595,013,120 | 59 | 180 |
S_list = [input() for i in range(2)]
K = int(S_list[0])
S = S_list[1]
n = len(S)
if n <= K:
result = S
else:
S = S[:K] + "..."
result = S
print(result)
|
k = int(input())
s = input()
a = list(s.split())
if len(s) <= k:
print(s)
elif len(s) > k:
print((s[0:k] + '...'))
| 1 | 19,632,394,484,120 | null | 143 | 143 |
n, m, q = map(int, input().split())
query = [tuple(map(int, input().split())) for _ in range(q)]
def score(A):
ret = 0
for a, b, c, d in query:
if A[b-1] - A[a-1] == c:
ret += d
return ret
def dfs(pre, _min):
if len(pre) == n:
return score(pre)
ret = 0
for i in range(_min, m+1):
new = pre + [i]
ret = max(ret, dfs(new, i))
return ret
print(dfs([], 1))
|
n = int(input())
P = list(map(int, input().split()))
ans = 0
m = 200002
for p in P:
if p <= m:
m = p
ans += 1
print(ans)
| 0 | null | 56,479,182,306,560 | 160 | 233 |
N,K = [int(i) for i in input().split()]
mod = 998244353
LR = []
S = []
dp = [0]*(N+1)
dps = [0]*(N+1)
dps[1] = 1
dp[1] = 1
for i in range(K):
LR.append([int(i) for i in input().split()])
for i in range(1,N+1):
for l,r in LR:
l,r = i - r,i - l
#print(l,r)
if r < 1:
continue
l = max(1,l)
dp[i] += dps[r] - dps[l-1]
dp[i] %= mod
#print(dp[i])
dps[i] = dps[i-1] + dp[i]
#print(dp, dps)
print(dp[-1])
|
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint
#oo=list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# ko=list("abcdefghijklmnopqrstuvwxyz")
def sosuhante(n):
for k in range(2, int(math.sqrt(n))+1):
if n% k ==0:
return False
return True
def cmb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
numerator = [n - r + k + 1 for k in range(r)]
denominator = [k + 1 for k in range(r)]
for p in range(2,r+1):
pivot = denominator[p - 1]
if pivot > 1:
offset = (n - r) % p
for k in range(p-1,r,p):
numerator[k - offset] /= pivot
denominator[k] /= pivot
result = 1
for k in range(r):
if numerator[k] > 1:
result *= int(numerator[k])
return result
def kingaku(a,b,n):
keta=len(str(n))
return a*n+b*keta
def my_index(l, x, default=False):
if x in l:
return l.index(x)
else:
return default
# h,w,a,b = map(int, input().split())
# c = [[0 for j in range(n)] for i in range(n)]
def ret(a):
c=[None]*(len(a)-1)
if len(a)==1:
return a[0]
elif len(a)==0:
return 0
for i in range(1,len(a)):
c[i-1]=abs(a[i]-a[i-1])
return ret(c)
def soinsubunkai(n):
a = []
i = 1
while i*i <= n:
if n % i == 0 and i!=1:
a.append(i)
n=n//i
if n% i !=0 or i==1:
i += 1
nokori=[n]
return a + nokori
def soinsubunkai_e(n,m): #高速素因数分解 m[n]=nを割ることの出来る最小の素数
a = set()
i = 1
while n>1:
a.add(m[n])
n=n//m[n]
nokori=n
a.add(nokori)
return a
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]
def era(n): #b[n]=nを割ることの出来る最小の素数 の配列を生成 エラトステネスの篩
b=[i for i in range(n+1)]
for i in range(2,int(math.sqrt(n)+10)):
j=1
temp=i*j
while temp<=n:
b[temp]=min(i,b[temp])
temp+=i
return b
def main():
#l,r,d=map(int,input().split())
MODT=998244353
n,k=map(int,input().split())
step=[]
for i in range(k):
l,r=map(int,input().split())
step.append([l,r])
dp=[0 for i in range(n*2+2)]
dp[1]=1
dp[2]=-1
# print(step)
for i in range(1,n+1):
# print(dp)
dp[i]+=dp[i-1]
dp[i]%=MODT
for j in range(k):
dp[i+step[j][0]]+=dp[i]%MODT
dp[i+step[j][1]+1]-=dp[i]%MODT
# print(dp)
# print(dp)
print(dp[n]%MODT)
if __name__ == "__main__":
main()
| 1 | 2,717,686,774,920 | null | 74 | 74 |
N = int(input())
def func(x):
if len(x) == N:
print("".join(x))
return
last = ord(max(x)) - ord("a") + 1 if x else 0
for i in range(min(26, last) + 1):
x.append(chr(ord("a") + i))
func(x)
x.pop()
func([])
|
n = map(int, raw_input().split(' '))[0]
def dfs(i, mx, n, cur = []):
if i==n:
print ''.join(cur)
return
for v in range(0, mx + 1): dfs(i + 1, mx + (1 if v == mx else 0), n , cur + [chr(v+ ord('a'))])
dfs(0,0,n)
| 1 | 52,219,283,018,260 | null | 198 | 198 |
line = raw_input()
lis = line.split()
a = int(lis[0])
b = int(lis[1])
s = a * b
len = 2 * (a + b)
print str(s) + " " + str(len)
|
n, m = map(int, input().split())
data2 = []
for i in range(m):
data2.append(input().split())
graph = [[] for i in range(n)]
for i in range(0,m):
a, b = map(lambda z: int(z) - 1, data2[i])
graph[a].append(b)
graph[b].append(a)
size = [0 for i in range(n)]
check = [True for i in range(n)]
for i in range(n):
if check[i]:
tmp = 1
stack = [i]
check[i] = False
while stack:
now = stack.pop()
size[now] = tmp
tmp += 1
for to in graph[now]:
if check[to]:
check[to] = False
stack.append(to)
print(max(size))
| 0 | null | 2,127,954,144,492 | 36 | 84 |
s=input()
print('YNeos'[(s[2]!=s[3])|(s[4]!=s[5])::2])
|
n,k = map(int,input().split())
a = list(map(int,input().split()))
f = list(map(int,input().split()))
lim = sum(a) -k
if(lim <= 0):
print(0)
exit()
min_ = 0
max_ = 10**12+1
a.sort()
a = tuple(a)
f.sort(reverse=True)
f = tuple(f)
for i in range(100):
tmp = (max_ + min_)//2
tmp_sum = 0
for j in range(n):
tmp_sum += max(0, a[j] - tmp//f[j])
if(tmp_sum <= k):
max_ = tmp
else:
min_ = tmp
if(max_ - min_ == 1):
break
print(max_)
| 0 | null | 103,550,981,283,652 | 184 | 290 |
def roll(inst):
global u, s, e, w, n, d
if inst == 'N':
u, s, n, d = s, d, u, n
elif inst == 'E':
u, e, w, d = w, u, d, e
elif inst == 'S':
u, s, n, d = n, u, d, s
elif inst == 'W':
u, e, w, d = e, d, u, w
u, s, e, w, n, d = map(int, input().split())
q = int(input())
for i in range(q):
u1, s1 = map(int, input().split())
if u1 == u:
pass
elif u1 == s:
roll('N')
elif u1 == e:
roll('W')
elif u1 == w:
roll('E')
elif u1 == n:
roll('S')
elif u1 == d:
roll('N')
roll('N')
if s1 == s:
print(e)
elif s1 == e:
print(n)
elif s1 == n:
print(w)
elif s1 == w:
print(s)
|
#!/usr/bin/env python
import random
class Dice:
def __init__(self, top, s, e, w, n, bottom):
self.top = top
self.s = s
self.e = e
self.w = w
self.n = n
self.bottom = bottom
def rotate(self, dist):
if dist == 'N':
self.top, self.s, self.n, self.bottom = self.s, self.bottom, self.top, self.n
elif dist == 'S':
self.s, self.bottom, self.top, self.n = self.top, self.s, self.n, self.bottom
elif dist == 'E':
self.top, self.e, self.w, self.bottom = self.w, self.top, self.bottom, self.e
elif dist == 'W':
self.w, self.top, self.bottom, self.e = self.top, self.e, self.w, self.bottom
if __name__ == '__main__':
dice = Dice(*map(int, raw_input().split()))
ref = dict()
while len(ref)<24:
ref[(dice.top, dice.s)] = dice.e
dice.rotate('NSEW'[random.randint(0,3)])
for _ in range(input()):
top, s = map(int, raw_input().split())
print ref[(top, s)]
| 1 | 252,262,664,420 | null | 34 | 34 |
k = int(input())
a, b = list(map(int, input().split()))
ans = 'NG'
for i in range(1000 // k + 1):
if a <= i * k <= b:
ans = 'OK'
break
print(ans)
|
from itertools import chain, combinations
def power_set(x):
return chain.from_iterable(combinations(x, r) for r in range(len(x)+1))
def main():
n = int(input())
A = input()
#print(n)
A = list(map(int, A.split()))
q = int(input())
m = input()
ms = list(map(int, m.split()))
powerset = power_set(A)
sum_set = [sum(s) for s in powerset if len(s)!=0]
for m in ms:
if m in sum_set:
print('yes')
else:
print('no')
if __name__ == '__main__':
main()
| 0 | null | 13,249,900,809,710 | 158 | 25 |
import numpy as np
n, t = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort()
dp = np.zeros(t, dtype=np.int64)
ans = 0
for a, b in ab:
ans = max(ans, dp[-1] + b)
np.maximum(dp[a:], dp[:-a] + b, out=dp[a:])
print(ans)
|
from math import cos, sin, pi
def make_koch_curve(N, n1, n2):
s = ((2 * n1[0] + n2[0]) / 3, (2 * n1[1] + n2[1]) / 3)
t = ((n1[0] + 2 * n2[0]) / 3, (n1[1] + 2 * n2[1]) / 3)
u = ((t[0] - s[0])*cos(pi/3) - (t[1] - s[1])*sin(pi/3) + s[0],
(t[0] - s[0])*sin(pi/3) + (t[1] - s[1])*cos(pi/3) + s[1])
if N == 0:
return
make_koch_curve(N-1, n1, s)
print(*s)
make_koch_curve(N-1, s, u)
print(*u)
make_koch_curve(N-1, u, t)
print(*t)
make_koch_curve(N-1, t, n2)
def main():
N = int(input())
n1 = (0., 0.)
n2 = (100., 0.)
print(*n1)
make_koch_curve(N, n1, n2)
print(*n2)
if __name__ == '__main__':
main()
| 0 | null | 76,077,829,335,572 | 282 | 27 |
from sys import stdin
input = stdin.readline
from time import time
from random import randint
from copy import deepcopy
start_time = time()
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 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
def subGreedy(c, s, t, day):
day_lim = len(s)
socres = [0]*26
t = [0]*day_lim
lasts = [0]*26
for i in range(1, day_lim):
if day <= i:
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]
else:
scores[t[i]] += s[i][t[i]]
lasts[t[i]] = i
for j in range(26):
dif = i - lasts[j]
scores[j] -= c[j] * dif
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)
sum_score = sum(scores)
tm = time() - start_time
while tm < 1.86:
typ = randint(1, 100)
if typ <= 40:
for _ in range(500):
tmp_t = deepcopy(t)
tmp_t[randint(1, D)] = randint(0, 25)
tmp_scores = calcScore(tmp_t, s, c)
sum_tmp_score = sum(tmp_scores)
if sum_score < sum_tmp_score or (tm < 1.0 and randint(1, 1000) <= 1):
sum_score = sum_tmp_score
t = deepcopy(tmp_t)
scores = deepcopy(tmp_scores)
elif typ <= 99:
for _ in range(100):
tmp_t = deepcopy(t)
dist = randint(1, 15)
p = randint(1, D-dist)
q = p + dist
tmp_t[p], tmp_t[q] = tmp_t[q], tmp_t[p]
tmp_scores = calcScore(tmp_t, s, c)
sum_tmp_score = sum(tmp_scores)
if sum_score < sum_tmp_score or (tm < 1.0 and randint(1, 200) <= 1):
sum_score = sum_tmp_score
t = deepcopy(tmp_t)
scores = deepcopy(tmp_scores)
elif typ <= 100:
tmp_t = deepcopy(t)
day = randint(D//4*3, D)
tmp_scores, tmp_t = subGreedy(c, s, tmp_t, day)
sum_tmp_score = sum(tmp_scores)
if sum_score < sum_tmp_score:
sum_score = sum_tmp_score
t = deepcopy(tmp_t)
scores = deepcopy(tmp_scores)
tm = time() - start_time
for v in t[1:]:
print(v+1)
|
# -*- coding: utf-8 -*-
import sys
import os
import math
n = int(input())
p0 = (0, 0)
p1 = (100, 0)
def koch(depth, p0, p1):
if depth == 0:
return
# s = 2/3 p0 + 1/3 p1
sx = 2 / 3 * p0[0] + 1 / 3 * p1[0]
sy = 2 / 3 * p0[1] + 1 / 3 * p1[1]
s = (sx, sy)
tx = 1 / 3 * p0[0] + 2 / 3 * p1[0]
ty = 1 / 3 * p0[1] + 2 / 3 * p1[1]
t = (tx, ty)
theta = math.radians(60)
ux = math.cos(theta) * (tx - sx) - math.sin(theta) * (ty - sy) + sx
uy = math.sin(theta) * (tx - sx) + math.cos(theta) * (ty - sy) + sy
u = (ux, uy)
# ????????? s, u, t?????¨???
koch(depth - 1, p0, s)
print(*s)
koch(depth - 1, s, u)
print(*u)
koch(depth - 1, u, t)
print(*t)
koch(depth - 1, t, p1)
print(*p0)
koch(n, p0, p1)
print(*p1)
| 0 | null | 4,924,735,537,696 | 113 | 27 |
N=int(input())
c=[[0 for _ in range(10)] for _ in range(10)]
for h in range(1,N+1):
num=str(h)
c[int(num[-1])][int(num[0])]+=1
ans=0
for i in range(10):
for j in range(10):
ans+=c[i][j]*c[j][i]
print(ans)
|
from collections import Counter
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
#BC=[]
#for i in range(Q):
# BC.append(list(map(int,input().split())))
A_sum=sum(A)
A_count=Counter(A)
for i in range(Q):
B,C=(map(int,input().split()))
A_sum+=(C-B)*A_count[B]
A_count[C]+=A_count[B]
A_count[B]=0
print(A_sum)
| 0 | null | 49,177,454,365,868 | 234 | 122 |
n,m,l=map(int,input().split())
b=[]
for i in range(n):
x= list(map(int, input().split()))
b.append(x)
y=[]
for i in range(m):
z= list(map(int, input().split()))
y.append(z)
c = [[0] * l for i in range(n)]
for i in range(n):
for j in range(l):
for k in range(m):
c[i][j] += b[i][k] * y[k][j]
print(*c[i]) #*をつけると[]が外れて表示される
|
n, m, l = map(int, input().split())
A = []
B = []
for line in range(n):
A.append(list(map(int, input().split())))
for line in range(m):
B.append(list(map(int, input().split())))
C = []
for lines in range(n):
C.append([sum([A[lines][i] * B[i][j] for i in range(m)]) for j in range(l)])
print(" ".join(map(str, C[lines])))
| 1 | 1,464,573,906,504 | null | 60 | 60 |
def sample(n):
return n * n * n
n = input()
x = sample(n)
print x
|
class UnionFind:
par = None
def __init__(self, n):
self.par = [0] * n
def root(self, x):
if(self.par[x] == 0):
return x
else:
self.par[x] = self.root(self.par[x])
return self.root(self.par[x])
def unite(self, x, y):
if(self.root(x) != self.root(y)):
self.par[self.root(x)] = self.root(y)
def same(self, x, y):
return self.root(x) == self.root(y)
N, M = list(map(int, input().split()))
UF = UnionFind(N)
for i in range(M):
A, B = list(map(int, input().split()))
UF.unite(A - 1, B - 1)
ans = 0
for i in range(N):
if(UF.par[i] == 0):
ans += 1
print(ans - 1)
| 0 | null | 1,284,303,505,650 | 35 | 70 |
N=int(input())
base = ["ACL"]*N
print("".join(base))
|
import math
a, b, x = map(int, input().split())
if x < a ** 2 * b / 2:
theta = math.atan2(b, 2 * x / b / a)
else:
theta = math.atan2(2 * b - 2 * x / a / a, a)
deg = math.degrees(theta)
print(deg)
| 0 | null | 82,933,276,393,408 | 69 | 289 |
h, w, f = list(map(int, input().split()))
c = [input() for i in range(h)]
count = 0
bit_h = []
for k in range(2**h):
hh = []
for l in range(h):
if((k >> l) & 1):
hh.append(1)
else:
hh.append(0)
bit_h.append(hh)
bit_w = []
for i in range(2**w):
ww = []
for j in range(w):
if((i >> j) & 1):
ww.append(1)
else:
ww.append(0)
bit_w.append(ww)
ans = 0
for i in range(len(bit_h)):
for j in range(len(bit_w)):
count = 0
for k in range(h):
for l in range(w):
if bit_h[i][k] == 1 and bit_w[j][l] == 1 and c[k][l] == "#":
count += 1
if count == f:
ans += 1
print(ans)
|
n,r=map(int,input().split())
ans = r
if n<10:
ans = r+100*(10-n)
print(ans)
| 0 | null | 36,397,104,374,940 | 110 | 211 |
N,K=map(int,input().split())
ans=list()
for i in range(K):
D=int(input())
L=list(map(int,input().split()))
ans+=L
ans=list(set(ans))
print(N-len(ans))
|
n, k = map(int, input().split())
okashi = set()
for _ in range(k):
d = int(input())
lst = [int(i) for i in input().split()]
for i in range(d):
if lst[i] not in okashi:
okashi.add(lst[i])
count = 0
for i in range(n):
if i + 1 not in okashi:
count += 1
print(count)
| 1 | 24,443,679,855,878 | null | 154 | 154 |
N, A, B = map(int, input().split())
temp = N // (A+B)
temp2 = N % (A + B)
temp2 = min(temp2, A)
print(temp*A + temp2)
|
n = int(input())
for _ in range(n):
num = sorted(map(int, input().split()))
print("YES" if num[2]**2 == num[1]**2 + num[0]**2 else "NO")
| 0 | null | 27,843,034,804,588 | 202 | 4 |
n = input()
a = map(int, raw_input().split())
for i in range(n):
key = a[i]
j = i - 1
while j >= 0 and a[j] > key:
a[j + 1] = a[j]
j -= 1
a[j + 1] = key
print(" ".join(map(str, a)))
|
def insertion_sort(array):
'''?????????????´?????????????????????¨??????????????????????????¨???????????????????????§?????\?????????????????°????????????
1. ??????????????¨??????????????????????´?????????????????????? v ????¨?????????????
2. ????????????????????¨??????????????????v ????????§??????????´??????????????????????????§?????????????
3. ?????????????????????????????????????????????????´? v???????????\?????????'''
for i in range(len(array)):
v = array[i]
j = i - 1
while(j>=0 and array[j] > v):
array[j+1] = array[j]
j = j - 1
array[j+1] = v
print(' '.join(map(str, array)))
def test():
'''??? input =
6
5 2 4 6 1 3
->
5 2 4 6 1 3
2 5 4 6 1 3
2 4 5 6 1 3
2 4 5 6 1 3
1 2 4 5 6 3
1 2 3 4 5 6'''
element_number = int(input())
input_array = list(map(int, input().split()))
insertion_sort(input_array)
if __name__ == '__main__':
test()
| 1 | 6,015,685,182 | null | 10 | 10 |
N = int(input())
ans = 0
ans = -(-N//2)
print(ans)
|
n = int(input())
for a in range(-118,120):
for b in range(-119,119):
if a ** 5 - b **5 == n :
print(a,b)
exit()
| 0 | null | 42,134,367,086,480 | 206 | 156 |
def bubble_sort(array):
isEnd = False
count_swap = 0
while isEnd is False:
isEnd = True
for j in reversed(range(1,len(array))):
if array[j - 1] > array[j]:
tmp = array[j - 1]
array[j - 1] = array[j]
array[j] = tmp
count_swap += 1
isEnd = False
return count_swap
def print_array(array):
print(str(array)[1:-1].replace(', ', ' '))
def main():
N = int(input())
array = [int(s) for s in input().split(' ')]
count = bubble_sort(array)
print_array(array)
print(count)
if __name__ == '__main__':
main()
|
n, m, q = map(int, input().split())
abcd = [list(map(int, input().split())) for _ in range(q)]
a,b,c,d = [],[],[],[]
for i in range(q):
a.append(abcd[i][0])
b.append(abcd[i][1])
c.append(abcd[i][2])
d.append(abcd[i][3])
def score(A):
tmp = 0
for ai, bi, ci, di in zip(a, b, c, d):
if A[bi] - A[ai] == ci:
tmp += di
return tmp
def dfs(A):
if len(A)==n+1:
return score(A)
ans = 0
for i in range(A[-1],m):
A.append(i)
ans = max(ans,dfs(A))
A.pop()
return ans
print(dfs([0]))
| 0 | null | 13,696,501,678,264 | 14 | 160 |
import collections
n = int(input())
s = input()
ans = 0
for i in range(10):
ind = s.find(str(i))+1
if ind == 0 or ind == len(s):
continue
for j in range(10):
ind_j = ind + s[ind:].find(str(j))+1
if ind_j == ind or ind_j == len(s):
continue
cnt = collections.Counter(s[ind_j:])
ans += len(cnt)
print(ans)
|
while True:
input = raw_input()
if input == "0":
break
sum = 0
for i in xrange(len(input)):
sum += int(input[i])
print sum
| 0 | null | 65,337,768,887,270 | 267 | 62 |
import sys
input = sys.stdin.readline
'''
'''
s = input().rstrip()
if s == "MON": print(6)
elif s == "SAT": print(1)
elif s == "FRI": print(2)
elif s == "THU": print(3)
elif s == "WED": print(4)
elif s == "TUE": print(5)
else:
print(7)
|
S = input()
# 辞書型を使うとスッキリ書ける!
dic = {'SUN': 7, 'MON': 6, 'TUE': 5, 'WED': 4, 'THU': 3, 'FRI': 2, 'SAT': 1}
print(dic[S])
| 1 | 133,067,398,557,210 | null | 270 | 270 |
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = input()
k = int(K)
print(A[k-1])
|
import sys
import collections
N = int(input())
L = collections.deque()
for _ in range(N):
com = (sys.stdin.readline().rstrip()).split()
if com[0] == 'insert':
L.appendleft(int(com[1]))
elif com[0] == 'delete':
try:
L.remove(int(com[1]))
except:
pass
elif com[0] == 'deleteFirst':
L.popleft()
elif com[0] == 'deleteLast':
L.pop()
print(*L)
| 0 | null | 24,993,906,503,598 | 195 | 20 |
S = input()
result = ''
for _ in S:
result += 'x'
print(result)
|
S = str(input())
a = len(S)
print('x' * a)
| 1 | 73,112,808,657,604 | null | 221 | 221 |
from collections import deque
def run_process(processes, slot):
"""Simulate the round-robin scheduler.
Returns a list of (process, elapsed_time).
>>> ps = [('p1', 150), ('p2', 80), ('p3', 200), ('p4', 350), ('p5', 20)]
>>> run_process(ps, 100)
[('p2', 180), ('p5', 400), ('p1', 450), ('p3', 550), ('p4', 800)]
"""
ps = deque(processes)
tot = 0
finish = []
while len(ps) > 0:
p, t = ps.popleft()
dt = min(t, slot)
if dt == t:
finish.append((p, tot+dt))
else:
ps.append((p, t-dt))
tot += dt
return finish
def run():
count, slot = [int(i) for i in input().split()]
ps = []
for _ in range(count):
p, t = input().split()
ps.append((p, int(t)))
for p, t in run_process(ps, slot):
print(p, t)
if __name__ == '__main__':
run()
|
#!usr/bin/env pypy3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
res = list(sys.stdin.readline())
if res[-1] == "\n":
return res[:-1]
return res
def IR(n):
return [I() for i in range(n)]
def LIR(n):
return [LI() for i in range(n)]
def SR(n):
return [S() for i in range(n)]
def LSR(n):
return [LS() for i in range(n)]
sys.setrecursionlimit(1000000)
def main():
K = I()
ans = 0
for i in range(1, K+1):
for j in range(1, K+1):
for k in range(1, K+1):
ans += math.gcd(math.gcd(i, j), k)
print(ans)
main()
| 0 | null | 17,715,958,749,850 | 19 | 174 |
z = input()
a= z.split()
if int(a[0]) < int(a[1]) < int(a[2]):
print('Yes')
else:
print('No')
|
s = input()
hitachi = ""
for i in range(5):
hitachi += "hi"
if s==hitachi:
print("Yes")
exit(0)
print("No")
| 0 | null | 26,752,634,791,738 | 39 | 199 |
class UnionFind(object):
def __init__(self, n=1):
self.par = [i for i in range(n)]
self.rank = [0 for _ in range(n)]
self.size = [1 for _ in range(n)]
def find(self, x):
if self.par[x] == x:
return x
else:
self.par[x] = self.find(self.par[x])
return self.par[x]
def union(self, x, y):
x = self.find(x)
y = self.find(y)
if x != y:
if self.rank[x] < self.rank[y]:
x, y = y, x
if self.rank[x] == self.rank[y]:
self.rank[x] += 1
self.par[y] = x
self.size[x] += self.size[y]
def is_same(self, x, y):
return self.find(x) == self.find(y)
def get_size(self, x):
x = self.find(x)
return self.size[x]
N, M = map(int, input().split())
u = UnionFind(N+1)
for i in range(M):
A, B = map(int, input().split())
u.union(A, B)
print(max([u.get_size(i) for i in range(1, N+1)]))
|
from collections import defaultdict
def main():
N, M = map(int, input().split())
g = defaultdict(set)
for _ in range(M):
a, b = map(int, input().split())
a -= 1
b -= 1
g[a].add(b)
g[b].add(a)
def dfs(u, visited: set):
stack = [u]
visited.add(u)
while stack:
u = stack.pop()
for v in g[u]:
if v not in visited:
stack.append(v)
visited.add(v)
count = dict()
for u in range(N):
if u in count:
continue
visited = set()
dfs(u, visited)
# print(visited)
count[u] = len(visited)
for v in visited:
count[v] = len(visited)
print(max(count.values()))
if __name__ == '__main__':
import sys
sys.setrecursionlimit(10000)
main()
| 1 | 3,963,639,863,530 | null | 84 | 84 |
n, m, k = map(int, input().split())
mod = 998244353
def powerDX(n, r, mod):
if r == 0: return 1
if r%2 == 0:
return powerDX(n*n % mod, r//2, mod) % mod
if r%2 == 1:
return n * powerDX(n, r-1, mod) % mod
def cmb(n, r, mod):
if ( r<0 or r>n ):
return 0
r = min(r, n-r)
return g1[n] * g2[r] * g2[n-r] % mod
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, n + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
g2.append( (g2[-1] * inverse[-1]) % mod )
ans = 0
for i in range(0, k+1):
ans += m*cmb(n-1, i, mod)*pow(m-1, n-i-1, mod)
ans %= mod
print(ans)
|
N,M,K = map(int, input().split())
MOD = 998244353
fact = [0] * (N+1)
inv = [0] * (N+1)
fact[0] = fact[1] = 1
inv[1] = 1
for i in range(2, N+1):
fact[i] = fact[i-1] * i % MOD
inv[i] = MOD - inv[MOD%i] * (MOD//i) % MOD # //で良いのかな?
def main():
if N == 1:
print(M)
return
num = M
nums = [M]
for i in reversed(range(1,N)):
num *= i*(M-1)
num *= inv[N-i]
num %= MOD
nums.append(num)
nums.reverse()
print(sum(nums[:K+1])%MOD)
if __name__ == "__main__":
main()
| 1 | 23,038,905,108,590 | null | 151 | 151 |
a,b,c = map(int, input().split())
if 4*a*b < (c-a-b)**2 and c > a + b:
print('Yes')
else:
print('No')
|
import decimal
#decimal.getcontext().prec = 30
a,b,c = list(map(int, input().split()))
a = decimal.Decimal(a)
b = decimal.Decimal(b)
c = decimal.Decimal(c)
d = decimal.Decimal(0.5)
e = decimal.Decimal(1/10000000)
#print(a**decimal.Decimal(0.5))
if(a**d + b**d < (c)**d ):
print("Yes")
else:
print("No")
#print(a**d + b**d , (c)**d)
| 1 | 51,687,624,725,552 | null | 197 | 197 |
N = int(input())
amount = 0
for i in range(1, N + 1):
if (i % 15 == 0) or (i % 3 == 0) or (i % 5 == 0):
pass
else:
amount = amount + i
print(amount)
|
n = int(input())
sum = 0
for i in range(1, n + 1):
if i % 3 != 0 and i % 5 != 0:
sum = sum + i
print(sum)
| 1 | 34,992,124,824,402 | null | 173 | 173 |
N,K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
M = 10**9+7
def pow(a,b,M):
if b == 0:
return 1
elif b % 2 == 0:
return pow((a**2)%M,b//2,M) % M
else:
return ((a % M) * pow((a**2)%M,b//2,M)) % M
def inv(a,p):
return pow(a,p-2,p)
ans,comb = 0,1
#i番目ではcomb = (K-1-i)_C_(K-1)
#max,min以外での選ぶ個数は常にK-1であることに注目すればcomb関数はいらなかった
for i in range(N-K+1):
if i > 0:
comb = (comb * (K-1+i) * inv(i,M)) % M
ans = (ans + comb*((A[K-1+i]-A[N-K-i]) % M)) % M
print(ans)
|
n, k, *a = map(int, open(0).read().split())
a.sort()
mod = 10 ** 9 + 7
fact = [1] * (n + 1)
for i in range(1, n + 1):
fact[i] = fact[i - 1] * i % mod
def inv(x):
return pow(x, mod - 2, mod)
def c(n, k):
return fact[n] * inv(fact[n - k] * fact[k] % mod) % mod
ans = 0
for i in range(k - 1, n):
# a[i]がmax
ans += a[i] * c(i, k - 1) % mod
a = list(reversed(a))
for i in range(k - 1, n):
ans -= a[i] * c(i, k - 1) % mod
print((ans + mod) % mod)
| 1 | 95,423,362,020,052 | null | 242 | 242 |
from sys import stdin
from math import pi
r = float(stdin.readline().rstrip())
area = pi*r*r
circumference = 2*pi*r
print("%lf %lf" % (area, circumference))
|
N, *X = map(int, open(0).read().split())
ans = float("inf")
for x in range(min(X), max(X) + 1):
cur = 0
for j in range(N):
cur += (X[j] - x) ** 2
ans = min(ans, cur)
print(ans)
| 0 | null | 32,775,807,642,852 | 46 | 213 |
a, b, k = map(int, input().split())
if a==0 and b==0:
print(0, 0)
elif k>a:
if b-(k-a)>0:
print(0, b-(k-a))
else:
print(0, 0)
elif k<a:
print(a-k, b)
elif a==k:
print(0, b)
|
a, b, k = map(int, input().split())
if a >= k:
print(a-k, b)
elif b >= (k-a):
print(0, (a+b)-k)
else:
print(0, 0)
| 1 | 104,379,872,260,918 | null | 249 | 249 |
from itertools import product
import copy
H,W,K = list(map(int, input().split()))
A = []
for i in range(H):
A.append(list(map(int, input())))
#SM = [np.cumsum(A[i]) for i in range(H)]
ANS = []
for pat in product(['0','1'], repeat = H-1):
res = []
cnt = 0
now = copy.copy(A[0])
for i in range(1,H):
p = pat[i-1]
if p == '1':
res.append(now)
now = copy.copy(A[i])
cnt += 1
else:
for j in range(W):
now[j] += A[i][j]
res.append(now)
"""
print("---")
print(pat)
print(res)
print(cnt)
"""
wk2 = [0] * len(res)
cnt2 = 0
flg = True
for x in range(W):
for j in range(len(res)):
if res[j][x] > K:
# 横に割った段階で、すでに最小単位がKを超えてたら実現不可能
flg = False
break
if wk2[j] + res[j][x] > K:
cnt2 += 1
wk2 = [0] * len(res)
break
for j in range(len(res)):
wk2[j] += res[j][x]
if not flg:
break
if flg:
ANS.append(cnt + cnt2)
#print(pat, cnt, cnt2)
print(min(ANS))
|
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
H, W, K = map(int, input().split())
S = [tuple(map(int, list(input()))) for _ in range(H)]
ans = 10 ** 9
for bit in range(1 << (H-1)):
canSolve = True
order = [0] * (H + 1)
tmp_ans = 0
for i in range(H):
if bit & 1 << i:
order[i+1] = order[i] + 1
tmp_ans += 1
else:
order[i+1] = order[i]
sum_block = [0] * (H + 1)
for w in range(W):
one_block = [0] * (H + 1)
overK = False
for h in range(H):
h_index = order[h]
one_block[h_index] += S[h][w]
sum_block[h_index] += S[h][w]
if one_block[h_index] > K:
canSolve = False
if sum_block[h_index] > K:
overK = True
if not canSolve:
break
if overK:
tmp_ans += 1
sum_block = one_block
if tmp_ans >= ans:
canSolve = False
break
if canSolve:
ans = tmp_ans
print(ans)
if __name__ == '__main__':
main()
| 1 | 48,632,025,280,014 | null | 193 | 193 |
MAX = 2*10**6
MOD = 10**9+7
fac = [0] * (MAX)
finv = [0] * (MAX)
inv = [0] * (MAX)
def comb_init():
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fac[i] = fac[i-1] * i % MOD
inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
finv[i] = finv[i-1] * inv[i] % MOD
def comb(n, k):
if n < k:
return 0
if n < 0 or k < 0:
return 0
return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD
if __name__ == '__main__':
k = int(input())
s = input()
n = len(s)
comb_init()
ans = 0
for i in range(k+1):
val = comb(i+n-1, n-1)
val *= pow(25, i, MOD)
val %= MOD
val *= pow(26, k-i, MOD)
val %= MOD
ans += val
ans %= MOD
print(ans)
|
K=int(input())
L=len(input())
from numba import*
@njit(cache=1)
def f():
m=10**9+7
max_n=2*10**6
fac=[1]*(max_n+1)
inv=[1]*(max_n+1)
ifac=[1]*(max_n+1)
for n in range(2,max_n+1):
fac[n]=(fac[n-1]*n)%m
inv[n]=m-inv[m%n]*(m//n)%m
ifac[n]=(ifac[n-1]*inv[n])%m
d=[1]*(K+1)
d2=[1]*(K+1)
for i in range(K):
d[i+1]=d[i]*25%m
d2[i+1]=d2[i]*26%m
a=0
for i in range(K+1):
a=(a+fac[L+i-1]*ifac[i]%m*ifac[L-1]%m*d[i]%m*d2[K-i]%m)%m
return a
print(f())
| 1 | 12,745,616,821,920 | null | 124 | 124 |
import math
a, b = map(int, input().split())
for i in range(1, 10**5):
if math.floor(i*0.08) == a and math.floor(i*0.1) == b:
print(i)
exit()
print(-1)
|
A, B = map(int, input().split())
x = 0
while int(x * 0.08) <= A or int(x * 0.1) <= B:
x += 1
if int(x * 0.08) == A and int(x * 0.1) == B:
print(x)
exit()
print(-1)
| 1 | 56,361,032,953,700 | null | 203 | 203 |
K = int(input())
A, B = map(int, input().split())
ans = "NG"
for i in range(A, B+1):
if i % K == 0:
ans = "OK"
break
else:
pass
print(ans)
|
import math
def checkPrime(n):
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
return False
return True
if __name__ == "__main__":
N = input()
cnt = 0
for i in range(N):
n = input()
if checkPrime(n):
cnt += 1
print cnt
| 0 | null | 13,273,219,611,808 | 158 | 12 |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
inf = 10**17
mod = 10**9+7
k, x = map(int, input().split())
if k * 500 >= x: print("Yes")
else: print("No")
|
k,x=list(map(int,input().split()))
if 500*k>=x:
print('Yes')
else:
print('No')
| 1 | 98,337,775,197,710 | null | 244 | 244 |
H, W, K = map(int, input().split())
c = []
b_h = [0] * H
b_w = [0] * W
b = 0
for h in range(H):
c.append(input().rstrip())
for w in range(W):
if c[h][w] == "#":
b_h[h] += 1
b_w[w] += 1
b += 1
ans = 0
for hi in range(2 ** H):
for wi in range(2 ** W):
bsum = b
for h in range(H):
if hi & (2 ** h) != 0:
bsum -= b_h[h]
for w in range(W):
if wi & 2 ** w != 0:
if c[h][w] == '#':
bsum += 1
for w in range(W):
if wi & (2 ** w) != 0:
bsum -= b_w[w]
if bsum == K:
ans += 1
print(ans)
|
def main():
H, W, K = [int(k) for k in input().split(" ")]
C = []
black_in_row = []
black_in_col = [0] * W
for i in range(H):
C.append(list(input()))
black_in_row.append(C[i].count("#"))
for j in range(W):
if C[i][j] == "#":
black_in_col[j] += 1
black = sum(black_in_row)
if black < K:
print(0)
return 0
cnt = 0
for i in range(2 ** H):
row_bit = [f for f, b in enumerate(list(pad_zero(format(i, 'b'), H))) if b == "1"]
r = sum([black_in_row[y] for y in row_bit])
for j in range(2 ** W):
col_bit = [f for f, b in enumerate(list(pad_zero(format(j, 'b'), W))) if b == "1"]
c = sum([black_in_col[x] for x in col_bit])
bl = black - r - c + sum([1 for p in row_bit for q in col_bit if C[p][q] == "#"])
if bl == K:
cnt += 1
print(cnt)
def pad_zero(s, n):
s = str(s)
return ("0" * n + s)[-n:]
main()
| 1 | 8,933,789,714,930 | null | 110 | 110 |
x,y=map(int,input().split())
if (2*y-x)%3==0 and(2*x-y)%3==0 and (2*y-x)>=0 and (2*x-y)>=0:
a=(2*y-x)//3
b=(2*x-y)//3
numerator=1
denominator=1
for i in range(a):
numerator=(numerator*(a+b-i))%(10**9+7)
denominator=(denominator*(a-i))%(10**9+7)
print((numerator*pow(denominator,10**9+5,10**9+7))%(10**9+7))
else:
print(0)
|
N = int(input())
import math
o = math.ceil(N / 2)
print(o / N)
| 0 | null | 163,366,490,512,608 | 281 | 297 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.