Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    h,w,k=map(int,input().split())
    S=[input() for _ in range(h)]
    final_ans=10**10
    for row_lis in range(1<<(h-1)):
        lst=[0]*h
        q,ans=0,0
        for r in range(h-1):
            if (row_lis>>r)&1==0:
                lst[r+1]=q
            else:
                q+=1
                lst[r+1]=q
                ans+=1
        data=[0]*h
        for j in range(w):
            for i in range(h):
                data[lst[i]]+=int(S[i][j])
                if data[lst[i]]>k:
                    ans+=1
                    break
            else:
                continue
            data=[0]*h
            for i in range(h):
                data[lst[i]]+=int(S[i][j])
                if data[lst[i]]>k:
                    break
            else:
                continue
            break
        else:
            final_ans=min(final_ans,ans)
    print(final_ans)


if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A,B=[0]*n,[0]*n
    for i in range(n):
        A[i],B[i]=map(int,input().split())
    A.sort()
    B.sort()
    if n%2==1:
        print(B[n//2]-A[n//2]+1)
    else:
        print(int(((B[n//2-1]+B[n//2])/2-(A[n//2-1]+A[n//2])/2)*2)+1)

if __name__=='__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    T = input()
    len_t = len(T)
    S = ""
    for t in T:
        if t == "?":
            S += "D"
        else:
            S += t
    print(S)


if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    T = input()
    len_t = len(T)
    S = ""
    for t in T:
        if t == "?":
            S += "D"
        else:
            S += t
    print(S)


if __name__=='__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().rstrip()
def count2019(str, l, k): 
    count = 0
    for i in range(l): 
        n = 0
        for j in range(i, l, 1): 
            n = n * 10 + (ord(str[j]) - ord('0')) 
            if (n % k == 0): 
                count += 1
    return count 
def main():
    s=input()
    print(count2019(s,len(s),2019))


if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
	s=input()
	len_s=len(s)
	T=[0]*(len_s+1)
	T[-1],T[-2]=0,int(s[-1])
	mod=2019
	for i in range(len_s-2,-1,-1):
		T[i]=(T[i+1]+int(s[i])*pow(10,len_s-i-1,mod))%mod
	tc=list(Counter(T).values())
	ans=0
	for tcc in tc:
		ans+=tcc*(tcc-1)//2
	print(ans)

if __name__=='__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().rstrip()
def count2019(str, l, k): 
    count = 0
    for i in range(l): 
        n = 0
        for j in range(i, l, 1): 
            n = n * 10 + (ord(str[j]) - ord('0')) 
            if (n % k == 0): 
                count += 1
    return count 
def main():
    s=input()
    print(count2019(s,len(s),2019))


if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
	s=input()
	len_s=len(s)
	T=[0]*(len_s+1)
	T[-1],T[-2]=0,int(s[-1])
	mod=2019
	for i in range(len_s-2,-1,-1):
		T[i]=(T[i+1]+int(s[i])*pow(10,len_s-i-1,mod))%mod
	tc=list(Counter(T).values())
	ans=0
	for tcc in tc:
		ans+=tcc*(tcc-1)//2
	print(ans)

if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def main():
    r=int(input())
    print(2*np.pi*r)

if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def main():
    r=int(input())
    print(2*np.pi*r)

if __name__=='__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    s=input()
    R=[]
    G=[]
    B=[]
    for i in range(1,n+1):
        if s[i-1]=='R':R.append(i)
        elif s[i-1]=='G':G.append(i)
        else:B.append(i)
    sum=0
    for r in R:
        for g in G:
            for b in B:
                n_list=[r,g,b]
                n_list.sort()
                if n_list[1]-n_list[0]!=n_list[2]-n_list[1]:
                    sum+=1
    print(sum)

if __name__=='__main__':
    main()

Fixed submission:
import sys
from collections import Counter
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    s=input()
    c_s=Counter(s)
    sum_a=0
    for diff in range(1,(n-1)//2+1):
        for i in range(n-2*diff):
            if s[i]!=s[i+diff] and s[i+diff]!=s[i+2*diff] and s[i]!=s[i+2*diff]:
                sum_a+=1
    print(c_s['R']*c_s['G']*c_s['B']-sum_a)

if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n,m=map(int,input().split())
if n>=2 and m>=2:print(cmb(n,2)+cmb(m,2))
elif n>=2:print(cmb(m,2))
elif m>=2:print(cmb(n,2))
else:print(0)

Fixed submission:
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n,m=map(int,input().split())
if n>=2 and m>=2:print(cmb(n,2)+cmb(m,2))
elif n>=2:print(cmb(n,2))
elif m>=2:print(cmb(m,2))
else:print(0)

Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n,m=map(int,input().split())
if n>=2 and m>=2:print(cmb(n,2)+cmb(m,2))
elif n=>2:print(cmb(m,2))
elif m>=2:print(cmb(n,2))
else:print(0)

Fixed submission:
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n,m=map(int,input().split())
if n>=2 and m>=2:print(cmb(n,2)+cmb(m,2))
elif n>=2:print(cmb(n,2))
elif m>=2:print(cmb(m,2))
else:print(0)

Buggy python submission (verdict: Runtime Error):
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n,m=map(int,input().split())
if n>=2 and m>=2:print(cmb(n,2)+cmb(m,2))
elif n==1 and m==1:print(0)
elif m==1:print(cmb(n,2))
else:print(cmb(m,2))

Fixed submission:
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

n,m=map(int,input().split())
if n>=2 and m>=2:print(cmb(n,2)+cmb(m,2))
elif n>=2:print(cmb(n,2))
elif m>=2:print(cmb(m,2))
else:print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter,defaultdict
from operator import mul
from functools import reduce
def cmb1(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def main():
    n=int(input())
    A=[int(_) for _ in input().split()]
    A_c=Counter(A)
    m=defaultdict(int)
    A_c_items=A_c.items()
    for i,a_c in enumerate(A_c_items):#選ぶ数字
        for j,a_c2 in enumerate(A_c_items):
            sum=0
            if i!=j and a_c2[1]>=2:
                sum+=cmb1(a_c2[1],2)
            elif i==j and a_c2[1]>=3:
                sum+=cmb1(a_c2[1]-1,2)
            m[a_c[0]]+=sum
    for i in range(n):
        print(m[A[i]])


if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter,defaultdict
from operator import mul
from functools import reduce
def cmb1(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def main():
    n=int(input())
    A=[int(_) for _ in input().split()]
    A_c=Counter(A)

    combi=0
    for ac in A_c.items():
        if ac[1]>=2:
            combi+=cmb1(ac[1],2)
    for i in range(n):
        print(combi-(A_c[A[i]]-1))

if __name__=='__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter,defaultdict
from operator import mul
from functools import reduce
def cmb1(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def main():
    n=int(input())
    A=[int(_) for _ in input().split()]
    A_c=Counter(A)
    m=defaultdict(int)
    A_c_items=A_c.items()
    for i,a_c in enumerate(A_c_items):#選ぶ数字
        for j,a_c2 in enumerate(A_c_items):
            sum=0
            if i!=j and a_c2[1]>=2:
                sum+=cmb1(a_c2[1],2)
            elif i==j and a_c2[1]>=3:
                sum+=cmb1(a_c2[1]-1,2)
            m[a_c[0]]+=sum
    for i in range(n):
        print(m[A[i]])


if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter,defaultdict
from operator import mul
from functools import reduce
def cmb1(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def main():
    n=int(input())
    A=[int(_) for _ in input().split()]
    A_c=Counter(A)

    combi=0
    for ac in A_c.items():
        if ac[1]>=2:
            combi+=cmb1(ac[1],2)
    for i in range(n):
        print(combi-(A_c[A[i]]-1))

if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    a,b,c=map(int,input().split())
    if c-a-b>0 and (c-a-b)**2>4*a*b:
        print("Yes")
    else:print("No")

if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    k=int(input())
    lis=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    print(lis[k-1])
if __name__=='__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    q=int(input())
    inv=False
    for i in range(q):
        que=input()
        if que[0]=="1":
            inv=not(inv)
        else:
            f=int(que[2])
            if (f==1 and not(inv)) or (f==2 and inv):
                s=que[4]+s
            else:
                s+=que[4]
    if inv:
        print(s[::-1])
    else:
        print(s)



if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import deque
def main():
    s=input()
    q=int(input())
    s=deque(s)
    inv=False
    for i in range(q):
        que=input()
        if que[0]=='1':
            inv=not(inv)
        else:
            f=que[2]
            if (f=='1' and not(inv)) or (f=='2' and inv):
                s.appendleft(que[4])
            else:
                s.append(que[4])
    if inv:s.reverse()
    print(*s,sep='')

if __name__=='__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    q=int(input())
    inv=False
    for i in range(q):
        que=input()
        if que[0]=="1":
            inv=not(inv)
        else:
            f=int(que[2])
            if (f==1 and not(inv)) or (f==2 and inv):
                s=que[4]+s
            else:
                s+=que[4]
    if inv:
        print(s[::-1])
    else:
        print(s)



if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import deque
def main():
    s=input()
    q=int(input())
    s=deque(s)
    inv=False
    for i in range(q):
        que=input()
        if que[0]=='1':
            inv=not(inv)
        else:
            f=que[2]
            if (f=='1' and not(inv)) or (f=='2' and inv):
                s.appendleft(que[4])
            else:
                s.append(que[4])
    if inv:s.reverse()
    print(*s,sep='')

if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
A=[[int(_) for _ in input().split()] for i in range(3)]
flag=[[0]*3 for i in range(3)]
n=int(input())
for k in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j]==b:
                flag[i][j]=1
import numpy as np
if (3 in np.sum(flag,axis=0)) or (3 in np.sum(flag,axis=1)) or (((flag[0][0]==flag[1][1] and flag[1][1]==flag[2][2]) or (flag[0][2]==flag[1][1] and flag[1][1]==flag[2][0])) and flag[1][1]==1):
    print("Yes")
else:
    print("No")

Fixed submission:
A=[[int(_) for _ in input().split()] for i in range(3)]
flag=[[0]*3 for i in range(3)]
n=int(input())
for k in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if A[i][j]==b:
                flag[i][j]=1
import numpy as np
if (3 in np.sum(flag,axis=0)) or (3 in np.sum(flag,axis=1)) or (((flag[0][0]==flag[1][1] and flag[1][1]==flag[2][2]) or (flag[0][2]==flag[1][1] and flag[1][1]==flag[2][0])) and flag[1][1]==1):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().rstrip()
from itertools import accumulate
import numpy as np
def main():
    n,k=map(int,input().split())
    P=[int(_) for _ in input().split()]
    P_num=np.array(P)
    PP=(P_num+1)/2
    PP_cum=np.cumsum(PP)
    ans=PP_cum[k:]-PP_cum[:n-k]
    print(max(max(ans),PP_cum[k-1]))

if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
from itertools import accumulate
def main():
    n,k=map(int,input().split())
    P=[int(_) for _ in input().split()]
    PP=[0]*n
    for i in range(n):
        PP[i]=(P[i]+1)/2
    PP_ac=list(accumulate(PP))
    ans=PP_ac[k-1]
    for i in range(1,n-k+1):
        ans=max(ans,PP_ac[i+k-1]-PP_ac[i-1])
    print(ans)

if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
import math
def input(): return sys.stdin.readline().rstrip()
def main():
    h=int(input())
    print(2**(int(math.log2(h))+1)-1)

if __name__=='__main__':
    main()

Fixed submission:
import sys
import math
def input(): return sys.stdin.readline().rstrip()
def main():
    h=int(input())
    print(2**(int(math.log2(h))+1)-1)

if __name__=='__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    P=[int(_) for _ in input().split()]
    count=0
    for i in range(n):
        if min(P[:i+1])==P[i]:count+=1
    print(count)

if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    P=[int(_) for _ in input().split()]
    count=0
    min_p=10**6
    for i in range(n):
        if min_p>P[i]:
            count+=1
            min_p=P[i]
    print(count)

if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def main():
    n,k,s=map(int,input().split())
    ans=np.array([0]*n)
    ans[:k]+=s
    if s!=10**9:
        ans[k:]+=10**9
    else:
        ans[k:]+=10**9-1
    print(*ans)

if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def main():
    n,k,s=map(int,input().split())
    ans=np.array([0]*n)
    ans[:k]+=s
    if s!=10**9:
        ans[k:]+=10**9
    else:
        ans[k:]+=10**9-1
    print(*ans)

if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
h,a=map(int,input().split())
print(-(-h//a))

Fixed submission:
print(chr(ord(input())+1))
Buggy python submission (verdict: Runtime Error):
import sys
from itertools import permutations
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    P=tuple(map(int,input().split()))
    Q=tuple(map(int,input().split()))
    p_list=list(permutations(range(1,n+1)))
    print(abs(p_list.index(Q)-p_list.index(P)))

if __name__=='__main__':
    main()

Fixed submission:
k,x=map(int,input().split())
if 500*k>=x:print("Yes")
else:print("No")
Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,k=map(int,input().split())
    r,s,p=map(int,input().split())
    T=input()
    T_lis=[False]*n
    ans=0
    for i,t in enumerate(T):
        if i-k>=0:
            if T[i-k]==t and T_lis[i-k]:
                continue
        if t=='r':
            ans+=p
        elif t=='s':
            ans+=r
        else:
            ans+=s
        T_lis[i]=True
    print(ans)


if __name__=='__main__':
    main()

Fixed submission:
s,t=input().split()
print(t+s)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    C1=[0]*60
    for a in A:
        ax=a
        for i in range(60):
            if ax&1:C1[i]+=1
            ax>>=1
            if ax==0:break
    ans=0
    for i,c in enumerate(C1):
        ans+=c*(n-c)*2**i%mod
    print(ans%mod)

if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    max_n=len(format(max(A),'b'))
    C=[[0,0] for _ in range(max_n)]
    for a in A:
        ax=a
        for i in range(max_n):
            C[i][ax%2]+=1
            ax=ax//2
    ans=0
    for i,c in enumerate(C):
        ans+=c[0]*c[1]*2**i%mod
    print(ans%mod)

if __name__=='__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    max_n=len(format(max(A),'b'))
    C=[[0,0] for _ in range(max_n)]
    for a in A:
        ax=a
        for i in range(max_n):
            C[i][ax%2]+=1
            ax=ax//2
    ans=0
    for i,c in enumerate(C):
        ans+=c[0]*c[1]*2**i%mod
    print(ans%mod)

if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=list(map(int,input().split()))
    mod=10**9+7
    max_n=len(format(max(A),'b'))
    C=[[0,0] for _ in range(max_n)]
    for a in A:
        ax=a
        for i in range(max_n):
            C[i][ax%2]+=1
            ax=ax//2
    ans=0
    for i,c in enumerate(C):
        ans+=c[0]*c[1]*2**i%mod
    print(ans%mod)

if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    s=input()
    n=s[0]
    if int(s)<100:print(0)
    if int(s[1:3])<=int(n)*5:print(1)
    else:print(0)

if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    for i in range(1001):
        if 100*i<=n and n<=105*i:
            print(1)
            break
    else:print(0)


if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n=int(input())
    A=list(map(int,input().split()))
    cunt=[0]*n
    cunt[0]=3
    ans=1
    mod=10**9+7
    for a in A:
        ans=ans*cunt[a]%mod
        if ans==0:break
        cunt[a+1]+=1
        cunt[a]-=1
    print(ans)
    

if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
    n=int(input())
    A=list(map(int,input().split()))
    rgb=[-1,-1,-1]
    ans=1
    mod=10**9+7
    for a in A:
        ans=ans*Counter(rgb)[a-1]%mod
        if ans==0:break
        rgb[rgb.index(a-1)]+=1
    print(ans)
    

if __name__=='__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
    n=int(input())
    A=list(map(int,input().split()))
    rgb=[-1,-1,-1]
    ans=1
    mod=10**9+7
    for a in A:
        ans=ans*Counter(rgb)[a-1]%mod
        rgb[rgb.index(a-1)]+=1
    print(ans)
    

if __name__=='__main__':
    main()

Fixed submission:
import sys
def input(): return sys.stdin.readline().rstrip()
from collections import Counter
def main():
    n=int(input())
    A=list(map(int,input().split()))
    rgb=[-1,-1,-1]
    ans=1
    mod=10**9+7
    for a in A:
        ans=ans*Counter(rgb)[a-1]%mod
        if ans==0:break
        rgb[rgb.index(a-1)]+=1
    print(ans)
    

if __name__=='__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    a,b,x=map(int,input().split())
    if a+b>x:
        print(0)
        sys.exit()
    for i in range(9,0,-1):#d(N)
        if x-b*i<a*10**(i-1):
            continue
        print(min(10**9,(x-b*i)//a))
        sys.exit()

if __name__=='__main__':
    main()

Fixed submission:
s=["SUN","MON","TUE","WED","THU","FRI","SAT"]
print(7-int(s.index(input())))