problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03994 | s019593243 | Accepted | s = input()
K = int(input())
k = K
ans = ""
for i in range(len(s)-1):
if(s[i] == "a"):
ans += s[i]
continue
if(ord(s[i])+k >= ord("z")+1):
ans += "a"
k -= ord("z")+1-ord(s[i])
else:
ans += s[i]
a = ord(s[-1])+k%26
if(a > ord("z")):
a -= 26
ans += chr(a)
print(ans) |
p03250 | s481185163 | Wrong Answer | A,B,C=map(int,input().split())
if A <= B :
print(B*10+C+A)
else :
print(A*10+B+C) |
p02924 | s057703860 | Wrong Answer | n=int(input())
ans=n*(n-1)/2
print(int(ans)) |
p02819 | s356559348 | Accepted | import math
X = int(input())
def is_prime(n):
if n <= 1:
return False
if n == 2:
return True
if n%2 == 0:
return False
for i in range(3,math.ceil(math.sqrt(n)),2):
if n%i == 0:
return False
return True
inf = 10**20
if is_prime(X) == True:
print(X)
else:
for i in range(X+1,inf):
if is_prime(i) == True:
print(i)
break
|
p03435 | s380391249 | Accepted | c = list(map(int, input().split()))
x, y, z = c[0]-c[1], c[1]-c[2], c[2]-c[0]
flag = True
for i in range(2):
c = list(map(int, input().split()))
s, t, u = c[0]-c[1], c[1]-c[2], c[2]-c[0]
if (x!=s) or (y!=t) or (z!=u):
flag = False
break
if flag:
print('Yes')
else:
print('No') |
p03455 | s363200878 | Wrong Answer | a, b = map(int, input().split())
if a * b % 2 == 0:
print('Yes')
else:
print('No') |
p02987 | s634281075 | Accepted | s = list(input())
if len(set(s))==2 and ((s[0]==s[1] and s[2]==s[3]) or (s[0]==s[2] and s[1]==s[3]) or (s[0]==s[3] and s[1]==s[2])):
print('Yes')
else:
print('No') |
p02972 | s835254000 | Accepted | N = int(input())
a = list(map(int, input().split()))
a.insert(0, 0)
b = [0 for _ in range(N+1)]
b[-1] = a[-1]
for i in reversed(range(N+1)):
sum = 0
for j in range(2, N+1):
if i*j <= N:
sum += b[i*j]
else:
break
if sum%2 == a[i]:
b[i] = 0
else:
b[i] = 1
ans = [str(i+1) for i, x in enumerate(b[1:]) if x == 1]
print(len(ans))
if len(ans) != 0:
print(" ".join(ans)) |
p02792 | s009830369 | Wrong Answer | N = int(input())
from numpy import zeros
A = zeros((10,10))
for i in range(1,N+1):
a = int(str(i)[0])
b = int(str(i)[-1])
A[a][b] += 1
cnt = 0
for _ in range(1,N+1):
a = int(str(_)[0])
b = int(str(_)[-1])
cnt += A[b][a]
print(cnt) |
p03761 | s980770677 | Accepted | #!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1
n=int(input())
S=[input() for i in range(n)]
C = collections.Counter(S[0])
for i in range(2,n):
C1 = collections.Counter(S[i])
C = C & C1
s=[]
for ci,i in C.items():
s+=[ci]*i
s.sort()
print(*s,sep="") |
p02695 | s630303569 | Accepted | n, m, q = [int(e) for e in input().split()]
import itertools as it
abcd=list()
for i in range(q):
abcd.append([int(e) for e in input().split()])
all = it.combinations_with_replacement(range(1,m+1),n)
count=list()
num=0
for i in all:
for j in abcd:
if i[j[1]-1]-i[j[0]-1] == j[2]:
num += j[3]
else:
pass
count.append(num)
num=0
print(max(count)) |
p02682 | s358086334 | Wrong Answer | a,b,c,k = map(int,input().split())
ans = 0
if a <= k:
ans += a
else:
print(a)
exit()
k = k - a
if b <= k:
ans += 0
else:
print(ans)
exit()
k = k - b
ans += k*-1
print(ans) |
p02963 | s804037130 | Accepted | import math
S = int(input())
a = int(math.sqrt(S))
if S - a**2 > 0:
a += 1
b = a**2 - S
c = 1
if b >= 10**8:
s = int(math.sqrt(b))
for i in range(s):
if b % (s-i) == 0:
b //= (s-i)
c *= (s-i)
break
print(0, 0, a, b, c, a) |
p03860 | s471260355 | Accepted | a,b,c = map(str,input().split())
s = list(b)
print('A'+str(b[0]+'C'))
|
p03455 | s564542705 | Accepted | a,b=map(int,input().split())
if a*b%2==0:
print('Even')
else:
print('Odd') |
p02681 | s882155017 | Accepted | s = input()
t = input()
if len(s) + 1 != len(t):
print("No")
elif s != t[:len(s)]:
print("No")
else:
print("Yes") |
p03817 | s691955790 | Accepted | x = int(input())
c = x // 11
m = x % 11
cnt = 2 * c
if 0 < m < 7:
cnt += 1
elif 6 < m:
cnt += 2
print(cnt)
|
p02598 | s483164970 | Wrong Answer | N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
def check(N, K, A, L):
return sum(a // L for a in A) <= K
lo = 1
hi = max(A)+1
while lo < hi:
m = (lo + hi)//2
ok = check(N, K, A, m)
if ok: # m 出来れるのでもっと小さく切れるか
hi=m
else:
lo=m+1
print(min(max(A), lo))
|
p02595 | s118822291 | Accepted | import math
N, D = map(int, input().split())
X = []
Y = []
ans = 0
for i in range(N):
x,y = map(int, input().split())
X.append(x)
Y.append(y)
for i in range(N):
if math.sqrt(X[i]** 2 + Y[i]** 2) <= D:
ans += 1
print(ans) |
p03359 | s666791005 | Accepted | a, b = map(int, input().split())
if a <= b:
print(a)
else:
print(a - 1) |
p02790 | s992097612 | Wrong Answer | a,b=input().split()
print(min(int(b*int(a)),int(a*int(b)))) |
p02725 | s292952284 | Accepted | K, N = map(int, input().split())
A = list(map(int, input().split()))
mx = 0
for i in range(N - 1):
mx = max([mx, A[i+1] - A[i]])
mx = max([mx, A[0] + K - A[N-1]])
print(K-mx) |
p03377 | s063092746 | Accepted | a, b, x = map(int, input().split())
if a + b >= x and a <= x:
print('YES')
else:
print('NO')
|
p03162 | s796963806 | Accepted | def main():
N=int(input())
dp=[[0]*(3) for _ in range(N)]
dp[0][0],dp[0][1],dp[0][2]=map(int,input().split())
for i in range(1,N):
a,b,c=map(int,input().split())
dp[i][0]=a+max(dp[i-1][1],dp[i-1][2])
dp[i][1]=b+max(dp[i-1][0],dp[i-1][2])
dp[i][2]=c+max(dp[i-1][1],dp[i-1][0])
print(max(dp[-1][0],dp[-1][1],dp[-1][2]))
main() |
p03637 | s204427927 | Accepted |
def main():
n = int(input())
a = list(map(int, input().split()))
div2 = 0
div4 = 0
notdiv4 = 0
for ea in a:
if ea % 4 == 0:
div4 += 1
elif ea % 2 == 0:
div2 += 1
else:
notdiv4 += 1
notdiv4 += div2 % 2
if notdiv4 - 1 > div4:
print('No')
else:
print('Yes')
if __name__ == '__main__':
main() |
p02708 | s250211231 | Accepted | N, K = [int(i) for i in input().split()]
res = 0
for i in range(K, N + 2) :
sum_lasti = i * (2 * N + 1 - i)/2 #初項 N + 1 - i 項数 i 公差1 末項 Nの等差数列の和
sum_firsti = ( i * i - i )/ 2 #初項 0 項数 i 公差1 末項 i-1の等差数列の和
res += sum_lasti - sum_firsti + 1
print(int(res%1000000007))
|
p03145 | s626663594 | Accepted | x,y,z= map(int,input().split())
print(x*y//2)
|
p03105 | s571749192 | Accepted | a,b,c=[int(i)for i in input().split()]
d=b//a
print(min(d,c)) |
p02688 | s787958316 | Accepted | N, K = map(int, input().split())
treats = [False] * N
for _ in range(K):
d = int(input())
As = map(int, input().split())
for A in As:
treats[A - 1] = True
count = 0
for t in treats:
if not t:
count += 1
print(count)
|
p02603 | s651907415 | Wrong Answer | n = int(input())
a = list(map(int, input().split()))
m = 1000
i = 0
while i < n - 1:
for j in range(i + 1, n):
if a[i] < a[j]:
m = m // a[i] * a[j] + m % a[i]
else:
i = j
break
print(m) |
p03379 | s953611540 | Accepted | n = int(input())
al = list(map(int, input().split()))
als = list(sorted(al))
x = als[n//2]
y = als[n//2-1]
for i in range(n):
z = al[i]
if z <=y:
print(x)
else:
print(y) |
p03474 | s243172539 | Wrong Answer | def resolve():
A, B = map(int, input().split())
S = input()
C = "1234567890"
if S[A] == "-":
S.replace(S[A], "0")
for i in range(len(S)):
if S[i] in C:
continue
else:
print("No")
exit()
print("Yes")
exit()
else:
print("No")
resolve() |
p02818 | s005678720 | Accepted | A,B,K = map(int,input().split())
if A+B<=K:
print(0,0)
else:
if A<=K:
print(0,B-(K-A))
else:
print(A-K,B) |
p02612 | s702270049 | Wrong Answer | from collections import deque
import math
import os
import random
import re
import sys
#n=list(map(int, input().split()))
#n=map(int, input().split())
def main():
din=int(input())
ar=[1000,2000,3000,4000,5000]
if din not in ar:
print(din-1800)
else:
print(0)
main()
'''
if __name__ == '__main__':
main()
'''
|
p02910 | s679513140 | Wrong Answer | S = list(map(str,input()))
odd = ['R','U','D']
even = ['L','U','D']
for i in range(len(S)):
if (i+1) == 0:
if S[i] in odd:
print('No')
exit()
elif (i+1) == 0:
if S[i] in even:
print('No')
exit()
print('Yes') |
p03131 | s251197377 | Wrong Answer | k, a, b = map(int, input().split())
if k < (a + 2) or (b - a) <= 2:
print(1 + k)
else:
cnt = (k - (a - 1)) // 2
mod = (k - (a - 1)) % 2
ans = (b - a)*cnt + a + mod
print(max(ans, k + 1)) |
p02705 | s850236854 | Accepted | from math import pi
print(2*int(input())*pi)
|
p03220 | s545784763 | Accepted | n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
l = []
for i in range(n):
k = (t-h[i]*0.006)
l.append(abs(a-k))
print(l.index(min(l))+1) |
p02777 | s382104901 | Accepted | S, T = input().split()
A, B = map(int,input().split())
U = input()
dic = {}
dic[S] = A
dic[T] = B
dic[U] -= 1
print(dic[S],dic[T])
|
p02608 | s733320593 | Wrong Answer | n = int(input())
f = [0]*21600
for x in range(1,60):
for y in range(1,60):
for z in range(1,60):
f[x**2+y**2+z**2+x*y+y*z+z*x-1]+=1
for i in range(n):
print(f[i]) |
p03456 | s121993425 | Accepted | import math
l=[]
l2=[]
l=list(map(str,input().split()))
d=int("".join(l))
for i in range(1,350):
c=pow(i,2)
l2.append(c)
if d in l2:
print("Yes")
else :
print("No") |
p02675 | s384449234 | Accepted | N = input()
if N[-1] in ['2', '4', '5', '7', '9']:
print('hon')
elif N[-1] in ['0', '1', '6', '8']:
print('pon')
else:
print('bon') |
p03241 | s569297921 | Wrong Answer | from math import sqrt
from numba import njit
@njit
def divisors(n):
divisors = []
for i in range(1, int(sqrt(n))+1):
q, r = divmod(n, i)
if r == 0:
divisors.append(i)
if i != q:
divisors.append(q)
divisors.sort()
return divisors
n, m = map(int, input().split())
ans = 1
for a in divisors(m)[1:-1]:
if a*n <= m:
ans = a
print(ans) |
p02829 | s562971431 | Wrong Answer | a=int(input())
b=int(input())
c=a+b
if c==3:
print("2")
elif c==4:
print("3")
else:
print("1") |
p03524 | s263262595 | Accepted | from collections import Counter
s = input()
cnt = list(Counter(s).values())
if len(cnt) < 3: cnt.append(0)
print('YES' if max(cnt) - min(cnt) <= 1 else 'NO') |
p03944 | s922977243 | Wrong Answer | w, h, n = map(int, input().split())
min_x, max_x, min_y, max_y = 0, w, 0, h
for _ in range(n):
x, y, a = map(int, input().split())
if a == 1:
min_x = x
elif a == 2:
max_x = x
elif a == 3:
min_y = y
else:
max_y = y
if max_x <= min_x or max_y <= min_y:
print(0)
else:
print((max_x - min_x) * (max_y - min_y)) |
p02768 | s394703911 | Accepted | def main():
n, a, b = map(int, input().split())
mod = 10**9+7
s = pow(2, n, mod)-1
x = 1
y = 1
for i in range(1, b+1):
x = x*(n-i+1)%mod
y = y*i%mod
if i==a or i==b:
s -= x*pow(y, mod-2, mod)
print(s%mod)
main() |
p03338 | s434793819 | Accepted | def main():
n = int(input())
s = input()
ma = 0
for i in range(1, n):
x = s[:i]
y = s[i:]
ma = max(ma, count_same(x, y))
print(ma)
def count_same(x, y):
return len(set(x) & set(y))
if __name__ == '__main__':
main()
|
p03062 | s354954782 | Accepted | from numpy import*
n=int(input())
a=array(list(map(int,input().split())))
b=abs(a)
if 0 in a:
print(sum(b));exit()
minus_cnt=sum(a<0)
if minus_cnt%2==0:
print(sum(b));exit()
print(sum(b)-min(b)*2)
|
p03286 | s957097986 | Accepted | n = int(input())
s = ""
while n != 0:
s += str(-(n % -2))
n = -(n//2)
if s == "":
print(0)
else:
print("".join(s[::-1]))
|
p02724 | s818720950 | Accepted | s=int(input())
a= s//500
b=(s%500)//5
yasashisa=a*1000+b*5
print(yasashisa) |
p02699 | s258323223 | Accepted | S,W = map(int,input().split())
if W<S:
print("safe")
else:
print("unsafe") |
p03037 | s707211988 | Wrong Answer | n,m = map(int, input().split())
l,r = [0]*m,[0]*m
for i in range(m):
l[i],r[i] = map(int,input().split())
s = min(n,min(r)) - min(n,max(l))
if (n < min(r)):
s = 0
else:
s += 1
print(s) |
p02958 | s306025916 | Wrong Answer | N = int(input())
MM = input().split()
count = 0
list1 =[]
for i in MM:
a = int(i)
list1.append(a)
list2 = sorted(list1)
for i,j in zip(list1,list2):
if i != j:
count +=1
if count >2:
print('No')
else:
print('Yes') |
p03380 | s597475222 | Wrong Answer | from scipy.misc import comb
url = "https://atcoder.jp//contests/abc094/tasks/arc095_b"
def main():
input()
t = list(map(int, input().split()))
combs = {}
for i in range(-1, -2, -1):
for j in range(i, len(t)):
tmp = sorted([t[i], t[j]], reverse=True)
combs[comb(tmp[0], tmp[1], exact=True)] = tmp[::]
key = max(combs.keys())
print(' '.join([str(v) for v in combs[key]]))
if __name__ == '__main__':
main()
|
p02862 | s822230617 | Accepted | mod = 10 ** 9 + 7 # mod素数
def nCr(n, r, mod):
ret = [1]*(r+1)
for i in range(1, r+1):
ret[i] = (ret[i-1] * (n-i+1) * pow(i,mod-2,mod)) % mod
return ret
X,Y=map(int,input().split())
x,y = 2*X-Y, 2*Y-X
if x<0 or y<0 or x%3!=0 or y%3!=0:
ret=0
else:
x,y=x//3,y//3
nCrl = nCr(x+y, min(x,y), mod)
ret=nCrl[min(x,y)]
print(ret) |
p03679 | s874810131 | Accepted | X,A,B=map(int,input().split())
if X<B-A:
print("dangerous")
elif B-A<=0:
print("delicious")
else:
print("safe") |
p02645 | s232120681 | Wrong Answer | S=input()
print(S[0:2]) |
p03481 | s273319751 | Wrong Answer | import math
x,y=map(int,input().split())
ans=math.floor(math.log2(y/x))+1
print(ans) |
p02546 | s659386764 | Accepted | S = input()
print(S + "s" if S[-1] != "s" else S + "es") |
p03059 | s470633417 | Accepted | a, b, t = map(int, input().split())
print(b * (t // a))
|
p03543 | s007940911 | Wrong Answer | N = input()
index = set()
for c in N:
index.add(c)
if (len(index) <= 2):
print('Yes')
else:
print('No')
|
p02861 | s863899427 | Accepted | N = int(input())
XY = [list(map(int, input().split())) for _ in range(N)]
dist_sum = 0
for n, i in enumerate(XY[:-1]):
for j in XY[n+1:]:
dist_sum += ((i[0] - j[0])**2 + (i[1] - j[1])**2) ** 0.5
print(dist_sum * 2 / N)
|
p02996 | s779649396 | Wrong Answer | n = int(input())
a = []
for i in range(n):
a.append(list(map(int,input().split())))
a.sort(key=lambda x: x[1])
q = 0
w = 0
flg = 0
for j in a:
q += j[0]
w += j[1]
if q > w :
flg = 1
break
if flg == 0:
print('Yes')
else:
print('No')
|
p03705 | s991717875 | Accepted | n,a,b=map(int,input().split())
if a>b:
print(0)
exit()
if a==b:
print(1)
exit()
if n==1:
print(0)
exit()
minimum = a*(n-1)+b
maximum = b*(n-1)+a
if n<=2:
print(1)
else:
print(maximum-minimum+1)
|
p03035 | s469895218 | Accepted | a,b = map(int,input().split())
if a<=5:
print(0)
elif 6<=a and a<=12:
print(int(b/2))
else:
print(b) |
p02597 | s828033992 | Accepted | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
n = int(input())
word = input()
res = 0
num_r = 0
for charactor in word:
if charactor == 'R':
num_r += 1
num_w = 0
for i in range(num_r):
if word[i] == 'W':
num_w += 1
print(num_w)
|
p03067 | s020942549 | Accepted | A,B,C = map(int,input().split())
if A < C < B or B < C < A:
print("Yes")
else:
print("No") |
p02952 | s191137808 | Accepted | n = int(input())
d = 1
ans = 0
while True:
if d > n:
break
else:
if d * 10 <= n:
ans += d * 9
else:
ans += n - d + 1
d *= 100
print(ans) |
p02773 | s882331453 | Accepted | from collections import defaultdict
from collections import OrderedDict
N = int(input())
ans = dict()
for _ in range(N):
k = str(input())
if k in ans:
ans[k]+=1
else:
ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
print(i) |
p03456 | s248428624 | Accepted | a,b = [x for x in input().split()]
ans = False
for i in range(1,1000):
if i ** 2== int(a+b):
ans = True
break
if ans:
print("Yes")
else:
print("No") |
p03545 | s629892754 | Accepted | import itertools
num = str(input())
sign = ("+", "-")
for s1, s2, s3 in itertools.product(sign, repeat=3):
result = num[0] + s1 + num[1] + s2 + num[2] + s3 + num[3]
if eval(result) == 7:
print(result+"=7")
break |
p03723 | s182098236 | Wrong Answer | def main():
A, B, C = map(int, input().split())
ans = 0
if (2 * A - B - C) == 0 and (2 * B - A - C) == 0 and (2 * C - A - B) == 0:
print(-1)
else:
for i in range(10**5):
if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
print(ans)
exit()
A, B, C = (B + C)//2, (A + C)//2, (A + B)//2
ans += 1
if __name__ == "__main__":
main() |
p03951 | s156366392 | Wrong Answer | n = int(input())
s = input()
t = input()
if(s == t):
print(len(s))
exit()
tmp = []
i = 1
while True:
if(s[-i] == t[i-1]):
tmp.append(i-1)
i += 1
else:
break
print(tmp)
t = list(t)
for i in range(len(tmp)):
del t[tmp[i]]
t = ''.join(t)
print(len(s+t)) |
p02939 | s866762747 | Accepted | s=list(input())
n=len(s)
dp=[0]*(n+1)
dp[0]=0
dp[1]=1
if n>=2:
dp[2]=1+(1 if s[0]!=s[1] else 0)
for i in range(2,n):
if s[i]!=s[i-1]:
dp[i+1]=dp[i]+1
else:
dp[i+1]=dp[i-2]+2
print(dp[n]) |
p02705 | s036952689 | Wrong Answer | r = int(input())
print(r*r*3.14) |
p02880 | s864026598 | Wrong Answer | N=int(input())
if N>81:
print("No")
for i in range(2,9):
if N%i==0 and N<=i*9:
print("yes")
exit(0)
print("No") |
p03449 | s918357232 | Accepted | N = int(input())
A = [list(map(int, input().split())) for _ in range(2)]
ans = 0
for n in range(N):
score = sum(A[0][:n + 1]) + sum(A[1][n:])
ans = max(ans, score)
print(ans) |
p02582 | s785950316 | Wrong Answer | input_weather = input()
print(input_weather.count('R')) |
p02697 | s989054443 | Accepted | N,M=map(int,input().split())
if N%2==1:
for i in range(1,M+1):
a,b=i,N-i
print(a,b)
else:
for i in range(1,M+1):
a,b=i,N-i
if b-a<=N//2:
a+=1
print(a,b) |
p03723 | s040223040 | Accepted | import sys
A, B, C = list(map(int, input().split()))
if A % 2 != 0 or B % 2 != 0 or B % 2 != 0:
print('0')
sys.exit()
if A == B == C:
print('-1')
sys.exit()
cnt = 0
while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
_A = A
_B = B
_C = C
A = _B // 2 + _C // 2
B = _A // 2 + _C // 2
C = _A // 2 + _B // 2
cnt += 1
print(cnt)
|
p02786 | s188690594 | Accepted | H=int(input())
print(2**(len(format(H,'b')))-1) |
p03309 | s550438373 | Accepted | n=int(input())
a=list(map(int,input().split()))
temp=[0]*n
for i in range(0,n):
temp[i]=a[i]-(i+1)
temp.sort()
ave=int(n/2)
ans=0
for i in range(0,n):
ans=ans+abs(temp[i]-temp[ave])
print(ans) |
p02780 | s745760604 | Wrong Answer | N, K = (int(i) for i in input().split())
p = [int(i) for i in input().split()]
p_ex = [(i+1)/2 for i in p]
sum_list = [sum(p_ex[0:K]),sum(p_ex[N-K:N])]
tmp_num = sum_list[0]
if N == K:
print(sum(p_ex))
else:
for i in range(1,N-K):
#print("i:"+str(i))
tmp_num = tmp_num - p_ex[i-1] + p_ex[i+K]
#print(" tmp_num = tmp_num - "+str(p_ex[i-1])+" + "+str(p_ex[i+K]))
sum_list.append(tmp_num)
print(max(sum_list)) |
p04020 | s066840332 | Accepted | import math
n = int(input())
cards = [0] * n
for i in range(n):
cards[i] = int(input())
ans = 0
for i in range(n):
ans += math.floor(cards[i] / 2)
cards[i] = cards[i] % 2
if cards[i] == 1 and not(i == (n - 1)) and not(cards[i + 1] == 0):
ans += 1
cards[i + 1] = cards[i + 1] - 1
print(ans)
|
p03041 | s310547159 | Accepted | a,b=map(int,input().split())
s=list(input())
s[b-1]=(s[b-1]).lower()
print("".join(s)) |
p02996 | s495817310 | Accepted | N = int(input())
AB = [list(map(int, input().split())) for _ in range(N)]
AB.sort(key=lambda x: x[1])
A, B = [list(i) for i in zip(*AB)]
t = 0
bl = True
for i in range(N):
t += A[i]
if t > B[i]:
bl = False
print('Yes' if bl else 'No') |
p03061 | s617140308 | Accepted | n = int(input())
A = list(map(int, input().split()))
def gcd(x, y):
if x < y: x, y = y, x
if y == 0: return x
return gcd(x % y, y)
L = [A[0]]
for i in range(1, n):
L.append(gcd(L[-1], A[i]))
R = [A[-1]]
for i in range(n-2, -1, -1):
R.append(gcd(R[-1], A[i]))
R = list(reversed(R))
ans = 1
for i in range(n):
if i == 0: g = R[i+1]
elif i == n-1: g = L[i-1]
else: g = gcd(L[i-1], R[i+1])
ans = max(ans, g)
print(ans) |
p03352 | s820324822 | Accepted | from math import *
x=int(input())
ans=[]
if x<4:
print(1)
exit()
for i in range(2,int(sqrt(x))+1):
t=2
while i**t<=x:
ans.append(i**t)
t+=1
print(max(ans)) |
p02909 | s922487208 | Accepted | c = ['Sunny', 'Cloudy', 'Rainy', 'Sunny']
s = input()
print(c[c.index(s) + 1]) |
p03719 | s255377828 | Wrong Answer | A,B,C=list(map(int,input().split()))
if A<=C<=B:
print('YES')
else:
print('NO') |
p02675 | s250150489 | Accepted | n = int(input())%10
if n in [2, 4, 5, 7, 9]:
print("hon")
elif n in [0, 1, 6, 8]:
print("pon")
else:
print("bon") |
p03284 | s725930886 | Wrong Answer | a, b = list(map(int, input().split()))
print( a % b ) |
p03633 | s042956476 | Accepted | def lcm(a, b):
x, y = a, b
while y != 0:
x, y = y, x % y
return a * b // x
N = int(input())
T = [int(input()) for _ in range(N)]
ans = 1
for t in T:
ans = lcm(ans, t)
print(ans)
|
p03380 | s395812139 | Accepted | n = int(input())
a = list(map(int, input().split()))
a.sort()
large = max(a)
a.remove(large)
min_list = [0, large/2]
for i in a:
if abs(i - large/2) < min_list[1]:
min_list = [i, abs(i - large/2)]
print(large, min_list[0])
|
p03493 | s230823044 | Wrong Answer | num = int(input())
a = num // 100
b = num // 10 - (a * 10)
c = num - (a * 100) - (b * 10)
print(a, b, c)
print(a + b + c) |
p02793 | s131556674 | Wrong Answer | import fractions
from functools import reduce
def gcd(*numbers):
return reduce(fractions.gcd, numbers)
def gcd_list(numbers):
return reduce(fractions.gcd, numbers)
def lcm_base(x, y):
return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
N = int(input())
A = list(map(int, input().split()))
ans = 0
MOD = 10**9 + 7
GCD = gcd_list(A)
LCM = lcm_list(A)//GCD
for a in A:
a == a//GCD
ans += LCM//a
ans = ans%MOD
print(ans) |
p02743 | s731957724 | Wrong Answer | from math import sqrt
from decimal import Decimal
def main():
a, b, c = map(Decimal, input().split())
print("Yes" if Decimal(sqrt(a)) + Decimal(sqrt(b)) < Decimal(sqrt(c)) else "No")
if __name__ == '__main__':
main()
|
p02613 | s195635864 | Accepted | # B
from collections import Counter
n = int(input())
s_c = Counter([input() for x in range(n)])
print("AC x",s_c["AC"])
print("WA x",s_c["WA"])
print("TLE x",s_c["TLE"])
print("RE x",s_c["RE"]) |
p02713 | s928691523 | Wrong Answer | import math
n = 2
sum = 0
for i in range(1,n+1):
for j in range(1,n+1):
for k in range(1,n+1):
sum += math.gcd(math.gcd(k,j), i)
print(sum) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.