problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03637 | s806184423 | Accepted | from collections import Counter
n=int(input())
a=list(map(int,input().split()))
amod4=list(map(lambda x:x%4, a))
d=Counter(amod4)
if n-d[0]-d[2]<d[0]+1:
print('Yes')
elif d[2]==0 and n==2*d[0]+1:
print('Yes')
else:
print('No')
|
p03001 | s912910385 | Accepted | import sys
from operator import itemgetter
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]
def ss(): return input().split()
def main():
W, H, x, y = mi()
s = W*H/2
cut = 1 if W/2 == x/1 and H/2 == y/1 else 0
print(s, cut)
return
main()
|
p03030 | s446929248 | Accepted | N = int(input())
L = []
for i in range(N):
N, K = input().split()
K = int(K)
L.append([N, -K, i+1])
L.sort()
for i in L:
print(i[2]) |
p02628 | s697923893 | Wrong Answer | from sys import stdin
N, K = map(int, input().split())
prices = list(map(int, input().split()))
prices = sorted(prices)
sum = 0
for i in range(0, K):
print(prices[i])
sum += prices[i]
print(sum) |
p02552 | s119506127 | Wrong Answer | x = input()
if x == 0:
print(1)
elif x == 1:
print(0) |
p02701 | s631521541 | Wrong Answer | N = int(input())
S = [input() for i in range(N)]
print(len(S)) |
p02688 | s390092193 | Accepted | N, K = [int(i) for i in input().split()]
count = [0]*N
for _ in range(K):
d = int(input())
for v in input().split():
j = int(v) - 1
count[j] += 1
sunsuke = 0
for i in count:
if i == 0:
sunsuke += 1
print(sunsuke) |
p03556 | s273572142 | Accepted | import math
N = int(input())
for i in range(N, 0, -1):
if math.sqrt(i) == int(math.sqrt(i)):
print(i)
break
|
p02983 | s495157350 | Accepted | L,R=map(int,input().split())
result=float("inf")
R=min(R,L+4038)
for i in range(L,R+1):
for j in range(i+1,R+1):
result=min(result,i*j%2019)
#if R-L>= 2019:
# result=0
#else:
# l=L%2019
# r=R%2019
# for i in range(l,r+1):
# for j in range(i+1,r+1):
# result=min(result,i*j%2019)
print(result)
|
p03000 | s074356142 | Wrong Answer | n,x=map(int,input().split())
l=list(map(int,input().split()))
k=0
cnt=0
for i in range(n):
k += l[i]
if k>x:
print(i+1)
exit()
else:
cnt += 1
continue
print(cnt) |
p02678 | s426833638 | Wrong Answer | print('No') |
p04033 | s066751268 | Accepted | A, B = map(int, input().split())
if A <= 0 and B >= 0:
print('Zero')
elif A > 0 and B > 0:
print('Positive')
else:
if (B-A)%2 != 0:
print('Positive')
else:
print('Negative') |
p03286 | s530917936 | Accepted | import sys
input = sys.stdin.readline
N = int(input())
i = 0
ans = []
if N == 0:
print(0)
sys.exit()
while N != 0:
i += 1
if N % 2 == 0:
N //= 2
ans.append("0")
else:
if i % 2 == 1:
N -= 1
N //= 2
ans.append("1")
else:
N += 1
N //= 2
ans.append("1")
print("".join(ans[::-1]))
|
p02811 | s215187819 | Accepted | k, x = map(int, input().split())
if 500 * k >= x:
print('Yes')
else:
print('No')
|
p02831 | s925180548 | Accepted | from fractions import gcd
A, B = map(int, input().split())
print(int(A*B//gcd(A,B))) |
p02684 | s559510896 | Wrong Answer | import numpy as np
import math
N, K=map(int,input().split())
A2 = np.zeros(N)
A = list(map(int,input().split()))
#A = list(map(lambda x: x -1 , A))
current_town = 0
i=0
while i<K:
current_town = A[current_town]-1
i=i+1
if A2[current_town] != 0:
cycle = i - A2[current_town]
i = K - (K-i) % cycle
break
else:
A2[current_town] = i
while i<K:
current_town = A[current_town]-1
i=i+1
print(current_town+1)
|
p03061 | s731154744 | Wrong Answer | n=int(input())
a=list(map(int,input().split()))
l=[0]
r=[0]
ans=0
from fractions import gcd
for i in range(n-1):
l.append(gcd(l[i],a[i]))
r.append(gcd(r[i],a[-1]-i))
for i in range(n):
ans=max(ans,gcd(l[i],r[-1-i]))
print(ans)
|
p03076 | s720247747 | Accepted | #nyuuryoku
food=[]
for i in range (5):
food.append(int(input()))
time = 0
#1keta toru 10 watte amari dasu
#amari wo dasu
machi = []
for i in range (5):
if food[i]%10 == 0:
time += food[i]
else:
time += food[i]+(10-(food[i]%10))
machi.append(10-(food[i]%10))
if len(machi) == 0:
print(time)
else:
print(time-max(machi))
|
p03565 | s735403058 | Wrong Answer | import re
word = '?tc????'.replace('?','.')
substring = 'coder'
N = len(word) - len(substring)
found = False
for i in range(N+1):
regexp = re.compile(word[i:i+len(substring)])
if regexp.search(substring):
found = True
res = word[0:i] + substring
print(res.replace('.','a'))
if found == False:
print('UNRESTORABLE') |
p03073 | s534302461 | Accepted | s = list(str(input()))
n = len(s)
cnt = 0
for i in range(n):
if (i % 2) != int(s[i]):
cnt += 1
print(min(cnt, n - cnt)) |
p02627 | s060039810 | Wrong Answer | n=input()
b=n.upper()
print(b)
|
p02833 | s135335613 | Wrong Answer | N = int(input())
import sys
if N & 1:
print(0)
sys.exit()
ans = 0
N /= 2
while N != 0:
ans += N // 5
N /= 5
print(ans) |
p03672 | s966356990 | Accepted | class mystr:
def __init__(self,string):
self.value = string
def isEven(self):
l = len(self.value)
if (not l & 1) and self.value[:l//2] == self.value[l//2:]:
return True
else:
return False
def pop(self):
l = len(self.value)
self.value = self.value[:l-1]
s = mystr(input())
l = len(s.value)
for i in reversed(range(l)):
s.pop()
if s.isEven():
print(i)
break
|
p02633 | s817099107 | Accepted | x = int(input())
k = 2
while k*x%360!=0:
k += 1
print(k) |
p03417 | s757892101 | Accepted | N, M = sorted(map(int, input().split()))
if N == 1:
if M == 1:
print(1)
elif M == 2:
print(0)
else:
print(M - 2)
elif N == 2:
if M == 2:
print(0)
else:
print(0)
else:
print((N - 2) * (M - 2))
|
p03067 | s081313070 | Wrong Answer | a,b,c=list(map(int ,input().split()))
ans_range=range(a,b)
if(c in ans_range):
print("Yes")
else:
print("No")
|
p03041 | s018210765 | Accepted | n, k = map(int, input().split())
s = list(input())
s[k - 1] = chr(ord(s[k - 1]) + 32)
print(''.join(s)) |
p03633 | s567071964 | Accepted | import math
N=int(input())
a = [int(input()) for _ in range(N)]
ans = a[0]
for i in range(1, N):
ans = ans * a[i] // math.gcd(ans, a[i])
print(ans) |
p03017 | s943623155 | Wrong Answer | n, a, b, c, d = map(int, input().split())
s = input()
if "##" in s[min(a,b):max(c,d)]:
print("No")
exit()
if c < d:
print("Yes")
else:
if "..." in s[b-2:c]:
print("Yes")
else:
print("No") |
p03456 | s839067160 | Wrong Answer | n = int(input().replace(" ", ""))
print("Yes" if isinstance(n **.5, int) else "No")
|
p03645 | s217209622 | Accepted | n, m = map(int, input().split())
a, b = [0] * m, [0] * m
root_i = [False] * n
root_n = [False] * n
for i in range(m):
a[i], b[i] = map(int, input().split())
for i in range(m):
if a[i] == 1:
root_i[b[i]] = True
elif b[i] == n:
root_n[a[i]] = True
for i in range(n):
if root_i[i] == True and root_n[i] == True:
print("POSSIBLE")
exit()
print("IMPOSSIBLE") |
p03524 | s903239491 | Accepted | s = input()
ac = s.count('a')
bc = s.count('b')
cc = s.count('c')
if max([ac, bc, cc])-min([ac, bc, cc])<=1:
print('YES')
else:
print('NO') |
p03767 | s371807140 | Wrong Answer | N = int(input())
A=list(map(int,input().split()))
A.sort()
st = sum(A[N:2*N])
ans = 0
for i in range(N):
ans +=A[-2*i]
print(max(st,ans)) |
p03261 | s940164237 | Accepted | n = int(input())
words = set()
w = ''
ok = True
for i in range(n):
nw = input()
if nw in words:
ok = False
break
words.add(w)
if w and w[-1] != nw[0]:
ok = False
w = nw
if ok:
print('Yes')
else:
print('No') |
p02612 | s476432960 | Wrong Answer | N = int(input().strip())
print(N%1000)
|
p03478 | s146360684 | Wrong Answer | n, a, b = map(int, input().split())
res = 0
for i in range(a, n+1):
s = str(i)
sum = 0
for j in s:
sum += int(s)
res += sum
print(res) |
p03720 | s265943103 | Accepted | #print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
N,M=pin()
ans=[0]*N
for i in range(M):
a,b=pin()
ans[a-1]+=1
ans[b-1]+=1
for an in ans:
print(an)
#%%submit!
resolve() |
p02957 | s059810633 | Accepted | a, b = map(int, input().split())
if (a+b) % 2 == 0:
print((a + b) // 2)
else:
print("IMPOSSIBLE") |
p02552 | s482406905 | Accepted | N = int(input())
if N == 0:
print(1)
else:print(0) |
p02899 | s636142532 | Accepted | def q3():
N = int(input())
A = [int(i) for i in input().split()]
ans = [0] * N
for i, a in enumerate(A):
ans[a-1] = i + 1
print(' '.join([str(i) for i in ans]))
if __name__ == '__main__':
q3()
|
p03838 | s084794936 | Accepted | def main():
import sys
input = sys.stdin.readline
x, y = [int(x) for x in input().strip().split()]
dist = abs(abs(x) - abs(y))
if x + dist == y:
print(dist)
elif - x + dist == y or - (x + dist) == y:
print(dist + 1)
elif - (- x + dist) == y:
print(dist + 2)
if __name__ == '__main__':
main() |
p03219 | s018021896 | Accepted | X, Y = map(int, input().split())
print(X+(Y//2)) |
p02641 | s315017672 | Accepted | X,N=list(map(int, input().split(' ')))
if N>0:
p=list(map(int, input().split(' ')))
else:
p=[]
A=0
A2=400
A3=0
for i in range(0,200):
if i in p:
v=0
else:
A=abs(i-X)
if A<A2:
A2=A
A3=i
else:
print(A3)
exit() |
p04031 | s782657393 | Accepted | n = int(input())
a = list(map(int,input().split()))
ave = sum(a)//n
b = c = 0
for i in range(n):
b += (a[i]-ave)**2
c += (a[i] - ave - 1)**2
print(min(b,c))
|
p02595 | s336196669 | Wrong Answer | import math
N,D = map(int,input().split())
cnt = 0
for n in range(N):
a,b = map(int,input().split())
if math.sqrt(a**2 + b**2)-D>=0:
cnt+=1
print(cnt) |
p03251 | s216411406 | Wrong Answer | n,m,x,y=map(int,input().split())
l_x=sorted(list(map(int,input().split())))
l_y=sorted(list(map(int,input().split())))
print("No War" if l_y[0] - l_x[-1] >= 1 else "War") |
p02795 | s205095193 | Accepted | H = int(input())
W = int(input())
N = int(input())
H = H
W = W
count = 0
paint = 0
while paint<N:
if W>H:
count +=1
paint += W
H-=1
else:
count +=1
paint += H
W -=1
else:
print(count)
|
p03323 | s016631877 | Wrong Answer | A,B=map(int, input().split())
if A > 10 or B > 10 or A+B > 16:
print(":(")
else:
print("Yay!")
|
p03352 | s813214168 | Accepted | n = int(input())
import math as m
if n < 4:
print(1)
exit(0)
perfect = 1
for b in range(2,int(n**0.5)+1):
p = int(m.log(n,b))
x = b**(p+1)
if x > n:
x = b**p
perfect = max(perfect,x)
#print(b,x)
if perfect == n:
break
print(perfect)
|
p03785 | s316068943 | Wrong Answer | n,c,k = map(int,input().split())
t = list(int(input()) for i in range(n))
t = sorted(t)
leave = t[0] + k
cnt = 1
ans = 0
for i in range(1,n):
if cnt == 0 or leave < t[i]:
ans += 1
cnt = 1
leave = t[i] + k
else:
cnt += 1
print(ans+1)
|
p02695 | s056598713 | Accepted | from itertools import combinations_with_replacement
def main():
N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for x in range(Q)]
ans = 0
for x in combinations_with_replacement(range(1, M+1), N):
r = 0
for a,b,c,d in abcd:
if x[b-1] - x[a-1] == c:
r += d
ans = max(ans,r)
print(ans)
if __name__ == '__main__':
main() |
p03721 | s525216013 | Accepted | import heapq
n, k = map(int,input().split())
q = []
for i in range(n):
q.append(list(map(int, input().split())))
heapq.heapify(q)
cnt = 0
while cnt < k:
a, b = heapq.heappop(q)
cnt += b
print(a) |
p02699 | s522312463 | Accepted | S,W = list(map(int,input().split()))
print("safe" if S>W else "unsafe")
|
p03665 | s034720379 | Wrong Answer | import sys
def input():
return sys.stdin.readline().strip()
N, P = map(int, input().split())
A = list(map(int, input().split()))
odd = sum([a % 2 for a in A])
even = len(A) - odd
ans = (2 ** even) * (2 ** (odd - 1))
print(ans)
|
p03319 | s430039364 | Wrong Answer | N, K = map(int, input().split())
A = list(map(int, input().split()))
i = A.index(1)
ans = (i+1)//2
ans += ((N-i-1-(i&1))+1)//2
print(ans) |
p03163 | s771275464 | Accepted |
N,W=map(int,input().split())
dp=[0]*(W+1)
L = sorted([list(map(int,input().split())) for i in range(N)])
s=0
for w, v in L:
s+=w
for j in range(min(W,s),w-1,-1):
if dp[j-w]+v > dp[j]: dp[j]=dp[j-w]+v
print(max(dp)) |
p03076 | s673647742 | Accepted | a = []
for i in range(5):
a.append(int(input()))
p = 10
for i in range(5):
if a[i] % 10 != 0:
p = min(p,a[i]%10)
ans = 0
for i in range(5):
if a[i] % 10 != 0:
if a[i] % 10 == p:
ans += a[i]
p = 10
else:
ans += a[i] - a[i] % 10 + 10
else:
ans += a[i]
print(ans) |
p02970 | s698121387 | Wrong Answer | a,b=map(int,input().split())
d=b*2+1
c=a/d
if c>b:
print(c+1)
else:
print(c) |
p02696 | s981481190 | Wrong Answer | A, B, N = map(int, input().split())
maxFloor = 0
def floor(x):
num = int(x // 1)
return num
check = floor(A * (B - 1) / B) - A * floor((B - 1) / B)
print(check) |
p03261 | s590247161 | Accepted | n = int(input())
s_1 = input()
word_list = [s_1]
target = s_1[-1]
frag = "Yes"
for i in range(n-1):
s = input()
if s in word_list :
frag = "No"
if target == s[0]:
target = s[-1]
else:
frag = "No"
word_list.append(s)
print(frag) |
p03760 | s485784400 | Wrong Answer | s=input()
t=input()
l=""
i=0
j=0
while i < len(s):
l+=s[i]
i+=1
while j < len(t):
l+=t[j]
j+=1
print(l)
|
p02606 | s438467282 | Wrong Answer | l,r,n=map(int,input().split())
print((r-l)//n) |
p02838 | s608074110 | Wrong Answer | N = int(input())
MOD = 1e+9 + 7
a = [int(i) for i in input().split()]
b = [0 for _ in range(60)]
for i in a:
for j in range(60):
b[j] += (i >> j) & 1
ans = 0
for i, j in enumerate(b):
second = 1
for _ in range(i):
second *= 2
second %= MOD
ans += (j * (N - j)) * second
ans %= MOD
print(int(ans)) |
p03161 | s635552063 | Accepted | n, k = map(int, input().split())
lst = list(map(int, input().split()))
cst = [float('inf')] * n
cst[0] = 0
for _ in range(0, n):
m = min(n-(_+1),k)
for i in range(0, m+1):
cst[_+i] = min(cst[_] + abs(lst[_+i] - lst[_]),cst[_+i])
print(cst[n-1]) |
p02854 | s291995264 | Wrong Answer | from itertools import accumulate
N = int(input())
A = list([int(x) for x in input().split()])
count = 0
ironbar = list(accumulate(A))
print(ironbar)
i = 0
j = len(A) - 1
while i + 1 < j:
left = ironbar[i]
right = ironbar[j] - ironbar[i]
if left > right:
j = (i+j) // 2
elif left < right:
i = (i+j) // 2
else:
print(0)
exit()
print(abs(ironbar[i]-ironbar[j]))
|
p04019 | s728216152 | Accepted | x = list(input())
if 'N' in x and 'S' in x:
if 'E' in x and 'W' in x:
print('Yes')
elif 'E' not in x and 'W' not in x:
print('Yes')
else:
print('No')
elif 'N' not in x and 'S' not in x:
if 'E' in x and 'W' in x:
print('Yes')
elif 'E' not in x and 'W' not in x:
print('Yes')
else:
print('No')
else:
print('No') |
p02555 | s472392374 | Wrong Answer | S = int(input())
mod = 10**9 + 7
dp = [0]*(S+10)
dp[0] = 1
for i in range(S-2):
for j in range(3, 10):
dp[i+j] += dp[i]
dp[i+j] %= mod
print(dp[S]) |
p02724 | s126612487 | Wrong Answer | num = int(input())
hap1000 = num/500
hap5 = (num-hap1000*500)/5
print(int(1000*hap1000+5*hap5)) |
p04019 | s348028056 | Wrong Answer | s = input()
ans1 = True
ans2 = True
if "N" in s:
ans1 = "S" in s
if "W" in s:
ans2 = "E" in s
print("Yes" if ans1 & ans2 else "No") |
p02713 | s584344367 | Accepted | from math import gcd
n = int(input())
ans = 0
for a in range(1,n+1):
for b in range(1,n+1):
for c in range(1,n+1):
ans += gcd(a,gcd(b,c))
print(ans) |
p03795 | s586760203 | Wrong Answer | N = 100
x = N * 800
y = 0
for i in range(N+1):
if i % 15 == 0:
y = y + 200
print(x-y) |
p02701 | s464748172 | Accepted | n = int(input())
item = {}
for i in range(n):
it = input()
item[it] = 'y'
print(len(item))
|
p03285 | s619386994 | Accepted | n = int(input())
a = 0
for i in range(n+1):
for j in range(n+1-i):
if i*4 + j*7 == n:
a += 1
if a >= 1:
print("Yes")
else:
print("No") |
p03103 | s763287456 | Accepted | N,M=map(int,input().split())
C=[0]*N
for i in range(N):
C[i]=tuple(map(int,input().split()))
C.sort(key=lambda x:x[0])
cnt=0
cost=0
for i in range(N):
#print(C[i][0],C[i][1])
if cnt+C[i][1] < M:
#print(cnt,cost)
cnt += C[i][1]
cost += C[i][0]*C[i][1]
else:
#print(cnt,cost)
cost += (M-cnt)*C[i][0]
break
print(cost) |
p03457 | s471636988 | Wrong Answer | N = int(input())
t_0 = 0
x_0 = 0
y_0 = 0
flag = True
for _ in range(N):
t,x,y = map(int,input().split())
if abs(x-x_0) + abs(y-y_0) <= abs(t-t_0) and (abs(x-x_0)+abs(y-y_0))%2 == abs(t-t_0)%2:
continue
flag = False
print("Yes" if flag else "No") |
p02795 | s678265827 | Accepted | H=int(input())
W=int(input())
N=int(input())
if H<W:
H,W=W,H
ans = N // H
if N % H > 0: ans += 1
print(ans)
|
p03633 | s529753030 | Accepted | from math import gcd
n=int(input())
a=int(input())
for i in range(n-1):
b=int(input())
g=gcd(a,b)
a=a*b//g
print(a) |
p02766 | s522622709 | Accepted | N, K = map(int, input().split())
def Base_10_to_n(X, n):
if (int(X/n)):
return Base_10_to_n(int(X/n), n)+str(X%n)
return str(X%n)
print(len(Base_10_to_n(N, K))) |
p03338 | s208448297 | Wrong Answer | import numpy as np
N=int(input())
S=str(input())
s_list = "abcdefghijklmnopqrstuvwxyz"
max_count = 0
for i in range(1,N-1): # N字目で切った場合
count_list = np.zeros(26)
for k in range(i):
if S[k] in S[i:len(S)-1]:
count_list[s_list.index(S[k])] = count_list[s_list.index(S[k])] + 1
# print(len([1 for x in count_list if x>0]))
if max_count < len([1 for x in count_list if x>0]):
max_count = len([1 for x in count_list if x>0])
print(max_count)
|
p03723 | s239565522 | Accepted | l = [list(map(int, input().split()))]
i = 0
while (1):
a, b, c = map(int,l[i])
if (a % 2 == 1 or b % 2 == 1 or c % 2 == 1):
print(i)
break
t = [b / 2 + c / 2, c / 2 + a / 2, a / 2 + b / 2]
if (t in l):
print(-1)
break
l.append(t)
i+=1
|
p03252 | s186689490 | Accepted | a=input()
b=input()
dic_a={}
dic_b={}
for i in a:
if i not in dic_a:
dic_a[i]=1
else:
dic_a[i] += 1
for i in b:
if i not in dic_b:
dic_b[i]=1
else:
dic_b[i] += 1
print("Yes" if (sorted(dic_a.values())==sorted(dic_b.values())) else "No" ) |
p03377 | s537310331 | Accepted | a,b,x = map(int, input().split())
if a + b < x :
print("NO")
elif a > x :
print("NO")
else :
print("YES")
|
p02582 | s482804752 | Wrong Answer | S = str(input())
count = 0
for x in range(len(S)):
if S[0] == 'R' and x == 0:
count = count + 1
elif S[x] == 'R' and S[x - 1] == 'R':
count = count + 1
elif S[x] == 'S':
continue
if count >= 0:
print(count)
else:
print(0) |
p02779 | s522280181 | Accepted | n=int(input())
a=list(map(int,input().split()))
d={}
ans="YES"
for i in range(n):
if(a[i] in d):
ans="NO"
break
else:
d[a[i]]=1
print(ans) |
p02899 | s429626879 | Wrong Answer | import numpy as np
def plus(n):
return n+1
N = int(input())
A = list(map(int,input().split()))
A = np.array(A)
A = A.argsort()
ans = [ n+1 for n in A]
for i in ans:
print(i,end="")
|
p04031 | s495389241 | Accepted | from math import ceil,floor
ansc,ansf = 0,0
n = int(input())
a = list(map(int,input().split()))
gp = sum(a)/len(a)
c = ceil(gp)
f = floor(gp)
for i in a:
ansc += (i-c)**2
ansf += (i-f)**2
print(min(ansc,ansf)) |
p02842 | s669625941 | Accepted | n = int(input())
for i in range(50001):
if n == int(i*1.08):
print (i)
exit()
print (":(") |
p02778 | s889608489 | Accepted | S=raw_input()
print "x"*len(S) |
p02756 | s913582192 | Wrong Answer | from collections import deque
s = input()
q = int(input())
Q = []
for _ in range(q):
Q.append(list(map(str, input().split())))
S = deque([s])
for i in Q:
if int(i[0]) == 1:
S.reverse()
else:
if int(i[1]) == 1:
S.appendleft(i[2])
elif int(i[1]) == 2:
S.append(i[2])
print(''.join(S))
|
p03478 | s564356551 | Wrong Answer | def main():
def reviewSum(n):
sum = 0
while n > 0:
sum += n % 10
n = n // 10
return sum
N, A, B = map(int, input().split())
total = 0
for i in range(N):
sum = reviewSum(i)
if sum >= A and sum <= B:
total += i
print(total)
main() |
p02813 | s745813078 | Accepted | import itertools
def main():
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
a = list(itertools.permutations([i for i in range(1, N+1)]))
k, l = 0, 0
for i in range(len(a)):
if list(a[i]) == P: k = i
if list(a[i]) == Q: l = i
return abs(k-l)
if __name__ == '__main__':
print(main()) |
p02909 | s112037897 | Wrong Answer | s = input()
if s=="Sunny":
print("Cloudy")
elif s=="Cloudy":
print("Cloudy")
else:
print("Sunny") |
p03208 | s561734970 | Accepted | n, k = map(int, input().split())
h = []
for i in range(n):
h_ = int(input())
h.append(h_)
h.sort()
#print(h)
ans = float('inf')
for i in range(n-k+1):
ans = min(ans, h[i+k-1]-h[i])
print(ans) |
p03475 | s968429062 | Wrong Answer | import sys
import math
class cin():
def getInt():
return int(sys.stdin.readline().rstrip())
def getString():
return sys.stdin.readline().rstrip()
N = cin.getInt()
A = [list(map(int,cin.getString().split())) for i in range(N - 1)]
for i in range(N):
t = 0
for j in range(i,N - 1):
if t <= A[j][1]:
t = A[j][1] + A[j][0]
else:
t = (1 + t // A[j][2]) * A[j][2] + A[j][0]
print(t) |
p03351 | s845161816 | Wrong Answer | a,b,c,x = map(int, input().split())
if abs(c-a) <= x or (abs(c-b) <= x and abs(b-a) <= x):
print('YES')
else:
print('NO') |
p03624 | s077855878 | Wrong Answer | l=sorted(list(set(input())))
#print(l)
flag=1
for i in range(len(l)):
if not(ord(l[i])==i+97):
print(chr(i+97))
flag=0
break
if flag==1:
print("None") |
p02691 | s258397837 | Wrong Answer | N=int(input())
A=list(map(int,input().split()))
m=0
for i in range(N-1):
b=A[i]
j=i+b+1
for k in range(j,N):
if k-A[k]>0:
pass
else:
if abs(k-i)==A[i]+A[k]:
m+=1
print(m)
|
p02603 | s418372207 | Accepted | n = int(input())
a_list = list(map(int, input().split()))
money = 1000
num = 0
for i in range(len(a_list)-1):
if a_list[i] <= a_list[i+1]:
num += money // a_list[i]
money -= num * a_list[i]
money += num * a_list[i+1]
num = 0
print(money)
|
p02711 | s603989939 | Wrong Answer | N = int(input())
re = 0
for i in range(N):
if i % 3 == 0 or i % 5 == 0:
re = re + 0
else:
re = re + i
print(re) |
p02909 | s155554070 | Accepted | s = input()
if s=='Sunny': print('Cloudy')
elif s=='Cloudy': print('Rainy')
else: print('Sunny') |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.