problem_id
stringclasses
428 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
5
816
p03951
s045313719
Wrong Answer
n = int(input()) s = list(reversed(input())) t = list(input()) for idx, (ss, tt) in enumerate(zip(s,t)): if ss != tt: break if list(reversed(s)) == t: print(len(s)) else: print(n + n - idx)
p03161
s578769868
Wrong Answer
N,K = map(int, input().split()) H = list(map(int, input().split())) dp_list = [10**4+1]*len(H) dp_list[0]=0 ## DP for h in range(1,len(H)): ## 各位置ごとに計算していく loop_cnt = min(K,h) ## 前の石にどれくらい戻れるか、の計算 cost = dp_list[h] for m in range(1,loop_cnt+1): cost_tmp = abs(H[h]-H[h-m])+dp_list[h-m] cost = min(cost,cost_tmp) dp_list[h] = cost ans = dp_list[-1] print(ans)
p02699
s790160372
Wrong Answer
#!python3 iim = lambda: map(int, input().rstrip().split()) def resolve(): S, W = iim() print("safe" if S >2*W else "unsafe") if __name__ == "__main__": resolve()
p02660
s352057201
Accepted
N = int(input()) n, p, score = N, 2, 0 while p ** 2 <= N and n > 1: e = 1 while n % (p ** e) == 0: n //= (p ** e) score += 1 e += 1 else: while n % p == 0: n //= p p += 2 - (p == 2) else: score += n > 1 print(score)
p02777
s640229743
Accepted
s,t=input().split() a,b=input().split() aa=int(a) bb=int(b) u=input() if u==s: aa=aa-1 elif u==t: bb=bb-1 print(aa,"",bb)
p02972
s685771209
Wrong Answer
import collections import heapq n = int(raw_input()) ais = [0] + map(int, raw_input().split(' ')) res = [0] * (n +1) for u in range(n, 0, -1): c = u *2 cumul = 0 while(c <= n): cumul += res[c] c += u if ais[u] == 1: if cumul % 2 == 0: res[u] = 1 elif ais[u] == 0: if cumul % 2 == 1: res[u] = 1 cc = collections.Counter(res) print cc[1] print ''.join([str(i) for i in range(len(res)) if res[i]])
p02888
s077052041
Accepted
from collections import deque from bisect import bisect_left n = int(input()) l = sorted(map(int, input().split())) ld = deque(l) cnt = 0 for a in range(n - 2): l_a = ld.popleft() for b in range(a + 1, n - 1): cnt += bisect_left(l, l_a + l[b]) - b - 1 print(cnt)
p02547
s032099533
Accepted
N = int(input()) flag = 0 ans = "No" for i in range(N): A,B = input().split() if A == B: flag += 1 else: flag = 0 if flag == 3: ans = "Yes" break print(ans)
p02547
s785936661
Wrong Answer
def main(): n = int(input()) count = 0 answer = 'No' for i in range(n): d = list(map(int, input().split())) if d[0] == d[1]: count += 1 if count >= 3: answer = 'Yes' print(answer) if __name__ == '__main__': main()
p02624
s457277167
Accepted
n = int(input()) ans = 0 for i in range(1,n+1): ans += (n//i)*(n//i+1)//2*i print(ans)
p03457
s929905113
Accepted
N = int(input()) current = (0, 0, 0) for i in range(N): ct, cx, cy = map(int, current) t, x, y = map(int, input().split()) v = abs(x-cx) + abs(y-cy) if abs(t-ct) < v: print("No") exit() if abs(t-ct) % 2 != v % 2: print("No") exit() print("Yes")
p02697
s807093020
Wrong Answer
def LI():return list(map(int,input().split())) # toriaezudasudakedasu n,m=LI() for i in range(1,m+1): a=i b=(a+m+(i-1)) while b>n: b-=m print(a,b)
p02711
s273308558
Accepted
S = input() s = set(S) if "7" in s: print("Yes") else: print("No")
p02957
s948365215
Accepted
a = list(map(int, input().split())) b = abs(a[0] - a[1]) if b % 2 == 0: print(max(a[0], a[1]) - b // 2) else: print("IMPOSSIBLE")
p03679
s931557496
Accepted
X, A, B = map(int, input().split()) if B - A <= 0: print('delicious') elif B - A <= X: print('safe') else: print('dangerous')
p03407
s952652584
Accepted
A, B, C = map(int, input().split()) if A + B >= C: print('Yes') else: print('No')
p02612
s008832679
Wrong Answer
price = int(input()) amari = price % 1000 print(amari)
p02711
s578837394
Accepted
if '7' in input(): print("Yes") else: print("No")
p03241
s946882234
Accepted
N ,M = map(int,input().split()) L = [] ans = 0 for i in range(1,int(M**(1/2)+1)): if M % i == 0: if i >= N: ans = max(ans,M//i) if M // i >= N: ans = max(ans,i) print(ans)
p02594
s221369021
Accepted
a=int(input()) if a>=30: print("Yes") else: print("No")
p02731
s404072471
Accepted
n=int(input()) print((n/3)*(n/3)*(n/3))
p03221
s307220144
Accepted
import bisect as bis n, m = map(int, input().split()) p, y = [], [] idx = lambda x: x-1 for _ in range(m): p_, y_ = map(int, input().split()) p.append(p_) y.append(y_) val = [[] for _ in range(n)] for i in range(m): val[idx(p[i])].append(y[i]) for i in range(n): val[i].sort() for i in range(m): v = p[i] id = bis.bisect_right(val[idx(v)], y[i]) print(str(v).zfill(6) + str(id).zfill(6))
p02623
s044904212
Wrong Answer
N, M, K = map(int, input().split()) pa = abs(N-M) + 1 A = list(map(int, input().split()))+ [1000000010] B = list(map(int, input().split()))+ [1000000010] if N < M: A = A + [1000000010]*(pa) elif N > M: B = B + [1000000010]*(pa) c = 0 while K >= A[0] or K >= B[0]: if A[0] < B[0]: K -= A.pop(0) else: K -= B.pop(0) c += 1 print(c)
p04019
s622308172
Accepted
s = list(input()) s = set(s) if len(s) % 2 == 0 and (("S" in s and "N" in s) or ("E" in s and "W" in s)): print("Yes") else: print("No")
p02767
s801724957
Accepted
N=int(input()) *X,=map(int,input().split()) ans=10**9 i=1 while i<=100: j=0 count=0 while j<N: count+=(i-X[j])**2 j+=1 ans=min(ans,count) i+=1 print(ans)
p03219
s569721025
Accepted
X,Y=map(int,input().split()) print(X+Y//2)
p02553
s677371369
Wrong Answer
a, b, c, d = map(int, input().split()) if b <= 0 and d <= 0: print(c * a) elif b > 0 and d > 0: print(b * d) elif b < 0 and d > 0: if c > 0: print(c * a) else: print(b * c) elif b > 0 and d < 0: if a > 0: print(a * c) else: print(a * d)
p02847
s740977313
Accepted
import sys def input(): return sys.stdin.readline().rstrip('\n') DAYS = { 'SUN':7, 'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'SAT':1, } S = input() #A,B = list(map(int,input().split())) print(DAYS[S])
p03827
s414643023
Accepted
n = int(input()) s = input() x = 0 res = 0 for op in list(s): if op=="I": x += 1 else: x -= 1 res = max(res, x) print(res)
p03095
s145453504
Accepted
import bisect import copy import heapq import math import sys from collections import * from functools import lru_cache from itertools import accumulate, combinations, permutations, product def input(): return sys.stdin.readline()[:-1] def ruiseki(lst): return [0]+list(accumulate(lst)) sys.setrecursionlimit(5000000) mod=pow(10,9)+7 al=[chr(ord('a') + i) for i in range(26)] direction=[[1,0],[0,1],[-1,0],[0,-1]] n=int(input()) s=input() cnt=Counter(s) ans=1 for i in al: ans*=cnt[i]+1 ans%=mod ans-=1 print(ans%mod)
p02731
s037364487
Accepted
l = float(input()) x = l/3 print(x**3)
p03127
s777967007
Accepted
from math import gcd N = int(input()) A = list(map(int,input().split())) ans = A[0] for e in A: ans = gcd(e,ans) print(ans)
p03639
s493144622
Accepted
import sys n = int(input()) s = [int(i)%4 for i in sys.stdin.read().split()] s0 = s.count(0) s2 = s.count(2) if n - s0 - s2 <= s0 + (s2 == 0): print("Yes") else: print("No")
p03284
s457911936
Accepted
def solve(): n, k = map(int, input().split()) if n % k == 0: print(0) else: print(1) if __name__ == "__main__": solve()
p03456
s147962383
Wrong Answer
import math a,b = input().split() s =int(a+b) if float(int(math.sqrt(s))) == int(math.sqrt(s)): print("Yes") else: print("No")
p03011
s863244467
Accepted
ps = list(map(int, input().split())) print(sum(ps) - max(ps))
p03360
s611813920
Accepted
a, b, c = map(int, input().split()) k = int(input().strip()) m = max(a, b, c) tmp = m for i in range(k): m *= 2 print(sum((m, a, b, c)) - tmp)
p02989
s698917480
Accepted
N = int(input()) d = list(map(int,input().split())) sd = sorted(d) #Kとしてあり得る値は sd[N // 2 - 1] + 1 から d[N // 2] までの合計 d[N // 2] - d[N // 2 - 1] 個 print(sd[N//2]-sd[N//2-1])
p03087
s574770816
Accepted
N,Q=map(int,input().split()) S=input() l=0 r=0 l=[0]*Q r=[0]*Q s=[] s.append(0) for i in range(1,N): if(S[i-1]=='A' and S[i]=='C'): s.append(s[i-1]+1) else: s.append(s[i-1]) for i in range(Q): l[i],r[i]=map(int,input().split()) for i in range(Q): print(s[r[i]-1]-s[l[i]-1])
p02601
s981797984
Wrong Answer
a, b, c = map(int, input().split()) k = int(input()) for i in range(k): if a > b: b *= 2 elif b > c: c *= 2 print('Yes') if a < b < c else print('No')
p02948
s913135427
Accepted
import heapq from collections import defaultdict N,M = map(int,input().split()) AB = defaultdict(list) for i in range(N): a,b = list(map(int,input().split())) if a not in AB: AB[a] = [-b] else: AB[a] += [-b] work = 0 AB2 = [] heapq.heapify(AB2) for i in range(1,M+1): for j in AB[i]: heapq.heappush(AB2,j) if not AB2: continue b = heapq.heappop(AB2) work += -b print(work)
p02817
s359048767
Wrong Answer
s, t = input().split() print(s+t)
p02766
s193527275
Wrong Answer
from sys import stdin import math n, k = [int(x) for x in stdin.readline().rstrip().split()] cnt = 1 if n <= k: print(cnt) exit kk = k while n >= kk: kk = kk * k cnt += 1 print(cnt)
p03617
s622158677
Accepted
def main(): Q, H, S, D = (int(i) for i in input().split()) N = int(input()) one = min(4*Q, 2*H, S) two = min(2*one, D) ans = 0 if N & 1: ans += one N -= 1 ans += two * (N // 2) print(ans) if __name__ == '__main__': main()
p03862
s231936061
Wrong Answer
N, x = map(int, input().split()) a = list(map(int, input().split())) cnt = 0 for i in range(1, N): eat = max(a[i - 1] + a[i] - x, 0) cnt += eat a[i] -= eat print(cnt)
p02829
s707894643
Wrong Answer
import math import time from collections import deque from copy import deepcopy t = time.time() def iip(): ret = [int(i) for i in input().split()] if len(ret) == 1: return ret[0] return ret def main(): n = iip() if n == 0: print(0) exit() if n % 2 == 1: print(0) exit() ret = 0 n = n / 2 for i in range(1, 1145141919810): ret += int(n/(5**i)) if 5**i > n: break print(ret) main()
p03105
s408876254
Accepted
a=list(map(int,input().split())) if a[1]//a[0]<a[2]: print(a[1]//a[0]) else:print(a[2])
p03075
s679760386
Accepted
a = [int(input())for i in range(5)] k = int(input()) print( "Yay!" if max(a)-min(a) <= k else ":(" )
p03493
s351101373
Accepted
print(input().count("1"))
p02848
s488102983
Accepted
n=int(input()) s=list(input()) ans=[] for i in range(len(s)): a=int(((ord(s[i])+n)%65)%26) ans.append(chr(a+65)) print(''.join(ans))
p02971
s040225044
Accepted
N = int(input()) A = [int(input()) for i in range(N)] maxA = max(A) copy_A = A[:] copy_A.remove(maxA) secondA = max(copy_A) for x in A: if x == maxA: print(secondA) else: print(maxA)
p02708
s402170899
Wrong Answer
import math import itertools N, K = map(int, input().strip().split()) L = math.pow(10, 10) values = [0] * (N + 1) for i in range(N + 1): values[i] = i amount = 0 for comb_no in range(K, N + 2): possible_values = set() for combination in itertools.combinations(values, comb_no): possible_values.add(sum(combination)) print(len(possible_values))
p02597
s056831671
Accepted
def main(): n = int(input()) c = input() r = 0 for i in range(n): if c[i]=='R': r += 1 ans = 0 for i in range(r): if c[i]=='W': ans += 1 print(ans) if __name__ == "__main__": main()
p02765
s764355641
Accepted
n, r = map(int, input().split()) print( r+100*max(0, 10-n) )
p02801
s836243558
Accepted
ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz' input_str = input() next_idx = ascii_lowercase.index(input_str)+1 print(ascii_lowercase[next_idx])
p02792
s973285673
Wrong Answer
N = int(input()) dp = [[0]*10 for _ in range(10)] for i in range(1, N+1): if i%10==0: continue strI = str(i) if len(strI) > 1: f,l = strI[-1], strI[0] dp[int(f)][int(l)] += 1 else: dp[i][i] += 1 res = 0 for i in range(1,10): for j in range(1,10): if i==j or dp[i][j]>1: res += dp[i][j] * dp[j][i] print(res)
p03637
s179297749
Wrong Answer
n = int(input()) A=list(map(int, input().split())) ans="No" c2=c4=0 for a in A: if a%4==0: c4+=1 elif a%2==0: c2+=1 if c2==1: c2=0 if (n-c2)//2<=c4 : ans="Yes" else: ans="No" print( ans )
p03211
s878266229
Accepted
s = input() ans = 1000 for i in range(len(s) - 2): t = int(s[i: i + 3]) ans = min(abs(753 - t), ans) print(ans)
p02957
s190865952
Accepted
a,b=map(int, input().split()) if (a+b)%2==1: print('IMPOSSIBLE') else: print((a+b)//2)
p02628
s399191025
Wrong Answer
a = input().split() b = input().split() b.sort() sum = 0 for i in range(int(a[1])): sum += int(b[i]) print(sum)
p02779
s737070621
Wrong Answer
N = int(input()) A = sorted(list(map(int, input().split()))) B =list(set(A)) print('YES' if A == B else 'NO')
p03286
s746728282
Wrong Answer
N = int(input()) tmp = [] if(N == 0): print('0') else: N = N // 2 while(abs(N)>1): tmp.append(N%2) N = N // 2 tmp.append(1) tmp.reverse() print(''.join([str(n) for n in tmp]))
p02731
s370583300
Wrong Answer
N=int(input()) print((N**3)//27)
p03745
s650528083
Wrong Answer
n = int(input()) a = list(map(int, input().split())) ans = 1 judge = 0 for i in range(n-1): if a[i] == a[i+1]: break elif a[i] < a[i+1]: if judge == -1: ans += 1 else: judge = 1 elif a[i] > a[i+1]: if judge == 1: ans += 1 else: judge = 1 print(ans)
p02718
s912821052
Accepted
n,m = map(int,input().split()) nlist = list(map(int,input().split())) ans = 0 for i in range(n): if nlist[i] >= sum(nlist)/(4*m): ans += 1 if ans >= m: print('Yes') else: print('No')
p02641
s598788500
Accepted
num = list(map(int, input().split())) if num[1] != 0: arr = list(map(int, input().split())) arr.sort() l_num = arr[0] l_diff = 10000 for i in range(arr[0]-1, arr[-1]+2): if abs(num[0]-i) < l_diff and i not in arr: #print(i, num[0], l_num, abs(i-num[0])) l_num = i l_diff = abs(num[0]-i) print(l_num) else: print(num[0])
p02641
s863831685
Wrong Answer
tmp = list(map(int, input().split())) x = tmp[0] n = tmp[1] if n == 0: print(x) exit() p = list(map(int, input().split())) i = 1 while True: if not x-i in p: print(x-i) break if not x+i in p: print(x+i) break i += 1
p04005
s474003603
Accepted
a,b,c=sorted(list(map(int,input().split()))) if a*b*c%2==0:print(0) else:print(a*b)
p03493
s720575689
Accepted
s = list(input()) print(s.count("1"))
p02612
s631713562
Wrong Answer
print(int(int(input()) % 1000))
p02743
s889076458
Accepted
a, b, c = map(int, input().split()) l = 4 * a * b r = (c - a - b) ** 2 if c - a - b < 0 or l >= r: print("No") else: print("Yes")
p02899
s820642901
Wrong Answer
n = int(input()) a = list(map(int, input().split())) alist = [] for i in range(1, n+1): alist.append(a.index(i)+1) print(alist)
p02702
s191928189
Accepted
s = list(input()) # s = list(str(10**200000)) n = len(s) ans = 0 s.reverse() # print(s) x = 1 tot = 0 count = [0]*2019 for i in range(n): count[tot]+=1 tot += int(s[i])*x # print(tot) tot %= 2019 ans += count[tot] x = x*10%2019 print(ans)
p03331
s879145432
Accepted
n = int(input()) min = 100 a_sum = 0 b_sum = 0 for a in range(1, n): b = n-a while a >= 1: a_sum += a%10 a = a//10 while b >= 1: b_sum += b%10 b = b//10 if a_sum + b_sum < min: min = a_sum + b_sum a_sum = 0 b_sum = 0 print(min)
p03038
s741897772
Accepted
n,m=map(int,input().split()) a=sorted(list(map(int,input().split()))) b=[list(map(int,input().split())) for i in range(m)] b.sort(key=lambda x:x[1]) p=0 c=[] for i in b[::-1]: if p>n: break c+=[i[1]]*i[0] p+=i[0] n=min(len(c),n) c=c[:n] m=sum(a) x=m for i in range(n): m=m-a[i]+c[i] x=max(x,m) print(x)
p03038
s256740394
Accepted
n, m = map(int,input().split()) a = list(map(int,input().split())) bc = [list(map(int,input().split())) for i in range(m)] bc = sorted(bc, key = lambda x : x[1], reverse=True) sum_b = 0 for b, c in bc: sum_b += b a += [c] * b if n < sum_b: break a.sort(reverse=True) a = a[:n] print(sum(a))
p02859
s612317318
Accepted
r=int(input()) print(r**2)
p03037
s814607497
Accepted
N,M=map(int,input().split()) lmax,rmin=1,N for i in range(M): l,r=map(int,input().split()) if l > lmax:lmax=l if r < rmin:rmin=r print(max(rmin-lmax+1,0))
p02695
s697366406
Accepted
import itertools N,M,Q = map(int,input().split()) li = [] for i in range(Q): li.append(list(map(int,input().split()))) li.sort(key = lambda x:x[3]) num = [i for i in range(1,M+1)] l = list(itertools.combinations_with_replacement(num, N)) max_sum=-1 for i in range(len(l)): s = 0 for j in range(Q): if l[i][li[j][1]-1] - l[i][li[j][0]-1] == li[j][2]: s+= li[j][3] max_sum = max(max_sum,s) print(max_sum)
p03385
s952730777
Wrong Answer
s = input() if s[0] != s[1] != s[2]: print('Yes') else: print('No')
p02665
s019032548
Accepted
n=int(input()) ; n+=1 A=list(map(int,input().split())) if n==1: if A[0]==1: print(1);exit() print(-1);exit() if A[0]!=0:print(-1);exit() ANS=[0]*n ;ANS[0]=1 R=[0]*n for i in range(n-2,-1,-1): R[i]=R[i+1]+A[i+1] #print(R) for i in range(1,n): ANS[i]=min(ANS[i-1]*2-A[i], R[i]) if ANS[i]<0:print(-1);exit() print(sum(A)+sum(ANS))
p02784
s313776337
Wrong Answer
import math a,b=map(int,input().split()) array = map(int,input().split()) sum = 0 for skill in array: a -= skill if(a <= 0): print("yes") else: print("no")
p03767
s809370551
Accepted
N = int(input()) a = list(map(int,input().split())) A = sorted(a, reverse=True) B = [] ans = 0 B = A[:2*N] for i in range(int(len(B)/2)): ans += B[2*i+1] print(ans)
p02719
s894703653
Accepted
n,k = map(int,input().split()) if n % k ==0: print(0) else: l = [n] p = n//k c = n-(p*k) half = k//2 while c > half: c = abs(c-k) l.append(c) print(min(l))
p03471
s568245267
Accepted
n, y = map(int, input().split()) for i in range(n + 1): for j in range(n+1 - i): k = n - i - j if i *10000 + j * 5000 + k *1000 == y: print(i,j,k) exit() print('-1 -1 -1')
p03211
s784326248
Accepted
s = input() num = 1000 for i in range(len(s)-2): num = min(num, abs(753-int(s[i:i+3]))) print(num)
p03799
s977079613
Accepted
n,m=map(int,input().split()) if n<m/2:print(n+(m-n*2)//4) else:print(m//2)
p03796
s979764847
Accepted
a = int(input()) ans = 1 for i in range(1,a+1): ans = (ans*i)%1000000007 print(ans)
p02712
s321035932
Accepted
N = int(input()) ans = 0 for i in range(1, N + 1): if i % 3 != 0 and i % 5 != 0: ans += i print(ans)
p02818
s069922488
Wrong Answer
A, B, K = map(int,input().split()) a = 0 b = 0 if K <= A: a = A - K elif A < K <= A + B: a = 0 b = B + A - K print(str(a) + ' ' + str(b))
p02725
s126067899
Accepted
k,n = (int(x) for x in input().split()) list = [int(i) for i in input().split()] list.append(k+list[0]) long = 0 for i in range(n): long = max(long,list[i+1]-list[i]) print(k-long)
p02833
s368342930
Wrong Answer
N=int(input()) ans=0 if N%2==0: for i in range(1,19): ans+=N//(10**i) print(ans)
p03323
s236082762
Accepted
A,B=map(int,input().split()) print('Yay!' if A<=8 and B<=8 else ':(')
p03617
s450618538
Accepted
A = list(map(int, input().split())) N = int(input()) A[0]*=4 A[1]*=2 t1=10**10 for i in range(3): t1=min(t1,A[i]) A[0]*=2 A[1]*=2 A[2]*=2 t2=10**10 for i in range(4): t2=min(t2,A[i]) if(N%2==1): print(t2*(N//2)+t1) else: print(t2*(N//2))
p02802
s650258088
Wrong Answer
N,M = map(int,input().split()) P = [] S = [] total = [] for i in range(M): a,b = map(str,input().split()) P.append(a) S.append(b) ok = 0 pena = 0 for (i,j) in zip(P,S): if not i in total: if j=='WA': pena+=1 elif j=='AC': ok+=1 total.append(i) print(str(ok)+' '+str(pena))
p02731
s198654419
Accepted
L = int(input()) print(pow(L / 3, 3))
p02768
s208708471
Accepted
mod = 10**9+7 n, a, b = map(int, input().split()) ans = pow(2, n, mod) - 1 nCa = 1 for i in range(n-a+1, n+1): nCa *= i nCa %= mod for i in range(1, a+1): nCa *= pow(i, mod-2, mod) nCa %= mod nCb = 1 for i in range(n-b+1, n+1): nCb *= i nCb %= mod for i in range(1, b+1): nCb *= pow(i, mod-2, mod) nCb %= mod ans -= (nCa + nCb) ans %= mod print(ans)
p04005
s927319679
Accepted
A, B, C = map(int,input().split()) if A%2 == 0 or B%2 == 0 or C%2 == 0: print(0) exit() print(A*B*C//max(A,B,C))
p03998
s820033458
Accepted
dic_s = {x:input() for x in 'abc'} dic_i = {x:i for x,i in zip('abc',[0,0,0])} dic_max = {x:len(dic_s[x]) for x in 'abc'} nt = 'a' while True: if dic_max[nt] == dic_i[nt]: break else: dic_i[nt] += 1 nt = dic_s[nt][dic_i[nt]-1] print(nt.upper())
p03286
s050890022
Accepted
N=int(input()) ans='' if N==0: print('0') exit() while N!=0: Nmod=N%(-2) ans+=str(abs(Nmod)) if Nmod==-1: N=N//(-2)+1 else: N=N//(-2) print(''.join(list(reversed(ans))))