problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03339 | s377252965 | Wrong Answer | n=int(input())
s=input()
wc=[0]
ec=[0]
for i in range(n):
if s[i]=="W":
wc.append(wc[i]+1)
ec.append(ec[i])
else:
wc.append(wc[i])
ec.append(ec[i]+1)
ans=10**6
for i in range(n):
tmp=0
tmp+=wc[i]
tmp+=ec[n]-ec[i]
ans=min(tmp,ans)
print(ans) |
p03719 | s533227480 | Wrong Answer | a,b,c=map(int,input().split())
if a<=b and b<=c:
print("Yes")
else:
print("No") |
p03730 | s850132031 | Accepted | a, b, c = map(int, input().split())
ans = 'NO'
for i in range(b):
if ((a*i) % b) == c: ans = 'YES'
print(ans) |
p02993 | s005138368 | Wrong Answer | s=input()
print("Good" if any([s[i]!=s[i+1] for i in range(len(s)-1)]) else "Bad") |
p02881 | s757666042 | Accepted | from math import sqrt
n=int(input())
def make_divisors(n):
lower_divisors , upper_divisors = [], []
i = 1
while i*i <= n:
if n % i == 0:
lower_divisors.append(i)
if i != n // i:
upper_divisors.append(n//i)
i += 1
return lower_divisors + upper_divisors[::-1]
l=make_divisors(n)
if len(l)%2==0:
print((l[len(l)//2]+l[(len(l)//2)-1])-2)
elif len(l)%2==1:
print(int((sqrt(n)*2)-2)) |
p02789 | s823231740 | Wrong Answer | arr = set(map(int, input().split()))
print('AC' if len(arr) == 1 else 'WA')
|
p03637 | s019702960 | Accepted | n = int(input())
a = list(map(int, input().split()))
cnt4 = 0
cnt2 = 0
for i in a:
if i % 4 == 0:
cnt4 += 1
elif i % 2 == 0:
cnt2 += 1
if cnt4 >= n//2:
print('Yes')
elif 2 * cnt4 >= n - cnt2:
print('Yes')
else:
print('No') |
p02730 | s688133344 | Wrong Answer | def is_kaibun(s):
if len(s) % 2 == 1:
for i in range(int((len(s) + 1) / 2)):
if s[i] != s[-(i + 1)]:
return False
return True
s = input()
result = is_kaibun(s) and is_kaibun(s[:int((len(s) - 1) / 2)]) and is_kaibun(s[int(((len(s) + 3) / 2) - 1):])
print('Yes' if result else 'No')
|
p03324 | s385968846 | Accepted | D, N = map(int, input().split())
if N < 100:
ans = N * 100 ** D
else:
ans = N * 100 ** D + 100**D
print(ans)
|
p02756 | s648106950 | Accepted | from collections import deque
s = deque(input())
q = int(input())
t = 0
for _ in range(q):
query = list(input().split())
query[0] = int(query[0])
if query[0] == 1: t = 1 - (t)
else:
if t == 0:
if int(query[1]) == 1: s.appendleft(query[2])
else: s.append(query[2])
else:
if int(query[1]) == 1: s.append(query[2])
else: s.appendleft(query[2])
if t == 0: print(*s, sep = '')
else: print(*reversed(s), sep = '') |
p03997 | s292702279 | Wrong Answer | a = int(input())
b = int(input())
h = int(input())
print(0.5*h*(a+b))
|
p03274 | s848717966 | Accepted | import numpy as np
n, k = map(int, input().split())
x = np.array(list(map(int, input().split())))
result = []
for i in range(n-k+1):
l, r = x[i], x[i+k-1]
if l*r >= 0:
result.append(max(abs(l), abs(r)))
else:
result.append(abs(2*l-r))
result.append(abs(2*r-l))
print(min(result)) |
p03632 | s462899465 | Accepted | A, B, C, D = map(int, input().split())
ans = -1
for i in range(101):
if (A <= i) and (C <= i) and (i <= B) and (i <= D):
ans += 1
print(max(ans,0))
|
p02787 | s395630510 | Wrong Answer | h, n = map(int, input().split())
dp = [10**10]*(h+1)
dp[0] = 0
for _ in range(n):
a, b = map(int, input().split())
for end in range(1, h+1):
start = end - a
if start < 0:
continue
dp[end] = min(dp[end], dp[start]+b)
print(dp[h])
|
p02778 | s805881510 | Accepted | S=input()
list=list(S)
a=len(list)
answer=[]
s=0
while s<a:
answer.append('x')
s=s+1
y=''.join(answer)
print(y) |
p02780 | s738474533 | Accepted | N, K = map(int, input().split())
def calculate_Expectation(n):
n = int(n)
p = 1/n
e = p * (n*(n+1)/2)
return e
E = list(map(calculate_Expectation, input().split()))
if N == K:
print(sum(E))
else:
S = [0]
for i, e in enumerate(E):
S.append(S[i]+e)
sum_of_E = []
for left in range(1, N+1-K):
right = left + K
sum_of_E.append(S[right]-S[left])
print(max(sum_of_E)) |
p03075 | s598249338 | Wrong Answer | li = []
for i in range(5):
li.append(int(input()))
k = int(input())
if li[0] - li[4] > k:
print(':(')
else:
print("Yay!")
|
p02783 | s269616854 | Accepted | h, a = map(int, input().split())
div, mod = divmod(h, a)
if mod > 0:
print(div + 1)
else:
print(div)
|
p03037 | s568450890 | Accepted | n,m=map(int,input().split())
L=[0]*m
R=[0]*m
ans=0
for i in range(m):
L[i],R[i]=map(int,input().split())
print(max(0,(min(R)-max(L)+1)))
|
p04011 | s231871904 | Accepted | N = int(input())
K = int(input())
X = int(input())
Y = int(input())
cost = 0
for i in range(1,N+1):
if i <= K:
cost += X
else:
cost += Y
print(cost) |
p03836 | s945483278 | Accepted | sx, sy, tx, ty = map(int, input().split())
ans = ""
ans = "R"*(tx-sx) + "U"*(ty-sy) + "L"*(tx-sx) + "D"*(ty-sy) + "L" + "U"*(ty+1-sy) + "R"*(tx+1-sx) + "D" +"R" + "D"*(ty+1-sy) + "L"*(tx+1-sx) + "U"
print(ans) |
p03672 | s713286142 | Accepted | s = input()
rev = s[::-1]
n = len(s)
for i in range(1, n):
l = s[i:]
r = rev[i:]
if l[:(n-i)//2] == l[(n-i)//2:] or r[:(n-i)//2] == r[(n-i)//2:]:
print(n-i)
break |
p03481 | s043427806 | Accepted | x,y = map(int,input().split())
for i in range(1,100):
x = x * 2
if x > y:
break
print(i) |
p02727 | s297466865 | Accepted | import sys
input = sys.stdin.readline
from itertools import chain
def readlines(*xy):
for n in xy:
yield sorted(map(int, input().split()), reverse=True)[:n]
yield map(int, input().split())
def main():
x, y, a, b, c = map(int, input().split())
apples = sorted(chain(*readlines(x,y)), reverse=True)
print(sum(apples[:x+y]))
main()
|
p03854 | s405301245 | Accepted | print("NO" if input().replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "") else "YES") |
p03042 | s227963742 | Accepted | S=input()
x=int(S[:2])
y=int(S[2:4])
if 1<=x<=12:
if 1<=y<=12:
print("AMBIGUOUS")
else:
print("MMYY")
else:
if 1<=y<=12:
print("YYMM")
else:
print("NA") |
p02775 | s031057935 | Wrong Answer | n=input()
m=list(n)
l=[int(i) for i in m]
l.reverse()
l.append(0)
k=l
ans=0
for i in range(len(l)):
if k[i]<6:
ans+=k[i]
else:
ans+=10-k[i]
k[i+1]+=1
print(ans) |
p03478 | s183053892 | Accepted | N,A,B = map(int,input().split())
count = 0
for i in range(1,N+1):
tot = 0
num = i
while(num > 0):
tot = tot + num%10
num = int(num/10)
if tot >= A and tot <= B:
count += i
print(count) |
p04045 | s246218984 | Accepted | total, k = map(int, input().split())
d = list(map(int, input().split()))
def total_to_digits(total):
return map(int, list(str(total)))
def find_lowest_denomination(total, d):
res = None
for i in range(total, 99999):
digits = list(total_to_digits(i))
if not (set(digits) & set(d)):
print(i)
return
find_lowest_denomination(total, d)
|
p03309 | s038302213 | Accepted | n = int(input())
a = list(map(int,input().split()))
b = [a[i]-i-1 for i in range(n)]
b.sort()
if n%2 == 0:
c = (b[(n-2)//2] + b[n//2])//2
else:
c = b[(n - 1) // 2]
ans = 0
for i in range(n):
ans += abs(b[i]-c)
print(ans)
|
p02811 | s548939429 | Wrong Answer | nums = list(map(int,input().split()))
money_sum = 500 * nums[0]
if nums[1] < money_sum:
print("No")
else:
print("Yes") |
p02743 | s410900509 | Wrong Answer | import math
A,B,C = map(int, input().split())
if math.sqrt(A) + math.sqrt(B) < math.sqrt(C):
print('Yes')
else:
print('No') |
p03719 | s117277316 | Accepted | a,b,c = map(int,input().split())
print("Yes" if a<=c<=b else "No") |
p03061 | s406832926 | Wrong Answer | import sys
from functools import reduce
def gcd(m, n):
r = m % n
return gcd(n, r) if r else n
def gcd_list(numbers):
return reduce(gcd, numbers)
n = int(input())
a = list(map(int, sys.stdin.readline().split()))
c = [gcd_list(a[:i] + a[i+1:]) for i in range(min(n, 20))]
c.sort()
if n == 2:
print(c[1])
else:
print(c[2]) |
p02572 | s832519565 | Accepted | n = int(input())
a = list(map(int,input().split()))
ans = sum(a)**2
mod = 10**9 + 7
for i in range(n):
ans -= a[i]**2
ans //= 2
print(ans%mod) |
p02723 | s825091472 | Accepted | S = input()
if S[2] == S[3] and S[4] == S[5]:
print('Yes')
else:
print('No') |
p02660 | s220326209 | Accepted | n=int(input())
def prime(n):
dic={}
f=2
m=n
while f*f<=m:
r=0
while n%f==0:
n//=f
r+=1
if r>0:
dic[f]=r
f+=1
if n!=1:
dic[n]=1
return dic
def counter(dic):
ans=0
for val in dic.values():
i=1
while i*(i+3)/2<val:
i+=1
ans+=i
return ans
print(counter(prime(n))) |
p03637 | s377784287 | Wrong Answer | N = int(input())
a = list(map(int, input().split()))
a_4 = [val for val in a if val % 4 == 0]
num_4=len(a_4)
a_odd = [val for val in a if val % 2 ==1]
num_odd=len(a_odd)
num_2 = N - num_odd - num_4
if num_4>=num_odd:
print('Yes')
elif 1<=num_4 < num_odd:
if num_2:
print('No')
else:
print('Yes')
else:
print('No') |
p03385 | s359769310 | Accepted | S = input()
if S.count("a") == 1 and S.count("b") == 1 and S.count("c") == 1:
print("Yes")
else:
print("No") |
p02628 | s407315341 | Accepted | n,k = map(int,input().split())
l = list(map(int,input().split()))
l.sort()
cheap = l[:k]
print(sum(cheap)) |
p03838 | s432250804 | Accepted | x,y = map(int, input().split())
ans = 0
if x*y<0:
ans = abs(x+y) +1
else:
ans = abs(x-y)
if 0 < y and y < x:
ans +=2
elif x==0 and y < 0:
ans +=1
elif y < x and x < 0:
ans +=2
elif y==0 and x>0:
ans +=1
print(ans) |
p02795 | s142846344 | Accepted | import math
H,W,N = [int(input()) for i in range(3)]
print(min(math.ceil(N/H),math.ceil(N/W))) |
p02576 | s010566019 | Accepted | #!/usr/bin python3
# -*- coding: utf-8 -*-
n, x, t = map(int, input().split())
ret = (n + (x-1))//x
print(ret*t)
|
p03693 | s404079082 | Wrong Answer | def calc():
ans = r + g + b
if ans%4 == 0:
return "YES"
else:
return "NO"
r, g, b = map(int, input().split())
print(calc) |
p03309 | s947561067 | Wrong Answer | n = int(input())
ls = list(map(int,input().split()))
for i in range(n):
ls[i] -= i+1
mn = int(sum(ls)/n)
if sum(ls)/n> 0:
mx = int(sum(ls)/n) +1
elif sum(ls)/n< 0:
mx = int(sum(ls)/n)-1
else:
mx = float("inf")
lsmn = [abs(e-mn) for e in ls]
lsmx = [abs(e-mx) for e in ls]
print(min(sum(lsmn),sum(lsmx))) |
p02546 | s799288703 | Wrong Answer | S = input()
a = S[:-1]
b = S[-1]
if b == 's': print(a + 'es')
else: print(a + 's') |
p02910 | s715451879 | Wrong Answer | S=input()
count=0
Ans=True
for i in range(len(S)):
if i%2==1 and S[i]=="R":
Ans=False
elif i%2==0 and S[i]=="L":
Ans=False
print(Ans) |
p02793 | s676007439 | Wrong Answer | from fractions import gcd
s=int(input())
t=list(map(int, input().split()))
ans=t[0]
for i in t:
ans=(ans*i)//gcd(ans,i)
mod=10**9+7
ans%=mod
a=0
for j in t:
a+=ans//j
print(int(a)%mod) |
p03962 | s958844627 | Accepted | p = sorted(list(map(int, input().split())))
if p[0] == p[1]:
if p[1] == p[2]:
print(1)
else:
print(2)
elif p[1] == p[2]:
print(2)
else:
print(3)
|
p03319 | s776864729 | Accepted | if __name__ == '__main__':
n, k = map(int, input().split())
a = list(map(int, input().split()))
tolerance = (k - 1)
cnt = 0
for i in range(1, n + 10):
if k + tolerance * (i - 1) < n:
cnt += 1
else:
cnt += 1
break
print(cnt)
|
p02916 | s825372666 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
c = 0
for i in range(N):
a = A[i]
ans += B[a - 1]
ans += c
c = C[a - 1] if a < N else 0
print(ans)
|
p02817 | s503682012 | Accepted | s,t=input().split()
print(t+s)
|
p02963 | s662978851 | Accepted | #!/usr/bin/env python3
def main():
S = int(input())
x1, y1 = 0, 0
x2, y2 = 10**9, 1
x3 = (x2 - (S % x2)) % x2
y3 = (S + x3) // x2
print('{} {} {} {} {} {}'.format(x1, y1, x2, y2, x3, y3))
if __name__ == "__main__":
main()
|
p03417 | s330010329 | Wrong Answer | n, m = map(int, input().split())
cnt = 0
if n == 1 and m == 1:
corner = 1
wall = 0
if n > 1 and m > 1:
corner = 4
wall = max(0, n-2) * 2 + max(0, m-2) * 2
if n == 1 and m > 1:
corner = 2
wall = 0
if n > 1 and m == 1:
corner = 2
wall = 0
print(n * m - corner - wall) |
p03860 | s209991025 | Accepted | s = input().split()[1]
print("A"+s[0]+"C") |
p03146 | s084596212 | Accepted | s = int(input())
a = [s]
ans = 0
for i in range(1000000):
if a[i] % 2 == 0:
if a[i]/2 in a:
ans = i + 2
break
a.append(a[i]/2)
else:
if 3*a[i] + 1 in a:
ans = i + 2
break
a.append(3*a[i] + 1)
print(ans) |
p03126 | s889632380 | Accepted | n,m=map(int,input().split())
S=set(range(1,m+1))
for i in range(n):
K,*A=map(int,input().split())
S&=set(A)
print(len(S)) |
p02859 | s927282829 | Accepted | r = int(input())
print(int(r*r)) |
p02595 | s451013294 | Accepted | N, D = map(int, input().split())
ans = 0
for i in range(N):
x, y = map(int, input().split())
if x ** 2 + y ** 2 <= D ** 2:
ans += 1
print(ans) |
p03759 | s069559888 | Accepted | a,b,c=map(int,input().split());print("YNEOS"[b-a!=c-b::2]) |
p04030 | s569171171 | Accepted | S = input()
res = ''
for s in S:
if s == 'B':
res = res[:len(res)-1]
else:
res += s
print(res)
|
p02678 | s948869853 | Wrong Answer | print("No") |
p02773 | s114692200 | Wrong Answer | import collections as c
n = int(input())
l = [input() for _ in range(n)]
c = c.Counter(l)
c = c.most_common()
for i in c:
if i[1] == c[0][1]:
print(i[0]) |
p04019 | s512695195 | Wrong Answer | S = list(input())
print("Yes" if S.count("S")==S.count("N") and S.count("E") == S.count("W") else "No")
|
p03827 | s481094918 | Accepted | n = int(input())
s = input()
r_list = list()
x = 0
r_list.append(x)
for t in s:
if t == 'I':
x = x + 1
else:
x = x - 1
r_list.append(x)
print(max(r_list)) |
p02994 | s758554027 | Accepted | n, l = map(int, input().split())
apple = [i + l for i in range(n)]
aji = sum(apple)
if 0 in apple:
print(aji)
elif apple[0] > 0:
print(aji - min(apple))
else:
print(aji - max(apple))
|
p02793 | s285967385 | Accepted | import sys
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
MOD = 10**9+7
def gcd(a, b):
while a and b:
if a > b:
a %= b
else:
b %= a
return max(a, b)
def lcm(a, b):
_gcd = gcd(a, b)
return a * b // _gcd
_a = a_ls[0]
for a in a_ls:
_a = lcm(_a, a)
ls = [_a // a for a in a_ls]
print(sum(ls) % MOD) |
p03767 | s809239858 | Accepted | N=int(input())
A=list(map(int,input().split()))
A=sorted(A)
ans=0
for i in range(N):
ans+=A[N+2*i]
print(ans) |
p02618 | s942916183 | Accepted | import random as rd
d = int(input())
c = list(map(int,input().split()))
s = []
for i in range(d):
s.append(list(map(int,input().split())))
for i in range(d):
print(rd.randint(1,26)) |
p02582 | s915301881 | Wrong Answer | a = input()
if a == "RRR":
print(3)
elif a in "RR":
print(2)
elif a == "SSS":
print(0)
else:
print(1) |
p02861 | s242071021 | Wrong Answer | # ABC145C
import itertools, math
n = int(input())
city_list = [list(map(int, input().split())) for _ in range(n)]
length = 0
sum_ = 0
for num, val in enumerate(itertools.permutations(city_list, n)):
for i in range(len(val) - 1):
length = math.sqrt((val[i][0] - val[i + 1][0]) ** 2 + (val[i][1] - val[i + 1][1]) ** 2)
length += length
sum_ += length
length = 0
ans = sum_ / (num + 1)
print(ans) |
p02627 | s870002929 | Accepted | s=input()
if(s.isupper()):
print('A')
else:
print('a')
|
p03035 | s623825235 | Accepted | a,b=map(int,input().split())
if a>=13:
print(b)
elif a>=6 and a<=12:
print(b//2)
else:
print(0)
|
p02982 | s897119801 | Wrong Answer | import numpy as np
from scipy.special import comb
n,d=map(int,input().split())
x=[]
total=0
for i in range(n):
x.append(list(map(int,input().split())))
for i in range(n):
for j in range(n):
if i!=j:
a=np.array(x[i])
b=np.array(x[j])
u=b-a
print(np.linalg.norm(u))
if np.linalg.norm(u)==int(np.linalg.norm(u)):
total+=1
print(total/2) |
p03821 | s334020481 | Wrong Answer | n = int(input())
a = []
b = []
for i in range(n):
x, y = map(int, input().split())
a.append(x)
b.append(y)
a = a[::-1]
b = b[::-1]
ans = 0
for i in range(n):
if b[i]==1:
continue
else:
t = (a[i]+ans) % b[i]
ans += abs(b[i]-t)
print(ans) |
p02577 | s888810158 | Accepted | import math
num = input()
l = len(num)
k = 0
for i in range(l):
k += int(num[i])
ans = k % 9
if ans == 0:
print("Yes")
else:
print("No") |
p03037 | s436748979 | Wrong Answer | n,m = map(int, input().split())
mini = 0
maxi = 10**9
for i in range(m):
l,r = map(int, input().split())
if mini < l:
mini = l
if r < maxi:
maxi = r
print(maxi-mini+1) |
p03328 | s713805169 | Accepted | import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce
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()
c = b - a
c = c*(c+1)//2
print(c-b)
|
p03449 | s250430928 | Accepted | N=int(input())
L=list(map(int,input().split()))
M=list(map(int,input().split()))
ans=0
for i in range(N):
ans=max(ans,sum(L[:i+1])+sum(M[i:]))
print(ans) |
p03723 | s952572039 | Wrong Answer | import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
cookies = np.array(lr())
if len(set(cookies)) == 1:
print(-1)
exit()
if any(cookies&1):
print(0)
exit()
count = 0
half_total = cookies.sum() // 2
while True:
cookies = half_total - cookies//2
count += 1
if any(cookies&1):
print(count)
break
if count == 1000000:
print(-1)
exit()
|
p03611 | s948775864 | Accepted | MAX_A = 100_001
N = int(input())
A = list(map(int, input().split()))
_A = [0] * MAX_A
for a in A:
_A[a] += 1
if a - 1 >= 0:
_A[a - 1] += 1
if a + 1 < MAX_A:
_A[a + 1] += 1
print(max(_A))
|
p03623 | s500257938 | Wrong Answer | x, a, b = map(int, input().split())
if (x - a) < (b - x):
print('A')
else:
print('B')
|
p02797 | s990726477 | Accepted | N, K, S = list(map(int, input().split()))
ans = [0] * N
tmp = S+1
if S+1 > 10 ** 9:
tmp -= 2
for i in range(N):
if i < K:
ans[i] = S
else:
ans[i] = tmp
print(*ans)
|
p04029 | s232871451 | Wrong Answer | n = int(input())
sum = 0
for i in range(1, n+1) :
sum += n
print(sum) |
p02629 | s402993033 | Accepted | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(input())
l = [chr(v) for v in range(ord("a"), ord("z")+1)]
ans = []
while n>0:
n -= 1
i,j = n//26, n%26
ans.append(l[j])
n = i
# ans.append(l[n])
print("".join(ans[::-1])) |
p02683 | s011395682 | Wrong Answer | from itertools import product
n,m,x = list(map(int, input().split()))
book = []
for i in range(n):
book.append(list(map(int, input().split())))
ans = 10 ** 5 * n
for i in product([0,1], repeat=n):
price = 0
skill = [0] * m
for index_, bit in enumerate(i):
if bit:
for j in range(m):
skill[j] += book[index_][ j + 1]
price += book[index_][0]
if all(v >= x for v in skill):
ans = min(ans, price)
print(ans)
|
p03017 | s915018796 | Accepted | import sys
input = sys.stdin.readline
N, A, B, C, D = map(int, input().split())
S = list(input())[: -1]
tri = 0
for i in range(min(A, B) - 1, max(C, D) - 1):
if S[i] == "#" and (S[i + 1] == "#"):
print("No")
exit(0)
for i in range(max(A, B) - 1, min(C, D)):
if S[i] == "." and (S[i - 1] == ".") and (S[i + 1] == "."): tri = 1
if C <= D:
print("Yes")
else:
if tri: print("Yes")
else: print("No")
|
p02730 | s171467129 | Wrong Answer | import copy
S = input()
flag_fail = 0
N = len(S)
while N != 1:
S_temp = copy.copy(S)
N = len(S)
K = N // 2
if N == 2:
break
else:
for i in range(K):
if S_temp[i] != S_temp[N - i - 1]:
flag_fail = 3
break
if flag_fail != 0:
print('No')
break
else:
S = []
S = S_temp[0:K]
if flag_fail == 0:
print('Yes')
|
p02725 | s247687106 | Accepted | K, N = map(int, input().split(' '))
A_ls = list(map(int, input().split(' ')))
rst = -1
for i in range(N):
l = A_ls[(i + 1) % N] - A_ls[i]
if l < 0:
l = K - A_ls[i] + A_ls[(i + 1) % N]
if rst == -1:
rst = l
else:
rst = max(rst, l)
print(K - rst) |
p02778 | s503861346 | Wrong Answer | from sys import stdin
def get_result(data):
return 'x' * len(data[0])
if __name__ == '__main__':
data = list(map(str, stdin.readline().split(' ')))
result = get_result(data)
print(result)
|
p03251 | s348377999 | Wrong Answer | def solve():
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
max_x = max(X, max(x))
min_y = min(Y, min(y))
if max_x < min_y:
print('NO War')
else:
print('War')
if __name__ == '__main__':
solve()
|
p03221 | s086134634 | Accepted | import bisect
n,m = map(int, input().split())
L = [[] for i in range(n)]
D = []
for i in range(m):
p, y= map(int, input().split())
L[p-1].append(y)
D.append([p,y])
for i in range(n):
L[i].sort()
for i in range(m):
s1 = str(D[i][0]).zfill(6)
s2 = str(bisect.bisect_left(L[D[i][0]-1], D[i][1])+1).zfill(6)
print(s1+s2) |
p03962 | s644515097 | Accepted | # -*- coding: utf-8 -*-
colors = input().split()
arr = {}
for color in colors:
arr[color] = 1
print(len(arr)) |
p03069 | s905591866 | Accepted | _,s=open(b:=0);w=a=s.count('.')
for c in s:b+=(x:=c<'.');w-=(x<1);a=min(a,b+w)
print(a) |
p02831 | s133805969 | Wrong Answer | a, b = map(int, input().split())
if a>b:
c = a//b
d = a/c
e = b/c
print(int(min(a*e, b*d)))
else:
f = b//a
g = a/f
h = b/f
print(int(min(a*h, b*g))) |
p03612 | s916143125 | Wrong Answer | n = int(input())
d = list(map(int, input().split()))
res = 0
for i in range(n - 1):
if d[i] == (i + 1): # もし同じ子がいたら
d[i], d[i+1] = d[i+1], d[i]
res += 1
print(res)
|
p02951 | s508936726 | Accepted | a, b, c = map(int, input().split())
ans = c-(a-b)
if ans < 0:
print(0)
else:
print(ans)
|
p02910 | s880121696 | Accepted | s = input()
s_eve = [i for i in s[::2]]
s_odd = [i for i in s[1::2]]
if 'L' not in s_eve and 'R' not in s_odd:
print('Yes')
else:
print('No')
|
p03545 | s345382805 | Accepted | A = input()
op_cnt = len(A) - 1
result = 0
for i in range(2 ** op_cnt):
f = ""
bag = []
for j in range(op_cnt):
if (i >> j) & 1:
bag.append("+")
else:
bag.append("-")
for p_n, p_o in zip(A, bag + [""]):
f += (p_n + p_o)
if eval(f) == 7:
print(f+'=7')
break |
p02732 | s609243235 | Accepted | N = int(input())
myList = list(map(int, input().split()))
sortedList = sorted(myList)
myDict = {sortedList[0]:1}
for myIndx1 in range(1,N):
if sortedList[myIndx1] == sortedList[myIndx1-1]:
myDict[sortedList[myIndx1-1]] = myDict[sortedList[myIndx1-1]] + 1
else:
myDict[sortedList[myIndx1]] = 1
total = 0
for myVal in myDict.values():
total = total + int((myVal*(myVal-1))/2)
for item in myList:
print(total - (myDict[item]-1)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.