problem_id
stringclasses 428
values | submission_id
stringlengths 10
10
| status
stringclasses 2
values | code
stringlengths 5
816
|
|---|---|---|---|
p02756
|
s683202293
|
Accepted
|
s,_,*q=open(0)
a='%s'
p=1
for q in q:
try:
q,f,c=q.split()
if(f<'2')^p:a+=c
else:a=c+a
except:p^=1
print((a%s[:-1])[::p or-1])
|
p02748
|
s447210734
|
Wrong Answer
|
A,B,M=map(int,input().split())
x = [0] * M
y = [0] * M
c = [0] * M
a = [0] * M
b = [0] * M
#0から入ってる
a=input().split()
b=input().split()
#ただの最小
mina=int(min(a))
minb=int(min(b))
nomal_count=mina+minb
#割引
wari_count=10*10*6
for i in range(M):
x,y,c=map(int,input().split())
now_count=int(a[x-1])+int(b[y-1])-c
if nomal_count>now_count:
wari_count=now_count
print(min(nomal_count,wari_count))
|
p02570
|
s216395648
|
Accepted
|
from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map, oct, zip
import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
#from functools import lru_cache #use @lru_cache(None)
if os.path.exists('in.txt'): sys.stdin=open('in.txt','r')
if os.path.exists('out.txt'): sys.stdout=open('out.txt', 'w')
#
def input(): return sys.stdin.readline()
def mapi(arg=0): return map(int if arg==0 else str,input().split())
#------------------------------------------------------------------
d,t,s = mapi()
if d/s<=t:
print("Yes")
else:
print("No")
|
p02917
|
s144634441
|
Accepted
|
N = int(input())
B = [10**6]+list(map(int,input().split()))+[10**6]
A = [0]*N
for p in range(N):
A[p] = min(B[p], B[p+1])
print(sum(A))
|
p02724
|
s615079415
|
Accepted
|
def resolve():
X = int(input())
ans = X // 500 * 1000
X = X % 500
ans += X // 5 * 5
print(ans)
resolve()
|
p02621
|
s994015953
|
Wrong Answer
|
a=int(input())
a=a+a^2+a^3
a=int(a)
print(a)
|
p03241
|
s878926326
|
Wrong Answer
|
n, m = map(int, input().split())
cnt = 1
a = []
for i in range(1, int(m ** 0.5) + 1):
if m % i == 0:
x = m // i
if x >= n:
a.append(i)
if i >= x:
a.append(x)
print(max(a))
|
p03817
|
s888568581
|
Wrong Answer
|
N = int(input())
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
print(ans)
|
p03605
|
s033914063
|
Accepted
|
c=input()
if "9" in c:
print("Yes")
else:
print("No")
|
p03360
|
s241926973
|
Wrong Answer
|
A, B, C = map(int, input().split())
K = int(input())
max_ = max(A, B, C)
print(max_*2*K + A + B + C - max_)
|
p02747
|
s347165686
|
Accepted
|
s = str(input())
flag = 0
a = []
if(len(s)%2 != 0):
print("No")
exit()
else:
for i in range(0,len(s),2):
if(s[i] != "h" or s[i+1] != "i"):
print("No")
exit()
print("Yes")
|
p03624
|
s376952175
|
Accepted
|
s = sorted(input())
alphabet = 'abcdefghijklmnopqrstuvwxyz'
for i in range(26):
if not alphabet[i] in s:
print(alphabet[i])
break
if alphabet[i] == 'z':
print("None")
|
p03210
|
s058817943
|
Accepted
|
X=input()
if X in ["3","5","7"]:
print("YES")
else:
print("NO")
|
p02729
|
s894022248
|
Wrong Answer
|
a,b =map(int,input().split())
print(a*(a-1)/2 + b*(b-1)/2)
|
p03637
|
s955612167
|
Accepted
|
n = int(input())
A = list(map(int, input().split()))
cnt4 = 0
cnt2 = 0
for a in A:
if a % 4 == 0:
cnt4 += 1
elif a % 2 == 0:
cnt2 += 1
if (n - max(0, cnt2 - 1)) // 2 <= cnt4:
print("Yes")
else:
print("No")
|
p03627
|
s946569737
|
Wrong Answer
|
n = int(input())
a = list(map(int,input().split()))
s = set(sorted(a))
v = [i for i in s]
v.reverse()
b_1 = 0
b_2 = 0
for i in v:
n = a.count(i)
if n >= 2 and b_1 != 0 and b_2 == 0:
b_2 = i
if n >= 2 and b_1 == 0:
b_1 = i
if n >= 4 and b_2 == 0:
b_2 = i
print(b_1*b_2)
|
p03730
|
s749077014
|
Accepted
|
a, b, c = map(int, input().split())
print("YES" if any((a*i)%b==c for i in range(1, b+1)) else "NO")
|
p03042
|
s244252427
|
Accepted
|
s=input()
a=int(s[0:2])
b=int(s[2:4])
if 0<a<13:
if 0<b<13:
print('AMBIGUOUS')
else:
print('MMYY')
else:
if 0<b<13:
print('YYMM')
else:
print('NA')
|
p02829
|
s463823153
|
Wrong Answer
|
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
a = int(input())
b = int(input())
if (a == 1 and b == 2):
print(3)
elif(a == 1 and b == 3):
print(2)
else:
print(1)
|
p03944
|
s656730865
|
Wrong Answer
|
w,h,n = map(int, input().split())
xl, xu, yl, yu = 0, w, 0, h
for _ in range(n):
x,y,a = map(int,input().split())
if a == 1:
xl = max(xl, x)
elif a == 2:
xu = min(xu, x)
elif a == 3:
yl = max(yl, y)
else:
yu = min(yu, y)
print(max((xu-xl)*(yu-yl), 0))
|
p02606
|
s176774028
|
Accepted
|
l, r, d = map(int, input().split())
count = 0
for i in range(l, r+1):
if i%d==0:
count+=1
print(count)
|
p03803
|
s853757317
|
Accepted
|
A, B = map(int, input().split())
if A == B:
print("Draw")
elif A == 1 or B == 1:
print("Alice" if A == 1 else "Bob")
else:
print("Alice" if A > B else "Bob")
|
p03062
|
s426307383
|
Accepted
|
import sys
N=int(input())
A=[int(x) for x in sys.stdin.readline().split()]
abssum=0
negative=0
mi=100000000000000
for i in range(N):
if A[i]<0:
negative+=1
abssum+=abs(A[i])
mi=min(mi,abs(A[i]))
if negative%2==1:
abssum-=2*mi
print(abssum)
|
p02959
|
s345089327
|
Accepted
|
N = int(input())
*A, = map(int, input().split())
*B, = map(int, input().split())
ans = 0
for i in range(N):
left = min(A[i], B[i])
ans += left
A[i] -= left
B[i] -= left
right = min(A[i+1], B[i])
ans += right
A[i+1] -= right
B[i] -= right
print(ans)
|
p02819
|
s220871731
|
Accepted
|
X=int(input())
while True:
for x in range(2,X):
if X%x==0:
break
else:
print(X)
break
X+=1
|
p02622
|
s229975630
|
Accepted
|
S = input()
T = input()
list_s = []
list_t = []
counter = 0
for i in range(0, len(S)):
list_s.append(S[i])
list_t.append(T[i])
if S[i] != T[i]:
list_s[i] = list_t[i]
counter += 1
print(counter)
|
p03838
|
s835743397
|
Accepted
|
x, y = [int(w) for w in input().split()]
d = abs(abs(x) - abs(y))
if d == 0:
if x - y == 0:
ans = 0
else:
ans = 1
elif y == 0:
if x < 0:
ans = abs(x)
else:
ans = x + 1
else:
ans = d
if x * y > 0:
if x > y:
ans += 2
else:
if x > y:
ans += 1
elif x < 0:
ans += 1
print(ans)
|
p02582
|
s762315558
|
Wrong Answer
|
i = 0
for s in input():
if s == "R":
i += 1
print(i)
|
p02677
|
s999871307
|
Wrong Answer
|
import math
zi, hun, H, M = map(int, input().split())
tan = H*30+M*0.5
tyo = M*6
bus = (tan-tyo)/90
ans = math.sqrt((zi**2)+(hun**2)) * bus
print(ans)
|
p03107
|
s152706347
|
Accepted
|
s=list(input())
print(len(s)-(max(s.count('0'),s.count('1'))-min(s.count('0'),s.count('1'))))
|
p03632
|
s485049903
|
Accepted
|
A,B,C,D=map(int,input().split())
start=max(A,C)
goal=min(B,D)
dt=goal-start
if dt<0:
print(0)
else:
print(dt)
|
p02784
|
s677872013
|
Accepted
|
h,n=map(int, input().split())
li=list(map(int,input().split()))
if h<=sum(li):
print('Yes')
else:
print('No')
|
p03627
|
s965443522
|
Accepted
|
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse = True)
before = 0
ans = 0
for num in a:
if num == before:
if ans == 0:
ans = num
before = 0
else:
print(ans * num)
exit()
else:
before = num
print(0)
|
p02784
|
s812679574
|
Accepted
|
h, n = map(int, input().split())
sum = 0
for i in list(map(int, input().split())):
sum += i
if sum >= h:
print("Yes")
else:
print("No")
|
p04044
|
s485778765
|
Wrong Answer
|
NL = [ x for x in map(int,input().split()) ]
cha = []
i = 0
while i < NL[0]:
cha.append(input())
i += 1
print(sorted(cha))
|
p02813
|
s615706003
|
Wrong Answer
|
from itertools import permutations
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
a, b = 0, 0
perms = list(permutations(range(1, N + 1)))
for per in perms:
if P == per:
a = perms.index(per) + 1
elif Q == per:
b = perms.index(per) + 1
if a != 0 and b != 0:
break
print(abs(a - b))
|
p02947
|
s163548877
|
Accepted
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Created: Jul, 13, 2020 23:02:56 by Nobody
# $Author$
# $Date$
# $URL$
__giturl__ = "$URL$"
from collections import defaultdict
from sys import stdin
input = stdin.readline
def main():
N = int(input())
S = [input()[:-1] for _ in range(N)]
dic = defaultdict(int)
for i in range(N):
dic[''.join(sorted(S[i]))] += 1
ans = 0
for n in dic.values():
ans += int(n*(n-1)/2)
print(ans)
if(__name__ == '__main__'):
main()
|
p03160
|
s588286654
|
Accepted
|
def main():
n = int(input())
h = list(map(int, input().split()))
dp = [0] * n
def cost(i,j):
return abs(h[i]-h[j])
dp[1] = cost(0,1)
for i in range(2,n):
dp[i] = min(dp[i-2] + cost(i-2,i), dp[i-1] + cost(i-1,i))
print(dp[n-1])
if __name__ == '__main__':
main()
|
p03481
|
s268515093
|
Accepted
|
x,y=map(int,input().split())
count=0
while x<=y:
x*=2
count+=1
print(count)
|
p03455
|
s060635403
|
Accepted
|
a, b = list(map(int, input().strip().split()))
c = a*b
if c%2 == 0:
print('Even')
else:
print('Odd')
|
p02719
|
s406344360
|
Accepted
|
n, k = map(int, input().split())
amari = n % k
print(min(amari, abs(amari - k)))
|
p02811
|
s124247467
|
Accepted
|
k, x = map(int, input().split())
if 500 * k >= x: print("Yes")
else: print("No")
|
p02688
|
s710913640
|
Wrong Answer
|
n, k = map(int, input().split())
for i in range(k):
d = int(input())
A = set([int(x) for x in input().split()])
print(len(A))
|
p03448
|
s712889422
|
Accepted
|
a = int(input())
b = int(input())
c = int(input())
x = int(input())
ans = 0
for i in range(a + 1):
for j in range(b + 1):
for k in range(c + 1):
if 500 * i + 100 * j + 50 * k == x:
ans += 1
print(ans)
|
p02766
|
s673725829
|
Wrong Answer
|
N,K = map(int,input().split())
cnt = 0
while(N>1):
N /= K
cnt += 1
print(cnt)
|
p02747
|
s650412130
|
Accepted
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
s=input()
l = len(s)
if (l % 2 != 0):
print('No')
sys.exit()
for i in range(len(s)):
if (i % 2 == 0 and s[i] != 'h') or (i % 2 == 1 and s[i] != 'i'):
print('No')
sys.exit()
print('Yes')
|
p03639
|
s871169782
|
Wrong Answer
|
N = int(input())
A = list(map(lambda x:int(x)%4, input().split()))
ans_list = []
for i in [0,1,2,3]:
a = A.count(i)
ans_list.append(a)
ans = ans_list[0] - (ans_list[1] + ans_list[3])
if ans < 0:
print("No")
exit(0)
if ans_list[2]%2 == 0 and ans < 1:
print("No")
exit(0)
print("Yes")
|
p02996
|
s009307636
|
Accepted
|
import numpy as np
n = int(input())
ab = np.zeros((n, 2))
for i in range(n):
l = list(map(int, input().split()))
ab[i, :] = l
ab = ab[np.argsort(ab[:, 1])]
a_cum = np.cumsum(ab[:, 0])
for i in range(n):
if a_cum[i] > ab[i, 1]:
print("No")
break
else:
print("Yes")
|
p02555
|
s860642785
|
Wrong Answer
|
s = int(input())
n = [0, 0, 1]
for i in range(3, s) :
# print(n[0:i-3])
next_n = sum(n[0:i-2]) + 1
n.append(next_n)
# print(n)
# print(n)
print(n[-1] % (10**9 + 7))
|
p03997
|
s980034243
|
Accepted
|
a = int(input())
b = int(input())
h = int(input())
print((a + b) * h // 2)
|
p02813
|
s917066844
|
Accepted
|
import itertools
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))
seq=list(range(1,n+1))
l=list(itertools.permutations(seq))
p_i=l.index(p)
q_i=l.index(q)
print(abs(p_i-q_i))
|
p03469
|
s918455223
|
Accepted
|
lst1 = list(input())
lst1[3] = "8"
print("".join(lst1))
|
p02606
|
s698803999
|
Wrong Answer
|
def input_int():
return map(int, input().split())
def one_int():
return int(input())
def one_str():
return input()
def many_int():
return list(map(int, input().split()))
L, R, d = input_int()
mins = L//d
maxs = R//d
print(maxs-mins)
|
p02775
|
s595029921
|
Wrong Answer
|
N = input()
order = len(N)
cash = 0
for i in range(order):
if int(N[-(i+1)]) >=6:
cash += 10**(i+1)
else:
cash += int(N[-(i+1)]) * (10**(i))
back = cash-int(N)
num=0
for a in str(cash):
num += int(a)
for a in str(back):
num += int(a)
print(num)
|
p02600
|
s247498794
|
Accepted
|
X = int(input())
if 400<=X<600:
ans = 8
elif 600<=X<800:
ans = 7
elif 800<=X<1000:
ans = 6
elif 1000<=X<1200:
ans = 5
elif 1200<=X<1400:
ans = 4
elif 1400<=X<1600:
ans = 3
elif 1600<=X<1800:
ans = 2
elif 1800<=X<2000:
ans = 1
print(ans)
|
p03821
|
s552883619
|
Accepted
|
def main():
N = int(input())
A = [None]*N
B = [None]*N
for i in range(N):
A[i],B[i] = map(int,input().split())
tmp = 0
ans = 0
for i in range(N-1,-1,-1):
if (A[i]+tmp)%B[i] == 0:
continue
ans += (B[i] - (A[i]+tmp)%B[i])
tmp += (B[i] - (A[i]+tmp)%B[i])
print(ans)
if __name__ == '__main__':
main()
|
p03565
|
s408707845
|
Accepted
|
sd = input()
t = input()
n = len(sd)
m = len(t)
s = []
for i in range(n-m, -1, -1):
t_p = sd[i:i+m]
for j in range(m+1):
if j == m:
print((sd[:i] + t + sd[i + len(t):]).replace("?", "a"))
exit()
else:
if t_p[j] == "?":
continue
elif t_p[j] != t[j]:
break
print("UNRESTORABLE")
|
p04030
|
s554025536
|
Accepted
|
s1 = str(input())
s = []
for i in s1:
if i == '0' or i == '1':
s.append(i)
else:
if 1 <= len(s):
s.pop(len(s)-1)
w = ""
for h in s:
w += h
print(w)
|
p02633
|
s947778439
|
Wrong Answer
|
x = int(input())
print(int(360/x)) if 360%x == 0 else print(int(360/x)+1)
|
p02924
|
s538764612
|
Accepted
|
N = int(input())
ans = ((N)*(N-1))//2
print(ans)
|
p02663
|
s357353354
|
Wrong Answer
|
from sys import stdin
h1, m1, h2, m2, k = [int(x) for x in stdin.readline().rstrip().split()]
allMin1 = h1 * 60
allMin2 = h2 * 60
diff = (allMin2 + m2 - allMin1 + m1)
if diff < 0 :
diff += 24 * 60
ans = diff - k
if ans >= 0 :
if ans > k :
print(ans)
else :
print(k)
else :
print(0)
|
p02847
|
s168771605
|
Accepted
|
print(7 - ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'].index(input()))
|
p02719
|
s609163270
|
Wrong Answer
|
n,k=map(int,input().split())
a=n%k
if n<k:
print(n)
exit()
if n%k==0:
print(0)
else:
print(k-a)
|
p03286
|
s463823628
|
Accepted
|
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)
def check(n):
if n == 0:
return ''
if n % 2 == 0:
return check(n // (-2)) + '0'
return check((n - 1) // (-2)) + '1'
n = int(readline())
if n == 0:
print(0)
else:
print(check(n))
|
p03239
|
s374179611
|
Accepted
|
N, T = map(int, input().split())
x = None
for i in range(N):
c, t = map(int, input().split())
if t <= T:
x = c if x is None or x > c else x
if x is None:
print('TLE')
else:
print(x)
|
p02910
|
s735667345
|
Accepted
|
s = input()
n = len(s)
for i in range(0,n,2):
if s[i] == "L":
print("No")
break
else:
for j in range(1,n,2):
if s[j] == "R":
print("No")
break
else:
print("Yes")
|
p02994
|
s525654619
|
Wrong Answer
|
def main():
n, l = map(int, input().split())
m = sorted(list(range(1,n+1)))
res = 0
for i in m:
res += l + i - 1
print(res)
if __name__ == '__main__':
main()
|
p03485
|
s316601908
|
Wrong Answer
|
a, b = map(int,input().split())
x = (a + b) /2
print(int(x))
|
p03076
|
s746124387
|
Accepted
|
import math
a = []
mini = 9
flag = False
for i in range(5):
x = int(input())
if x%10==0:
a.append(x)
else:
flag = True
if x%10<mini :
mini = x%10
a.append(math.ceil(x/10)*10)
if flag:
print(sum(a)-(10-mini))
else:
print(sum(a))
|
p02602
|
s788467998
|
Accepted
|
import sys
input = sys.stdin.readline
N,K=map(int,input().split())
A=list(map(int,input().split()))
for i in range(K,N):
if A[i]>A[i-K]:
print("Yes")
else:
print("No")
|
p03338
|
s792380491
|
Wrong Answer
|
n = int(input())
l = list(map(str,input()))
ans = 0
for i in range(n):
a = l[0:i]
b = l[i:n-1]
tmp = []
for j in a:
if j in b:
tmp.append(j)
tmp = set(tmp)
ans = (max(ans,len(tmp)))
print(ans)
|
p02773
|
s667572744
|
Wrong Answer
|
n=int(input())
a=[]
for i in range(n):
a.append(input())
x=max(a)
c=[]
d=[]
for i in a:
c.append(a.count(i))
for i in a:
if a.count(i)==max(c):
d.append(a[a.index(i)])
d=list(set(d))
for i in d:
print(i)
|
p03163
|
s197472481
|
Accepted
|
import sys
sys.setrecursionlimit(10**9)
N,W = map(int,input().split())
w = []
v = []
for i in range(N):
w_,v_ = map(int,input().split())
w.append(w_)
v.append(v_)
dp = [[0]*(W+1) for _ in range(N+1)]
def memo(i,j):
if dp[i][j]:
return dp[i][j]
if i == N:
dp[i][j] = 0
elif w[i] > j:
dp[i][j] = memo(i+1,j)
else:
dp[i][j] = max(memo(i+1,j),memo(i+1,j-w[i])+v[i])
return dp[i][j]
print(memo(0,W))
|
p04019
|
s782590917
|
Accepted
|
import collections
S=list(str(input()))
cc=collections.Counter(S)
if cc['S']==0 and cc['N']!=0:
print('No')
elif cc['S']!=0 and cc['N']==0:
print('No')
elif cc['E']==0 and cc['W']!=0:
print('No')
elif cc['E']!=0 and cc['W']==0:
print('No')
else:
print('Yes')
|
p02676
|
s976241791
|
Accepted
|
k = int(input())
s = input()
sl = len(s)
if k >= sl:
print(s)
else:
print(s[0:k]+'...')
|
p02687
|
s852316441
|
Accepted
|
test = input()
if test == 'ARC':
print('ABC')
else:
print('ARC')
|
p04045
|
s335280853
|
Accepted
|
N, K = map(int, input().split())
D = set(input().split())
for n in range(N, 100000):
if set(str(n)).isdisjoint(D): break
print(n)
|
p02641
|
s668386687
|
Wrong Answer
|
#abc170
x, n = map(int, input().split())
ln = []
if n == 0:
pass
else:
ln = list(map(int, input().split()))
i = 0
while i < 5:
if (x-i in ln) == False:
print(x-i)
break
elif (x+i in ln) == False:
print(x+i)
break
else:
i +=1
|
p02836
|
s782815394
|
Accepted
|
s = input()
cnt = 0
for i in range(len(s)//2):
a0, a1 = s[i], s[-i-1]
if a0 != a1:
cnt += 1
print(cnt)
|
p03796
|
s459904551
|
Accepted
|
import math
N = int(input())
print(math.factorial(N) % (1000000000 + 7))
|
p02607
|
s224681352
|
Accepted
|
n=int(input())
a=list(map(int,input().split()))
b=0
for i in range(n):
if i%2==0 and a[i]%2==1:
b+=1
print(b)
|
p03835
|
s981736653
|
Accepted
|
k, s = map(int, input().split())
count = 0
for i in range(k+1):
for j in range(k+1):
if i+j+k >= s and s-i-j >= 0:
count += 1
else:
continue
print(count)
|
p02727
|
s852586529
|
Wrong Answer
|
x,y,a,b,c=map(int,input().split())
a=list(map(int,input().rstrip().split()))
b=list(map(int,input().rstrip().split()))
c=list(map(int,input().rstrip().split()))
a.sort(reverse=True)
b.sort(reverse=True)
d=0
c.sort(reverse=True)
a1=a+c
a1.sort(reverse=True)
for i in range(x):
d=d+a1[i]
l=x-len(c)
b1=b+c[l:len(c)]
b1.sort(reverse=True)
for j in range(y):
d=d+b1[j]
print(d)
|
p02987
|
s048344022
|
Accepted
|
s = input()
s = sorted(s)
if s[0] == s[1] and s[2] == s[3] and s[0] != s[3]:
print('Yes')
else:
print('No')
|
p02688
|
s904491415
|
Accepted
|
n, k = map(int, input().split())
S = [0]*n
for i in range(k):
d = int(input())
A = list(map(int, input().split()))
for j in range(len(A)):
S[A[j]-1]+=1
print(S.count(0))
|
p03339
|
s193637904
|
Accepted
|
n = int(input())
s = list(input())
result = [s[1:].count("E")]
for i in range(n-1):
if s[i:i+2] == ["W","W"]:
result.append(result[-1]+1)
elif s[i:i+2] == ["E","E"]:
result.append(result[-1]-1)
else:
continue
print(min(result))
|
p03817
|
s068232913
|
Accepted
|
x = int(input())
rem = x%11
cnt = (x-rem)//11
cnt *= 2
if 0 < rem <= 6:
cnt += 1
elif rem > 6:
cnt += 2
print(cnt)
|
p02832
|
s529373769
|
Wrong Answer
|
def main():
N = int(input())
b = list(map(int, input().split()))
i = 1
for j in range(N):
if b[j] == i:
i += 1
print(i - 1)
if __name__ == '__main__':
main()
|
p03327
|
s004373203
|
Accepted
|
a=int(input())
if a<=999:
print("ABC")
else:
print("ABD")
|
p02767
|
s757357295
|
Wrong Answer
|
n=int(input())
x=list(map(int,input().split()))
ans=10**12
cou=0
for i in range(min(x),max(x)):
for j in range(n):
cou+=(x[j]-i)**2
if cou<ans:
ans=cou
cou=0
print(ans)
|
p03150
|
s961395248
|
Wrong Answer
|
s=input()
n=len(s)
ans="No"
for i in range(n):
for j in range(1,n+1):
num=s[:i]+s[j:]
if num == "keyence":
ans="Yes"
print(ans)
|
p04005
|
s739324662
|
Wrong Answer
|
a, b = sorted(map(int, input().split()))[:2]
print(a*b if a*b%2 else 0)
|
p02847
|
s902541053
|
Accepted
|
S = str(input())
week = ['SAT','FRI','THU','WED','TUE','MON','SUN']
for i in range(7):
if S == week[i]:
print(i+1)
|
p02813
|
s117614955
|
Accepted
|
import itertools
N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))
ls = [i+1 for i in range(N)]
per = []
for j in itertools.permutations(ls,N):
per.append(j)
print(abs(per.index(P) - per.index(Q)))
|
p03211
|
s678059208
|
Accepted
|
s=input()
mina=653
for i in range(len(s)-2):
mina=min(mina, abs(753-int(s[i:i+3])))
print(mina)
|
p03262
|
s311589707
|
Accepted
|
from fractions import gcd
from functools import reduce
n,x=map(int, input().split())
A=[abs(int(i)-x) for i in input().split()]
def gcd_list(numbers):
return reduce(gcd, numbers)
print(gcd_list(A))
|
p03779
|
s950286588
|
Accepted
|
x = int(input())
i = 0
SUM = 0
while SUM < x:
i += 1
SUM += i
print(i)
|
p03544
|
s489483563
|
Accepted
|
l = [2, 1]
for i in range(2, int(input()) + 1):
l.append(l[len(l) - 1] + l[len(l) - 2])
print(l[len(l) - 1])
|
p03160
|
s890213660
|
Accepted
|
"""
author : halo2halo
date : 4, Feb, 2020
"""
import sys
# import itertools
# import math
# import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N, *H = map(int, read().split())
dp = [0] * N
dp[1] = abs(H[1] - H[0])
for i in range(2, N):
dp[i] = min(dp[i - k] + abs(H[i] - H[i - k]) for k in [1, 2])
ans = dp[-1]
print(ans)
|
p02570
|
s736166508
|
Accepted
|
D,T,S=map(int,input().split())
if D/S<=T:
print('Yes')
else:
print('No')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.