problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p02831 | s234059955 | Accepted | from fractions import gcd
A,B = map(int, input().split())
print(int((A * B) / gcd(A, B))) |
p02613 | s578758014 | Accepted | n = int(input())
counts = {'AC': 0, 'TLE': 0, 'WA': 0, 'RE': 0}
for i in range(n):
s = input()
counts[s] += 1
print("AC x "+str(counts['AC']))
print("WA x "+str(counts['WA']))
print("TLE x "+str(counts['TLE']))
print("RE x "+str(counts['RE'])) |
p02582 | s425765046 | Accepted | # -*- coding: utf-8 -*-
s = input()
if s == 'RRR':
print(3)
elif 'RR' in s:
print(2)
elif 'R' in s:
print(1)
else:
print(0)
|
p02622 | s403940448 | Wrong Answer | s = [x for x in input()]
t = [y for y in input()]
count = 0
for _ in range(len(s)):
if s[_] == t[_]:
count+=1
print(count) |
p02952 | s672693973 | Wrong Answer | n = str(input())
iL = len(n)
count = 0
for i in range(1,iL+1):
if i != iL and i % 2 != 0:
count += (100**(i//2))*9
elif i == iL and i% 2 != 0:
count += int(n) - 100**(i-2)+1
print(count)
|
p03623 | s509964178 | Accepted | x,a,b = map(int,input().split())
if abs(a-x) > abs(b-x):
print('B')
else:
print('A') |
p02843 | s006940754 | Accepted | def solve():
X = int(input())
n = X // 100
if X - n * 100 <= n * 5:
print(1)
else:
print(0)
if __name__ == '__main__':
solve()
|
p03557 | s021658766 | Accepted | from bisect import bisect_left, bisect_right
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
len_c = len(c)
total = 0
for num in b:
idx_a = bisect_left(a, num)
idx_c = bisect_right(c, num)
cnt = idx_a * (len_c - idx_c)
total += cnt
print(total)
|
p03557 | s564902437 | Accepted | import bisect
(n,),aa,bb,cc = [sorted(list(map(int, s.split()))) for s in open(0)]
ans = 0
for b in bb:
ans += (bisect.bisect_left(aa,b))*(n-bisect.bisect_right(cc,b))
print(ans) |
p03481 | s016019792 | Accepted | x, y = map(int, input().split())
count = 0
while y >= x:
count += 1
y = y // 2
print(count) |
p02988 | s281223666 | Accepted | import statistics
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(n-2):
l2=[l[i],l[i+1],l[i+2]]
if statistics.median(l2)==l[i+1]:
ans+=1
print(ans) |
p02973 | s063602925 | Wrong Answer | import bisect
N = int(input())
A = [-int(input()) for _ in range(N)]
p = [A[0]]
for i in A[1:]:
if p[-1] <= i:
p.append(i)
else:
p[bisect.bisect_left(p,i)] = i
print (len(p)) |
p02743 | s485125687 | Accepted | a,b,c=map(int,input().split())
n=c-a-b
if n > 0 and n**2 > 4*a*b:
print("Yes")
else:
print("No") |
p02633 | s770627013 | Accepted | x=int(input())
for i in range(1,361):
if (i*x)%360==0:
print(i)
break |
p02802 | s209235698 | Accepted | n,m=map(int,input().split())
ac=[0]*n
pn=[0]*n
for i in range(m):
ps=input().split()
p=int(ps[0])-1
s=ps[1]
if ac[p]:
continue
if s=='AC':
ac[p]=1
else:
pn[p]+=1
acs=sum(ac)
pns=sum([x for i,x in enumerate(pn) if ac[i]])
print(acs, pns) |
p02700 | s299833709 | Accepted | a, b, c ,d = map(int, input().split())
while True:
c = c - b
if c <= 0:
print('Yes')
break
a = a - d
if a <= 0:
print('No')
break
|
p03493 | s890215878 | Wrong Answer | n=int(input())
print(n%3) |
p03612 | s733100346 | Accepted | input()
cnt, ans = 0, 0
for i, p in enumerate(map(int, input().split()), start=1):
if i == p:
cnt += 1
else:
ans += (cnt + 1) // 2
cnt = 0
else:
ans += (cnt + 1) // 2
print(ans) |
p02577 | s536840444 | Accepted | n = input()
ans = 0
for i in n:
ans += int(i)
if ans%9 == 0:
print('Yes')
else:
print('No')
|
p02689 | s870479356 | Accepted | n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
neighbor = [[] for _ in range(n)]
for i in range(m):
a, b = list(map(int, input().split()))
neighbor[a - 1].append(b - 1)
neighbor[b - 1].append(a - 1)
cnt = 0
for i in range(n):
if all([h[i] > h[j] for j in neighbor[i]]):
cnt += 1
print(cnt) |
p03487 | s553819065 | Accepted | n=int(input())
li = list(map(int,input().split()))
dic={}
for i in li:
if i not in dic:
dic[i] = 1
elif dic[i] >= 1:
dic[i] += 1
#print(dic)
cnt = 0
for i in dic:
#print(i)
#print(dic[i])
if i>dic[i]:
cnt += dic[i]
else:
cnt += dic[i]-i
print(cnt) |
p02748 | s139824699 | Accepted | A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
xyc = [list(map(int, input().split())) for _ in range(M)]
ans = min(a) + min(b)
for i, (xi, yi, ci) in enumerate(xyc):
ans = min(ans, max(0, a[xi - 1] + b[yi - 1] - ci))
print(ans) |
p03457 | s786317676 | Wrong Answer | N = int(input())
bt, bx, by = 0, 0, 0
flg = True
for i in range(N):
t, x, y = map(int, input().split())
dist = abs(x-bx)+abs(y-by)
time = t-bt
if time<dist and time%2!=dist%2:
flg = False
break
else:
bt, bx, xy = t, x, y
if flg:
print('Yes')
else:
print('No') |
p03493 | s229496933 | Accepted | s=input()
print(s.count("1"))
|
p02691 | s741808587 | Accepted | from collections import defaultdict
import bisect
N = int(input())
A = list(map(int,input().split()))
plus = [A[i]+(i+1) for i in range(N)]
diff = [-A[i]+(i+1) for i in range(N)]
plusc = defaultdict(list)
for i in range(N):
plusc[plus[i]].append(i)
ans = 0
for i in range(1,N):
ans += bisect.bisect_left(plusc[diff[i]],i)
print(ans) |
p02647 | s156494853 | Accepted | import math
from itertools import accumulate
n, k = map(int, input().split())
As = list(map(int, input().split()))
for i in range(min(41, k)):
_As = [0]*(n+1)
for j in range(n):
l = max(0, j - As[j])
r = min(n - 1, j + As[j])
_As[l] += 1
_As[r+1] -= 1
As = list(accumulate(_As))[:-1]
print(' '.join([str(A) for A in As])) |
p03693 | s864196802 | Accepted | r,g,b=map(int,input().split())
if (r*100+g*10+b)%4==0:
print('YES')
else:
print('NO') |
p02779 | s821562695 | Wrong Answer | from sys import stdin
def get_result(data):
N, A = data[0], data[1]
return 'Yes' if len(list(set(A))) == len(A) else 'NO'
if __name__ == '__main__':
raw_data = [val.rstrip('\n') for val in stdin.readlines()]
data = [list(map(int, val.split(' '))) for val in raw_data]
result = get_result(data)
print(result)
|
p03680 | s178187564 | Wrong Answer | n = int(input())
a= [int(input()) for _ in range(n)]
count = 0
now = a[0]
while now != 2 and count < n:
now = a[now-1]
count += 1
print(count if count<n else -1) |
p03437 | s157901818 | Wrong Answer | # 8 = 2 * 2 * 2
# 6 = 2 * 3
x,y= map(int,(input().split()))
result = 0
if x % y == 0:
result = -1
else:
result = x * 2
print(result)
|
p04029 | s144908493 | Accepted | n = int(input())
print(n * (n+1) // 2)
|
p04020 | s874421630 | Accepted | N=int(input())
A=[int(input()) for _ in range(N)]
ans=A[0]//2
res=A[0]%2
for i in range(1,N):
ans+=(A[i]+res)//2
if A[i]>0:
res=(A[i]+res)%2
else:
res=0
print(ans) |
p02861 | s298485321 | Wrong Answer | from itertools import permutations
from math import sqrt, pow, factorial
N = int(input())
l = [list(map(int, input().split())) for _ in range(N)]
print(l)
def calc(a, b):
[x1, y1] = a
[x2, y2] = b
return sqrt(pow(x1 - x2, 2) + pow(y1 -y2, 2))
ans = 0
for order in permutations(range(N)):
tmp = 0
for i in range(1, N):
tmp += calc(l[order[i]], l[order[i-1]])
ans += tmp
print(ans/factorial(N))
|
p03035 | s395379712 | Accepted | a,b= map(int,input().split())
if a >= 13:
print(b)
elif a > 5:
print(b//2)
elif a <= 5:
print(0) |
p02888 | s112297456 | Wrong Answer | N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
count = 0
for i in range(N-1):
l = 0
r = i -1
while(l< r):
if (A[l] + A[r] >A[i]):
count += (r-l)
r -= 1
else:
l += 1
print(count)
|
p03695 | s268511175 | Wrong Answer |
N = int(input())
A = list(map(int,input().split()))
colors = [0] * 8
for a in A:
index = min (a // 400,7)
colors[index] += 1
min_color = sum([1 for c in colors if c != 0])
max_color = min(min_color+colors[-1]-1,7)
print(min_color,max(min_color,max_color))
|
p03160 | s737821571 | Accepted | N=int(input()) # 足場の数
H=list(map(int,input().split(" "))) # 足場の高さ
C=[0 for _ in range(N)] # 各足場までの最小コスト
for i in range(1,N):
if i==1: # 2つ目のは1つ目から移るしかない
C[1]=C[0]+abs(H[1]-H[0])
else: # 3つ目以降
C[i]=min(C[i-1]+abs(H[i]-H[i-1]),C[i-2]+abs(H[i]-H[i-2]))
print(C[-1]) # 最後の足場に行く最小コスト |
p03997 | s172208431 | Wrong Answer | a = int(input())
b = int(input())
h = int(input())
s = 0.5 * (a + b) * h |
p02882 | s222634288 | Wrong Answer | import math
a, b, x = map(int, input().split())
ans = a * (b**2) / (2 * x)
e = 90
s = 0
while e - s > 10**(-8):
m = (e + s) / 2
z = math.tan(math.radians(m))
if z == ans:
s = m
break
elif z > ans:
e = m
else:
s = m
print(s)
|
p02755 | s637494053 | Wrong Answer | #O(1)
from math import ceil
a,b = map(int, input().split( ))
if int(min(a/0.08,b/.01))<ceil(max(a/0.08,b/0.1)):
print(-1)
exit()
print(ceil(max(a/0.08,b/0.1)))
|
p03617 | s804659613 | Accepted | import sys
def input():
return sys.stdin.readline()[:-1]
q,h,s,d=map(int,input().split())
n=int(input())
li=[[0.25,q],[0.5,h],[1,s]]
li.sort(key=lambda x: x[1]/x[0])
li=[[1,int(li[0][1]/li[0][0])],[2,d]]
li.sort(key=lambda x: x[1]/x[0])
# print(li)
ans=0
now=0
for i in range(2):
ko=(n-now)//li[i][0]
ans+=ko*li[i][1]
now+=ko*li[i][0]
now=int(now)
# print(ans,now)
print(int(ans)) |
p02767 | s572361484 | Wrong Answer | n = int(input())
x = list(map(int, input().split()))
mid = int(sum(x)/n)
ans = 1000000000
total = 0
for j in range(x[0], x[n-1]):
for i in range(n):
total += (x[i] - j)**2
if total < ans:
ans = total
total = 0
print(ans) |
p02607 | s820037100 | Wrong Answer | N= map(int, input())
a = list(map(int,input().split())) |
p03778 | s120292289 | Accepted | W,a,b = map(int, input().split())
if (a <= b <= a+W) or (a <= b+W <= a+W):
print(0)
else:
if a+W < b:
print(abs(b-(a+W)))
elif b+W < a:
print(abs(a-(b+W))) |
p02598 | s380589455 | Wrong Answer | import math
N, K = list(map(int,input().split()))
A = list(map(int,input().split()))
def is_ok(mid):
cnt = 0
for i in range(N): cnt += math.floor(A[i] / mid)
return cnt <= K
def binary_search(left, right):
while (abs(right - left) > 1):
mid = (left + right) // 2
if is_ok(mid): right = mid
else: left = mid
return right
if K == 0: print(max(A))
else:
left = max(A) + 1
right = 0
ret = binary_search(right, left)
print(ret) |
p03548 | s923234018 | Wrong Answer | x,y,z=map(int,input().split())
x-=z
c=0
while y<=x:
x-=y
x-=z
c+=1
print(c-1)
|
p03759 | s864441683 | Accepted | import sys
import math
import bisect
def main():
a, b, c = map(int, input().split())
if a + c == b * 2:
print('YES')
else:
print('NO')
if __name__ == "__main__":
main()
|
p02546 | s268181981 | Accepted | s = input()
if s[len(s)-1] == "s":
print(s + "es")
else:
print(s + "s") |
p02696 | s059319473 | Accepted | def main():
a, b, n = map(int, input().split())
ans = int(a * min(b - 1, n) / b) - a * int(min(b - 1, n) / b)
print(ans)
if __name__ == '__main__':
main()
|
p03073 | s656568038 | Wrong Answer | S=list(input())
A=[]
B=[]
a=0
b=0
for i in range(len(S)):
if i%2==0:
A.append("0")
else:
A.append("1")
for i in range(len(S)):
if A[i]!=S[i]:
a+=1
for j in range(len(S)):
if i%2==0:
B.append("1")
else:
B.append("0")
for j in range(len(S)):
if B[j]!=S[j]:
b+=1
print(min(a, b)) |
p02597 | s612886403 | Accepted | n = int(input())
c = input()
a = c.count("R")
ans = 0
for i in range(a):
if c[i] == "W":
ans += 1
print(ans) |
p02707 | s998488555 | Accepted |
# coding: utf-8
DATA = """
5
1 1 2 2
""".split("\n")
def get_debug_line():
for i in DATA:
yield i
if 1:
get_line = input
else:
get_line = get_debug_line().__next__
get_line()
N = int(get_line().strip())
Memo = [0] * (N+1)
for i in get_line().strip().split(" "):
i = int(i)
Memo[i] += 1
for i in range(1, N+1):
print (Memo[i])
|
p02641 | s865174496 | Wrong Answer | X, N= list(map(int, input().split()))
P = list(map(int, input().split()))
if N == 0:
print(X)
else:
for i in range(1, 51):
try:
P.index(X - i)
except Exception:
print(X - i)
break
try:
P.index(X + i)
except Exception:
print(X + i)
break |
p02756 | s919040342 | Accepted | B = input()
order = True
F = ""
for q in range(int(input())):
T = input().rstrip().split()
if T[0] == "1":
order ^= True
else:
f,c = T[1],T[2]
if not((f == "1") ^ order):
F += c
else:
B += c
#print(F,B)
F = F[::-1]+B
if not order:
F = F[::-1]
print(F) |
p02946 | s862234950 | Wrong Answer | a,b=map(int,input().split())
c=list(range(b-(a-1),b+(a-1)+1))
print(c)
d=' '.join(map(str,c))
print(d) |
p02861 | s542350249 | Accepted | import math
n = int(input())
town = []
ans = 0
for i in range(n):
town.append(list(map(int,input().split())))
for i in range(n):
for s in range(i,n):
ans += math.sqrt((town[i][0]-town[s][0])**2+(town[i][1]-town[s][1])**2)
print(ans*2/n) |
p03107 | s709057973 | Accepted | def main():
s = input()
zero = s.count("0")
one = s.count("1")
print(min(zero, one) * 2)
main() |
p03012 | s197882261 | Wrong Answer | n=int(input())
w=list(map(int,input().split()))
m = sum(w)//2
s = 0
for i in range(n):
s += w[i]
if s >= m:
if s == m:
print(0)
break
else:
print(abs(m-s)+1)
break |
p02811 | s473229076 | Accepted | k,x=map(int,input().split())
if(500*k>=x):
print("Yes")
else:
print("No") |
p03345 | s497817957 | Accepted | a,b,c,k=map(int,input().split())
if k%2==1:
print(b-a)
else:
print(a-b) |
p02695 | s539551457 | Wrong Answer | li=[]
ld=[]
k=0
ans=0
n,m,q=map(int,input().split())
A=[1]*n
for i in range(q):
a,b,c,d=map(int,input().split())
li.append([a,b,c])
ld.append(d)
if d>k:
k=d
for i in range(q):
dm=sorted(ld,reverse=True)[i]
lia=li[ld.index(dm)]
if A[lia[1]-1]==1:
A[lia[1]-1]=A[lia[1]-lia[0]-1]+lia[2]
ans+=dm
print(ans) |
p02711 | s466229628 | Wrong Answer | s = input()
l = [int(x) for x in s]
if l[0] == 7 or l[1] == 7 or l[2] == 7:
print('YES')
else:
print('NO') |
p03827 | s444209031 | Accepted | n=int(input())
s= [1 if c=="I" else -1 for c in input() ]
ans=[0]
for i in range(n):
ans.append(sum(s[:i+1]))
print (max(ans))
|
p03612 | s770047995 | Accepted | N = int(input())
p = list(map(int,input().split()))
ans = 0
k = 0
while k < N:
if p[k] == k+1:
k += 1
ans += 1
k += 1
print(ans)
|
p02801 | s319897050 | Wrong Answer | import numpy as np
let= raw_input()
letters="abcdefghijklmnopqrstuvwxyz"
print( letters[np.argmax(let)+1])
|
p02630 | s147988262 | Accepted | n = int(input())
a = list(map(int,input().split()))
s = sum(a)
#print(ans)
q = int(input())
import collections
cc = collections.Counter(a)
#print(cc)
for i in range(q):
b,c = map(int,input().split())
tmp = cc[b]
cc[b] = 0
s=s-b*tmp+c*tmp
cc[c]+=tmp
print(s) |
p03698 | s657400969 | Accepted | s = input()
if len(set(s)) - len(s) == 0:
print('yes')
else:
print('no') |
p02701 | s789298662 | Wrong Answer | N=int(input())
list=[]
for i in range(N):
list.append(input())
print(len(list)) |
p02820 | s600588566 | Accepted | n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=input()
Pt=[0,p,r,s]
Ans=[0]*k
Prev=[0]*k
for i in range(n):
if t[i]=="r":
cur=1
elif t[i]=="s":
cur=2
else:
cur=3
ii=i%k
if Prev[ii]==cur:
Prev[ii]=0
else:
Ans[ii]+=Pt[cur]
Prev[ii]=cur
print(sum(Ans)) |
p02933 | s261976326 | Accepted | # -*- coding: utf-8 -*-
a = int(input())
s = str(input())
if a >= 3200:
print(s)
else:
print('red') |
p02556 | s351963767 | Accepted | #
import sys
input=sys.stdin.readline
def main():
N = int(input())
R = [tuple(map(int, input().split())) for i in range(N)]
A = sorted(R, key = lambda x: x[0] + x[1])
B = sorted(R, key = lambda x: x[0] - x[1])
a = abs(A[-1][0] - A[0][0]) + abs(A[-1][1] - A[0][1])
b = abs(B[-1][0] - B[0][0]) + abs(B[-1][1] - B[0][1])
print(max(a, b))
if __name__=="__main__":
main()
|
p02622 | s506251396 | Accepted | s=list(input())
t=list(input())
ans=0
for i in range(len(s)):
if s[i]!=t[i]:
ans+=1
print(ans) |
p02657 | s377660103 | Accepted | A, B = map(int, input().split())
print(A * B)
|
p02699 | s561596540 | Wrong Answer | s, w = map(int, input().split()) # 入力
if w >= s / 2:
ans = 'unsafe'
else:
ans = 'safe'
print(ans)
|
p03127 | s182091587 | Accepted | import math
n = int(input())
a = list(map(int,input().split()))
ans = a[0]
for i in range(n-1):
ans = math.gcd(ans,a[i+1])
print(ans) |
p02786 | s664504098 | Accepted | import math
h=int(input())
i=int(math.log(h,2))
print((2**(i+1))-1) |
p03773 | s104048759 | Accepted | print(eval(input().replace(" ","+"))%24) |
p03639 | s427388539 | Accepted | N = int(input())
A = list(map(int, input().split()))
eight = 0
one = 0
two = 0
for i in A:
if i%4 == 0:
eight = eight + 1
if i == 1:
one = one + 1
if i % 2 == 0 and i % 4 != 0:
two = two + 1
if len(A)//2 <= eight:
print("Yes")
elif (len(A)//2) <= (eight + (two//2)):
print("Yes")
elif (eight >= one) and (eight + one +(two//2)) > (len(A)//2):
print("Yes")
else:
print("No")
|
p02681 | s832451519 | Wrong Answer | S=input()
T=input()
if T.startswith(S):
if len(T)==len(S)+1:
print('YES')
else:
print('NO') |
p02706 | s911401155 | Accepted | (n,m)=map(int,input().split())
a=list(map(int,input().split()))
i=max(-1,n-sum(a))
print(i) |
p03252 | s318795572 | Accepted | from collections import defaultdict
s=input()
t=input()
n=len(s)
ss=defaultdict(list)
tt=defaultdict(list)
for i in range(n):
ss[s[i]].append(i)
tt[t[i]].append(i)
sss=[]
ttt=[]
for k,v in ss.items():
sss.append(v)
for k,v in tt.items():
ttt.append(v)
sss.sort()
ttt.sort()
ans="No"
if sss==ttt:
ans="Yes"
print(ans)
|
p03146 | s367791259 | Accepted | #!/usr/bin/env python3
S = int(input())
if S == 1 or S == 2 or S == 4:
print(4)
exit()
A = [S]
e = S
cnt = 0
while True:
if e % 2 == 0:
v = e//2
else:
v = 3*e+1
A.append(v)
e = v
cnt += 1
if v == 4:
print(cnt+4)
exit()
|
p03011 | s638391223 | Accepted |
url = "https://atcoder.jp//contests/abc129/tasks/abc129_a"
def main():
p, q, r = list(map(int, input().split()))
print(sum([p,q,r]) - max(p,q,r))
if __name__ == '__main__':
main()
|
p03943 | s075730834 | Accepted | a, b, c = map(int, input().split())
jdg = False
if a + b == c: jdg = True
if b + c == a: jdg = True
if c + a == b: jdg = True
print( 'Yes' if jdg else 'No') |
p04005 | s783256578 | Accepted | a,b,c = map(int,input().split())
res = 0
if a*b*c%2!=0:
res = min([a*b,b*c,c*a])
print(res)
|
p03038 | s311828393 | Wrong Answer | import math
n, m = map(int, input().split(" "))
aL = sorted(list(map(int, input().split(" "))))
bcL = sorted([list(map(int,
input().split(" "))) for _ in range(m)],
key=lambda x: x[1],
reverse=True)
csl = 0
for cnt, point in bcL:
for i in range(cnt):
if aL[csl] >= point or csl == n - 1:
print(sum(aL))
exit()
aL[csl] = point
csl += 1
print(sum(aL))
exit() |
p02700 | s612042808 | Accepted | a, b, c, d=map(int,input().split())
for i in range(100):
c = c -b
if c <= 0:
print('Yes')
break
a = a - d
if a <= 0:
print('No')
break |
p03951 | s201641025 | Wrong Answer | n=int(input())
s=input()
t=input()
for i in range(n):
if s[n-i-1:]==t[:i+1]:
print(2*n-i-1)
exit()
print(2*n) |
p02688 | s052999777 | Wrong Answer | n,k = map(int,input().split())
import itertools
grid = []
for i in range(2*k):
array = list(map(int, input().strip().split()))
grid.append(array)
print(grid)
l = []
for j in range (k):
l.append(grid[0+2*j+1])
print(l)
lis = list(itertools.chain.from_iterable(l))
print(lis)
count = 0
for m in range(n):
if m+1 in lis:
count = count +1
print(n - count) |
p02572 | s142752644 | Accepted | N = int(input())
A = list(map(int, input().split()))
M = 0
sum = 0
for i in range(N):
sum += A[i]
for i in range(N-1):
sum = sum - A[i]
M += A[i] * sum
if M > 10 ** 9 + 7:
M = M % (10 ** 9 + 7)
print(M) |
p03605 | s352233399 | Accepted | n = list(input())
if n[0] == "9" or n[1] == "9":
print("Yes")
else:
print("No") |
p02645 | s748912199 | Accepted | name = input()
print(name[:3]) |
p02777 | s306570343 | Accepted | s, t = input().split()
a, b = map(int, input().split())
u = input()
if u == s:
print(a-1,b)
else: print(a,b-1) |
p02797 | s453850802 | Accepted | n, k, s = map(int, input().split())
ans = [0] * n
for i in range(k): ans[i] = s
for i in range(k, n): ans[i] = s+1-2*(s==1e9)
print(*ans) |
p03605 | s610064659 | Accepted | N = input()
if ("9" in N):
print("Yes")
else:
print("No")
|
p03095 | s776016780 | Wrong Answer | n = int(input())
s = input()
d = {}
for x in s:
if x in d:
d[x] += 1
else:
d[x] = 1
ans = 1
for x in d.values():
ans *= x+1
print(ans - 1) |
p02787 | s856029987 | Wrong Answer | H,N = map(int,input().split())
T = []
for i in range(N):
a,b = map(int,input().split())
T.append([a,b])
dp = [10**9]*(H+10**3+1)
dp[0] = 0
for i in range(1,H+10**3+1):
for j in range(N):
if i - T[j][0] >= 0:
dp[i] = min(dp[i],dp[i-T[j][0]]+T[j][1])
for i in range(H,H+10**3+1):
if dp[i] != 10**9:
print(dp[i])
break |
p03796 | s148674090 | Accepted | n = int(input())
power = 1
for i in range(1, n+1):
power = (power * i) % 1000000007
print(power)
|
p03817 | s681525848 | Wrong Answer | N = int(input())
def solve(N):
ans = 0
a = (N // 11) * 2
b = N % 11
if b == 0:
ans = a
elif 0 < b <= 5:
ans = a + 1
else:
ans = a + 2
return ans
print(solve(N-1)) |
p03774 | s131525077 | Accepted | # ABC057
# B
# Checkpoints
n, m = map(int, input().split())
ax = [None]*n
by = [None]*n
cx = [None]*m
dy = [None]*m
d_list = [[None]*m for i in range(n)]
for i in range(n):
ax[i],by[i] = map(int, input().split())
for i in range(m):
cx[i],dy[i] = map(int, input().split())
for i in range(n):
for j in range(m):
d_list[i][j] = abs(ax[i]-cx[j]) + abs(by[i]-dy[j])
for i in range(n):
print(d_list[i].index(min(d_list[i]))+1)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.