Problem:


Score : 100 points

Problem Statement

Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.

In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".

The current time is A o'clock, and a contest will begin in exactly B hours.
When will the contest begin? Answer in 24-hour time.

Constraints

0 \leq A,B \leq 23

A and B are integers.

Input

The input is given from Standard Input in the following format:

A B

Output

Print the hour of the starting time of the contest in 24-hour time.

Sample Input 1

9 12

Sample Output 1

21

In this input, the current time is 9 o'clock, and 12 hours later it will be 21 o'clock in 24-hour time.

Sample Input 2

19 0

Sample Output 2

19

The contest has just started.

Sample Input 3

23 2

Sample Output 3

1

The contest will begin at 1 o'clock the next day.



Sample input:
9 12


Sample output:
21

Submission status: Runtime Error

Solution code:
from math import factorial

n, a, b = map(int, input().split(" "));
v = list(map(int, input().split(" ")))


def product(iterable):
    prod = 1
    for n in iterable:
        prod *= n
    return prod

def npr(n, r):
    return product(range(n - r + 1, n + 1))

def ncr(n, r):
    if r > n // 2:
        r = n - r
    return npr(n, r) // factorial(r)

v.sort();
revv=list(reversed(v))
print(sum(v[-a:])/a)

revpos=revv.index(v[-a]);
num=v.count(v[-a]);
ans=0;
for i in range(a-revpos, b-revpos+1):
    ans+=ncr(num, i);
print(ans);

Submission status: Runtime Error

Solution code:
import math;

n, m = map(int, input().split(" "));
ab = [];
for i in range(0, n):
    ab.append(input().split(" "));

cd = [];
for i in range(0, m):
    cd.append(input().split(" "));

for i in range(0, n):
    dist=9999999999999
    nearm=0;
    for j in range(0, m):
         dist2 = math.fabs(int(ab[i][0]) - int(cd[j][0])) + math.fabs(int(ab[i][1]) - int(cd[j][1]));
         if dist2 < dist:
            dist = dist2;
            nearm=j;
    print(nearm + 1);

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split(" ");
print( (a+b) % 24)

Submission status: Runtime Error

Solution code:
def calcManhattanDistance(student, checkpoint):
    return abs(student[0] - checkpoint[0]) + abs(student[1] - checkpoint[1])


if __name__ == "__main__":
    # input process
    N, M = map(int, input().split())
    students = [list(map(int, input().split())) for i in range(N)]
    checkpoints = [list(map(int, input().split())) for i in range(M)]

    # calculation process
    for student in students:
        distance_list = []

        for checkpoint in checkpoints:
            distance_list.append(calcManhattanDistance(student, checkpoint))

        # print the first index(+1) of minimum value
        minval = min(distance_list)
        print(distance_list.index(minval) + 1)

    # END

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Here your code !
import numpy as np
n,m = [int(x) for x in input().split(' ')]
chil = []
check = []
minlist = []
for i in range(n):
    chil.append([int(x) for x in input().split(' ')])
for i in range(m):
    check.append([int(x) for x in input().split(' ')])
for c in chil:
    min = 10**12
    index = 0
    for inde,ch in enumerate(check):
        if abs(ch[1]-c[1]) + abs(ch[0]-c[0]) < min:
            min = abs(ch[1]-c[1]) + abs(ch[0]-c[0])
            index = inde
    minlist.append(index + 1)
for i in minlist:
    print(i)

Submission status: Runtime Error

Solution code:
import math
N=int( input())
for r in range (int(math.sqrt(N)),0,-1):
  if N%r==0:
    count=1
    l=N/r
    for i in range (0,10):
      l=l/10
      if l<1:
        print(count)
        break
      count+=1
    break

Submission status: Runtime Error

Solution code:
import sys

sys.setrecursionlimit(10000)


def memoize(f):
    cache = {}

    def func(*args):
        if args not in cache:
            cache[args] = f(*args)
        return cache[args]

    return func


@memoize



def combi(n, r):
  if r == 0 or n == r:
    return 1
  return combi(n-1, r-1) + combi(n-1, r)

n, a, b = map(int, input().split())
items = sorted(map(int, input().split()), reverse=True)
max_ave_list = items[:a]
print(sum(max_ave_list)/len(max_ave_list))

m = max_ave_list.count(max_ave_list[-1])
l = items.count(max_ave_list[-1])
if l == m:
  print(1)
elif max_ave_list[0] != max_ave_list[-1]:
  print(combi(l, m))
else:
  print(sum(combi(l, k) for k in range(m, min(b, l) + 1)))

Submission status: Runtime Error

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

a = []
b = []

for i in range(n):
    tmp1, tmp2 = list(map(int, input().split()))
    a.append(tmp1)
    b.append(tmp2)

c = []
d = []

for i in range(m):
    tmp1, tmp2 = list(map(int, input().split()))
    c.append(tmp1)
    d.append(tmp2)

for i in range(n):
    tmp = abs(a[n] - c[0]) + abs(b[n] - d[0])
    s = 1
    for j in range(m):
        tmp3 = abs(a[i] - c[j]) + abs(b[i] - d[j])
        if tmp3 < tmp:
            tmp = tmp3
            s = j + 1
    print(s)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
stu = []
check = []
for i in range(n):
    stu.append(list(map(int, input().split())))

for i in range(m):
    check.append(list(map(int, input().split())))


ans = []

for i in range(n):
    dist = []
    for j in range(m):
        tmp = abs(stu[i][0] - check[j][0]) + abs(stu[i][1] - check[j][1])
        dist.append(tmp)
    mi = dist.index(min(dist))
    ans.append(mi)


for i in range(len(ans)):
    print(ans[i] + 1)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
stu = []
check = []
for i in range(n):
    stu.append(list(map(int, input().split())))

for i in range(m):
    check.append(list(map(int, input().split())))


ans = []

for i in range(n):
    dist = []
    for j in range(m):
        tmp = abs(stu[i][0] - check[j][0]) + abs(stu[i][1] - check[j][1])
        dist.append(tmp)
    mi = dist.index(min(dist))
    ans.append(mi)


for i in range(len(ans)):
    print(ans[i] + 1)

Submission status: Runtime Error

Solution code:
a, b = input().split()
c = (a + b) % 24
print(c)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
s = []
d = []
for i in range(n):
    x, y = map(int, input().split())
    s.append([x, y])
for i in range(m):
    x, y = map(int, input().split())
    d.append([x, y])
for i in s:
    a = m
    c = abs(i[0] - d[0][0]) + abs(i[1] - d[1][1])
    for j in range(1, m):
        c_t = abs(i[0] - d[j][0]) + abs(i[1] - d[j][1])
        if c_t < c:
            c = min(c, c_t)
            a = j
    print(a)

Submission status: Runtime Error

Solution code:
A,B=map(int,input().split())
print((a + b) % 24)

Submission status: Runtime Error

Solution code:
N,M = list(map(int, input().split()))
 
s = [list(map(int,input().split())) for i in range(n)]
c = [list(map(int,input().split())) for j in range(n)]
 
for t1 in s:
    l = list(map(lambda x: abs(t1[0] - x[0]) + abs(t1[1] - x[1]), c))
    print(l.index(min(l)) + 1)

Submission status: Runtime Error

Solution code:
def digits(num):
    return len(str(num))

N = int(input())
min_d = digits(N)
for i in list(range(2, N, 1)):
    if (N % i == 0):
        min_d = min(digits(i), min_d)

print(min_d)

Submission status: Runtime Error

Solution code:
#! coding: UTF-8
N,A,B = list(map(int,input().split(" ")))
V = list(map(int,input().split(" ")))
V.sort(reverse=True)
max_avr = sum(V[:A]) / A
a_num = V.count(V[A-1])
a_pos = V[:A].count(V[A-1])

#確率統計nCr
import math
def nCr(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n-r)

if V[0] == V[A-1]:
    cnt = sum(nCr(a_num,i) for i in range(A,min(B,a_num))) 
else:
    cnt = nCr(a_num,a_pos)
print("{0:.10f}".format(max_avr))
print(int(cnt))

Submission status: Runtime Error

Solution code:
#! coding: UTF-8
N,A,B = list(map(int,input().split(" ")))
V = list(map(int,input().split(" ")))
V.sort(reverse=True)
max_avr = sum(V[:A]) / A
a_num = V.count(V[A-1])
a_pos = V[:A].count(V[A-1])

#確率統計nCr
import math
def nCr(n,r):
    f = math.factorial
    return f(n) // f(r) // f(n-r)

cnt = 0
if V[0] == V[A-1]:
    while a_pos <= B:
        cnt += nCr(a_num,a_pos)
        a_pos += 1
else:
    cnt = nCr(a_num,a_pos)
print("{0:.10f}".format(max_avr))
print(int(cnt))

Submission status: Runtime Error

Solution code:
#coding:utf-8

AB = raw_input().split()
A = int(AB[0])
B = int(AB[1])

if A+B > 24:
    print (A+B)%24
elif A+B = 24:
    print 0
else:
    print A+B

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
# input
n, m = map(int, input().split())
persons = []
checks = []
for i in range(n):
    point = tuple(map(int, input().split()))
    persons.append(point)
for i in range(m):
    point = tuple(map(int, input().split()))
    checks.append(point)

# print(persons)
# print(checks)
    
def get_distance(person, check):
    return abs(person[0] - check[0]) + abs(person[1] - check[1])
    
for i in range(n):
    min_distance = 10 ** 10
    min_distance_point_num = -1

    # calculate min distance from n to each m
    for j in range(m):
        distance = get_distance(persons[i], checks[j])
        if distance < min_distance:
            min_distance = distance
            min_distance_point_num = j + 1

    print(min_distance_point_num)

Submission status: Runtime Error

Solution code:
#!/usr/bin/evn python3
# input
n, m = map(int, input().split())
persons = []
checks = []
for i in range(n):
    point = tuple(map(int, input().split()))
    persons.append(point)
for i in range(m):
    point = tuple(map(int, input().split()))
    checks.append(point)

# print(persons)
# print(checks)
    
def get_distance(person, check):
    return abs(person[0] - check[0]) + abs(person[1] - check[1])
    
for i in range(n):
    min_distance = 10 ** 10
    min_distance_point_num = -1

    # calculate min distance from n to each m
    for j in range(m):
        distance = get_distance(persons[i], checks[j])
        if distance < min_distance:
            min_distance = distance
            min_distance_point_num = j + 1

    print(min_distance_point_num)

Submission status: Runtime Error

Solution code:
a, b = (int(i) for i in input().split())

Submission status: Runtime Error

Solution code:
a, b = (int(i) for i in input().split())  
print (a+b)%24

Submission status: Runtime Error

Solution code:
a, b=map(int, input().split())
2.c=a+b
3.if c<24:
4.  print (c)
5.elif c>=24:
6.  print (c-24)

Submission status: Runtime Error

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

num = [0 for x in range(N)]
total = [0 for x in range(N)]

for i, v in enumerate(L):
    for j in reversed(range(1, i + 1)):
        new_v = total[j - 1] + v
        if(new_v > total[j]):
            total[j] = new_v
            num[j] = num[j - 1]
        elif(new_v == total[j]):
            num[j] = num[j] + num[j - 1]

    if(v > total[0]):
        total[0] = v
        num[0] = 1
    elif(v == total[0]):
        num[0] = num[0] + 1

print(total)
total = [x / (i + 1) for i, x in enumerate(total)]
total = total[(A - 1):B]
num = num[(A - 1):B]

maxV = max(total)
maxNum = sum([j for i, j in zip(total, num) if i == maxV])
print(maxV)
print(maxNum)

Submission status: Runtime Error

Solution code:
A = 20
B = 6
X = A + B
if(X>= 24):
　　X = X - 24
print(X)

Submission status: Runtime Error

Solution code:
import math

def C(n, r):
	fact = math.factorial
	return fact(n) // fact(r) // fact(n-r)

N, A, B = map(int, input().split())
v = list(map(int, input().split()))

v_sort = sorted(v, reverse=True)

print(sum(v_sort[:A])/A)

a, b = v_sort.count(v_sort[A-1]), v_sort[:A].count(v_sort[A-1])

if v_sort[0] == v_sort[A-1]:
	print(sum([C(a, r) for r in range(A, min(B, a)+1)]))
else:
	print(C(a, b))

Submission status: Runtime Error

Solution code:
 a=9
 b=6
 print(a+b)

Submission status: Runtime Error

Solution code:
#include <stdio.h>

int abs(int j)
{
    return (j>0) ? j : -j;
}

int main()
{
    int N, M, i, j;
    int a[50], b[50], c[50], d[50],;
    int p[50] = {0};

    scanf("%d %d", &N, &M);
    
    for(i=0; i<N; i++)
    {
         scanf("%d %d", &a[i], &b[i]);
    }
    
    for(j=0; j<M; j++)
    {
         scanf("%d %d", &c[j], &d[j]);
    }
    
    for(i=0; i<N; i++)
    {
         for(j=0; j<M; j++)
         {
             if(abs(a[i] - c[j]) + abs(b[i] - d[j]) < abs(a[i] - c[p[i]]) + abs(b[i] - d[p[i]])
             {
                 p[i] = j;
             }
         }
         printf("%d\n", p[i]);
    }
}

Submission status: Runtime Error

Solution code:
l = map(int, input().split())
print((l[0] + l[1]) % 24)

Submission status: Runtime Error

Solution code:
l = map(int, raw_input().split())
print((l[0] + l[1]) % 24)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

import sys
import os

N, M = list(map(int, input().split()))
students = []
checkpoints = []

for i in range(N):
    a, b = list(map(int, input().split()))
    students.append([a, b])

for i in range(M):
    a, b = list(map(int, input().split()))
    checkpoints.append([a, b])

for student in students:
    min_dist = float('inf')
    min_i = None
    for i, checkpoint in enumerate(checkpoints):
        manhattan_dist = abs(checkpoint[0] - student[0]) + abs(checkpoint[1] - student[1])
        if manhattan_dist < min_dist:
            min_dist = manhattan_dist
            min_i = i
    print(min_i + 1)

Submission status: Runtime Error

Solution code:
import sys

if __name__=="__main__":
    ab=[]
    cd=[]
    [n,m]=map(int,raw_input().split(" "))
    for i in range(n):
        ab.append( map(int,raw_input().split(" ")) )
    for j in range(m):
        cd.append( map(int,raw_input().split(" ")) )
    for i in range(n):
        min=sys.maxint
        index=0
        for j in range(m):
            distance = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
            if min > distance :
                min=distance 
                index=j
        print(index+1)

Submission status: Runtime Error

Solution code:
print(A+B/24)

Submission status: Runtime Error

Solution code:
l = input().split()
A = l[0]
B = l[1]
T = A + B
if T < 24:
	print(T)
else:
	print(T-24)

Submission status: Runtime Error

Solution code:
import math

def main():
    N, M = tuple(map(int, input().split(' ')))
    man_list = []
    point_list = []
    for i in range(N):
        man_list.append(tuple(map(int, input().split(' '))))
    for i in range(M):
        point_list.append(tuple(map(int, input().split(' '))))

    result = []
    for i, man in enumerate(man_list):
        a, b = man
        min_ = float('inf')
        for j, point in enumerate(point_list):
            c, d = point
            v = abs(a-c)+ abs(b-d)
            if len(result) < i+1:
                min_ = v
                result.append(j+1)
                continue
            if v < min_:
                result[i] = j+1
                min_ = v


    for r in result:
        print('{}'.format(r))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    A, B = tuple(map(int, raw_input().split(' ')))
    print('{}'.format((A+B)%24))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    A, B = raw_input().split(' ')
    print('{}'.format((A+B)%24))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:

def main():
    A, B = raw_input()
    print('{}'.format((A+B)%24))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
if __name__ == "__main__":
    times = [int(time) for time in input().split()]
    print((A+B)%24)

Submission status: Runtime Error

Solution code:
a = int(a)
b = int(b)
time = a+b
if time>=24:
    time = time -24

Submission status: Runtime Error

Solution code:
#input a,b

beginning_time = a+b
if beginning_time>12:
    beginning_time = beginning_time - 12
else:
    beginning = beginning

Submission status: Runtime Error

Solution code:
import math
N = int(input())
ans = 10

for i in reversed(range(1,int(math.sqrt(N)) + 1)):
    if N % i == 0:
        A = len(str(i))
        B = len(str(N //  i))
        print (N // i)
        ans = min(ans,max(A,B))

print(ans)

Submission status: Runtime Error

Solution code:
A,B = int(input().split())
print(A+B)

Submission status: Runtime Error

Solution code:
def distance(p1,p2):
    return abs(p1[0]-p2[0])+abs(p1[1]-p2[1])

M,N=[int(x) for x in input().split()]

student=[]
check=[]
for i in range(0,M):
    a,b=[int(x) for x in input().split()]
    student.append((a,b))

for j in range(0,N):
    c,d=[int(x) for x in input().split()]
    check.append((c,d))


for i in range(0,M):
    dist=distance(student[i],check[N-1])
    num=N-1
    for j in range(0,N):
        k=N-j-1
        if dist>=distance(student[i],check[k]):
            dist=distance(student[i],check[k])
            num=k
    print(num+1)

Submission status: Runtime Error

Solution code:
import math
n = int(input())
nn = int(math.sqrt(n))
while n%nn != 0: nn-=1
ans = len(str(n/nn))
print(ans)

Submission status: Runtime Error

Solution code:
import math
n = int(input())
nn = int(math.sqrt(n))
for i in range(nn,0,-1):
    if n%i==0:
        print(len(str(n//i)))
        break

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import math
N, A, B = map(int, input().split())
V = list(map(int, input().split()))
V.sort(reverse=True)
maxavg = sum(V[:A])/A
print(maxavg)
min = V[A-1]
ltAnum = 0
minnum = 0
for i in range(N):
    if V[i] > min:
        ltAnum = ltAnum + 1
    elif V[i] == min:
        minnum = minnum + 1
    else:
        break
#print(ltAnum)
#print(minnum)

import math
def nCr(n,r):
    f = math.factorial
    return f(n)//f(r)//f(n-r)

c_min = 0
import itertools
if ltAnum > 0:
    c_min = nCr(minnum, A-ltAnum)
if ltAnum == 0:
    for j in range(A, B+1):
        if minnum < j:
            break
        else:
            c_min = c_min + nCr(minnum, j)
print(c_min)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
N, M = map(int, input().split())
students = []
checkpoints = []
for i in range(N):
    students.append(list(map(int, input().split())))
#print(students)
for i in range(M):
    checkpoints.append(list(map(int, input().split())))
#print(checkpoints)
for i in range(N):
    mincp = -1
    mindist = -1
    for j in range(M):
        dist = abs(students[i][0]-checkpoints[j][0]) + abs(students[i][1]-checkpoints[j][1])
        if mincp == -1:
            mincp = j
            mindist = dist
        else:
            if dist < mindist:
                mindist = dist
                mincp = j
    print("%d" % (mincp+1))

Submission status: Runtime Error

Solution code:
N = int(raw_input())
t = 1

for i in xrange(1, N):

    if i*i > N:
        break

    elif i*i == N:
        t = i
        break

    if N % i == 0:
        t = i

print len(str(N/t))

Submission status: Runtime Error

Solution code:
a, b = map(int, split.input())
print((a+b)%24)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python

import math

n=int(raw_input().strip())
N=int(math.ceil(math.sqrt(float(n))))
a=[]
for i in range(1,N+1):
    if n%i==0:
        a.append(i)
A=max(a)
B=int(n/A)
A_keta=len(map(int,str(A)))
B_keta=len(map(int,str(B)))
F=max(A_keta,B_keta)
print F

Submission status: Runtime Error

Solution code:
from itertools import combinations
N,A,B = [int(i) for i in input().split()]

v = [int(i) for i in input().split()]
v.sort()

if v[-A] != v[-A-1]:
    print(sum(v[-A:]) / A)
    print(1)
elif v[-1] :
    # AAと同じ数のカウント
    # Aよりも大きい数のカウント
    cnt = 0
    bigger = 0
    for i in range(N):
        if v[A] < v[i]:
            bigger += 1
        if v[i] == v[A]:
            cnt += 1

    ans = 0
    mini = min(B, cnt+bigger)
    for i in range(A,mini):
        ans += len(list(combinations(range(cnt), i - bigger)))

    print(sum(v[-A:]) / A)
    print(ans)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python

nm = [int(i) for i in input().split()]
n = nm[0]
m = nm[1]

student = list()
point = list()

for i in range(n):
    student.append([int(a) for a in input().split()])

for j in range(m):
    point.append([int(b) for b in input().split()])


mat = [[abs(student[i][0]-point[j][0]) + abs(student[i][1]-point[j][1]) for j in range(m)] for i in range(m)]

for i in range(n):
    print(mat[i].index(min(mat[i]))+1)

Submission status: Runtime Error

Solution code:
import itertools
 
N, A, B = map(int, raw_input().split())
 
v = map(int, raw_input().split())
 
resultValue = 0
resultCount = 0
 
for pcs in range(B - A + 1):
    perm = list(itertools.combinations(v, B + pcs))
    for cand in perm:
        average = float(sum(cand)) / len(cand)
        if resultValue < average:
            resultValue = average
            resultCount = 1
        elif resultValue == average:
            resultCount += 1
 
print(resultValue)
print(resultCount)

Submission status: Runtime Error

Solution code:
import sys
import math

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func()
    top_str = input_raw.strip().split()
    [N] = [int(top_str[0])]

    min_F = sys.maxint
    digit = int(math.log10(N) + 1)
    for i in range(10 ** int((digit - 1)/2.0 + 0.5) , 0 , -1):
        if(N % i == 0):
            A = i
            B = N/i
            F = max(int(math.log10(A) + 1), int(math.log10(B) + 1))
            if F < min_F:
                min_F = F
            #break
    print min_F



if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n = int(input())

def prime_decomposition(n):
    # 素因数分解
    if n < 2:
        return []
    prime_factors = []
    while n % 2 == 0:
        prime_factors.append(2)
        n >>= 1

    while n % 3 == 0:
        prime_factors.append(3)
        n //= 3

    a = 5
    b = 7
    while a ** 2 <= n:
        if n % a == 0:
            prime_factors.append(a)
            n //= a
        elif n % b == 0:
            prime_factors.append(b)
            n //= b
        else:
            a += 6
            b += 6
    if n > 1:
        prime_factors.append(n)
    return prime_factors

pfs = prime_decomposition(n)
pfs.reverse()

def ds(n):

    ret = 1
    while 10**ret <= n:
        ret += 1
    return ret

ln = len(pfs)
size = 2**ln

min_v = 100
for i in range(size):
    p = 1
    for j in range(ln):
        if 1<<j & i:
            p *= pfs[j]
    min_v = min(min_v, max(ds(p), ds(n//p)))
print(min_v)

Submission status: Runtime Error

Solution code:
import numpy as np
N, M = map(int, input().split())
list_coStu = []
list_coChe = []
for i in range(N):
    list_coStu.append(list(map(int, input().split())))
for i in range(M):
    list_coChe.append(list(map(int, input().split())))

#calc distance

for iS in range(len(list_coStu)):
    coStu = np.array(list_coStu[iS])
    min_iC = 0
    d = 4 * 10**8 + 1
    for iC in range(len(list_coChe)):
        coChe = np.array(list_coChe[iC])
        dif = coChe - coStu
        dist = np.sum(np.abs(dif))
        if dist < d:
            min_iC = iC
            d = dist
    print(min_iC + 1)

Submission status: Runtime Error

Solution code:
import math

N, M = map(int, raw_input().split())
a = []
for i in range(N+M):
    a.append(map(int, raw_input().split()))

b=[]

def mhtn(a,b,c,d):
    return 

for i in range(N):
    best=4*10e8
    num=0
    for j in range(M):
        x=math.fabs(a[i][0]-a[N+j][0])+math.fabs(a[i][1]-a[N+j][1])
        
        if(best>x):
            best=x
            num=j+1
    b.append(num)

for i in b:
    print i

Submission status: Runtime Error

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

a = []
c = []
for i in range(0, N + M):
    s = list(map(int, input().split()))
    if  i < N:
        a.append(s)
    else:
        c.append(s)

for i in range(0, N):
    min_idx = 0
    min_dis = 999999999999
    for j in range(0, M):
        dis = abs(a[i][0] - c[j][0]) + abs(a[i][1] - c[j][1])
        if min_dis > dis:
            min_dis = dis
            min_idx = j + 1
    print(str(min_idx))

Submission status: Runtime Error

Solution code:
import math
def digit(X):
    d = 0
    while X:
        X //= 10
        d += 1
    return d

def F(A, B):
    return max(digit(A), digit(B))

N = int(input())

min_F = 20
max_div = round(math.sqrt(N))
for i in range(1, max_div):
    if N % i == 0:
        f = F(i, N/i)
        if f < min_F:
            min_F = f
print(min_F)

Submission status: Runtime Error

Solution code:
import math

N=int(raw_input())

n=math.floor(math.sqrt(N))

while(N%n!=0): n-=1

m=N/n
n=int(n)
m=int(m)

if n>=m:
    print len(str(n))
else:
    print len(str(m))

Submission status: Runtime Error

Solution code:
import math
n=int(raw_input())
sq=math.sqrt(n)
ans=None



if str(sq)[-2]=='.':
    print len(str(sq))-2
else:
    nu=[]
    while sq>1:
        sq=int(sq)
        if n%sq==0:
            nu.append(str(sq))
            nu.append(str(n/sq))
            sq-=1
            break
        else:
            sq-=1
    if len(nu)!=0:
        nu.sort()
        print len((nu[1]))
    else:
        print len(str(n))

Submission status: Runtime Error

Solution code:
A = int(input())
B = int(input())
C = A + B 
if C >= 24:
    C -= 24
print(C)

Submission status: Runtime Error

Solution code:
a, b = int(input().split())
c = a + b
if c <= 24:
    print(c)
else:
    print(c - 24)

Submission status: Runtime Error

Solution code:
a, b = int(input().split())
print(a)
c = a + b
if c <= 24:
    print(c)
else:
    print(c - 24)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-


def main():
    a, b = [int(e) for e in input().split()]
    answer = (a + b) % 23
    return answer


print((main())

Submission status: Runtime Error

Solution code:
l = raw_input().split()

time=(l[0]+l[1])%24

print time

Submission status: Runtime Error

Solution code:
print(sum(map(int, raw_input().split()))%24)