TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
#!/usr/bin/env python3

n=input()

n1,n2=int(n[:2]),int(n[2:])
if n1>12 and n2>12 or n1==0 or n2==0:
    print("Na")
elif n1<=12 and n2<=12:
    print("AMBIGUOUS")
elif n1!=0 or n1<=12:
    print("MMYY")
elif n2!=0 or n2<=12:
    print("YYMM")
else:
    print("errer")



n=input()

n1,n2=int(n[:2]),int(n[2:])
if n1>12 and n2>12 or n1==0 or n2==0:
    print("Na")
elif (n1!=0 and n1<=12) and (n2!=0 and n2<=12):
    print("AMBIGUOUS")
elif n1!=0 or n1<=12:
    print("MMYY")
elif n2!=0 or n2<=12:
    print("YYMM")
else:
    print("errer")




n1,n2=int(n[:2]),int(n[2:])
if (n1>12 and n2>12) or (n1==0 and n2==0):
    print("NA")
elif (n1!=0 and n1<=12) and (n2!=0 and n2<=12):
    print("AMBIGUOUS")
elif n1!=0 and n1<=12:
    print("MMYY")
elif n2!=0 and n2<=12:
    print("YYMM")
else:
    print("errer")



n=input()

n1,n2=int(n[:2]),int(n[2:])
#if (n1>12 and n2>12) or (n1==0 and n2==0):
#   print("NA")
if (n1!=0 and n1<=12) and (n2!=0 and n2<=12):
    print("AMBIGUOUS")
elif n1!=0 and n1<=12:
    print("MMYY")
elif n2!=0 and n2<=12:
    print("YYMM")
else:
    print("NA")





Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
S = input()

a = S[:2]
b = S[2:]

print(a,int(b))

if (int(a) > 12 and int(b) <= 12 and int(b) > 0):
  print('YYMM')
elif (int(b) > 12 and int(a) <= 12 and int(a) > 0):
  print('MMYY')
elif (int(a) <= 12 and int(a) > 0 and int(b) <= 12 and int(b) > 0):
  print('AMBIGUOUS')
else:
  print('NA')


S = input()
 
a = S[:2]
b = S[2:]
  
if (int(a) > 12 and int(b) <= 12 and int(b) > 0):
  print('YYMM')
elif (int(b) > 12 and int(a) <= 12 and int(a) > 0):
  print('MMYY')
elif (int(a) <= 12 and int(a) > 0 and int(b) <= 12 and int(b) > 0):
  print('AMBIGUOUS')
elif (int(a) == 0 and int(b) <= 12 and int(b) > 0):
  print('YYMM')
elif (int(b) == 0 and int(a) <= 12 and int(a) > 0):
  print('MMYY')  
else:
  print('NA')

Verdicts: Wrong Answer

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
S = input()

A = 10 * int(S[0]) + int(S[1])
B = 10 * int(S[2]) + int(S[3])

print(A)
print(B)

flag_YYMM = 0
flag_MMYY = 0

if 1 <= A and A <= 12 and 1 <= B : 
    flag_MMYY += 1
if 1 <= B and B <= 12 and 1 <= A : 
    flag_YYMM += 1
    
if flag_YYMM == 0 and flag_MMYY == 0 : 
    print("NA")
elif flag_YYMM == 0 and flag_MMYY == 1 : 
    print("MMYY")
elif flag_YYMM == 1 and flag_MMYY == 0 : 
    print("YYMM")
elif flag_YYMM == 1 and flag_MMYY == 1 : 
    print("AMBIGUOUS")

S = input()

A = 10 * int(S[0]) + int(S[1])
B = 10 * int(S[2]) + int(S[3])

# print(A)


flag_YYMM = 0
flag_MMYY = 0

if 1 <= A and A <= 12 : 
    flag_MMYY = 1
if 1 <= B and B <= 12 : 
    flag_YYMM = 1
    
if flag_YYMM == 0 and flag_MMYY == 0 : 
    print("NA")
elif flag_YYMM == 0 and flag_MMYY == 1 : 
    print("MMYY")
elif flag_YYMM == 1 and flag_MMYY == 0 : 
    print("YYMM")
elif flag_YYMM == 1 and flag_MMYY == 1 : 
    print("AMBIGUOUS")

Verdicts: Wrong Answer

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
s=int(input())
k=s%100
l=(s-k)/100
k=int(k)
l=int(l)
if k<=12 & k>=1:
    if l>=1 and l<=12:
        ans='ANBIGUOUS'
    else:
        ans='MMYY'
elif l>=1 and l<=12:
    ans='YYMM'
else:
    ans='NA'
print(ans)
    
        

s=int(input())
k=s%100
l=(s-k)/100
k=int(k)
l=int(l)
if k<=12 and k>=1:
    if l>=1 and l<=12:
        ans='AMBIGUOUS'
    else:
        ans='YYMM'
elif l>=1 and l<=12:
    ans='MMYY'
else:
    ans='NA'
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
S = input()

ans1 = 'YYMM'
ans2 = 'MMYY'
ans3 = 'AMBIGUOUS'
ans4 = 'NA'

s1 = int(S[:2])
s2 = int(S[2:])

print(s1, s2)

if 0 < s1 < 13 and 0 < s2 < 13:
  print(ans3) 
elif 0 < s1 < 13:
  print(ans2) 
elif 0 < s2 < 13:
  print(ans1) 
else:
  print(ans4)

S = input()

ans1 = 'YYMM'
ans2 = 'MMYY'
ans3 = 'AMBIGUOUS'
ans4 = 'NA'

s1 = int(S[:2])
s2 = int(S[2:])

print(s1, s2)

if 0 < s1 < 13 and 0 < s2 < 13:
  print(ans3) 
elif 0 < s1 < 13:
  print(ans2) 
elif 0 < s2 < 13:
  print(ans1) 
else:
  print(ans4)

S = input()

ans1 = 'YYMM'
ans2 = 'MMYY'
ans3 = 'AMBIGUOUS'
ans4 = 'NA'

s1 = int(S[:2])
s2 = int(S[2:])

if 0 < s1 < 13 and 0 < s2 < 13:
  print(ans3) 
elif 0 < s1 < 13:
  print(ans2) 
elif 0 < s2 < 13:
  print(ans1) 
else:
  print(ans4)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
s=input()
aa=int(s[:2])
bb=int(s[3:])
if aa>12 and bb==0 or aa==0 and bb>12: ans='NA'
elif 0<aa<=12 and 0<bb<=12: ans='AMBIGUOUS'
elif aa>12 or aa==0 and 0<bb<=12: ans='YYMM'
else :ans='MMYY'
print(ans)1

s=input()
aa=int(s[:2])
bb=int(s[2:])
if 0<aa<=12 and 0<bb<=12: ans='AMBIGUOUS'
elif 0<bb<=12: ans='YYMM'
elif 0<aa<=12: ans='MMYY'
else: ans='NA'
print(ans)

Verdicts: Runtime Error

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
try:
    s1=(input(''))
    if len(s1)>=4:
        raise ValueError
    
    check=list((s1))
    assert bool(int(check[0]+check[1])<=12) != bool(int(check[2]+check[3])<=12)
    if int(check[0]+check[1])<=12:
        print("MMYY")
    elif int(check[2]+check[3])<=12:
        print("YYMM")
except AssertionError:
    if int(check[0]+check[1])<=12 and int(check[2]+check[3])<=12:
        print("AMBIGUOUS")
    else:
        print("NA")



a=input()
 
b = int(a[:2])
c = int(a[2:])
 
if 0< b < 13:
    a_month_flag = 1
    
elif b == 0:
    a_month_flag = 0    
else:
    a_month_flag = 0
 
if 0< c < 13:
    b_month_flag = 1
    
elif c == 0:
    b_month_flag = 0
  
else:
    b_month_flag = 0
 
if a_month_flag ==1 and b_month_flag==1:
    print("AMBIGUOUS")
elif a_month_flag == 1 and b_month_flag == 0:
    print("MMYY")
elif a_month_flag == 0 and b_month_flag ==1:
    print("YYMM")
else:
    print("NA")

Verdicts: Runtime Error

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
# -*- coding: utf-8 -*-
S = list(input())
FF = ''
RR = ''
J = [0] * 2

for st in S[0],S[1]:
	FF += st

for st in S[1],S[3]:
	RR += st

if 1 <= int(FF) <= 12:
	J[0] = 1
else:
	J[0] = 0

if 1 <= int(RR) <= 12:
	J[1] = 1
else:
	J[1] = 0

if J[0] == 0 and J[1] == 0:
	print('NA')
elif J[0] == 0 and J[1] == 1:
	print('YYMM')
elif J[0] == 1 and J[1] == 0:
	print('MMYY')
else:
	print('AMBIGUOUS')

# -*- coding: utf-8 -*-
S = list(input())
FF = ''
RR = ''
J = [0] * 2

for st in S[0],S[1]:
	FF += st

for st in S[2],S[3]:
	RR += st

if 1 <= int(FF) <= 12:
	J[0] = 1
else:
	J[0] = 0

if 1 <= int(RR) <= 12:
	J[1] = 1
else:
	J[1] = 0

if J[0] == 0 and J[1] == 0:
	print('NA')
elif J[0] == 0 and J[1] == 1:
	print('YYMM')
elif J[0] == 1 and J[1] == 0:
	print('MMYY')
else:
	print('AMBIGUOUS')

Verdicts: Wrong Answer

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
s=list(map(int,input()))
a=10*s[0]+s[1]
b=10*s[2]+s[3]
if a<=12 and b<=12:
    print('AMBIGUOUS')
elif a+b==0:
    print('NA')
elif a>12 and b>12:
    print('NA')
elif a==0,b>12:
    print('NA')
elif b==0.a>12:
    print('NA')
elif 0<a<=12 and 12<b:
    print('MMYY')
elif 0<b<=12 and 12<a:
    print('YYMM')
elif 0<a<=12 and 0==b:
    print('MMYY')
elif 0<b<=12 and 1==a:
    print('YYMM')


s=list(map(int,input()))
a=10*s[0]+s[1]
b=10*s[2]+s[3]
counta=0
countb=0
'''month'''
if 0<a<=12:
    counta+=1
if 0<b<=12:
    countb+=1
'''year'''
if a==0 or a>=13:
    counta+=5
if b==0 or b>=13:
    countb+=5
j=counta+countb
if j==2:
    print('AMBIGUOUS')
elif j==6 and counta==5:
    print('YYMM')
elif j==6 and countb==5:
    print('MMYY')
else:
    print('NA')


Verdicts: Runtime Error

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
a,b,c,d=input()
x=int(a+b)
y=int(c+d)
if 0<=x<=12 and 1<=y<=12:
  print('AMBIGUOUS')
elif 1<=x<=12 and 0<=y=12:
  print('AMBIGUOUS')
elif 0<=x<=99 and 1<=y<=12:
  print('YYMM')
elif 1<=x<=12 and 0<=y<=99:
  print('MMYY')
else:
  print('NA')

a,b,c,d=input()
x=int(a+b)
y=int(c+d)
if 1<=x<=12 and 1<=y<=12:
  print('AMBIGUOUS')
elif 1<=x<=12 and 0<=y<=99:
  print('MMYY')
elif 0<=x<=99 and 1<=x<12:
  print('YYMM')
else:
  print('NA')

a,b,c,d=input()
x=int(a+b)
y=int(c+d)
if 1<=x<=12 and 1<=y<=12:
  print('AMBIGUOUS')
elif 1<=x<=12 and 13<=y<=99:
  print('MMYY')
elif 13<=x<=99 and 1<=x<12:
  print('YYMM')
elif 1<=x<=12 and y==0:
  print('MMYY')
elif x==0 and 1<=y<=12:
  print('YYMM')
else:
  print('NA')

a,b,c,d=map(int,input())
x=int(a+b)
y=int(c+d)
if 0<=x<=12 and 0<=b<=12:
  if x==y==0:
    print('NA')
  else:
    print('AMBIGUOUS')
elif 0<=x<=99 and 1<=y<=12:
  print('YYMM')
elif 1<=x<=12 and 0<=y<=99:
  print('MMYY')
else:
  print('NA')

a,b,c,d=map(int,input().split())
x=int(a+b)
y=int(c+d)
if 0<=x<=12 and 0<=b<=12:
  if x==y==0:
    print('NA')
  else:
    print('AMBIGUOUS')
elif 0<=x<=99 and 1<=y<=12:
  print('YYMM')
elif 1<=x<=12 and 0<=y<=99:
  print('MMYY')
else:
  print('NA')

a,b,c,d=input()
x=int(a+b)
y=int(c+d)
if 1<=x<=12 and 1<=y<=12:
  print('AMBIGUOUS')
elif 1<=x<=12 and 0<=y<=99:
  print('MMYY')
elif 0<=x<=99 and 1<=y<=12:
  print('YYMM')
else:
  print('NA')

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
S = input()

formar = int(S[:2])
latter = int(S[2:])

if has_month_potential(formar) and not has_month_potential(latter):
    print('MMYY')
elif not has_month_potential(formar) and has_month_potential(latter):
    print('YYMM')
elif has_month_potential(formar) and has_month_potential(latter):
    print('AMBIGUOUS')
elif not has_month_potential(formar) and not has_month_potential(latter):
    print('NA')

def has_month_potential(num):
    return num >= 1 and num <= 12

S = input()

formar = int(S[:2])
latter = int(S[2:])

if has_month_potential(formar) and not has_month_potential(latter):
    print('MMYY')
elif not has_month_potential(formar) and has_month_potential(latter):
    print('YYMM')
elif has_month_potential(formar) and has_month_potential(latter):
    print('AMBIGUOUS')
elif not has_month_potential(formar) and not has_month_potential(latter):
    print('NA')

Verdicts: Runtime Error

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
s = input()
h = s[:2]
t = s[2:]
print(h, t)
def montheable(p):
    return '00' < p < '13'
if montheable(h) and montheable(t):
    print('AMBIGUOUS')
elif montheable(h):
    print('MMYY')
elif montheable(t):
    print('YYMM')
else:
    print('NA')

s = input()
h = s[:2]
t = s[2:]
def montheable(p):
    return '00' < p < '13'
if montheable(h) and montheable(t):
    print('AMBIGUOUS')
elif montheable(h):
    print('MMYY')
elif montheable(t):
    print('YYMM')
else:
    print('NA')

Verdicts: Wrong Answer

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
S = input()

if int(S[:1]) <= 12 and int(S[:1]) >= 1:
  if int(S[2:]) <= 12 and int(S[2:]) >= 1:
    print("AMBIGUOUS")
  else:
    print("MMYY")
elif int(S[:1]) > 12:
  if int(S[2:]) <= 12 and int(S[2:]) >= 1:
    print("YYMM")
  else:
    print("NA")
elif int(S[:1]) == 0:
  if int(S[2:]) < 12 and int(S[2:]) >= 1:
    print("YYMM")
  else:
    print("NA")
  


S = input()
u = int(S[0]) * 10 + int(S[1])
d = int(S[2]) * 10 + int(S[3])

if d >= 1 and d <= 12:
  if u >= 1 and u <=12:
    print("AMBIGUOUS")
  else:
    print("YYMM")
elif u >= 1 and u <= 12:
  print("MMYY")
else:
  print("NA")


Verdicts: Wrong Answer

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
s=input()
s1=int(s[0:2])
s2=int(s[2:4])

if 0<s1<13 and 0<s2<13:
    print("AMBIGUOUS")
elif 0<s1<13:
    print("MMYY")
elif 0<s2<13:
    print("YYMM")
else:
    print("NA")

print(s1,s2)

s=input()
s1=int(s[0:2])
s2=int(s[2:4])

if 0<s1<13 and 0<s2<13:
    print("AMBIGUOUS")
elif 0<s1<13:
    print("MMYY")
elif 0<s2<13:
    print("YYMM")
else:
    print("NA")

Verdicts: Wrong Answer

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
NN = input()
AA = int(NN[0:2])
BB = int(NN[2:-1])
count1 = 0
count2 = 0
if AA >12 or AA == 00:
  count1 +=1
if BB >12 or BB == 00:
  count2 +=2
if count1 == 0 and count2 == 0:
  print('AMBIGUOUS')
elif count1 ==1 and count2 == 0:
  print('YYMM')
elif count1 ==0 and count2 == 1:
  print('MMYY')
else:
  print('NA')
 

NN = input()
AA = int(NN[0:2])
BB = int(NN[2:-1])
count1 = 0
count2 = 0
if AA > 12 or AA == 00:
  count1 +=1
if BB > 12 or BB == 00:
  count2 +=1
if count1 == 0 and count2 == 0:
  print('AMBIGUOUS')
elif count1 ==1 and count2 == 0:
  print('YYMM')
elif count1 ==0 and count2 == 1:
  print('MMYY')
else:
  print('NA')

NN = input()
AA = int(NN[0:2])
BB = int(NN[2:])

count1 = 0
count2 = 0
if AA > 12 or AA == 00:
  count1 +=1
if BB > 12 or BB == 00:
  count2 +=1
if count1 == 0 and count2 == 0:
  print('AMBIGUOUS')
elif count1 ==1 and count2 == 0:
  print('YYMM')
elif count1 ==0 and count2 == 1:
  print('MMYY')
else:
  print('NA')

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
s=int(input())
a=(s-s%1000)-(s%1000-s%100)
b=s%100
if a<=1200 and b<=12:
  print('AMBIGUOUS')
elif a<=1200 and b>12:
  print('MMYY')
elif a>12 and b<=12:
  print('YYMM')
elif a>12 and B>12:
  print('NA')

s=int(input())
a=(s-s%1000)+(s%1000-s%100)
b=s%100
if 100<=a<=1200 and 1<=b<=12:
  print('AMBIGUOUS')
elif 100<=a<=1200 and b>12:
  print('MMYY')
elif a>1200 and 1<=b<=12:
  print('YYMM')
elif a==100 and b==0:
  print('MMYY')
elif a==0 and b==1:
  print('YYMM')
else:
  print('NA')

Verdicts: Runtime Error

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7


s = input()
if s[:2] == '00' or s[2:] == '00':
    print('NA')
    exit()

a = (1 <= int(s[:2]) <= 12)
b = (1 <= int(s[2:]) <= 12)

if a and b:
    print('AMBIGUOUS')
    exit()
elif a:
    print('MMYY')
    exit()
elif b:
    print('YYMM')
    exit()
else:
    print('NA')


from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7


s = input()
if s[:2] == '00' or s[2:] == '00':
    print('NA')
    exit()
    
a = (1 <= int(s[:2]) <= 12)
b = (1 <= int(s[2:]) <= 12)

if a and b:
    print('AMBIGUOUS')
elif a and (not b):
    print('MMYY')
elif (not a) and b:
    print('YYMM') 
else:
    print('NA')


S = input()
l = S[:2]
r = S[2:]
 
lcnt = 0
rcnt = 0
if 0 < int(l) <= 12:
    lcnt = 1
if  0 < int(r) <= 12:
    rcnt = 1
if lcnt and rcnt:
    print('AMBIGUOUS')
    exit()
elif lcnt:
    print('MMYY')
    exit()
elif rcnt:
    print('YYMM')
    exit()
else:
    print('NA')

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
s = int(input())
f = s/100
l = s%100
if 1 <= f and f <= 12:
    if 1 <= l and l <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= l and l <= 12:
        print('AMBIGUOUS')
    else:
        print('NA')

s = int(input())
f = s/100
l = s%100
if 1 <= f and f <= 12:
    if 1 <= l and l <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= l and l <= 12:
        print('YYMM')
    else:
        print('NA')

Verdicts: Wrong Answer

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
ym = int(input())
 
ym1 = int(ym/100)
ym2 = int(ym%100)

print(ym1,ym2)
 
if ym1 >= 1 and ym1 <= 12 and ym2 >= 1 and ym2 <=12:
  print('AMBIGUOUS')
elif ym2>=1 and ym2<=12:
  print('YYMM')
elif ym1>=1 and ym1<=12:
  print('MMYY')
else:
  print('NA')


ym = int(input())
 
ym1 = int(ym/100)
ym2 = int(ym%100)
 
if ym1 >= 1 and ym1 <= 12 and ym2 >= 1 and ym2 <=12:
  print('AMBIGUOUS')
elif ym2>=1 and ym2<=12:
  print('YYMM')
elif ym1>=1 and ym1<=12:
  print('MMYY')
else:
  print('NA')

Verdicts: Wrong Answer

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
S=list(input())
def main():
    while True:
        if int(S[0]+S[1])>12:
            if int(S[2]+S[3])==0:
                return 'NA'
            if int(S[2]+S[3])>12:
                return 'YYMM'
            else:
                return 'AMBIGUOUS'
        else:
            return 'MMYY'
            
print(main())

S=list(input())
def main():
    while True:
        if 1<=int(S[0]+S[1])<=12:
            if 1<=int(S[2]+S[3])<=12:
                return 'AMBIGUOUS'
            else:
                return 'MMYY'
        else:
            if 1<=int(S[2]+S[3])<=12:
                return 'YYMM'
            else:
                return 'NA'

print(main())

Verdicts: Wrong Answer

Accepted
Problem: You have a digit sequence S of length 4. You are wondering which of the following formats S is in:    * YYMM format: the last two digits of the year and the two-digit representation of the month (example: `01` for January), concatenated in this order   * MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order  If S is valid in only YYMM format, print `YYMM`; if S is valid in only MMYY format, print `MMYY`; if S is valid in both formats, print `AMBIGUOUS`; if S is valid in neither format, print `NA`.

Submission attempts (in order):
S = input().rstrip()
S = input().rstrip()
be = int(S[:2])
en = int(S[2:])
flag_be = False
flag_en = False
answer = ""
if be <= 12 and be >= 1:
    flag_be = True
if en <= 12 and en >= 1:
    flag_en = True

if flag_be and flag_en:
    answer = "AMBIGUOUS"
elif flag_be == True and flag_en == False:
    answer = "MMYY"
elif flag_be == False and flag_en == True:
    answer = "YYMM"
else:
    answer = "NA"
print(answer)

S = input().rstrip()
be = int(S[:2])
en = int(S[2:])
flag_be = False
flag_en = False
answer = ""
if be <= 12 and be >= 1:
    flag_be = True
if en <= 12 and en >= 1:
    flag_en = True

if flag_be and flag_en:
    answer = "AMBIGUOUS"
elif flag_be == True and flag_en == False:
    answer = "MMYY"
elif flag_be == False and flag_en == True:
    answer = "YYMM"
else:
    answer = "NA"
print(answer)

Verdicts: Runtime Error

Accepted
Problem: Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:    1. Throw the die. The current score is the result of the die.   2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.   3. The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.  You are given N and K. Find the probability that Snuke wins the game.

Submission attempts (in order):
from decimal import *
getcontext().prec = 28
li = input().split()
n = int(li[0])
k = int(li[1])







answer = 0
for i in range(n):
    dicenum = i + 1
    winline = dicenum
    x = 0
    while winline < k:
        x += 1
        winline = dicenum * (2**x)
    if dicenum == 1:
        first_x = x
        bunbo = n * 2**x
        bunsi = 1
    elif x == 0:
        bunsi += 2**first_x
    else:
        bunsi += (first_x - x) * 2

answer = Decimal(str(bunsi)) / Decimal(str(bunbo))
print(answer)

li = input().split()
n = int(li[0])
k = int(li[1])







answer = 0
for i in range(n):
    dicenum = i + 1
    winline = dicenum
    x = 0
    while winline < k:
        x += 1
        winline = dicenum * (2**x)
    if dicenum == 1:
        first_x = x
        bunbo = n * 2**x
        bunsi = 1
    elif x == 0:
        bunsi += 2**first_x
    else:
        bunsi += (first_x - x) * 2

answer = bunsi / bunbo
print(answer)

from decimal import Decimal
li = input().split()
n = int(li[0])
k = int(li[1])







answer = 0
for i in range(n):
    dicenum = i + 1
    winline = dicenum
    x = 0
    while winline < k:
        x += 1
        winline = dicenum * (2**x)
    if dicenum == 1:
        first_x = x
        bunbo = n * 2**x #initialize
        bunsi = 1 #initialize
    elif x == 0:
        bunsi += 2**first_x
    else:
        bunsi += 2**(first_x - x)

answer = Decimal(str(bunsi)) / Decimal(str(bunbo))
print("{:.12f}".format(answer))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:    1. Throw the die. The current score is the result of the die.   2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.   3. The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.  You are given N and K. Find the probability that Snuke wins the game.

Submission attempts (in order):
N,K=map(int, input().split())
#N,K=100000, 100000

l=[]
for i in range(1,N+1):
    n=0
    while i =< K:
        i *= 2
        n+=1
    l.append(1/N * (1/2)**n)

print(str(sum(l))[:14])


N,K=map(int, input().split())
#N,K=100000,5

l=[]
for i in range(1,N+1):
    n=0
    while i < K:
        i *= 2
        n+=1
    l.append(1/N * (1/2)**n)

print(round(sum(l), 12))


Verdicts: Runtime Error

Accepted
Problem: Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:    1. Throw the die. The current score is the result of the die.   2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.   3. The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.  You are given N and K. Find the probability that Snuke wins the game.

Submission attempts (in order):
input_num = input().split()
dice_num = int(input_num[0])
border_socre = int(input_num[1])
ans_p = 0

for score in range(1,dice_num + 1):
    coin_counter = 0
    
    while score <= border_socre:
        score = score * 2
        coin_counter += 1
    ans_p += (1 / dice_num ) * (1/2 ) ** coin_counter
print(ans_p)

dice_num = int(input_num[0])
border_socre = int(input_num[1])
ans_p = 0

for score in range(1,dice_num + 1):
    coin_counter = 0
    
    while score <= border_socre:
        score = score * 2
        coin_counter += 1
    ans_p += (1 / dice_num ) * (1/2 ) ** coin_counter
print(ans_p)

input_num = input().split()
dice_num = int(input_num[0])
border_socre = int(input_num[1])
ans_p = 0

for score in range(1,dice_num + 1):
    coin_counter = 0
    while score < border_socre:
        score = score * 2
        coin_counter += 1
        print(coin_counter)
    ans_p += (1 / dice_num ) * ((1/2 ) ** coin_counter)
    
print(ans_p)

input_num = input().split()
dice_num = int(input_num[0])
border_socre = int(input_num[1])
ans_p = 0

for score in range(1,dice_num + 1):
    coin_counter = 0
    while score < border_socre:
        score = score * 2
        coin_counter += 1
    ans_p += (1 / dice_num ) * ((1/2 ) ** coin_counter)
    
print(round(ans_p, 12))

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:    1. Throw the die. The current score is the result of the die.   2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.   3. The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.  You are given N and K. Find the probability that Snuke wins the game.

Submission attempts (in order):
import sys
from operator import itemgetter
import math

sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]
def ss(): return input().split()

def main():
    n, k = mi()
    nr = 1/n
    rate = 0.5

    ans = 0
    if n > k:
        ans += (n - k + 1) * nr
        n = k - 1
    left, right = k//2, k
    while right > 0:
        if left <= n:
            cnt = n - left
            ans += cnt * nr * rate
            n = left
        rate /= 20
        left, right = left//2, left
        
    print(f"{ans:.10f}")
    return

main()


import sys
from operator import itemgetter
import math

sys.setrecursionlimit(10**9)
input = sys.stdin.readline

def ii(): return int(input())
def mi(): return map(int, input().split())
def lmi(): return list(map(int, input().split()))
def lmif(n): return [list(map(int, input().split())) for _ in range(n)]
def ss(): return input().split()

def main():
    n, k = mi()

    ans = 0
    for i in range(1, n+1):
        t = 0
        while i < k:
            i *= 2
            t += 1
        ans += 0.5 ** t
    ans /= n
    print(f"{ans:.12f}")
    return

main()


Verdicts: Wrong Answer

Accepted
Problem: Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:    1. Throw the die. The current score is the result of the die.   2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.   3. The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.  You are given N and K. Find the probability that Snuke wins the game.

Submission attempts (in order):
# -*- coding: utf-8 -*-
import math

def main():
    N, K = map(int, input().split(' '))
    
    result = 1 / N * sum([math.pow(0.5, math.ceil(math.log2(K / n))) if n < K else 1.0 for n in range(1, N + 1)])
    print('{:f}'.format(result))


if __name__ == '__main__':
    main()


# -*- coding: utf-8 -*-
import math

def main():
    N, K = map(int, input().split(' '))
    
    result = 1 / N * sum([math.pow(0.5, math.ceil(math.log2(K / n))) if n < K else 1.0 for n in range(1, N + 1)])
    print('{:.12f}'.format(result))


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:    1. Throw the die. The current score is the result of the die.   2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.   3. The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.  You are given N and K. Find the probability that Snuke wins the game.

Submission attempts (in order):
n, k = map(int, input().split())
value = 0

for i in range(1, n+1):
    if i < k:
        for j in range(5):
            if i * 2**j >= 10:
                value += (1/n) * (1/(2**j))
                break
    else:
        value += 1/n
print(value)

n, k = map(int, input().split())
value = 0

for i in range(1, n+1):
    if i < k:
        for j in range(5):
            if i * 2**j >= k:
                value += (1/n) * (1/(2**j))
                break
    else:
        value += 1/n
print(value)

n, k = map(int, input().split())
value = 0

for i in range(1, n+1):
    if i <= k-1:
        for j in range(1, 5):
            if i * 2**j >= k:
                value += (1/n) * (1/(2**j))
                break
    else:
        value += 1/n
print(value)

n, k = map(int, input().split())
value = 0

for i in range(1, n+1):
    if i <= k-1:
        for j in range(1, 5):
            if i * 2**j >= k:
                value += 1/(n * (2**j))
                break
    else:
        value += 1/n
print(value)

n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
    tmp = 1.0/n
    now = i
    while now < k:
        now *= 2
        tmp /= 2
    ans += tmp
print("{:.12f}".format(ans))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:    1. Throw the die. The current score is the result of the die.   2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.   3. The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.  You are given N and K. Find the probability that Snuke wins the game.

Submission attempts (in order):
n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
    for j in range(15):
        if i >= k:
            break
        i *= 2
    ans += (1 / n) * (1 / 2) ** j
print(ans)

n, k = map(int, input().split())
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)
a = []
for i in range(1, n+1):
    for j in range(15):
        if i >= k:
            break
        i *= 2
    a.append(n * 2 ** j)
lcm = a[0]
for i in range(1, n):
    lcm = lcm * a[i] // gcd(lcm, a[i])
u = 0
for s in a:
    u += lcm // s
print(u/lcm)

n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
    for j in range(15):
        if i >= k:
            break
        i *= 2
    ans += 1 / (n * 2 ** j)
print(ans)

n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
    for j in range(18):
        if i >= k:
            break
        i *= 2
    ans += (1 / n) * (0.5) ** j
print('{:.12f}'.format(ans))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:    1. Throw the die. The current score is the result of the die.   2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.   3. The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.  You are given N and K. Find the probability that Snuke wins the game.

Submission attempts (in order):
from decimal import Decimal
from math import log2, ceil
N, K = list(map(int, input().strip().split()))
r = max(N - K, 0)

t = Decimal(0)
d = Decimal(N)
for i in range(1, N-r+1):
    tmp = 1/d * (Decimal(0.5) ** Decimal(ceil(log2(K/i))))
    t += 1/d * (Decimal(0.5) ** Decimal(ceil(log2(K/i))))

if r > 0:
    t += Decimal(1) - Decimal(N-r) / Decimal(r)

print(str(t))


from decimal import Decimal
from math import log2, ceil
N, K = list(map(int, input().strip().split()))
r = max(N - (K - 1), 0) 

t = Decimal(0)
d = Decimal(N)
for i in range(1, N-r +1):
    t += 1/d * (Decimal(0.5) ** Decimal(ceil(log2(K/i))))

if r > 0:
    t += Decimal(r) / Decimal(N)

print(str(t)[:14])



Verdicts: Wrong Answer

Accepted
Problem: Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:    1. Throw the die. The current score is the result of the die.   2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.   3. The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.  You are given N and K. Find the probability that Snuke wins the game.

Submission attempts (in order):
import math

n, k = map(int, input().split())
limit = 1 / n
ans = 0
for x in range(1 , n + 1):
    num = math.pow(2, -1 * math.ceil(math.log(k / x, 2)))
    num = num / n
    if num > limit:
        num = limit
    ans = ans + num
    if ans >= 1:
        break
print("{:.12
f}".format(ans))

import math

n, k = map(int, input().split())
limit = 1 / n
ans = 0
for x in range(1 , n + 1):
    num = math.pow(2, -1 * math.ceil(math.log(k / x, 2)))
    num = num / n
    if num > limit:
        num = limit
    ans = ans + num
    if ans >= 1:
        break
print("{:.12f}".format(ans))

Verdicts: Runtime Error

Accepted
Problem: Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:    1. Throw the die. The current score is the result of the die.   2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.   3. The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.  You are given N and K. Find the probability that Snuke wins the game.

Submission attempts (in order):
n,k=map(int,input().split())
cnt=0
j=17
for i in range(1,n+1):
    if i>=k:
        cnt+=1
    else:
        while i*(2**j)>k:
            j-=1
        cnt+=1/2**(j+1)
print(cnt/n)


n,k=map(int,input().split())
cnt=0
j=17
for i in range(1,n+1):
    if i>=k:
        cnt+=1
    else:
        while i*(2**j)>=k:
            j-=1
        cnt+=1/2**(j+1)
print(format(cnt/n,'.12f'))


Verdicts: Wrong Answer

Accepted
Problem: Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:    1. Throw the die. The current score is the result of the die.   2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.   3. The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.  You are given N and K. Find the probability that Snuke wins the game.

Submission attempts (in order):
import math

N, K = map(int, input().split())

naru = 0

for i in range(1, N+1):
    if i >= K:
        naru += 1
    else:
        kaisuu = math.ceil(math.log2(K / i))
        naru += 0.5 ** kaisuu
        print(kaisuu)
    print(i, naru)

print("{:.12f}".format(naru / N))


import math

N, K = map(int, input().split())

naru = 0

for i in range(1, N+1):
    if i >= K:
        naru += 1
    else:
        kaisuu = math.ceil(math.log2(K / i))
        naru += 0.5 ** kaisuu

print("{:.12f}".format(naru / N))


Verdicts: Wrong Answer

Accepted
Problem: Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:    1. Throw the die. The current score is the result of the die.   2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.   3. The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.  You are given N and K. Find the probability that Snuke wins the game.

Submission attempts (in order):
from collections import deque
n = int(input())

colors = [-1] * n

conns = [set() for _ in [0] * n] 

for x in range(1, n):
  v1, v2, dis = map(int, input().split())
  
  conns[v1-1].add((v2-1, dis))
  conns[v2-1].add((v1-1, dis))


q = deque([(0, 0)])

while q:
  v, dis, past = q.popleft()
  
  
  colors[v] = dis&1
  
  
  for edge, w in conns[v]:
    
    
    q.append((edge, dis + w))

print('\n'.join(map(str, colors)))

n, k = map(int, input().split())
total_prob = 0
for i in range(1, n+1):
  dice_count = 0
  while (i << dice_count) < k:
    dice_count += 1
  
  total_prob += (1 / n) * (0.5 ** dice_count)
  
print(round(total_prob, 12))

Verdicts: Runtime Error

Accepted
Problem: Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:    1. Throw the die. The current score is the result of the die.   2. As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.   3. The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.  You are given N and K. Find the probability that Snuke wins the game.

Submission attempts (in order):
N,K=map(int,input().split())
ans=0
for i in range(1,N+1):
    score=i
    cnt=0
    while(K>=score):
        score=score*2
        cnt+=1
    ans+=(1/N)*(0.5**cnt)
print(ans)

N,K=map(int,input().split())
ans=0
for i in range(1,N+1):
    score=i
    cnt=0
    while(K>score):
        score=score*2
        cnt+=1
    ans+=(1/N)*(0.5**cnt)
print("{:.12f}".format(ans))

Verdicts: Wrong Answer

Accepted