problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p02720 | s309606318 | Accepted | import queue
k = int(input())
q = queue.Queue()
for i in range(1,10):
q.put(i)
cnt = 0
runrun = 0
while cnt < k:
runrun = q.get()
cnt += 1
if runrun % 10 != 0:
q.put(10 * runrun + (runrun % 10) - 1)
q.put(10 * runrun + (runrun % 10))
if runrun % 10 != 9:
q.put(10 * runrun + (runrun % 10) + 1)
print(runrun) |
p02552 | s506507088 | Wrong Answer | x = input()
if x == 0:
print(1)
if x == 1:
print(0)
|
p03448 | s594354415 | Wrong Answer | a = [ int(input()) for i in range(4) ]
count = 0
for k in range(a[2]+1):
for j in range(a[1]+1):
for i in range(a[0]+1):
total = 50 * i + 100 * j + 500 * k
if total == a[3]:
count += 1
print(count) |
p02645 | s830206448 | Accepted | s=input()
print(s[:3]) |
p02911 | s387775770 | Accepted | N,K,Q = map(int,input().split())
scores = [K] * N
for i in range(Q):
a = int(input())
scores[a - 1] += 1
for s in scores:
print(("No","Yes")[s - Q > 0])
|
p02712 | s800680980 | Accepted | N = int(input())
ans = 0
for i in range(1, N + 1):
if i % 3 == 0 or i % 5 == 0:
continue
ans += i
print(ans)
|
p02917 | s550836498 | Wrong Answer | N = int(input())
B = list(map(int,input().split()))
A = []
A.append(B[0])
A.append(B[0])
for i in range(1,N-2):
A.append(min(B[i],B[i+1]))
if N > 2:
A.append(B[N-2])
print(sum(A))
|
p02897 | s429615511 | Accepted | n = int(input())
s = 0
for i in range(1, n+1):
if i % 2 != 0:
s += 1
print(s/n) |
p02693 | s941304683 | Accepted | k = int(input())
a, b = map(int, input().split())
f = False
for i in range(a, b + 1):
if i % k == 0:
f = True
if f:
print('OK')
else:
print('NG')
|
p03672 | s491676039 | Accepted | s=list(input())
s=s[:-2]
while s:
n=len(s)//2
p=s[:n]
q=s[n:]
if p==q:
print(2*n)
break
else:
s=s[:-2] |
p03494 | s209085598 | Accepted | n = int(input())
a = list(map(int, input().split()))
ret = 0
flg = False
while flg == False:
for i in range(len(a)):
if(a[i] == 0 or a[i]%2 != 0):
flg = True
else:
a[i] = a[i]/2
if not flg:
ret += 1
print(ret)
|
p03607 | s336430519 | Accepted | # https://atcoder.jp/contests/abc073/tasks/abc073_c
n = int(input())
nums = []
for _ in range(n):
nums.append(int(input()))
s = set()
for num in nums:
if num in s:
s.remove(num)
else:
s.add(num)
ans = len(s)
print(ans) |
p03107 | s183943553 | Accepted | S = input()
A = S.count("0")
B = S.count("1")
print(2*min(A, B)) |
p02554 | s196048080 | Accepted | N = int(input())
M = 1000000007
t, t1, t2 = 1, 1, 1
for _ in range(N):
t, t1, t2 = t*10, t1*9, t2*8
t, t1, t2 = t%M, t1%M, t2%M
print((t - t1*2 + t2) % M)
|
p02598 | s305059447 | Accepted | from decimal import Decimal
from heapq import heapify, heappop, heappush
N, K = map(int, input().split())
*A, = map(int, input().split())
tot = sum(A)
ng = 0
ok = 10**9
m = 4
while ng + 1 < ok:
m = (ng+ok)//2
c = sum((a-1)//m for a in A)
if c > K:
ng = m
else:
ok = m
print(ok)
|
p03241 | s950254077 | Accepted | import math
n, m = map(int, input().split())
if m%2 == 0:
divisor = [1, 2, m//2, m]
else:
divisor = [1, m]
for i in range(3, int(math.sqrt(m))+1):
if m%i == 0:
divisor.append(i)
divisor.append(m//i)
divisor = sorted(divisor, reverse=True)
a = m//n
for i in divisor:
if i > a:
continue
if (m-(m//i*i))%i == 0:
break
print(i)
|
p02923 | s155509734 | Accepted | n = int(input())
h = list( map(int,input().split()) )
x = [0] * (n+1)
c = h[0]
for i in range(1,n):
if h[i] <= c:
x[i] = 1
c = h[i]
ans = 0
tmp = 0
for i in x:
if i == 1:
tmp += 1
else:
ans = max(ans,tmp)
tmp = 0
print(ans) |
p03544 | s916531455 | Wrong Answer | n = int(input())
l0 = 2
l1 = 1
cnt = 2
l2 = l0 + l1
while cnt < n:
l2, l1, l0 = l2 + l1, l2, l1
cnt += 1
print(l2) |
p03127 | s689063133 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
while len(a) > 0:
m = min(a)
a = [a[i]%m for i in range(len(a)) if a[i]%m > 0]
print(m)
|
p03796 | s864182774 | Wrong Answer | n= int(input())
cnt = 1
for i in range(1,n+1):
cnt *= i
print(cnt//(10**9+7)) |
p03821 | s763023922 | Accepted | n=int(input())
a=[list(map(int,input().split())) for i in range(n)][::-1]
b=0
for i in range(n):
if (b+a[i][0])%a[i][1]==0:
continue
b+=a[i][1]-(b+a[i][0])%a[i][1]
print(b) |
p02879 | s364704310 | Accepted | A,B=map(int,input().split())
if A <10 and B <10:
print(A*B)
else:
print("-1")
|
p03239 | s386338235 | Accepted | n,t = map(int,input().split())
ct = [0]*n
for i in range(0,n):
ct[i] = input().split()
s = []
for i in range(0,n):
if(int(ct[i][1]) <= t):
s.append(int(ct[i][0]))
if(len(s) != 0):
print(min(s))
else:
print("TLE") |
p03944 | s707323177 | Wrong Answer | w,h,n=map(int,input().split())
A=[0,w,0,h]
for i in range(n):
x,y,a=map(int,input().split())
if a==1:
A[0]=max(A[0],x)
elif a==2:
A[1]=min(A[1],x)
elif a==3:
A[2]=max(A[2],y)
else:
A[3]=min(A[3],y)
squ=(A[1]-A[0])*(A[3]-A[2])
print(squ if squ>=0 else 0) |
p02843 | s098208382 | Wrong Answer | x = int(input())
a = x-x//100*100
print(1) if a//5+1 <= x//100 else 0
|
p02714 | s399682475 | Accepted | N = int(input())
S = input()
cR = len([1 for s in S if s == 'R'])
cG = len([1 for s in S if s == 'G'])
cB = len([1 for s in S if s == 'B'])
# 条件2を無視したときの組の数
_all = cR * cG * cB
# 条件2でNGになるような組の数
ng_condition2 = 0
for i in range(N-1):
for j in range(i+1, N):
k = j+j-i
if k >= N:
break
if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
ng_condition2 += 1
print(_all - ng_condition2) |
p03145 | s397015636 | Wrong Answer | AB,BC,CU = input().split()
AB = int(AB)
BC = int(BC)
CU = int(CU)
if 1 <= AB <= 100:
if 1 <= BC <= 100:
if 1 <= CU <= 100:
area = (AB * BC )/ 2
print(area) |
p03285 | s779081685 | Wrong Answer | a = int(input())
a = a%4
a = a%7
if a == 0:
print('Yes')
else:
print('No') |
p02600 | s120675753 | Accepted |
a=int(input())
if a>=1800:
print(1)
elif a>=1600 and a<1800:
print(2)
elif a>=1400 and a<1600:
print(3)
elif a>=1200 and a<1400:
print(4)
elif a>=1000 and a<1200:
print(5)
elif a>=800 and a<1000:
print(6)
elif a>=600 and a<800:
print(7)
elif a>=400 and a<600:
print(8) |
p02701 | s850175962 | Accepted | N = int(input())
output = []
for i in range(N):
S = input()
output.append(S)
print(len(set(output)))
|
p03254 | s374140490 | Accepted | from itertools import accumulate
N, X = [int(x) for x in input().split()]
a = sorted([int(x) for x in input().split()])
p = list(accumulate(a))
result = 0
for i, x in enumerate(p):
if X < x:
break
if i == N-1 and x != X:
break
result += 1
print(result) |
p02595 | s610527375 | Accepted | n,d = map(int,input().split())
count = 0
for i in range(n):
x,y = map(int,input().split())
sum = x**2 + y**2
if sum**0.5 <= d:
count += 1
print(count) |
p03605 | s315680081 | Accepted | N=input()
N1=int(N[0])
N2=int(N[1])
print("Yes" if N1==9 or N2==9 else "No") |
p03160 | s259727800 | Accepted | n = int(input())
n_list = list(map(int, input().split()))
dp = [-1]*n
dp[0] = 0
dp[1] = abs(n_list[1]-n_list[0])
for i in range(2,n):
dp[i] = min(abs(n_list[i]-n_list[i-1])+dp[i-1], abs(n_list[i]-n_list[i-2])+dp[i-2])
print(dp[n-1]) |
p03011 | s359968398 | Accepted | p,q,r=map(int,input().split())
print(min(p+q,p+r,q+r)) |
p02597 | s407675396 | Accepted | def main():
N = int(input())
S = input()
border = S.count("R")
ans = 0
for i in range(N):
if S[i] == "W" and i < border:
ans += 1
print(ans)
if __name__ == "__main__":
main()
|
p02690 | s708503514 | Accepted | x = int(input())
for i in range(-119, 120):
for j in range(-119, 120):
if i**5 - j**5 == x:
print(i,j)
exit() |
p03705 | s382114985 | Wrong Answer | if __name__ == "__main__":
n, a, b = list(map(int, input().split()))
ans = 0
if b > a and n > 2:
ans = (n - 2) * b - (n - 2) * a + 1
elif n == 1 and a == b:
ans = 1
elif n == 2 and b > a:
ans = 1
print(ans)
|
p02917 | s989407755 | Accepted | N=int(input())
B=list(map(int, input().split()))
B.append(B[len(B)-1])
A=[0]*N
A[0]=B[0]
for i in range(1,N):
A[i]=min(B[i-1],B[i])
print(sum(A)) |
p02897 | s272948312 | Accepted | n = int(input())
if n%2 == 0:
print(float((n//2)/n))
elif n == 1:
print(float(1))
else:
print(float((n//2 + 1)/n)) |
p03779 | s607591525 | Accepted | from math import ceil, sqrt
def main():
target = int(input())
print(ceil((-1 + sqrt(1 + 8 * target)) / 2))
if __name__ == '__main__':
main()
|
p02582 | s963431059 | Wrong Answer | S = input()
cnt = 0
for i in range(3):
if S[i] == "R":
cnt += 1
print(cnt) |
p03449 | s238175197 | Wrong Answer | n=int(input())
p=list(map(int, input().split()))
q=list(map(int, input().split()))
ans = sum(p)+q[n-1]
for i in range(2, n-2):
tmp = ans + q[n-i] - p[n-i+1]
ans = max(ans, tmp)
print(ans) |
p02676 | s175589440 | Accepted | K = int(input())
S = input()
text = ''
if len(S) > K:
text = S[:K] + '...'
else:
text = S
print(text) |
p02792 | s985821993 | Accepted | n = int(input())
grid = [[0 for i in range(9)] for j in range(9)]
ans = 0
for i in range(1, n+1):
s = str(i)
if int(s[0]) == 0 or int(s[-1]) == 0:
continue
grid[int(s[0])-1][int(s[-1])-1] += 1
for i in range(9):
for j in range(i, 9):
if i == j:
ans += grid[i][j] * grid[j][i]
else:
ans += (grid[i][j] * grid[j][i])*2
print(ans) |
p03328 | s802311985 | Wrong Answer | a, b = map(int, input().split())
print(0.5*(b-a)*(b-a-1)-a)
|
p04043 | s714020126 | Wrong Answer | a,b,c = map(int,input().split())
print("YES" if a*b*c == 35 else "NO")
|
p03835 | s385848446 | Accepted | K, S=map(int, input().split())
s=S-2*K if S-2*K>0 else 0
e=S if S<K else K
ans=0
for Z in range(s, e+1):
if S-Z>K:
ans+=2*K+Z-S+1
else:
ans+=S-Z+1
print(ans) |
p04043 | s960563546 | Wrong Answer | L=sorted(map(int, input().split()))
if L==[5, 5, 7]:
ans='Yes'
else:
ans='No'
print(ans) |
p02761 | s805247338 | Wrong Answer | N,M=map(int,input().split())
nums={}
for i in range(M):
s,c=map(str,input().split())
if s in nums.keys():
if nums[s]!=c:
ans=-1
print(ans)
exit()
else:
nums[s]=c
for i in range(1,N+1):
if str(i) not in nums.keys():
nums[str(i)]='0'
n=[]
for i in sorted(nums):
n.append(nums[i])
ans=int(''.join(n))
if len(list(str(ans)))!=N:
ans=-1
print(ans) |
p03472 | s833654242 | Accepted | import math
n,h = map(int,input().split())
s = []
max_a = 0
for i in range(n):
a,b = map(int,input().split())
max_a = max(a,max_a)
s.append((b,a))
if max_a >= h:
print(1)
exit()
s.sort(reverse=True)
ans = 10**9
i = 0
while h > 0 and i < n:
h -= s[i][0]
c = max(0,math.ceil(h/max_a))
ans = min(i+c+1,ans)
i += 1
print(ans) |
p02842 | s933813632 | Accepted | from math import ceil,floor
N=int(input())
X=ceil(N/1.08)
print(X if floor(X*1.08)==N else ":(")
|
p03137 | s696312861 | Accepted | N, M = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
D = []
for i in range(len(X)-1):
D.append(X[i+1]-X[i])
D.sort()
if N>=M:
print(0)
else:
print(sum(D[:M-N])) |
p02707 | s110669304 | Wrong Answer | N = int(input())
import collections
b = input().split()
c = collections.Counter(b)
d = list(c.values())
e = list(c.keys())
current = 0
for i in range(N):
if len(c) > current:
if e[current] == str(i + 1):
print(d[current])
current += 1
else:
print('0')
else:
print('0') |
p02802 | s510935718 | Accepted | n, m = map(int, input().split())
problem = [False] * n
count_wa = [0] * n
for _ in range(m):
num, res = input().split()
num = int(num) - 1
if res == 'AC':
problem[num] = True
else:
if problem[num] == False:
count_wa[num] += 1
else:
continue
a = sum(problem)
b = 0
for i in range(n):
if problem[i] == True:
b += count_wa[i]
print(a, b)
|
p03323 | s118472531 | Accepted | a,b = map(int, input().split())
if a <= 8 and b <= 8:
print('Yay!')
else:
print(':(') |
p03038 | s292886260 | Accepted | import sys
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
b = []
for _ in range(m):
b += [list(map(int, input().split()))]
b = sorted(b, key=lambda x: x[1], reverse=True)
for i in range(m):
for j in range(b[i][0]):
if a[0] < b[i][1]:
a.pop(0)
a.append(b[i][1])
else:
print(sum(a))
sys.exit()
print(sum(a))
|
p02706 | s374312217 | Accepted | import sys
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7
def resolve():
n, m = map(int, input().split())
A = list(map(int, input().split()))
if n >= sum(A):
print(n - sum(A))
else:
print(-1)
if __name__ == '__main__':
resolve()
|
p03126 | s780727096 | Accepted | N,M = map(int,input().split())
foods = [0] * (M+1)
for i in range(N):
line = list(map(int,input().split()))
for j in range(1,line[0]+1):
foods[line[j]] += 1
print(foods.count(N))
|
p02681 | s358740684 | Wrong Answer | a=list(input())
b=list(input())
a.append(b[-1])
print(a,b)
if a==b:
print("Yes")
else:
print("No") |
p03479 | s574917736 | Accepted | X,Y = map(int,input().split())
cnt = 0
while X <= Y:
X += X
cnt += 1
print(cnt) |
p03131 | s528622264 | Accepted | K, A, B = map(int, input().split())
if (B - A) <= 2:
print(K + 1)
elif K <= A:
print(K + 1)
else:
M = K - A + 1
ans = A + M // 2 * (B - A) + M % 2
print(ans)
|
p03672 | s309075209 | Accepted | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def main():
S = list(input())
for _ in range(len(S)):
S.pop()
if S[:len(S) // 2] == S[len(S) // 2:]:
print(len(S))
break
if __name__ == "__main__":
main()
|
p02555 | s525857252 | Accepted | MOD = 10 ** 9 + 7
S = int(input())
dp = [0] * (S + 1)
dp[0] = 1
for i in range(1, S + 1):
dp[i] = sum(dp[:max(0, i - 2)]) % MOD
print(dp[-1] % MOD)
|
p02843 | s895455258 | Accepted | x=int(input())
a=x//100
b=x%100
if a*5>=b:
print(1)
else:
print(0) |
p02881 | s094585376 | Accepted | n,a=int(input()),float("inf")
for i in range(1,5*10**6+1):
if n%i==0:j=n//i;a=min(a,i+j-2)
print(a) |
p03994 | s227238819 | Accepted | s = input()
k = int(input())
v = list(s)
n = len(s)
a = [0 for i in range(n)]
for i in range(n):
a[i] = (123 - ord(s[i]))%26
if k == 0:
break
if k >= a[i]:
v[i] = 'a'
k -= a[i]
if k > 0:
k %= 26
v[n-1] = chr(ord(v[n-1])+k)
print (''.join(v)) |
p03543 | s417834338 | Accepted | N=input()
if N[0]==N[1]==N[2] or N[3]==N[1]==N[2]:
print("Yes")
else:
print("No") |
p02645 | s691233165 | Accepted | s = input()
print(s[0:3]) |
p02963 | s139250858 | Accepted | # https://atcoder.jp/contests/agc036/tasks/agc036_a
S = int(input())
x1 = 0
y1 = 0
x2 = 1000000000
y2 = 1
v = 1000000000
x = (v - S % v) % v
y = (S + x) // v
print("{} {} {} {} {} {}".format(x1, y1, x2, y2, x, y)) |
p03632 | s717570035 | Accepted | A,B,C,D=map(int,input().split())
print(max(0,min(B,D)-max(A,C)))
|
p03419 | s476211284 | Accepted | N,M=list(map(int, input().split()))
if N!=1 and M!=1:
print((N-2)*(M-2))
elif N==M==1:
print(1)
elif N==1 and M!=1:
print(M-2)
else:
print(N-2) |
p03210 | s178101629 | Wrong Answer | x = int(input())
if x == 3 or x == 5 or x == 7:
print('Yes')
else:
print('No')
|
p02732 | s599686368 | Accepted | import collections
N=int(input())
lst=input().split()
s=0
dic=collections.Counter(lst)
for i in dic.values():
s+=(i*i-i)//2
for i in lst:
print(s+1-dic[i]) |
p03774 | s665703022 | Accepted | n,m = map(int,input().split())
A = {}
for i in range (1,n+1):
a,b = map(int,input().split())
A[i] = [a,b]
B = {}
for i in range(1,m+1):
c,d = map(int,input().split())
B[i] = [c,d]
for v in A.values():
t = float('inf')
ans = 0
for x,w in B.items():
if abs(v[0]-w[0])+abs(v[1]-w[1]) < t:
t = abs(v[0]-w[0])+abs(v[1]-w[1])
ans = x
print (ans)
|
p03339 | s685196004 | Accepted | n = int(input())
s = input()
e = [0] * (n + 1)
w = [0] * (n + 1)
for i in range(len(s)):
if s[i] == "E":
e[i+1] = e[i] + 1
w[i+1] = w[i]
else:
w[i+1] = w[i] + 1
e[i+1] = e[i]
ans = 10 ** 9
for i in range(0, n+1):
t = w[i] + e[n] - e[i]
ans = min(ans, t)
print(ans)
|
p03804 | s050553974 | Accepted | n,m = map(int,input().split())
a = [list(input())for i in range(n)]
b = [list(input())for i in range(m)]
for y in range(n-m+1):
for z in range(n-m+1):
count = 0
for p in range(m):
if b[p] == a[y+p][z:(z+m)]:
count += 1
if count == m:
print("Yes")
exit()
else:
count = 0
print("No")
|
p03285 | s788837914 | Accepted | N=int(input())
for i in range(26):
for j in range(15):
if 4*i + 7*j == N:
print('Yes')
exit()
print('No')
|
p02657 | s646103984 | Accepted | a, b = map(int, input().split())
print(a*b)
|
p03910 | s154392897 | Accepted | import sys
sys.setrecursionlimit(10**7)
def is_ok(m, n):
return m*(m+1)//2>=n
def meguru_bisect(ng, ok, n):
while (abs(ok - ng) > 1):
mid = (ok + ng) // 2
if is_ok(mid, n):
ok = mid
else:
ng = mid
return ok
def f(n):
if n>0:
m = meguru_bisect(0,10**7, n)
print(m)
f(n-m)
N = int(input())
f(N)
|
p02829 | s234993806 | Wrong Answer | A=int(input())
B=int(input())
if A==1 and B==2:
print(3)
elif A==2 and B==3:
print(1)
elif A==3 and B==1:
print(2) |
p02603 | s152162213 | Accepted | n = int(input())
a = list(map(int, input().split()))
cash = 1000
for buy, sell in zip(a, a[1:]):
if buy >= sell:
continue
stock, cash = divmod(cash, buy)
cash += stock * sell
print(cash) |
p03815 | s269384627 | Accepted | x=int(input())
kai=x//11
amari=x%11
if 1<=amari<=6:
print(2*kai+1)
elif 7<=amari<=10:
print(2*kai+2)
else:
print(2*kai) |
p02719 | s053862971 | Accepted | n,k=map(int,input().split())
r=n%k
print(min(r,k-r)) |
p03705 | s463985741 | Accepted | # https://atcoder.jp/contests/agc015/tasks/agc015_a
# 最小と最大は必ず一つは存在するのか
n, a, b = map(int, input().split())
if b < a or (n == 1 and a != b): # コーナーケース
print(0)
exit()
ma = b * (n - 1) + a
mi = a * (n - 1) + b
print((ma - mi + 1))
|
p03545 | s973920684 | Wrong Answer | # https://atcoder.jp/contests/abc079/tasks/abc079_c
import random
import sys
str = input()
print(str)
def retop():
if(random.uniform(0, 1) > 0.5):
return "+"
return "-"
for i in range(100):
formula = (str[0] + retop() + str[1] + retop() + str[2] + retop() + str[3])
if eval(formula) == 7:
print(formula + "=7")
sys.exit()
|
p02718 | s153684451 | Wrong Answer | N,M = list(map(int,input().split()))
A = list(map(int,input().split()))
A.sort(reverse=True)
all_ =sum(A)
th = all_//(4*M)
ans='No'
if A[M-1] >= th:
ans='Yes'
print(ans) |
p03145 | s781088470 | Accepted | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
AB, BC, CA = map(int, input().split())
print(AB * BC // 2)
if __name__ == '__main__':
main()
|
p02577 | s810212304 | Accepted | n = list(map(int, input()))
if (sum(n)%9 == 0):
print("Yes")
else:
print("No") |
p03095 | s733024288 | Accepted | from collections import Counter
N = int(input())
S = input()
count = Counter(S)
mod = 10**9+7
ans = 1
for k, v in count.items():
ans = ans * (v+1) % mod
print(ans-1) |
p02918 | s977305154 | Accepted | N, K = map(int, raw_input().split())
S = raw_input()
x = 0
for i in range(N):
if (S[i]=="L" and 0<i and S[i-1]=="L" or
S[i]=="R" and i<N-1 and S[i+1]=="R"):
x += 1
print min(x+2*K, N-1)
|
p03795 | s005664487 | Accepted | a=int(input())
print(800*a-(a//15)*200) |
p03163 | s483814903 | Accepted | def solve():
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
w[i], v[i] = map(int, input().split())
dp = [0] * (W + 1)
for i in range(N):
for j in range(W - w[i], -1, -1):
dp[j + w[i]] = max(dp[j + w[i]], dp[j] + v[i])
print(dp[W])
if __name__ == '__main__':
solve()
|
p02939 | s435959238 | Accepted | txt = list(input())
a = txt[0]
count = 1
i = 1
while(i < len(txt)):
#print(temp)
if a != txt[i]:
a = txt[i]
i += 1
count += 1
else:
if (len(txt)-i) >= 2:
a = txt[i:i+1]
i += 2
count += 1
else:
break
print(count) |
p03821 | s314496416 | Accepted | N = int(input())
Array = []
for i in range(N):
Array.append(tuple(map(int,input().split())))
res = 0
for i in reversed(range(N)):
a,b = Array[i]
a+=res
res+= ((b-a%b)%b)
print(res) |
p02713 | s242622099 | Accepted | import math
n = int(input())
rg = range(1, n + 1)
k = 0
for a in rg:
for b in rg:
g1 = math.gcd(a,b)
for c in rg:
g2 = math.gcd(g1,c)
k += g2
print(k)
|
p02572 | s689012331 | Accepted | # -*- coding: utf-8 -*-
def main(N, A_list):
total_list = []
total = 0
for i in range(len(A_list)):
total += A_list[i]
total_list.append(total)
num = 0
for i in range(len(A_list)-1):
num += A_list[i] * (total_list[len(A_list)-1]-total_list[i])
val = num % ((10 ** 9) + 7)
print(val)
N = int(input())
A_list = list(map(int, input().split()))
main(N, A_list)
|
p03623 | s580816239 | Wrong Answer | import sys
s = list(input())
s.sort()
alp = list('abcdefghijklmnopqrstuvwxyz')
for s_,alp_ in zip(s,alp):
if s_ != alp_ :
print(alp_)
sys.exit()
print('None') |
p03625 | s232011667 | Wrong Answer | import collections
N = int(input())
A = [int(x) for x in input().split()]
c = collections.Counter(A)
cc = {k:v for k, v in c.items() if v>1}
ccc = sorted(list(cc.keys())[-2:])
if len(ccc)==2:
print(ccc[0] * ccc[1])
else:
print(0) |
p03161 | s855064377 | Accepted | N, K = map(int, input().split())
h = list(map(int, input().split()))
S = [0] * N
S[0] = 0
for i in range(1, N):
value = S[i - 1] + abs(h[i] - h[i - 1])
maxStep = min(K, i)
for step in range(1, maxStep + 1):
value = min(value, S[i - step] + abs(h[i] - h[i - step]))
S[i] = value
print(S[N - 1]) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.