problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p03457
|
s199790761
|
Wrong Answer
|
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
t1,x1,y1 = T[i]
# t2,x2,y2 = T[i+1]
# dis = abs(x2-x1)+abs(y2-y1)
# _t = t2-t1
# if dis > _t or _t%2 != dis%2:
# flag = 'No'
i += 1
print(flag)
|
p03779
|
s887933751
|
Wrong Answer
|
x = int(input())
for t in range(1000000000):
if 2 * x < t * (t + 1):
print(t)
break
|
p02622
|
s384907412
|
Accepted
|
s=input()
t=input()
l=len(s)
sum=0
for i in range(l):
if s[i]!=t[i]:
sum=sum+1
print(sum)
|
p03475
|
s541978636
|
Wrong Answer
|
import sys
input = sys.stdin.readline
import numpy as np
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
n = I()
mylist = tuple(tuple(MI()) for i in range(n-1))
def main(j):
time = 0
for c, s, f in mylist:
if time < s:
time = s
if (time - s) % f != 0:
time += (f - (time - s) % f) #待ち時間を足す
time += c
print(time)
for i in range(n-1):
main(i)
print(0)
|
p02755
|
s138838438
|
Accepted
|
#!/usr/bin/env python
from sys import stdin, stderr
def main():
A, B = map(int, stdin.readline().split())
p = 1
res = -1
while True:
a = (p * 8) / 100
b = (p * 10) / 100
if a > A or b > B:
break
if a == A and b == B:
res = p
break
p += 1
print(res)
return 0
if __name__ == '__main__': main()
|
p03778
|
s640512025
|
Wrong Answer
|
W, a, b = map(int,input().split())
print(min(abs(a+W-b),abs(a-W-b)))
|
p02608
|
s977158426
|
Accepted
|
L=[]
i=0
while i <100001:
L.append(0)
i+=1
for x0 in range(1,100):
for y0 in range(1,100):
for z0 in range(1,100):
p=x0**2+y0**2+z0**2+x0*y0+y0*z0+z0*x0
if p<10001:
L[p]+=1
N=int(input())
for i in range(1,N+1):
print(L[i])
|
p03944
|
s793831836
|
Accepted
|
W,H,N=map(int,input().split())
X=[list(map(int,input().split())) for _ in range(N)]
x1=0
x2=W
y1=0
y2=H
for i in range(N):
if X[i][2]==1:
x1=max(x1,X[i][0])
elif X[i][2]==2:
x2=min(x2,X[i][0])
elif X[i][2]==3:
y1=max(y1,X[i][1])
else:
y2=min(y2,X[i][1])
print((y2-y1)*(x2-x1) if (y2-y1)>0 and (x2-x1)>0 else 0)
|
p04012
|
s571684054
|
Accepted
|
w=input()
S=set(w)
print("Yes" if all(w.count(s)%2==0 for s in S)==True else "No")
|
p03761
|
s492940626
|
Accepted
|
n = int(input())
d = {}
s = input()
for c in set(s):
d[c] = s.count(c)
for _ in range(n-1):
s = input()
for c in d.keys():
d[c] = min(d[c], s.count(c))
d_sorted = sorted(d.items(), key=lambda x:x[0])
ans = ''
for item in d_sorted:
ans += item[0]*item[1]
print(ans)
|
p03657
|
s345761142
|
Accepted
|
a, b = map(int, input().split())
if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
print("Possible")
else:
print("Impossible")
|
p03289
|
s561750344
|
Accepted
|
s=input()
print('AC' if s[0]=='A' and 'C' in s and 1<s.index('C') and s.index('C')+1<len(s) and sum([c.isupper() for c in s])==2 else 'WA')
|
p02555
|
s028610054
|
Accepted
|
fact = [1, 1]; factinv = [1, 1]; inv = [0, 1]; p = 10**9+7
for i in range(2, 2001):
fact.append(fact[-1]*i%p)
inv.append(-inv[p%i]*(p//i)%p)
factinv.append(factinv[-1]*inv[-1]%p)
def cmb(n, r, p):
return fact[n]*factinv[r]*factinv[n-r]%p
s = int(input()); c = 0
for i in range(1, s//3+1):
c += cmb(s-i*3+i-1, i-1, p)
print(c%p)
|
p03644
|
s403960274
|
Accepted
|
n = int(input())
if n >= 64:
print(64)
elif n >= 32:
print(32)
elif n >= 16:
print(16)
elif n >= 8:
print(8)
elif n >= 4:
print(4)
elif n >= 2:
print(2)
else:
print(1)
|
p03817
|
s620159205
|
Accepted
|
def main():
x = int(input())
ans = (x // 11) * 2
if x % 11 == 0:
pass
elif x % 11 <= 6:
ans += 1
else:
ans += 2
print(ans)
if __name__ == '__main__':
main()
|
p03720
|
s100928393
|
Wrong Answer
|
import numpy as np
N, M = map(int, input().split())
c = []
for _ in range(M):
a, b= map(int, input().split())
c.append(a)
c.append(b)
C = np.zeros((max(c),1),dtype = 'int')
for i in range(len(C)):
C[i,0] = c.count(i)
print(C)
|
p02792
|
s960375570
|
Wrong Answer
|
N = int(input())
table = [[0] * 10 for _ in range(10)]
for i in range(1, N):
s = str(i)
if s[-1] == '0': continue
table[int(s[0])][int(s[-1])] += 1
ans = 0
for i in range(1, 10):
for j in range(1, 10):
ans += table[i][j] * table[j][i]
print(ans)
|
p02818
|
s786822374
|
Wrong Answer
|
A, B, K = map(int, input().split())
num_eat_A = min([A, K])
if num_eat_A < K:
num_eat_B = K - num_eat_A
else:
num_eat_B = 0
A_remain = A - num_eat_A
B_remain = B - num_eat_B
print("{} {}".format(A_remain, B_remain))
|
p02829
|
s938537178
|
Accepted
|
ans=["1","2","3"]
for i in range(2):
num=input()
ans.remove(num)
print(ans[0])
|
p03252
|
s196655751
|
Accepted
|
s,t=input(),input()
import collections
c1=collections.Counter(s)
c2=collections.Counter(t)
if sorted(c1.values())==sorted(c2.values()):
print('Yes')
else:
print('No')
|
p03481
|
s201245579
|
Wrong Answer
|
import numpy as np
x, y = map(int, input().split())
n = 1 + int(np.log2(y/x))
print(n)
|
p02959
|
s162117113
|
Accepted
|
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
ans=0
for i in range(n):
m=min(a[i],b[i])
ans+=m
a[i]-=m
b[i]-=m
m=min(a[i+1],b[i])
a[i+1]-=m
b[i]-=m
ans+=m
print(ans)
|
p02957
|
s867581911
|
Wrong Answer
|
a, b = map(int, input().split())
if a - b % 2 == 1:
print('IMPOSSIBLE')
else:
dif = (a - b) // 2
if a < b:
print(a + dif)
else:
print(b + dif)
|
p02829
|
s289024694
|
Accepted
|
print(6 - int(input()) - int(input()))
|
p04019
|
s428377720
|
Accepted
|
s = list(input())
f = {
"N": False,
"S": False,
"W": False,
"E": False
}
for i in s:
f[i] = True
if (f["N"] ^ f["S"]):
print("No")
elif (f["W"] ^ f["E"]):
print("No")
else:
print("Yes")
|
p03644
|
s018766032
|
Wrong Answer
|
n=int(input())
for i in range(n):
if 2**(i+1)>n:
ans=i
break
print(ans)
|
p02689
|
s717209292
|
Accepted
|
n,m=map(int,input().split())
H=list(map(int,input().split()))
L=[]
for i in range(m):
a,b=map(int,input().split())
if H[a-1]<H[b-1]:
L.append(a)
elif H[a-1]>H[b-1]:
L.append(b)
else:
L.append(a)
L.append(b)
print(n-len(set(L)))
|
p02996
|
s323837351
|
Wrong Answer
|
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
sortedab = sorted(ab, key=lambda x:x[1])
cleartime = [0]*n
cleartime[0] = sortedab[0][0]
flag = True
for i in range(n):
cleartime[i] = cleartime[i-1] + sortedab[i][0]
if cleartime[i] <= sortedab[i][1]:
continue
else:
flag = False
break
if flag:
print("Yes")
else:
print("No")
|
p03487
|
s023464764
|
Accepted
|
n = int(input())
a = list(map(int, input().split()))
num_map = dict()
for i in range(n):
if a[i] not in num_map:
num_map[a[i]] = 1
else:
num_map[a[i]] += 1
res = 0
for key, value in num_map.items():
if key <= value:
res += value - key
else:
res += value
print(res)
|
p02556
|
s138223177
|
Wrong Answer
|
N = int(input())
t = []
for i in range(N):
a = tuple(map(int, input().split()))
t.append(a[0] + a[1])
t.sort()
print(t[-1] - t[0])
|
p02748
|
s473847022
|
Accepted
|
a,b,m=map(int,input().split())
ai=list(map(int, input().split()))
bi=list(map(int, input().split()))
sm=[list(map(int, input().split())) for _ in range(m)]
k=min(ai)+min(bi)
for x in range(m):
l=ai[sm[x][0]-1]+bi[sm[x][1]-1]-sm[x][2]
k=min(k,l)
print(k)
|
p03544
|
s466610126
|
Accepted
|
N = int(input()) + 1
lucas = [0]*N
lucas[0] = 2
lucas[1] = 1
for i in range(N):
if i < 2: pass
else: lucas[i] = lucas[i - 1] + lucas[i - 2]
print(lucas[N - 1])
|
p03243
|
s229937581
|
Wrong Answer
|
n = list(input())
t = sorted(n, reverse=True)[0]
print(str(t)*3)
|
p03759
|
s016004298
|
Accepted
|
a,b,c = map(int, input().split())
if b-a == c-b:
print('YES')
else:
print('NO')
|
p02570
|
s663787096
|
Wrong Answer
|
d,t,s = map(int,input().split())
if t*s <= d:
print("No")
else:
print("Yes")
|
p03095
|
s141591962
|
Accepted
|
import collections
MOD=10**9+7
N=int(input())
S=list(input())
c = collections.Counter(S)
cnt=1
for i in c.values():
cnt*=(i+1)
ans=cnt-1
print(ans%MOD)
|
p02665
|
s487663032
|
Accepted
|
N = int(input())
A = list(map(int, input().split()))
def solve(A):
ans = 0
leaves = sum(A)
prev_node_capacity = 1
for ai in A:
if ai > prev_node_capacity:
return -1
ans += min(prev_node_capacity, leaves)
leaves -= ai
prev_node_capacity -= ai
prev_node_capacity *= 2
return ans
print(solve(A))
|
p03071
|
s672030506
|
Accepted
|
a,b=map(int,input().split())
sum=0
for _ in range(2):
sum += max(a,b)
if a > b:
a -= 1
elif a < b:
b -= 1
print(sum)
|
p02791
|
s220222281
|
Accepted
|
N = int(input())
P = list(map(int,input().split()))
ans = 0
m = 10 ** 6
for i in range(N):
if m > P[i]:
ans += 1
m = min(m,P[i])
print(ans)
|
p04005
|
s293409203
|
Wrong Answer
|
a, b, c = map(int, input().split())
# 偶数の辺があれば、そこをぶった切ればよい
if a * b * c % 2 == 0:
print(0)
exit()
# 全部奇数である場合を考える
mindiff = 1 << 35
edge = [a, b, c] * 3
for i in range(3):
e, f = edge[i] // 2, edge[i] // 2 + 1
diff = abs(e * edge[i+1] * edge[i+2] - f * edge[i+1] * edge[i+2])
mindiff = min(mindiff, diff)
print(diff)
|
p03639
|
s626288821
|
Accepted
|
n = int(input())
li = list(map(int,input().split()))
A = 0
B = 0
C = 0
for a in li:
if a % 4 == 0:
A += 1
elif a % 2 == 0:
B += 1
else:
C += 1
if B == 0:
if C <= A + 1:
print('Yes')
else:
print('No')
else:
if C <= A:
print('Yes')
else:
print('No')
|
p02676
|
s736269328
|
Accepted
|
k = int(input())
s = input()
if len(s) <= k:
print(s)
raise SystemExit(0)
print(s[:k] + "...")
|
p03632
|
s158555122
|
Wrong Answer
|
a,b,c,d=map(int,input().split())
if b>c:
if b < d:
ans=b-c
else:
ans=d-c
else:
ans=0
print(ans)
|
p02712
|
s656321446
|
Accepted
|
N = int(input())
sum = 0
for i in range(1, N + 1):
if i % 3 == 0 or i % 5 == 0 or i % 15 == 0:
pass
else:
sum += i
print(sum)
|
p03623
|
s209274679
|
Accepted
|
x,a,b=map(int,input().split())
if abs(x-a)>abs(x-b):
print("B")
else:
print("A")
|
p02881
|
s307751546
|
Accepted
|
n = int(input())
left = 1
right = n
ans_l = 1
while left <= right:
left += 1
right = n/left
if n/left %1==0:
right = int(n/left)
ans_l = left
ans_r = n // ans_l
print(ans_l+ans_r-2)
|
p03799
|
s188752110
|
Wrong Answer
|
n,m=map(int,input().split())
ans=n+(m-n*2)//2//2
print(ans)
|
p02922
|
s755476699
|
Accepted
|
a,b = map(int,input().split())
ans = 0
cnt = 1
while cnt < b:
cnt -= 1
cnt += a
ans += 1
print(ans)
|
p02994
|
s910669820
|
Wrong Answer
|
import math
n, l = map(int, input().split())
t = []
for i in range(1, n+1):
t.append(l+i-1)
fab = 0
if l >= 1:
fab = math.fabs(sum(t)-t[0])
elif l < 1 and n%2 == 0 and n+l > 0:
for i in range(1, n):
fab += t[i]
elif l < 1 and n%2 != 0 and n+l > 0:
#sum(t)==0
fab = 0
elif n+l < 0:
for i in range(n-1):
fab += t[i]
print(int(fab))
|
p03160
|
s367948593
|
Wrong Answer
|
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
n=ni()
h=nl()
dp=[10**5]*(n+1)
dp[0]=0
for i in range(n):
if i+1<n:
dp[i+1] = min(dp[i+1], dp[i]+abs(h[i+1]-h[i]))
if i+2<n:
dp[i+2] = min(dp[i+2], dp[i]+abs(h[i+2]-h[i]))
print(dp[n-1])
|
p02988
|
s961201408
|
Accepted
|
N = int(input())
LP = list(map(int, input().split()))
cnt = 0
for i in range(N-2):
LA = []
LB = []
LA.append(LP[i])
LA.append(LP[i+1])
LA.append(LP[i+2])
LB = sorted(LA)
if LA[1] == LB[1]:
cnt += 1
print(cnt)
|
p02909
|
s948274255
|
Wrong Answer
|
s = input()
if s == "Sunny":
print("Cloudy")
if s == "Cloudy":
print("Cloudy")
if s == "Rainy":
print("Sunny")
|
p02802
|
s350644133
|
Accepted
|
n,m=map(int,input().split())
ac=[0]*n
wa=[0]*n
for i in range(m):
p,s=map(str,input().split())
if ac[int(p)-1]==0:
if s=="AC":
ac[int(p)-1]=ac[int(p)-1]+1
else:
wa[int(p)-1]=wa[int(p)-1]+1
for i in range(n):
if ac[i]==0:
wa[i]=0
print(sum(ac),sum(wa))
|
p03910
|
s505975777
|
Accepted
|
N = int(input())
r=int((2*N+.25)**0.5 - 0.5)+1
for i in range(1,r+1):
if i!=r*(r+1)//2-N:
print(i)
|
p03137
|
s713183828
|
Accepted
|
N, M = map(int, input().split())
XS = sorted(map(int, input().split()))
DIFFS = []
for i in range(M - 1):
DIFFS.append(XS[i + 1] - XS[i])
DIFFS.sort()
for i in range(N - 1):
if DIFFS != []:
DIFFS.pop(-1)
print(sum(DIFFS))
|
p02718
|
s891193029
|
Accepted
|
n, m = map(int, input().split())
arr = list(map(int, input().split()))
r = 0
s = sum(arr)
for i in arr:
if i/s >= 1/(4*m):
r += 1
print("Yes" if r >= m else "No")
|
p03495
|
s566130726
|
Accepted
|
from collections import Counter
N, K = map(int, input().split())
A = list(map(int, input().split()))
L = Counter(A)
ans = N
for a, cnt in L.most_common(K):
ans -= cnt
print(ans)
|
p02879
|
s998237161
|
Accepted
|
a,b=map(int,input().split())
if a<10 and b<10:
print(a*b)
else:
print(-1)
|
p03836
|
s700379059
|
Accepted
|
sx,sy,tx,ty = list(map(int, input().split()))
result = ""
dy = ty-sy
dx = tx-sx
for i in range(dy):
result += "U"
for i in range(dx):
result += "R"
for i in range(dy):
result += "D"
for i in range(dx):
result += "L"
result += "L"
for i in range(dy+1):
result += "U"
for i in range(dx+1):
result += "R"
result += "D"
result += "R"
for i in range(dy+1):
result += "D"
for i in range(dx+1):
result += "L"
result += "U"
print(result)
|
p03360
|
s211498073
|
Accepted
|
A, B, C = map(int, input().split())
K = int(input())
m = max(A, B, C)
print(m * (2 ** K) + A + B + C - m)
|
p02583
|
s516772349
|
Accepted
|
import itertools
N = input()
array = list(map(int, input().split()))
p = list(itertools.combinations(array, 3))
count = 0
for p_i in p:
if p_i[0] + p_i[1] > p_i[2]:
if p_i[1] + p_i[2] > p_i[0]:
if p_i[2] + p_i[0] > p_i[1]:
if p_i[0] != p_i[1] and p_i[1] != p_i[2] and p_i[2] != p_i[0]:
count = count + 1
print(count)
|
p03486
|
s308905750
|
Accepted
|
print('Yes'if sorted(input())<sorted(input())[::-1] else'No')
|
p03998
|
s361685630
|
Accepted
|
a = input()
b = input()
c = input()
i = "a"
player = {"a":a,"b":b,"c":c}
while True:
if len(player[i])==0:
print(i.upper())
break
l = player[i][0]
player[i] = player[i][1:]
i = l
|
p03328
|
s529361452
|
Wrong Answer
|
ans=0
a,b=map(int,input().split())
for i in range(1,999):
ans+=i
if ans>b:
print(ans-a)
exit(0)
|
p03136
|
s323682410
|
Accepted
|
import numpy as np
N = int(input())
L = list(map(int, input().split()))
maxL = max(L)
argmaxL = np.argmax(L)
L.pop(argmaxL)
if maxL < sum(L):
print('Yes')
else:
print('No')
|
p02629
|
s315594126
|
Accepted
|
n = int(input())
alpha_arr = [chr(i) for i in range(97, 97+26)]
ans = []
while n > 0:
n -= 1
ans.insert(0, alpha_arr[n % 26])
n //= 26
print(''.join(ans))
|
p02595
|
s241641979
|
Wrong Answer
|
import numpy as np
N, D = map(int,input().split())
num = 0
for n in range(N):
x,y = map(int,input().split())
d = np.sqrt(x**2 + y**2)
if d >= D:
num+=1
print(num)
|
p03385
|
s792281376
|
Accepted
|
print("Yes" if len(set(input()))==3 else "No")
|
p03000
|
s850029556
|
Wrong Answer
|
N,X=map(int, input().split())
L=list(map(int, input().split()))
distance = 0
count = 0
while distance <= X and count < N:
print(distance)
distance = distance + L[count]
count = count + 1
|
p03804
|
s367663051
|
Accepted
|
n,m=map(int,input().split())
a=[]
for i in range(n):
ai=list(input())
a.append(ai)
b=[]
for i in range(m):
bi=list(input())
b.append(bi)
frag='No'
for i in range(n-m+1):
for j in range(n-m+1):
for k in range(m):
if a[i+k][j:j+m]!=b[k]:
break
else:
frag="Yes"
break
continue
print(frag)
|
p02706
|
s650577175
|
Accepted
|
N, M = map(int, input().split())
A = list(map(int, input().split()))
s = sum(A)
ans = N - s
if ans < 0:
print(-1)
else:
print(ans)
|
p02897
|
s606448842
|
Accepted
|
def main():
n = int(input())
print(0.5 if n % 2 == 0 else (1 + n // 2) / n)
if __name__ == '__main__':
main()
|
p03627
|
s109437621
|
Accepted
|
n = int(input())
a = list(map(int, input().split()))
from collections import Counter
c = Counter(a)
c = [(length,cnt) for length,cnt in sorted(c.items(), key=lambda x:(-x[0], -x[1])) if cnt>=2]
if len(c)<2:
print(0)
else:
if c[0][1]>=4:
print(c[0][0]*c[0][0])
else:
print(c[0][0]*c[1][0])
|
p03796
|
s025789619
|
Accepted
|
import math
N=int(input())
ans=math.factorial(N)%(10**9+7)
print(ans)
|
p02578
|
s724328432
|
Accepted
|
N=int(input())
A=list(map(int,input().split()))
m=0
K=0
for i in range(N):
if i==0:
m=A[i]
else:
S=max(0,m-A[i])
K+=S
m=A[i]+S
print(K)
|
p03035
|
s207219960
|
Accepted
|
A,B = map(int,input().split())
if A >= 13:
print(B)
elif A <= 5:
print(0)
else:
print(B//2)
|
p02866
|
s491552252
|
Wrong Answer
|
import sys
from collections import defaultdict
input = sys.stdin.readline
P = 998244353
def main():
N = int(input())
D = list(map(int, input().split()))
count = defaultdict(int)
for d in D:
count[d] += 1
if count[0] != 1:
print(0)
exit()
max_depth = max(count.keys())
ans = 1
for d in range(max_depth):
ans = (ans * pow(count[d], count[d + 1], mod=P)) % P
print(ans)
if __name__ == "__main__":
main()
|
p02555
|
s382284751
|
Wrong Answer
|
S = int(input())
const = 10**9 + 7
from scipy.special import comb
def amari(a, k):
temp = 0
for i in range(a):
temp += comb(a-1, i) * comb(i+1, k)
return int(temp)
a = S//3
b = S%3
if b == 0:
ans = amari(a, 0)
elif b==1:
ans = amari(a, 1)
else:
ans = amari(a, 1) + amari(a, 2)
ans %= const
print(ans)
|
p03106
|
s424403418
|
Accepted
|
A, B, K = map(int, input().split())
c = 0
for i in range(min(A,B), 0, -1):
if A % i == 0 and B % i == 0:
c += 1
# print(c,i)
if c == K:
ans = i
print(ans)
|
p02640
|
s168662453
|
Wrong Answer
|
a, b = map(int, input().split())
c = b//4
print(c)
if c > a:
print("No")
exit()
for i in range(0, b):
for j in range(0, b):
if i*2 + j*4 == b:
print("Yes")
exit()
else:
print("No")
|
p03109
|
s578646787
|
Wrong Answer
|
s = input()
if int(s[5:7]) < 4:
print ("Heisei")
else :
print ('TBD')
|
p02702
|
s412799026
|
Wrong Answer
|
s=input()
b=0
m=len(s)
c=0
for i in range(m-3):
a=s[i]+s[i+1]+s[i+2]
for j in range(i+3,m):
if c==1 and int(s[j])%3!=0:
c=0
continue
a=str(a)
a=int(a+s[j])
c=0
if a%3!=0:
continue
c=1
if a%2019==0:
b+=1
print(b)
|
p03076
|
s207828122
|
Accepted
|
# coding: utf-8
dish = [int(input().rstrip()) for i in range(5)]
def get_ans(flag: int, current: int):
if (1 << 5) - 1 == flag:
return current
tmp = current
if current % 10 != 0:
tmp += 10 - (current % 10)
ans = 2000
for i in range(5):
key = 1 << i
if (flag & key) != 0:
continue
ret = get_ans(flag + key, tmp + dish[i])
ans = min(ans, ret)
return ans
print(get_ans(0, 0))
|
p02880
|
s168865312
|
Accepted
|
N = int(input())
lt = list()
for i in range(1, 10):
for j in range(1, 10):
lt.append(i*j)
if N in lt:
print('Yes')
else:
print('No')
|
p02838
|
s606267228
|
Accepted
|
n = int(input())
a = list(map(int,input().split()))
MOD = 10**9 + 7
from collections import Counter
s = []
for i in range(n):
b = bin(a[i])[2:]
c = len(b)
s.append("0"*(60-c) + b)
ans = 0
for i in range(60):
zero = 0
one = 0
for j in range(n):
if s[j][i] == "0":
zero += 1
else:
one += 1
temp = zero * one * (2 ** (59-i)) % MOD
ans = (ans + temp) % MOD
print(ans)
|
p03705
|
s318923850
|
Wrong Answer
|
n,a,b=map(int,input().split())
ans=b*(n-1)+a-a*(n-1)-b
if ans<=0:
print(0)
else:
print(ans)
|
p02691
|
s537756764
|
Accepted
|
def resolve():
N= int(input())
A = list(map(int,input().split()))
API = dict()
ans = 0
for i,a in enumerate(A):
api = a+i+1
ami = i+1-a
if ami in API:
ans += API[ami]
if not api in API:
API[api]=0
API[api]+=1
print(ans)
if __name__ == "__main__":
resolve()
|
p03796
|
s172455164
|
Wrong Answer
|
n = int(input())
a = 1
for i in range(1,n+1):
a = i * (a % (10**9+7))
print(a)
|
p03592
|
s727551054
|
Wrong Answer
|
import sys
N, M, K = map(int, input().split())
for i in range(N+1):
for j in range(M+1):
if M*i + N*j - i*j == K:
print('Yes')
sys.exit()
print('No')
|
p02848
|
s573021453
|
Accepted
|
N = int(input())
S = input()
arr = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ"
c = ""
for s in S:
c = c + arr[arr.find(s)+N:arr.find(s)+N+1]
print(c)
|
p03126
|
s332298941
|
Accepted
|
import itertools
n,m=map(int,input().split())
a=[]
for i in range(0,n):
a.append(list(map(int,input().split())))
del a[i][0]
a=list(itertools.chain.from_iterable(a))
count=0
for i in range(0,m):
if a.count(i+1)==n:
count=count+1
print(count)
|
p02768
|
s422357877
|
Accepted
|
from functools import reduce
n,a,b=map(int,input().split())
mod=10**9+7
def nCk(n,k):
if n<k or (n<0 or k<0):
return 0
k=min(k,n-k)
up,down=1,1
for i in range(k):
up=up*(n-i)%mod
down=down*(i+1)%mod
return up*pow(down,mod-2,mod)%mod
all=pow(2,n,mod)
nCa=nCk(n,a)
nCb=nCk(n,b)
print((all-nCa-nCb-1)%mod)
|
p03449
|
s798630793
|
Accepted
|
def resolve():
n = int(input())
a_1 = list(map(int, input().split()))
a_2 = list(map(int, input().split()))
total = 0
for i in range(n):
line_1 = sum(a_1[:i+1])
line_2 = sum(a_2[i:])
total = max(total, line_1+line_2)
print(total)
resolve()
|
p02705
|
s970998164
|
Wrong Answer
|
from math import pi
def cicle(hankei):
print(2 * hankei * pi)
cicle(1)
cicle(73)
|
p03042
|
s811828990
|
Wrong Answer
|
#!/usr/bin/env python3
s = str(input())
a = s[0:2]
b = s[2:]
def div(a):
a = int(a)
if a <= 12 and a >= 1:
return "BOTH"
else:
return "YY"
if div(a) == div(b):
if div(a) == "YY":
print("NA")
else:
print("AMBIGUOUS")
elif div(a) == "YY":
print(b+a)
else:
print(a+b)
|
p02811
|
s327913116
|
Accepted
|
k,x=[int(i) for i in input().split()]
print("Yes" if k*500>=x else "No")
|
p02838
|
s260837044
|
Accepted
|
import numpy as np
n = int(input())
aa = list(map(int, input().split()))
mod = 10**9+7
res = 1
pow2 = 1
ans = 0
for i in range(60):
cnt = np.count_nonzero(np.array(aa)&pow2)
ans = (ans + cnt * (n-cnt) * res)%mod
res = (res*2)%mod
pow2*=2
print(ans)
|
p02820
|
s155357949
|
Accepted
|
#<D>wa
n, k = map(int,input().split())
r, s, p = map(int,input().split())
q = input()
d = {"r":p,"s":r, "p":s}
ans = 0
wins = [False] * k
for i in range(len(q)):
if not wins[i % k] or q[i] != q[i - k]:
ans += d[q[i]]
wins[i % k] = True
else:
wins[i % k] = False
print(ans)
|
p03127
|
s809792486
|
Accepted
|
from math import gcd
n=int(input())
a=list(map(int,input().split()))
g=gcd(a[0],a[0])
for i in range(n):
g=gcd(g,a[i])
print(g)
|
p02833
|
s999325562
|
Accepted
|
N = int(input())
if N % 2 == 1:
ans = 0
else:
count = 1
ans = 0
while N//2 >= 5**count:
ans += N//(2*5**count)
count+=1
print(ans)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.