s_id stringlengths 10 10 | p_id stringlengths 6 6 | u_id stringlengths 10 10 | date stringlengths 10 10 | language stringclasses 1
value | original_language stringclasses 11
values | filename_ext stringclasses 1
value | status stringclasses 1
value | cpu_time stringlengths 1 5 | memory stringlengths 1 7 | code_size stringlengths 1 6 | code stringlengths 1 539k |
|---|---|---|---|---|---|---|---|---|---|---|---|
s969986899 | p03583 | u513900925 | 1555812419 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 285 | N = int(input())
S = input()
onlyb = 0
onlyw = 0
twotn = 0
flag = 0
ch =0
for i in range(N):
if S[i] == ".":
onlyb += 1
ch = 0
if flag != 0:
twotn +=1
else:
onlyw += 1
ch +=1
flag = 1
print(min(onlyb,onlyw-ch,twotn)) |
s151301684 | p03583 | u770077083 | 1555102447 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3060 | 260 | from math import floor
import sys
ns = int(input())
for h in range(1, 3501):
for n in range(h, 3501):
w = float(ns / (4 - ns / h - ns / n) )
if(w.is_integer() and w > 0):
print("{} {} {}".format(h, n, int(w)))
exit() |
s191452587 | p03583 | u770077083 | 1555101699 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 290 | from math import floor
ns = int(input())
start = floor(ns / 4)
if(start == 0): start = 1
for h in range(start, 3501):
for n in range(h, 3501):
w = float(ns / (4 - ns / h - ns / n) )
if(w.is_integer() and w > 0):
print(f"{h} {n} {int(w)}")
exit() |
s919250299 | p03583 | u813102292 | 1554690228 | Python | Python (3.4.3) | py | Runtime Error | 2107 | 3060 | 256 | N = int(input())
try:
for h in range(1,3501):
for n in range(1,3501):
w1 = (N*h*n)//(4*h*n-N*(h+n))
w2 = (N*h*n)/(4*h*n-N*(h+n))
if w1==w2:
raise(Exception)
except Exception:
print(h,n,w1) |
s491190366 | p03583 | u813102292 | 1554689722 | Python | Python (3.4.3) | py | Runtime Error | 19 | 2940 | 156 | N = int(input())
h = N
n = max(N//3,1)
w = 1
while True:
if (N*n)//(3*n-N) == (N*n)/(3*n-N):
print(h,n,(N*n)//(3*n-N))
break
n += 1
|
s920521650 | p03583 | u371763408 | 1554689411 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 166 | N=int(input())
ans=4/n
for h in range(1,3501):
for n in range(1,3501):
tmp=4*h*n-N*h-N*n
if tmp>0 and N*h*n%tmp==0:
print(h,n,N*h*n//tmp)
exit() |
s122761336 | p03583 | u151625340 | 1554689197 | Python | PyPy3 (2.4.0) | py | Runtime Error | 251 | 40684 | 299 | N = int(input())
flag = True
for h in range(1,3501):
for n in range(1,3501):
if flag and (N*n*h) % (4*h*n-N*(n+h)) == 0:
print(str(h)+' '+str(N*n*h // (4*h*n+N*(n+h)))+' '+str(n))
flag = False
if not flag:
break
if not flag:
break
|
s477768339 | p03583 | u315485238 | 1554688923 | Python | Python (3.4.3) | py | Runtime Error | 20 | 3064 | 240 | N=int(input())
for h in range(N//4, min(3501, 3*N//4 +1)):
for n in range((N*h)//(4*h-N), min(3501, (2*N*h)//(4*h-N))):
x = 4*h*n - N*n - N*h
y = N*h*n
if x>0 and not y%x:
print('{} {} {}'.format(h,n,y//x))
exit() |
s095062491 | p03583 | u315485238 | 1554688672 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 261 | N=int(input())
for h in range(N//4, min(3501, 3*N//4 +1)):
for n in range((N*h)//(4*h-N), min(3501, (2*N*h)//(4*h-N))):
x = 4*h*n - N*n - N*h
y = N*h*n
if x<=0 or y%x:
continue
else:
print('{} {} {}'.format(h,n,y//x))
exit() |
s359378342 | p03583 | u844005364 | 1554687847 | Python | PyPy3 (2.4.0) | py | Runtime Error | 228 | 39152 | 266 | import sys
n = int(input())
def main():
for i in range(1, 3500):
for j in range(1, 3500):
z = n * i * j / (4 * i * j - n * i - n * j)
if z >= 1 and z == int(z):
print(i, j, z)
sys.exit()
main()
|
s449946067 | p03583 | u543954314 | 1554685726 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3060 | 217 | n = int(input())
if n%2 == 0:
print(n,n,n//2)
else:
for h in range(2,3501):
for l in range(2,3501):
w = n*h*l // (4*h*l - n*(h+l))
if 4*h*l*w == n*(h*w+h*l+l*w):
print(h,l,w)
break |
s219884253 | p03583 | u543954314 | 1553566713 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3188 | 237 | from itertools import product
n = int(input())
if n%2 == 0:
print(n,n,n//2)
else:
for h,l in product(range(2,3501),repeat=2):
m = n*h*l
c = 4*h*l - n*(h+l)
if c >= 0 and m%c == 0:
w = m//c
break
print(h,l,w) |
s800325045 | p03583 | u944209426 | 1551510579 | Python | PyPy3 (2.4.0) | py | Runtime Error | 429 | 41580 | 283 | n=int(input())
import sys
for a in range(1,3501):
for b in range(1,3501):
if (4/n-1/a-1/b)<=0:
continue
c=n*a*b/(4*a*b -n*a -n*b)
if not 0<c<=3500:
continue
if c==int(c):
print(a,b,int(c))
sys.exit() |
s476720082 | p03583 | u944209426 | 1551510369 | Python | PyPy3 (2.4.0) | py | Runtime Error | 578 | 41308 | 273 | n=int(input())
ans=[]
for a in range(1,3501):
for b in range(1,3501):
if (4/n-1/a-1/b)==0:
continue
c=1/(4/n-1/a-1/b)
if c==int(c) and c>0:
ans.append([str(a),str(b),str(int(c))])
break
print(" ".join(ans[0])) |
s689670131 | p03583 | u619819312 | 1550407400 | Python | Python (3.4.3) | py | Runtime Error | 19 | 2940 | 192 | n=int(input())
for i in range(n//4,3501):
for j in range(1,3501):
t=4*i*j-i*s-j*s
y=s*i*j
if t>0 and s*i*j%t==0:
print(s*i*j//t,i,j)
exit()
|
s956515226 | p03583 | u846041485 | 1546575259 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3060 | 363 | n = int(input())
imin = n // 4
flag = False
for i in range(imin, 3501):
jmin = i * n // (4 * i - n)
for j in range(jmin, 3501):
num = i * j * n
den = 4 * i * j - i * n - j * n
if den > 0 and num % den == 0:
k = num // den
print("{} {} {}".format(i, j, k))
... |
s848074044 | p03583 | u397531548 | 1543890761 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 214 | N=int(input())
for i in range(1,3501):
for j in range(1,3501):
aw=(N*n*h)
bw=4*n*h-N*h-N*n
if bw!=0 and bw/aw==bw//aw:
h=i
n=j
break
print(h,n,bw//aw) |
s644120998 | p03583 | u397531548 | 1543890705 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 213 | N=int(input())
for i in range(1,3501):
for j in range(1,3501):
aw=(N*n*h)
bw=4*n*h-N*h-N*n
if bw!=0 and bw/aw=bw//aw:
h=i
n=j
break
print(h,n,bw//aw) |
s381368631 | p03583 | u729133443 | 1533015801 | Python | Python (3.4.3) | py | Runtime Error | 1988 | 2940 | 144 | N=int(input())
for h in range(1,3501):
for n in range(1,3501):
w=(N*h*n)/(4*h*n-N*(n+h))
if w==int(w):
print(h,n,w)
exit() |
s944731815 | p03583 | u520158330 | 1526570746 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 397 | %%time
N = int(input())
isok=False
for h in range(1,3501):
bunsi = 4*h - N
bunbo = N*h
if bunsi>0:
n = (bunbo//bunsi) + 1
bunsi = 4*h*n - N*(h+n)
bunbo = N*h*n
if bunsi>0 and bunbo%bunsi==0:
w = bunbo//bunsi
isok = True
break
if i... |
s203732659 | p03583 | u562016607 | 1525993966 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3060 | 171 | N=int(input())
for h in range(1,3501):
for n in range(1,3501):
A=N*h*n
B=4*h*n-N*n-N*h
if B<0:
continue
if A%B==0:
print(h,n,A//B)
exit()
|
s273171157 | p03583 | u562016607 | 1525993908 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 2940 | 142 | N=int(input())
for h in range(1,3501):
for n in range(1,3501):
A=N*h*n
B=4*h*n-N*n-N*h
if A%B==0 and B>0:
print(h,n,A//B)
exit()
|
s026145948 | p03583 | u276192130 | 1522920845 | Python | Python (3.4.3) | py | Runtime Error | 1472 | 3060 | 300 | N = int(input())
if N % 2 == 0:
print(N // 2, N, N)
for h in range(1, 3500+1):
hN = h * N
for n in range(h, 3500+1):
b = (4 * h * n - n * N - hN)
if b > 0:
continue
a = (n * hN)
if a % b == 0:
print(h, n, a // b)
quit()
|
s586671505 | p03583 | u714878632 | 1507404870 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3060 | 454 | from sys import stdin
gets = stdin.readline
@profile
def main():
n = int(gets())
flag = False
for h in range(3500, 1, -1):
nh = n*h
for w in range(1, h+1):
y = (4 * h * w - nh - n*w)
if y > 0 and (nh % y == 0 or w % y == 0):
print(h, w, (nh*w)//y)
... |
s873574256 | p03583 | u045930594 | 1506868803 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3192 | 924 | import math
def is_prime(q):
if q == 2:
return (True, 0)
if q < 2:
return (False, 1)
if q&1 == 0:
return (False, 2)
i = 3
end = int(math.sqrt(q))
while i <= end:
if q%i is 0:
return (False, i)
i += 2
return (True, 0)
def split22(n, k):
... |
s439210253 | p03583 | u776189585 | 1506827932 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3064 | 1566 | N = int(input())
mx = 3501
... |
s224661434 | p03583 | u667084803 | 1506827807 | Python | Python (3.4.3) | py | Runtime Error | 1263 | 3060 | 215 | import sys
N=int(input())
if N%2==0:
print(N//2,N,N)
else:
for a in range(1,3501):
for b in range(1,a):
M=N*a*b
L=4*a*b-N*(a+b)
if M%L==0 and L>0:
print(a,b,M//L)
sys.exit() |
s242429663 | p03583 | u846372029 | 1506826398 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 173 | # 4/N
n = int(input())
for i in range(1,3501):
for j in range(1,3501):
k = (n*i*j)/(4*i*j-n*i-n*k)
if k%1==0:
print(i,j,k)
break |
s422840727 | p03583 | u293976191 | 1506825706 | Python | Python (2.7.6) | py | Runtime Error | 11 | 2568 | 383 | i = 2
while True:
cond = i * 4
all_primes = primes + prime_decomposition(i)
total = reduce(lambda x, y: x * y, all_primes)
candi_primes = [p for p in all_primes if p <= cond - 2]
r = find_result(candi_primes, cond, total)
if r is not None:
h, n, w = r
print '{} {} {}'.format(int... |
s316811479 | p03583 | u010078589 | 1506822821 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 119 | N = input()
hnw = 0.75 * N
each = hnw / 3
h = each
n = each
w = each
print(h,end="")
print(n,end="")
print(w,end="") |
s068561061 | p03583 | u408018325 | 1506821472 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 283 | def main():
N = input()
for h in range(1, 3501):
for n in range(1, 3501):
r1 = h * n * N
r2 = 4 * h * n - h * N - n * N
if r2 > 0 and r1 % r2 == 0:
print "%d %d %d" % (h, n, r1 / r2)
return
main()
|
s847306091 | p03583 | u408018325 | 1506821129 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 289 | def main():
N = input()
for h in range(1, 3501):
for n in range(1, 3501):
r1 = h * n * N
r2 = 4 * h * n - h * N - n * N
if r2 > 0 and r1 % r2 == 0:
print("{} {} {}".format(h, n, r1 // r2))
return
main()
|
s456829103 | p03583 | u810735437 | 1506820912 | Python | Python (3.4.3) | py | Runtime Error | 322 | 5676 | 820 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import re
import string
N = int(input())
def get_a(N):
a = 1
while True:
if N < 4 * a:
return a, 4*a-N, N*a
... |
s962273175 | p03583 | u243492642 | 1506820438 | Python | PyPy3 (2.4.0) | py | Runtime Error | 219 | 39536 | 623 | # coding: utf-8
def II(): return int(input())
def ILI(): return list(map(int, input().split()))
def read():
N = II()
return (N,)
def solve(N):
ans = []
for h in range(1, 3501):
flag = False
for n in range(1, 3501):
w = (N * h * n) / (4 * h * n - N * h - N * n)
... |
s621675666 | p03584 | u892487306 | 1599454372 | Python | Python (3.8.2) | py | Runtime Error | 516 | 27444 | 809 | from collections import defaultdict
def main():
N, K = map(int, input().split())
integers = [list(map(int, input().split())) for _ in range(N)]
# bitwise orの結果の候補を計算
len_bin_k = len('{:b}'.format(K))
keys = [K]
for shift in range(1, len_bin_k + 1):
if (K >> shift) & 1 == 1:
... |
s556150650 | p03584 | u490642448 | 1598513303 | Python | PyPy3 (7.3.0) | py | Runtime Error | 94 | 74696 | 340 | n,k = map(int,readline().split())
ab = list(map(int,read().split()))
target = [k]
for i in range(1,30):
if((k>>i)&1):
target.append(( k-(1<<i)) | ((1<<i)-1) )
ans = 0
for i in target:
val = 0
it = iter(ab)
for a,b in zip(it,it):
if( a - (i&a) == 0 ):
val += b
ans = max(... |
s740619760 | p03584 | u119148115 | 1598502764 | Python | PyPy3 (7.3.0) | py | Runtime Error | 237 | 118976 | 837 | import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
N,K = MI()
k = K.bit_length()
AB = []
for _ in range(N):
a,b = MI()
if a > K:
continue
else:
AB.append(([(a >> i) & 1 for i in range(k-1,-1,-1)],b))
N = len(AB)
K = [(K >> i) & 1 for i in range(k-1,-1,-1)]
ANS = [0... |
s848081147 | p03584 | u119148115 | 1598497113 | Python | PyPy3 (7.3.0) | py | Runtime Error | 220 | 125196 | 705 | import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
N,K = MI()
k = K.bit_length()
AB = []
for _ in range(N):
a,b = MI()
if a > K:
continue
else:
AB.append(([(a >> i) & 1 for i in range(k-1,-1,-1)],b))
N = len(AB)
K = [(K >> i) & 1 for i in range(k-1,-1,-1)]
A = [[] ... |
s001228246 | p03584 | u119148115 | 1598495999 | Python | PyPy3 (7.3.0) | py | Runtime Error | 228 | 124656 | 1214 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return 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 S(): return s... |
s930664430 | p03584 | u119148115 | 1598495867 | Python | PyPy3 (7.3.0) | py | Runtime Error | 224 | 119660 | 1132 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return 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 S(): return s... |
s708980559 | p03584 | u119148115 | 1598495756 | Python | PyPy3 (7.3.0) | py | Runtime Error | 215 | 124920 | 1141 | import sys
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return 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 S(): return s... |
s704932461 | p03584 | u145600939 | 1589473470 | Python | Python (3.8.2) | py | Runtime Error | 107 | 1520 | 733 | import sys
input = sys.stdin.readline
n,k = map(int,input().split())
A = [set(range(30)) for _ in range(n)]
B = [0]*n
for i in range(n):
a,b = map(int,input().split())
j = 0
while a > 0:
if a&1:A[i].remove(j)
j += 1
a = a >> 1
B[i] = b
bit = [0]*30
j = 0
while k > 0:
bit[j] ... |
s478821497 | p03584 | u476604182 | 1589470550 | Python | PyPy3 (7.3.0) | py | Runtime Error | 137 | 1516 | 335 | N,K,*X = map(int, open(0).read().split())
S = bin(K)[2:]
L = len(S)
one = set()
ls = [(a,b) for a,b in zip(*[iter(X)]*2) if a<=K]
kls = [K]
ans = 0
for i in range(L):
if S[i]=='1':
m = int(S[:i]+'0'+'1'*(L-i-1),2)
kls.append(m)
for k in kls:
m = 0
for a,b in ls:
if k==k|a:
m += b
ans = max(ans... |
s081785160 | p03584 | u476604182 | 1589470324 | Python | PyPy3 (7.3.0) | py | Runtime Error | 175 | 1524 | 398 | N,K,*X = map(int,open(0).read().split())
S = bin(K)[2:]
L = len(S)
ls = [(a,b) for a,b in zip(*[iter(X)]*2)]
s = '0'
ans = 0
for i,c in enumerate(S):
if c=='0':
s += c
continue
j = L-i
m = (1<<(j-1))-1
n = int(s,2)<<j
x = m|n
v = 0
for a,b in ls:
if x==x|a:
v += b
ans = max(v,ans)
s ... |
s665482502 | p03584 | u476604182 | 1589470233 | Python | Python (3.8.2) | py | Runtime Error | 108 | 1488 | 397 | N,K,*X = map(int,open(0).read().split())
S = bin(K)[2:]
L = len(S)
ls = [(a,b) for a,b in zip(*[iter(X)]*2)]
s = '0'
ans = 0
for i,c in enumerate(S):
if c=='0':
s += c
continue
j = L-i
m = (1<<(j-1))-1
n = int(s,2)<<j
x = m|n
v = 0
for a,b in ls:
if x==x|a:
v += b
ans = max(v,ans)
s ... |
s373636351 | p03584 | u476604182 | 1589470131 | Python | Python (3.8.2) | py | Runtime Error | 110 | 1524 | 397 | N,K,*X = map(int,open(0).read().split())
S = bin(K)[2:]
L = len(S)
ls = [(a,b) for a,b in zip(*[iter(X)]*2)]
s = '0'
ans = 0
for i,c in enumerate(S):
if c=='0':
s += c
continue
j = L-i
m = (1<<(j-1))-1
n = int(s,2)<<j
x = m|n
v = 0
for a,b in ls:
if x==x|a:
v += b
ans = max(v,ans)
s ... |
s827433192 | p03584 | u843135954 | 1589463546 | Python | Python (3.8.2) | py | Runtime Error | 108 | 1524 | 8 | print(1) |
s419973148 | p03584 | u874644572 | 1589463200 | Python | PyPy3 (7.3.0) | py | Runtime Error | 137 | 1520 | 7840 | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ull=unsigned long long;
using uint=unsigned int;
using pcc=pair<char,char>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using pdd=pair<double,double>;
using tuplis=pair<ll,pll>;
using tuplis2=pair<pll,ll>;
template<class T... |
s006947926 | p03584 | u874644572 | 1589463156 | Python | PyPy3 (7.3.0) | py | Runtime Error | 134 | 1492 | 693 | n,k = map(int,input().split())
A = [set(range(30)) for _ in range(n)]
B = [0]*n
for i in range(n):
a,b = map(int,input().split())
j = 0
while a > 0:
if a&1:A[i].remove(j)
j += 1
a = a >> 1
B[i] = b
bit = [0]*30
j = 0
while k > 0:
bit[j] = k&1
k = k >> 1
j += 1
zero = ... |
s027787889 | p03584 | u145600939 | 1589462736 | Python | Python (3.8.2) | py | Runtime Error | 108 | 1504 | 694 | n,k = map(int,input().split())
A = [set(range(30)) for _ in range(n)]
B = [0]*n
for i in range(n):
a,b = map(int,input().split())
j = 0
while a > 0:
if a&1:A[i].remove(j)
j += 1
a = a >> 1
B[i] = b
bit = [0]*30
j = 0
while k > 0:
bit[j] = k&1
k = k >> 1
j += 1
zero = ... |
s111371833 | p03584 | u145600939 | 1589462708 | Python | PyPy3 (7.3.0) | py | Runtime Error | 137 | 1520 | 733 | import sys
input = sys.stdin.readline
n,k = map(int,input().split())
A = [set(range(30)) for _ in range(n)]
B = [0]*n
for i in range(n):
a,b = map(int,input().split())
j = 0
while a > 0:
if a&1:A[i].remove(j)
j += 1
a = a >> 1
B[i] = b
bit = [0]*30
j = 0
while k > 0:
bit[j] ... |
s199451267 | p03584 | u145600939 | 1589462571 | Python | Python (3.8.2) | py | Runtime Error | 109 | 1520 | 733 | import sys
input = sys.stdin.readline
n,k = map(int,input().split())
A = [set(range(30)) for _ in range(n)]
B = [0]*n
for i in range(n):
a,b = map(int,input().split())
j = 0
while a > 0:
if a&1:A[i].remove(j)
j += 1
a = a >> 1
B[i] = b
bit = [0]*30
j = 0
while k > 0:
bit[j] ... |
s972628235 | p03584 | u145600939 | 1589462454 | Python | Python (3.8.2) | py | Runtime Error | 108 | 1504 | 733 | import sys
input = sys.stdin.readline
n,k = map(int,input().split())
A = [set(range(30)) for _ in range(n)]
B = [0]*n
for i in range(n):
a,b = map(int,input().split())
j = 0
while a > 0:
if a&1:A[i].remove(j)
j += 1
a = a >> 1
B[i] = b
bit = [0]*30
j = 0
while k > 0:
bit[j] ... |
s653092753 | p03584 | u520276780 | 1589434804 | Python | Python (3.8.2) | py | Runtime Error | 109 | 1516 | 204 | #エラーはここか否か
n,k=map(int, input().split( ))
s = [tuple(map(int, input().split( ))) for _ in range(n)]
kk=[k]+[((((k>>i)-1)<<i) + (1<<i) -1) for i in range(1,k.bit_length()) if (k>>i)&1]
|
s177349464 | p03584 | u520276780 | 1589434334 | Python | Python (3.8.2) | py | Runtime Error | 106 | 1524 | 503 | #解説参照
#xor ではなく or
n,k=map(int, input().split( ))
s = [tuple(map(int, input().split( ))) for _ in range(n)]
kk=[k]+[((((k>>i)-1)<<i) + (1<<i) -1) for i in range(1,k.bit_length()) if (k>>i)&1]
#print(kk)
ans=0
for ki in kk:
tmp = 0
for ai,bi in s:
flag=True##ここ
for j in range(k.bit_length()):
... |
s326706052 | p03584 | u520276780 | 1589434260 | Python | Python (3.8.2) | py | Runtime Error | 110 | 1524 | 548 | #解説参照
#xor ではなく or
n,k=map(int, input().split( ))
s = [tuple(map(int, input().split( ))) for _ in range(n)]
kk=[k]+[((((k>>i)-1)<<i) + (1<<i) -1) for i in range(1,k.bit_length()) if (k>>i)&1]
#print(kk)
ans=0
for ki in kk:
tmp = 0
tmp2=[]
for ai,bi in s:
flag=True##ここ
for j in range(k.bit... |
s055512801 | p03584 | u520276780 | 1589434217 | Python | PyPy3 (7.3.0) | py | Runtime Error | 146 | 1524 | 548 | #解説参照
#xor ではなく or
n,k=map(int, input().split( ))
s = [tuple(map(int, input().split( ))) for _ in range(n)]
kk=[k]+[((((k>>i)-1)<<i) + (1<<i) -1) for i in range(1,k.bit_length()) if (k>>i)&1]
#print(kk)
ans=0
for ki in kk:
tmp = 0
tmp2=[]
for ai,bi in s:
flag=True##ここ
for j in range(k.bit... |
s779512463 | p03584 | u561231954 | 1589143444 | Python | Python (3.4.3) | py | Runtime Error | 709 | 16916 | 518 | INF = 10 ** 15
MOD = 10 ** 9 + 7
from collections import deque
def main():
N,K = map(int,input().split())
number = [tuple(map(int,input().split())) for _ in range(N)]
msb = 30
while (K>>msb)&1 == 0:
msb -= 1
ans = 0
for i in range(msb + 1):
x = K >> i
if i > 0:
... |
s409233216 | p03584 | u905582793 | 1581282262 | Python | Python (3.4.3) | py | Runtime Error | 1056 | 29428 | 369 | import sys
input = sys.stdin.readline
n,k = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
ans = []
l = k.bit_length()
for i in range(l-1,-1,-1):
if i == 0:
x = k
elif k & 1 << i:
x = (k >> (i+1)) << i+1 | (1 << i)-1
sm = 0
for j in range(n):
if a[j][0] | x == x:
... |
s670961089 | p03584 | u905582793 | 1581282222 | Python | Python (3.4.3) | py | Runtime Error | 1113 | 29428 | 331 | n,k = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
ans = []
l = k.bit_length()
for i in range(l-1,-1,-1):
if i == 0:
x = k
elif k & 1 << i:
x = (k >> (i+1)) << i+1 | (1 << i)-1
sm = 0
for j in range(n):
if a[j][0] | x == x:
sm += a[j][1]
ans.append(sm)
prin... |
s307061651 | p03584 | u423585790 | 1577215801 | Python | PyPy3 (2.4.0) | py | Runtime Error | 358 | 56412 | 1348 | #!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return... |
s825401632 | p03584 | u585482323 | 1575009688 | Python | PyPy3 (2.4.0) | py | Runtime Error | 661 | 63488 | 1598 | #!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().split()]... |
s382260242 | p03584 | u649373416 | 1558749135 | Python | PyPy3 (2.4.0) | py | Runtime Error | 670 | 62296 | 820 | N,K = [ int(it) for it in input().split() ]
li = [ [ int(it) for it in input().split() ] for i in range(N) ]
kbit = []
k = K
for i in range(100000000):
if (k == 0):
break
kbit.append( k%2 )
k//=2
keta = len(kbit)
def chk(c):
#print (c)
s = 0
for k,v in li:
if ( (c^k)|c == c ):
#print ( k,v,"... |
s423075056 | p03584 | u693716675 | 1555562933 | Python | Python (3.4.3) | py | Runtime Error | 792 | 16640 | 848 | N, K = [int(i) for i in input().split()]
pairs = []
kouhos= []
zero_index = []
one_index = []
for i in range(N):
A, B = [int(j) for j in input().split()]
pairs.append((A,B))
binK = bin(K)[2:]
lenK = len(binK)
for i in range(lenK):
if binK[i]=='0':
zero_index.append(i)
else:
one_index.... |
s873981520 | p03584 | u391331433 | 1535805929 | Python | Python (2.7.6) | py | Runtime Error | 581 | 14236 | 1177 | import sys
from collections import deque
import copy
import heapq
import math
from math import *
def get_read_func(fileobject):
if fileobject == None :
return raw_input
else:
return fileobject.readline
def main():
if len(sys.argv) > 1:
f = open(sys.argv[1])
else:
f = N... |
s874815895 | p03584 | u466826467 | 1507091432 | Python | Python (3.4.3) | py | Runtime Error | 877 | 16692 | 1044 | import math
if __name__ == '__main__':
N, K = list(map(int, input().split()))
integer_value = []
for i in range(N):
integer, value = list(map(int, input().split()))
integer_value.append((integer, value))
r = int(math.log(K, 2))
max_value = 0
for i in range(r + 1):
# prin... |
s459299529 | p03584 | u902644648 | 1506960195 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 484 | #get targets
def targets (K):
ret = [K]
for r in range(31):
if ((K >> r) & 1) == 1 :
tmp = K
tmp &= (~(1 << r))
tmp |= (1 << r) - 1
ret.append(tmp);
return ret
#input
N, K = map(int, input().split())
items = []
for steps in range(N):
A, B = map(int, input().slpit())
items.append([A, B])
#process
tar... |
s730935520 | p03584 | u057916330 | 1506891777 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1647 | 69592 | 588 | N, K = map(int, input().split())
A, B, a = [0] * N, [0] * N, [''] * N
for i in range(N):
A[i], B[i] = map(int, input().split())
a[i] = str(bin(A[i])[2:]).rjust(30, '0')
k = str(bin(K)[2:]).rjust(30, '0')
ans = 0
s = k.index('1')
for r in range(s, 30 + 1):
tmp = 0
for i in range(N):
affordable ... |
s035573087 | p03584 | u792078574 | 1506834184 | Python | Python (2.7.6) | py | Runtime Error | 420 | 2696 | 455 | N, K = map(int, raw_input().split(' '))
klen = len(bin(K)[2:]) if K > 0 else 0
vs = [0]*31
vs2 = [0]*31
for n in xrange(N):
a, b = map(int, raw_input().split(' '))
alen = len(bin(a)[2:]) if a > 0 else 0
for i in xrange(-klen-1, -alen):
vs[i] += b
if a <= (K % (2**alen)):
vs2[-alen] += b
ans = [0]*30
t... |
s438148296 | p03584 | u039623862 | 1506831088 | Python | Python (3.4.3) | py | Runtime Error | 746 | 16604 | 856 | def read_stdin():
n, k = map(int, input().split())
p = []
for i in range(n):
a, b = map(int, input().split())
if a <= k:
p.append((a, b))
return (n, k, p)
def main(n, k, p):
max_score = 0
if not p:
print(0)
exit()
for i in range(n):
if k ... |
s479431337 | p03584 | u039623862 | 1506830914 | Python | Python (3.4.3) | py | Runtime Error | 772 | 16604 | 810 | def read_stdin():
n, k = map(int, input().split())
p = []
for i in range(n):
a, b = map(int, input().split())
if a <= k:
p.append((a, b))
return (n, k, p)
def main(n, k, p):
max_score = 0
for i in range(n):
if k | p[i][0] == k:
max_score += p[i][... |
s900075083 | p03584 | u039623862 | 1506830663 | Python | Python (3.4.3) | py | Runtime Error | 731 | 16592 | 856 | def read_stdin():
n, k = map(int, input().split())
p = []
for i in range(n):
a, b = map(int, input().split())
if a <= k:
p.append((a, b))
return (n, k, p)
def main(n, k, p):
max_score = 0
for i in range(n):
if k | p[i][0] == k:
max_score += p[i][1... |
s972311493 | p03584 | u039623862 | 1506830635 | Python | PyPy3 (2.4.0) | py | Runtime Error | 636 | 54232 | 856 | def read_stdin():
n, k = map(int, input().split())
p = []
for i in range(n):
a, b = map(int, input().split())
if a <= k:
p.append((a, b))
return (n, k, p)
def main(n, k, p):
max_score = 0
for i in range(n):
if k | p[i][0] == k:
max_score += p[i][1... |
s581051220 | p03584 | u039623862 | 1506827973 | Python | PyPy3 (2.4.0) | py | Runtime Error | 618 | 55416 | 747 | def main():
n, k = map(int, input().split())
p = []
for i in range(n):
a, b = map(int, input().split())
if a <= k:
p.append((a, b))
max_score = 0
for i in range(n):
if k | p[i][0] == k:
max_score += p[i][1]
mask = bin(k)[2:]
bit_size = len... |
s282501461 | p03584 | u039623862 | 1506827879 | Python | PyPy3 (2.4.0) | py | Runtime Error | 622 | 54400 | 695 | def main():
n, k = map(int, input().split())
p = []
for i in range(n):
a, b = map(int, input().split())
if a <= k:
p.append((a, b))
max_score = 0
for i in range(n):
if k | p[i][0] == k:
max_score += p[i][1]
mask = bin(k)[2:]
bit_size = len... |
s577450826 | p03584 | u039623862 | 1506827529 | Python | PyPy3 (2.4.0) | py | Runtime Error | 613 | 54360 | 670 | def main():
n, k = map(int, input().split())
p = []
for i in range(n):
a, b = map(int, input().split())
if a <= k:
p.append((a, b))
max_score = 0
for i in range(n):
if k | p[i][0] == k:
max_score += p[i][1]
mask = bin(k)[2:]
for i in range... |
s429647816 | p03584 | u792078574 | 1506826488 | Python | Python (2.7.6) | py | Runtime Error | 359 | 2692 | 372 | N, K = map(int, raw_input().split(' '))
kbin = bin(K)[2:]
klen = len(kbin)
vs = [0]*30
vs2 = [0]*30
for n in xrange(N):
a, b = map(int, raw_input().split(' '))
abin = bin(a)[2:]
alen = len(abin)
vs[-alen-1] += b
if a <= (K % (2**alen)):
vs2[-alen] += b
ans = [0]*30
tmp = 0
for i in xrange(-klen, 0):
a... |
s985405919 | p03584 | u112902287 | 1506824204 | Python | Python (3.4.3) | py | Runtime Error | 425 | 11980 | 448 | n, k = list(map(int, input().split()))
a = []
b = []
for _ in range(n):
cur_a, cur_b = list(map(int, input().split()))
a.append(cur_a)
b.append(cur_b)
memo = {}
def rec(i, j):
if (i, j) in memo.keys():
return memo[(i, j)]
if i == n:
res = 0
elif k < a[i] | j:
res = rec(... |
s591264633 | p03584 | u315078622 | 1506824175 | Python | PyPy3 (2.4.0) | py | Runtime Error | 705 | 69880 | 518 | N, K = map(int, input().split())
A = [tuple(int(x) for x in input().split()) for _ in range(N)]
A = [(a, b) for a, b in A if a <= K]
# print(A)
L = K.bit_length()
ans = 0
for i in reversed(range(L)):
bit = (1 << i) & K
if bit != 1:
# print(bit, ':', i)
cand = 0
bor = 0
for a, b i... |
s045240259 | p03584 | u257374434 | 1506823298 | Python | Python (3.4.3) | py | Runtime Error | 2105 | 29428 | 758 |
N , K = list(map(int,input().split()))
keta = 0
for i in range(1000):
if 2**i > K:
keta=i
break
K_2 = bin(K)[2:]
max_kouho = [K_2,"1"* (len(K_2) -1) ]
for i in range(1,len(K_2)-1):
if K_2[i] == "1" :
#print(K_2[:i-1]+"00"+ ("1" * 100)[- (len(K_2)-i-1 if len(K_2)-i-1 > 0 else 100 ):] ... |
s110478380 | p03585 | u467736898 | 1597004307 | Python | Python (3.8.2) | py | Runtime Error | 113 | 27220 | 2149 | import os
import sys
import numpy as np
# >>> binary indexed tree >>>
# 必要な要素数+1 の長さの ndarray の 1 要素目以降を使う
def bit_sum(bit, i): # ["bit_sum", "i8(i8[:],i8)"],
# (0, i]
res = 0
while i:
res += bit[i]
i -= i & -i
return res
def bit_add(bit, i, val): # ["bit_add", "void(i8[:],i8,i8)"],... |
s587330092 | p03585 | u340781749 | 1596171374 | Python | Python (3.8.2) | py | Runtime Error | 204 | 28948 | 1378 | import os
import sys
import numpy as np
def solve(inp):
def intersection(a, b, c, d, e, f):
x = (c * e - b * f) / (a * e - b * d)
y = (f - d * x) / e
return x, y
n = int(inp[0])
m = n * (n - 1) // 2
aaa = inp[1::3]
bbb = inp[2::3]
ccc = inp[3::3]
intersections_x =... |
s359157473 | p03585 | u340781749 | 1596171296 | Python | Python (3.8.2) | py | Runtime Error | 403 | 28884 | 1312 | import os
import sys
import numpy as np
def solve(inp):
def intersection(a, b, c, d, e, f):
x = (c * e - b * f) / (a * e - b * d)
y = (f - d * x) / e
return x, y
n = int(inp[0])
m = n * (n - 1) // 2
aaa = inp[1::3]
bbb = inp[2::3]
ccc = inp[3::3]
intersections_x =... |
s734172697 | p03585 | u340781749 | 1596169980 | Python | Python (3.8.2) | py | Runtime Error | 207 | 29564 | 1384 | import os
import sys
import numpy as np
def solve(inp):
def intersection(a, b, c, d, e, f):
if a * e - b * d == 0:
print('WA')
return c, f
x = (c * e - b * f) / (a * e - b * d)
y = (f - d * x) / e
return x, y
n = int(inp[0])
m = n * (n - 1) // 2
... |
s628726442 | p03585 | u340781749 | 1596169554 | Python | Python (3.8.2) | py | Runtime Error | 118 | 26920 | 1429 | import os
import sys
import numpy as np
def solve(inp):
def intersection(a, b, c, d, e, f):
if a * e - b * d == 0:
print('WA')
exit()
x = (c * e - b * f) / (a * e - b * d)
y = (f - d * x) / e
return x, y
n = inp[0]
m = n * (n - 1) // 2
aaa = in... |
s416883218 | p03585 | u340781749 | 1596169225 | Python | Python (3.8.2) | py | Runtime Error | 200 | 29488 | 1743 | import os
import sys
import numpy as np
def solve(inp):
def intersection(a, b, c, d, e, f):
if a == 0:
y = c / b
x = (f - e * y) / d
return x, y
if d == 0:
y = f / e
x = (c - b * y) / a
return x, y
if b == 0:
... |
s298030099 | p03585 | u340781749 | 1596168985 | Python | Python (3.8.2) | py | Runtime Error | 206 | 29500 | 1674 | import os
import sys
import numpy as np
def solve(inp):
def intersection(a, b, c, d, e, f):
if a == 0:
y = c / b
x = (f - e * y) / d
return x, y
if d == 0:
y = f / e
x = (c - b * y) / a
return x, y
if b == 0:
... |
s057658342 | p03585 | u488401358 | 1593005864 | Python | PyPy3 (7.3.0) | py | Runtime Error | 192 | 84976 | 1835 | class BIT():
def __init__(self,n):
self.BIT=[0]*(n+1)
self.num=n
def query(self,idx):
res_sum = 0
while idx > 0:
res_sum += self.BIT[idx]
idx -= idx&(-idx)
return res_sum
#Ai += x O(logN)
def update(self,idx,x):
while idx <= self.... |
s881613206 | p03585 | u864197622 | 1577334853 | Python | PyPy3 (2.4.0) | py | Runtime Error | 5264 | 134408 | 983 | def addbit(i):
i += 1
while i <= N:
BIT[i] += 1
i += i & (-i)
def getsum(i):
ret = 0
i += 1
while i != 0:
ret += BIT[i]
i -= i&(-i)
return ret
def bit(L):
global BIT
BIT=[0] * (N+1)
re = 0
for l in L:
re += getsum(l)
addbit(l)
r... |
s256877651 | p03585 | u133038626 | 1506879229 | Python | Python (3.4.3) | py | Runtime Error | 5256 | 19380 | 2302 | # coding: utf-8
import math
import fractions
import heapq
import collections
import re
import array
import bisect
import itertools
from collections import Counter, defaultdict
def argsort(l, one_base=False):
return sorted(range(one_base, len(l) + one_base), key=lambda i: l[i-one_base])
class BinaryIndexedTree... |
s287154642 | p03587 | u428341537 | 1600615485 | Python | Python (3.8.2) | py | Runtime Error | 19 | 9108 | 58 | a,s,d,f,g,h= map(int, input().split())
print(a+s+d+f+g+h) |
s379804082 | p03587 | u546853743 | 1598754436 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8912 | 87 | n=list(int,input())
count=0
for i in range(n):
if n=='1':
count += 1
print(count) |
s996543772 | p03587 | u595952233 | 1598441379 | Python | Python (3.8.2) | py | Runtime Error | 25 | 8872 | 34 | print(list(input()).count('1')) ]
|
s365794278 | p03587 | u989306199 | 1595653121 | Python | Python (3.8.2) | py | Runtime Error | 23 | 8856 | 63 | s=input()
ans = 0
for c in s:
if c=="1"
ans+=1
print(ans) |
s217876100 | p03587 | u357751375 | 1591669954 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 40 | s = list(int(input()))
print(s.count(1)) |
s653610387 | p03587 | u358254559 | 1591407471 | Python | PyPy3 (2.4.0) | py | Runtime Error | 166 | 38256 | 28 | s=input()
print(s.count("1") |
s636895132 | p03587 | u953110527 | 1589655530 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 74 | S = input()
count = 0
for i in S:
if i == '1':
count++
print(count) |
s681667595 | p03587 | u422272120 | 1583091814 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 23 | print (input().count(1) |
s126080786 | p03587 | u217627525 | 1582725717 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 78 | s=input()
ans=0
for i in range(n):
if s[i]=="1":
ans+=1
print(ans) |
s192149315 | p03587 | u247366051 | 1581962223 | Python | Python (2.7.6) | py | Runtime Error | 10 | 2568 | 29 | a=input()
print(a.count("1")) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.