problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03815 | s490263238 | Accepted | x=int(input())
ans,mod=divmod(x,11)
ans*=2
if mod>6:
ans+=2
elif mod>0:
ans+=1
print(ans) |
p02814 | s334074488 | Accepted | # ABC150 D
from math import gcd
N,M=map(int,input().split())
A=list(map(int,input().split()))
g=A[0]
check=g&-g
for a in A:
if check!=a&-a:
check=-1
break
g=g*a//gcd(a,g)
if check>=0:
g//=2
print((M//g+1)//2)
else:
print(0) |
p02689 | s706872383 | Accepted | import sys
readline = sys.stdin.buffer.readline
arr = []
n,m= list(map(int,readline().rstrip().split()))
h = readline().rstrip().decode().split()
for i in range(m):
k,l= list(map(int,readline().rstrip().split()))
if int(h[k-1]) > int(h[l-1]):
arr.append(l)
elif int(h[k-1]) < int(h[l-1]):
arr.append(k)
else:
arr.append(l)
arr.append(k)
print(n-len(set(arr))) |
p02725 | s630470328 | Wrong Answer | K,N=list(map(int,input().split()))
A=list(map(int,input().split()))
B=[]
for i in(A):
if(i!=0):
B.append(i)
B.sort()
if((B[-1]-B[0])<(B[0]+K-B[-1])):
print(B[-1]-B[0])
else:
print(B[0]+K-B[-1]) |
p02553 | s809481210 | Accepted | a,b,c,d = map(int, input().split())
l = [a*c, a*d, b*c, b*d]
print(max(l)) |
p02717 | s625089527 | Accepted | x, y, z = map(int,input().split())
print(z, x, y) |
p03695 | s288903795 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
A = list(map(lambda x:x//400,A))
#print(A)
C = [0]*9
for a in A:
if a>=8:
C[8] +=1
elif C[a]==0:
C[a] = 1
#print(C[:-1])
mi = sum(C[:-1])
mini = mi
if mi == 0:
mini = min(1,C[-1])
ma = min(8,mi+C[-1])
print(mini,ma) |
p03665 | s740830041 | Accepted | N, P = map(int, input().split())
A = list(map(int, input().split()))
def comb(n, k):
ret = 1
for i in range(1, k+1):
ret = ret * (n+1-i) // i
return ret
Even = 0
Odd = 0
for a in A:
if a % 2 == 0:
Even += 1
else:
Odd += 1
ans = 0
while P <= Odd:
ans += comb(Odd, P)
P += 2
print(ans * 2 ** Even) |
p02854 | s178052334 | Accepted | from collections import defaultdict
def readInt():
return int(input())
def readInts():
return list(map(int, input().split()))
def readChar():
return input()
def readChars():
return input().split()
n = readInt()
a = readInts()
sum_a = sum(a)
v = sum(a)/2
ans = float("inf")
t = 0
for i in range(len(a)):
t+=a[i]
ans = min(ans,abs(sum_a-2*t))
print(ans) |
p04012 | s421719435 | Wrong Answer | w = input()
lis = []
for a in set(w):
b = w.count(a)
if b % 2 == 1:
print("No")
break
else:
lis.append(b)
if len(lis) == set(w):
print("Yes")
|
p02646 | s865572776 | Accepted | a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if v-w <= 0:
print('NO')
exit()
ans=abs(a-b)/(v-w)
if ans <= t:
print('YES')
else:
print('NO')
|
p02842 | s004126239 | Accepted | import math
a = input()
N = int(a)
X = N//1.08 + 1
x = math.floor(X*1.08)
if x == N:
print(int(X))
else:
print(':(') |
p02813 | s078885694 | Wrong Answer | import itertools as it
n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
r = list(it.permutations(range(1, n+1)))
a = 0
b = 0
for i in range(len(r)):
if r[i] == p:
a = i
elif r[i] == q:
b = i
print(abs(a-b))
|
p03323 | s578548133 | Accepted | A,B = map(int, input().split())
print('Yay!' if A <= 8 and B <= 8 else ':(') |
p02801 | s294844867 | Accepted | #ABC151 A
C=input()
myord=1+ord(C)
print(chr(myord)) |
p02682 | s965511871 | Accepted | a,b,c,k=map(int,input().split())
if a>=k:
print(k)
elif a+b>=k:
print(a)
else:
print(2*a+b-k)
|
p02811 | s908227343 | Wrong Answer | k , x = map(int,input().split())
print("Yes" if 500*k>x else "No") |
p03385 | s326276782 | Wrong Answer | a, b, c = input()
if "a" and "b" and "c" in (a + b + c):
print("Yes")
else:
print("No") |
p02607 | s896283824 | Accepted | N=int(input())
a=list(map(int,input().split()))
print(sum(i%2==1 for i in a[::2])) |
p02708 | s884292721 | Accepted | n, k = map(int, input().split())
l = [int(i) for i in range(n + 1)]
lr = l[::-1]
if k == n + 1:
print(1)
else:
ans = 1
mod = 10**9 + 7
left = sum(l[:k])
right = sum(lr[:k])
# print(left)
# print(right)
for i in range(n - k + 1):
ans += right - left + 1
ans %= mod
left += l[k + i]
right += lr[k + i]
print(ans)
|
p02959 | s822295137 | Accepted | import numpy as np
n = int(input())
a0 = np.array(list(map(int, input().split())))
a = a0.copy()
b = np.array(list(map(int, input().split())))
for i in range(n):
c = a[i] - b[i]
if c < 0:
a[i] = 0
a[i+1] = a[i+1] + c
if a[i+1] < 0:
a[i+1] = 0
else:
a[i] = a[i] - b[i]
print(sum(a0 - a)) |
p02879 | s748470692 | Wrong Answer | A, B = map(int, input().split())
if(A<=9 and B<=9):
print(int(A*B))
else:
print() |
p02603 | s403964547 | Accepted | n=int(input())
al=list(map(int,input().split()))
s=1000
k=0
for i,j in zip(al,al[1:]):
if i==j:
continue
if i<j:
m=s//i
k+=m
s-=m*i
else:
s+=k*i
k=0
s+=k*al[-1]
print(s)
|
p02658 | s043536090 | Accepted | n = int(input())
a = list(map(int, input().split()))
ans = 1
flag = 0
for i in range(n):
ans *= a[i]
if ans > 1e18:
flag = 1
ans = 1
if a[i] == 0:
flag = 0
ans = 0
if flag:
print(-1)
else:
print(ans)
|
p03331 | s156584348 | Wrong Answer | N = input()
li = [int(i) for i in N]
print(sum(li))
|
p03680 | s286960478 | Accepted | N = int(input())
A=[int(input()) for i in range(N)]
now=1
c=0
while c<N:
now=A[now-1]
c+=1
if(now==2):
print(c)
break
else:
print("-1") |
p02731 | s342631705 | Accepted | L = int(input())
print((L/3) ** 3)
|
p02570 | s354982116 | Accepted | d,t,s=map(int,input().split())
if d<=s*t:
print("Yes")
else:
print("No") |
p03408 | s837661874 | Accepted | n=int(input())
blue=[input() for _ in range(n)]
m=int(input())
red=[input() for _ in range(m)]
l=list(set(blue))
print(max(0,max(blue.count(l[i])-red.count(l[i]) for i in range(len(l))))) |
p02922 | s890796111 | Accepted | a, b = map(int, input().split())
ans = 0
c = 1
while c < b:
ans += 1
c += a - 1
print(ans) |
p02952 | s411069677 | Accepted | N = int(input())
cnt = 0
for i in range(1,N+1):
if len(str(i))%2 == 1:
cnt += 1
print(cnt) |
p02783 | s041586829 | Wrong Answer | H,A=list(map(int,input().split()))
print(int(H/A)+1) |
p03012 | s908799636 | Accepted | N = int(input())
W = [int(s) for s in input().split()]
ans = 10**9
for i in range(N):
s1 = sum(W[0:i])
s2 = sum(W[i:])
ans = min(abs(s1-s2), ans)
print(ans)
|
p02773 | s711392802 | Wrong Answer | import collections
n = int(input())
l = []
for i in range(n):
l.append(input())
l.sort()
c = collections.Counter(l)
print(c.most_common()[0][0])
for i in range(1, len(c)):
if c.most_common()[0][1] == c.most_common()[i][1]:
print(c.most_common()[i][0])
else:
break |
p02683 | s458516031 | Accepted | N,M,X = map(int,input().split())
K = []
for i in range(N):
a = list(map(int,input().split()))
K.append(a)
ans = 10**8
for i in range(2**N):
c = 0
skill = [0]*M
for j in range(N):
if ( (i>>j) & 1 ):
c += K[j][0]
for k in range(1,M+1):
skill[k-1] += K[j][k]
skill.sort()
if skill[0] >= X:
ans = min(c,ans)
if ans == 10**8:
print(-1)
else:
print(ans) |
p02843 | s564237066 | Wrong Answer | x = int(input())
if x<100:
print(0)
else:
n = x//100
m = x%100
dp = set([0,1,2,3,4,5])
for i in range(n):
t = set([])
for dp_i in dp:
for j in range(6):
t.add((dp_i+j)%100)
dp = t
if m in dp:
print(1)
else:
print(0)
|
p02988 | s018303902 | Accepted | n = int(input())
A = list(map(int, input().split()))
t = 0
for i in range(n-2):
if A[i:i+3][1] == sorted(A[i:i+3])[1]:
t += 1
print(t) |
p02675 | s959701647 | Accepted | N = int(input())
h = [2, 4, 5, 7, 9]
p = [0, 1, 6, 8]
b = [3]
NN = N % 10
if NN in h:
print('hon')
elif NN in p:
print('pon')
else:
print('bon')
|
p04033 | s310670197 | Accepted | a, b = map(int, input().split())
if (a <= 0 and b >= 0) or (a >= 0 and b <= 0):
print("Zero")
elif (a < 0 and b < 0):
if (abs(a - b) + 1) % 2 == 0:
print("Positive")
else:
print("Negative")
else:
print("Positive")
|
p03611 | s291450451 | Accepted | import numpy as np
import sys
import math
n=int(input())
A=np.array(sorted(list(map(int,input().split()))))
C=np.bincount(A)
D=C.copy()
D[1:]+=C[:-1]
D[:-1]+=C[1:]
print(np.max(D)) |
p02630 | s006662848 | Accepted | import numpy as np
from collections import defaultdict
N = int(input())
arr = np.array(list(map(int, input().split())))
unique, cnts = np.unique(arr, return_counts=True)
counts = defaultdict(int)
sum = arr.sum()
for key, val in zip(unique, cnts):
counts[key] = val
Q = int(input())
for i in range(Q):
B, C = list(map(int, input().split()))
counts[C] += counts[B]
sum += counts[B] * (C - B)
counts[B] = 0
print(sum)
|
p02700 | s709165376 | Wrong Answer | a,b,c,d=map(int,input().split())
hpa=a
hpc=c
while (hpa>0) and (hpc>0):
hpc=hpc-b
hpa=hpa-d
if hpa<=0:
print("No")
if hpc<=0:
print("Yes") |
p03087 | s938567264 | Wrong Answer | #累積和的な
n,q = map(int,input().split())
s = input() + 'A'
li = [0]*(n+1)
for i in range(n):
li[i+1] = li[i] + (1 if s[i] + s[i+1] == 'AC' else 0)
print(li)
for j in range(q):
l,r = map(int,input().split())
print(li[r-1] - li[l-1]) |
p03605 | s938391169 | Accepted | print("NYoe s"["9" in input()::2]) |
p03815 | s039951333 | Wrong Answer | x = int(input())
per11 = x // 11
remain_per11 = x % 11
if remain_per11 >= 6:
print(per11*2 + 2)
else:
print(per11*2 + 1) |
p02675 | s912756414 | Accepted | def main():
N = int(input())
temp = int(N / 10)
temp = temp * 10
result = None
if (N- temp) == 2 or (N- temp) == 4 or (N- temp) == 5 or (N- temp) == 7 or (N- temp) == 9 :
result = 'hon'
elif (N- temp) == 3 :
result = 'bon'
else :
result = 'pon'
print(result)
if __name__ == "__main__":
main() |
p03221 | s529955359 | Wrong Answer | def input_int_list():
return [int(thing) for thing in input().split(" ")]
N,M=input_int_list()
ken_toshi=[input_int_list() for _ in range(M)]
ken_shinotoshi={i+1:sorted([thing[1] for thing in ken_toshi if thing[0]==i+1]) for i in range(N)}
ken_toshinum={i+1:0 for i in range(N)}
def normalize(num:int):
return str(num).zfill(6)
for ken,toshi in ken_toshi:
ans_left=normalize(ken)
the_index=ken_shinotoshi[ken].index(toshi)
ken_shinotoshi[ken].pop(the_index)
ans_right=normalize(the_index+1+ken_toshinum[ken])
print(ans_left+ans_right) |
p03493 | s305326842 | Accepted | s = input()
cnt = 0
for i in s:
if i == '1':
cnt += 1
print(cnt) |
p02701 | s600376652 | Accepted | N=int(input())
a = [str(input()) for i in range(N)]
b = list(set(a))
print(len(b)) |
p02996 | s137263876 | Accepted | # ABC131 D Megalomania
import itertools
n = int(input())
ab_list = [[None] * 2 for i in range(n)]
for i in range(n):
ab_list[i] = list(map(int, input().split()))
ab_list.sort(key=lambda x:(x[1]))
ab_list_T = [list(x) for x in zip(*ab_list)]
cum_iter = itertools.accumulate(ab_list_T[0])
flag = True
for i,_ in enumerate(cum_iter):
if _ > ab_list_T[1][i]:
flag = False
if flag:
print("Yes")
else:
print("No") |
p03309 | s555060729 | Wrong Answer | N=int(input())
A=list(map(int,input().split()))
p=0
for i in range(N):
A[i]=A[i]-i-1
p+=A[i]
A.sort()
ans=0
a=p//N-1
b=p//N
c=p//N+1
d=0
e=0
f=0
for i in range(N):
d+=abs(A[i]-a)
e+=abs(A[i]-b)
f+=abs(A[i]-c)
print(min(d,min(e,f))) |
p03137 | s854011759 | Accepted | n,m=map(int,input().split())
x=sorted(list(map(int,input().split())))
if m<=n:
print(0)
else:
d=[]
for i in range(m-1):
d.append(x[i+1]-x[i])
d=sorted(d)
print(sum(d[:m-n])) |
p02628 | s855427421 | Accepted | # -*- coding: utf-8 -*-
N, K = input().split()
p = sorted(map(int, input().split()))
print(sum(p[0:int(K)])) |
p03210 | s319601105 | Accepted | print("YES" if int(input()) in [3,7,5] else "NO") |
p02995 | s245603397 | Accepted |
import fractions
A,B,C,D = map(int, input().split())
def lcm(x, y):
return (x * y) // fractions.gcd(x, y)
a = (B // C) - ((A-1) // C)
b = (B // D) - ((A-1) // D)
c = (B // (lcm(C, D))) - ((A-1) // (lcm(C, D)))
s = a + b - c
ans = B - (A-1) - s
print(ans) |
p02791 | s692169005 | Accepted | n=int(input())
p=list(map(int,input().split()))
cnt=0
tiny=float('inf')
for i in range(n):
if tiny>=p[i]:
cnt+=1
tiny=p[i]
else:
pass
print(cnt) |
p03624 | s451313555 | Wrong Answer | alphabet = [chr(ord('a') + i) for i in range(26)]
s = list(input())
s = list(set(s))
s.sort()
for i in range(len(s)):
if s[i] == alphabet[i] and i != len(s) - 1:
pass
else:
print(alphabet[i])
exit()
print("None") |
p02761 | s471928734 | Accepted | n,m=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(m)]
arr=[str(i) for i in range(10**(n-1) if n>1 else 0,10**n)]
for x in arr:
for i,tmp in enumerate(l):
s,c=tmp
if x[s-1]!=str(c):
break
else:
print(x)
exit()
print(-1)
|
p02606 | s611230433 | Wrong Answer | l, r, x = map(int, input().split(' '))
ans = r // x - (l-1) // x |
p03723 | s233665466 | Accepted | a,b,c = map(int,input().split())
count = 0
flag = True
while(a % 2 == 0 and b % 2 == 0 and c % 2 == 0):
aa = a//2
bb = b//2
cc = c//2
a = bb + cc
b = aa + cc
c = aa + bb
if(a == b == c):
flag = False
break
count += 1
if flag:
print(count)
else:
print(-1)
|
p03293 | s498356110 | Accepted | s = input()
t = input()
for i in range(len(s)):
if s[i:]+s[:i] == t:
print('Yes')
exit()
print('No') |
p03095 | s166417801 | Wrong Answer | n = int(input())
A = list(input())
import collections
C = collections.Counter(A)
t = 1
for i in C.values():
t *= (i+1)
print(t - 1) |
p02725 | s560733109 | Wrong Answer | k,n=map(int,input().split())
a=list(map(int,input().split()))
a.append(a[0])
dis=[]
for i in range(n):
d=abs(a[i]-a[i+1])
if d>k/2:
d=k-d
dis.append(d)
print(dis,k-max(dis)) |
p03698 | s807859411 | Wrong Answer | s = input()
print('Yes') if len(set(list(s))) == len(s) else print('No') |
p02676 | s424831739 | Accepted | K = int(input())
S = input()
if len(S) > K:
S = S[:K] + '...'
print(S) |
p03323 | s751227119 | Accepted | a, b = map(int, input().split())
if a<= 8 and b <= 8:
print('Yay!')
else:
print(':(') |
p03146 | s365777276 | Accepted | s = int(input())
ans = [s]
i = 1
if s == 1 or s == 2:
ans = 4
else:
while ans[i-1] != 4:
if ans[i-1] % 2 ==0:
ans.append(ans[i-1]//2)
else:
ans.append(ans[i-1]*3 + 1 )
i += 1
ans = i + 3
print(ans) |
p03910 | s481407305 | Accepted | n=int(input())
s=0
l=[]
for i in range(1,n+1):
s+=i
l.append(i)
if s>=n:
for j in l:
if j!=s-n:
print(j)
break |
p03680 | s869830574 | Accepted | n = int(input())
a = [int(input()) for _ in range(n)]
cnt = 0
idx = 0
flg = False
for _ in range(n):
k = a[idx]
idx = k-1
cnt += 1
if idx == 1:
flg = True
break
if flg:
print(cnt)
else:
print(-1) |
p02777 | s559361371 | Accepted | a, b = input().split()
A, B = map(int,input().split())
c = input()
if a == c:
print(A - 1, B)
else:
print(A, B - 1) |
p03679 | s970175982 | Accepted | #!/usr/bin/env python3
import sys
def solve(X: int, A: int, B: int):
print("delicious" if A >= B else "safe" if A + X >= B else "dangerous")
def main():
def iterate_tokens():
for line in sys.stdin:
for word in line.split():
yield word
tokens = iterate_tokens()
X = int(next(tokens)) # type: int
A = int(next(tokens)) # type: int
B = int(next(tokens)) # type: int
solve(X, A, B)
if __name__ == '__main__':
main()
|
p02699 | s852564668 | Wrong Answer | s, w = map(int, input().split())
if s >= w:
print("safe")
else:
print("unsafe")
|
p03041 | s252717230 | Accepted | #A
n,k = map(int,input().split())
s = list(input())
s[k-1] = s[k-1].lower()
print("".join(s)) |
p03264 | s160190837 | Wrong Answer | k = int(input())
if k%2:
print((k//2)*((k//2)+1))
else:
print((k/2)**2)
|
p02748 | s778662940 | Accepted | A, B, M = map(int, input().rstrip().split(' '))
a = list(map(int, input().rstrip().split(' ')))
b = list(map(int, input().rstrip().split(' ')))
coupon = []
for i in range(M):
x, y, c = map(int, input().rstrip().split(' '))
temp = a[x-1]+b[y-1]-c
coupon.append(temp)
min_price = min(coupon)
if min(a)+min(b) < min_price :
print(min(a)+min(b))
else:
print(min_price) |
p03657 | s949145261 | 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') |
p03160 | s444763781 | Accepted | N = int(input())
[*h] = map(int, input().split())
dp = [0 for _ in range(N)]
dp[1] = abs(h[0]-h[1])
for i in range(2, N):
dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))
print(dp[N-1]) |
p03493 | s540505731 | Wrong Answer | a = input()
count = 0
for i in a:
if i == 1:
count += 1
print(count) |
p03252 | s697703826 | Accepted | S=input()
T=input()
d = {}
d2 = {}
for i in range(len(S)):
if not d.get(S[i]):
d[S[i]] = T[i]
elif d[S[i]] != T[i]:
print('No')
exit()
if not d2.get(T[i]):
d2[T[i]] = S[i]
elif d2[T[i]] != S[i]:
print('No')
exit()
print('Yes') |
p03721 | s415396693 | Accepted | # ABC061c
from collections import deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
n, k = map(int, input().split())
nums = [list(map(int, input().split())) for _ in range(n)]
nums.sort()
i = 0
for a, b in nums:
i += b
if i >= k:
print(a)
exit(0)
|
p02971 | s713236741 | Accepted | # C
n = int(input())
a = [int(input()) for i in range(n)]
maxa = [-1,0]
premaxa = [-1,-1]
for i,num in enumerate(a):
if num >= maxa[1]:
premaxa = [maxa[0], maxa[1]]
maxa = [i,num]
elif num > premaxa[1]:
premaxa = [i,num]
for i in range(n):
if i == maxa[0]:
print(premaxa[1])
else:
print(maxa[1]) |
p03456 | s516526414 | Accepted | joint = input().replace(" ", "")
num = int(joint)
root = num**(1/2)
# print(root)
# print(root.is_integer())
print("Yes" if root.is_integer() else "No") |
p02819 | s660272687 | Accepted | N = int(input())
import math
def is_prime(n):
if n == 1: return False
for k in range(2, int(math.sqrt(n)) + 1):
if n % k == 0:
return False
return True
for i in range(N,10**6):
if is_prime(i):
print(i)
exit(0) |
p03627 | s419600375 | Accepted | n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
b = []
g = []
for i in range(1,n):
if a[i-1] == a[i]:
b.append(a[i])
if 4 <= n:
for i in range(3,n):
if a[i-3] == a[i]:
g.append(a[i])
c = sorted(list(set(b)),reverse=True)
f = sorted(list(set(g)),reverse=True)
ans = 0
if len(f):
ans = max(ans,f[0]*f[0])
if 2 <= len(c):
ans = max(ans,c[0]*c[1])
print(ans) |
p02935 | s258746918 | Accepted | N=int(input())
v=[int(i) for i in input().split()]
v.sort()
avg=v[0]
for i in range(1,N):
avg=(v[i]+avg)/2
print(avg) |
p02556 | s363703918 | Wrong Answer | N=int(input())
A=[]
min_x=10**9+1
min_y=10**9+1
B=[0 for i in range(N)]
for i in range(N):
x,y=map(int,input().split())
A.append([x,y])
min_x=min(min_x,x)
min_y=min(min_y,y)
for i in range(N):
A[i][0]=A[i][0]-min_x
A[i][1]=A[i][1]-min_y
B[i]=A[i][0]+A[i][1]
print(max(B)-min(B)) |
p02939 | s252157352 | Wrong Answer | S = input()
res = 0
tmp = ""
last = ""
for s in S:
tmp += s
if tmp == last:
continue
print(tmp)
last = tmp
tmp = ""
res += 1
print(res) |
p02773 | s697605083 | Accepted | class Counter(dict):
def __missing__(self, i):
return 0
n = int(input())
s = Counter()
for _ in range(n):
i = input()
s[i] += 1
s = dict(sorted(s.items(), key=lambda x: -x[1]))
m = max(list(s.values()))
ans = []
for i in s:
if s[i] == m:
ans.append(i)
ans.sort()
print('\n'.join(ans))
|
p02608 | s040574555 | Wrong Answer | N = int(input())
result = [0] * N
for x in range(1, 101):
for y in range(1, 101):
for z in range(1, 101):
temp = pow(x+y, 2) + pow(y+z, 2) + pow(z+x, 2)
n = temp / 2
if not n.is_integer():
continue
n = int(n)
if n >= N:
break
result[n-1] += 1
for r in result:
print(r) |
p02772 | s910796455 | Accepted | import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re
N = int(input())
A = list(map(int,input().split()))
flg = 0
for i in range(N):
if A[i] % 2 == 0:
if not ( A[i] % 3 == 0 or A[i] % 5 == 0 ):
flg = 1
break
if flg == 1:
print('DENIED')
else:
print('APPROVED') |
p03042 | s940877779 | Wrong Answer | # #!/usr/bin/env python3
# # -*- coding: utf-8 -*-
def main():
S = input()
first = int(S[:2])
second = int(S[2:])
if first == 0 or second == 0:
print('NA')
elif first > 12 and second > 12:
print('NA')
elif first > 12 and second <= 12:
print('YYMM')
elif first <= 12 and second > 12:
print('MMYY')
else:
print('AMBIGUOUS')
if __name__ == "__main__":
main()
|
p02664 | s445712671 | Accepted | T = input()
T = T.split('?')
ans = ''
for i in range(len(T)):
ans = ans + T[i]
if i != len(T)-1:
ans += 'D'
print(ans) |
p03339 | s665237002 | Wrong Answer | n = int(input())
s = input()
ans = 3*(10**5)
to_east = 0
to_west = s.count('E', 1)
for i in range(1, n):
if s[i]=='W':
to_east += 1
if s[n-i]=='E':
to_west -= 1
ans = to_east+to_west if ans>to_east+to_west else ans
print(ans)
|
p03910 | s664501305 | Wrong Answer | n = int(input())
if n == 1:
print(1)
else:
if n % 2 == 0:
print(n//2-1)
print(n//2+1)
else:
print(n//2)
print(n//2+1) |
p02607 | s804680930 | Accepted | N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
if (i+1)%2 == 1 and A[i]%2 == 1:
ans += 1
print(ans) |
p03239 | s000296592 | Accepted | N, T = map(int, input().split())
ans = float('inf')
for i in range(N):
c, t = map(int, input().split())
if t <= T:
ans = min(ans, c)
print(ans if ans != float('inf') else 'TLE') |
p02689 | s299155824 | Wrong Answer | def solve(way, height, n):
ss = set()
for a,b in way:
if height[a-1] == height[b-1]:
ss = ss | {a,b}
else:
remove_idx = a if height[a-1] < height[b-1] else b
ss = ss | {remove_idx}
return n - len(ss)
if __name__ == "__main__":
n,m = map(int, input().split())
height = [int(i) for i in input().split()]
way = [tuple(map(int, input().split())) for i in range(m)]
print(way)
print(solve(way, height, n))
|
p02712 | s246342160 | Wrong Answer | x = [i for i in range(1, int(input())) if i%3!=0 and i%5!=0]
print(sum(x)) |
p02623 | s214242063 | Wrong Answer | N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
mix = sorted(A + B)
temp_sum = 0
goal = 0
for i in range(len(mix)):
temp_sum += mix[i]
goal = i
if temp_sum > K:
print(i)
exit()
print(goal + 1) |
p03030 | s501477678 | Accepted | N = int(input())
sp_list = []
sorted_list = []
for i in range(N):
S,P = map(str, input().split(' '))
sorted_list.append([S,int(P)])
sp_list.append(S + ' ' + P)
sorted_list = sorted(sorted_list, key=lambda x:(x[1]), reverse=True)
sorted_list = sorted(sorted_list, key=lambda x:(x[0]))
for i in range(N):
count=1
for j in range(N):
if sorted_list[i][0]+' '+str(sorted_list[i][1]) ==sp_list[j]:
print(count)
break
count+=1
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.