problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p02994
s539806225
Accepted
n,l = map(int,input().split()) aji_list = [] for i in range(n): aji_list.append(l+i) if l >= 0: print(sum(aji_list[1:])) else: if 0 in aji_list: print(sum(aji_list)) else: print(sum(aji_list[0:-1]))
p02772
s718965623
Accepted
N = int(input()) A = list(map(int, input().split())) flag = 1 for a in A: if a % 2 == 1: continue if a % 3 == 0 or a % 5 == 0: flag *= 1 else: flag *= 0 print('APPROVED' if flag==1 else 'DENIED')
p02627
s325994685
Accepted
input = raw_input a = input() if a == a.lower(): print("a") else: print("A")
p02631
s736658384
Wrong Answer
n,A,x=int(input()),map(int,input().split()),0 for i in A:x ^=i for i in A:print(x^i)
p03095
s165459818
Accepted
n=int(input()) s=input() s_set=set(list(s)) t=len(s_set) cnt=1 for s1 in s_set: cnt*=(1+s.count(s1)) print((cnt-1)%(10**9+7))
p03862
s847008072
Accepted
printn = lambda x: print(x,end='') inn = lambda : int(input()) inl = lambda: list(map(int, input().split())) inm = lambda: map(int, input().split()) ins = lambda : input().strip() DBG = True # and False BIG = 10**18 R = 10**9 + 7 def ddprint(x): if DBG: print(x) n,x = inm() a = inl() sm = 0 if a[0]>x: ...
p02918
s960679938
Accepted
import sys from itertools import groupby read = sys.stdin.read readline = sys.stdin.readline readlines = sys.stdin.readlines sys.setrecursionlimit(10 ** 9) INF = 1 << 60 MOD = 1000000007 def main(): N, K = map(int, readline().split()) S = readline().strip() ans = groups = 0 for k, g in groupby(S): ...
p03219
s411357533
Accepted
x, y = map(int, input().split()) print(int(x + y / 2))
p02912
s084973067
Wrong Answer
N, M= map(int, input().split()) A = list(map(int, input().split())) A.sort() l = -1 r = A[-1] + 1 while r - l > 1: m = (r + l) // 2 t = 0 mc = 0 a = 0 for i in range(N): s = A[i] while m < s: s //= 2 mc += 1 a += s if mc <= M: r = m ...
p03035
s924819021
Accepted
a, b = list(map(int, input().split())) if a <= 5: print(0) elif 6 <= a <= 12: print(b // 2) else: print(b)
p02952
s278397016
Wrong Answer
N = str(input()) count = 0 for i in range(1, len(N)): if i % 2 != 0: count += 9 * 10**(i-1) if len(N) != 1 and len(N) % 2 != 0: hasuu = int(N[1:len(N)]) + 1 elif len(N) % 2 != 0: hasuu = int(N) else: hasuu = 0 print(str(count + hasuu))
p03720
s653266295
Accepted
n, m = map(int, input().split()) ab = [] for _ in range(m): a,b = map(int, input().split()) ab.append(a) ab.append(b) for i in range(1,n+1): print(ab.count(i))
p03469
s761999192
Wrong Answer
s = input() a = s.replace(s[:9],"2018/01/") print(a)
p03042
s638328912
Accepted
S = input() l, r = map(int, [S[:-2], S[2:]]) if 0 < l < 13: if 0 < r < 13: print('AMBIGUOUS') exit() else: print('MMYY') else: if 0 < r < 13: print('YYMM') else: print('NA')
p02947
s741795126
Accepted
from collections import defaultdict dd = defaultdict(int) n = int(input()) ans = 0 for _ in range(n): m = list(input()) m.sort() tmp = "".join(m) ans += dd[tmp] dd[tmp] += 1 print(ans)
p02838
s529204281
Wrong Answer
n = int(input()) a = list(map(int,input().split())) for i in range(n): a[i] = list(format(a[i],'0b').zfill(60)) g = [0 for i in range(60)] for i in range(60): for j in range(n): if a[j][i] == '1': g[i] += 1 ans = 0 for i in range(len(g)): ans += g[i]*(n-g[i])*(pow(2,64-i,10**9+7)) print(...
p03705
s593440845
Accepted
N,A,B = map(int,input().split()) if B < A: print(0) exit() num = B-A+1 mi = A*(N-1) + B ma = B*(N-1) + A ans = ma - mi + 1 print(max(ans,0))
p02583
s703291346
Wrong Answer
N = int(input()) L = input().split() P = [] for i in range(N): P.append(int(L[i])) P = sorted(P) C = 0 for i in range(N-2): if P[-(i + 1)] <(P[-(i+2)] + P[-(i+3)]): C+= 1 print(C)
p03971
s932518580
Accepted
import math a,b,c = map(int,input().split()) s = input() g = 1 d = b+c k = 1 for i in range(a): if s[i]=='c': print("No") elif s[i] == 'a' and k<=d: print("Yes") k+=1 elif s[i] == 'b' and g<=c and k<=d: print("Yes") k+=1 g += 1 else: print("No")
p02777
s881836366
Accepted
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines sys.setrecursionlimit(500000) s, t = readline().decode('utf-8').split() a, b = map(int, readline().split()) u = read().decode('utf-8').rstrip() if u == s: a -= 1 else: b -= 1 print(a, b)
p03474
s717234461
Wrong Answer
A, B = map(int, (input().split())) S = input().split('-') ans = len(S) == 2 ans = False if not ans else A == len(S[0]) and B == len(S[1]) ans = False if not ans else A == len(str(int(S[0]))) and B == len(str(int(S[1]))) print('Yes' if ans else 'No')
p02783
s673588262
Wrong Answer
H,A = map(int,input().split()) """ count = 0 while H > 0: H -= A count +=1 print(count) """
p02607
s819302456
Wrong Answer
N = int(input()) a = [] a = input().split() count = 0 for i in range(int(N/2)): cd = 2 * i - 2 jd = int(a[cd]) if jd % 2 == 1: count += 1 print(count)
p02988
s222039870
Wrong Answer
n = int(input()) p = list(map(int,input().split())) count=0 if n == 3: if p[0] < p[1] < p[2] or p[2] < p[1] < p[0]: count+=1 else: for i in range(n-2): pp = p[0+i:3+i] if pp[0] < pp[1] < pp[2] or p[2] < p[1] < p[0]: count+=1 print(count)
p03387
s025770850
Accepted
abc = list(map(int, input().split())) abc.sort() c = abc[2] ab = abc[0] + abc[1] if ab % 2 == 0: print((c * 2 - ab) // 2) else: c += 1 ab += 1 print((c * 2 - ab) // 2 + 1)
p02665
s361093895
Accepted
import sys N = int(input()) A = list(map(int, input().split())) cusum = [0 for i in range(N+1)] cusum[N] = A[N] if N == 0 and A[0] > 1: print(-1) sys.exit() for i in range(N-1, -1, -1): cusum[i] = cusum[i+1] + A[i] # print(cusum) pre_node = 1 ans = 1 for i in range(1, N+1): node = (pre_node - A[i-1])...
p03795
s080620251
Accepted
n = int(input()) a = n // 15 print(n * 800 - 200 * a)
p02773
s836826328
Accepted
from collections import Counter n = int(input()) s = [] for _ in range(n): s.append(input()) s = Counter(s) words, counts = zip(*s.most_common()) selected = [] num = None for w, c in zip(words, counts): if num == None: num = c selected.append(w) else: if c == num: selecte...
p02771
s584322061
Accepted
a,b,c=map(int,input().split()) if a==b==c or (a!=b and b!=c and a!=c): print("No") else: print("Yes")
p02922
s638553870
Accepted
import sys A, B = map(int, input().split()) inf = 10**7 if (B == 1): print(0) sys.exit() for i in range(1, inf): if B <= ((A - 1) * (i - 1) + A): print(i) break
p02608
s534349414
Accepted
n=int(input()) N=10**4+1 lst=[0]*N s=0 for i in range(1,10**2+1): for j in range(1,10**2+1): for k in range(1,10**2+1): s=i**2+j**2+k**2+i*j+j*k+k*i if s<10**4+1: lst[s]+=1 for i in range(1,n+1): print(lst[i])
p03827
s216460240
Accepted
N = int(input()) S = input() ans = 0 cnt = 0 for i in range(N): if S[i] == "I": cnt += 1 elif S[i] == "D": cnt -= 1 ans = max(ans, cnt) print(ans)
p02720
s385017374
Accepted
from sys import stdin import sys import math from functools import reduce import functools import itertools from collections import deque,Counter from operator import mul import copy lun = [[str(i)] for i in range(10)] + [[]] olun =[[str(i)] for i in range(10)] + [[]] ans = [str(i) for i in range(1,10)] while True:...
p02630
s436275694
Wrong Answer
N = int(input()) An = list(map(int, input().split())) Q = int(input()) L = [0] * 100001 for item in An: L[item] += 1 sum = sum(An) for i in range(Q): b, c = map(int, input().split()) sum += (c-b) * L[b] print(sum)
p03998
s313056435
Accepted
s=[list(input()) for i in range(3)] k=0 while 1: if len(s[k])>0: t=s[k].pop(0) k=0 if t=='a' else 1 if t=='b' else 2 else: break print('ABC'[k])
p03486
s767519676
Accepted
s = input() s_asc = ''.join(sorted(s)) t = input() t_desc = ''.join(sorted(t, reverse=True)) if s_asc < t_desc: print('Yes') else: print('No')
p02814
s687702795
Wrong Answer
n,m=map(int,input().split()) a=map(int,input().split()) from fractions import gcd def lcm(a,b): return a*b//gcd(a,b) l=1 for i in a: l=l*i//2//gcd(l,i//2) if l>m: break ans=1 if l<=m else 0 m-=l print(ans+max(0,m//(2*l)))
p03041
s002441660
Wrong Answer
a,b=map(int,input().split()) s=input() s=s[b-1].lower() print(s)
p03986
s124995159
Accepted
# A - STring X = input() count = max_count = 0 ST = {'S':-1, 'T':1} for i in range(len(X)): count += ST[X[i]] if count > max_count: max_count = count print(2*max_count)
p02627
s259627933
Wrong Answer
p=input() if p.islower()==p: print('a') else: print('A')
p03910
s226883348
Wrong Answer
n=int(input()) for i in range(n): if i*(i+1)//2>=n:break ans=[] for j in range(i,0,-1): if j<=n: n-=j ans+=[j] print(*ans,sep='\n')
p02755
s214745254
Wrong Answer
import math a, b = map(int, input().split()) e=int(a / 0.08) for i in range(e, 101): if (b == math.floor(e * 0.1)): print(i) exit (0) print(-1)
p03761
s357970817
Accepted
n = int(input()) A = [0 for i in range(26)] s = input() for i in range(len(s)): A[ord(s[i]) - 97] += 1 for j in range(1, n): B = [0 for i in range(26)] s = input() for i in range(len(s)): B[ord(s[i]) - 97] += 1 for i in range(26): A[i] = min(A[i], B[i]) ans = "" for i in range(26): ans += chr(97+i) ...
p02924
s174419964
Accepted
n=int(input()) k=int(n*(n-1))//2 print(k)
p03835
s347402640
Accepted
k, s=map(int, input().split()) count=0 for x in range(k+1): for y in range(k+1): z=s-x-y if 0<=z<=k: count+=1 print(count)
p03095
s500752667
Wrong Answer
def resolve(): N = int(input()) S = list(input()) SS=set(S) cnt=1 for i in SS: cnt*=(S.count(i)+1) print(cnt-1) resolve()
p02612
s299657863
Accepted
n=int(input()) if n%1000==0: print(0) else: x=n//1000 y=x+1 y=y*1000 y=abs(n-y) print(y)
p02820
s099595635
Wrong Answer
args=input().split() N=int(args[0]) K=int(args[1]) args=input().split() R=int(args[0]) S=int(args[1]) P=int(args[2]) T=input() resSS=[] for i in T: if i=="r": resSS.append(P) elif i=="s": resSS.append(R) else: resSS.append(S) if N>=K: for i in range(N-K): if resSS[i+K]==resSS[i]: resSS[i...
p03345
s303818532
Accepted
a, b, c, k = map(int, input().split()) if k%2==0: if b-a < 10**18: print(a-b) else: print("Unfair") else: if a-b < 10**18: print(b-a) else: print("Unfair")
p02766
s964667954
Accepted
N, K = map(int,input().split()) qs = [] q,mod = divmod(N,K) qs.append(mod) while q != 0: q,mod = divmod(q,K) qs.append(mod) print(len(qs))
p03017
s041238388
Accepted
n, a, b, c, d = map(int, input().split()) a -= 1 b -= 1 c -= 1 d -= 1 s = input() def is_a(x, y): for i in range(x, y-1): if s[i]==s[i+1]=="#": return False return True def is_f(x, y): for i in range(x, y+1): if s[i-1]==s[i]==s[i+1]==".": return True return False ans = "No" if is_a(a, b) an...
p03013
s701313473
Accepted
n,m = map(int,input().split()) mod = 10**9+7 a = [int(input()) for _ in range(m)] s = [0]*(n+1) s[0],s[1]=1,1 for i in range(2,n+1): s[i] = (s[i-1]+s[i-2])%mod if m == 0: print(s[n]) quit() ans = s[a[0]-1] for i in range(1,m): if a[i]-a[i-1] == 1: print(0) quit() ans = (ans*s[a[i]-a[i-1]-2])%mod print...
p02720
s963666571
Accepted
from collections import deque k = int(input()) q = deque([1,2,3,4,5,6,7,8,9]) for i in range(k): x = q.popleft() y = x%10 if y != 0: q.append(10*x+y-1) q.append(10*x+y) if y != 9: q.append(10*x+y+1) print(x)
p02730
s224032873
Accepted
S = input() N = len(S) def isPalindrome(S, i, j): i = int(i) j = int(j) while S[i] == S[j]: i+=1 j-=1 if i >= j: return True return False if isPalindrome(S, 0, N-1) and isPalindrome(S, 0, (N-1)/2-1) and isPalindrome(S, (N+3)/2-1, N-1): print('Yes') else: pri...
p03449
s370911428
Accepted
N=int(input()) A=[list(map(int,input().split())) for _ in range(2)] sum1=[0] sum2=[0] for i in range(N): sum1.append(sum1[-1]+A[0][i]) sum2.append(sum2[-1]+A[1][i]) print(max(sum1[i]+sum2[N]-sum2[i-1] for i in range(1,N+1)))
p03254
s306932546
Wrong Answer
n,x=map(int,input().split()) a=sorted([int(i)for i in input().split()]) res=0 if sum(a)==x: res=n else: for i in range(n): if sum(a[:i])<=x:res=len(a[:i])-1 print(max(0,res))
p03852
s712183980
Accepted
c=input() if c in "aioue": print("vowel") else: print("consonant")
p03474
s894766499
Accepted
a,b = map(int,input().split()) s = input() if s.count('-') == 1 and s[a] =='-': print('Yes') else: print('No')
p03494
s984681157
Wrong Answer
import sys n = input() l = list(map(int, input().split())) loop = 0 while (1): for i in l: if (i % (2 ** loop) != 0): print(loop) sys.exit(0) loop = loop + 1
p03285
s403053441
Accepted
n = int(input()) if n in set([4*i+7*j for i in range(100//4+1) for j in range(100//7+1) if (4*i+7*j)<=100]): print('Yes') else: print('No')
p02897
s528154938
Accepted
from math import ceil n= int(input()) print(ceil(n/2)/n)
p02641
s546558743
Wrong Answer
x,n = map(int,input().split()) if n==0: exit(print(x)) p = list(map(int,input().split())) p.sort() if x not in p: exit(print(x)) h=1000 l=1000 for i in range(x,101): if i not in p: h = i break for i in range(x,0,-1): if i not in p: l = i break if abs(x-h)>=abs(x-l): print(l) if a...
p03161
s791809869
Wrong Answer
n, k = map(int, input().split()) h = list(map(int, input().split())) INF = 10 ** 7 D = [INF] * n D[0] = 0 for i in range(n): for j in range(1, k + 1): if i >= j: D[i] = min(D[i], D[i - j] + abs(h[i] - h[i - j])) print(D[-1])
p03971
s154265093
Accepted
p = 0 f = 0 n, a, b = map(int, input().split()) for i in input(): if i == "a" and p < a+b: p += 1 print("Yes") elif i == "b" and p < a+b and f < b: p += 1 f += 1 print("Yes") else: print("No")
p03013
s924835148
Wrong Answer
import numpy as np n,m=map(int, input().split()) a=set(int(input()) for i in range(m)) x=(10**9)+7 dp=np.array([0]*(n+1)) dp[0]=1 if 1 not in a: dp[1]=1 for i in range(2,n+1): if i in a: continue dp[i]+=dp[i-1]+dp[i-2] #print(dp) print(dp[-1]%x)
p03795
s146476428
Wrong Answer
N = int(input()) x = N * 800 y = N / 15 * 200 print(x - y)
p03951
s413937930
Accepted
N=int(input()) s=input() t=input() chohuku=0 for i in range(N): if s[i:]==t[:N-i]: chohuku=len(s[i:]) break print(N+N-chohuku)
p02641
s320963930
Wrong Answer
x,n=map(int,input().split()) p=[int(x) for x in input().split()] min=x gap=x for i in range(102): if i in p: continue else: if abs(x-i) < gap: gap=x-i min=i print(min)
p03971
s665564458
Accepted
n,a,b = map(int, input().split()) ab = a+b s = input() cap_a,cap_b = 0,0 for i in range(n): if s[i] == "a": if cap_a+cap_b < ab: print("Yes") if cap_a < a: cap_a += 1 else: cap_b += 1 else: print("No") elif s[i] == "b": if cap_a+cap_b < ab and cap_b < b: print("Yes") cap_b += 1 els...
p02594
s975213638
Accepted
n = int(input()) if n >= 30: print('Yes') else: print('No')
p03329
s913331378
Accepted
import sys from io import StringIO import unittest sys.setrecursionlimit(100**3) def rec(n, dp): if n <= 1: return n if dp[n] < float('inf'): return dp[n] pow6 = 6 pow9 = 9 dp[n] = min(n, dp[n]) while n >= pow6: dp[n] = min(dp[n], rec(n-pow6, dp) + 1) pow6 *= 6 while n >= pow9: dp[n] = min(dp[n], rec...
p03679
s087222252
Accepted
x, a, b = map(int, input().split()) if b<=a: print("delicious") elif b <= a+ x: print("safe") else: print("dangerous")
p03136
s487545546
Accepted
n = int(input()) L = list(map(int, input().split())) lm = max(L) if sum(L) - lm > lm: print("Yes") else: print("No")
p02640
s912467827
Accepted
x, y = map(int, input().split()) if y%2!=0 or y>4*x or y<2*x: print('No') else: print('Yes')
p02595
s129541033
Wrong Answer
n,d = map(int,input().split()) ans = 0 for _ in range(n) : x,y = map(int,input().split()) distance = (x**2 + y**2)**1/2 if distance <= d : ans += 1 print(ans)
p03095
s780240596
Wrong Answer
import sys from collections import Counter sys.setrecursionlimit(10 ** 7) f_inf = float('inf') mod = 10 ** 9 + 7 def resolve(): n = int(input()) s = input() res = 1 D = Counter(s) for v in D.values(): res *= (v + 1) print(res - 1) if __name__ == '__main__': resolve()
p02792
s314185092
Accepted
N = int(input()) cnt = [[0 for i in range(10)] for j in range(10)] for i in range(1, N+1): i_str = str(i) cnt[int(i_str[0])][int(i_str[-1])] += 1 ans = 0 for i in range(10): for j in range(10): ans += cnt[i][j] * cnt[j][i] print(ans)
p02600
s176789512
Accepted
import sys from math import ceil, floor, sqrt, sin, cos, pi from itertools import accumulate, permutations, combinations from fractions import gcd # 最大公約数 from collections import deque, Counter from operator import itemgetter from heapq import heappop,heappush sys.setrecursionlimit(10**7) def lcm(x, y): return ((x * y)...
p03328
s445582759
Wrong Answer
a, b = map(int, input().split()) X = b - a ans = 0 for i in range(X): ans += i print(ans)
p03986
s774028262
Accepted
X = input() stacks = [] for i in range(len(X)): if not stacks: stacks.append(X[i]) elif stacks[-1] == "S" and X[i] == "T": del stacks[-1] else: stacks.append(X[i]) print(len(stacks))
p03220
s091284847
Wrong Answer
N = int(input()) T, A = map(int, input().split()) H = list(map(int, input().split())) list = [] for i in H: list.append(T - (i * 0.006)) for i in range(len(list)): list[i] = A - list[i] print(list.index((min(list))) + 1)
p03077
s672877143
Accepted
import collections n = int(raw_input()) ais = map(int,[raw_input() for _ in range(5)]) m = min(ais) print (n + m -1) / m + 4
p03434
s569031277
Accepted
import numpy as np N = int(input()) a = np.array(list(map(int, input().split()))) a.sort() a = a[::-1] print(a[0::2].sum() - a[1::2].sum())
p03328
s849051529
Accepted
a, b = [int(x) for x in input().split()] n = b-a-1 An = n*(n+1)//2 print(An-a)
p02612
s739392293
Accepted
n = int(input()) i = 0 while 1: if i*1000 >= n: print(i*1000-n) break else: i += 1
p02664
s166788451
Accepted
t = input() s = "" for i in t: if i == "?": s+="D" else: s+=i print(s)
p03767
s239087848
Accepted
N=int(input()) A=list(map(int,input().split())) A.sort() print(sum(A[N::2]))
p02888
s131218071
Accepted
from bisect import bisect_left n=int(input()) L=sorted((map(int,input().split()))) t=0 for i in range(n-2): for j in range(i+1,n-1): l=j r=n while l+1<r: c=(l+r)//2 if L[i]+L[j]>L[c]: l=c else: r=c t+=l-j print(t)
p03327
s803955176
Wrong Answer
N = int(input()) if N < 1000: print('ABC'+str(N)) else: print('ABD'+str(N+1)[1:])
p03241
s284879828
Accepted
N, M = map(int, input().split()) def divisors(n): d = [] for i in range(1, int(n**0.5) + 1): if n % i == 0: d.append(i) if i != n // i: d.append(n // i) return d d = divisors(M) ans = 0 for i in d: if N * i <= M: ans = max(ans, i) print(ans)...
p02958
s318208681
Wrong Answer
n = int(input()) p = tuple(map(int, input().split())) cnt = 0 for i in range(1, n+1): if i != p[i-1]: cnt += 1 if cnt > 2: print("No") else: print("Yes")
p03486
s708911835
Accepted
s = "".join(sorted(input())) t = "".join(sorted(input())[::-1]) if s < t: print("Yes") else: print("No")
p02727
s935713348
Accepted
X, Y, A, B, C = map(int, input().split()) p = sorted(list(map(int, input().split())), reverse = True)[: X] q = sorted(list(map(int, input().split())), reverse = True)[: Y] r = list(map(int, input().split())) all_apple = sorted(p + q + r, reverse = True) print(sum(all_apple[: X + Y]))
p02602
s146125233
Accepted
n,k=map(int,input().split()) arr=list(map(int,input().split())) for i in range(k,n): if arr[i]>arr[i-k]: print('Yes') else: print('No')
p02847
s916016366
Accepted
def main(): days = {'SUN':7,'MON':6,'TUE':5,'WED':4,'THU':3,'FRI':2,'SAT':1} S = input() print(days[S]) return 0 if __name__ == '__main__': main()
p03161
s694403631
Wrong Answer
n, k = map(int, input().split()) h = list(map(int, input().split())) dp = [float("inf")]*n for i in range(1, n): for j in range(1, k+1): if i-j >= 0: dp[i] = min(dp[i], dp[i-j] + abs(h[i]-h[i-j])) print(dp[n-1])
p03127
s734222390
Wrong Answer
def gcd(a, b): while b: a, b = b, a % b return a N = int(input()) A = list(map(int, input().split())) A.sort() ans = 0 if A[0] == max(A): ans = A[0] else: a = A[0] b = 0 for i in range(1, N): if a != A[i]: b = A[i] break ans = gcd(a, b) print(ans...
p03037
s347052065
Wrong Answer
N,M = map(int, input().split()) l=0 r=N for _ in range(M): ll,rr=map(int,input().split()) l = max(l,ll) r = min(r,rr) print(rr-ll+1)
p02847
s057563568
Accepted
# encoding:utf-8 import copy import random import bisect #bisect_left これで二部探索の大小検索が行える import fractions #最小公倍数などはこっち import math import sys import collections mod = 10**9+7 sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000 d = collections.deque() def LI(): return list(map(int, sys.stdin.readline().split())) S = str(i...
p03910
s055963383
Accepted
import math n=int(input()) num=int(math.sqrt(n*2)) num2=(num*(num+1))//2 num3=n-num2 if num3>num: num+=1 num3-=num if num3<0: num-=1 num3+=num+1 ans=list(range(1,num+1)) for i in range(num3): ans[-i-1]+=1 for i in ans: print(i)