TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

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

p.sort()

ans = 0
for i in range(k):
  ans += p.pop(0)

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

p.sort()

ans = p[:k].sum()
  
print(ans)

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

p.sort()

ans = sum(p[:k])
  
print(ans)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
a,b = map(int,input().split())
c = []
for _ in range(a):
	c.append(int(input()))
sort(c)
print(sum(c[0:b]))

a,b = map(int,input().split())
c = list(map(int,input().split()))
c.sort()
print(sum(c[0:b]))

Verdicts: Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
sum = 0
for x in A[0:N]:
    sum = sum + x
print(sum)

N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
sum = 0
for x in A[0:K]:
    sum = sum + x
print(sum)

Verdicts: Wrong Answer

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):

if __name__ == "__main__":
  N, K = [int(a) for a in input().split()]
  P = list(map(int, input().split()))
  list.sort(P)
  print(P)
  ans = sum(P[:K])
  print(ans)



if __name__ == "__main__":
  N, K = [int(a) for a in input().split()]
  P = list(map(int, input().split()))
  list.sort(P)
  ans = sum(P[:K])
  print(ans)


Verdicts: Wrong Answer

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
n,k=map(int,input().split())
p=list(map(int(input().split()))
p.sort()
q=p[:k]
print(sum(q))
       

n,k=map(int,input().split())
p=list(map(intinput().split()))
p.sort()
q=p[:k]
print(sum(q))
       

n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
q=p[:k]
print(sum(q))


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.sort()
for i in b[a[1]]:
  c=0
  c+=b[i]
  return c
print(c)

a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.sort()
c=0
for i in b[a[1]]:
  c+=b[i]
  return c
print(c)


N, K = map(int, input().split())
p = list(map(int, input().split()))
print(sum(sorted(p)[:K]))


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

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

p=list(map(int,input().split()))

p.sort()
print(p)

sum = 0

for i in range(K):
    print(i)
    sum += p[i]
    
    
print(sum)

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

p=list(map(int,input().split()))
p.sort()

sum = 0

for i in range(K):
    sum += p[i]
    
    
print(sum)

Verdicts: Wrong Answer

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
nn=int(input())
kk=int(input())
num_value = list(map(int, input().split())) 
num_value.sort()
goukei=0
for i in range(kk):
    goukei=goukei+num_value[kk]
print(goukei)

nn=int(input())
kk=int(input())
num_value = list(map(int, input().split())) 
num_value.sort()
goukei=0
for i in range(kk):
    for k in range(nn-i):
        if num_value[i]>num_value[k]:
            num_value[i],num_value[k]=num_value[k],num_value[i]
goukei=goukei+num_value[i]
print(goukei)



nn=int(input())
kk=int(input())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)


nn=int(input())
kk=int(input())
num_value = list(map(int, input().split())) 
num_value.sort()
goukei=0
for i in range(kk):
   goukei=gokei+num_value[i]
print(goukei)


nn=int(input())
kk=int(input())
num_value = list(map(int, input().split())) 
num_value.sort()
goukei=0
for i in range(kk):
    goukei=goukei+num_value[kk]
print(goukei)


nn,kk=map(int,input.split())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)



nn,kk=map(int,input().split())
num_value = list(map(int, input().split())) 
num_value.sort()
gokei=0
for i in range(kk):
   gokei=gokei+num_value[i]
print(gokei)



Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
n,k=map(int,input().split())
p=list(map(int,input().split()))
pnew=sorted(p)
sums=0
for i in range(k):
    sums=sums+pnew[i]
    
print(pnew)
print(sums)

n,k=map(int,input().split())
p=list(map(int,input().split()))
pnew=sorted(p)
sums=0
for i in range(k):
    sums=sums+pnew[i]
    

print(sums)

Verdicts: Wrong Answer

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

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

L_2=sorted(L)

L_3=L_2[0:k]
print(L_3)
print(sum(L_3))

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

L_2=sorted(L)

L_3=L_2[0:k]
print(sum(L_3))

Verdicts: Wrong Answer

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
n, k = map(int, input().split())
pList = map(int, input().split())
list.sort(pList)
score = 0
for i in range(k):
    score += pList[i]
print(score)

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

#pList = [50, 100, 80, 120, 80]
list.sort(pList)
score = 0
for i in range(k):
    score += pList[i]
print(score)

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

#pList = [50, 100, 80, 120, 80]
list.sort(pList)
score = 0
for i in range(k):
    score += pList[i]
print(score)

n, k = map(int, input().split())
#pList = map(int, input().split())
split = input().split()
pList = [int(i) for i in split]
list.sort(pList)
score = 0
for i in range(k):
    score += pList[i]
print(score)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
a,b=map(int,input().split())
c=[]
c=input().split()
d=c.sort()
print(d)
ans=0
for i in range(0,b):
 ans+=d[i]

print(ans)

a,b=map(int,input())
c=[]
c=input().split()
d=c.sorted()
ans=0
for i in range(b):
  ans+=c[i]
print(ans)
 


a,b=map(int,input().split())
c=list(map(int,input().split()))
d=c.sort()
print(d)
ans=0
for i in range(0,b):
 ans+=d[i]

print(ans)

a,b=map(int,input().split())
c=list(map(int,input().split()))
print(c)
d=sorted(c)
ans=0
for i in range(0,b):
 ans+=d[i]
print(ans)

a,b=map(int,input().split())
c=[]
c=map(int,input().split())
d=list(c)
d2=sorted(d)
ans=0
for i in range(b):
  ans+=d2[i]
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
import itertools
import sys
from typing import Callable, List, NoReturn


def main() -> NoReturn:
    readline: Callable[[], str] = sys.stdin.readline
    n, k = map(int, readline().rstrip().split())  # type: int,...
    p: List[int] = [int(_) for _ in readline().rstrip().split()]

    print(sum(p.sort()[:k]))


if __name__ == '__main__':
    main()


import itertools
import sys
from typing import Callable, List, NoReturn


def main() -> NoReturn:
    readline: Callable[[], str] = sys.stdin.readline
    n, k = map(int, readline().rstrip().split())  # type: int,...
    p: List[int] = [int(_) for _ in readline().rstrip().split()]
    p.sort()
    print(sum(p[:k]))


if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
if __name__ == "__main__":
    N, K = list(map(int, input().split()))
    p = list(map(int, input().split()))

    print(p)
    p.sort()
    print(p)

    sum = 0
    for i in range(K):
        sum += p[i]
    
    print(sum)

if __name__ == "__main__":
    N, K = list(map(int, input().split()))
    p = list(map(int, input().split()))
    p.sort()
    sum = 0
    for i in range(K):
        sum += p[i]
    
    print(sum)

Verdicts: Wrong Answer

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
n,k = map(int , input().split(""))
p = list(map(int , input()).split(""))
 
p.sort()
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)

n,k = map(int , input().split( ))
p = list(map(int , input().split( ))
 
p.sort()
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)

n,k = int(input()).split()
p = list(int(input()).split())
 
p1 = sorted(p)
 
temp = 0
for i in p[k] :
  temp += i
print(temp)

n,k = map(int , input().split())
p = list(map(int , input()).split())
 
p1 = sorted(p)
 
temp = 0
for i in p[k] :
  temp += i
print(temp)

n,k = map(int , input().split())
p = list(map(int , input()).split())
 
p1 = sorted(p)
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)

n,k = map(int , input().split( ))
p = list(map(int , input()).split( ))
 
p.sort()
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)

n,k = map(int , input().split())
p = list(map(int , input()).split())
 
p1 = sorted(p)
 
temp = 0
for i in p1[:k] :
  temp += i
print(temp)

n,k = int(input()).split()
p = list(int(input()).split())

p1 = sorted(p)

temp = 0
for i in p[k] :
  temp += i
  return temp
print(temp)

n,k = map(int , input().split())
p = list(map(int , input()).split())
 
p.sort()
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)

n,k = map(int , input().split( ))
p = list(map(int , input().split( )))
 
p.sort()
 
temp = 0
for i in p[:k] :
  temp += i
print(temp)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
a, b = [int(x) for x in input().split()]
cs = [int(x) for x in input().split()]
print(a, b)
print(cs)
cs.sort()

print(sum(cs[:b]))

a, b = [int(x) for x in input().split()]
cs = [int(x) for x in input().split()]
cs.sort()

print(sum(cs[:b]))

Verdicts: Wrong Answer

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
from sys import stdin

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

prices = sorted(prices)

sum = 0
for i in range(0, K):
    print(prices[i])
    sum += prices[i]
print(sum)

from sys import stdin

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

prices = sorted(prices)

sum = 0
for i in range(0, K):
    sum += prices[i]
print(sum)

Verdicts: Wrong Answer

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
n, k = map(int, input().split())
p = sorted(list(int, input().split()))

ans = 0
for i in range(k):
    ans += p[i]

print(ans)

n, k = map(int, input().split())
p = sorted(list(map(int, input().split())))

ans = 0
for i in range(k):
    ans += p[i]

print(ans)

Verdicts: Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
N, K = int(input().split())
juice = []
for i in range(N):
    juice.append(list(map(int,input().split())))
juice.sort()
for i in range(K):
  print (juice[0] + juice[1] + juice[2])

N, K = int(input().split())
juice = []
for i in range(N):
    juice.append(list(input().split()))
juice.sort()
for i in range(K):
  print (juice[0:K])

N, K = int(input().split())
juice = []
for i in range(N):
    juice.append(list(input().split()))
juice.sort()
print (sum(juice[0:K]))

N,K = map(int, input().split())
*a, = map(int, input().split())
print (sum(sorted(a)[:K]))

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
a = input().split()
# a[0] is N個
# a[1] is K個
b = list(map(int, input().split()))
b.sort()

print(b)
sum = 0

for i in range(int(a[1])):
    sum += b[i]

print(sum)

a = input().split()
b = input().split()
b.sort()
sum = 0

for i in range(int(a[1])):
    sum += int(b[i])

print(sum)

a = input().split()
# a[0] is N個
# a[1] is K個
b = input().split()
b.sort()
sum = 0

for i in range(int(a[1])):
    sum += int(b[i])

print(sum)

#include <stdio.h>

void swap(int *a,int *b){
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;    
    return;
}

int main(void){
    int i,j,ans=0,N,K,p[1000];

    //入力部
    scanf("%d %d",&N,&K);
    for(i=0; i<N; i++){
        scanf("%d",&p[i]);
    }

    //計算部
    for(i=0;i<N-1;i++){
        for(j=i;j<N-1;j++){
            if(p[j]>p[j+1]){
                swap(&p[j],&p[j+1]);
            }
        }
    }
    for(i=0;i<K;i++){
        ans+=p[i];
    }

    //表示部
    printf("%d\n",ans);

    return 0;
}




a = input().split()
# a[0] is N個
# a[1] is K個
b = list(map(int, input().split()))
b.sort()

sum = 0

for i in range(int(a[1])):
    sum += b[i]

print(sum)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
n, k = map(int, input().split())
p = list(map(int, input().split()))
p = p.sort()
print(sum(p[:k]))

n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
print(sum(p[:k]))

Verdicts: Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
N, M = int(input().split())
list = str(input().split())
list.sort()
total = 0
for i in [0:M]:
  total += list[i]
print(total)



N, M = map(int, input().splilt())
L = list(map(int, input().splilt()))
print(sum(sorted(L)[:M]))

N, M = map(int, input().splilt())
p = list(map(int, input().splilt()))
print(sum(sorted(p)[:M]))

N, K = map(int, input().split())
p = list(map(int, input().split()))
print(sum(sorted(p)[:K]))

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
N = int(input())
K = int(input())
p = []

for i in range(N):
    x = int(input())
    p.append(x)

p.sort()

y = 0

for i in range(K):
    y += p[i]

print(y)


K = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort()
y = 0
for i in range(K[1]):
    y += p[i]
print(y)


Verdicts: Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
N, K = map(int, input().split())
price = [input() for _ in range(N)]
price.sort()
print(sum(price[:3]))

N, K = map(int, input().split())
price = [int(input()) for _ in range(N)]
price.sort()
print(sum(price[:3]))

N, K = map(int, input().split())
price = list(map(int, input().split()))
price.sort()
print(sum(price[:K]))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
inputs = [input() for i in range(2)]

N = inputs[0].split()[0]
K = inputs[0].split()[1]
p = [int(pn) for pn in inputs[1].split()]

ans = sum(p.sort()[0:K])
print(ans)

inputs = [input() for i in range(2)]

N = int(inputs[0].split()[0])
K = int(inputs[0].split()[1])
p = [int(pn) for pn in inputs[1].split()]

ans = sum(sorted(p)[0:K])
print(ans)

Verdicts: Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

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

s = input().rstrip().split(' ')
a = int(s[0]) 
sorted = []
sorted.append(a)

for i in range(1,n):
  a = int(s[i]) 
  sorted.append(a)
  
  main = i
  sub = i-1
  while main = 0:
    if(sorted[sub] > sorted[main]):
      stock = sorted[sub]
      sorted[sub] = sorted[main]
      sorted[main] = stock
    else:
      break
     
    main -= 1
    sub -= 1

sum = 0
for j in range(0,k):
  sum += sorted[j]
  
print(sum)
    

n,k = map(int,input().split)
 
s = input().rstrip().split(' ')
st = []
 
for i in range(0,n):
  a = int(s[i]) 
  st.append(a)

new_st = sorted(st)
sum = 0
for j in range(0,k):
  sum += new_st[j]
  
print(sum)
    

n,k = map(int,input().split())
 
s = input().rstrip().split(' ')
st = []
 
for i in range(0,n):
  a = int(s[i]) 
  st.append(a)
 
new_st = sorted(st)
sum = 0
for j in range(0,k):
  sum += new_st[j]
  
print(sum)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
N,K = map(int,input().split())
list[N] = input().split()
MIN = int(list[0])
SUM = 0
for j in range(0,K):
  for i in list:
    if MIN > int(i):
      MIN = int(i)
  list.remove(str(MIN))
  SUM += MIN
  MIN = int(list[0])
print(SUM)


N,K = map(int,input().split())
list = input().split()
MIN = int(list[0])
SUM = 0
import sys
if K<1 or N<1 or K>1000 or N>1000:
    sys.exit()
for j in range(0,K):
  for i in list:
    if(i<1 or i>1000):
        sys.exit()
    if MIN > int(i):
      MIN = int(i)
  list.remove(str(MIN))
  SUM += MIN
  MIN = int(list[0])
print(SUM)



N,K = map(int,input().split())
list = map(int,input().split())
MIN = list[0]
SUM = 0
for j in range(1,K):
  for i in list:
    if MIN > list[i]:
      MIN = list[i]
  list.delete(MIN)
  SUM += MIN
  MIN = list[0]
print(SUM)

N,K = map(int,input().split())
import sys
if N==1:
    print(input())
    sys.exit()
list = input().split()
MIN = 1001
SUM = 0
for j in range(0,K):
  for i in list:
    if MIN > int(i):
      MIN = int(i)
  list.remove(str(MIN))
  SUM += MIN
  MIN = 1001
print(SUM)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

Submission attempts (in order):
n, k = inpl()
p = inpl()
p = sorted(p)
ans = 0
for i in range(n):
    ans += p[i]
    if i+1 == k:
        break
print(ans)

from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

n, k = inpl()
p = inpl()
p = sorted(p)
ans = 0
for i in range(n):
    ans += p[i]
    if i+1 == k:
        break
print(ans)

Verdicts: Runtime Error

Accepted
Problem: A shop sells N kinds of fruits, Fruit 1, \ldots, N, at prices of p_1, \ldots, p_N yen per item, respectively. (Yen is the currency of Japan.)  Here, we will choose K kinds of fruits and buy one of each chosen kind. Find the minimum possible total price of those fruits.

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

ans=0
for i in range(k):
  mi=min(lis)
  ans+=mi
  lis.remove(mi)
  
print(ans)

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

ans=0
for i in range(k):
  mi=min(lis)
  ans+=mi
  lis.remove(mi)
  
print(ans)


Verdicts: Runtime Error

Accepted
Problem: 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:    * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;   * the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names `aa`, `ab`, `ac`, ..., `zy`, `zz`;   * the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names `aaa`, `aab`, `aac`, ..., `zzy`, `zzz`;   * the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names `aaaa`, `aaab`, `aaac`, ..., `zzzy`, `zzzz`;   * the dogs numbered 475255,475256,\cdots  were respectively given the names `aaaaa`, `aaaab`, ...;   * and so on.  To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:  `a`, `b`, ..., `z`, `aa`, `ab`, ..., `az`, `ba`, `bb`, ..., `bz`, ..., `za`, `zb`, ..., `zz`, `aaa`, `aab`, ..., `aaz`, `aba`, `abb`, ..., `abz`, ..., `zzz`, `aaaa`, ...  Now, Roger asks you:  "What is the name for the dog numbered N?"

Submission attempts (in order):
n=int(input())
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

print(num2alpha(n))

n=int(input())
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

print(num2alpha(n).lower())

Verdicts: Wrong Answer

Accepted
Problem: 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:    * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;   * the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names `aa`, `ab`, `ac`, ..., `zy`, `zz`;   * the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names `aaa`, `aab`, `aac`, ..., `zzy`, `zzz`;   * the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names `aaaa`, `aaab`, `aaac`, ..., `zzzy`, `zzzz`;   * the dogs numbered 475255,475256,\cdots  were respectively given the names `aaaaa`, `aaaab`, ...;   * and so on.  To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:  `a`, `b`, ..., `z`, `aa`, `ab`, ..., `az`, `ba`, `bb`, ..., `bz`, ..., `za`, `zb`, ..., `zz`, `aaa`, `aab`, ..., `aaz`, `aba`, `abb`, ..., `abz`, ..., `zzz`, `aaaa`, ...  Now, Roger asks you:  "What is the name for the dog numbered N?"

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

import numpy as np

s = input()

x = np.base_repr(int(s), 26)

strings = {
"1": "a",
"2": "b",
"3": "c",
"4": "d",
"5": "e",
"6": "f",
"7": "g",
"8": "h",
"9": "i",
"A": "j",
"B": "k",
"C": "l",
"D": "m",
"E": "n",
"F": "o",
"G": "p",
"H": "q",
"I": "r",
"J": "s",
"K": "t",
"L": "u",
"M": "v",
"N": "w",
"O": "x",
"P": "y",
"Q": "z"
}

r = ''
for i in list(x):
    r += strings[i]

print(x, r)


# -*- coding: utf-8 -*-

n = int(input())

r = ''

def to_moji(x: int):
    if x == 0:
        x = 26
    return chr(96 + x)

def devide(x, moji):
    a = x // 26
    b = x % 26

    if b == 0:
        a -= 1

    if a < 1:
        moji = to_moji(b) + moji
        return moji
    elif 1 <= a and a <= 26:
        moji = to_moji(b) + moji
        moji = to_moji(a) + moji
        return moji
    else:
        moji = to_moji(b) + moji
        return devide(a, moji)

print(devide(n, r))


Verdicts: Runtime Error

Accepted
Problem: 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:    * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;   * the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names `aa`, `ab`, `ac`, ..., `zy`, `zz`;   * the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names `aaa`, `aab`, `aac`, ..., `zzy`, `zzz`;   * the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names `aaaa`, `aaab`, `aaac`, ..., `zzzy`, `zzzz`;   * the dogs numbered 475255,475256,\cdots  were respectively given the names `aaaaa`, `aaaab`, ...;   * and so on.  To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:  `a`, `b`, ..., `z`, `aa`, `ab`, ..., `az`, `ba`, `bb`, ..., `bz`, ..., `za`, `zb`, ..., `zz`, `aaa`, `aab`, ..., `aaz`, `aba`, `abb`, ..., `abz`, ..., `zzz`, `aaaa`, ...  Now, Roger asks you:  "What is the name for the dog numbered N?"

Submission attempts (in order):
n = 123456789

m = {}
for i in range(0,26):
  m[i] = chr(97+i)

ans = ''
while 1:

  n -= 1

  x = n // 26
  y = n % 26

  ans = m[y] + ans

  n = x
  if n == 0:
    break

print(ans)


n = int(input())

m = {}
for i in range(0,26):
  m[i] = chr(97+i)

ans = ''
while 1:

  n -= 1

  x = n // 26
  y = n % 26

  ans = m[y] + ans

  n = x
  if n == 0:
    break

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:    * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;   * the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names `aa`, `ab`, `ac`, ..., `zy`, `zz`;   * the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names `aaa`, `aab`, `aac`, ..., `zzy`, `zzz`;   * the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names `aaaa`, `aaab`, `aaac`, ..., `zzzy`, `zzzz`;   * the dogs numbered 475255,475256,\cdots  were respectively given the names `aaaaa`, `aaaab`, ...;   * and so on.  To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:  `a`, `b`, ..., `z`, `aa`, `ab`, ..., `az`, `ba`, `bb`, ..., `bz`, ..., `za`, `zb`, ..., `zz`, `aaa`, `aab`, ..., `aaz`, `aba`, `abb`, ..., `abz`, ..., `zzz`, `aaaa`, ...  Now, Roger asks you:  "What is the name for the dog numbered N?"

Submission attempts (in order):
N=int(input())
alphabet='zabcdefghijklmnopqrstuvwxyz'
result = ''
while N > 0:
  result = alphabet[N%26]+result
  if N%26==0:
    N-=1
    N//=26
print(result)

N=int(input())
alphabet=list('abcdefghijklmnopqrstuvwxyz')
result = []
while N >= 0:
  num, N = N%26, N//26
  result.append(alphabet[num-1])
print(''.join(result)[::-1])

N=int(input())
alphabet=list('zabcdefghijklmnopqrstuvwxyz')
result = ''
while N > 0:
  result = alphabet[N%26]+result
  if N%26==0:
    N-=1
    N//=26
print(result)

N=int(input())
alphabet=list('zabcdefghijklmnopqrstuvwxyz')
result = ''
while N > 0:
  result = alphabet[N%26]+result
  if N%26==0:
    N-=1
  N//=26
print(result)

Verdicts: Time Limit Exceeded

Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:    * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;   * the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names `aa`, `ab`, `ac`, ..., `zy`, `zz`;   * the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names `aaa`, `aab`, `aac`, ..., `zzy`, `zzz`;   * the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names `aaaa`, `aaab`, `aaac`, ..., `zzzy`, `zzzz`;   * the dogs numbered 475255,475256,\cdots  were respectively given the names `aaaaa`, `aaaab`, ...;   * and so on.  To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:  `a`, `b`, ..., `z`, `aa`, `ab`, ..., `az`, `ba`, `bb`, ..., `bz`, ..., `za`, `zb`, ..., `zz`, `aaa`, `aab`, ..., `aaz`, `aba`, `abb`, ..., `abz`, ..., `zzz`, `aaaa`, ...  Now, Roger asks you:  "What is the name for the dog numbered N?"

Submission attempts (in order):
def func(tmp):
  print(tmp)
  ans = ''
  sub_ans = tmp/26
  if sub_ans >0:
    ans += func(int(sub_ans))

  ans += chr(96 + int(tmp)%26)
    
  return ans

  
tmp = int(input())
print(func(tmp)[1:])

def func(tmp):
  ans = ''
  sub_ans = (tmp-1)/26
  if int(sub_ans) >0:
      ans += func(int(sub_ans))
  if (tmp-1) <= 0:
    ans+='a'
  else:
  	ans += chr(97 + int(tmp-1)%26)
  return ans

  
tmp = int(input())
print(func(tmp))
  
  

Verdicts: Wrong Answer

Accepted
Problem: 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:    * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;   * the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names `aa`, `ab`, `ac`, ..., `zy`, `zz`;   * the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names `aaa`, `aab`, `aac`, ..., `zzy`, `zzz`;   * the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names `aaaa`, `aaab`, `aaac`, ..., `zzzy`, `zzzz`;   * the dogs numbered 475255,475256,\cdots  were respectively given the names `aaaaa`, `aaaab`, ...;   * and so on.  To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:  `a`, `b`, ..., `z`, `aa`, `ab`, ..., `az`, `ba`, `bb`, ..., `bz`, ..., `za`, `zb`, ..., `zz`, `aaa`, `aab`, ..., `aaz`, `aba`, `abb`, ..., `abz`, ..., `zzz`, `aaaa`, ...  Now, Roger asks you:  "What is the name for the dog numbered N?"

Submission attempts (in order):

def main():
    import collections

    N = int(input())
    A_s = list(map(int, input().split()))
    Q = int(input())

    summ = sum(A_s)
    CNT_A = collections.Counter(A_s)


    for i in range(Q):
        before, after = map(int, input().split())
        
        tmp_cnt = CNT_A[before]
        
        if (tmp_cnt > 0):
            tmp_before = CNT_A[before] * (after - before)
            summ += tmp_before

            N_before=CNT_A[before]

            del CNT_A[before]
            N_after = CNT_A[after]
            
            if (N_after > 0):
                CNT_A[after] = N_after + N_before
            else:
                CNT_A[after] = N_before
            
        
        print(summ)


if __name__ == '__main__':
    main()


N = int(input())

bitts = ''
ans = ''

dic = 'abcdefghijklmnopqrstuvwxyz'

while (N > 0):
    N -= 1
    
    b = N // 26
    mod = N - 26 * b
    bitts += str(mod)
    
    ans += dic[mod]
    
    N = N // 26
    

print(ans[::-1])



Verdicts: Runtime Error

Accepted
Problem: 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:    * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;   * the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names `aa`, `ab`, `ac`, ..., `zy`, `zz`;   * the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names `aaa`, `aab`, `aac`, ..., `zzy`, `zzz`;   * the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names `aaaa`, `aaab`, `aaac`, ..., `zzzy`, `zzzz`;   * the dogs numbered 475255,475256,\cdots  were respectively given the names `aaaaa`, `aaaab`, ...;   * and so on.  To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:  `a`, `b`, ..., `z`, `aa`, `ab`, ..., `az`, `ba`, `bb`, ..., `bz`, ..., `za`, `zb`, ..., `zz`, `aaa`, `aab`, ..., `aaz`, `aba`, `abb`, ..., `abz`, ..., `zzz`, `aaaa`, ...  Now, Roger asks you:  "What is the name for the dog numbered N?"

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


def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

ans=num2alpha(num)

print(ans)

num=int(input())


def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

ans=num2alpha(num).lower()

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:    * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;   * the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names `aa`, `ab`, `ac`, ..., `zy`, `zz`;   * the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names `aaa`, `aab`, `aac`, ..., `zzy`, `zzz`;   * the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names `aaaa`, `aaab`, `aaac`, ..., `zzzy`, `zzzz`;   * the dogs numbered 475255,475256,\cdots  were respectively given the names `aaaaa`, `aaaab`, ...;   * and so on.  To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:  `a`, `b`, ..., `z`, `aa`, `ab`, ..., `az`, `ba`, `bb`, ..., `bz`, ..., `za`, `zb`, ..., `zz`, `aaa`, `aab`, ..., `aaz`, `aba`, `abb`, ..., `abz`, ..., `zzz`, `aaaa`, ...  Now, Roger asks you:  "What is the name for the dog numbered N?"

Submission attempts (in order):
def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
BC=[]
for i in range(Q):
    BC.append(list(map(int,input().split())))
for i in BC:
    if i[0] in A:
        indexlist=my_index_multi(A,i[0])
        for j in indexlist:
            A[j]=i[1]
    print(sum(A))

def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]
N=int(input())
A=list(map(int,input().split()))
Q=int(input())
BC=[]
for i in range(Q):
    BC.append(list(map(int,input().split())))
for i in BC:
    if i[0] in A:
        indexlist=my_index_multi(A,i[0])
        for j in indexlist:
            A[j]=i[1]
    print(sum(A))

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
N=int(input())
print(num2alpha(N).lower())

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:    * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;   * the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names `aa`, `ab`, `ac`, ..., `zy`, `zz`;   * the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names `aaa`, `aab`, `aac`, ..., `zzy`, `zzz`;   * the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names `aaaa`, `aaab`, `aaac`, ..., `zzzy`, `zzzz`;   * the dogs numbered 475255,475256,\cdots  were respectively given the names `aaaaa`, `aaaab`, ...;   * and so on.  To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:  `a`, `b`, ..., `z`, `aa`, `ab`, ..., `az`, `ba`, `bb`, ..., `bz`, ..., `za`, `zb`, ..., `zz`, `aaa`, `aab`, ..., `aaz`, `aba`, `abb`, ..., `abz`, ..., `zzz`, `aaaa`, ...  Now, Roger asks you:  "What is the name for the dog numbered N?"

Submission attempts (in order):
n=int(input())
N=0
N+=n
k=n
ddd=[]
for i in range(1,15):
  ddd.append((26**i)//25-1)
keta=0
syo=0
kou=0
for i in range(1,15):
  if (26**i-1)//25 == n:
    keta=i
    break
  if (26**i-1)//25 < n < (26**(i+1)-1)//25:
    keta=i
    break
ans=[]
for i in range(keta):
  ans.append(n%27)
  n=n//26
ans.reverse()
alf="zabcdefghijklmnopqrstuvwxyz"
anss=""
print(ans)
if not N in ddd:
  for i in ans:
    anss+=alf[i]
  print(anss)
else:
  print("z"*keta)

n=int(input())
alf = list("abcdefghijklmnopqrstuvwxyz")
ans=""
i=0
while n-26**i>=0:
  n-=26**i
  i+=1

for j in range(i):
  n,b=divmod(n,26)
  ans+=str(alf[b])
print(ans[::-1])

Verdicts: Wrong Answer

Accepted
Problem: 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:    * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;   * the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names `aa`, `ab`, `ac`, ..., `zy`, `zz`;   * the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names `aaa`, `aab`, `aac`, ..., `zzy`, `zzz`;   * the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names `aaaa`, `aaab`, `aaac`, ..., `zzzy`, `zzzz`;   * the dogs numbered 475255,475256,\cdots  were respectively given the names `aaaaa`, `aaaab`, ...;   * and so on.  To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:  `a`, `b`, ..., `z`, `aa`, `ab`, ..., `az`, `ba`, `bb`, ..., `bz`, ..., `za`, `zb`, ..., `zz`, `aaa`, `aab`, ..., `aaz`, `aba`, `abb`, ..., `abz`, ..., `zzz`, `aaaa`, ...  Now, Roger asks you:  "What is the name for the dog numbered N?"

Submission attempts (in order):
N = int(input())
ans = ''
for i in range(1, 99):
    if N <= 26 ** i:
        N -= 1
        for j in range(i):
            ans += chr(ord('a') + N % 26)
            N //= 26
            break
    else:
       N -= 26 ** i
       print(ans[::-1]) 


a = int(input())
s = []
ret = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
       'w', 'x', 'y', 'z',
       ]
while a > 0:
    a -= 1  
    shang = int(a / 26)
    yushu = int(a % 26)
    print(shang, yushu)
    s.append(yushu)  
    a = shang

s.reverse()
# print(s)
v = ''
for i in range(len(s)):
    v += ret[s[i]]
print(v)


a = int(input())
s = []
ret = ['z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
       'w', 'x', 'y', 'z',
       ]
while a > 0:
    a -= 1
    shang = int(a / 26)
    yushu = int(a % 26)
    # print(shang, yushu)
    s.append(yushu+1)
    a = shang

s.reverse()
# print(s)
v = ''
for i in range(len(s)):
    v += ret[s[i]]
print(v)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:    * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;   * the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names `aa`, `ab`, `ac`, ..., `zy`, `zz`;   * the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names `aaa`, `aab`, `aac`, ..., `zzy`, `zzz`;   * the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names `aaaa`, `aaab`, `aaac`, ..., `zzzy`, `zzzz`;   * the dogs numbered 475255,475256,\cdots  were respectively given the names `aaaaa`, `aaaab`, ...;   * and so on.  To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:  `a`, `b`, ..., `z`, `aa`, `ab`, ..., `az`, `ba`, `bb`, ..., `bz`, ..., `za`, `zb`, ..., `zz`, `aaa`, `aab`, ..., `aaz`, `aba`, `abb`, ..., `abz`, ..., `zzz`, `aaaa`, ...  Now, Roger asks you:  "What is the name for the dog numbered N?"

Submission attempts (in order):
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

n = num2alpha(123456789)
print(n.lower())

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

a=int(input())
n = num2alpha(a)
print(n.lower())

Verdicts: Wrong Answer

Accepted
Problem: 1000000000000001 dogs suddenly appeared under the roof of Roger's house, all of which he decided to keep. The dogs had been numbered 1 through 1000000000000001, but he gave them new names, as follows:    * the dogs numbered 1,2,\cdots,26 were respectively given the names `a`, `b`, ..., `z`;   * the dogs numbered 27,28,29,\cdots,701,702  were respectively given the names `aa`, `ab`, `ac`, ..., `zy`, `zz`;   * the dogs numbered 703,704,705,\cdots,18277,18278  were respectively given the names `aaa`, `aab`, `aac`, ..., `zzy`, `zzz`;   * the dogs numbered 18279,18280,18281,\cdots,475253,475254  were respectively given the names `aaaa`, `aaab`, `aaac`, ..., `zzzy`, `zzzz`;   * the dogs numbered 475255,475256,\cdots  were respectively given the names `aaaaa`, `aaaab`, ...;   * and so on.  To sum it up, the dogs numbered 1, 2, \cdots were respectively given the following names:  `a`, `b`, ..., `z`, `aa`, `ab`, ..., `az`, `ba`, `bb`, ..., `bz`, ..., `za`, `zb`, ..., `zz`, `aaa`, `aab`, ..., `aaz`, `aba`, `abb`, ..., `abz`, ..., `zzz`, `aaaa`, ...  Now, Roger asks you:  "What is the name for the dog numbered N?"

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

while True:
  if  26*(26**n-1)/25 >= N:
    break
  else:
    n +=1

alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
num = []

num = [0 for _ in range(n)]

for i in reversed(range(n)):
  print('i :', i)
  for j in range(1,27):
    pre = 26*(26**i-1)/25
    if 26**i * j + pre >= N:
      num[i] = alpha[j-1]

      N -= 26**i * j
      break


print(''.join(num[::-1]))

n = 1
N = int(input())

while True:
  if  26*(26**n-1)/25 >= N:
    break
  else:
    n +=1

alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
num = []

num = [0 for _ in range(n)]

for i in reversed(range(n)):
  for j in range(1,27):
    pre = 26*(26**i-1)/25
    if 26**i * j + pre >= N:
      num[i] = alpha[j-1]

      N -= 26**i * j
      break


print(''.join(num[::-1]))

Verdicts: Wrong Answer

Accepted