problem_id stringclasses 428
values | submission_id stringlengths 10 10 | status stringclasses 2
values | code stringlengths 5 816 |
|---|---|---|---|
p03673 | s862748224 | Accepted | from collections import deque
n = int(input())
a = list(map(int, input().split()))
q = deque()
t = 0
for i in a:
if t == 0: q.append(i)
else: q.appendleft(i)
t = -1 - t
if t == 0: print(*q)
else: print(*reversed(q)) |
p02761 | s228428537 | Accepted | n, m = [int(i) for i in input().split()]
n_list = [10] * n
for _ in range(m):
si, ci = [int(i) for i in input().split()]
if n_list[si - 1] == 10:
n_list[si - 1] = ci
elif n_list[si - 1] != ci:
print(-1)
exit()
if n != 1:
ans = n_list[0] if n_list[0] != 10 else 1
else:
ans = n_list[0] if n_list[0] ... |
p02951 | s852682325 | Wrong Answer | a,b,c=map(int, input().split())
print(b + c -a) |
p02571 | s637867129 | Accepted | a = input()
b = input()
arr = []
la = len(a)
lb = len(b)
for i in range(la-lb+1):
c = a[i:i+lb]
cu = 0
for j in range(lb):
if c[j] != b[j]:
cu += 1
arr.append(cu)
print(min(arr)) |
p03761 | s179263486 | Accepted | from collections import defaultdict
N = int(input())
S = [input() for _ in range(N)]
d = defaultdict(lambda: 50+1)
for i in range(N):
for c in range(ord("a"), ord("z")+1):
d[chr(c)] = min(d[chr(c)], S[i].count(chr(c)))
ans = ""
for key, value in d.items():
ans += key * value
print(ans) |
p03339 | s320767350 | Accepted | N = int(input())
S = input()
a = S.count("E")
c = a
for s in S:
if s=="E":
c-=1
else:
c+=1
a=min(a,c)
print(a) |
p03835 | s265092003 | Wrong Answer | from math import *
def nHr(n, r):
if 0 <= r:
return factorial(n+r-1) / (factorial(r) * factorial(n-1))
else:
return 0
lst = input().split()
K = int(lst[0])
S = int(lst[1])
a = nHr(3, S)
b = (3 * nHr(3, S - K)) - (3 * nHr(3, S - (2*K)))
print(int(a - b)) |
p03760 | s817743634 | Wrong Answer | o=list(input())
e=list(input())
for x,y in zip(o,e):print(x+y,end="") |
p03815 | s591073281 | Wrong Answer | x=int(input())
if 0<=x%11<=5:
ans=(x//11)*2+1
if x%11>5:
ans=(x//11)*2+2
print(ans)
|
p03760 | s329749235 | Accepted | O,E=input(),input()
ans=''
for i in range(len(O+E)):
if i%2==0: ans=ans+O[i//2]
else: ans=ans=ans+E[i//2]
print(ans) |
p03284 | s826400871 | Accepted | n, k = map(int, input().split())
if n % k == 0:
print(0)
else:
print(1) |
p03494 | s938610182 | Wrong Answer | n=int(input())
a=list(map(int,input().split()))
b=[]
cnt=0
for i in range(n):
while a[i]%2==0:
a[i] /= 2
cnt += 1
b.append(cnt)
cnt = 0
if min(b)!=0:
print(min(b)-1)
else:
print('0') |
p02843 | s506798979 | Accepted | x=int(input())
y=1 # y個購入すると題意をみたす時、1<=y<=x//100、実際に支払い可能な金額は100*y〜105*y
if x<100:
print(0)
else:
while y<=x//100+1:
if y*100<=x<=y*105:
print(1)
break
elif y>x//100:
print(0)
break
else:
y+=1
|
p03617 | s299002018 | Wrong Answer | Q, H, S, D = map(int, input().split())
N = int(input())
q, h, s, d = Q * 4, H * 2, S, D / 2
if N % 2 == 0:
ans = N * min(q, h, s, d)
else:
if N == 1:
ans = min(q, h, s)
else:
ans = (N - 1) * min(q, h, s, d) + min(q, h, s)
print(int(ans))
|
p03475 | s330794113 | Wrong Answer | n = int(input())
cs = []
ss = []
fs = []
for _ in range(n-1):
c, s, f = map(int, input().split())
cs.append(c)
ss.append(s)
fs.append(f)
for i in range(n):
t = 0
for j in range(i, n-1):
if t < ss[j]:
t = ss[j] + cs[j]
elif t % fs[j] == 0:
t += cs[j]
... |
p03711 | s955722204 | Wrong Answer | A = [1,3,5,7,10,12]
B = [4,6,9,11]
a,b = map(int, input().split())
if ((a in A)and(b in A)) or ((a in B) and (b in B)) or a == b == 2:
print("Yes")
else:
print("No") |
p03817 | s045038670 | Wrong Answer | x = int(input())
ans = 0
ans = x//11*2
x %= 11
# 0 <= x < 11 になっている
if x == 0:
pass
elif x < 6:
ans += 1
else:
ans += 2
print(ans) |
p03543 | s734653179 | Wrong Answer | print('NYoe s'[len(set(input()))<3::2]) |
p03943 | s352041069 | Accepted | a, b, c = map(int, input().split())
if max(a, b, c) == a + b + c - max(a, b, c):
print('Yes')
else:
print('No')
|
p02711 | s364535448 | Accepted | if '7' in str(input()):
print('Yes')
else:
print('No')
|
p04044 | s658867066 | Wrong Answer | n,b=list(map(int,input().split()))
a=[input() for i in range(n)]
print(''.join(a)) |
p02989 | s172875644 | Accepted | n=int(input())
a=list(map(int,input().split()))
a.sort()
m=n//2
print(a[m]-a[m-1])
|
p03262 | s488878257 | Accepted | import fractions
from functools import reduce
def gcd_list(numbers):
return reduce(fractions.gcd, numbers)
N,X=map(int,input().split())
W=list(map(int,input().split()))
ans=[]
for i in W:
ans.append(abs(i-X))
print(gcd_list(ans))
|
p02661 | s808379946 | Accepted | n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
a = [x[0] for x in ab]
a.sort()
b = [y[1] for y in ab]
b.sort()
if n % 2 == 0:
print((b[n // 2 - 1] + b[n // 2]) - (a[n // 2 - 1] + a[n // 2]) + 1)
else:
print(b[(n - 1) // 2] - a[(n - 1) // 2] + 1) |
p02939 | s404519137 | Accepted | s = input()
ans = 0
n = len(s)
prev = ""
now = 0
while now<n:
if prev != s[now]:
prev = s[now]
now += 1
else:
if now != n-1:
now += 2
prev = ""
else:
break
ans += 1
print(ans) |
p03387 | s055036445 | Wrong Answer | a=list(map(int,input().split()))
a.sort()
cnt=0
if a[0]==a[1]==a[2]:
print(0)
exit()
if a[0]==[1]:
print(a[2]-a[1])
exit()
if a[1]==a[2]:
if (a[2]-a[0])%2==0:
print(a[2]-a[0])
exit()
else:
print(a[2]-a[0]+1)
exit()
cnt+=a[2]-a[1]
a[0]+=cnt
if a[0]%2==0:
cnt+=a[2]-a[0]
else:
cnt+=a[2]-a[0... |
p03767 | s945882773 | Wrong Answer | N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
# print(A)
ans = sum(A[N:2*N])
print(ans) |
p03997 | s169891644 | Accepted | #!/usr/bin/env python3
print((int(input())+int(input()))*int(input())//2) |
p03161 | s795441800 | Wrong Answer | n , k = map(int, input().split())
H = list(map(int, input().split()))
DP = [100000 for i in range(n)]
DP[0] = 0
for i in range(1, n):
for j in range(1, k+1):
if i - j >= 0:
tmp = DP[i - j] + abs(H[i - j] - H[i])
DP[i] = min(DP[i], tmp)
else:
pass
print(DP[n - 1]... |
p02768 | s351340773 | Wrong Answer | M = 10**9 + 7
n, a, b = map(int, input().split())
r = (pow(2, n, M) - 1) % M
f = c = 1
for i in range(b):
f = f * (i + 1) % M
c = c * (n - i) % M
if i + 1 == a:
r = (r - c * pow(f, M - 2, M)) % M
print((r - c * pow(f, M - 2, M) % M))
|
p03719 | s937019949 | Accepted | A, B, C = map(int, input().split())
if (C >= A) and (C <= B):
print( "Yes" )
else :
print( "No" ) |
p02860 | s750102550 | Wrong Answer | n = int(input())
s = input()
if n%2 == 1:
print("No")
slise = (n/2)+1
a = s[:int(slise)]
b = s[int(slise):]
if a==b:
print("Yes")
else:
print("No") |
p02696 | s338311245 | Accepted | from math import floor
a, b, n = map(int, input().split())
if b > n:
print(floor(a*n/b))
else:
print(floor(a*(b-1)/b))
|
p02759 | s219996123 | Wrong Answer | N = int(input())
if N % 2 ==1:
print(N//2 +1)
else:
print(N/2) |
p03043 | s660273226 | Wrong Answer | n, k = map(int, input().split())
ans = []
for i in range(1, n+1):
if i < k:
cnt = 0
while i < k:
i *= 2
cnt += 1
tmp = 1/n * ((1/2) ** cnt)
ans.append(tmp)
print(sum(ans)) |
p02640 | s888498130 | Accepted | X, Y = map(int, input().split())
f = 0
for a in range(100):
for b in range(100):
x = a + b
y = 2 * a + 4 * b
if x == X and y == Y:
f = 1
break
if f == 1:
break
print(['No', 'Yes'][f]) |
p02578 | s501363924 | Accepted | N=input()
*A, = map(int,input().split())
ans = 0
h = A[0]
for a in A:
ans += max(0,h-a)
h = max(h,a)
print(ans) |
p02718 | s112582475 | Accepted | n, m = map(int, input().split())
a =list(map(int, input().split()))
b = [i for i in a if i >= sum(a)*(1/(4*m))]
if len(b) >= m:
print("Yes")
else:
print("No") |
p02983 | s891991047 | Wrong Answer | l, r = map(int, input().split())
m = 2019
if r - l < 673:
print(0)
else:
ans = 2018
l = l%m
r = r%m
for i in range(l, r):
for j in range(i+1, r+1):
ans = min(ans, (i*j)%m)
print(ans) |
p03457 | s215590088 | Wrong Answer | """
a,b,c=map(int,input().split())
s=[a,b,c]
s.sort()
print(s[0]+s[1])
"""
n = int(input())
count=0
temp=0
xtemp=0
ytemp=0
for i in range(0,n):
t,x,y = map(int, input().split())
if (t-temp)>=x-xtemp+y-ytemp and (x-xtemp+y-ytemp-(t-temp))%2==0:
count=count+1
temp=t
xtemp=x
ytemp=y
if count==n... |
p02786 | s042566482 | Accepted | H = int(input())
def func(h):
if h == 1:
return 1
else:
return func(h // 2) * 2 + 1
r = func(H)
print(r)
|
p02658 | s272145174 | Wrong Answer | import numpy as np
N = int(input())
AList = np.array(input().split(" "), dtype=np.int64)
result = AList.prod()
if result > 10 ** 18:
print("-1")
else:
print(result) |
p03359 | s194644857 | Wrong Answer | a,b = map(int, input().split())
if a>=b: print(a-1)
else: print(a) |
p02995 | s787822372 | Wrong Answer | import math
A, B, C, D = map(int, input().split())
CD = int(C * D // math.gcd(C, D))
B_in_C = int(B/C)
B_in_D = int(B/D)
B_in_CD = int(B/(CD))
B_con = B - (B_in_C + B_in_D - B_in_CD)
A = A-1 if A > 1 else A
A_in_C = int(A/C)
A_in_D = int(A/D)
A_in_CD = int(A/(CD))
A_con = A - (A_in_C + A_in_D - A_in_CD)
print(B_con... |
p03821 | s803041164 | Wrong Answer | N = int(input())
ls = []
for i in range(N):
a,b = map(int,input().split())
ls.append([a,b])
ls.reverse()
#貪欲法 (aをbの倍数にする)
ans = 0
for i in range(N):
A = ls[i][0]
B = ls[i][1]
if i != 0:
A += ans
if B == 1:
continue
else:
ans += B - A % B
print(ans) |
p03243 | s338150752 | Accepted | l=[i*111 for i in range(1,10)]
N=int(input())
for i in l:
if N>i:
continue
else:
print(i)
break |
p02995 | s740747687 | Accepted | import fractions
a,b,c,d = map(int, input().split())
x = (b//c - (a - 1)//c)
y = (b//d - (a - 1)//d)
z = (b//((c * d)//fractions.gcd(c,d)) - (a - 1)//((c * d)//fractions.gcd(c,d)))
print(int((b - a + 1) - (x + y - z)))
|
p03162 | s680731233 | Accepted | n = int(input())
lst = [list(map(int, input().split())) for i in range(n)]
ans = [[0]*3 for i in range(n)]
ans[0] = lst[0]
for i in range(1, n):
ans[i][0] = lst[i][0] + max(ans[i-1][1], ans[i-1][2])
ans[i][1] = lst[i][1] + max(ans[i-1][0], ans[i-1][2])
ans[i][2] = lst[i][2] + max(ans[i-1][0], ans[i-1][1])
res = ... |
p03720 | s014910025 | Wrong Answer | N, M = map(int, input().split())
mat = [[0 for _ in range(N)] for _ in range(N)]
for i in range(M):
a, b = map(int, input().split())
a -= 1
b -= 1
mat[a][b] = 1
mat[b][a] = 1
for i in range(N):
cnt = 0
for j in range(N):
if mat[i][j] != 0:
cnt += 1
print(cnt) |
p03962 | s132948640 | Accepted | print(len(set(input().split()))) |
p02732 | s603819602 | Accepted | import sys
from collections import Counter
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
count = Counter(A)
sm = {}
sm2 = {}
for key, value in count.items():
sm[key] = value*(value-1)//2
sm2[key] = (value-1)*(value-2)//2
total = sum(sm.values())
for num in A:
print(total... |
p02714 | s309154056 | Accepted | n = int(input())
s = input()
ans = s.count('R') * s.count('G') * s.count('B')
for i in range((n-3)//2+1):
for j in range(n-3-i*2+1):
j1 = j+i+1
j2 = j+i*2+2
if s[j] != s[j1] and s[j1] != s[j2] and s[j2] != s[j]:
ans -= 1
print(ans) |
p02785 | s295649128 | Wrong Answer | import numpy as np
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort
j=0
if K >= N:
print(N)
else:
for i in range (N-K):
j+=H[i]
print(j+K) |
p02755 | s397266676 | Accepted | m,n=map(int,input().split())
l=[]
for i in range(1,12500):
if i*2//25==m and i//10==n:
l.append(i)
if len(l)==0:
print(-1)
else:
print(min(l))
|
p02987 | s753836014 | Accepted | a=list(input())
b=set(a)
count=0
for i in range(4):
if a[0]==a[i]:
count+=1
if len(b)==2 and (count==2):
print('Yes')
else:
print('No')
|
p03951 | s845182934 | Accepted | n=int(input())
s=input()
r=input()
t=s+r
f=0
for i in range(n):
if(s[i:]==r[:n-i]):
t=s[:i]+r
f=1
break
if(f==1):
print(len(t))
else:
print(2*n)
|
p03208 | s627049151 | Wrong Answer | import sys
import numpy as np
input = sys.stdin.readline
def readstr():
return input().strip()
def readint():
return int(input())
def readnums():
return map(int, input().split())
def readstrs():
return input().split()
def main():
N, K = readnums()
h = np.sort(np.array([readint() for _ ... |
p02994 | s876593595 | Accepted | N, L = map(int, input().split())
taste_list = list(range(L, N + L, 1))
print(sum(taste_list) - min(taste_list, key=lambda x: -x if x < 0 else x))
|
p03494 | s521570989 | Accepted | n = int(input())
A = list(map(int, input().split()))
cont = 0
cont_list =[]
for a in A:
if a % 2 != 0:
cont_list.append(cont)
break
else:
while a % 2==0:
a //= 2
cont += 1
cont_list.append(cont)
cont=0
print(min(cont_list)) |
p03137 | s150177173 | Accepted | N, M = map(int, input().split())
X = list(map(int, input().split()))
Y = []
X.sort()
for i in range(1, M):
Y.append(X[i] - X[i-1])
Y.sort()
if N >= M:
print(0)
else:
print(sum(Y[:M-N])) |
p02933 | s775760707 | Accepted | #!/usr/bin/env python
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor
def main():
#N, M = map(int, input().split())
#N, K = map(int, input().split())
a = int(input())
s = inpu... |
p02879 | s120542020 | Accepted | a,b = map(int,input().split())
print(a*b if a<=9 and b<=9 else -1) |
p03324 | s838369408 | Wrong Answer | d,n = map(int,input().split())
print(n*100**d) |
p03711 | s112729142 | Accepted | G1 = [1,3,5,7,8,10,12]
G2 = [4,6,9,11]
x,y = map(int, input().split())
if x in G1 and y in G1:
print('Yes')
elif x in G2 and y in G2:
print('Yes')
else:
print('No') |
p03012 | s870346703 | Accepted | N = int(input())
W = list(map(int,input().split()))
ans = float("inf")
for T in range(N):
ans = min(ans, abs(sum(W[:T]) - sum(W[T:])))
print(ans) |
p02779 | s576499348 | Accepted | N = int(input())
L_a = [int(s) for s in input().rstrip().split(' ')]
l_a = set(L_a)
if len(l_a) == len(L_a):
print("YES")
else:
print("NO") |
p03485 | s376077662 | Wrong Answer | a, b = (int(x) for x in input().split())
x = (a+b) / 2
if (a+b) % 2 == 0:
print(x)
else:
print(x + 0.5) |
p03434 | s142490537 | Accepted | n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
if n%2 == 1:
a.append(0)
n += 1
ans = 0
for i in range(n//2):
ans += a[2*i]
ans -= a[2*i+1]
print(ans) |
p02971 | s566595843 | Accepted | import math
import collections
def main():
n = int(input())
s = []
dd = collections.defaultdict(int)
for i in range(n):
a = int(input())
dd[a]+=1
s.append(a)
k = max(dd.keys())
lis = sorted(list(dd.keys()),reverse = True)
for i in range(n):
if(s[i]==k and dd... |
p02899 | s773093115 | Accepted | n = int(input())
a=list(map(int,input().split()))
ans = [-1]*n
for i,b in enumerate(a):
ans[b-1]=i+1
print(*ans) |
p03555 | s088839525 | Accepted | a=input()
b=input()
if(a[2]==b[0] and a[1]==b[1] and a[0]==b[2]):
print('YES')
else:
print('NO') |
p02660 | s077303397 | Wrong Answer | from math import sqrt
def eratosthenes(x):
prime = []
for i in range(2, int(sqrt(x)) + 1):
if x % i == 0:
prime.append(i)
while x % i == 0:
x //= i
return prime
N = int(input())
prime = eratosthenes(N)
ans = 0
for x in prime:
i = 1
while N % x... |
p03071 | s497100364 | Wrong Answer | A,B = map(int,input().split())
print(max(2*A-1, A+B, 2*B+1)) |
p03328 | s765187086 | Wrong Answer | a,b = map(int,input().split())
l = [i*(i+1)//2 for i in range(1,101)]
ans = 0
for i in range(100):
a += 1
b += 1
ans += 1
if a in l and b in l:
print(ans)
break
|
p02595 | s734389518 | Wrong Answer | A,B = map(int,input().split())
t=0
for i in range(A):
X,Y = map(int,input().split())
if (X^2+Y^2)>=B^2:
t=t+1
else:
t=t
print(t) |
p03998 | s105406128 | Accepted | S={suit:list(input()) for suit in 'abc'}
s='a'
while S[s]:s=S[s].pop(0)
print(s.upper()) |
p02848 | s024925669 | Accepted | N = int(input())
S = input()
for i in range(len(S)):
print(chr(ord("A") + (ord(S[i]) - ord("A") + N) % 26), end="")
|
p02645 | s968654051 | Accepted | S = input()
print(S[:3]) |
p03672 | s473198220 | Accepted | S=input()
N=len(S)
ans=""
for i in range(2,N,2):
T=S[:i]
T1=T[:i//2]
T2=T[i//2:]
if T1==T2:
ans=T
print(len(ans)) |
p02743 | s792493581 | Accepted | import math
s = input().split()
a = int(s[0])
b = int(s[1])
c = int(s[2])
if a + b >= c :
print('No')
else:
if 4*a*b < ( c - a - b ) ** 2 :
print('Yes')
else:
print('No')
|
p02772 | s458574372 | Accepted | N = int(input())
A = list(map(int,input().split()))
for a in A:
if a%2 == 0:
if a%3 != 0 and a%5 != 0:
print("DENIED")
exit()
print("APPROVED")
|
p02645 | s001243843 | Accepted | S=str(input())
n=[]
for i in range(3):
n.append(S[i])
print(''.join(n)) |
p02583 | s188279283 | Accepted | from itertools import combinations
def main():
_ = int(input())
A = list(map(int, input().split()))
if len(set(A)) < 3:
print(0)
return
C = combinations(A, 3)
ans = 0
for c in C:
c = sorted(c)
if c[0] != c[1] and c[0] != c[1] and c[1] != c[2]:
if c[2]... |
p02917 | s818324449 | Accepted | n = int(input())
li = list(map(int,input().split()))
ans_li=[10 ** 5 + 1] * n
ans_li[0] = li[0]
for i in range(len(li)-1):
ans_li[i] = min(li[i], ans_li[i])
ans_li[i+1] = min(li[i], li[i+1])
ans_li[-1] = li[-1]
print(sum(ans_li)) |
p03611 | s706120096 | Accepted | n = int(input())
a = list(map(int,input().strip().split()))
import collections
c = collections.Counter(a)
_max = 0
for i in range(max(a)+1):
_sum = c[i-1] + c[i] + c[i+1]
if _max < _sum:
_max = _sum
print(_max) |
p02689 | s071546805 | Accepted | n,m=map(int,input().split())
h=list(map(int,input().split()))
flag=[1]*n
for i in range(m):
a,b = map(int,input().split())
a-=1
b-=1
if h[a] == h[b]:
flag[a] =0
flag[b] =0
elif h[a] > h[b]:
flag[b] = 0
else:
flag[a] = 0
print(sum(flag)) |
p03796 | s029154790 | Wrong Answer | import functools
import operator
import time
N = int(input())
start = time.time()
power_list = [x+1 for x in range(N)]
result = functools.reduce(operator.mul, power_list)
print(result % (10**9+7))
elapsed_time = time.time() - start
print(elapsed_time) |
p03206 | s600049573 | Accepted | import sys
ri = lambda: int(sys.stdin.readline())
s = ri()
print(['Christmas Eve Eve Eve', 'Christmas Eve Eve', 'Christmas Eve', 'Christmas'][s-22])
|
p02622 | s695659266 | Wrong Answer | S= list(map(str, input().split()))
T= list(map(str, input().split()))
STand = set(S) & set(T)
STlist = list(STand )
print(len(STlist)) |
p02627 | s136431312 | Wrong Answer | N=input()
if N.isupper()=="TRUE":
print("A")
else:
print("a") |
p03286 | s525543100 | Wrong Answer | n=int(input())
ans=''
while n:
ans+=str(n%2)
n-=n%2
n//=-2
print([''.join(ans[::-1]),0][n==0]) |
p02786 | s203789535 | Wrong Answer | H=int(input())
ans=1
num=1
while H>0:
ans+=num
num*=2
H//=2
print(ans) |
p02753 | s265428434 | Accepted | s = input()
if s == 'AAA' or s == 'BBB':
print('No')
else:
print('Yes')
|
p03109 | s273096834 | Accepted | S0,S1,S2=input().split("/")
if int(S1)<5:
print("Heisei")
else:
print("TBD")
|
p03339 | s433504089 | Accepted | N = int(input())
S = input()
Wlist = [0]*(N+1)
Elist = [0]*(N+1)
for i in range(1,N+1):
if S[i-1] == 'W':
Wlist[i] = Wlist[i-1] + 1
else:
Wlist[i] = Wlist[i-1]
if S[i-1] == 'E':
Elist[i] = Elist[i-1] + 1
else:
Elist[i] = Elist[i-1]
ans = []
for i in range(1... |
p02629 | s124108392 | Accepted | n = int(input())
ans = ''
l = []
while n>0:
w = chr(96+n%26)
if not n%26:
w = 'z'
n-=26
l.append(w)
n = int(n//26)
l.reverse()
ans = ''.join(l)
print(ans) |
p03705 | s004172845 | Accepted |
import sys
# sys.setrecursionlimit(100000)
def input():
return sys.stdin.readline().strip()
def input_int():
return int(input())
def input_int_list():
return [int(i) for i in input().split()]
def main():
n, a, b = input_int_list()
if b < a or (n == 1 and a != b):
print(0)
sy... |
p02713 | s244327654 | Accepted | import math
K = int(input())
ans = 0
for i in range(1, K+1):
for j in range(1, K+1):
tmp = math.gcd(i, j)
for k in range(1, K+1):
ans += math.gcd(tmp, k)
print(ans)
|
p02784 | s212837088 | Wrong Answer | H,N=map(int,input().split())
As=[int(i) for i in input().split()]
if sum(As)>H:
print("Yes")
else:
print("No") |
p02684 | s822278949 | Accepted | n,k = map(int, input().split())
l = [0]+list(map(int, input().split()))
journey = [1]
for i in range(2*n):
next = l[journey[-1]]
journey.append(next)
if k <= n+1:
print(journey[k])
exit()
end = n
start = n-1
while journey[start] != journey[end]:
start -= 1
period = end - start
k %= period
whil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.