Problem:


Score : 100 points

Problem Statement

We have three boxes A, B, and C, each of which contains an integer.

Currently, the boxes A, B, and C contain the integers X, Y, and Z, respectively.

We will now do the operations below in order. Find the content of each box afterward.  

Swap the contents of the boxes A and B

Swap the contents of the boxes A and C

Constraints

1 \leq X,Y,Z \leq 100

All values in input are integers.

Input

Input is given from Standard Input in the following format:

X Y Z

Output

Print the integers contained in the boxes A, B, and C, in this order, with space in between.

Sample Input 1

1 2 3

Sample Output 1

3 1 2

After the contents of the boxes A and B are swapped, A, B, and C contain 2, 1, and 3, respectively.

Then, after the contents of A and C are swapped, A, B, and C contain 3, 1, and 2, respectively.  

Sample Input 2

100 100 100

Sample Output 2

100 100 100

Sample Input 3

41 59 31

Sample Output 3

31 41 59



Sample input:
1 2 3


Sample output:
3 1 2

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
def resolve():
    a, b, c = map(int, list(input()))
    print(a + b + c)


if __name__ == "__main__":
    resolve()

Submission status: Runtime Error

Solution code:
n, m = input().split()
b = input().split()
sum = 0
for x in b:
    sum += int(x)
yy=0
for y in b:
    if int(y) > sum/(4*int(m)):
        yy+=1
if yy <= int(m):
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
X,Y,Z = list(map(int, input().split(" ")))
print(Z + " " + X + " " + Y)

Submission status: Runtime Error

Solution code:
import numpy as np
K = int(input())
lis = [1,2,3,4,5,6,7,8,9]
lis = np.array(lis)
  
if K < 10:
  print(K)
    
else:
  count = 9
  sub_count = 0
  while count < K:
    tmp = lis[sub_count]
    if tmp % 10 == 9:
      count += 2
      lis.append(tmp * 10  + 8)
      lis.append(tmp + 9)
      sub_count += 1
    elif  tmp % 10== 0:
      count += 2
      lis.append(tmp * 10 + 0)
      lis.append(tmp * 10 + 1)
      sub_count += 1
    else:
      count += 3
      for i in range(-1,2):
        lis.append(tmp * 10 + tmp % 10 + i)
      sub_count += 1
  print(lis[count-1])

Submission status: Runtime Error

Solution code:
a,b,c = mapt(int,input().split())
res = str(c)+""+str(a)+""+str(b)
print(res)

Submission status: Runtime Error

Solution code:
a,b,c = raw_input().split()
a,b,c = c,a,b

print(a,b,c)

Submission status: Runtime Error

Solution code:
a,b,c = raw_input().split()

arr = [a,b,c]

print(arr[2],arr[0],arr[1])

Submission status: Runtime Error

Solution code:
a,b,c = raw_input().split()
arr = [a,b,c]

print(arr[1],arr[2],arr[0])

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())
a = b
a = c
print(a b c)

Submission status: Runtime Error

Solution code:
n,k = map(int, input().split())

print(min(n%k, abs(n%k-k)))

Submission status: Runtime Error

Solution code:
a,b,c= c,a,b

Submission status: Runtime Error

Solution code:
a,b,c = list(map(int,input().split()))
a,b = b,a
a,c = c,a
print(f'{a} {b} {c}')

Submission status: Runtime Error

Solution code:
temp=A
A=B
B=temp

temp=A
A=C
C=temp

print(A,B,C)

Submission status: Runtime Error

Solution code:
    abc = input()
    abc.split(" ")
    print(abc[2] + " " + abc[0] + " " + abc[1])

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())

min = 10**18+1
flag = True

while flag==True:
  N = abs(N-K)
  if N < min: min = N
  else: flag = False
    
return min

Submission status: Runtime Error

Solution code:
x=int(input())
y=int(input())
z=int(input())
print(z)
print(x)
print(y)

Submission status: Runtime Error

Solution code:
box = []
box = input().split()
box[0], box[1] = box[1], box[0]
box[0], box[2] = box[2], box[0]
print(box[0] box[1] box[2])

Submission status: Runtime Error

Solution code:
box = []
box = input().rstrip()
print(box[2] box[0] box[1])

Submission status: Runtime Error

Solution code:
a=list(map(int,input().split()))
print (f"{a[2]} {a[0]} {a[1]}")

Submission status: Runtime Error

Solution code:
a=list(map(int,input().split()))
b= [a[2], a[0], a[1]]
print (f"{b[0]} {b[1]} {b[2]}")

Submission status: Runtime Error

Solution code:
a=list(map(int,input().split()))
n=a[1]
a[1]=a[0]
a[0]=a[2]
a[2]=n
print (f"{a[0]} {a[1]} {a[2]}")

Submission status: Runtime Error

Solution code:
a=list(map(int,input().split()))
n=a[0]
a[0]=a[1]
a[1]=a[2]
a[2]=n
print (f"{a[0]} {a[1]} {a[2]}")

Submission status: Runtime Error

Solution code:
a=list(map(int, input().split()))
n=a[0]
a[0]=a[2]
a[2]=a[1]
a[1]=n
for i in range (len(a)):
  print a[i],

Submission status: Runtime Error

Solution code:
N, K, C = map(int, input().split())
S = list(input())
#left_greedy
countr = 0
countl = 0
switchr = 0
switchl = 0
left_greedy = [0]*len(S)
right_greedy=[0]*len(S)
#left
for l in range(len(S)):
    i = S[l]
    if switchl ==1:
        if i == 'o':
            if countl >= C:
                left_greedy[l]=1
                clist[l] = countl
                countl = 0
            else:
                countl+=1
                clist[l] = countl
        else:
            countl+=1
    else:
        if i == 'o':
            left_greedy[l]=1
            switchl+=1
#right_greedy
    r = len(S)-l-1
    i = S[r]
    if switchr ==1:
        if i == 'o':
            if countr >= C:
                right_greedy[r]=1
                
                countr = 0
            else:
                countr+=1
        else:
            countr+=1
            
    else:
        if i == 'o':
            right_greedy[r]=1
            switchr+=1
for n in range(len(S)):
    if left_greedy[n] == right_greedy[n]==1:
        print(n+1)

Submission status: Runtime Error

Solution code:
N, K, C = map(int, input().split())
S = list(input())
countr = 0
countl = 0
switchr = 0
switchl = 0
left_greedy = [0]*len(S)
right_greedy=[0]*len(S)
#left
for l in range(len(S)):
    i = S[l]
    if switchl ==1:
        if i == 'o':
            if countl >= C:
                left_greedy[l]=1
                clist[l] = countl
                countl = 0
            else:
                countl+=1
                clist[l] = countl
        else:
            countl+=1
    else:
        if i == 'o':
            left_greedy[l]=1
            switchl+=1
#right_greedy
    r = len(S)-l-1
    i = S[r]
    if switchr ==1:
        if i == 'o':
            if countr >= C:
                right_greedy[r]=1
                
                countr = 0
            else:
                countr+=1
        else:
            countr+=1
            
    else:
        if i == 'o':
            right_greedy[r]=1
            switchr+=1
for i in range(len(S)):
    if S[i] ==  'o':
        l = left_greedy[0:i].count(1)
        r = right_greedy[i+1:len(S)].count(1)
        x = r+l
        if 1 in left_greedy[0:i][::-1]:
            if 1 in right_greedy[i+1:len(S)-1]:
                if left_greedy[0:i][::-1].index(1)+right_greedy[i+1:len(S)-1][::-1].index(1)+1 < C:
                    x+=-1
        if x < K:
            print(i+1)

Submission status: Runtime Error

Solution code:
T

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
l=abs(N//K)
p=K*l
for i in range(1,10000):
	if abs(N-(K*(l+i)))<abs(N-p):
		p=p+i
print(abs(N-p))

Submission status: Runtime Error

Solution code:
a, b, c = [int(s) for s in input().split()]

a, b = b, a
a, c = c, a

print(' '.join([a, b, c])

Submission status: Runtime Error

Solution code:
x, y, z = [int(i) for i in input().split()]
x, y = y, x
x, z = z, x
print(f'{x} {y} {z}')

Submission status: Runtime Error

Solution code:
x, y, z = [int(i) for i in input().split()]
x, y = y, x
x, z = z, x
print(f'{x} {y} {z}'

Submission status: Runtime Error

Solution code:
A=int(input('A: '))
B=int(input('B: '))
C=int(input('C: '))
x1=A
y1=B
z1=C
C=y1
B=z1
A=x1
print(A,B,C)

Submission status: Runtime Error

Solution code:
x=int(input('x: '))
y=int(input('y: '))
z=int(input('z: '))
x1=x
y1=y
z1=z
z=y1
x=z1
y=x1
print(x,y,z)

Submission status: Runtime Error

Solution code:
N, M = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
cnt = 0 

for a in A:
    if a >= S / (4*M):
        cnt += 1
    if cnt >= M:
        print("Yes")
    else:
        print("No")

Submission status: Runtime Error

Solution code:
x,y=input().split()
z=input()
print(z,x,y)

Submission status: Runtime Error

Solution code:
n,k = map(int, input().split())
print(abs(n-k) % k)

# if n % k == 0:
#   print(0)
#   exit()

# min = 10**18

# while True:
#   n = abs(n-k)
#   if min > n:
#     min = n
#   else:
#     break

# print(min)

Submission status: Runtime Error

Solution code:
def swap(x,y,z):
  x, y = y, x
  x, z = z, x
  
  print('%d %d %d' % (x,y,z))
  
 (x, y, z) = input()
 swap(x,y,z)

Submission status: Runtime Error

Solution code:
a = input().int()
b = input().int()
c = input().int()

d = c
c = b 
b = d
d = a

print(a)
print(b)
print(c)

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
#swapping a and b
temp = a
a = b
b = temp

#swapping a and c
temp = a
a = c
c = temp

print(str(a)+"␣"+str(b)+"␣"+str(c))

Submission status: Runtime Error

Solution code:
a,b,c = int(input("enter three integers : ").split())
temp = a
a=b
b=temp
temp = c
c= a
a=temp
print(a,b,c)

Submission status: Runtime Error

Solution code:
input(x)
input(y)
input(z)

print(z)
print(x)
print(y)

Submission status: Runtime Error

Solution code:
l=list(map(int(input().strip().split()))
       print(str(l[3]+ " " +l[1]+" "+l[2]))

Submission status: Runtime Error

Solution code:
X,Y,Z = map(int,input().split())
 
print({} {} {} .format(Y,Z,X))

Submission status: Runtime Error

Solution code:
X,Y,Z = map(int,input().split())
 
print(Y Z X)

Submission status: Runtime Error

Solution code:
A,B,C = int(input()) 
X = int()
A,B,C = B,A,C
A,B,C = C,B,A

print(A B C)

Submission status: Runtime Error

Solution code:
A,B,C = int(input()) 
A,B = B,A
A,C = C,A

print(A B C)

Submission status: Runtime Error

Solution code:
x,y,z = mpa(int, input().split())
print("{} {} {}".format(z,x,y))

Submission status: Runtime Error

Solution code:
N, M = map(int,input().split())
A = list(map(int,input().split()))
S = sum(A)
cnt = 0
for a in A:
  if a >= S / (4*M):
	cnt += 1

if cnt >= M:
	print("Yes")
else:
 	print("No")

Submission status: Runtime Error

Solution code:
a = input()
b = input()
c = input()

subitem1 = a
a = b
b = subitem1

subitem2 = a
a = c
c = subitem2

print(a,b,c)

Submission status: Runtime Error

Solution code:
N,K=map(int, input().split())
a=N%K
print(a,K-a)

Submission status: Runtime Error

Solution code:
x,y,z = map(int,input().split())
swap(x,z)
swap(x,y)
print(x,y,z)

Submission status: Runtime Error

Solution code:
x, y, z=int(input(),input(),input())
x,y=y,x
x,z=z,x
print(str(x) + " " + str(y) + " " + str(z) )

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input())

print("{} {} {}".format(c, a, b))

Submission status: Runtime Error

Solution code:
from collections import deque

K = int(input()) 
a = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])

for i in range(K-1):
    j = a.popleft()
    if j%10 != 0:
        a.append((10*j) + ((j%10) -1))
        
    a.append((10*j)+j%10)
    
    if j%10 != 9:
        a.append((10*j) +((j%10)+1))
    
a.popleft()

Submission status: Runtime Error

Solution code:
from collections import deque

K = int(input()) 
a = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])

for i in range(K):
    j = a.popleft()
    print(j)
    if j%10 != 0:
        a.append((10*j) + ((j%10) -1))
        
    a.append((10*j)+j%10)
    
    if j%10 != 9:
        a.append((10*j) +((j%10)+1))

Submission status: Runtime Error

Solution code:
a, b, c = map(int, input().split())
lis = [c, a, b]
print(" ".join(lis))

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))

A = sum(a)
a.sort(reverse=True)
print(a)

if a[m-1] >= A/(4*m):
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))

A = sum(a)
a.sort(reverse=True)

if a[m-1] >= A/(4*m):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
x = input() y = input() z = input()
print(z) print(x) print(y)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

sumA = sum(A)

filteredA = list(filter(lambda x: x < (sumA / (4*M)), A))

if M <= len(filteredA):
    print('Yes')
else:
    print("No")

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
l = list(map(int, input().split()))
a = sum(l)
s = a / (4*m)
l.sort(reverse = True)
if l[m-1] < s:
    print('No')
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
s=str(input())
l=[0,0]
i=0
for n in range(0,len(s)):
  if s[n]==' ':
    l[i]=n
    i+=1
  if i==2:
    break
X=int(s[0:l[0]-1])
Y=int(s[l[0]+1,l[1]-1])
Z=int(s[l[1]+1,len(s)-1])
temp1=X
X=Y
Y=temp1
temp2=X
X=Z
Z=temp2
print(X,' ',Y,' ',Z)

Submission status: Runtime Error

Solution code:
x, y, z = map(int, input().split())
print(f'{z} {x} {y}')

Submission status: Runtime Error

Solution code:
s=str(input())
X=int(s[0])
Y=int(s[2])
Z=int(s[4])
temp1=X
X=Y
Y=temp1
temp2=X
X=Z
Z=temp2
print(X,' ',Y,' ',Z)

Submission status: Runtime Error

Solution code:
a = list(map(int(input().split())))
n = len(a)-1
i = 0
for _ in range(len(a)-1):
    temp = a[i]
    a[i] = a[n-1]
    a[n-1] = temp
    n+=1
for  i in a:
         print(i,end=" ")

Submission status: Runtime Error

Solution code:
a = list(map(int(input().split()))
n = len(a)-1
i = 0
for _ in range(len(a)-1):
    temp = a[i]
    a[i] = a[n-1]
    a[n-1] = temp
    n+=1
for  i in a:
         print(i,end=" ")

Submission status: Runtime Error

Solution code:
n = len(a)-1
i = 0
for _ in range(len(a)-1):
    temp = a[i]
    a[i] = a[n-1]
    a[n-1] = temp
for i in a:
  print(i,end=" ")

Submission status: Runtime Error

Solution code:
a = list(map(int,input().split()))
n = len(a) - 1
for i in range(len(a)):
  temp = a[i]
  a[i] = a[n-1]
  a[n-1] = temp
  n+=1

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
a = list(map(int, input().split()))

total = sum(a)

count = 0

valid = total / (4 * m)

for i in a:
    if i > valid:
        count += 1

if count >= m:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
x, y, z = map(int, input())
print(z, x, y)

Submission status: Runtime Error

Solution code:
X , Y ,Z = int(input())
print(Z, X, Y)

Submission status: Runtime Error

Solution code:
x,y,z=map(int,input().split()))
print(z,x,y)

Submission status: Runtime Error

Solution code:
L=list(map(int,input().split()))
print(L[3],L[1],L[2])

Submission status: Runtime Error

Solution code:
L=list(map(int,input().split()));print(L[3],L[1],L[2])

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
t = n%k
print(min(t,abs(k-t)))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
print(min(n%k, k-(n%k)))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())

t = n%k
if t > k-t:
  print(k-t)
else:
  print(t)

Submission status: Runtime Error

Solution code:
#abc161b
n,m=map(int,raw_input().split())
a=map(int,raw_input().split())
x=sum(a)/(4.0*m)
l=[i for i in a if i>=x]
if len(l)>=m:
 print 'Yes'
else:
 print 'No'

Submission status: Runtime Error

Solution code:
abc161b
n,m=map(int,raw_input().split())
a=map(int,raw_input().split())
x=sum(a)/(4*m)
l=[i for i in a if i>x]
if len(l)>=m:
 print 'Yes'
else:
 print 'No'

Submission status: Runtime Error

Solution code:
#abc161b
n,m=map(int,raw_input().split())
a=map(int,raw_input().split())
x=sum(a)/(4*m)
l=[i for i in a if i>=x]
if len(l)>m:
 print 'Yes'
else:
 print 'No'

Submission status: Runtime Error

Solution code:
a, b, c = list(map(int, input().split()))

if (a == b == c):
    print(f'{a} {b} {c}')
else:
    a, b = b, a
    a, c = c, a
    print(f'{a} {b} {c}')

Submission status: Runtime Error

Solution code:
x, y, z = map(int(input().split()))
print(z, x, y)

Submission status: Runtime Error

Solution code:
X,Y,Z = map(int, input().split(" "))

A = int(Z)
B = int(X)
C = int(Y)

print(f"{A} {B} {C}")

Submission status: Runtime Error

Solution code:
X,Y,Z = map(int, input().split())

A = int(Z)
B = int(X)
C = int(Y)

print(f"{A} {B} {C}")

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
#標準入力の取得
N,M = map(int,input().split())
A = list(map(int,input().split()))

cutoff = sum(A)/(4*M)
count_pop = sum(i >= cutoff for i in A)


if count_pop<M :
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
N,M = map(int,input().split())
A = list(map(int,input().split()))
tot_votes = sum(A)
count = 0
for a in A:
    if(a>=tot_votes/(4*M)):
        count+=1
if(count>=M):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
l = list(map(int,input().split()))
print(l[2]+' 'l[0]+' 'l[1])

Submission status: Runtime Error

Solution code:
def inp_list(): return list(map(int, sys.stdin.readline().split()))


X, Y, Z = inp_list()
print(Z, X, Y)

Submission status: Runtime Error

Solution code:
n,k,c = map(int, input().split())
s = str(input())
t = [0 for i in range(n)]
u = [0 for i in range(n)]
i,x,y = 0,0,0
j = n-1
while i < n and x <= k:
    if s[i] == "o":
        t[i] = 1
        x += 1
        i += c
    i += 1

while j >= 0 and y <= k:
    if s[j] == "o":
        u[j] = 1
        y += 1
        j += -c
    j += -1

for i in range(0,n):
    if t[i] == 1 and u[i] == 1:
        print(i+1)

Submission status: Runtime Error

Solution code:
lun_luns = [1, 2, 3, 4, 5, 6, 7, 8, 9]
k = int(input())
index = 0
while True:
	if len(lun_luns) >= k:
		break
	num = lun_luns.pop(index)
	lun_luns.insert(index, num)
	mod = num % 10
	n = num * 10
	if mod == 9:
		lun_luns.extend([n+mod-1, n+mod])
	else:
		lun_luns.extend([n+mod-1, n+mod, n+mod+1])
	index += 1
print(lun_luns[k-1])

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
'''
11 3 2
ooxxxoxxxoo
'''

import numpy as np

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

oks = [idx for idx, i in enumerate(S) if i == 'o']
# print(oks)

for ok in oks:
    temp = oks.copy()
    temp.remove(ok)
    temp = np.array(temp)
    cnt = 0

    while True:
        if len(temp) == 0:
            print(ok + 1)
            break
        val = temp[0]
        temp = temp[temp > val + C]
        cnt += 1
        if cnt >= K:
            break

Submission status: Runtime Error

Solution code:
from collections import deque

k = int(input())
q = deque(range(1, 10))
 
for i in range(k):
    x = q.popleft()
    if x % 10 != 0:
        q.append(10 * x + x % 10 - 1) #左端

    q.append(10 * x + x % 10) #真ん中

    if x % 10 != 9:
        q.append(10 * x + x % 10 + 1) #右端
 
print(x)

Submission status: Runtime Error

Solution code:
import math
n, k = map(int, input().split())
if n <= k:
    print(min(n, k - n))
else:
    t = (n - k - 1) / k + 1
    n = n - t * k
    print(min(n, k - n))

Submission status: Runtime Error

Solution code:
x, y, z = map(int, input().split())
 
x, y, z = y, z, x
y, z, x = we
print(we)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
c=list(map(int,input().split()))
required=sum(c)/(4*b)
count=0
for d in ｃ:
    if d>=required:
        count+=1
    else:
        break
print("YNeos"[count<b::2])

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
c=list(map(int,input().split()))
required=sum(c)/(4*b)
count=0
for d in sorted(c,reverse=True):
  if d>=required:
      count+=1
  else:
      break
print("YNeos"[count<b::2])

Submission status: Runtime Error

Solution code:
X=input()
Y=input()
Z=input()

print(f'{Z} {X} {Y}')

Submission status: Runtime Error

Solution code:
X = input()
Y = input()
Z = input()

print(f"Z X Y")

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
import math
# stdin = open("sample.txt")

def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

K = int(stdin.readline().rstrip())
a = list(range(1,10))
b = []
attack = 100000
while attack > 0:
    go = a.pop(0)
    ue = go*10
    shimo = go%10
    b.append(go)
    if shimo == 0:
        a.append(ue)
        a.append(ue+1)
    elif shimo == 9:
        a.append(ue+shimo-1)
        a.append(ue+shimo)
    else:
        a.append(ue+shimo-1)
        a.append(ue+shimo)
        a.append(ue+shimo+1)
    attack -= 1

print(b[K-1])

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
S = sum(A)
if A[M-1] >=  S / (4 * M):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
A = list(map(int, input().split()))
borderline = sum(A) / (4 * m)

print('Yes' if sorted(A, reverse=True)[m-1] >= borderline else 'No')

Submission status: Runtime Error

Solution code:
k = int(input())
x =[int(0)]*3234566669
count=0
mem=0
for a in range(k*k):
    n = str(a)
    if(len(n))==1:
        x[int(n)]=1
        mem=int(n)
        count+=1
    elif x[int(n[:-1])]==1 and abs(int(n[-1])-int(n[-2]))<2:
        x[int(n)]=1
        mem=int(n)
        count+=1
    if count>k:
        break
print(mem)

Submission status: Runtime Error

Solution code:
def swap(a,b):
    temp=a
    a=b
    b=temp


lis=[]
for i in range(3):
    a=int(input())
    lis.append(a)
for j in lis:
    print(j,end=" ")
    
swap(a[1],a[2])
swap(a[1],a[3])
for j in lis:
    print(j)

Submission status: Runtime Error

Solution code:
def main():
  n, k, c = map(int, input().split())
  ss = list(input())
  
  wd = [i for i, e in enumerate(ss) if e == 'o']
  wd_flg = [True for _ in wd]
  
  used = [0]
  cur = wd[0]
  if k != 1:
    for i, e in enumerate(wd):
      if e > cur + c:
        used.append(i)
        cur = e
        if len(used) == k:
          break
          
  used_rev = [len(wd)-1]
  cur = wd[-1]
  if k != 1: 
    for i, e in enumerate(wd[::-1]):
      if e < cur - c:
        used_rev.append(len(wd) - 1 - i)
        cur = e
        if len(used_rev) == k:
          break
  
  for i in used:
    if i not in used_rev:
      continue
    if used.index(i) + used_rev.index(i) >= k:
      continue
    else:
      print(wd[i]+1)
  
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n = int(input())
D = []

def FindOtvet(i, j, otv):
    if i == 0:
        return ''
    if j == 0:
        if (otv + D[i - 1][j]) < n:
            otv += D[i - 1][j]
            return str(j + 1) + FindOtvet(i - 1, j + 1, otv)
        else:
            return str(j) + FindOtvet(i - 1, j, otv)
    elif j == 9:
        if (otv + D[i - 1][j - 1]) < n:
            otv += D[i - 1][j - 1]
            return str(j) + FindOtvet(i - 1, j, otv)
        else:
            return str(j - 1) + FindOtvet(i - 1, j - 1, otv)
    else:
        if (otv + D[i - 1][j - 1]) < n:
            otv += D[i - 1][j - 1]
            if (otv + D[i - 1][j]) < n:
                otv += D[i - 1][j]
                return str(j + 1) + FindOtvet(i - 1, j + 1, otv)
            else:
                return str(j) + FindOtvet(i - 1, j, otv)
        else:
            return str(j - 1) + FindOtvet(i - 1, j - 1, otv)

arr = []
for i in range(10):
    arr.append(1)
D.append(arr)
totalSum = 9
i = 1
respI = 0
respJ = 0
while respI == 0 and respJ == 0:
    arr = []
    for j in range(10):
        if j == 0:
            arr.append(D[i - 1][j] + D[i - 1][j + 1])
        elif j < 9:
            arr.append(D[i - 1][j - 1] + D[i - 1][j] + D[i - 1][j + 1])
        else:
            arr.append(D[i - 1][j - 1] + D[i - 1][j])
        if j > 0:
            if (totalSum + arr[j]) >= n:
                respI = i
                respJ = j
                break
            totalSum += arr[j]
    D.append(arr)
    i += 1
respStr = str(respJ)
print(respStr + FindOtvet(respI, respJ, totalSum))

Submission status: Runtime Error

Solution code:
import math
 
N = int(input())
 
cnt = 0
 
if N == 2:
  print(1)
  exit()
 
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
 
    # divisors.sort()
    return divisors
res1 = sorted(make_divisors(N))
res1 = res1[1:math.ceil(len(res1)/2)]
 
for num in res1:
  kensa = N
  while True:
    if kensa % num == 0:
      kensa = kensa // num
      continue
    break
  if kensa % num == 1:
    cnt += 1
 
res2 = sorted(make_divisors(N-1))
cnt += len(res2[1:])+1
 
print(cnt)

Submission status: Runtime Error

Solution code:
n, k, c = map(int, input().split())
ss = list(input())

wd = [i for i, e in enumerate(ss) if e == 'o']
wd_flg = [True for _ in wd]

used = [0]
cur = wd[0]
if k != 1:
  for i, e in enumerate(wd):
    if e > cur + c:
      used.append(i)
      cur = e
      if len(used) == k:
        break
        
used_rev = [len(wd)-1]
cur = wd[-1]
if k != 1: 
  for i, e in enumerate(wd[::-1]):
    if e < cur - c:
      used_rev.append(len(wd) - 1 - i)
      cur = e
      if len(used_rev) == k:
        break

for i in used:
  if i not in used_rev:
    continue
  if used.index(i) + used_rev.index(i) >= k:
    continue
  else:
    print(wd[i]+1)

Submission status: Runtime Error

Solution code:
w

Submission status: Runtime Error

Solution code:
import sys
import math

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

pre=n-math.floor(n/k)*k

while 1:
    if pre <= abs(pre-k):
        print(pre)
        sys.exit()
    pre = abs(pre - k)

Submission status: Runtime Error

Solution code:
# coding: utf-8
x,y,z = list(map(int, input().split()))

print(f'{z} {x} {y}')

Submission status: Runtime Error

Solution code:
x,y,z=map(int,input().split)
print(z,x,y)

Submission status: Runtime Error

Solution code:
x,y,z=input().split()＃これは文字
x=int(x)
y=int(y)
z=int(z)
print(z,x,y)

Submission status: Runtime Error

Solution code:
n,k=map(int,input().split())
t=n%k
n=min(t,k)
print(n)

Submission status: Runtime Error

Solution code:
a,b,c=map(int,intput().split())
print(a," ",b," ",c)

Submission status: Runtime Error

Solution code:
N, K = map(int,input().split())
if K == 1 or N == 0 or N == K or N%K==0:
    print(0)
    exit()
elif K == 0 or K > N:
    print(N)
    exit()
elif N == 1 or N == K-1 or K == N-1:
    print(1)
    exit()
elif N > K:
    ans = (N//K) + 1
    res = abs(N - (K*ans))
    print(res)
    exit()

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
A = list(map(int, input().split()))
x = sum(A)/(4*m)
count = 0
for a in A:
    if a >= x:
        count += 1
if count >= m:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
X,Y,Z=map(int(input().split()))
print(Z,X,Y)

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split(' '))
x = N % K
x1 = K - x
if x > x1:
  print(x1)
else:
  print(x)

Submission status: Runtime Error

Solution code:
N, K = input().split()
N = int(N)
K = int(K)
temp = N
while N>0:
    if temp > K:
        N = N-K
        if N <= 0:
            print(abs(N))
    else:
        print(abs(N))

Submission status: Runtime Error

Solution code:
import sys
n ,k = map(int, input().split())
m = 0

if n == k or k == 1:
    print(0)
    sys.exit()
    
def abs_N(n, k):
    m = abs(n-k)
    compare_N_M(n, m)

def compare_N_M(n, m):
    if m == 1:
        print(1)
        sys.exit()
    elif n >= m:
        n = m
        abs_N(n, k)
    else:
        print(n)
        sys.exit()
        

abs_N(n, k)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = list(set((map(int, input().split()))))
vote = []
for Ai in A:
    if Ai >= (1 / (4 * M) * sum(A)):
        vote.append(Ai)
if len(vote) >= M:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

count = 0
allpoint = sum(A)
X = allpoint // (4 * M)

for i in A:
    if i > X:
        count += 1

if  count >= M:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
ans = n - k
if k == 1 or n == 1:
    print(1)
    quit()
if n % k == 0:
    print(0)
    quit()
if n < k:
    print(n)
    quit()

print(min(ans, k - n%k))

Submission status: Runtime Error

Solution code:
a, b = map(int,input().split())

if a<b:
    a,b=b,a

if a%b == 0:
    print(0)
else:
    
    a=a%b
    
    while abs(a-b)<a:
        a=abs(a-b)
    print(a)

Submission status: Runtime Error

Solution code:
import sys
import math
from collections import defaultdict
def countfact(n,rem):
    if n!=1:
        for i in range(2,int(math.sqrt(n))+2):
            if n%i==0:
                a,b=n//i,i
                #print(a,'fac1',b,'fac2')
                if a!=1:
                    rem.add(a)
                if b!=1:
                    rem.add(b)
def getfact(n):
    ans=[]
    for i in range(2,int(math.sqrt(n))+2):
        if n%i==0:
            a,b=n//i,i
            ans.append(a)
            ans.append(b)
    ans.sort()
    return ans
n=int(sys.stdin.readline())
count=0
temp=n
rem=set()
rem.add(n-1)
vis=defaultdict(int)
countfact(n-1,rem)
for i in rem:
    vis[i]=1

vis[1]=1
l=getfact(n)
temp=n
for i in range(len(l)):
    while n%l[i]==0:
        n=n//l[i]
    if n%l[i]==1 and vis[l[i]]==0:
        #print(l[i])
        vis[l[i]]=1
        count+=1
    n=temp
'''for i in range(2,int(math.sqrt(n))+2):
    if n%i==0:
        a,b=n//i,i
        c=0
        if b>a and vis[a]==0:
            vis[a]=1
            while a%1==0 and b>a:
                
                #print(a,'before')
                if b%a==1:
                    c+=1
                a=math.sqrt(a)
                #print(a,'a')
        elif vis[b]==0:
            vis[b]=1
            while b%1==0 and a>b:
                #print(b,'before')
               
                if a%b==1:
                    c+=1
                b=math.sqrt(b)
                #vis[b]=1
                #print(b,'after')
        count+=c
        #countfact(b-1,rem)'''

#print(count,'count')       
ans=len(rem)+count
if 1 in rem:
    ans-=1
#print(rem,'rem')
#print(ans,'ans')
count,z=1,True
while z:
    a=math.sqrt(n)
    #print(a,'a')
    if a%1==0 and vis[a]==0:
        count+=1
    else:
        z=False
    n=a
print(ans+count)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

count = 0
allpoint = sum(A)

for i in A:
    if i > float(allpoint // (4 * M)):
        count += 1

if  count >= M:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N,K=map(int, input().split()) 
min = abs(N-K)
if N < K:
    if min < abs(min-K):
        print(min)
    else:
        print(abs(min-K))
else: 
    while min >= abs(min-K):
        min = abs(min-K)
        if min < K:
            if min < abs(min-K):
                print(min)
                break
            else:
                print(abs(min-K))
                break
    else :
        print(min)

Submission status: Runtime Error

Solution code:
X = input()
Y = input()
Z = input()
print(Z)
print(X)
print(Y)

Submission status: Runtime Error

Solution code:
import fractions

n, k = map(int, input().split())
if (n > abs(n - k)):
    n = fractions.gcd(n, k)
while n > abs(n - k):
    n = abs(n - k)
if n == k:
    print('0')
else:
    print(n)