problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03852 | s044227820 | Wrong Answer | c=input()
v="abcde"
print("vowel" if c in v else "consonant") |
p03449 | s005938041 | Accepted | # -*- coding: utf-8 -*-
# C - Candies
# 標準入力の取得
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
# 求解処理
# 100通りの全探索を行う
result = 0
for n in range(1, N+1):
candies = sum(A1[:n]) + sum(A2[n-1:])
result = max(result, candies)
# 結果出力
print(result) |
p02924 | s878202842 | Wrong Answer | import itertools
N = int(input())
print(int(N*(N-1)/2))
|
p02882 | s173722065 | Accepted | import math
a, b, x = map(int, input().split())
remain = a * a * b - x
ans = 0
if remain <= x:
c = remain / a / a * 2
ans = math.degrees(math.atan2(c, a))
else:
c = x / a / b * 2
ans = math.degrees(math.atan2(b, c))
print(ans) |
p03264 | s558785762 | Accepted | k = int(input())
if k%2 == 0:
print(int(k*k/4))
else:
print(int(k**2/4-1/4)) |
p02755 | s454955869 | Accepted | import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
a, b = input_nums()
a_rate = 0.08
b_rate = 0.1
al = int(a / a_rate)
ar = int((a+1) / a_rate)
bl = int(b / b_rate)
br = int((b+1) / b_rate)
ans = 0
if bl <= al and al < br:
ans = al
elif al <= bl and bl < ar:
ans = bl
else:
ans = -1
if not ans == -1 and int(ans*0.08) < a:
ans += 1
if int(ans*0.1) > b:
ans = -1
print(ans) |
p02682 | s419380643 | Accepted | A,B,C,K = map(int,input().split())
nList = [A,B,C]
pList = [1,0,-1]
ans = 0
for i in range(len(nList)):
if nList[i] <= K:
ans += nList[i]*pList[i]
K -= nList[i]
else:
ans += K*pList[i]
break
print(ans)
|
p03910 | s509007993 | Wrong Answer | n = int(input())
ans = []
tmp = n
for i in range(min(n, 3162), 0, -1):
if tmp > i * (i - 1) // 2:
ans.append(i)
tmp -= i
ans.sort()
print('\n'.join(map(str, ans)))
|
p02831 | s221982552 | Accepted | import math
a,b = map(int,input().split())
print(a*b//math.gcd(a,b)) |
p02695 | s929290231 | Accepted | from itertools import permutations, combinations,combinations_with_replacement,product
N,M,Q=map(int,input().split())
a=[i for i in range(1,M+1)]
A=list(combinations_with_replacement(a,N))
B=[list(map(int,input().split())) for i in range(Q)]
ans=[]
for i in A:
tmp=0
#print(i)
for j in B:
#print(j)
if i[j[1]-1]-i[j[0]-1]==j[2]:
tmp+=j[3]
else:
pass
ans.append(tmp)
print(max(ans)) |
p02678 | s355935017 | Accepted | n,m=map(int,input().split())
l=[[] for i in range(n)]
for i in range(m):
a,b=map(int,input().split())
l[a-1].append(b)
l[b-1].append(a)
ans=[-1]*n
ans[0]=0
x=[1]
y=[]
count=1
while x!=[]:
for i in x:
for j in l[i-1]:
if ans[j-1]==-1:
ans[j-1]=i
y.append(j)
count+=1
x=y
y=[]
print('Yes')
for i in range(1,n):
print(ans[i]) |
p03773 | s693242105 | Wrong Answer | a,b=[int(i) for i in input().split()]
if a+b==24:
print(24)
else:
print((a+b)%24) |
p02784 | s198307943 | Accepted | hp, attack_count = map(int, input().split())
attack_list = list(map(int, input().split()))
full_damage = sum(attack_list)
if hp > full_damage:
print("No")
else:
print("Yes") |
p02780 | s969792059 | Wrong Answer | import numpy as np
n,k = list(map(int,input().split()))
p = np.array(list(map(int,input().split())))
P = 0
for i in range(n-k+1):
if P < p[i:i+k].sum():
P = p[i:i+k].sum()
mp = p[i:i+k]
ans = 0
print(mp)
for i in mp:
if i%2 == 0:
ans += ((i+1) * i//2)/i
else:
ans += ((i+1) * (i//2) + (i//2) + 1)/i
print(ans)
|
p02744 | s091506463 | Wrong Answer | import sys
stdin = sys.stdin
sys.setrecursionlimit(10**9)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()
al = ['a','b','c','d','e','f','g','h','i','j']
n = ni()
import numpy as np
for i in range(2**(n-1)):
k = list(map(int,format(i, 'b')))
u = len(k)
k = [0]*(n-u) + k
p = list(np.cumsum(k))
ans = [str(al[j])for j in p]
print(''.join(ans)) |
p03380 | s736363763 | Accepted |
n = int(input())
lst = list(map(int,input().split()))
lst.sort()
m = lst[-1]
line = m / 2
r = 10**10
for i in range(n):
if abs(r-line) > abs(lst[i]-line):
r = lst[i]
print(m,r) |
p02676 | s654675423 | Accepted | k = int(input())
s = input()
if k >= len(s):
print(s)
else:
tmp = s[0:k]
tmp = tmp + "..."
print(tmp) |
p02780 | s097126744 | Wrong Answer | n,k=map(int, input().split())
p=[(int(i)+1.0)/2.0 for i in input().split()]
ans=0
for i in range(k):ans+=p[i]
tmp1=ans
for i in range(k, n-k+1):
tmp2 = (tmp1- p[i-k])+p[i]
ans = max(ans, tmp2)
tmp1=tmp2
print('{:.12f}'.format(ans))
|
p02690 | s446655632 | Accepted | X = int(input())
def search(x):
for A in range(-1000, 1000):
for B in range(-1000, 1000):
A5 = A**5
B5 = B**5
if A5 - B5 == x:
print(A, B)
return
search(X) |
p02924 | s007674045 | Accepted | n = int(input())
print(n*(n-1)//2) |
p03284 | s401495284 | Accepted | a,b = map(int, input().split())
if a%b ==0:
print(0)
else:
print(1) |
p03657 | s339055109 | 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') |
p03835 | s054135041 | Wrong Answer | k, s = map(int, input().split())
cnt = 0
for i in range(k):
for j in range(k):
z = s - i - j
if 0 <= z <= k:
cnt += 1
print(cnt) |
p02801 | s285811968 | Accepted | c = input()
print(chr(ord(c)+1)) |
p03555 | s643257904 | Accepted | line1=input()
line2=input()
if line1[0]==line2[2] and line1[1]==line2[1] and line1[2]==line2[0]:
print("YES")
else:
print("NO") |
p03698 | s494595158 | Wrong Answer | s=list(str(input()))
len(s)
print('Yes' if len(list(set(s)))==len(s) else 'No') |
p02759 | s171266270 | Accepted | n = int(input())
print(int((n+1)/2)) |
p03472 | s575699543 | Accepted | import math
n, h = map(int, input().split())
max_swing = 0
throw = []
for _ in range(n):
a, b = map(int, input().split())
max_swing = max(max_swing, a)
throw.append(b)
throw.sort(reverse=True)
min_cnt = int(math.ceil(h / max_swing))
throw_cnt = 0
for t in throw:
h -= t
throw_cnt += 1
if h <= 0:
min_cnt = min(throw_cnt, min_cnt)
break
cnt = throw_cnt + int(math.ceil(h / max_swing))
min_cnt = min(cnt, min_cnt)
print(min_cnt)
|
p03011 | s054181264 | Wrong Answer | pqr = list(map(int,input().split()))
sorted(pqr)
print(sum(pqr[:2])) |
p03309 | s559500721 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
A = [a - (i + 1) for i, a in enumerate(A)]
b1 = sum(A) // N
b2 = b1 + 1
tmp1, tmp2 = 0, 0
for a in A:
tmp1 += abs(a - b1)
tmp2 += abs(a - b2)
print(min(tmp1, tmp2)) |
p02818 | s707667088 | Accepted | A,B,K=map(int,input().split())
if A+B-K<=0:
print(0,0)
elif A-K<=0:
print(0,A+B-K)
else:
print(A-K,B) |
p03711 | s676330599 | Accepted | print('YNeos'[len(set([0 if i==2 else [1,2][i in [4,6,9,11]] for i in [*map(int,input().split())]]))!=1::2]) |
p03017 | s696117451 | Accepted | N, A, B, C, D = map(int, input().split())
S = input()
p = 0
t = 0
stri = 0
for i in range(A-1, max(C, D) - 1):
if S[i:i+2] == '##':
p = 1
for j in range(B-1, min(C, D) - 1):
if S[j:j+3] == '...':
if stri == 0:
stri = j + 1
t = 1
if S[B] == '.' and S[B-2] == '.':
t = 1
if (C < D and p == 0) or (C > D and p == 0 and t == 1 and stri <= D-1):
print('Yes')
else:
print('No') |
p03150 | s334619992 | Wrong Answer | s = input()
ans = 'keyence'
state = 0
for i in range(len(s)):
if state == 7:
print('YES')
break
elif s[i]==ans[state]:
state += 1
else:
continue
else:
print('YES' if state==7 else 'NO') |
p03243 | s097786541 | Accepted | N = int(input())
for i in range(N, 1000):
if i % 111 == 0:
zorome = i
break
print(zorome) |
p02917 | s541666183 | Accepted | n = int(input())
b = list(map(int,input().split()))
ans = [0]*n
for i in range(n-1):
if i == 0:
ans[i] = b[i]
else:
ans[i] = min(b[i-1],b[i])
print(sum(ans)+b[-1]) |
p02607 | s372538806 | Wrong Answer | n = int(input())
a = input().split()
a = list(map(int,a))
s = 0
for i in range(n):
if(i%2!=0):
if(a[i]%2!=0):
s+=1
print(s) |
p02953 | s474656558 | Accepted | import sys
import numpy as np
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
H = np.array(lr())
X = np.minimum.accumulate(H[::-1])[::-1]
Y = H - X
answer = np.any(Y>=2)
print('No' if answer else 'Yes')
|
p02754 | s612043258 | Wrong Answer | N,A,B=[int(s) for s in input().split(" ")]
Ans1=N//(A+B)
Ans2=N%(A+B)
Ans=A*Ans1+Ans2
print(Ans) |
p02623 | s824598378 | Accepted | N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ma = [0] * (N + 1)
mb = [0]*(M+1)
for i in range(N):
ma[i + 1] = ma[i] + A[i]
for i in range(M):
mb[i + 1] = mb[i] + B[i]
j = M
max_num = 0
for i in range(N+1):
if ma[i] > K:
break
while ma[i] + mb[j] > K:
j -= 1
max_num = max(max_num, i + j)
print(max_num)
|
p02859 | s019665604 | Wrong Answer | def multiply(r):
s = r*r
return s |
p02829 | s435645063 | Accepted | a = int(input())
b = int(input())
print(6-a-b) |
p02603 | s325068595 | Accepted | n = int(input())
a = list(map(int, input().split()))
a.insert(0, 1000)
a.append(0)
money = 1000
stock = 0
for i in range(1, n+1):
# buy
if a[i] <= a[i-1] and a[i] < a[i+1]:
stock = money // a[i]
money %= a[i]
# sell
elif a[i] > a[i-1] and a[i] >= a[i+1]:
money += a[i]*stock
print(money) |
p03472 | s513505587 | Accepted | n,h=map(int,input().split())
th=[]
ma=0
for i in range(n):
a,b=map(int,input().split())
ma=max(ma,a)
th.append([b,a])
ans=0
th.sort(reverse=True)
for i in range (n):
if h>0 and th[i][0]>ma:
h-=th[i][0]
ans+=1
if h<=0:
print(ans)
exit()
if h%ma==0:
ans+=h//ma
else:
ans+=1+(h//ma)
print(ans)
|
p02748 | s373442563 | Wrong Answer | 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)]
price = min(A)+min(B)
for x,y,c in xyc:
k = A[x-1] + B[y-1] - c
if k < price:
price = k
print(k) |
p03126 | s211384522 | Accepted | def main():
N, M = map(int, input().split(" "))
foods = [0] * (M + 1)
result = 0
for _ in range(N):
tmp = list(map(int, input().split(" ")))
for t in tmp[1:]:
foods[t] += 1
for food in foods:
if food == N:
result += 1
print(result)
if __name__ == '__main__':
main() |
p02681 | s037755773 | Wrong Answer | S = input()
T = input()
while len(S) > 10:
S = input('Sは: ')
while len(T) != len(S) + 1:
T = input('Tは: ')
if S in T and S != T:
print('Yes')
elif S not in T or S == T:
print('No')
|
p02639 | s553628145 | Accepted | [ print(i+1) for i,x in enumerate(map(int, input().split())) if x == 0] |
p02882 | s941810063 | Accepted | import math
a, b, x = map(int, input().split())
if (a ** 2) * b <= 2 * x:
t = (2 * b * (a ** 2) - 2 * x) / a ** 3
res = math.degrees(math.atan(t))
else:
t = 2 * x / (a * b ** 2)
res = 90 - math.degrees(math.atan(t))
print(res)
|
p02598 | s368180912 | Accepted | import math
def is_ok(mid,K,A):
p = 0
for i in A:
p += (i - 1)// mid
if p > K:
return False
else:
return True
N,K = map(int,input().rstrip().split(" "))
A = list(map(int,input().rstrip().split(" ")))
A.sort()
maxi = A[0]
ng = 0
ok = 10 ** 9
while(abs(ng - ok) > 1):
mid = (ok + ng) // 2
if is_ok(mid,K,A):
ok = mid
else:
ng = mid
print(ok) |
p03557 | s271558715 | Wrong Answer | import bisect
n = int(input())
x = sorted(list(map(int,input().split())), reverse=True)
y = sorted(list(map(int,input().split())), reverse=True)
z = sorted(list(map(int,input().split())), reverse=True)
count = 0
X =[0]*n
for b in range(n):
k = bisect.bisect_right(x,y[b])
X[b] =(n-k)
for a in range(n):
j = bisect.bisect_right(y,z[a])
count+=sum(X[j:])
print(count) |
p02996 | s230129280 | Accepted | N = int(input())
task = []
for i in range(N):
task.append(list(map(int, input().split())))
task.sort(key = lambda t: t[1])
ok = True
time = 0
for x in task:
time += x[0]
if time > x[1]:
ok = False
break
if ok:
print("Yes")
else:
print("No") |
p03543 | s166620583 | Accepted | a, b, c, d, = input()
print("Yes" if a==b==c or b==c==d else "No") |
p02972 | s029597291 | Wrong Answer | import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
#print(a)
ans = []
a = a[::-1]
for i, x in enumerate(a):
j = n-i
tmp = 0
k = 1
baisu = [(n//j) * k for k in range(n//j)]
for k in baisu:
if (k+1) * j in ans:
tmp += 1
if tmp % 2 != x:
ans.append(j)
print(len(ans))
print(*ans)
|
p03264 | s574451269 | Accepted | k = int(input())
if k % 2 == 0:
print((k//2) * (k//2))
else:
print((k//2)*(k//2++1)) |
p03555 | s058053903 | Wrong Answer | C1 = input()
#print(C1)
C2 = input()
if (C1[2] == C2[0]) and (C1[1] == C2[1]):
print("YES")
else:
print("NO") |
p03076 | s807255499 | Accepted | a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a,b,c,d,e]
l1 = [a%10,b%10,c%10,d%10,e%10]
l2 = [(a//10)*10+10,(b//10)*10+10,(c//10)*10+10,(d//10)*10+10,(e//10)*10+10]
for i in range(len(l)):
if l[i]%10 == 0:
l1[i] = 10
l2[i] -= 10
print((sum(l2)-(10-(min(l1))))) |
p03077 | s647171160 | Wrong Answer | N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
print(5+(N//min(A,B,C,D,E))) |
p02578 | s522444465 | Accepted | def main():
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(1,n):
if a[i-1]>a[i]:
ans += a[i-1]-a[i]
a[i] = a[i-1]
print(ans)
if __name__ == "__main__":
main()
|
p02687 | s184769528 | Wrong Answer | print('ABC') if input() == 'AGC' else print('AGC')
|
p03719 | s936023223 | Wrong Answer | a,b,c=map(int,input().split())
print(["No","Yes"][a<=b<=c]) |
p02594 | s114077295 | Accepted | print("Yes" if int(input()) >= 30 else "No") |
p03241 | s596776572 | Accepted | n,m = map(int,input().split())
def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
divisors.sort(reverse=True)
return divisors
cnd = make_divisors(m)
for i in range(len(cnd)):
if m // cnd[i] >= n:
print(cnd[i])
exit()
|
p03252 | s870202253 | Wrong Answer | s = input()
t = input()
dict = {}
ans = "Yes"
for i in range(len(s)):
if s[i] != t[i]:
if t[i] in dict:
ans = "No"
break
else:
dict.update({t[i]:True})
print(ans) |
p02687 | s473317825 | Accepted | print('ARC' if input()[1]=='B' else 'ABC') |
p02743 | s895815541 | Wrong Answer | import math
a,b,c = map(int, input().split())
compare_num = math.sqrt(a) + math.sqrt(b) - math.sqrt(c)
if compare_num < 0:
print("Yes")
else:
print("No") |
p03250 | s114969874 | Accepted | A, B, C = sorted(map(int, input().split()))
print(C*10 + A+B)
|
p02947 | s431965475 | Accepted | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from operator import mul
from functools import reduce
from collections import Counter
def cmb(n,r):
r = min(n-r,r)
if r == 0: return 1
over = reduce(mul, range(n, n - r, -1))
under = reduce(mul, range(1,r + 1))
return over // under
n = int(readline())
s = ["".join(sorted(list(readline().decode().rstrip()))) for _ in range(n)]
c = Counter(s)
l = [cmb(v,2) for k, v in c.items() if v >=2]
print(sum(l)) |
p02873 | s832323853 | Wrong Answer | S=input()
A=[0]*(len(S)+1)
for i in range(len(S)):
if S[i]=='<':
A[i+1]=max(A[i+1],A[i]+1)
for i in range(len(S)-2,0,-1):
if S[i]=='>':
A[i]=max(A[i],A[i+1]+1)
print(sum(A))
|
p02860 | s923778084 | Accepted | n = int(input())
s = input()
print('Yes' if s[:n // 2] == s[n // 2:] else 'No')
|
p03251 | s610358038 | Accepted | n, m, x, y = map(int, input().split())
x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))
flag = False
if max(x_list) < min(y_list):
flag = True
if flag:
for i in range(max(x_list) + 1, min(y_list) + 1):
if x < i <= y:
flag = True
break
else:
flag = False
if flag:
print('No War')
else:
print('War') |
p03351 | s493052286 | Wrong Answer | a, b, c, d = map(int,input() . split())
x = int(a - b)
y = int(b - c)
z = int(c - a)
if abs(x) <= d or abs(y) <= d or abs(z) <= d:
print('Yes')
else:
print('No') |
p02813 | s080171483 | Accepted | import itertools
n = int(input())
p = tuple(map(int,input().split()))
q = tuple(map(int,input().split()))
l=list(itertools.permutations(list(range(1,n+1))))
print(abs(l.index(p) - l.index(q))) |
p03838 | s782193512 | Accepted | x,y = map(int, input().split())
if x <= y:
if abs(x) <= abs(y):
ans = min(y-x, y-(-x)+1)
else:
ans = min(y-x, 1 + abs(-y-x))
else:
ans = abs(abs(x) - abs(y)) + 1
if x*y > 0: ans += 1
print(ans) |
p02720 | s048112705 | Accepted | k = int(input())
ans = [i for i in range(1,10)]
i = 0
for i in range(k):
now = ans[i]
if str(now)[-1] == '0':
ans.append(now*10)
ans.append(now*10+1)
elif str(now)[-1] == '9':
ans.append(now*10+8)
ans.append(now*10+9)
else:
ans.append(now*10+now%10-1)
ans.append(now*10+now%10)
ans.append(now*10+now%10+1)
if len(ans) > k:
break
print(ans[k-1])
|
p02972 | s466068914 | Accepted | n = int(input())
A = [None] + [int(i) for i in input().split()]
B = [0] * (n + 1) # 1-indexed
ans = []
for i in range(1, n + 1)[::-1]:
_tmp = sum(B[i * 2::i])
if _tmp % 2 != A[i]:
B[i] += 1
ans.append(str(i))
print(len(ans))
print(" ".join(ans))
|
p02699 | s838855598 | Accepted | S, W = map(int, input().split())
if S <= W:
print('unsafe')
else:
print('safe') |
p02687 | s387194973 | Wrong Answer | # coding: utf-8
# Your code here!
tmp = input()
if tmp == "ABC":
print("ARC")
else:
print("ARC") |
p03779 | s482669255 | Wrong Answer | x = int(input())
z = 0
for i in range(1,10**5):
s = i*(i+1)//2
if s > x:
z = x - s + i
break
print(i-1+z) |
p02678 | s307300433 | Wrong Answer | import networkx as nx
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
G = nx.Graph()
N, M = map(int, input().split())
edge = [tuple(map(int, input().split())) for _ in range(M)]
G.add_edges_from(edge)
pre = nx.predecessor(G, 1)
exit()
print("Yes")
for i in range(2, N + 1):
print(pre[i][0]) |
p03126 | s003883704 | Wrong Answer | import collections
N,M=map(int,input().split())
A=[]
for i in range (N):
A.append(list(map(int,input().split())))
B=[]
count=0
ans=0
for i in range (N):
for j in range (1,A[i][0]+1):
B.append(A[i][j])
for i in range (M):
count=0
for j in range (len(B)):
if B[j]==i:
count+=1
if count==N:
ans+=1
print(ans) |
p03639 | s613144691 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
cnt1 = 0
cnt4 = 0
cnt2 = 0
for i in a:
if i % 2 != 0:
cnt1 += 1
elif i % 4 == 0:
cnt4 += 1
elif i % 2 == 0:
cnt2 += 1
if cnt1 > cnt4 and n > 3:
print("No")
elif cnt4 >= 1:
print("Yes")
else:
print("No")
|
p03693 | s505268838 | Wrong Answer | r,g,b=map(int,input().split())
print("YES"if 100*r+10*g+b%4==0 else "NO") |
p03556 | s414330029 | Accepted | n= int(input())
for i in range(n,-1,-1):
if (i**0.5).is_integer():
print(i)
break |
p04012 | s286059386 | Accepted | def problemB():
""" B - 美しい文字列 """
w = input()
while True:
if len(w) == 0:
ans = 'Yes'
break
find = w[0]
cnt = w.count(find)
if cnt % 2 == 1:
ans = 'No'
break
w = w.replace(find, '')
print(ans)
if __name__ == '__main__':
problemB() |
p02571 | s781095477 | Accepted | S = str(input())
T = str(input())
Slen = len(S)
Tlen = len(T)
diff = Slen - Tlen
ans = [0] * (diff+1)
for i in range(diff+1):
S_i = i
for j in range(Tlen):
if S[S_i] != T[j]:
ans[i] = ans[i] + 1
S_i += 1
min_ans = min(ans)
print(min_ans) |
p03137 | s549406510 | Accepted | n, m = map(int, input().split())
x = list(map(int, input().split()))
if n >= m:
print(0)
else:
del x[m:]
x.sort()
d = []
for i in range(len(x) - 1):
d.append(x[i+1] - x[i])
d.sort()
print(sum(d[:(m-n)]))
|
p03145 | s535924971 | Accepted | a,b,c=map(int,input().split())
print(a*b//2) |
p03698 | s552783365 | Accepted | s=input()
for i in range(len(s)-1):
for j in range(i+1,len(s)):
if s[i]==s[j]:
print("no")
break
else:
continue
break
else:
print("yes") |
p02982 | s486530464 | Accepted | import math
a,b=map(int, input().split())
x=[list(map(int,input().split()))for _ in range(a)]
c = 0
for i in x:
for j in x:
ans = 0
for k in range(b):
ans += abs(i[k]-j[k])**2
q = math.sqrt(ans)
if q.is_integer() == True:
c += 1
d = (c-a)//2
print(d) |
p02678 | s916177245 | Accepted | from collections import deque
N, M = map(int, input().split())
d = {i:[] for i in range(1, N+1)}
for _ in range(M):
A, B = map(int, input().split())
d[A].append(B)
d[B].append(A)
par = [-1]*(N+1)
par[1] = 0
q = deque([1])
while q:
a = q.popleft()
for b in d[a]:
if par[b]!=-1:continue
par[b] = a
q.append(b)
print("Yes")
for i in range(2, N+1):
print(par[i])
|
p03261 | s030690914 | Wrong Answer | import sys
n = int(input())
w = input()
words=[]
words.append(w)
for i in range(1,n):
w = input()
words.append(w)
if w not in words:
if words[i-1][-1]==words[i][0]:
continue
else:
print("No")
sys.exit()
else:
print("No")
sys.exit()
print("Yes") |
p03745 | s337653547 | Accepted | N = int(input())
A = list(map(int, input().split()))
if N == 1:
print(1)
quit()
A.append(A[N-1])
ans = 1
last = A[0]
s = 0
for i in range(N-1):
if not(A[s] <= A[i] <= A[i+1]) and not(A[s] >= A[i] >= A[i+1]):
s = i + 1
ans += 1
print(ans) |
p02622 | s100565419 | Wrong Answer | def main():
S = list(map(str, input().split()))
T = list(map(str, input().split()))
count = 0
for i,s in enumerate(S):
if s != T[i]:
count +=1
print(count)
if __name__ == '__main__':
main()
|
p03680 | s911924762 | Wrong Answer | *A, = map(int, open(0).read().split())
N = A[0]
visited = [0]*(N+1)
a = A[1]
cnt = 1
while True:
a = A[a]
cnt += 1
if a == 2:
print(cnt)
break
if visited[a]:
print(-1)
break
visited[a] = True
|
p03286 | s574597388 | Accepted | N=int(input())
A= [(-2)**i for i in range(40)]
#print(A)
ans=""
for i,num in enumerate(A):
if N%((-2)**(i+1))==0:
ans += "0"
else:
ans += "1"
N -= num
if N==0:
break
print(ans[::-1]) |
p02556 | s705270760 | Accepted | import sys
stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))
def main():
n = ni()
xy = list(nl() for _ in range(n))
xpy = [x + y for x, y in xy]
xmy = [x - y for x, y in xy]
print(max(max(xpy) - min(xpy), max(xmy) - min(xmy)))
if __name__ == '__main__':
main()
|
p02664 | s527030595 | Wrong Answer | s = input()
dp = [[-1000]*2 for _ in range(len(s)+1)]
dp[0][0] = 0 #D
dp[0][1] = 0 #P
for i in range(len(s)):
if s[i] == "D":
dp[i+1][0] = max(dp[i][0]+1,dp[i][1]+2)
if s[i] == "P":
dp[i+1][1] = max(dp[i][0],dp[i][1])
if s[i] == "?":
dp[i+1][0] = max(dp[i][0]+1,dp[i][1]+2) #Dの時
dp[i+1][1] = max(dp[i][0],dp[i][1]) #Pの時
print(max(dp[len(s)][0],dp[len(s)][1])) |
p02993 | s621895772 | Accepted | s = input()
if s[0]==s[1] or s[1]==s[2] or s[2]==s[3]:
print('Bad')
else:
print('Good') |
p03380 | s923536009 | Accepted | import bisect
n = int(input())
A = sorted(list(map(int,input().split())))
ma = A[-1]
half = ma / 2
index = bisect.bisect_left(A,half)
if index != 0:
ans = A[index-1] if half - A[index-1] <= A[index] - half else A[index]
else:
ans = A[0]
print(ma,ans) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.