input stringlengths 20 127k | target stringlengths 20 119k | problem_id stringlengths 6 6 |
|---|---|---|
n = int(eval(input()))
nodes = []
id_list = []
output = [None for i in range(n)]
cnt = 0
root = set(range(n))
for i in range(n):
id, _, *li = list(map(int, input().split(' ')))
root -= set(li)
nodes.append(li)
id_list.append(id)
def rooted_tree(id, depth, parent):
out = {}
ind = i... | n = int(eval(input()))
nodes = [0 for i in range(n)]
output = [None for i in range(n)]
cnt = 0
root = set(range(n))
for i in range(n):
id, _, *li = list(map(int, input().split(' ')))
root -= set(li)
nodes[id] = li
def rooted_tree(id, depth, parent):
out = {}
out['node'] = id
out['p... | p02279 |
#coding:utf-8
#1_7_A
class Node():
def __init__(self, node_id, degree, children):
self.node_id = node_id
self.parent = -1
self.depth = 0
self.typ = "leaf"
self.degree = degree
self.children = children
def set_attr(s... | #coding:utf-8
#1_7_A
class Node():
def __init__(self, node_id, children):
self.node_id = node_id
self.parent = -1
self.depth = 0
self.typ = "leaf"
self.children = children
def set_attr(self, parent, depth):
self.parent = ... | p02279 |
# -*- coding:utf-8 -*-
import sys
from collections import OrderedDict
def cleate_node_dict(children):
node_dict = OrderedDict()
for val in children:
node_dict[val] = OrderedDict()
return node_dict
def cleate_tree(nodes):
tree = nodes.copy()
for node, children in list(nodes.... | # -*- coding:utf-8 -*-
import sys
from collections import OrderedDict
def cleate_node_dict(children):
node_dict = OrderedDict()
for val in children:
node_dict[val] = None
return node_dict
def cleate_tree(nodes):
tree = nodes.copy()
for node, children in list(nodes.items()):... | p02279 |
a,b,c = list(map(int, input().split()))
if a == max(a,b,c):
print((int(b*c / 2)))
elif b == max(a,b,c):
print((int(a*c / 2)))
elif c == max(a,b,c):
print((int(a*b / 2)))
| a, b, c = list(map(int, input().split()))
print((a*b // 2)) | p03145 |
a,b,c = sorted([int(i) for i in input().split()])
print((int(a*b/2))) | a = [int(i) for i in input().split()]
a = sorted(a)
ans = int(a[0] * a[1]/2)
print(ans) | p03145 |
a,b,c = list(map(int,input().split()))
if a**2+b**2==c**2:
ans = a*b//2
elif a**2+c**2==b**2:
ans = a*c//2
else:
ans = b*c//2
print(ans) | a,b,c = list(map(int,input().split()))
print((a*b//2)) | p03145 |
a,b,c = list(map(int,input().split()))
print((a*b//2)) | a,b,c = sorted(map(int,input().split()))
print((a*b//2)) | p03145 |
print(((lambda l:l[0]*l[1]//2)(sorted(list(map(int,input().split())))))) | print(((lambda l:l[0]*l[1]//2)(list(map(int,input().split())))))
| p03145 |
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digi... | えーびー,びーしー,_ = list(map(int,input().split()))
めんせき =えーびー*びーしー//2
print(めんせき) | p03145 |
X = list(map(int,input().split()))
X.sort()
print((X[0]*X[1]//2))
| AB,BC,CA = list(map(int,input().split()))
print((AB*BC//2)) | p03145 |
def main():
a, b, c = (int(i) for i in input().split())
from math import sqrt
s = (a + b + c) / 2
print((int(sqrt(s*(s-a)*(s-b)*(s-c)))))
if __name__ == '__main__':
main()
| def main():
a, b, c = (int(i) for i in input().split())
print((a*b//2))
if __name__ == '__main__':
main()
| p03145 |
# -*- coding: utf-8 -*-
a, b, c = list(map(int, input().split()))
print((int(a*b/2)))
| A, B, C = list(map(int, input().split()))
print(((A * B) // 2))
| p03145 |
a = list(map(int,input().split()))
a.sort()
print((int(a[0]*a[1]/2))) | l = list(map(int,input().split()))
l.sort()
print((int(l[0]*l[1]/2))) | p03145 |
# coding: utf-8
from sys import stdin
AB,BC,AC = list(map(int, stdin.readline().rstrip().split()))
print((int(AB*BC/2))) | # coding: utf-8
AB,BC,AC = list(map(int, input().split()))
print((AB*BC//2)) | p03145 |
AB, BC, CA = list(map(int, input().split()))
print((AB * BC//2)) | A, B, C = list(map(int, input().split()))
print((A * B // 2)) | p03145 |
A, B, C =list(map(int,input().split()))
print(((A*B)//2)) | a,b,c = list(map(int,input().split()))
print((int((1/2)*a*b))) | p03145 |
a,b,c = list(map(int,input().split()))
print((int(a*b/2))) | a,b,c = list(map(int,input().split()))
print((a*b//2)) | p03145 |
a,b,c = list(map(int,input().split()))
print(((a*b)//2)) | L = sorted(list(map(int,input().split())))
print(((L[0]*L[1])//2))
| p03145 |
import itertools
import math
import fractions
import functools
import copy
ab, bc, ca = list(map(int, input().split()))
print((ab*bc//2)) | def main():
# n = int(input())
a, b, c = list(map(int, input().split()))
# h = list(map(int, input().split()))
# s = input()
print((a*b//2))
if __name__ == '__main__':
main()
| p03145 |
AB,BC,CA = list(map(int,input().split()))
print((AB*BC//2)) | a,b,c=list(map(int,input().split()))
print((a*b//2)) | p03145 |
a, b, c = list(map(int, input().split()))
print((int(a*b/2))) | a, b, c = list(map(int, input().split()))
ans = a * b // 2
print(ans)
| p03145 |
a,b,c = list(map(int, input().split()))
print((a*b//2)) | AB,BC,CA = list(map(int,input().split()))
print((AB*BC//2)) | p03145 |
a,b,c=list(map(int,input().split()))
s=int((a*b)/2)
print(s) | a,b,c=list(map(int,input().split()))
print((int(a*b/2))) | p03145 |
A, B, C = sorted(map(int,input().split()))
print((int((A*B)/2))) | A, B, C = list(map(int,input().split()))
print((A*B//2)) | p03145 |
a, b, c = list(map(int,input().split()))
print(((a*b)//2)) | def ans():
A, B, C = list(map(int,input().split()))
print(((A*B)//2))
ans() | p03145 |
import math
V = [int(n) for n in input().split()]
s = sum(V) / 2
A = math.sqrt(s*(s-V[0])*(s-V[1])*(s-V[2]))
print((int(A))) | a, b, c = list(map(int, input().split()))
print((a * b // 2))
| p03145 |
a = list(map(int,input().split()))
a.sort()
print((a[0]*a[1]//2)) | R= list(map(int,input().split()))
R.sort()
print((R[0] * R[1] // 2))
| p03145 |
a, b, c = list(map(int, input().split()))
print((int(a * b * 0.5))) | a, b, c = list(map(int, input().split()))
print((a * b // 2)) | p03145 |
ab,bc,ca=input().split()
ab,bc,ca=int(ab),int(bc),int(ca)
print((ab*bc//2))
| a,b,_=list(map(int,input().split()))
print((a*b//2)) | p03145 |
import math
a,b,c=sorted(map(int,input().split()))
print((math.floor(a*b/2))) | x, y, z = sorted(map(int, input().split()))
print(((x * y) // 2)) | p03145 |
import sys
from collections import defaultdict as dd
from collections import deque as dq
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
if K >= N - 1:
print((int(a[0] != 1)))
exit(0)
res = 0
if a[0] != 1:
a[0] = 1
... | import sys
from collections import defaultdict as dd
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
if K >= N - 1:
print((int(a[0] != 1)))
exit(0)
res = 0
if a[0] != 1:
a[0] = 1
res += 1
e = dd(set)
inc = [0] * (... | p04008 |
from heapq import heappop,heappush
n,k = list(map(int,input().split()))
a = [0] + list(map(int,input().split()))
ans = 0
if(a[1] != 1):
ans += 1
links_c = [set() for _ in range(n+1)]
for i,ai in enumerate(a[2:],2):
links_c[ai].add(i)
depth = [-1] * (n+1)
depth[1] = 0
stack = [1]
hq = []
whi... | n,k = list(map(int,input().split()))
a = [0] + list(map(int,input().split()))
ans = 0
if(a[1] != 1):
ans += 1
links_c = [set() for _ in range(n+1)]
for i,ai in enumerate(a[2:],2):
links_c[ai].add(i)
depth = [-1] * (n+1)
depth[1] = 0
stack = [1]
ts = [(0,1)]
while(stack):
next = []
wh... | p04008 |
import sys
sys.setrecursionlimit(200000)
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
ans = 0
if a[0] != 1:
a[0] = 1
ans += 1
b = [[]for i in range(n)]
for i in range(n):
b[a[i]-1].append(i)
b[0].remove(0)
huka = 0
kyo = [float("inf")] * n
z =[[]for i in range(n)]
def dfs... | import sys
sys.setrecursionlimit(200000)
n,k = list(map(int,input().split()))
a = list(map(int,input().split()))
ans = 0
if a[0] != 1:
a[0] = 1
ans += 1
b = [[]for i in range(n)]
for i in range(1,n):
b[a[i]-1].append(i)
huka = 0
kyo = [float("inf")] * n
z =[[]for i in range(n)]
def dfs(x,y):
kyo[... | p04008 |
def DFS(graph,root,parent):
dist = [-1]*(n+1)
dist[root] = 0
stack = [root]
while stack:
x = stack.pop()
for y in graph[x]:
if dist[y] == -1:
parent[y] = x
dist[y] = dist[x]+1
stack.append(y)
return dist
#親のリスト、頂点v、kが与えられたときに「vのk個上の祖先」を見る
class Doubling:
... | def DFS(graph,root,parent):
dist = [-1]*(n+1)
dist[root] = 0
stack = [root]
while stack:
x = stack.pop()
for y in graph[x]:
if dist[y] == -1:
parent[y] = x
dist[y] = dist[x]+1
stack.append(y)
return dist
#親のリスト、頂点v、kが与えられたときに「vのk個上の祖先」を見る
class Doubling:
... | p04008 |
# ABC135
def main():
a, b = tuple(map(int, input().rstrip().split()))
print(((a + b) // 2 if (a + b) % 2 == 0 else "IMPOSSIBLE"))
if __name__ == "__main__":
main() | # ABC135A - Harmony
def main():
A, B = list(map(int, input().split()))
flg = (A + B) % 2 == 0
print(((A + B) // 2 if flg else "IMPOSSIBLE"))
if __name__ == "__main__":
main() | p02957 |
a, b = list(map(int, input().split()))
k = ( a + b )
if k%2 == 0:
print((k//2))
else:
print('IMPOSSIBLE') | a, b = list(map(int, input().split()))
if (a**2 - b**2) % (2 * (a - b)) == 0:
print(((a**2 - b**2) // (2 * (a - b))))
else:
print('IMPOSSIBLE')
| p02957 |
ab = input().split()
A, B = int(ab[0]), int(ab[1])
if A == B:
print((1))
elif A % 2 != B % 2:
print("IMPOSSIBLE")
else:
K = (A+B) // 2
if abs(A-K) == abs(B-K):
print(K)
else:
print("IMPOSSIBLE") | ab = input().split()
A, B = int(ab[0]), int(ab[1])
out = None
if A == B:
out = None
elif A % 2 != B % 2:
out = "IMPOSSIBLE"
else:
K = (A+B) // 2
if abs(A-K) == abs(B-K):
out = K
else:
out = "IMPOSSIBLE"
print(out) | p02957 |
a,b=list(map(int,input().split()))
if (a+b)%2==0:
print(((a+b)//2))
else:
print("IMPOSSIBLE")
| a,b=list(map(int,input().split()))
if (a+b)%2!=0:
print("IMPOSSIBLE")
else:
print(((a+b)//2))
| p02957 |
a, b = list(map(int, input().split()))
if abs(b - a) % 2:
print('IMPOSSIBLE')
else:
print((abs(b - a) // 2 + min(a, b))) | a, b = list(map(int, input().split()))
if (a - b) % 2 == 0:
print(((a + b) // 2))
else:
print('IMPOSSIBLE')
| p02957 |
a, b = list(map(int, input().split()))
if (a - b) % 2 == 0:
print(((a + b) // 2))
else:
print("IMPOSSIBLE") | a, b = list(map(int, input().split()))
print(((a+b)// 2 if (a+b)% 2 == 0 else "IMPOSSIBLE")) | p02957 |
a,b = list(map(int,input().split()))
if a%2==0 and b%2!=0:
print("IMPOSSIBLE")
elif a%2!=0 and b%2==0:
print("IMPOSSIBLE")
else:
print((int(((a+b)/2)))) | a,b = list(map(int,input().split()))
if (a%2) != (b%2):
print("IMPOSSIBLE")
else:
print((int(((a+b)/2))))
| p02957 |
A,B = list(map(int, input().split()))
a=(A+B)
if (a)%2==1:
print('IMPOSSIBLE')
else:
print((str(int(a/2)))) | A,B = list(map(int, input().split()))
if (A+B)%2==1:
print('IMPOSSIBLE')
else:
print((int((A+B)/2))) | p02957 |
#ABC135A - Harmony
A, B = list(map(int,input().split()))
if (max(A,B) - min(A,B)) % 2 == 1:
print("IMPOSSIBLE")
else:
print(((A+B)//2)) | #ABC135A - Harmony
A, B = list(map(int,input().split()))
if (A+B) % 2 == 1:
print("IMPOSSIBLE")
else:
print(((A+B)//2)) | p02957 |
a,b=list(map(int,input().split()))
k=(a+b)/2
if int(k)<(a+b)/2:
print('IMPOSSIBLE')
else:
print((int(k))) | A, B = list(map(int, input().split()))
print(((A+B)//2 if (A+B) % 2 == 0 else "IMPOSSIBLE")) | p02957 |
s=eval(input().replace(" ","+"))
print((s//2 if s%2==0 else "IMPOSSIBLE")) | A, B = list(map(int, input().split()))
print(((A+B)//2 if (A+B) % 2 == 0 else "IMPOSSIBLE")) | p02957 |
# coding: utf-8
# Your code here!
A,B=input().split()
A=int(A)
B=int(B)
def abs(x):
if x>=0:
return x
else:
return -x
if abs(A-B)%2==0:
print((min(A,B)+int(abs(A-B)/2)))
else:
print('IMPOSSIBLE') | A, B = list(map(int, input().split()))
if (A + B) % 2 == 0:
K = (A + B) // 2
print(K)
else:
print('IMPOSSIBLE') | p02957 |
A,B = list(map(int,input().split()))
if (A+B)%2==0:
print(((A+B)//2))
else:
print("IMPOSSIBLE") | A,B = list(map(int,input().split()))
if A>B:
A,B = B,A
if (B-A)%2==0:
print(((B+A)//2))
else:
print("IMPOSSIBLE") | p02957 |
a, b = list(map(int, input().split()))
large = max(a, b)
ans = 0
for i in range((a+b)//2, large):
if abs(a - i) == abs(b - i):
ans = i
break
if ans == 0:
print("IMPOSSIBLE")
else:
print(ans)
| a, b = list(map(int, input().split()))
large = max(a, b)
ans = ((a + b) / 2)
if ans.is_integer():
print((int(ans)))
else:
print("IMPOSSIBLE")
| p02957 |
a=eval(input().replace(' ','+'));print((a%2*'IMPOSSIBLE'or a//2)) | a=eval(input().replace(*' +'))
print((a%2*'IMPOSSIBLE'or a//2)) | p02957 |
a, b = list(map(int, input().split()))
if (a+b) % 2 == 0:
print(((a + b) // 2))
else:
print("IMPOSSIBLE") | a, b = list(map(int, input().split()))
if abs(a-b) % 2 == 0:
print(((a+b)//2))
else:
print("IMPOSSIBLE") | p02957 |
A, B = list(map(int, input().split()))
if (A+B) % 2 == 0:
print(((A+B)//2))
else:
print("IMPOSSIBLE")
| def LI():
return list(map(int, input().split()))
A, B = LI()
if (A+B) % 2 == 0:
ans = (A+B)//2
else:
ans = "IMPOSSIBLE"
print(ans)
| p02957 |
A,B=list(map(int, input().split()))
print(((A+B)//2 if (A+B)&1==0 else 'IMPOSSIBLE')) | A, B = list(map(int, input().split()))
if A > B: A, B = B, A
if (B - A) & 1:
print('IMPOSSIBLE')
exit()
print((A + (B - A) // 2))
| p02957 |
A, B = list(map(int, input().split()))
if (A+B) % 2:
print('IMPOSSIBLE')
else:
print(((A+B)//2)) | a=eval(input().replace(' ','+'));print((a%2*'IMPOSSIBLE'or a//2)) | p02957 |
a, b = list(map(int, input().split()))
if (a+b)%2 != 0:
print("IMPOSSIBLE")
else:
print(((a+b)//2)) | a, b = list(map(int, input().split()))
if (a+b)%2 != 0:
print("IMPOSSIBLE")
else:
print((int((a+b)/2))) | p02957 |
from functools import reduce
n, _, c = list(map(int, input().split()))
bs = tuple(map(int, input().split()))
count = 0
for i in range(n):
if reduce(
lambda x, y: x + y[0] * y[1],
list(zip(bs, list(map(int, input().split())))),
0,
) + c > 0:
count += 1
print(count... | n, _, c = list(map(int, input().split()))
bs = tuple(map(int, input().split()))
count = 0
for _ in range(n):
if sum(x * bs[i] for i, x in enumerate(map(int, input().split()))) + c > 0:
count += 1
print(count)
| p03102 |
n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for _ in range(n):
a = list(map(int, input().split()))
t = 0
for i in range(m):
t += a[i]*b[i]
if (t + c) > 0:
ans += 1
print(ans)
| # ソースコードの正答を判定する。
n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for _ in range(n):
a = list(map(int, input().split()))
t = 0
for i in range(m):
t += a[i]*b[i]
if (t + c) > 0:
ans += 1
print(ans)
| p03102 |
n,m,c = list(map(int,input().split()))
b = [int(_) for _ in input().split()]
a = []
ans = 0
for _ in range(n):
a.append([int(_) for _ in input().split()])
for i in range(n):
sum = 0
for j in range(m):
sum += a[i][j] * b[j]
if sum + c > 0:
ans += 1
else:
pass
pri... | n,m,c = list(map(int,input().split()))
b = [int(_) for _ in input().split()]
ans = 0
for _ in range(n):
a = [int(_) for _ in input().split()]
sum = 0
for j in range(m):
sum += a[j] * b[j]
if sum + c > 0:
ans += 1
print(ans) | p03102 |
n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0
for i in range(n):
a = list(map(int, input().split()))
val = 0
for j in range(m):
val += a[j] * b[j]
val += c
if val > 0:
cnt += 1
print (cnt) | n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
res = 0
for i in range(n):
a = list(map(int, input().split()))
cnt = 0
for j in range(m):
cnt += a[j]*b[j]
cnt += c
if cnt > 0:
res += 1
print (res) | p03102 |
N, M, C = list(map(int, input().split()))
Bi = list(map(int, input().split()))
count = 0
for i in range(N):
Ai = list(map(int, input().split()))
t = C
for i in range(M):
t += Ai[i] * Bi[i]
if t > 0:
count += 1
print(count) | N, M, C = list(map(int, input().split()))
Bi = list(map(int, input().split()))
Ai = [list(map(int, input().split())) for _ in range(N)]
count = 0
for a in Ai:
s = C
for i in range(M):
s += a[i] * Bi[i]
if s > 0:
count += 1
print(count) | p03102 |
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = []
cnt = 0
for i in range(N):
A.append(list(map(int, input().split())))
for a in range (N):
tl = 0
for b in range (M):
tl += A[a][b]*B[b]
if tl+C > 0:
cnt += 1
print(cnt)
| N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = []
cnt = 0
for i in range (N):
A.append(list(map(int,input().split())))
for j in range (N):
tl = 0
for k in range (M):
tl += A[j][k]*B[k]
if tl + C > 0:
cnt += 1
print(cnt) | p03102 |
n,m,c = list(map(int,input().split()))
b = [int(i) for i in input().split()]
ans = 0
for i in range(n):
a = [int(i) for i in input().split()]
sum = c
for i in range(m):sum+=b[i] * a[i]
ans+=sum > 0
print(ans) | n,m,c=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(n):
a=list(map(int,input().split()))
sum=c
for j in range(m):sum+=a[j]*b[j]
if sum>0:ans+=1
print(ans) | p03102 |
n,m,c = list(map(int,input().split()))
b = list(map(int,input().split()))
a = [(list(map(int,input().split()))) for i in range(n)]
t = 0
for i in range(n):
z = 0
for j in range(m):
z += a[i][j] * b[j]
z += c
if z > 0:
t += 1
print(t) | n,m,c = list(map(int,input().split()))
b = list(map(int,input().split()))
a = [(list(map(int,input().split()))) for i in range(n)]
ans = 0
for i in range(n):
z = c
for j in range(m):
z += a[i][j] * b[j]
if z > 0:
ans += 1
print(ans) | p03102 |
import sys
input = sys.stdin.readline
def main():
ans = 0
n,m,c = list(map(int, input().split()))
b = list(map(int, input().split()))
for _ in range(n):
temp = 0
a = list(map(int, input().split()))
for j in range(m):
temp += a[j]*b[j]
if temp + ... | import sys
input = sys.stdin.readline
def main():
ans = 0
n,m,c = list(map(int, input().split()))
b = list(map(int, input().split()))
for _ in range(n):
temp = c
a = list(map(int, input().split()))
for j in range(m):
temp += a[j]*b[j]
if temp > ... | p03102 |
N,M,C=list(map(int,input().split()))
B=list(map(int,input().split()))
A=[list(map(int,input().split())) for _ in range(N)]
cnt=0
for i in range(N):
ans=0
for j in range(M):
ans += B[j]*A[i][j]
if ans+C>0:
cnt+=1
print(cnt) | N,M,C=list(map(int,input().split()))
B=list(map(int,input().split()))
cnt=0
for i in range(N):
am=0
A=list(map(int,input().split()))
for j in range(M):
am+=B[j]*A[j]
if am+C>0:
cnt+=1
print(cnt) | p03102 |
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(N)]
ct = 0
for i in A:
if sum([j * k for j, k in zip(i, B)]) + C > 0:
ct += 1
print(ct)
| N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
ct = 0
for i in range(N):
if sum([j * k for j, k in zip(list(map(int, input().split())), B)]) + C > 0:
ct += 1
print(ct)
| p03102 |
import copy
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
As = []
for i in range(N):
As.append(list(map(int, input().split())))
correct_answer_num = 0
for A in As:
result = 0
for j in range(M):
result += A[j] * B[j]
result += C
if result > ... | N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
As = []
for i in range(N):
As.append(list(map(int, input().split())))
correct_answer_num = 0
for A in As:
result = 0
for j in range(M):
result += A[j] * B[j]
result += C
if result > 0:
cor... | p03102 |
N, M, C = list(map(int, input().split()))
blist = list(map(int, input().split()))
alist = [list(map(int, input().split())) for _ in range(N)]
res = 0
for i in range(N):
sum = 0
for j in range(M):
sum += alist[i][j] * blist[j]
if sum + C > 0:
res += 1
print(res) | N, M, C = list(map(int, input().split()))
blist = list(map(int, input().split()))
alist = [list(map(int, input().split())) for _ in range(N)]
print((sum([1 if sum(t[0]*t[1] for t in zip(alist[i], blist)) + C > 0 else 0 for i in range(N)]))) | p03102 |
n,m,c=list(map(int,input().split()))
B=list(map(int,input().split()))
A=[list(map(int,input().split()))for i in range(n)]
cnt=0
for i in range(n):
total=0
for j in range(m):
total+=B[j]*A[i][j]
total+=c
if 0<total:
cnt+=1
print(cnt) | N,M,C=list(map(int,input().split()))
B=list(map(int,input().split()))
A =[list(map(int,input().split()))for i in range(N)]
ans=0
for i in range(N):
X=0
for j in range(M):
X += A[i][j]*B[j]
X += C
if 0 < X:
ans += 1
print(ans)
| p03102 |
N,M,C=list(map(int,input().split()))
B=list(map(int,input().split()))
A =[list(map(int,input().split()))for i in range(N)]
ans=0
for i in range(N):
X=0
for j in range(M):
X+=(A[i][j]*B[j])
X=X+C
if 0 < X:
ans = ans+1
print(ans)
| n, m, c = list(map(int, input().split()))
blst = list(map(int, input().split()))
cnt = 0
for i in range(n):
judge = 0
alst = list(map(int, input().split()))
for j, k in zip(alst, blst):
judge += j * k
if judge + c > 0:
cnt += 1
print(cnt) | p03102 |
N, M, C = list(map(int, input().split()))
*B, = list(map(int, input().split()))
A = [tuple(map(int, input().split())) for _ in range(N)]
count = 0
for a in A:
j = 0
for ta, b in zip(a, B):
j += ta * b
if 0 < j + C:
count += 1
print(count)
| N, M, C = list(map(int, input().split()))
*B, = list(map(int, input().split()))
count = 0
for _ in range(N):
count += (0 < sum(x * y for x, y in zip(tuple(map(int, input().split())), B)) + C)
print(count)
| p03102 |
lx = list(map(int,input().split(" ")))
lb = list(map(int,input().split(" ")))
#la = [li[0]][li[1]]
la = []
cnt = 0
for i in range(0, lx[0]):
tmp = lx[2]
la.append(list(map(int,input().split(" "))))
for j in range(0, lx[1]):
tmp += la[i][j] * lb[j]
if (tmp > 0):
cnt += 1
p... | n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
#la = [li[0]][li[1]]
cnt = 0
for i in range(n):
a = list(map(int, input().split()))
tmp = c
for j in range(0, m):
tmp += a[j] * b[j]
if (tmp > 0):
cnt += 1
print(cnt) | p03102 |
N, M, C = list(map(int, input().split()))
Blis = [int(x) for x in input().split()]
k = 0
for i in range(N):
Alis = [int(x) for x in input().split()]
total = 0
for j in range(M):
total = total + (Alis[j])*(Blis[j])
total = total + C
if total > 0:
k = k + 1
print(k) | N, M, C = list(map(int, input().split()))
Blis = [int(x) for x in input().split()]
Alis = [x for x in range(N)]
k = 0
for i in range(N):
Alis[i] = [int(x) for x in input().split()]
for i in range(N):
total = 0
for j in range(M):
total = total + (Alis[i][j])*(Blis[j])
total = total + C
if total ... | p03102 |
N,M,C = list(map(int,input().split()))
Blist = list(map(int,input().split()))
Alist = [list(map(int,input().split())) for i in range(N)]
counter = 0
for x in range(N):
all = C
xlist = Alist[x]
for j in range(M):
all += Blist[j]*xlist[j]
if all>0:
counter += 1
print(count... | N, M, C = list(map(int, input().split()))
Blist = list(map(int, input().split()))
ans = 0
for i in range(N):
score = C
Alist = list(map(int, input().split()))
for j in range(M):
score += Alist[j]*Blist[j]
if score > 0:
ans += 1
print(ans) | p03102 |
n, m, c = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(n):
A = list(map(int, input().split()))
s = c
for a, b in zip(A, B): s += a*b
if s > 0: ans += 1
print(ans)
| n, m, c = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(n):
A = list(map(int, input().split()))
s = c + sum([a*b for a, b in zip(A, B)])
if s > 0: ans += 1
print(ans)
| p03102 |
n,m,c=list(map(int,input().split()))
b=list(map(int,input().split()))
a=[[0] * m for _ in range(n)]
for i in range(n):
a[i]=list(map(int,input().split()))
count=0
for i in range(n):
# print(sum(list(map(lambda a,b:a*b,a[i],b))))
if sum(list(map(lambda a,b:a*b,a[i],b)))+c > 0:
count+=1
... | N,M,C=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for i in range(N):
A=list(map(int,input().split()))
if sum(a*b for a,b in zip(A,B))+C>0:count+=1
print(count) | p03102 |
N,M,C = list(map(int, input().split()))
B = list(map(int, input().split()))
cnt = 0
for _ in range(N):
A = list(map(int, input().split()))
sums = sum([A[i]*B[i] for i in range(M)])+C
if sums > 0:
cnt += 1
print(cnt) | n, m, c = list(map(int, input().split()))
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
cnt = 0
for i in a:
if sum([j * k for j, k in zip(i, b)]) + c > 0:
cnt += 1
print(cnt) | p03102 |
N,M,C = list(map(int,input().split()))
B_ = list(map(int,input().split()))
A_ = [list(map(int,input().split())) for i in range(N)]
ans = 0
for i in range(N):
sum_n = 0
for j in range(M):
sum_n += A_[i][j]*B_[j]
if sum_n+C > 0:
ans += 1
print(ans) | N,M,C = list(map(int,input().split()))
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]
count = 0
for n in range(N):
cost = 0
for m in range(M):
cost += A[n][m]*B[m]
if cost + C > 0:
count += 1
print(count) | p03102 |
N, M, C = list(map(int,input().split()))
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]
cnt = 0
for a in A:
tmp = C
for i in range(M):
tmp += a[i]*B[i]
if(tmp > 0):
cnt += 1
print(cnt) | N, M, C = list(map(int,input().split()))
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]
ans = 0
for a in A:
tmp = C
for j in range(M):
tmp += a[j]*B[j]
if tmp > 0:
ans += 1
print(ans) | p03102 |
N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [0]*N
count = 0
def a_x_b(ab):
a, b = ab
return a*b
for n in range(N):
A[n] = list(map(int, input().split()))
AB = [(A[n][i], B[i]) for i in range(M)]
if sum(list(map(a_x_b, AB)))+C > 0:
count += 1
else:
... | N, M, C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = [0]*N
count = 0
for n in range(N):
A[n] = list(map(int, input().split()))
_sum = 0
for i in range(M):
_sum += A[n][i] * B[i]
if _sum + C > 0:
count += 1
else:
continue
print(count)
| p03102 |
N,M,C=list(map(int,input().split()))
B=list(map(int,input().split()))
count=0
for i in range(N):
A=list(map(int,input().split()))
p=C
for j in range(M):p+=A[j]*B[j]
if p>0:count+=1
print(count) | n,m,c = list(map(int,input().split()))
b=list(map(int,input().split()))
a=[list(map(int,input().split())) for _ in range(n)]
count=0
t=c
for i in range(n):
for j in range(m):
t += a[i][j]*b[j]
if t > 0:
count += 1
t=c
print(count)
| p03102 |
N,M,C = list(map(int,input().split()))
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]
ans = 0
for i in range(N):
res = C
for j in range(M):
res += A[i][j]*B[j]
if res > 0:
ans += 1
print(ans) | N, M, C = list(map(int,input().split()))
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]
ans = 0
for i in range(N):
res = C
for j in range(M):
res += B[j] * A[i][j]
if res > 0:
ans += 1
print(ans) | p03102 |
import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline
n=int(eval(input()))
s=input().strip()
memo={}
def getans(a,b,c):
while a and c and a[0]==c[-1]:
a=a[1:]
c=c[:-1]
if b=="":
if a=="" and c=="": return 1
else: return 0
key=a+"/"+b+"/"+c
if... |
import sys
#sys.stdin=open("data.txt")
input=sys.stdin.readline
n=int(eval(input()))
s=input().strip()
memo={}
def getans(a,b,c):
while a and c and a[0]==c[-1]:
a=a[1:]
c=c[:-1]
if a and c: return 0
if b=="":
if a=="" and c=="": return 1
else: return 0
... | p03298 |
import sys
input = sys.stdin.readline
from collections import defaultdict
def main():
n = int(eval(input()))
s = input().strip()
pc = defaultdict(lambda: 0)
for i in range(pow(2, n)):
rd = ""
bl = ""
for b in range(n):
if (i // pow(2, b))%2 == 1:
rd += s[b]
else:
... | import sys
input = sys.stdin.readline
sys.setrecursionlimit(pow(10, 6))
from collections import defaultdict
def main():
n = int(eval(input()))
s = input().strip()
tmp = defaultdict(lambda : 0)
for state in range(1 << n):
rs, bs = "", ""
for i in range(n):
if ... | p03298 |
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LS2(): return list(sys.stdin.readline().rstrip()) #空白なし
N = I()
S = LS2()
# 左N個のマスをどう塗るかで半分全列挙
ans = 0
left = []
right = []
for i in range(2**N):
red = []
blue = []
for j in range(N):
if (i >> j) & 1:
... | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip())) #空白なし
def ... | p03298 |
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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()... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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()... | p03298 |
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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()... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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()... | p03298 |
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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()... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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()... | p03298 |
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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()... | #!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
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()... | p03298 |
n, m = list(map(int, input().split()))
ab = []
for _ in range(n):
a, b = list(map(int, input().split()))
ab.extend([a for _ in range(b)])
ab.sort()
print((sum(ab[:m]))) | n,m,*t = list(map(int, open(0).read().split()))
ans = 0
for a, b in sorted(zip(t[::2], t[1::2])):
ans += min(b, m)*a
m -= b
if m <= 0:
print(ans)
break | p03103 |
def main():
n, m = list(map(int, input().split()))
answer = 0
cost = [list(map(int, input().split())) for _ in range(n)]
cost.sort(key=lambda x: x[0])
for c, num in cost:
if m < 0:
break
answer += c * min(m, num)
m -= min(m, num)
print(answer)
i... | def main():
n, m = list(map(int, input().split()))
info = []
for _ in range(n):
info.append(list(map(int, input().split())))
info.sort(key=lambda x: x[0])
answer = 0
for a, b in info:
if m <= 0:
break
answer += a * min(b, m)
m -= min(b, m)
... | p03103 |
n,m=list(map(int,input().split()))
ab=[list(map(int,input().split())) for _ in range(n)]
sorted_ab=sorted(ab, key=lambda x: x[0])
ans=0
i=0
for a, b in sorted_ab:
for _ in range(b):
if i < m:
ans+=a
i+=1
print(ans) | n,m=list(map(int,input().split()))
ab=[list(map(int,input().split())) for _ in range(n)]
sorted_ab=sorted(ab, key=lambda x: x[0])
ans=0
i=0
for a, b in sorted_ab:
for _ in range(b):
if i < m:
ans+=a
i+=1
else:
break
print(ans) | p03103 |
#float型を許すな
#numpyはpythonで
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 h... | #float型を許すな
#numpyはpythonで
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 h... | p03103 |
from functools import reduce
N, M = list(map(int,input().split()))
ary1 =[]
for x in range(N):
ary1.append(list(map(int,input().split())))
ary2 = sorted(ary1)
print((sum(reduce(lambda a,b: a+b ,[[x[0]]*x[1] for x in ary2])[0:M])))
| from functools import reduce
N, M = list(map(int,input().split()))
ary1 =[]
for x in range(N):
ary1.append(list(map(int,input().split())))
ary2 = sorted(ary1)
count = 0
total_sum = 0
for i in range(N):
if count + ary2[i][1] <= M:
total_sum += ary2[i][0] * ary2[i][1]
count += ary2[i][1]
elif ... | p03103 |
from sys import stdin
def a(input_string):
N, M = [int(x) for x in input_string[0].split()]
C = input_string[1:]
temp = [string.split() for string in C]
D = []
for i in range(len(temp)):
D.append([int(word) for word in temp[i]])
#print(D)
get_count = 0
min_cost = 10... | from sys import stdin
def a(input_string):
N, M = [int(x) for x in input_string[0].split()]
C = input_string[1:]
temp = [string.split() for string in C]
D = []
for i in range(len(temp)):
D.append([int(word) for word in temp[i]])
#print(D)
get_count = 0
min_cost = 10... | p03103 |
N,M=list(map(int,input().split()))
AB=list(list(map(int,input().split())) for _ in range(N))
AB.sort(key=lambda x:x[0])
cost=0
for ab in AB:
for i in range(ab[1]):
if M>0:
M-=1
cost+=ab[0]
print(cost) | N,M=list(map(int,input().split()))
AB=list(list(map(int,input().split())) for _ in range(N))
AB.sort(key=lambda x:x[0])
cost=0
for ab in AB:
if M>=ab[1]:
M-=ab[1]
cost+=ab[0]*ab[1]
else:
cost+=ab[0]*M
break
print(cost) | p03103 |
from collections import deque
N, M = list(map(int, input().split()))
A = [0]*N
B = [0]*N
for i in range(N):
A[i], B[i] = list(map(int, input().split()))
C = deque()
while len(C) < M:
for j in range(B[A.index(min(A))]):
if len(C) < M:
C.append(min(A))
else:
... | import sys
from collections import deque
from operator import itemgetter
input = sys.stdin.readline
N, M = list(map(int, input().split()))
A = deque()
for i in range(N):
A.append(list(map(int, input().split())))
A = sorted(A, key=itemgetter(0))
m=0
cost=0
for i in range(N):
if m >= M:
... | p03103 |
n, m = list(map(int, input().split()))
x = [[int(j) for j in input().split()] for i in range(n)]
a = []
b = []
for i in range(n):
a.append(x[i][0])
b.append(x[i][1])
mon = 0
cnt = 0
ind = 100000
while(cnt < m):
min = 10000000000
for i in range(n):
if a[i] < min:
min = a[i]
ind = i... | import math
n, m = list(map(int, input().split()))
a = []
for i in range(n):
l = list(map(int, input().split()))
a.append(l)
a.sort(key=lambda x: x[0])
sum = 0
cnt = 0
for i in range(n):
if cnt + a[i][1] >= m:
sum += (m-cnt)*a[i][0]
cnt += m-cnt
break
else:
... | p03103 |
n,m=list(map(int,input().split()))
xy=[]
for i in range(n):
a,b=list(map(int,input().split()))
xy.append((a,b))
xy=sorted(xy)
ans=0
for p,c in xy:
if m>=c:
ans+=p*c
m-=c
else:
ans+=p*m
m=0
break
print(ans)
| n, m = list(map(int,input().split()))
drinks = []
for i in range(n):
a,b= list(map(int,input().split()))
drinks.append((a,b))
drinks.sort()
ans = 0
for x,y in drinks:
if y < m:
ans += x*y
m -= y
else:
ans += x*m
break
print(ans) | p03103 |
N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(N)]
X.sort()
ans = 0
res = M
for v in X:
ans += v[0] * min(v[1], res)
res -= v[1]
if res <= 0:
break
print(ans)
|
N, M = list(map(int, input().split()))
X = [list(map(int, input().split())) for _ in range(N)]
X.sort()
res = M
ans = 0
for a, b in X:
if res <= 0:
break
tmp = min(b, res)
res -= tmp
ans += tmp * a
print(ans)
| p03103 |
n, m = list(map(int, input().split()))
a, b = [0]*n, [0]*n
for i in range(n):
a[i], b[i] = list(map(int, input().split()))
flag = 1
while flag:
flag = 0
for j in range(n-1):
if a[j] > a[j+1]:
tmp = a[j]
a[j] = a[j+1]
a[j+1] = tmp
res = b[... | n, m = list(map(int, input().split()))
a = [0]*n
for i in range(n):
a[i] = list(map(int, input().split()))
a.sort(key=lambda x: x[0])
ans = 0
for i in range(n):
if m > a[i][1]:
ans += a[i][0]*a[i][1]
m -= a[i][1]
else:
ans += m*a[i][0]
break
print(ans) | p03103 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.