TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):


def main():


    N = int(input())

    for i in range(int(N/4)):
        for j in range(int(N/7)):
            if i*4+j*7==N:
                print('Yes')
                exit()
    
    print('No')


    
if __name__== "__main__":
    main() 













def main():

    
    N = int(input())

    for i in range(N//4+1):
        for j in range(N//7+1):
            if i*4+j*7==N:
                print('Yes')
                exit()
    print('No')


if __name__== "__main__":
    main() 











Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N=int(input())
res=False
for i in range(N//7):
    if (N-7*i)%4==0:
        res=True
        break

if res:
    print("Yes")
else:
    print("No")


N=int(input())
res=False
for i in range(N//7+1):
    if (N-7*i)%4==0:
        res=True
        break

if res:
    print("Yes")
else:
    print("No")


Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())

cake_price = 4
donut_price = 7

max_cake = N // cake_price
max_donut = N // donut_price

isJustN = False
if max_cake * cake_price == N or max_donut * donut_price == N:
    isJustN = True
else:
    for c in range(1, max_cake + 1):
        for d in range(1, max_donut + 1):
            total_price = cake_price * c + donut_price * d
            if total_price == N:
                isJustN = True
                break

Result = ''
Result = 'Yes' if isJustN == True else Result = 'No'
print(Result)



N = int(input())

cake_price = 4
donut_price = 7

max_cake = N // cake_price
max_donut = N // donut_price

isJustN = False
if max_cake * cake_price == N or max_donut * donut_price == N:
    isJustN = True
else:
    for c in range(1, max_cake + 1):
        for d in range(1, max_donut + 1):
            total_price = cake_price * c + donut_price * d
            if total_price == N:
                isJustN = True
                break

Result = ''
Result = 'Yes' if isJustN == True else 'No'
print(Result)


Verdicts: Runtime Error

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())

for i in range(26):
  for j in range(16):
    if(4*i + 7*j == N):
      print("Yes")
      break
else:
  print("No")

N = int(input())
ans = "No"
for i in range(26):
  for j in range(16):
    if(i*4+j*7 == N):
      ans = "Yes"
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
import math
counter = False
for n in range (0,10):
  for i in range (math.ceil((n+1) / 4) ):
    for j in range (math.ceil((n+1) / 7) ):
      #print(n, i,j)
      if i*4 + j*7 == n:
        counter = True
  if counter == True:
   print("Yes")
  else:
   print("No")
  counter=False

import math
n = int(input())
counter = False
#for n in range (0,100):
  for i in range (math.ceil((n+1) / 4) ):
    for j in range (math.ceil((n+1) / 7) ):
      #print(n, i,j)
      if i*4 + j*7 == n:
        counter = True
  if counter == True:
    print("Yes")
  else:
    print("No")

import math
n = int(input())
counter = False
#for n in range (0,100):
  for i in range (math.ceil((n+1) / 4) ):
    for j in range (math.ceil((n+1) / 7) ):
      #print(n, i,j)
      if i*4 + j*7 == n:
        counter = True
  if counter == True:
    print("Yes")
  else:
   	print("No")

import math
n = int(input())
counter = False
#for n in range (0,100):
for i in range (math.ceil((n+1) / 4) ):
  for j in range (math.ceil((n+1) / 7) ):
    #print(n, i,j)
    if i*4 + j*7 == n:
      counter = True
if counter == True:
  print("Yes")
else:
  print("No")


Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n = int(input())
temp = n
while temp > 0:
    temp -= 7
    if temp%4 == 0:
        temp = 0
        break
print(temp)
if n>=4 and (n%4 == 0 or n%7 == 0 or temp == 0):
    print("Yes")
else:
    print("No")

n = int(input())
if n in [1,2,3,5,6,9,10,13,17]:
    print("No")
else:
    print("Yes")

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
#ABC 105 B
divisors = [4+i*7 for i in range(4)]
bound_num = max(divisors)
n = int(input())
yes=[i*4 + j*7 for i in range(6) for j in range(6)]
if n >= bound_num or n in yes:
    print("Yes")
else:
    print("No")
    
print(yes)


#ABC 105 B
divisors = [4+i*7 for i in range(4)]
bound_num = max(divisors)
n = int(input())
yes=[i*4 + j*7 for i in range(6) for j in range(6)]
if n >= bound_num or n in yes:
    print("Yes")
else:
    print("No")


Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n = int(input())
ans = "No"
for i in range(n // 4):
    for j in range(n // 7):
        if 4 * i + 7 * j == n:
            ans = "Yes"
            break
print(ans)

n = int(input())
ans = "No"
for i in range(n // 4 + 1):
    for j in range(n // 7 + 1):
        if 4 * i + 7 * j == n:
            ans = "Yes"
            break
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
import math
n=int(input())
for a in range(math.floor(n/4)+1):
    if (n-a*4)%7==0:
        print("Yes")
        break
print("No")


import math
n=int(input())
for a in range(math.floor(100/4)+1):
    for b in range(math.floor((100-a*4)/7)+1):
        if n==a*4+b*7:
            print("Yes")
        else:
            print("No")


import math
n=int(input())
count=0
while cakes*4+donuts*7<n:
    for a in range(math.floor(n/4)+1):
        if (n-a*4)%7==0:
            count+=1
print(count)


import math
n=int(input())
for a in range(math.floor(n/4)+1):
    if (n-a*4)%7==0:
        print("Yes")
        quit()
print("No")


Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N=int(input())
d=N//4
for i in range(d+1):
  if N-4*i%7==0:
    print("Yes")
    break
else:
  print("No")

N=int(input())
d=N//4
for i in range(d+1):
  if (N-4*i)%7==0:
    print("Yes")
    break
else:
  print("No")

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())

def func(n):
    for k in range(N//4):
        for d in range(N//7):
            if 4 * k + 7 * d == N:
                return 'Yes'
    return 'No'

print(func(N))

N = int(input())

def func(n):
    for k in range(N//4 + 1):
        for d in range(N//7 + 1):
            if 4 * k + 7 * d == N:
                return 'Yes'
    return 'No'

print(func(N))

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n = int(input())
a = 0
while n >= 0:
    if n % 7 == 0:
        a += 1
        break
    n -= 4
    print(n)
if a == 1:
    print("Yes")
else:
    print("No")

n = int(input())
a = 0
while n >= 0:
    if n % 7 == 0:
        a += 1
        break
    n -= 4
if a == 1:
    print("Yes")
else:
    print("No")

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n = int(input())
ans="No"
for i in range(n+1):
    for j in range(n+1):
        if n-4*i-7*j == 0:
            ans+="Yes"
print(ans)

n = int(input())
ans="No"
for i in range(n+1):
    for j in range(n+1):
        if n-4*i-7*j == 0:
            ans="Yes"
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())
ans = 0

for i in range(N//4 + 1):
    for j in range(N//7 + 1):
        if i * 4 + j * 7 == N:
            ans += 1
print(ans)


N = int(input())
ans = 0

for i in range(N//4 + 1):
    for j in range(N//7 + 1):
        if i * 4 + j * 7 == N:
            ans += 1

if ans == 0:
    print('No')
else:
    print('Yes')


Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())

M=N//7

for i in range(M):
  #print(N-i)
  if (N-i*7)%4==0:
    print('Yes')
    break
else:
  print('No')

N = int(input())

M=N//7

flag=0
for i in range(M):
  #print(N-i)
  if (N-i*7)%4==0:
    flag=1
    break
else:
  if N==4 or N==7:
    flag=1

print('Yes' if flag==1 else 'No')

N = int(input())

M=N//7

flag=0
for i in range(M+1):
  #print(N-i*7)
  if (N-i*7)%4==0:
    flag=1
    break
else:
  if N==4 or N==7:
    flag=1

print('Yes' if flag==1 else 'No')

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
x=int(input())
t=0
while x>0:
  if x%7==0:
    t+=1
  x-=4
print(t)

x=int(input())
t=0
while x>=0:
  if x%7==0:
    t=1
  x-=4
if t==0:
  print('No')
else: print('yes')

x=int(input())
t=0
while x>=0:
  if x%7==0:
    t+=1
  x-=4
print(t)

x=int(input())
t=0
while x>=0:
  if x%7==0:
    t=1
  x-=4
if t==0:
  print('No')
else: print('Yes')

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
import sys
n=int(input())
while(1):
    if(n%4=0):
        print("Yes")
        sys.exit()
    n-=7
    if(n<=3):
        break
print("No")

n=int(input())
if(n==3):
  print("No")
elif(n%4==0 or n%4==3):
  print("Yes"):
else:
  print("No")

import sys
n=int(input())
if(n%7==0):
  print("Yes")
  sys.exit(0)
while(1):
    if(n%4==0):
        print("Yes")
        sys.exit(0)
    n-=7
    if(n<=3):
        break
print("No")

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())
ans =0
for i in range(25):
    for j in range(int(100/7)):
        if(i*4+j*7 ==N):
            ans +=1
print(ans)
        

N = int(input())
ans =0
for i in range(25):
    for j in range(int(100/7)):
        if(i*4+j*7 ==N):
            ans +=1
if(ans >0):
    print("Yes")
else:
    print("No")

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n = int(input())

k = 'NO'

for a in range(int(n/4)+1):
	for b in range(int(n/7)+1):
		if 4*a + 7*b == n:
			k = 'YES'
			break

print(k)

n = int(input())

if n%4 != 0:
	n = int(n%7)

if n != 0:
	n = int(n%4)

if n == 0:
	print('YES')
else:
	print('NO')

n = int(input())

k = 'No'

a = 0
b = 0

while a < int(n/4):
	while b < int(n/7):
		if 4*a + 7*b == n:
			k = 'Yes'
			break
		b += 1
	a += 1

a = 0
b = 0

if k == 'No':
	while b < int(n/7):
		while a < int(n/4):
			if 4*a + 7*b == n:
				k = 'Yes'
				break
			a += 1
		b += 1


print(k)

n = int(input())

a = n % 11
b = n % 7
c = n % 4

if n <= 3:
	print('NO')
elif a == 0 or a == 3 or b == 0 or b == 4 or c == 0 or c == 3:
	print('YES')
else:
	print('NO')

n = int(input())

ans = 'No'

a = 0
b = 0

for i in range(int(n/4)+1):
	for i in range(int(n/7)+1):
		if 4*a + 7*b == n:
			ans = 'Yes'
			break

print(ans)

n = int(input())

ans = 'No'

a = 0
b = 0

for a in range(int(n/4)+1):
	for b in range(int(n/7)+1):
		if 4*a + 7*b == n:
			ans = 'Yes'
			break

print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
# -*- coding: utf-8 -*-
N = int(input())
i = 1
while N>4:
  N = N - i*7
  if N % 4 == 0:
    print("Yes")
  else:
    i = i+1
    continue
print("No")
  

N = int(input())
for i in range(26):
    for j in range(15):
        if 4*i+7*j == N:
            print("Yes")
            exit()

print("No")

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

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

n = int(input())
if n%4 == 0 or n%7 == 0 or n%4%7 == 0:
    print("Yes")
else:
    print("No")

n = int(input())
if n%4%7 == 0:
  print("Yes")
else:
  print("No")

n = int(input())
for c in range(0, 100//4):
    for d in range(0, 100//7):
        if n == 4*c + 7*d:
            print("Yes")
            exit(0)
print("No")

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n = int(input())
if n % 7 == 0 or n % 4 == 0:
   print("Yes")
elif (n % 28) % 4 == 0 or (n % 28) % 7 == 0:
   print("Yes")
else:
   print("No")

n = int(input())
for x in range (0, int(n/7)):
      if (n - 7*x)%4 == 0:
       print("Yes")
       exit()
print("No")

n = int(input())
a = n//7 +1
for x in range (0, a):
      if (n - 7*x)%4 == 0:
       print("Yes")
       exit()
print("No")

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n = int(input())

for x in range(0,n):
    for y in range(0,n):
        if 4*x + 7*y == n:
            result="Yes"
        else:
            result="No"
            
            
print(result)
        

N = int(input())

for x in range(N):
    for y in range(N):
        if x*4 + y*7 == N:
            flag = True
        else:
            flag = False
            

print("Yes") if flag else print("No")

N = int(input())

for x in range(N//2):
    for y in range(N//2):
        if x*4 + y*7 == N:
            flag = True
        else:
            flag = False
            

print("Yes") if flag else print("No")

N = int(input())

count = 0

for x in range(0,N):
    for y in range(0,N):
        if x*4 + y*7 == N:
            count += 1
            
           
            

print("No") if count == 0 else print("Yes")

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())

count = 0
for i in range(26):
    for j in range(15):
        if 4*i+7*j == N:
            print("Yes")
            print(i,j)
            count += 1
if count == 0:
    print("No")


N = int(input())

for i in range(26):
  for j in range(15):
    if 4*i+7*j == N:
      print("Yes")
    else:
      print("No")



N = int(input())

count = 0
for i in range(26):
    for j in range(15):
        if 4*i+7*j == N:
        	count = 1
if count == 1:
    print("Yes")
else:
	print("No")


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n=int(input())
m=n//4+1
ans=False
if m%7==0:
  ans=True
else:
  for i in range(1,m):
    if (i*4)%7==0:
      ans=True
      break
print(("No","Yes")[ans])

n=int(input())
ans=False
for i in range(100//4+1):
  if 4*i>n:
    break
  for j in range(100//7+1):
    if 4*i+7*j>n:
      break
    elif 4*i+7*j==n:
      ans=True
      break
    
print(("No","Yes")[ans])

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
a = int(input())
flag = True
while a > 7 and flag:
    if a % 4 == 0:
        print('YES')
        flag = False
    a -= 7
if flag:
    print('YES' if a == 4 or a == 7 else 'NO')

a = int(input())
flag = False
for nana in range(15):
    for yon in range(26):
        if 7 * nana + 4 * yon == a:
            flag = True
print('Yes' if flag else 'No')

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n=int(input())
print("YES" if n>=7*((-n)%4) else "NO")

n=int(input())
print("Yes" if n>=7*((-n)%4) else "No")

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())
for x in range(100 // 4 + 1):
  answer = 'no'
  for y in range(100 // 7 + 1):
    if 4 * x + 7 * y == N:
      print('yes')
      answer = 'yes'
      break
  if answer == 'yes':
    break
print('no')

N = int(input())
for x in range(N // 4 + 1):
  if (N - 4 * x) % 7 == 0:
    print('Yes')
    break
print('No')

N = int(input())
for x in range(N // 4 + 1):
  answer = 'no'
  for y in range(N // 7 + 1):
    if 4 * x + 7 * y == N:
      answer = 'yes'
      break
  if answer == 'yes':
    break
print(answer)

N = int(input())
answer = 'No'
for x in range(N // 4 + 1):
    if (N - 4 * x) % 7 == 0:
        answer = 'Yes'
        break
print(answer)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n = int(input())
for i in range(n + 1, 4):
    if (n - i) % 7 == 0:
        print('Yes')
        exit()
print('No')

n = int(input())
for i in range(0, n + 1, 4):
    print(i)
    if (n - i) % 7 == 0:
        print('Yes')
        exit()
print('No')

def main():
    n = int(input())
    for i in range(0, n + 1, 7):
        if (n - i) % 4 == 0:
            print('Yes')
            break
    else:
        print('No')


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
def Cakes_and_Donuts(N):
    CP = 4
    DP = 7
    
    if N <= 3:
        return f"No"
    
    for i in range(26):
        for j in range(15):
            if (CP * i + DP * j) == N:
                return f"Yes"
    
    return f"No"
  
  N = int(input())
  Cakes_and_Donuts(N)

def Cakes_and_Donuts(N):
    CP = 4
    DP = 7
    
    if N <= 3:
        return f"No"
    
    for i in range(26):
        for j in range(15):
            if (CP * i + DP * j) == N:
                return f"Yes"
    
    return f"No"

def Cakes_and_Donuts(N):
  
    CP = 4
    DP = 7
    
    if N <= 3:
        return "No"
    
    for i in range(26):
        for j in range(15):
            if (CP * i + DP * j) == N:
                return "Yes"
    return "No"
  
  
N = int(input())
Cakes_and_Donuts(N)

def main(N):
  
    CP = 4
    DP = 7
    
    if N <= 3:
        return "No"
    
    for i in range(100):
        for j in range(100):
            if (CP * i + DP * j) == N:
                print(i,j)
                return "Yes"
    return "No"

N = int(input())
print(main(N))


def main(N):
    CP = 4
    DP = 7
    
    if N <= 3:
        return f"No"
    
    for i in range(26):
        for j in range(15):
            if (CP * i + DP * j) == N:
                return f"Yes"
    
    return f"No"
  

def main(N):
  
    CP = 4
    DP = 7
    
    if N <= 3:
        return "No"
    
    for i in range(100):
        for j in range(100):
            if (CP * i + DP * j) == N:
                return "Yes"
    return "No"
N = int(input())
print(main(N))

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
import sys


CAKE = 4
DOUNAT = 7


def check_amount(i, j, n):
    return i*4 + j*7 == n


n = int(input())
count = 0
for i in range(int(n/CAKE+1)):
    for j in range(int(n/DOUNAT+1)):
        print(i, j)
        if check_amount(i, j, n):
            print('Yes')
            sys.exit()
print('No')

import sys


CAKE = 4
DOUNAT = 7


def check_amount(i, j, n):
    return i*4 + j*7 == n


n = int(input())
count = 0
for i in range(int(n/CAKE+1)):
    for j in range(int(n/DOUNAT+1)):
        if check_amount(i, j, n):
            print('Yes')
            sys.exit()
print('No')

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n = int(input())
x = n // 7
y = n //4
for i in range(x+1):
    for j in range(y+1):
        if i*7 + j*4 == n:
            print('YES')
            exit()
print('NO')


n = int(input())
x = n // 7
y = n //4
for i in range(x+1):
    for j in range(y+1):
        if i*7 + j*4 == n:
            print('Yes')
            exit()
print('No')


Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())

if N in [1, 2, 3, 5, 6, 9, 10, 13, 17]:
    print('Yes')
else:
    print('No')


N = int(input())

if N in [1, 2, 3, 5, 6, 9, 10, 13, 17]:
    print('No')
else:
    print('Yes')


Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())
s = (N//4 +1)
for i in range(s):
  for j in range(s):
    if 4*i+7*j == N:
      print("Yes")
    else:
      print("No")

N = int(input())
ans = 0
buy = N//4 + 1
for i in range(buy):
  for j in range(buy):
    if 4*i+7*j == N:
      ans += 1
print("Yes" if ans!=0 else "No")

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n = int(input())
m = n // 7
a = n % 7
if a == 0:
    print('Yes')
else:
    if m == 0 and n == 4:
        print('Yes')
    for i in range(m):
        if (n - (i + 1) * 7) % 4 == 0:
            print('Yes')
    print('No')

n = int(input())
m = n // 7
a = n % 7
if a == 0:
    print('Yes')
    exit()
else:
    for i in range(m+1):
        if (n - i * 7) % 4 == 0:
            print('Yes')
        exit()
    print('No')

n = int(input())
m = n // 7
a = n % 7
if a == 0:
    print('Yes')
    exit()
else:
    for i in range(m+1):
        if (n - i * 7) % 4 == 0:
            print('Yes')
            exit()
    print('No')

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
a = int(input())
b = a%7
b = a%4

c = a%4
c = c%7
if b == 0:
  print('Yes')
elif c ==0:
  print('Yes')
else:
  print('No')

a = int(input())
a = a%4
a = a%7
if a == 0:
  print('Yes')
else:
  print('No')

n = int(input())
for i in range(n//4 +1):
  if (n - 4 * i) % 7 == 0:
    print('Yes')
    exit()
print('No')

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n = int(input())

if n%4 == 0 or n%7 == 0:
    print("Yes")
else:
    print("No")

# ABC105 B - Cakes and Donuts
n = int(input())
 
count = 0

for x in range(0,n):
    for y in range(0,n):
        if x*4 + y*7 == n:
            count += 1

print("No") if count == 0 else print("Yes")

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())

C = N//4
D = N//7
count = 0
for c in range(1,C):
    for d in range(1,D):
        if (4*c) + (7*d) == N:
            count += 1

if count > 0:
    print("Yes")
else:
    print("No")

N = int(input())

C = N//4
D = N//7
count = 0
for c in range(0,C+1):
    for d in range(0,D+1):
        if (4*c) + (7*d) == N:
            count += 1

if count > 0:
    print("Yes")
else:
    print("No")

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())
import numpy as np
a = np.array((26,15))
for i in range(26):
  for j in range(15):
    a[i][j] = 4 * i + 7 * j

if N in a:
  print('Yes')
else:
  print('No')

N = int(input())
import numpy as np
a = np.empty((26,15))
for i in range(26):
  for j in range(15):
    a[i][j] = 4 * i + 7 * j

if N in a:
  print('Yes')
else:
  print('No')

Verdicts: Runtime Error

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n = int(input())

for i in range(n // 4):
    for j in range(n // 7):
        if i * 4 + j * 7 == n:
            print('Yes')
            exit()
print('No')


n = int(input())

for i in range(n // 4 + 1):
    for j in range(n // 7 + 1):
        if i * 4 + j * 7 == n:
            print('Yes')
            exit()
print('No')


Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
if __name__ == "__main__":
    N = input()
    for x in range(0, 100):
        y = N - 4 * x
        if y % 7 == 0:
            print ("Yes")
            exit(0)
    print ("No")

if __name__ == "__main__":
    N = int(input())
    for x in range(0, 100):
        y = N - 4 * x
        if y < 0:
            break
        if y % 7 == 0:
            print ("Yes")
            exit(0)
    print ("No")

Verdicts: Runtime Error

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())
answer = "No"

for x in range(N/4+1):
	for y in range(N/7+1):
  		if(4*x + 7*y == N):
    		answer = "Yes"
      		break
   

N = int(input())

for x in range(N/4)
	for y in range(N/7)
  		if(4*x + 7*y ==)
    		print("Yes")
      		break
   

N = int(input())
answer = "No"
cake = N//4
nut = N//7

for x in range(cake+1):
  for y in range(nut+1):
    if 4*x + 7*y == N:
      answer = "Yes"

N = int(input())
answer = "No"
cake = N//4 + 1
nut = N//7 + 1

for x in range(cake):
  for y in range(nut):
    if 4*x + 7*y == N:
      answer = "Yes"

N = int(input())
answer = "No"
cake = N//4
nut = N//7

for x in range(cake+1):
  for y in range(nut+1):
    if 4*x + 7*y == N:
      answer = "Yes"

print(answer)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
N = int(input())
# N = 4n+7m 
if N % 4 == 0 or N % 7 ==0 or N % == 4:
  print("Yes")
else:
  print("No")



N = int(input())
# N = 4n+7m 
if N % 4 == 0 or N % 7 ==　0 or N % 7 == 4:
  print("Yes")
else:
  print("No")



N = int(input())
m = 0
for i in range(15):
  n = N-7*m
  if n < 0:
    print("No")
    break
  elif n % 4 == 0:
    print("Yes")
    break
  elif m == 14:
    print("No")
  m += 1

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):


from itertools import dropwhile
from collections import deque
n=int(input())
ans=deque([["",n]])
def bfs(d):
    global ans
    l=len(ans)
    for i in range(l):
        x=ans.popleft()
        new1=[x[0]+"0",x[1]]
        if abs(new1[1])<abs((-2)**d):
            ans.append(new1)
        new2=[x[0]+"1",x[1]-(-2)**d]
        if abs(new2[1])<abs((-2)**d):
            ans.append(new2)
    if d!=0:
        bfs(d-1)
bfs(30)


for i in ans:
    if i[1]==0:
        ans=list(dropwhile(lambda x:x=="0",i[0]))
        if len(ans)==0:
            print(0)
        else:
            print("".join(ans))
        break

n=int(input())
for i in range(n//7+1):
    if (n-i*7)%4==0:
        print("Yes")
        break
else:
    print("No")

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n=int(input())
for i in range(n//4+1):
  for j in range(n//7+1):
    if 4*i+7*j==n:
      print('Yes')
    else:
      print('No')

n=int(input())
flag=0
for i in range(n//4+2):
  for j in range(n//7+2):
    if 4*i+7*j==n:
      flag+=1
    else:
      flag+=0
if flag!=0:
  print('Yes')
else:
  print('No')

Verdicts: Wrong Answer

Accepted
Problem: _La Confiserie d'ABC_ sells cakes at 4 dollars each and doughnuts at 7 dollars each. Determine if there is a way to buy some of them for exactly N dollars. You can buy two or more doughnuts and two or more cakes, and you can also choose to buy zero doughnuts or zero cakes.

Submission attempts (in order):
n = int(input())

for i in range(1, 26):
    for j in range(1, 16):
        if(4*i+7*j==n):
            print("Yes")
            break
else:
    print("No")

n = int(input())
flg=False

for i in range(0, 26):
    for j in range(0, 16):
        if(4*i+7*j==n):
            flg = True
            break
print("Yes" if flg else "No")

Verdicts: Wrong Answer

Accepted
Problem: Given an integer N, find the base -2 representation of N.  Here, S is the base -2 representation of N when the following are all satisfied:    * S is a string consisting of `0` and `1`.   * Unless S = `0`, the initial character of S is `1`.   * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N.  It can be proved that, for any integer M, the base -2 representation of M is uniquely determined.

Submission attempts (in order):
N = int(input())

if N==0:
    print(0)
else:
    ans = []
    
    while N!=0:
        now = str(N%2)
        ans.append(now)
        N = -1*(N//2)
    
    print(''.join(ans))

N = int(input())

if N==0:
    print(0)
else:
    ans = []
    
    while N!=0:
        now = str(N%2)
        ans.append(now)
        N = -1*(N//2)
    ans.reverse()
    print(''.join(ans))

Verdicts: Wrong Answer

Accepted
Problem: Given an integer N, find the base -2 representation of N.  Here, S is the base -2 representation of N when the following are all satisfied:    * S is a string consisting of `0` and `1`.   * Unless S = `0`, the initial character of S is `1`.   * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N.  It can be proved that, for any integer M, the base -2 representation of M is uniquely determined.

Submission attempts (in order):
n = int(input())

ans = ""
while n != 0:
    rest = n % 2
    if rest == 1:
        ans += "1"
    else:
        ans += "0"

    n = (n - rest) // -2

if ans == "":
    ans += "0"

print(ans)

n = int(input())

ans = ""
while n != 0:
    rest = n % 2
    if rest == 1:
        ans += "1"
    else:
        ans += "0"

    n = (n - rest) // -2

if ans == "":
    ans += "0"

print(reversed(ans))

n = int(input())

ans = ""
while n != 0:
    rest = n % 2
    if rest == 1:
        ans += "1"
    else:
        ans += "0"

    n = (n - rest) // -2

if ans == "":
    ans += "0"

print(ans[::-1])

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: Given an integer N, find the base -2 representation of N.  Here, S is the base -2 representation of N when the following are all satisfied:    * S is a string consisting of `0` and `1`.   * Unless S = `0`, the initial character of S is `1`.   * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N.  It can be proved that, for any integer M, the base -2 representation of M is uniquely determined.

Submission attempts (in order):
n = int(input())
s = ""

while n != 0:
  s = str(n%(-2)) + s
  n = n // (-2)
  
if s == "":
  print("0")
else:
  print(s)

n = int(input())
s = ""

while n != 0:
  if n % (-2) == 0:
    s = "0" + s
  else:
    s = "1" + s
    n -= 1
  n = n / (-2)
  
if s == "":
  print("0")
else:
  print(s)

Verdicts: Wrong Answer

Accepted
Problem: Given an integer N, find the base -2 representation of N.  Here, S is the base -2 representation of N when the following are all satisfied:    * S is a string consisting of `0` and `1`.   * Unless S = `0`, the initial character of S is `1`.   * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N.  It can be proved that, for any integer M, the base -2 representation of M is uniquely determined.

Submission attempts (in order):
import math

n = int(input())
nn = math.floor(math.log2(abs(n)))
keta = 0
under = 0
s = ""

if n > 0:
    if n <= sum([2**i for i in range(0,nn+1,2)]):
        keta = nn+1
        under = sum([2**i for i in range(0,nn,2)])
    else:
        keta = nn+3
        under = sum([2**i for i in range(0,nn+1,2)])

    for i in range(1,keta):
        remainder = (n-under)%(2**i)
        if remainder in range(1,2**(i-1)+1):
            s += "0" if i%2==1 else "1"
        else:
            s += "1" if i%2==1 else "0"
    else:
        s+="1"
    print(s[::-1])

elif n < 0:
    if n >= sum([(-2)**i for i in range(1,nn+1,2)]):
        keta = 2*(nn)
        under = sum([(-2)**i for i in range(1,nn-1,2)])
    else:
        keta = 2*(nn+1)
        under = sum([(-2)**i for i in range(1,nn+1,2)])
    for i in range(1,keta):
        remainder = abs(n-under)%(2**i)
        if remainder in range(1,2**(i-1)+1):
            s += "1" if i%2==1 else "0"
        else:
            s += "0" if i%2==1 else "1"
    else:
        s+="1"
    print(s[::-1])

else:
    print(0)




n = int(input())
for i in range(2**n):
    a = list(format(i,'b'))[::-1]
    
    summ = 0
    for index,aa in enumerate(a):
        summ += int(aa)*((-2)**index)

    if summ == n:
        print(format(i,'b'))
        break


#!/usr/bin/env python3
import sys
from math import ceil

def solve(N: int):
    if N == 0:
        print(0)
        return 

    answer = ""
    while N != 0:
        syou = ceil(N/-2) 
        amari = N-syou*-2

        answer+= str(amari)
        N = syou
    
    print(answer[::-1])

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: Given an integer N, find the base -2 representation of N.  Here, S is the base -2 representation of N when the following are all satisfied:    * S is a string consisting of `0` and `1`.   * Unless S = `0`, the initial character of S is `1`.   * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N.  It can be proved that, for any integer M, the base -2 representation of M is uniquely determined.

Submission attempts (in order):
from collections import deque
import sys
n = int(input())
k = 1
if n < 0:
    k = 0
    n = -n
if n == 0:
    print(0)
    sys.exit()
ans = deque([])
while n > 0:
    if n % 2 == 0:
        ans.appendleft("0")
    else:
        ans.appendleft("1")
    n = n // 2
if k:
    print(int("".join(ans)))
else:
    print(int("-"+"".join(ans)))

from collections import deque
n = int(input())
ans = deque([])
while n > 0:
    if n % 2 == 0:
        ans.appendleft(0)
    else:
        ans.appendleft(1)
    n = n // 2
print("".join(ans))

n = int(input())
key = []
if n%2:
  key.append("1")
  n -= 1
else:
  key.append("0")

bef_p, bef_q = 0, 0
n //= 2
while n:
  k_p, k_q = (n//2)%2, n%2
  if k_p == 0:
    if k_q == 0:
      key.append("0")
      key.append("0")
      bef_p, bef_q = 0, 0
    else:       
      key.append("1")
      key.append("1")
      bef_p, bef_q = 0, 0      
  else:
    if k_q == 0:
      key.append("0")
      key.append("1")
      bef_p, bef_q = 0, 0
    else:
      key.append("1")
      key.append("0")
      bef_p, bef_q = 1, 1
  n //= 4
  n = n + bef_p*2-bef_q
key.reverse()
print(int("".join(key)))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: Given an integer N, find the base -2 representation of N.  Here, S is the base -2 representation of N when the following are all satisfied:    * S is a string consisting of `0` and `1`.   * Unless S = `0`, the initial character of S is `1`.   * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N.  It can be proved that, for any integer M, the base -2 representation of M is uniquely determined.

Submission attempts (in order):
import sys
 
N = int(sys.stdin.readline())
if N == 0:
    print(0)
    sys.exit()
binN = ""
pN = abs(N)
while N != 0:
    if abs(N % -2) == 1:
        binN += "1"
    else:
        binN += "0"
    N //= -2
print(binN[::-1])

import sys
 
N = int(sys.stdin.readline())
if N == 0:
    print(0)
    sys.exit()
binN = ""
pN = abs(N)
while N != 0:
    if abs(N % -2) == 1:
        binN += "1"
    else:
        binN += "0"
    N += N%(-2)
    N //= -2
print(binN[::-1])

Verdicts: Wrong Answer

Accepted
Problem: Given an integer N, find the base -2 representation of N.  Here, S is the base -2 representation of N when the following are all satisfied:    * S is a string consisting of `0` and `1`.   * Unless S = `0`, the initial character of S is `1`.   * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N.  It can be proved that, for any integer M, the base -2 representation of M is uniquely determined.

Submission attempts (in order):
def base2_number(n):
    result = ""
    while True:
        print(n)
        rem = n % 2
        if rem:
            n -= 1
        n = n // -2
        result += str(abs(rem))
        if n == 0:
            break
    return int(result[::-1])
n = int(input())
print(base2_number(n))


def base2_number(n):
    result = ""
    while True:
        rem = n % 2
        if rem:
            n -= 1
        n = n // -2
        result += str(abs(rem))
        if n == 0:
            break
    return int(result[::-1])
n = int(input())
print(base2_number(n))


Verdicts: Wrong Answer

Accepted
Problem: Given an integer N, find the base -2 representation of N.  Here, S is the base -2 representation of N when the following are all satisfied:    * S is a string consisting of `0` and `1`.   * Unless S = `0`, the initial character of S is `1`.   * Let S = S_k S_{k-1} ... S_0, then S_0 \times (-2)^0 + S_1 \times (-2)^1 + ... + S_k \times (-2)^k = N.  It can be proved that, for any integer M, the base -2 representation of M is uniquely determined.

Submission attempts (in order):
def getBaseM2Num(n):
  if n == 0:
    return 0
  
  
  base = 1
  b2 = []
  while n != 0:
    if n % (2*base) == 0:
      
      b2.insert(0,"0")
    else:
      
      b2.insert(0,"1")
      n -= base
      
    base *= -2
  print(b2)  
  return "".join(b2)

n = int(input())
print(getBaseM2Num(n))

N = int(input())

ans = ""

if N == 0:
    print(0)
    exit()

while N != 0:
    
    if N % -2 == 0:
        ans = "0" + ans
    else:
        ans = "1" + ans
    tmp = abs(N % -2)
    #print(N, tmp)
    N = (N-tmp) // -2

print(ans)


Verdicts: Wrong Answer

Accepted