problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03494 | s854406599 | Accepted | N = int(input())
A = list(map(int,input().split()))
n = 0
F = 0
while 1:
#すべてが偶数か確認
for i in range(N):
if A[i] % 2 == 0:
continue
else:
F = 1
if F == 1 : break
for i in range(N):
A[i] = A[i]/2
n += 1
print(n) |
p03545 | s459275004 | Accepted | from itertools import product
A,B,C,D =list(input())
for z in product(("+","-"),repeat=3):
if eval(A+z[0]+B+z[1]+C+z[2]+D)==7:
print(A+z[0]+B+z[1]+C+z[2]+D+"=7")
break |
p02756 | s877616389 | Accepted | S = input()
lQ = list(range(int(input())))
def main(S):
T = True
L = ''
R = ''
for i in lQ:
q = list(input().split())
if q[0]=='1':
T = not(T)
else:
if (T and q[1]=='1') or (not(T) and q[1]=='2'):
L += q[2]
elif (T and q[1]=='2') or (not(T) and q[1]=='1'):
R += q[2]
SS = L[::-1] + S + R
if T:
print(SS)
else:
print(SS[::-1])
main(S) |
p02546 | s191298185 | Wrong Answer | S = input("")
if len(S)<=1000:
if S.endswith(('o', 'ch', 's', 'sh', 'x', 'z')):
print(S.lower()+"es")
else:
print(S.lower()+"s")
|
p02948 | s149703251 | Accepted | from heapq import heappop, heappush, heapify
N, M = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]
AB.sort(reverse=True)
que = []
ans = 0
for d in range(1, M + 1):
while AB and AB[-1][0] <= d:
heappush(que, -AB.pop()[1])
if que:
ans += heappop(que)
print(-ans)
|
p03721 | s297085167 | Accepted | #!/usr/bin/env python
n, k = map(int, input().split())
a = [0 for _ in range(n)]
b = [0 for _ in range(n)]
for i in range(n):
a[i], b[i] = map(int, input().split())
d = {}
for i in range(n):
if a[i] not in d:
d[a[i]] = b[i]
else:
d[a[i]] += b[i]
d = sorted(d.items(), key=lambda x: x[0])
tmp = 0
for i in range(len(d)):
tmp += d[i][1]
if tmp >= k:
print(d[i][0])
exit()
|
p02726 | s799296528 | Wrong Answer | N,X,Y=map(int,input().split())
d=[[0 for _ in range(N)] for _ in range(N)]
ans=[0]*N
for i in range(N):
for j in range(i+1,N):
d[i][j]=min(abs(i-j),abs(X-1-i)+abs(Y-1-j)+1,abs(X-1-j)+abs(Y-1-i)+1)
ans[d[i][j]-1]+=1
for o in range(N-1):
print(ans[o+1]) |
p03000 | s600628016 | Accepted | n, x = map(int, input().split())
l = list(map(int, input().split()))
distance = 0
bounds = 1
for i in range(n):
distance += l[i]
if distance <= x:
bounds += 1
else:
break
print(bounds) |
p04019 | s504592097 | Accepted | s = input()
x = 0
y = 0
s = list(set(s))
for i in range(len(s)):
if s[i] == 'N':
y += 1
elif s[i] == 'W':
x -= 1
elif s[i] == 'S':
y -= 1
else:
x += 1
print('Yes' if x == 0 and y == 0 else 'No')
|
p03069 | s058610380 | Accepted | N=int(input())
S=list(map(int,input().replace('#','1').replace('.','0')))
cum=[0]
for i in range(N):
cum.append(cum[-1]+S[i])
ans=10**20
for i in range(N+1):
b = cum[i]
w = N-i-(cum[-1]-cum[i])
ans = min(ans,b+w)
print(ans) |
p03150 | s665188383 | Wrong Answer | import re
S=input()
if re.match('k([a-z]*)eyence',S):
print('YES')
elif re.match('ke([a-z]*)yence',S):
print('YES')
elif re.match('key([a-z]*)ence',S):
print('YES')
elif re.match('keye([a-z]*)nce',S):
print('YES')
elif re.match('keyen([a-z]*)ce',S):
print('YES')
elif re.match('keyenc([a-z]*)e',S):
print('YES')
else:
print('NO') |
p03243 | s885352449 | Accepted | N = int(input())
f = N
while True:
x = str(f)
if all(x[i] == x[0] for i in range(len(x))):
print(x)
exit()
else:
f += 1 |
p02933 | s182503520 | Accepted | a = int(input())
s = input()
if a >= 3200:
print(s)
else:
print('red') |
p02572 | s861505180 | Accepted | N = int(input())
A = map(int,input().split())
ans = 0
ans2 = 0
mod = 10 ** 9 + 7
for a in A:
ans += a
ans2 += a**2
print(((ans **2 - ans2)//2)%mod) |
p03323 | s629603868 | Accepted | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7
a, b = rm()
print(':(' if a > 8 or b > 8 else 'Yay!')
|
p03637 | s834287677 | Accepted | n=int(input())
a=list(map(int,input().split()))
cnt_odd=0
cnt_even=0
cnt_4=0
for i in range(n):
if a[i]%2!=0:
cnt_odd+=1
else:
cnt_even+=1
if a[i]%4==0:
cnt_4+=1
if cnt_even-cnt_4==0:
if cnt_4+1>=cnt_odd:
print("Yes")
else:
print("No")
else:
if cnt_4>=cnt_odd:
print("Yes")
else:
print("No") |
p02629 | s408731659 | Wrong Answer | n = int(input())
ans = ''
while not n == 0:
ans += chr(ord('a') + n % 26 - 1)
n //= 26
print(ans[::-1]) |
p02640 | s461247583 | Accepted | def main():
x,y=map(int, input().split())
all_crane = x * 2
all_turtle = x * 4
if y >= all_crane and y <= all_turtle and y % 2 == 0:
print("Yes")
else:
print('No')
if __name__ == "__main__":
main() |
p04045 | s117766184 | Accepted | def iparse():
return list(map(int, input().split()))
n, k = iparse()
d = iparse()
for i in range(n, 5000000):
tmp = i
f = True
while tmp > 0:
x = tmp % 10
if x in d:
f = False
break
tmp //= 10
if f:
print(i)
exit()
|
p03161 | s006643368 | Accepted | from sys import maxint
N, K = map(int,raw_input().split())
stones = map(int,raw_input().split())
costs = [maxint] * N
costs[0] = 0
for n in range(N) :
for k in range(1,min(K, N-n-1)+1) :
costs[n+k] = min(costs[n+k], costs[n] + abs(stones[n]-stones[n+k]))
print costs[-1] |
p02682 | s298721834 | Accepted | a,b,c,k=map(int,input().split())
if a>=k:
print(k)
elif a+b>=k:
print(a)
else:
k-=(a+b)
print(a-k) |
p03605 | s698661232 | Accepted | s = input()
for i in s:
if i == '9':
print('Yes')
exit()
print('No') |
p03557 | s301165342 | Wrong Answer | import sys
input=sys.stdin.readline
from bisect import bisect_right, bisect_left
n=int(input())
a = [list(map(int, input().split())) for _ in range(3)]
a[0].sort()
a[2].sort()
cnt=0
for i in range(n):
index_1 = bisect_right(a[0],a[1][i])
index_2 = n-bisect_left(a[2],a[1][i])
cnt+=index_1*index_2
print(cnt)
|
p02612 | s624586392 | Wrong Answer | N = int(input())
ans = ((N//1000)+1)*1000-N
print(ans) |
p03817 | s420452557 | Wrong Answer | x = int(input())
n = x//11
k = x%11
if k<=6:
print(2*n+1)
else:
print(2*n+2) |
p03760 | s172099689 | Wrong Answer | o = input()
e = input()
lis = []
for i in range(min(len(o),len(e))):
lis.append(o[i])
lis.append(e[i])
if len(o)>len(e):
lis.append(o[-1])
elif len(o)==len(e):
lis.append(o[-1])
lis.append(e[-1])
print(''.join(lis)) |
p02959 | s045015899 | Accepted | n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
count = 0
for i, b in enumerate(B):
count += min(A[i], b)
b -= A[i]
if b > 0:
x = min(A[i + 1], b)
A[i + 1] -= x
count += x
print(count) |
p02888 | s687355141 | Accepted | n = int(input())
l = list(map(int, input().split()))
l.sort()
cnt = 0
for i in range(n):
k = i + 1
for j in range(i + 1, n):
while k + 1 < n and l[k + 1] < l[i] + l[j]:
k += 1
cnt += k - j
print(cnt) |
p02971 | s113298437 | Accepted | n = int(input())
lst = [int(input()) for _ in range(n)]
lst2 = sorted(lst)
saidai = max(lst2)
for i in range(n):
if lst[i] != saidai:
print(lst2[-1])
else:
print(lst2[-2]) |
p03680 | s927634387 | Accepted | n=int(input())
A=[]
for i in range(n):
a=int(input())
A.append(a-1)
t = 0
r = 0
while True:
t = A[t]
r += 1
if t == 1:
print(r)
break
if r == n:
print(-1)
break
|
p03852 | s816400004 | Accepted | c = input()
l = ["a","e","i","o","u"]
if c in l:
print("vowel")
else:
print("consonant") |
p03778 | s103735452 | Accepted | w,a,c=map(int,input().split())
b=w+a
d=w+c
if a>c:
if a>d:
print(abs(d-a))
else:
print('0')
else:
if c>b:
print(abs(c-b))
else:
print('0') |
p02548 | s488762212 | Wrong Answer | n = int(input())
ans = 0
for a in range(1, n):
ans += (n - 1)
print(ans) |
p02718 | s886792910 | Accepted | def resolve():
a, b = map(int, input().split())
input_data = [int(_) for _ in input().split()]
input_data.sort(reverse=True)
sum_data = sum(input_data)
converge = sum_data * (1 / (4 * b))
if(converge > input_data[b - 1]):
print("No")
else:
print("Yes")
resolve() |
p02706 | s861925682 | Accepted | n, m = map(int, input().split(" "))
a = map(int, input().split(" "))
z = n - sum(a)
print(z if z >=0 else -1) |
p02881 | s867800253 | Accepted | # 解説を読んだ。
n = int(input())
maximum_x = int(n ** (0.5))
move = 0
def gen():
for x in range(1, maximum_x + 1):
if n % x == 0:
yield x + int(n/x) - 2
print(min(gen()))
|
p03627 | s795480870 | Accepted | import collections
N = int(input())
A = list(map(int,input().split()))
C = collections.Counter(A).most_common()
CC = sorted(C,key=lambda x: -x[0])
AA = 0
BB = 0
for cc in CC:
if AA == 0 and cc[1] >= 4:
AA = cc[0]
BB = cc[0]
break
if AA == 0 and cc[1] >= 2:
AA = cc[0]
continue
if BB == 0 and cc[1] >= 2:
BB = cc[0]
break
print(AA*BB) |
p03427 | s270956161 | Accepted | N = input().strip()
k = len(N)
a = int(N[0])
if k==1:
cmax = a
else:
cnt = 0
for i in range(k):
cnt += int(N[i])
cmax = max((a-1)+9*(k-1),cnt)
print(cmax) |
p02811 | s054701367 | Accepted | k,x = list(map(int, input().split()))
print("Yes" if 500*k - x >= 0 else "No") |
p02953 | s483816585 | Wrong Answer | import sys
stdin = sys.stdin
from itertools import accumulate
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
n = ni()
h = na()
f = h[0]
b = False
for hi in h[1:]:
if hi > f:
f = hi
b = False
elif hi == f - 1 and not b:
f = hi
b = True
elif hi == f:
b = True
else:
print("No")
quit()
print("Yes") |
p03778 | s225209488 | Wrong Answer | w, a, b = map(int, input().split())
if a <= b and b <= a+w:
print(0)
elif b <= a+w and a <= b:
print(0)
elif b + w < a:
print(min(abs(a-b-w), abs(b-a-w))) |
p02682 | s584924276 | Accepted | A, B, C, K = map(int, input().split())
if K <= A:
print(K)
elif K <= A+B:
print(A)
else:
print(A-(K-A-B)) |
p03627 | s098648964 | Accepted | n=int(input())
a=list(map(int,input().split()))
a.sort()
side1=0
side2=0
num=0
for num in range(n-1):
if a[num]==a[num+1]:
side2=side1
side1=a[num]
a[num+1]=0
print(side1*side2) |
p03351 | s630180384 | Wrong Answer | a,b,c,d=map(int,input().split())
if (abs(a-b)<=b and abs(b-c)<=b) or abs(a-c)<=b:
print('Yes')
else:
print('No') |
p04020 | s684295313 | Accepted | n = int(input())
ans = 0
chk = 0
for i in range(n):
a = int(input())
p = chk+a
ans += p//2
if a > 0:
chk = p%2
else:
chk = 0
print(ans) |
p02743 | s960156658 | Accepted | import sys
import math
from decimal import Decimal
def main():
a, b, c = [int(_) for _ in input().split()]
a_sq = Decimal(a).sqrt()
b_sq = Decimal(b).sqrt()
c_sq = Decimal(c).sqrt()
if a_sq + b_sq < c_sq:
print("Yes")
else:
print("No")
main() |
p03804 | s890779525 | Accepted | n,m = map(int, input().split())
a = [input() for _ in range(n)]
for _ in range(m):
b = input()
for i in a:
if i.find(b) >= 0: break
print("No")
exit()
print("Yes") |
p03206 | s526605847 | Wrong Answer | D = int(input())
e = 25 - D
print('Chiristmas',end = ' ')
for i in range(e):
print('Eve', end=' ') |
p03433 | s295637291 | Wrong Answer | n=int(input())
a=int(input())
if a==0:
if n%500==0:
print("Yes")
else:
print("No")
else:
print("Yes") |
p03162 | s873754117 | Accepted | #DP-C
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
dp=[[0]*3 for i in range(n)]
dp[0]=l[0]
#print(dp)
for i in range(1,n):
for j in range(3):
for k in range(3):
#同じ活動の場合を除く
if j!=k:
dp[i][j]=max(dp[i-1][k]+l[i][j],dp[i][j])
print(max(dp[-1])) |
p03377 | s502034495 | Accepted | a,b,x=map(int,input().split())
if a<=x<=a+b:print("YES")
else:print("NO") |
p03386 | s515084190 | Accepted | A,B,K=map(int, input().split())
if B-A+1-2*K<1:
for i in range(A,B+1):
print(i)
else:
for i in range(K):
print(A+i)
for i in range(K):
print(B-K+i+1) |
p03323 | s279076483 | Accepted | from sys import stdin
A, B = [int(x) for x in stdin.readline().rstrip().split()]
if A<=8 and B<=8:
print("Yay!")
else:
print(":(") |
p03592 | s065660390 | Accepted | #CODE FESTIVAL 2017 qual A
"""
やるか・やらないかだけで、結果的にできるものは同じ。順序に関係はない。
縦・横にいくつ使うかを全探索で求まった。
"""
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,m,k = map(int,readline().split())
for i in range(n+1):
for j in range(m+1):
dup = i*j*2
res = i*m + j*n - dup
if k == res:
print("Yes")
exit()
print("No") |
p03478 | s497007380 | Accepted | N, A, B = list(map(int, input().split()))
ret = 0
for n in range(1, N+1):
tmp_n = n
tmp_cond = 0
while tmp_n > 0:
tmp_cond += tmp_n % 10
tmp_n //= 10
if A <= tmp_cond <= B:
ret += n
print(ret) |
p03067 | s889657786 | Accepted | x,y,z=(map(int,input().split()))
if(y<x):
x,y=y,x
if(z>=x and z<=y):
print("Yes")
else:
print('No')
|
p03146 | s702757695 | Accepted | s = int(input())
L = [s]
cnt = 2
while True:
if s%2 == 0:
s = s/2
if s in L:
print(cnt)
break
else:
L.append(s)
cnt += 1
else:
s = 3*s+1
if s in L:
print(cnt)
break
else:
L.append(s)
cnt += 1 |
p02743 | s833335263 | Accepted | from decimal import Decimal
a, b, c = (Decimal(x).sqrt() for x in map(int, input().split()))
print('Yes' if a+b < c else 'No') |
p03293 | s189713733 | Accepted | print("Yes" if input() in input()*2 else "No") |
p03699 | s573638306 | Wrong Answer | n = int(input())
s = []
for i in range(n):
s += [int(input())]
if sum(s) % 10 != 0:
print(sum(s))
f = 0
else:
a = []
for i in range(n):
if s[i] % 10 != 0:
a += [s[i]]
if (sum(s) - sum(a)) % 10 != 0:
print(sum(s) - sum(a))
f = 0
exit()
else:
f = 1
if f:
print(0) |
p04011 | s878758664 | Accepted | n = int(input())
k = int(input())
x = int(input())
y = int(input())
ans = min(n, k) * x
n -= min(n, k)
ans += n * y
print(ans)
|
p03815 | s280798815 | Accepted | x = int(input())
ans = (x // 11) * 2
if 0 < x % 11 < 7:
ans += 1
elif 6 < x % 11:
ans += 2
print(ans) |
p02711 | s675848403 | Accepted | N = input()
if N[0]!='7' and N[1] != '7' and N[2] != '7' :
print('No')
else :
print('Yes')
|
p03211 | s305290437 | Wrong Answer | s=input()
a=753
ans=999
for i in range(len(s)-2):
n=int(s[i:i+3])
print(n)
tmp=abs(a-n)
if tmp<ans:
ans=tmp
print(ans)
|
p02947 | s604860262 | Accepted | n = int(input())
S = [input() for _ in range(n)]
ans = 0
c = {}
for s in S:
s = "".join(sorted(s))
if s not in c.keys():
c[s] = 1
else:
ans += c[s]
c[s] += 1
print(ans) |
p03778 | s821288211 | Wrong Answer | w,a,b=map(int,input().split())
if len(sorted(set(range(a,a+w+1)) | set(range(b,b+w+1)))) ==0:
print("0")
elif b>=a+w:
print(b-a-w)
elif a>=b+w:
print(a-b-w) |
p02756 | s363309921 | Accepted | from collections import deque
s = deque(str(input()))
q = int(input())
t = 0
for i in range(q):
o = list(map(str, input().split()))
if o[0] == "1":
t += 1
else:
if o[1] == "1" and t%2 == 0 or o[1] == "2" and t%2 == 1:
s.appendleft(o[2])
else:
s.append(o[2])
if t%2 == 1:
s.reverse()
print("".join(s)) |
p03061 | s675445361 | Accepted | n = int(input())
a = list(map(int,input().split()))
def gcd(x,y):
while y != 0:
x,y = y,x%y
return x
l,r = [0],[0]
for i in range(n-1):
l.append(gcd(l[-1],a[i]))
r.append(gcd(r[-1],a[n-i-1]))
ans = 0
for i in range(n):
ans = max(ans,gcd(l[i],r[n-i-1]))
print(ans)
|
p02570 | s285053080 | Accepted | d, t, s = map(int, input().split())
if d / s <= t:
print('Yes')
else:
print('No') |
p03543 | s508966299 | Accepted | n = input()
if n[0] == n[1] == n[2] or n[1] == n[2] == n[3]:
print("Yes")
else:
print("No") |
p02647 | s164363011 | Accepted | import copy
n,k,*A = map(int,open(0).read().split())
for _ in range(min(50,k)):
B = [0] * (n+1)
for i,d in enumerate(A):
start = max(0,i-d)
B[start] += 1
end = min(n,i+d+1)
B[end] -= 1
light = 0
for i,b in enumerate(B[:n]):
light += b
A[i] = light
print(*A)
|
p02756 | s941958706 | Accepted | s=input()
n=int(input())
front=""
back=s
reverse=False
for i in range(n):
t=input().split()
if t[0]=="1":
reverse=not reverse
else:
if (t[1]=="1")^reverse:
front=front+t[2]
else:
back=back+t[2]
if reverse:
print(back[::-1]+front)
else:
print(front[::-1]+back)
|
p02843 | s569152621 | Wrong Answer | x = int(input())
for i in range(100000):
if(100*i <= x and 105*i >= x):
print(1)
else:
print(0) |
p03243 | s055626956 | Accepted | n = int(input())
answer = 0
while answer < n:
answer += 111
print(answer) |
p03785 | s908962277 | Accepted | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n,c,k=map(int,input().split())
ans=0
person=0
wait=-10**9
T=[int(input())for _ in range(n)]
T.sort()
for i in range(n):
if T[i]-wait<=k and person+1<=c:
person+=1
else:
ans+=1
person=1
wait=T[i]
print(ans)
if __name__=='__main__':
main() |
p02982 | s010166259 | Wrong Answer | import math
N, D = map(int, input().split(' '))
X_ls = []
cnt = 0
for i in range(N):
X_ls.append(list(map(int, input().split(' '))))
for i in range(N - 1):
for j in range(i+1, N):
dist_squared, dist = 0, 0
print(i,j)
for y, z in zip(X_ls[i], X_ls[j]):
dist_squared += (y - z) ** 2
dist = math.sqrt(dist_squared)
if dist - math.floor(dist) == 0:
cnt += 1
print(cnt) |
p02933 | s577196229 | Accepted | a = int(input())
b = input()
print('red' if a < 3200 else b) |
p02706 | s039541977 | Wrong Answer | n, m = map(int, input().split())
a = map(int, input().split())
check = n - sum(list(a))
if check > 0:
print(check)
else:
print(-1) |
p02982 | s151238416 | Accepted | import numpy as np
from itertools import combinations
N, D = map(int, input().split())
X = [np.array(input().split(), dtype=np.int64) for _ in range(N)]
ans = 0
for x, y in combinations(X, 2):
d = pow((x-y), 2).sum()
if (d**0.5).is_integer():
ans += 1
print(ans) |
p02801 | s678535963 | Wrong Answer | x=input("alphabet:")
if x=="z":
print("")
if x!="z":
print(chr(ord(x)+1))
|
p03836 | s487574801 | Accepted | sx,sy, tx,ty = map(int, raw_input().split())
def f(sx,sy,tx,ty):
path = ['D']
path += ['R'] * (abs(tx - sx) + 1)
path += ['U'] * (abs(ty - sy) + 1)
path += ['L'] * (abs(tx - sx) + 1)
path += ['D'] * (abs(ty - sy))
return path
def g(sx,sy,tx,ty):
path = []
path += ['R'] * (abs(tx - sx))
path += ['U'] * (abs(ty - sy) + 1)
path += ['L'] * (abs(tx - sx)+1)
path += ['D'] * (abs(ty - sy)+1)
return path + ['R']
print ''.join(f(sx,sy, tx,ty) + g(sx,sy,tx,ty))
|
p03427 | s713389547 | Wrong Answer | n = [int(i) for i in list(input())]
l = len(n)
ans = (n[0]-1) + 9*(l-1)
print(ans) |
p02639 | s147138239 | Accepted | s = list(map(int, input().split()))
a = s.index(0) + 1
print(a) |
p03478 | s645570406 | Accepted | N, A, B = (int(x) for x in input().split())
Ans = [i if A <= sum(int(x) for x in list(str(i))) <= B else 0 for i in range(1,N+1)]
print(sum(Ans)) |
p03293 | s712442355 | Accepted | s = input()
t = input()
s = s + s
if t in s:
print("Yes")
else:
print("No")
|
p02727 | s664781697 | Accepted | (X,Y,*e),*l=[list(map(int,input().split())) for _ in [0]*4]
s=sorted
P,Q,R=map(s,l)
print(sum(s(P[-X:]+Q[-Y:]+R)[-X-Y:])) |
p03435 | s733015320 | Wrong Answer | y1_list = list(map(int,input().split()))
y2_list = list(map(int,input().split()))
y3_list = list(map(int,input().split()))
a1 = list()
a2 = list()
a3 = list()
for i in range(3):
a1.append(y1_list[i] - y2_list[i])
a2.append(y2_list[i] - y3_list[i])
if a1[0] == a1[1] and a1[2] == a1[0]:
if a2[0] == a1[1] and a2[2] == a1[0]:
print("Yes")
else:
print("No")
else:
print("no")
|
p02657 | s600235922 | Wrong Answer | A=2
B=5
print(A*B) |
p03456 | s294656368 | Accepted | a, b = input().split()
n = int(a + b)
ans = "Yes" if n == int(n ** 0.5) ** 2 else "No"
print(ans)
|
p02641 | s638519035 | Accepted | x,n = map(int, input().split())
p = list(map(int, input().split()))
if n == 0:
print(x)
exit(0)
if x in p:
a,b = 0,0
for i in range(1,102):
if x - i in p:
continue
else:
a = x - i
break
for j in range(1,102):
if x + j in p:
continue
else:
b = x + j
break
if a < 0:
print(b)
elif b > 101:
print(a)
elif abs(x-a) <= abs(x-b):
print(a)
else:
print(b)
else:
print(x) |
p02682 | s189277668 | Wrong Answer | A,B,C,K = map(int,input().split())
print(A,B,C,K)
res = 0
if A>=K:
res= 1*A
else:
for b in range(K-A,B+1):
c = K-A-b
if c >= 0:
ans = 1*A + 0*b + (-1)*c
res = max(res,ans)
else:
break
print(res) |
p04033 | s624967324 | Accepted | a, b = map(int, input().split())
if a > 0:
print('Positive')
elif a <= 0 and b >= 0:
print('Zero')
else:
if (b-a)%2 == 0:
print('Negative')
else:
print('Positive') |
p02719 | s925098727 | Accepted | N, K = map(int, input().split())
m = N % K
if m > 0:
_m = abs(m - K)
if _m < m:
m = _m
print(m) |
p02754 | s140841186 | Wrong Answer | import sys
import math
from collections import defaultdict
sys.setrecursionlimit(10**7)
def input():
return sys.stdin.readline()[:-1]
mod = 10**9 + 7
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
if row <= 0:
return [[] for _ in range(col)]
elif col == 1:
return [I() for _ in range(row)]
else:
read_all = [LI() for _ in range(row)]
return map(list, zip(*read_all))
#################
N,A,B = LI()
num = N//(A+B)
print(num*A + N-(num*(A+B))) |
p03338 | s864299580 | Accepted | n = int(input())
S = list(input())
ans = 0
for i in range(1,n-1):
L = S[:i]
R = S[i:]
UL = set(L)
UR = set(R)
ans = max(ans, len(UL & UR))
print(ans) |
p02973 | s877108562 | Wrong Answer | import bisect
n = int(input())
alist = [int(input()) for _ in range(n)]
l = [alist[0],]
if n > 1:
for a in alist[1:]:
if l[-1] < a:
l[-1] = a
else:
if l[0] >= a:
l = [a] + l
else:
pos = bisect.bisect_right(l, a)
l[pos-1] = a
print(len(l)) |
p02970 | s616675230 | Accepted | import sys
input = lambda: sys.stdin.readline().rstrip()
def solve():
N, D = map(int, input().split())
if N < (D * 2 + 1):
ans = 1
else:
q, r = divmod(N, D * 2 + 1)
ans = q + 1 if r > 0 else q
print(ans)
if __name__ == '__main__':
solve()
|
p03854 | s304724526 | Accepted | s = input()
s = s.replace('eraser', '')
s = s.replace('erase', '')
s = s.replace('dreamer', '')
s = s.replace('dream', '')
if s == '':
print('YES')
else:
print('NO')
|
p02783 | s876167088 | Wrong Answer | H , A = map(int, input().split())
ans = 0
while(H >= 0):
H = H - A
ans + 1
print(ans) |
p02622 | s712040541 | Accepted | S = input()
T = input()
n = 0
for a in range(len(S)) :
if not S[a] == T[a] :
n += 1
print(n) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.