Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03439 (python)

Fixed submission:
N = int(input())

# 最初の符号
print(0, flush=True)
first = input()

if first == 'Vacant':
    exit()

if first == 'Male':
    first = 1
else:
    first = -1

notHas = 1
has = N - 1

while has - notHas > 1:
    mid = (notHas + has) // 2
    print(mid, flush=True)
    ret = input()

    if ret == 'Vacant':
        exit()

    if ret == 'Male':
        ret = 1
    else:
        ret = -1

    trueValue = first * (-1)**(mid % 2)
    if ret == trueValue:
        notHas = mid
    else:
        has = mid

print(notHas, flush=True)
ret = input()

if ret == 'Vacant':
    exit()

print(has, flush=True)
input()
exit()

Buggy submission (verdict: Runtime Error):
N = int(input())

# 最初の符号
print(0, flush=True)
first = input()

if first == 'Vacant':
    exit()

if first == 'Male':
    first = 1
else:
    first = -1

notHas = 1
has = N - 1

while has - notHas > 1:
    print('--{} , {}--'.format(notHas, has))
    mid = (notHas + has) // 2
    print(mid, flush=True)
    ret = input()

    if ret == 'Vacant':
        exit()

    if ret == 'Male':
        ret = 1
    else:
        ret = -1

    trueValue = first * (-1)**(mid % 2)
    if ret == trueValue:
        notHas = mid
    else:
        has = mid

print(notHas, flush=True)
ret = input()

if ret == 'Vacant':
    exit()

print(has, flush=True)
input()
exit()

Buggy submission (verdict: Runtime Error):
N = int(input())

# 最初の符号
print(0, flush=True)
first = input()

if first == 'Vacant':
    exit()

if first == 'Male':
    first = 1
else:
    first = -1

notHas = 1
has = N - 1

while has - notHas > 1:
    print('--{} , {}--'.format(notHas, has))
    mid = (notHas + has) // 2
    print(mid, flush=True)
    ret = input()

    if ret == 'Vacant':
        exit()

    if ret == 'Male':
        ret = 1
    else:
        ret = -1

    trueValue = first * (-1)**(mid % 2)
    if ret == trueValue:
        notHas = mid
    else:
        has = mid

print(notHas, flush=True)
ret = input()

if ret == 'Vacant':
    exit()

print(has, flush=True)
exit()
Problem p03488 (python)

Fixed submission:
S = input()
X, Y = map(int, input().split())

A = [0]
for s in S:
    if s == 'T':
        A.append(0)
    else:
        A[-1] += 1

B = [n for n in A[1:: 2]]
X -= A[0]
A = [n for n in A[2:: 2]]

def canGo(nums, g):
    if not nums:
        return g == 0

    bias = sum(nums) + 10
    g += bias
    if g < 0:
        return False

    dp = (1 << bias)

    for n in nums:
        dp = (dp << n) | (dp >> n)
    return (dp & (1 << g)) > 0

if canGo(A, X) and canGo(B, Y):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = input()
X, Y = map(int, input().split())

A = [0]
for s in S:
    if s == 'T':
        A.append(0)
    else:
        A[-1] += 1

B = [n for n in A[1:: 2]]
X -= A[0]
A = [n for n in A[2:: 2]]

def canGo(nums, g):
    if not nums:
        return g == 0

    bias = sum(nums) + 10
    g += bias
    dp = (1 << bias)

    for n in nums:
        dp = (dp << n) | (dp >> n)
    return (dp & (1 << g)) > 0

if canGo(A, X) and canGo(B, Y):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = input()
X, Y = map(int, input().split())

A = [0]
for s in S:
    if s == 'T':
        A.append(0)
    else:
        A[-1] += 1

B = [n for n in A[1:: 2]]
X -= A[0]
A = [n for n in A[2:: 2]]

def canGo(nums, g):
    if not nums:
        return g == 0

    bias = sum(nums)
    g += bias
    dp = (1 << bias)

    for n in nums:
        dp = (dp << n) | (dp >> n)
    return (dp & (1 << g)) > 0

if canGo(A, X) and canGo(B, Y):
    print('Yes')
else:
    print('No')
Problem p03612 (python)

Fixed submission:
N = int(input())
P = list(map(lambda a: int(a) - 1, input().split()))

ans = 0
for i in range(N):
    p = P[i]
    if p == i:
        if i < N - 1:
            P[i], P[i + 1] = P[i + 1], P[i]
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = list(map(int, input().split()))

ans = 0
for i in range(N):
    if P[i] == i + 1:
        P[i], P[i + 1] = P[i + 1], P[i]
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
P = list(map(lambda a: int(a) - 1, input().split()))

ans = 0
for i in range(N):
    p = P[i]
    if p == i and i < N:
        P[i], P[i + 1] = P[i + 1], P[i]
        ans += 1

print(ans)
Problem p03688 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

minColor = min(A)
maxColor = max(A)

if minColor == maxColor:
    if minColor == N - 1:  # 各色の猫が1匹ずつ
        print('Yes')
    elif minColor * 2 <= N:  # 各色の猫が2匹以上
        print('Yes')
    else:
        print('No')
    exit()

if minColor + 1 != maxColor:
    print('No')
    exit()

minCnt = 0
maxCnt = 0

for a in A:
    if a == minColor:
        minCnt += 1
    elif a == maxColor:
        maxCnt += 1
    else:
        print('No')
        exit()

# minCnt : 1匹だけの色
# maxCnt : 2匹以上の色
# 全体でmaxColor個の色

if (maxColor - minCnt) * 2 <= maxCnt and maxColor >= minCnt + 1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
from collections import Counter

N = int(input())
A = Counter(map(int, input().split()))

if len(A.keys()) >= 3:
    print('No')
    exit()

if len(A.keys()) == 1:
    p = list(A.keys())[0]
    print('Yes' if 2 * p <= N or p == N - 1 else 'No')
    exit()

p1, p2 = sorted(A.keys())
1 / 0
print('Yes' if [p1, p2] == [1, 2] and A[1] == 1 else 'No')

Buggy submission (verdict: Runtime Error):
from collections import Counter

N = int(input())
A = Counter(map(int, input().split()))

if len(A.keys()) >= 3:
    print('No')
    exit()

if len(A.keys()) == 1:
    print('Yes' if list(A.keys())[0] == N - 1 or list(A.keys())[0] == 2 else 'No')
    exit()

p1, p2 = A.keys()
1 / 0
print('Yes' if abs(p1 - p2) == 1 and max(p1, p2) <= N - 1 and A[min(p1, p2)] == 1 else 'No')
Problem p03696 (python)

Fixed submission:
N = int(input())
S = input()

l = S.count('(')
r = S.count(')')
d = r - l

if d > 0:
    S = '(' * d + S
if d < 0:
    S = S + ')' * (-d)

l, r, d = 0, 0, 0
for s in S:
    if s == '(':
        l += 1
    if s == ')':
        r += 1
    d = max(d, r - l)

if d > 0:
    S = '(' * d + S + ')' * d

print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())

ans = []
while S and S[-1] == '(':
    ans.append(')')
    S.pop()
ans = '(' * len(ans) + ''.join(ans)

cnt = 0
for s in S[::-1]:
    if s == ')':
        cnt += 1
    else:
        cnt -= 1

if cnt > 0:
    ans = '(' * cnt + ''.join(S) + ans
if cnt < 0:
    ans = S + ''.join(S) + ')' * cnt + ans

print(ans)
Problem p03739 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

pos = 0
left = A[0]
if left <= 0:
    pos += 1 - left
    left = 1
for a in A[1:]:
    if left * (left + a) < 0:
        left += a
    else:
        if left + a == 0:
            if left < 0:
                left += a + 1
            else:
                left += a - 1
            pos += 1
        else:
            pos += abs(left + a) + 1
            if left < 0:
                left = 1
            else:
                left = -1

neg = 0
left = A[0]
if left >= 0:
    neg += left + 1
    left = -1
for a in A[1:]:
    if left * (left + a) < 0:
        left += a
    else:
        if left + a == 0:
            if left < 0:
                left += a + 1
            else:
                left += a - 1
            neg += 1
        else:
            neg += abs(left + a) + 1
            if left < 0:
                left = 1
            else:
                left = -1

print(min(neg, pos))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

def sol(S):
    ret = 0
    B = [S]
    for a in A[1:]:
        b = a
        if S * (S + b) > 0:
            b = (abs(S) + 1) * (1 if S < 0 else -1)
        if S + b == 0:
            b = b - 1 if b < 0 else b + 1
        ret += abs(b - a)
        S += b
        B.append(b)
    return ret

ans = min(
    sol(A[0]),
    sol(-A[0] // abs(A[0])) + abs(A[0]) + 1
)
print(ans)
Problem p03801 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

# 現在末尾に追加される山より若い山で，最も個数の大きいものが次の山になる
# 他の山を次の山の個数以下まで減らす

ans = [0] * N

numList = [(a, i) for i, a in enumerate(A)]
numList.sort(reverse=True)
numList.append((0, 0))

y = float('inf')
for c, (a, i) in enumerate(numList[: N], start=1):
    y = min(y, i)
    ans[y] += c * (a - numList[c][0])

print(*ans, sep='\n')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [(a, i) for i, a in enumerate(map(int, input().split()))]
A.sort(reverse=True)
A.append((0, 0))

ans = [0] * N
now = float('inf')

for j, (a, i) in enumerate(A[:N], start=1):
    now = min(now, a)
    ans[now] += j * (now - A[j][0])

print(*ans, sep='\n')
Problem p03866 (python)

Fixed submission:
sX, sY, eX, eY = map(int, input().split())
N = int(input())

circles = [(sX, sY, 0)]
for _ in range(N):
    cx, cy, r = map(int, input().split())
    circles.append((cx, cy, r))
circles.append((eX, eY, 0))

edges = [[float('inf')] * (N + 2) for _ in range(N + 2)]

for i, (cx1, cy1, r1) in enumerate(circles):
    for j, (cx2, cy2, r2) in enumerate(circles):
        cDist = ((cx1 - cx2)**2 + (cy1 - cy2)**2)**0.5
        dist = max(0, cDist - r1 - r2)

        edges[i][j] = dist
        edges[j][i] = dist

minDist = [float('inf')] * (N + 2)
minDist[0] = 0
confilm = [False] * (N + 2)

for _ in range(N + 2):
    md = float('inf')
    minNode = -1
    for n in range(N + 2):
        if not confilm[n] and md > minDist[n]:
            minNode = n
            md = minDist[n]
    confilm[minNode] = True
    for to in range(N + 2):
        minDist[to] = min(minDist[to], minDist[minNode] + edges[minNode][to])

print(minDist[-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy.sparse.csgraph import dijkstra, csgraph_from_dense

sX, sY, eX, eY = map(int, input().split())
N = int(input())

circles = [(sX, sY, 0)]
for _ in range(N):
    cx, cy, r = map(int, input().split())
    circles.append((cx, cy, r))
circles.append((eX, eY, 0))

minDist = [[float('inf')] * (N + 2) for _ in range(N + 2)]

for i, (cx1, cy1, r1) in enumerate(circles):
    for j, (cx2, cy2, r2) in enumerate(circles):
        cDist = ((cx1 - cx2)**2 + (cy1 - cy2)**2)**0.5
        dist = max(0, cDist - r1 - r2)

        minDist[i][j] = dist
        minDist[j][i] = dist

l = csgraph_from_dense(minDist, null_value=float('inf'))

ans = dijkstra(l, indices=0, directed=False)
print(ans[-1])
Problem p04014 (python)

Fixed submission:
def sol():
    N = int(input())
    S = int(input())

    if N == S:
        print(N + 1)
        return

    def digitSum(n, b):
        if b < 2:
            return -1
        if n < b:
            return n
        return digitSum(n // b, b) + n % b

    for b in range(2, int(N**0.5) + 1):
        if digitSum(N, b) == S:
            print(b)
            return

    for p in range(int(N**0.5), 0, -1):
        b = (N - S) // p + 1
        if digitSum(N, b) == S:
            print(b)
            return
    print('-1')

sol()

Buggy submission (verdict: Runtime Error):
def sol():
    N = int(input())
    S = int(input())

    if N == S:
        print(N + 1)
        return

    def digitSum(n, b):
        if b < 0:
            return -1
        if n < b:
            return n
        return digitSum(n // b, b) + n % b

    for b in range(2, int(N**0.5 + 10)):
        if digitSum(N, b) == S:
            print(b)
            return

    for p in range(1, int(N**0.5 + 10)):
        b = (N - S) // p + 1
        if digitSum(N, int(b)) == S:
            print(int(b))
            return
    print('-1')
sol()
Problem p04016 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)

N = int(input())
S = int(input())

if N == S:
    print(N + 1)
    exit()

def f(b, n):
    if n < b:
        return n
    return f(b, n // b) + n % b

ans = float('inf')

for b in range(1, int(N**0.5) + 100):
    if b > 1 and f(b, N) == S:
        ans = min(ans, b)

    q = S - b
    b = (N - q) // b
    if b > 1 and f(b, N) == S:
        ans = min(ans, b)

if ans == float('inf'):
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = int(input())

if N == S:
    print(N + 1)
    exit()

if S == 1:
    print(N)
    exit()

if S > N:
    print(-1)
    exit()

def f(b, n):
    if n < b:
        return n
    return f(b, n // b) + n % b

ans = float('inf')

for b in range(2, int(N**0.5) + 10):
    if f(b, N) == S:
        ans = min(ans, b)

    q = S - b
    b = (N - q) // b
    if f(b, N) == S:
        ans = min(ans, b)

if ans == float('inf'):
    print(-1)
else:
    print(ans)
Problem p03470 (python)

Fixed submission:
N=int(input())
d=[input() for i in range(N)]
print(len(set(d)))

Buggy submission (verdict: Runtime Error):
N=input()
d=[input() for i in range(N)]
print(len(set(d)))
Problem p03494 (python)

Fixed submission:
input()
A=list(map(int,input().split()))
cnt=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
input()
A=list(map(int,input().split()))
cnt=0
while all(a%2==0 for a in A):
  A=[a/2 for a in A]
  cnt++
print(cnt)
Problem p02603 (python)

Fixed submission:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
money = 1000
kabu = 0
for i in range(1,n):
    if A[i-1] < A[i]:
        kabu = money // A[i-1]
        money -= kabu * A[i-1]
        money += kabu * A[i]
        kabu = 0
    #print(money,kabu)
print(money)

Buggy submission (verdict: Runtime Error):
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
A = readInts()
lis = []
prv = -1
for i in range(n):
    if prv != A[i]:
        lis.append(A[i])
        prv = A[i]
#print(lis)
dp = [[[0] * ]
def dfs(money,kabu,now):
    global ans
    if now == len(lis):
        ans = max(money,ans)
        return;
    if kabu != 0:
        dfs(money + kabu*lis[now],0,now+1)
    if money//lis[now] >= 1:
        dfs(money - lis[now] * (money//lis[now]),money//lis[now],now+1)
    dfs(money,kabu,now+1)
ans = 1000
dfs(1000,0,0)
print(ans)
Problem p02608 (python)

Fixed submission:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
dp = [0] * (500000)
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            pe = x**2 + y**2 + z**2 + x*y + y*z + z*x
            dp[pe] += 1
print(*dp[1:n+1],sep='\n')

Buggy submission (verdict: Runtime Error):
n = I()
dp = [0] * (500000)
for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            pe = x**2 + y**2 + z**2 + x*y + y*z + z*x
            dp[pe] += 1
print(*dp[1:n+1],sep='\n')
Problem p02747 (python)

Fixed submission:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from itertools import combinations # (string,3) 3回
#from collections import deque
#import collections.defaultdict(list)
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    s = input()
    for i in range(0,len(s),2):
        #print(s[i:i+2])
        if s[i:i+2] == 'hi':
            pass
        else:
            print('No')
            exit()
    print('Yes')
if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
s = input()
for i in range(len(n)):
  if 'hi' in s[i:i+2]:
    pass
  else:
    print('No')
    exit()
print('Yes')
Problem p02756 (python)

Fixed submission:
from collections import deque
d = deque([])
ans = input()
d.append(ans)
q = int(input())
rev = True # Trueなら後ろに # Falseなら前に
for i in range(q):
    Query = list(map(str,input().split()))
    if Query[0] == '2':
        if Query[1] == '1':
            if rev:
                d.append(Query[2])
            else:
                d.appendleft(Query[2])
        elif Query[1] == '2':
            if rev:
                d.appendleft(Query[2])
            else:
                d.append(Query[2])
    else:
        rev = rev^True
output = ""
while d:
    output += d.pop()
if rev:
    print(output)
else:
    print(output[::-1])

Buggy submission (verdict: Runtime Error):
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
s = input()
q = I()
straight = True
ans = deque(s)
for i in range(q):
    A = input().split()
    if A[0] == '1':
        straight = not straight
    else:
        if straight:
            if A[1] == '1':
                ans.append(A[2])
            else:
                ans.appendleft(A[2])
        else:
            if A[1] == '1':
                ans.appendleft(A[2])
            else:
                ans.append(A[2])
if straight:
    print(*ans,sep='')
else:
    print(*an[::-1],sep='')
Problem p02813 (python)

Fixed submission:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list
#from itertools import combinations # (string,3) 3回
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    import itertools
    n = int(input())
    # indexの中身 を 使うときは, list じゃなくて、 tuple じゃないとだめええ
    p = tuple(map(int,input().split()))
    q = tuple(map(int,input().split()))
    # 初期リスト
    num = [i + 1 for i in range(n)]
    per = list(itertools.permutations(num))
    # permutations 全て tuple だから 合わせろ!
    print(abs(per.index(q) - per.index(p)))



if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
n = I()
lis = list(range(1,n+1))
a,b = None,None
P = readInts()
Q = readInts()
i = 0
for A in permutations(lis,n):
    if list(A) == P:
        a = i
    elif list(A) == Q:
        b = i
    i += 1
print(abs(a-b))
Problem p02843 (python)

Fixed submission:
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    X = int(input())
    # O(1)解法
    quo = X//100
    mo_ = X % 100
    # 0 <= Xを100で割った余り <= 5 * Xを100で割った時の商 (最大で、5 * 商まで表せれるから)
    if 0 <= mo_ <= 5*quo:
        print(1)
    else:
        print(0)

    # 
if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations # (string,3) 3回
from collections import deque
from collections import defaultdict
import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
MENU = [100,101,102,103,104,105]
ok = False

X = int(input())
def readInts():
  return list(map(int,input().split()))
def dfs(Price):
    global X
    global ok
    if Price >= X:
        if Price == X:
            ok = True
            return
        else:
            return
    if not ok:
        for v in MENU:
            Price += v
            if Price > X:
                Price -= v
                continue
            dfs(Price)
            Price -= v
def main():
    dfs(0)
    print(1 if ok else 0)
if __name__ == '__main__':
  main()