problem_id stringclasses 428 values | submission_id stringlengths 10 10 | status stringclasses 2 values | code stringlengths 5 816 |
|---|---|---|---|
p03323 | s206424814 | Accepted | a, b = map(int, input().split())
if a > 8 or b > 8:
print(":(")
else:
print("Yay!") |
p03427 | s051735848 | Wrong Answer | N=input()
n=int(N)
N1=[int(x) for x in list(N)]
#n=int(N)
if n<10:
print(n)
exit()
else:
ans=0
for i in range(len(N)-1):
ans=max(ans,sum(N1[:i+1])-1+9*(len(N)-i-1))
print(ans) |
p02848 | s859672323 | Wrong Answer | N = int(input())
S = input()
ans = ''
for s in S:
ans += chr(ord(s) + N) if ord(s) < ord('Y') else chr(ord(s) - 26 + N)
print(ans) |
p02696 | s887348172 | Accepted | a,b,n=map(int,input().split())
if n>=b:
print(int(a*(b-1)/b)-a*int((b-1)/b))
else:
print(int(a*n/b)-a*int(n/b)) |
p03239 | s903761124 | Accepted | n, T = map(int, input().split())
p = []
for i in range(n):
tmp = [int(x) for x in input().split()]
p.append(tmp)
cmin = 1001
for c, t in p:
if (t <= T and c < cmin):
cmin = c
if (cmin > 1000):
print('TLE')
else:
print(cmin)
|
p03860 | s604881301 | Wrong Answer | x = input()[1]
print("A"+x+"C") |
p02613 | s993477307 | Accepted | from collections import Counter
n = int(input())
c = Counter(input() for _ in range(n))
print("AC x", c["AC"])
print("WA x", c["WA"])
print("TLE x", c["TLE"])
print("RE x", c["RE"])
|
p03854 | s102075657 | 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')
|
p02571 | s262264431 | Wrong Answer | S = input()
T = input()
res = 0
for i in range(len(S)-len(T)):
a = 0
for j in range(len(T)):
a += S[i+j] == T[j]
res = max(res,a)
print(len(T)-res) |
p03673 | s401827636 | Accepted | n = int(input())
A = input().split()
if n == 1:
print(' '.join(A))
elif n%2 == 0:
print(' '.join(A[1::2][::-1]) + ' ' + ' '.join(A[::2]))
else:
print(' '.join(A[::2][::-1]) + ' ' + ' '.join(A[1::2]))
|
p02912 | s686726546 | Accepted | N,M = map(int,input().split())
a = list(map(int,input().split()))
import heapq
heap = []
for i in range(N):
heapq.heappush(heap, -a[i])
for i in range(M):
buf = heapq.heappop(heap)
buf = -buf
buf = buf//2
heapq.heappush(heap,-buf)
print(-sum(heap)) |
p03331 | s847224762 | Accepted |
N = int(input())
if N in [10**i for i in range(1, 6)] :
print("10")
else :
print(sum(map(int, str(N))))
|
p02725 | s504683276 | Accepted | import math
def resolve():
import sys
input = sys.stdin.readline
# row = [int(x) for x in input().rstrip().split(" ")]
kn = [int(x) for x in input().rstrip().split(" ")]
k = kn[0]
a = [int(x) for x in input().rstrip().split(" ")]
max_dist = max([a[i+1] - a[i] for i in range(len(a)-1)])
max_dist = max_dist if max_dist > a[0] + k - a[len(a)-1] else a[0] + k - a[len(a)-1]
print(k - max_dist)
if __name__ == "__main__":
resolve()
|
p03043 | s819955065 | Wrong Answer | nums = input().split()
N = int(nums[0])
K = int(nums[1])
totalProb = 0
for i in range(K):
x = i + 1
tempProb = 1/N
while x < K:
tempProb = tempProb / 2
x = x * 2
print(tempProb)
totalProb += tempProb
if N > K:
totalProb += (N - K + 1) * 1/N
print(totalProb)
|
p03163 | s094405734 | Accepted | import numpy as np
[N,W]=[int(x) for x in input().split()]
dp=np.zeros([N+1,W+1],dtype=int)
for i in range(1,N+1):
w, v=map(int,input().split())
dp[i][:w]=dp[i-1][:w]
dp[i][w:]=np.maximum(dp[i-1][w:],dp[i-1][:W-w+1]+v)
print(dp[N][W]) |
p02860 | s980019243 | Accepted | #!/usr/bin/env python
def main():
N = int(input())
S = input()
if N % 2 == 1:
print("No")
else:
for i in range(N // 2):
if S[i] != S[i + N // 2]:
print("No")
exit()
print("Yes")
if __name__ == '__main__':
main()
|
p03095 | s647076307 | Accepted | from collections import Counter
N = int(input())
S = input()
C = Counter(S)
res = 1
for v in C.values():
res *= (v + 1)
res %= 10 ** 9 + 7
print(res - 1)
|
p02778 | s235827946 | Accepted | s = input()
l = len(s)
rep = ['x' for _ in range(l)]
print(''.join(rep)) |
p03042 | s529521987 | Accepted | dList = list(str(input()))
former = int(''.join([dList[0],dList[1]]))
latter = int(''.join([dList[2],dList[3]]))
if 1 <= former <= 12:
if 1<= latter<= 12:
print("AMBIGUOUS")
else:
print("MMYY")
elif former > 12:
if 1<= latter<= 12:
print("YYMM")
else:
print("NA")
else:
if latter == 0 or latter > 13:
print("NA")
else:
print("YYMM")
|
p02899 | s556577090 | Accepted | n=int(input())
*a,=map(int,input().split())
b=sorted([(a[i],str(i+1)) for i in range(n)],key=lambda x:x[0])
print(' '.join([c for _,c in b]))
|
p03371 | s293227453 | Accepted | a, b, c, x, y = map(int, input().split())
ans = 10 ** 9
for cn in range(0, max(x, y) * 2 + 1, 2):
may = max(0, x - cn // 2) * a + max(0, y - cn // 2) * b + cn * c
ans = min(ans, may)
print(ans)
|
p03797 | s398557602 | Wrong Answer | def main():
s_shaped_piece, c_shaped_piece = map(int, input().split())
answer = 0
if c_shaped_piece <= s_shaped_piece:
answer = c_shaped_piece
else:
answer = s_shaped_piece + (c_shaped_piece - 2 * s_shaped_piece) // 4
print(answer)
if __name__ == '__main__':
main()
|
p02552 | s048548008 | Accepted | x=int(input())
if x==0:
print(1)
if x==1:
print(0) |
p02701 | s311705433 | Accepted | N=int(input())
d=[]
for x in range(N):
S=input()
d.append(S)
print(len(set(d))) |
p03607 | s907513093 | Accepted | import collections
a=int(input())
b=[int(input()) for i in range(a)]
n=collections.Counter(b)
m,ans=zip(*n.most_common())
ans=[i for i in ans if i%2==1]
print(len(ans)) |
p03696 | s669775788 | Accepted | N = int(input())
S = input()
op = 0
for c in S:
if c=='(':
op += 1
elif op > 0:
op -= 1
cl = 0
for c in S[::-1]:
if c==')':
cl += 1
elif cl > 0:
cl -= 1
print('('*cl + S + ')'*op) |
p02594 | s579513447 | Accepted | # 入力
X = input()
# 以下に回答を記入
X = int(X)
if X >= 30:
print('Yes')
else:
print('No') |
p03284 | s737176083 | Accepted | N,K = map(int,input().split())
print(0 if N%K ==0 else 1) |
p02647 | s246089967 | Accepted | N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
for k in range(K):
B = [0] * (N+1)
for i, a in enumerate(A):
l = max(0, i-a)
r = min(i+a+1, N)
B[l] += 1
B[r] -= 1
for i in range(1, N+1):
B[i] += B[i-1]
B.pop()
if (A==B): break
A = B
for a in A:
print(a, end=' ')
print()
|
p02866 | s818041670 | Wrong Answer | import sys
from collections import Counter
input = sys.stdin.readline
N = int(input())
ans = 1
mod = 998244353
D = list(map(int, input().split()))
if D[0] != 0:
print(0)
exit()
D = sorted(Counter(D).items())
tmp = D[0][1]
stream = 0
for n, i in D:
if stream != n:
print(0)
exit()
if n == 0:
stream += 1
continue
ans *= pow(tmp, i)
ans %= mod
tmp = i
stream += 1
print(ans)
|
p02552 | s426905270 | Accepted | # -*- coding: utf-8 -*-
x = int(input())
if x == 1:
print(0)
else:
print(1) |
p02951 | s942862510 | Accepted | a,b,c = map(int,input().split())
print(c-(a-b) if c-(a-b) >= 0 else 0) |
p03379 | s460625229 | Wrong Answer | N = int(input())
X = list(map(int,input().split()))
Y = sorted(X)
a = Y[(N-1)//2]
b = Y[(N+1)//2]
for i in X:
if i >= a:
print(a)
else:
print(b) |
p03254 | s181157669 | Accepted | N,x = map(int,input().split())
A = sorted(list(map(int,input().split())))
if x>=2*sum(A):
print(0)
else:
ind = N
for i in range(N):
x -= A[i]
if x<0:
ind = i
break
if ind==N and x>0:
A = sorted(A,reverse=True)
for i in range(N):
x -= A[i]
if x<0:
ind -= 1
break
print(ind) |
p02854 | s416885831 | Accepted | n = int(input())
*a, = map(int, input().split())
tot = sum(a)
ret = tot
l, r = 0, tot
for i in range(n):
l += a[i]
r -= a[i]
ret = min(ret, abs(l - r))
print(ret)
|
p02607 | s600179842 | Accepted | n = int(input())
a = [int(x) for x in input().split()]
count = 0
for i in range(n):
if i%2 == 0 and a[i]%2 == 1:
count += 1
print(count)
|
p03131 | s212362255 | Accepted | K,A,B=map(int, input().split())
if A+2>=B:
print(K+1)
else:
if K==1 or K<=A:
print(K+1)
else:
cnt=0
K-=(A-1)
a=K//2
cnt=a*(B-A)+A
if K%2==1:
cnt+=1
print(cnt)
|
p02694 | s979128893 | Wrong Answer | x = int(input())
a = 100
year = 0
while(True):
a *= 1.01
year += 1
if a>=x:
break
print(year)
|
p03495 | s910773662 | Wrong Answer | n,k=map(int,input().split())
a=list(map(int,input().split()))
from collections import defaultdict
d=defaultdict(int)
for i in a:
d[i]+=1
print(sum(sorted(list(d.values()))[:n-k])) |
p02731 | s564300841 | Wrong Answer | L=int(input("Enter L:"))
V=(L*L*L)/27
print(V) |
p02694 | s705610869 | Accepted | X=int(input())
ans=100
now=100
cnt=0
while(True):
if X<=now:
break
else:
now=int(now+now*0.01)
cnt+=1
print(cnt) |
p02700 | s329403692 | Accepted | import math
A, B, C, D = input().split(' ')
takahasi_tairyoku = int(A)
aoki_tairyoku = int(C)
takahasi_kougeki = int(B)
aoki_kougeki = int(D)
takahasi_count = math.ceil(aoki_tairyoku / takahasi_kougeki) # 高橋はアオキを何回で倒せるか
aoki_count = math.ceil(takahasi_tairyoku / aoki_kougeki) # アオキは高橋を何回で倒せるか
# print(takahasi_count, aoki_count)
if (takahasi_count <= aoki_count):
print('Yes')
else:
print('No') |
p03607 | s132329138 | Accepted | from collections import Counter
N = int(input())
A = [int(input()) for i in range(N)]
c = Counter(A)
ans = 0
for i, j in c.items():
if j%2 != 0:
ans += 1
print(ans)
|
p03285 | s134452951 | Accepted | n = int(input())
ans = False
for c in range(101):
for d in range(101):
if (4 * c) + (7 * d) == n:
ans = True
break
if ans:
print("Yes")
else:
print("No") |
p03206 | s475221737 | Accepted | D = int(input())
print('Christmas' + ' Eve'*(25-D)) |
p02842 | s029161166 | Accepted | import math
N=int(input())
X_kari = math.ceil(N/1.08)
if int(X_kari * 1.08) == N:
print(X_kari)
else: print(':(') |
p03448 | s059415823 | Wrong Answer | a=int(input(""))
b=int(input(""))
c=int(input(""))
x=int(input(""))
def countcourse(r,t,y,u):
cnt=0
for h in range(r):
for l in range(t):
for o in range(y):
if 500*h+100*l+50*o==u:
cnt+=1
return cnt
print(countcourse(a,b,c,x)) |
p04005 | s426131581 | Wrong Answer | A,B,C = map(int,input().split())
cmin = ((A+1)//2-A//2)*B*C
cmin = min(cmin,((B+1)//2-B//2)*A*C)
Cmin = min(cmin,((C+1)//2-C//2)*B*A)
print(cmin) |
p02879 | s843467386 | Wrong Answer | A, B = list(map(int, input().split()))
print(A * B) |
p03127 | s073417135 | Wrong Answer | def main():
N = int(input())
A = list(map(int, input().split()))
Asum = sum(A)
ans = 10**10
for i in range(N):
if Asum % A[i] == 0:
ans = min(ans, A[i])
else:
ans = min(ans, Asum % A[i])
print(ans)
if __name__ == "__main__":
main() |
p02879 | s048875908 | Wrong Answer | a, b = map(int, input().split())
if a < 10 and b < 10:
print('a * b')
else:
print('-1') |
p02756 | s931518338 | Wrong Answer | S=input()
Q=int(input())
F=0
C=''
while Q>=1:
tfc=list(input().split())
if int(tfc[0])==1:
box1=S[0]
box2=S[-1]
S=box2+S[1:-1]+box1
elif int(tfc[0])==2:
if int(tfc[1])==1:
S=tfc[2]+S
elif int(tfc[1])==2:
S=S+tfc[2]
Q-=1
ans=''.join(S)
print(ans) |
p03331 | s742757923 | Accepted | def f(x):
a = 0
while x != 0:
a += x % 10
x //= 10
return a
N = int(input())
Min = 1 + f(N-1)
for i in range((N//2)-1):
Min = min(Min, f(i+2) + f(N-i-2))
print(Min)
|
p02748 | s626665061 | Wrong Answer | A,B,M = [int(i) for i in input().split()]
A = sorted([int(i) for i in input().split()])
B = sorted([int(i) for i in input().split()])
min = 99999999999
for i in range(M):
x,y,c = [int(i) for i in input().split()]
buf = A[x-1]+B[y-1]-c
if buf<min:
min = buf
print(buf) |
p03705 | s885667857 | Accepted | n, a, b = map(int, input().split())
mx = a+b*(n-1)
mn = a*(n-1)+b
if ((n==1)and(a!=b)) or (mx-mn<0):
r = 0
else:
r = mx-mn+1
print(r) |
p02796 | s064720121 | Accepted | n=int(input())
li=[None]*n
for i in range(0,n):
flag=True
x,l=map(int, input().split())
li[i]=(x+l, x-l)
li=sorted(li)
count=1
x,y=li[0]
for i in range(1,n):
x2,y2=li[i]
if y2 < x:
continue
count=count+1
x=x2
print(count) |
p03827 | s816749035 | Accepted | n = int(input())
string = input()
x = 0
out = [0]
for s in string:
if s == "I":
x += 1
else:
x -= 1
out.append(x)
print(max(out))
|
p02623 | s567588392 | Wrong Answer | import bisect
n,m,k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_cum = [0]
B_cum = [0]
for i in range(n):
A_cum.append(A_cum[i]+A[i])
for i in range(m):
B_cum.append(B_cum[i]+B[i])
ans = 0
for i in range(n+1):
rest = k-A_cum[i]
if rest<=0:
continue
ans = max(ans, bisect.bisect_right(B_cum, rest)-1+i)
print(ans) |
p04033 | s358878724 | Accepted | a,b = map(int,input().split())
if a>0 and b>0:
print('Positive')
elif a <0 and b<0:
if (a-b)%2 ==0:
print('Negative')
else:
print('Positive')
else:
print('Zero')
|
p02873 | s946777100 | Accepted | #AGC040-A
s = list(input())
ans = [0 for _ in range(len(s)+1)]
for i in range(len(s)):
if s[i] == '<':
ans[i+1] = ans[i]+1
for j in range(len(s)-1,-1,-1):
if s[j] == '>':
tmp = ans[j+1] + 1
if tmp > ans[j]:
ans[j] = tmp
print(sum(ans)) |
p03359 | s725236746 | Accepted | a,b=map(int,input().split())
if a>b :
print(a-1)
else :
print(a) |
p03328 | s102693960 | Accepted | a, b = map(int, input().split())
length = 0
for i in range(1, b-a+1):
length += i
print(length - b) |
p02818 | s256669725 | Accepted | a, b, k = map(int, input().split())
ca = a-k
if ca >= 0:
print(ca, b)
else:
cb = b + ca
if cb < 0:
print(0, 0)
else:
print(0, cb) |
p02696 | s390357234 | Accepted | a,b,n = map(int,input().split())
ans =0
# for x in range(1,n+1):
x = min(b-1,n)
ans = max( ans , (a * x) // b - a* (x // b))
print(ans) |
p02866 | s598173172 | Accepted | MOD=998244353
from collections import Counter
N=int(input())
D=list(map(int,input().split()))
if D[0]!=0:
print(0)
exit()
c=sorted(Counter(D[1:]).most_common(),key=lambda x:x[0])
ans=1
for i in range(1,len(c)):
if(c[i][0]!=i+1):
print(0)
exit()
ans=(ans*pow(c[i-1][1],c[i][1],MOD))%MOD
print(ans) |
p02646 | s473799850 | Accepted | def main():
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
dis = abs(B - A)
if W >= V:
print('NO')
exit()
dis_V = V - W
time = dis // dis_V if dis % dis_V == 0 else (dis // dis_V) + 1
if T >= time:
print('YES')
else:
print('NO')
if __name__ == "__main__":
main() |
p02995 | s032421353 | Wrong Answer | import fractions
a,b,c,d = map(int, input().split())
#print(a,b,c,d)
total = b-a+1
#print(total)
lcm = c*d / fractions.gcd(c,d)
x = (b//c) + (b//d) - (b//lcm)
y = ((a-1)//c) + ((a-1)//d) - ((a-1)//lcm)
#print(x,y)
print(total - (x - y))
|
p02576 | s534597595 | Accepted | import math
n,x,t = map(int,input().split())
ans = t*math.ceil(n/x)
print(ans) |
p02802 | s649425048 | Accepted | N,M = map(int, input().split())
s,p = [False]*N, [0]*N
for i in range(M):
tmp = input().split()
pi,Si = int(tmp[0])-1, tmp[1]
s[pi] |= Si == "AC"
p[pi] += 1 if not s[pi] else 0
print(sum(s), sum([pi for si,pi in zip(s,p) if si]))
|
p03449 | s564826943 | Accepted | n = int(input())
input_lines = [[int(j) for j in input().split()]for i in range(2)]
ans=0
for i in range(n):
tmp = sum(input_lines[0][:i+1])+sum(input_lines[1][i:])
if tmp>ans:
ans=tmp
print(ans) |
p02556 | s326257619 | Accepted | def get_ints():
return list(map(int, input().split()))
n = int(input())
a,b = [],[]
for i in range(n):
x, y = get_ints()
a.append(x+y)
b.append(x-y)
a.sort()
b.sort()
ans = max(a[-1]-a[0], b[-1]-b[0])
print(ans) |
p02608 | s658522151 | Accepted | N = int(input())
counts = [0 for i in range(N+1)]
for i in range(1,150):
for j in range(1,150):
for k in range(1,150):
now = i**2 + j**2 + k**2 + i*j + j*k + k*i
try:
counts[now] += 1
except:
pass
for i in range(1,N+1):
print(counts[i]) |
p02951 | s965205901 | Accepted | a,b,c = map(int,input().split())
print(max(0,c-(a-b))) |
p02775 | s922864664 | Wrong Answer | l=list(str(input()))
m=len(l)
t=0
for i in range(m):
if int(l[i])<=5:
t+=int(l[i])
else:
t+=11-int(l[i])
print(t)
|
p02682 | s566682174 | Accepted | #!/usr/bin/env python3
A, B, C, K = map(int, input().split())
if K <= A:
print(K)
elif K <= (A+B):
print(A)
else:
print(2*A-K+B) |
p02994 | s137689775 | Wrong Answer | #!/usr/bin/env python3
def main():
N, L = map(int, input().split())
if L >= 1:
# L + 1 から L + N - 1 の和
print((N - 1) * (2 * L + N) // 2)
elif L <= - N + 1:
# L から L + N - 2 の和
print((N - 1) * (2 * L + N - 2) // 2)
else:
# L から L + N - 1 の和
print((N - 1) * (2 * L + N - 1) // 2)
if __name__ == '__main__':
main()
|
p03799 | s397047961 | Accepted | def main():
N,M = map(int,input().split())
ans = 0
if 2*N >= M:
ans = M//2
else:
ans += N
M -= N*2
ans += M//4
print(ans)
main() |
p02682 | s921983908 | Accepted | A, B, C, K = map(int, input().split())
if A >= K:
print(K)
elif A+B >= K:
print(A)
else:
print(A - (K-A-B))
|
p03419 | s022312128 | Accepted | n, m = [int(i) for i in input().split()]
print(abs((n - 2) * (m - 2))) |
p02970 | s849573938 | Wrong Answer | n,d=map(int,input().split())
for i in range(n):
if i*((d-1)*2+3)>=n:
print(i)
exit() |
p03059 | s860800015 | Accepted | a,b,t=map(int,input().split())
print(((t+1//2)//a)*b)
|
p02719 | s662217545 | Accepted | n,k=map(int,input().split())
amari=n%k
print(min(amari,k-amari)) |
p03795 | s396652085 | Accepted | N=int(input())
print(800*N-(int(N/15)*200)) |
p03548 | s634304121 | Accepted | x,y,z=map(int,input().split())
print((x-z)//(y+z)) |
p02973 | s661673195 | Accepted | from bisect import bisect_left, bisect_right
import sys
input = sys.stdin.readline
n = int(input())
col_maxs = []
for _ in range(n):
a = int(input()) * (-1)
if not col_maxs:
col_maxs.append(a)
continue
curr_max = col_maxs[-1]
if a >= curr_max:
col_maxs.append(a)
else:
# aより大きい最小要素のindex/value
ind = bisect_right(col_maxs, a)
col_maxs[ind] = a
print(len(col_maxs)) |
p03309 | s076165441 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
na = [0]*n
for i in range(n):
na[i] = a[i]-(i+1)
mid = sum(na)//n
mid1 = mid+1
ans = 0
ans1 = 0
for i in range(n):
ans += abs(na[i]-mid)
ans1 += abs(na[i]+mid1)
print(min(ans, ans1)) |
p03435 | s014109925 | Accepted | C=[list(map(int,input().split())) for _ in range(3)]
x=[0]*3
y=[0]*3
x[0]=0
y[0]=0
for i in range(3):
y[i]=C[0][i]-x[0]
for i in range(3):
x[i]=C[i][0]-y[0]
ans=True
for i in range(3):
for j in range(3):
if C[i][j]!=x[i]+y[j]: ans=False
print('Yes' if ans else 'No') |
p02554 | s333535962 | Accepted | m=int(1e9+7)
n=int(input())
ans=pow(10,n,m)-2*pow(9,n,m)+pow(8,n,m)
print(ans%m)
|
p02971 | s924098689 | Accepted | N = int(input())
A = []
for i in range(N):
A.append(int(input()))
import copy
B = copy.deepcopy(A)
A = sorted(A)
for i in range(N):
num = B[i]
if num != A[-1]:
print(A[-1])
else:
print(A[-2]) |
p03408 | s670286376 | Accepted | n = int(input())
S = {}
for i in range(n):
s = str(input())
if s not in S:
S[s] = 1
else:
S[s] += 1
m = int(input())
T = {}
for i in range(m):
t = str(input())
if t not in T:
T[t] = 1
else:
T[t] += 1
ans = 0
for k, v in S.items():
if k in T:
ans = max(ans, v-T[k])
else:
ans = max(ans, v)
print(ans) |
p03281 | s714783889 | Wrong Answer | import math
n = int(input())
def factors(a):
b = int(math.sqrt(a))
f = []
for i in range(1, b+1):
if a % i == 0:
f.append(i)
f.append(a//i)
return len(f)
def solve():
if n < 105:
print(0)
return
ans = 0
for i in range(105, n+1):
if factors(i) == 8:
ans += 1
print(ans)
solve()
|
p04044 | s887399932 | Wrong Answer | n,l=map(int,input().split())
S=[]
a=""
for i in range(n):
s=list(input())
s.sort()
for k in range(l):
a+=s[k]
S.append(a)
a=""
S.sort()
ans=""
for j in range(n):
ans+=S[j]
print(ans) |
p03774 | s285009492 | Wrong Answer | n,m=map(int,input().split())
A=[[0,0]for i in range(n)]
B=[[0,0] for i in range(m)]
E=[1]*n
for i in range(n):
A[i][0],A[i][1]=map(int,input().split())
for i in range(m):
B[i][0],B[i][1]=map(int,input().split())
for i in range(n):
c=abs(A[i][0]-B[0][0])+abs(A[i][1]-B[0][1])
for j in range(1,m):
if abs(A[i][0]-B[j][0])+abs(A[i][1]-B[j][1])<c:
E[i]=j+1
for i in range(n):
print(E[i]) |
p03556 | s771629120 | Wrong Answer | import sys
N=int(input())
for i in range(N):
if i**2>N:
print((i-1)**2)
sys.exit()
else:
pass
|
p03997 | s144819792 | Accepted | a = int(input())
b = int(input())
h = int(input())
print(int((a+b)*h/2)) |
p02675 | s839205948 | Wrong Answer | n=str(input())
a=n[-1]
if a=='2' or n=='4' or a=='5' or a=='7' or a=='9':
print('hon')
elif a=='3':
print('bon')
elif n==0:
print('hon')
else:
print('pon') |
p02720 | s139179604 | Accepted | from collections import deque
K = int(input())
que = deque()
for i in range(1, 10):
que.append(i)
count = 0
while 1:
count += 1
x = que.popleft()
for i in range(-1, 2):
d = x % 10 + i
if (d < 0 or 9 < d):
continue
que.append(x * 10 + d)
if (count == K):
print(x)
break |
p02608 | s758736154 | Accepted | #
import sys
input=sys.stdin.readline
def main():
N=int(input())
cnt=[0]*(8*N)
r=int(N**0.5)+1
for x in range(1,r):
for y in range(1,r):
for z in range(1,r):
cnt[x*x+y*y+z*z+x*y+y*z+z*x]+=1
for i in range(1,N+1):
print(cnt[i])
if __name__=="__main__":
main()
|
p02924 | s818362852 | Accepted | n=int(input())
print(n*(n-1)//2)
|
p02982 | s999479218 | Accepted | import sys
import math
import numpy as np
stdin = sys.stdin
mod = 10**9 + 7
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]
n, d = na()
x = [[] for _ in range(n)]
for i in range(n):
x[i] = na()
x = np.array(x)
c = 0
for i in range(n):
for j in range(i+1, n):
s = (np.sum((x[i] - x[j])**2))**0.5
if s.is_integer():
c += 1
print(c) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.