problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p03426
u557437077
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['h, w, d = [int(i) for i in input().split()]\na = [[int(j)-1 for j in input().split()] for i in range(h)]\n\nq = int(input())#moving num\nl = [0 for i in range(q)]#start number\nr = [0 for i in range(q)]#finish number\n\nfor i in range(q):\n tmp = input().split()\n l[i]=int(tmp[0])-1\n r[i]=int(tmp[1])-1\nloc...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s522386109', 's957214303', 's718695326']
[27692.0, 27148.0, 38804.0]
[592.0, 2105.0, 627.0]
[783, 830, 1360]
p03426
u585704797
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['H, W, D=[int(x) for x in str(input()).split()]\nA=[[0 for x in range(W+1)]]\nfor i in range(1,H+1):\n b=[0]\n b+=[int(x) for x in str(input()).split()]\n A.append(b)\nQ=int(input())\nLR=[[0 for x in range(3)]]\nfor i in range(1,Q+1):\n b=[0]\n b+=[int(x) for x in str(input()).split()]\n LR.append(b)\n\n\n\n\n\n...
['Wrong Answer', 'Accepted']
['s389205658', 's523652765']
[50132.0, 48400.0]
[1004.0, 993.0]
[1347, 1327]
p03426
u595289165
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['import numpy as np\nh, w, d = map(int, input().split())\na = np.array([list(map(int, input().split())) for _ in range(h)])\nq = int(input())\nnum = h * w\nmass = np.array([[0, 0] for _ in range(num + 1)])\nmp = []\nfor i in range(h):\n for j in range(w):\n a_ij = a[i][j]\n mass[a_ij] = [i, j]\nfor i ...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s146964313', 's333789490', 's378789282', 's501773723', 's566782847', 's632214927', 's682199000', 's974574496', 's775704205']
[29992.0, 12512.0, 23232.0, 27752.0, 14444.0, 29516.0, 21872.0, 30448.0, 15548.0]
[1970.0, 148.0, 2109.0, 164.0, 148.0, 509.0, 192.0, 2109.0, 1681.0]
[478, 460, 520, 501, 460, 338, 460, 600, 463]
p03426
u595952233
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
["h, w, d = map(int, input().split())\na = []\nfor i in range(h):\n a+=list(map(int, input().split()))\nn = len(a)\nq = int(input())\nmax_dbl_line = 10\n\ndef dist(i, j):\n dw = abs(i%w - j%w)\n dh = abs(i//w - j//w)\n return dw + dh\n\nidx_table = [0] * n\nfor i in range(n):\n idx_table[a[i]-1] = i\n\n\...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s004259599', 's316804302', 's451193724', 's593472538', 's985850918']
[23432.0, 23488.0, 23420.0, 20640.0, 19940.0]
[2206.0, 2206.0, 2206.0, 2206.0, 277.0]
[1195, 1195, 1200, 1194, 638]
p03426
u604262137
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['import numpy as np\nH, W, D = input().split()\nH, W, D = int(H), int(W), int(D)\n\npx, py = np.zeros(H*W+1), np.zeros(H*W+1)\nfor i in range(H):\n A = input().split()\n for j in range(W):\n px[int(A[j])] = i\n py[int(A[j])] = j\n\nd = np.zeros(H*W+1)\nfor i in range(D+1, H*W+1):\n d[i]= d[i-D]+...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s101506991', 's668911383', 's003189530']
[17212.0, 12396.0, 19996.0]
[1736.0, 150.0, 1143.0]
[458, 448, 469]
p03426
u604693716
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['line = input().split(" ")\na = list(map(int, line))\ndata = [0] * 90001\nans = 0\nfor i in range(0, a[0]):\n line = input().split(" ")\n temp = list(map(int, line))\n for j in range(0, a[1]):\n data[temp[j]] = [i, j]\n\nmemo = [0] * 90001\n\nfor i in range(0, a[0] * a[1]):\n if i < a[2]:\n m...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s335523337', 's407624899', 's702309422', 's551325308']
[13552.0, 17084.0, 13552.0, 17084.0]
[909.0, 1068.0, 937.0, 1024.0]
[567, 572, 571, 571]
p03426
u610385881
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['H, W, D = map(int, input().split())\n\nA = [list(map(int, input().split())) for i in range(H)]\nrA = [[0 for j in range(2)] for i in range(H * W + 1)]\nS = [0 for i in range(H * W + 1)]\nfor i in range(H):\n\tfor j in range(W):\n\t\trA[A[i][j]][0] = i\n\t\trA[A[i][j]][1] = j\n\nQ = int(input())\nfor i in range(Q):\n\...
['Runtime Error', 'Accepted']
['s697711730', 's845809807']
[3064.0, 23536.0]
[17.0, 1496.0]
[616, 640]
p03426
u617515020
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['H,W,D=map(int,input().split())\nA=[list(map(int,input().split())) for _ in range(H)]\nQ=int(input())\nLR=[list(map(int,input().split())) for _ in range(Q)]\n\nc=[None]*(H*W)\nfor i in range(H):\n for j in range(W):\n c[A[i][j]-1] = (i, j)\n\nd=[0]*(H*W)\nfor i in range(D, H*W):\n px,py = c[i-D]\n x, y = c[i]\n ...
['Runtime Error', 'Accepted']
['s139552096', 's564750201']
[41252.0, 36460.0]
[318.0, 385.0]
[375, 389]
p03426
u620868411
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['# coding=utf-8\nline = input().split(" ")\nh = int(line[0])\nw = int(line[1])\nd = int(line[2])\n\ntable = [0 for _ in range(h*w+1)]\nfor hi in range(h):\n line = list(map(int, input().split(" ")))\n\n for wi in range(w):\n table[line[wi]] = (hi+1, wi+1)\n\ndef calc(l,r):\n ret = 0\n if l!=r:\n ...
['Wrong Answer', 'Accepted']
['s231665096', 's952359427']
[16428.0, 44780.0]
[937.0, 411.0]
[700, 426]
p03426
u631277801
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['import sys\nstdin = sys.stdin\n \nsys.setrecursionlimit(10**5) \n \ndef li(): return map(int, stdin.readline().split())\ndef li_(): return map(lambda x: int(x)-1, stdin.readline().split())\ndef lf(): return map(float, stdin.readline().split())\ndef ls(): return stdin.readline().split()\ndef ns(): return stdin.readlin...
['Runtime Error', 'Runtime Error', 'Accepted']
['s035489537', 's495064423', 's886250797']
[41156.0, 41160.0, 41276.0]
[238.0, 235.0, 487.0]
[1049, 1059, 1034]
p03426
u640303028
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['b = str(input()).split()\nh = int(b[0])\nw = int(b[1])\nd = int(b[2])\nc =[]\n\ndef abs(a,b):\n if a > b:\n return(a-b)\n else:\n return(b-a)\n\nfor i in range(0,h):\n c.append(str(input()).split())\n\nq = int(input())\nlr = []\nenergy = 0\n\n\n\nfor i in range(0,q):\n lr.append(str(input())...
['Runtime Error', 'Accepted']
['s288587809', 's322384212']
[38676.0, 35192.0]
[2106.0, 607.0]
[732, 602]
p03426
u650950012
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
["h, w, d = map(int, input().split(' '))\nq = int(input())\nlr = [map(int, input().split(' ')) for _ in range(q)]\n\ncomp = {}\nfor i in range(h):\n tmp = list(map(int, input().split(' ')))\n for j in range(w):\n comp[tmp[j]] = [i, j]\n\ndp = [0] * (h * w + 1)\nfor i in range(d + 1, h * w + 1):\n cnt = ...
['Runtime Error', 'Accepted']
['s466778865', 's912804037']
[3064.0, 71184.0]
[18.0, 739.0]
[470, 471]
p03426
u658993896
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['H,W,D=list(map(int,input().split()))\narr=[0 for i in range(H*W+1)]\nfor y in range(H):\n for x,n in enumerate(map(int,input().split())):\n arr[n]=[x,y]\n\ndic={}\n\nQ=int(input())\nfor i in range(Q):\n ans=0\n now,goal= list(map(int,input().split()))\n nx=arr[now][0]\n ny=arr[now][1]\n tmp=n...
['Wrong Answer', 'Accepted']
['s170519336', 's631914359']
[241812.0, 17664.0]
[2113.0, 1680.0]
[718, 408]
p03426
u667024514
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['import math\nh,w,d = map(int,input().split())\na = [list(map(int,input().split())) for i in range(h)]\nlis = [[0,0] for i in range(h * w)]\nnum = [[0] * math.ceil((h * w) // d + 1) for i in range(d)]\n\nfor i in range(h):\n for j in range(w):\n lis[a[i][j]-1] = [i,j]\n\nfor i in range(h * w-d):\n num[i%d...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s026514738', 's559519000', 's945798059', 's752813781']
[25712.0, 15860.0, 25712.0, 25712.0]
[2108.0, 67.0, 2105.0, 1119.0]
[576, 632, 608, 645]
p03426
u676264453
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['H, W, D = list(map(int, input().split()))\n \ndic = {}\nfor i in range(H):\n for j,v in enumerate(list(map(int, input().split()))):\n dic[v] = (i,j)\n \nQ = int(input())\n \nQs = []\nmi = 100000\nma = 1\nfor i in range(Q):\n l,r = list(map(int, input().split()))\n Qs.append((l,r))\n mi = min(mi, l)...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s043049094', 's047474991', 's107991248']
[36144.0, 33240.0, 36288.0]
[694.0, 480.0, 712.0]
[594, 396, 592]
p03426
u711539583
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['import sys\ninput = sys.stdin.readline\nh, w, d = map(int, input().split())\na = {}\nl = list(range(h * w))\nfor i in range(h):\n for j, x in enumerate(input().split()):\n a[int(x)] = (i, j)\nmemo = {}\ndef calc(s):\n tmp = 0\n memo(a[s]) = 0\n for xc, xn in zip(l[s::d], l[s+d::d]):\n xc, yc = a[xc]\n xn...
['Runtime Error', 'Accepted']
['s890911583', 's226975796']
[3064.0, 38200.0]
[17.0, 454.0]
[509, 514]
p03426
u763034939
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['H,W,D = map(int, input().split())\narr = [0]*(H*W)\nfor i in range(H):\n for j , v in enumerate(map(int, input().split())):\n arr[v-1] = (i,j)\nprint(arr) \nX = [[] for _ in range(D)]\nY = [[] for _ in range(D)]\nfor i , (x,y) in enumerate(arr):\n if i // D == 0:\n X[i%D].append(0)\n ...
['Wrong Answer', 'Accepted']
['s282973258', 's584981161']
[32304.0, 31304.0]
[1262.0, 1222.0]
[662, 643]
p03426
u785578220
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['N, W ,D = map(int, input().split())\ninf = float("inf")\ndp = [0]*(N*W)\ns = [inf]*N*W\n\nd = [list(map(int, input().split())) for i in range(N)]\nT = int(input())\nm = [list(map(int, input().split())) for i in range(T)]\nans = 0\n \nfor i in range(N):\n for j in range(W):\n s[d[i][j]-1] = [i,j]\nk=0\n#prin...
['Wrong Answer', 'Accepted']
['s514792578', 's794176684']
[42808.0, 42248.0]
[683.0, 645.0]
[490, 492]
p03426
u786020649
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['import sys\nreadline=sys.stdin.readline\nread=sys.stdin.read\n \nh,w,d=map(int,readline().split())\na=[list(map(int,readline().split())) for _ in range(h)]\nq,*lr=map(int,read().split())\n\nca=dict()\nfor i,l in enumerate(a):\n for j,e in enumerate(l):\n ca[e]=(i+1,j+1)\nmp=[[0]*((h*w)//d+1) for _ in range(d)]\nf...
['Wrong Answer', 'Accepted']
['s718253513', 's204974185']
[40428.0, 40576.0]
[2206.0, 316.0]
[565, 566]
p03426
u787456042
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['H,W,D=map(int,input().split());S=H*W;A=[map(int,input().split())for _ in range(H)];Q,*L=open(0);d=[0]*S;e=[0]*S\nfor i,l in enumerate(A):\n for j,v in enumerate(l):d[v-1]=(i,j)\nfor i in range(S):\n if i>=D:e[i]=sum(abs(p-q)for p,q in zip(d[i-D],d[i]))+e[i-D]\nfor i in L:l,r=map(int,i.split());print(e[r-1]-e[l-1])', ...
['Runtime Error', 'Accepted']
['s915845342', 's494979822']
[23608.0, 22612.0]
[392.0, 1066.0]
[310, 250]
p03426
u798818115
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['# coding: utf-8\n# Your code here!\n\n\nH,W,D=map(int,input().split())\n\nA=[]\nfor i in range(H):\n A.append(list(map(int,input().split())))\n\nloc=[[0,0] for i in range(W*H)]\n\n#print(loc)\n\nfor i in range(H):\n for j in range(W):\n loc[A[i][j]-1][0]=i\n loc[A[i][j]-1][1]=j\n #print(loc...
['Runtime Error', 'Accepted']
['s952939659', 's707316693']
[26528.0, 25700.0]
[253.0, 1082.0]
[657, 851]
p03426
u815878613
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['from collections import defaultdict\n\nH, W, D = list(map(int, input().split()))\nA = [list(map(int, input().split())) for _ in range(H)]\nQ = int(input())\nLR = [list(map(int, input().split())) for _ in range(Q)]\n\n# 1 -> 1+D ->\n# 2 -> 2+D ->\n\n\n\n\nd = defaultdict(list)\nfor i in range(H):\n for j in range(W...
['Wrong Answer', 'Accepted']
['s530137226', 's243966851']
[60184.0, 60428.0]
[409.0, 488.0]
[799, 789]
p03426
u827951256
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['n,m,d = map(int, input().split())\n\ngrid = []\n\nbuf = {}\n\nfor j in range(n):\n grid.append(list(map(int, input().split())))\n for k in range(len(grid[j])):\n buf[grid[j][k]] = (j,k)\nq = int(input())\nal = []\n\ncost = [0] * ((n*m)+1)\n\nfor i in range(d+1,n*m):\n cost[i] = cost[i-d] + abs(buf[i-d...
['Wrong Answer', 'Accepted']
['s197659388', 's683366902']
[40716.0, 39976.0]
[594.0, 615.0]
[517, 508]
p03426
u860002137
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['import numpy as np\nfrom numba import njit, i8\n\nh, w, d = map(int, input().split())\narr = np.zeros([h, w], dtype=np.int64)\n\nfor i in range(h):\n arr[i] = list(map(int, input().split()))\n\nq = int(input())\nlr = np.zeros([q, 2], dtype=np.int64)\n\nfor i in range(q):\n lr[i] = list(map(int, input().split())...
['Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s714649305', 's815127154', 's550351735']
[133892.0, 37060.0, 45864.0]
[2209.0, 2206.0, 407.0]
[894, 776, 715]
p03426
u870092796
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['H,W,D=list(map(int,input().split()))\nX=[(0,0) for i in range(H*W+1)]\n\nfor i in range(1,H+1):\n\tA=list(map(int,input().split()))\n\tfor idx,a in enumerate(A):\n\t\tX[a]=(i,idx+1)\n\nQ=int(input())\nL=[]\nR=[]\nS=[0]*(H*W+1)\n\nfor i in range(Q):\n\tl,r=list(map(int,input().split()))\n\tL.append(l)\n\tR.append(r)\n...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s806078247', 's825603139', 's391294199']
[26264.0, 22248.0, 22248.0]
[585.0, 546.0, 568.0]
[439, 421, 426]
p03426
u879870653
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['H,W,D = map(int,input().split())\nA = [list(map(int,input().split())) for i in range(H)]\nQ = int(input())\nLR = [list(map(int,input().split())) for i in range(Q)]\n\nPoint = {}\nfor y in range(H) :\n for x in range(W) :\n Point[A[y][x]] = (y, x)\n\ndef dist (y1,x1,y2,x2) :\n return abs(y1-x1) + abs(y2-x...
['Wrong Answer', 'Accepted']
['s255969955', 's082115804']
[46336.0, 22620.0]
[2106.0, 945.0]
[497, 465]
p03426
u896741788
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['import sys\ninput=sys.stdin.buffer.readline\ninputs=sys.stdin.buffer.readlines\nsys.setrecursionlimit(10**9)\nh,w,d=map(int,input().split())\ninds={}\nfor i in range(h):\n for D,j in enumerate(input().split()):\n inds[int(j)-1]=(i,D)\nnows=[[0]for c in range(d)]\n\nfor k in range(d,h*w):\n a,b=inds[k]\n ...
['Wrong Answer', 'Accepted']
['s372939479', 's136548269']
[36936.0, 36940.0]
[322.0, 307.0]
[540, 524]
p03426
u904804404
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n"""\nCreated on Fri Mar 23 11:18:48 2018\n\n@author: natsukiiwano\n"""\n\n_in_ = list(map(int,input().split(" ")))\nH,W,D = _in_[0],_in_[1],_in_[2]\ndic = {}\nfor h in range(H):\n _in_ = list(map(int,input().split(" ")))\n for w in range(W):\n dic[_in_[w]]...
['Wrong Answer', 'Accepted']
['s166903007', 's828851267']
[23004.0, 16072.0]
[2104.0, 1319.0]
[686, 606]
p03426
u916637712
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['import numpy as np\nin1=list(map(int,input().split(" ")))\n#print(in1)\n\nd={}\nfor i in range(in1[0]):\n #arr[i]=input().split(" ")\n for n,k in enumerate(input().split(" ")):\n d[int(k)]=[i,n]\n#print(arr)\nQ=int(input())\ntest=[]\nout=[]\nroute=[]\nfor k in range(Q):\n ans=0\n start,end=list(map...
['Runtime Error', 'Accepted']
['s069256089', 's691770861']
[41720.0, 55856.0]
[1151.0, 934.0]
[933, 691]
p03426
u920299620
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['H,W,D=map(int,input().split())\ndata=[]\nfor i in range(1,H+1):\n tmp=list(map(int,input().split()))\n for j in range(1,W+1):\n data.append([i,j,tmp[j-1]])\n\ndata.sort(key=lambda x:x[2])\n\nruiseki=[]\nfor i in range(D):\n tmp=[0]\n j=i+D\n while(j<H*W):\n tmp.append( abs(data[j][0]-data...
['Runtime Error', 'Accepted']
['s851628338', 's324335535']
[25188.0, 25316.0]
[425.0, 1118.0]
[523, 566]
p03426
u934868410
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['h,w,d = map(int,input().split())\np = [(0,0)] * (h*w)\nc = [0] * (h*w)\nfor i in range(h):\n a = list(map(int,input().split()))\n for j in range(w):\n p[a[j]-1] = (i,j)\n\nfor i in range(d, h*w):\n c[i] = c[i-d] + abs(p[i][0] - p[i-d][0]) + abs(p[i][1] - p[i-d][1])\n\nq = int(input())\nans = 0\nfor i in range(q...
['Runtime Error', 'Accepted']
['s655178125', 's392310556']
[13444.0, 14336.0]
[176.0, 943.0]
[372, 365]
p03426
u941884460
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
["tmp =input().split()\nH,W,D=int(tmp[0]),int(tmp[1]),int(tmp[2])\n\nlist = [[0 for x in range(W)] for y in range(H)]\ndict = {}\nfor i in range(H):\n tmp = input().split()\n for d in range(W):\n dict[tmp[d]] = str(i)+' '+str(d)\nresult ={}\ncost ={}\ndef calcost(L,R,D):\n if int(R)<D:\n cost[R]=...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s496823099', 's719877828', 's833320441', 's744509520']
[37016.0, 56848.0, 34968.0, 41488.0]
[2104.0, 1347.0, 138.0, 1074.0]
[886, 996, 876, 649]
p03426
u952708174
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['def d_practical_skill_test(H, W, D, A, Q, I):\n import numpy\n a = numpy.array(A)\n tmp = []\n for i in range(D):\n i += 1 + D\n t = [0]\n while i <= H * W:\n j, k = numpy.where(a == i)\n l, m = numpy.where(a == i - D)\n j, k = j[0], k[0]\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s270842060', 's413962680', 's184188172']
[44520.0, 44532.0, 37120.0]
[2110.0, 2110.0, 455.0]
[775, 791, 871]
p03426
u976256337
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['\nH, W, D = map(int, input().split())\n\ncoord_dict_x = [0 for i in range(90001)]\ncoord_dict_y = [0 for i in range(90001)]\n\nfor i in range(H):\n gyo = [int(i) for i in input().split()]\n for j in range(W):\n coord_dict_x[gyo[j]] = i\n coord_dict_y[gyo[j]] = j\n\nQ = int(input())\nexam = [[int(i...
['Runtime Error', 'Accepted']
['s804067018', 's202897792']
[23888.0, 37268.0]
[460.0, 584.0]
[715, 577]
p03426
u977193988
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['import sys\nfrom collections import defaultdict\n\n\ndef input():\n return sys.stdin.readline().strip()\n\n\nsys.setrecursionlimit(20000000)\n\n\ndef main():\n H, W, D = map(int, input().split())\n A = [list(map(int, input().split())) for _ in range(H)]\n M = defaultdict(list)\n for h in range(H):\n ...
['Runtime Error', 'Accepted']
['s957025758', 's682856639']
[26556.0, 34112.0]
[482.0, 488.0]
[1055, 1141]
p03426
u989345508
2,000
262,144
We have a grid with H rows and W columns. The square at the i-th row and the j-th column will be called Square (i,j). The integers from 1 through H×W are written throughout the grid, and the integer written in Square (i,j) is A_{i,j}. You, a magical girl, can teleport a piece placed on Square (i,j) to Square (x,y) by...
['from math import ceil\nh,w,d=map(int,input().split())\nx=ceil((h*w)/d)\nnum=[[[-1,-1] for j in range(x)] for i in range(d)]\nmp=[[0]*x for i in range(d)]\na=[list(map(int,input().split())) for i in range(h)]\nfor i in range(h):\n for j in range(w):\n k,l=a[i][j]%d,a[i][j]//d\n if k==0:\n n...
['Wrong Answer', 'Accepted']
['s248454430', 's099855422']
[35692.0, 35692.0]
[1166.0, 1158.0]
[837, 898]
p03427
u014139588
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n = int(input())\nprint(n//10**(len(str(n))-1))\nif (n//10**(len(str(n))-1)+1)*10**(len(str(n))-1)-1 > n:\n mx = (n//10**(len(str(n))-1))*10**(len(str(n))-1)-1\nelse:\n mx = (n//10**(len(str(n))-1)+1)*10**(len(str(n))-1)-1\nprint(sum(list(map(int,str(mx)))))', 'n = int(input())\nif (n//10**(len(str(n))-1)+1)*10**(l...
['Wrong Answer', 'Accepted']
['s794955734', 's602818702']
[9152.0, 9204.0]
[30.0, 29.0]
[254, 224]
p03427
u027929618
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n=list(map(int,input()))\ns=sum(n)\nk=len(n)\nprint(max(n[0]-1)+9*(k-1),s))', 'n=list(map(int,input()))\ns=sum(n)\nk=len(n)\nprint(max(n[0]-1)+9*(k-1),s)', 'n=list(map(int,input()))\ns=sum(n)\nk=len(n)\nprint(max((n[0]-1)+9*(k-1),s))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s662580136', 's721653450', 's071526038']
[2940.0, 2940.0, 2940.0]
[18.0, 20.0, 17.0]
[72, 71, 73]
p03427
u050428930
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N = list(input())\nprint(N)\nif 1!=len(N):\n if N[1]!=9:\n print(int(N[0])-1+9*(len(N)-1))\n elif N[i+1]==9:\n print(int(N[0])+9*(len(N)-1))\nelse:\n print(N[0])', '3141592653589793', 'def f(s):\n p=0\n for i in str(s):\n p+=int(i)\n return p\nN=int(input())\ni=1\nans=f(N)\nwhil...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s317957986', 's615221667', 's814754683']
[3060.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[176, 16, 199]
p03427
u060793972
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['print(sum([int(i) for i in input()]))', 's=input()\nk=10**(len(s)-1)\nprint(sum(map(int,str(int(s)//k))) if len(s)!=1 else s)', 's=input()\nk=10**(len(s)-1)\n#print(s,str(int(s)//k*k-1))\nprint(sum(map(int,str((int(s)+1)//k*k-1))) if len(s)!=1 else s)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s209683147', 's920839561', 's654729061']
[2940.0, 9132.0, 9112.0]
[17.0, 29.0, 26.0]
[37, 82, 119]
p03427
u064408584
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['def A_Digit_Sum_2():\n a=input()\n b=str(a)\n c=0\n for i in range(len(b)):\n c +=int(b[i])\n print(c)\n\nA_Digit_Sum_2()', "def A_Digit_Sum_2():\n a=input()\n count=0\n c=0\n for i in range(len(a)-1):\n if a[i+1]=='9':\n count+=1\n #print(count)\n if count==(...
['Wrong Answer', 'Accepted']
['s664303857', 's844985524']
[3316.0, 3064.0]
[19.0, 18.0]
[135, 305]
p03427
u086503932
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
["import sys\nimport math\n\ndef main():\n N = int(input())\n digit = int(math.log10(N))\n c = int(str(N)[0])\n if N > int(str(c) + '9'*digit):\n print(9 * digit + c -1)\n else:\n print(9 * digit + c)\n\nif __name__ == '__main__':\n main()", "#!/usr/bin/env python3\nimport sys\nimport ma...
['Wrong Answer', 'Accepted']
['s548375153', 's061873190']
[3060.0, 3188.0]
[18.0, 18.0]
[256, 291]
p03427
u089142196
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N=int(input())\nS=str(N)\nflag=False \n\nfor i in range(1,len(S)):\n #print(i,S[i])\n if S[i]!="9":\n flag=False\n break\nelse:\n flag=True\n\nif flag:\n print(N)\nelse:\n top=int(S[0])-1\n if top==0:\n top_s=""\n else:\n top_s=str(top)\n nokori = str(9)*(len(S)-1)\...
['Wrong Answer', 'Accepted']
['s943317828', 's089534530']
[3188.0, 3064.0]
[19.0, 17.0]
[349, 284]
p03427
u090406054
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n=list(input())\nn_list=[int(i) for i in n]\nif n_list[0]!=1 and set(n_list)!=[9]:\n ans=9*(len(n_list)-1)+n_list[0]-1\n print(ans)\nelif n_list[0]!=1 and set(n_list)==[9]:\n print(9*len(n_list))\nelif n_list[0]+n_list[1]<=9:\n ans=(len(n_list)-1)*9\nelse:\n ans=n_list[0]+n_list[1]-1+9*(len(n_list)-2)\n \n ', ...
['Runtime Error', 'Accepted']
['s626228289', 's339974528']
[9080.0, 9020.0]
[25.0, 28.0]
[303, 155]
p03427
u102960641
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n = input()\nn0 = int(n[0])\nln = len(n)\nif ln == 1:\n print(n0)\nelif n[1:] == "9"*(ln-1):\n print(n0+9*(ln-1))\nelse:\n print(n0+9*(ln-1)-1)\n\nprint("9"*(ln-1))\nprint(n[1:-1])', 'n = input()\nn0 = int(n[0])\nln = len(n)\nif ln == 1:\n print(n0)\nelif n[1:] == "9"*(ln-1):\n print(n0+9*(ln-1))\nelse:\n print...
['Wrong Answer', 'Accepted']
['s549668199', 's935654345']
[3060.0, 2940.0]
[18.0, 18.0]
[172, 139]
p03427
u131453093
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N = input()\n\na = len(N) - 1\nb = int(N[0])\n\nans = (b-1) + 9 * a\n\nif int(str(b) + "9"*a) < int(N):\n print(ans)\nelse:\n ans = b + 9 * a\n print(ans)\n\n', 'N = input()\nans = 0\n\nif N[1:] == "9" * (len(N) - 1):\n ans = int(N[0]) + (9 * (len(N) - 1))\nelse:\n ans = int(N[0]) + 9 * (len(N) - 1) - ...
['Wrong Answer', 'Accepted']
['s881107136', 's588401003']
[9156.0, 9036.0]
[27.0, 25.0]
[154, 155]
p03427
u134019875
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
["n = int(input())\nans = 0\nif len(str(n)) > 2:\n ans += (len(str(n)) - 2) * 9\n X = n // 10 ** (len(str(n)) - 2)\n if str(n % 10 ** (len(str(n)) - 2)).count('9') == len(str(n)) - 2:\n ans += 1\nelse:\n X = n\n if X == 99:\n ans += 1\nif len(str(X)) == 1:\n ans += X\nelse:\n if X % 1...
['Wrong Answer', 'Accepted']
['s544227237', 's510008293']
[3064.0, 9176.0]
[17.0, 25.0]
[385, 150]
p03427
u136395536
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N = input()\np = N[0]\n\nans = 9*(len(N)-1) + (int(p)-1)\nif int(N)>ans:\n ans = int(N)\nprint(ans)', 'N = input()\nnewN = N[1:]\np = N[0]\nnines = newN.count("9")\nif nines == len(newN):\n ans = 9*(len(N)-1) + (int(p))\nelse:\n ans = 9*(len(N)-1) + (int(p)-1)\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s067646206', 's774046834']
[2940.0, 3060.0]
[17.0, 17.0]
[96, 168]
p03427
u148551245
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n = int(input())\na = list(map(int, input().split()))\na.sort(reverse=True)\n\nans = sum(a[1:2*n+1:2])\nprint(ans)\n', 'n = int(input())\na = list(map(int, input().split()))\na.sort(reverse=True)\n\nans = sum(a[1:2*(n+1):2])\nprint(ans)\n', 'x = int(input())\nx += 1\n\nans = 9 * (len(str(x))-1) + int(str(x)[0])-1\npr...
['Runtime Error', 'Runtime Error', 'Accepted']
['s106579881', 's179739906', 's191452125']
[2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0]
[110, 112, 81]
p03427
u151625340
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N = input()\nif len(N) == 1:\n print(int(N))\nelse:\n print(max(sum(list(N)),(len(N)-1)*9+int(N[0])-1))\n', 'N = input()\nif len(N) == 1:\n print(int(N))\nelse:\n print(max(sum([int(i) for i in N]),(len(N)-1)*9+int(N[0])-1))\n']
['Runtime Error', 'Accepted']
['s063973010', 's173570991']
[2940.0, 2940.0]
[18.0, 18.0]
[106, 118]
p03427
u163320134
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n=input()\nans=int(n[0])+(len(n)-1)*9\nprint(ans)', "n=input()\nif len(n)==1:\n print(int(n))\nelse:\n cnt=n[1:].count('9')\n if cnt1==len(n)-1:\n print(int(n[0])+9*(len(n)-1))\n else:\n print(int(n[0])-1+9*(len(n)-1))", "n=input()\nif len(n)==1:\n print(int(n))\nelse:\n cnt=n[1:].count('9')\n if cnt==le...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s565992743', 's968694340', 's293378274']
[2940.0, 3060.0, 2940.0]
[17.0, 17.0, 18.0]
[47, 167, 167]
p03427
u163421511
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['\ndef maxf(n):\n a = list(map(int, list(n)))\n for i, item in enumerate(a):\n if i == 0 and item != 9:\n if a[i+1:] == [9]*(len(a)-1):break\n a[i] -=1\n a[i+1:] = [9]*(len(a)-1)\n break\n elif item != 9:\n a[i-1] -= 1\n a[i:] = [9]*...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s579201409', 's705103653', 's760592737']
[9144.0, 9000.0, 9064.0]
[26.0, 23.0, 30.0]
[379, 327, 375]
p03427
u171065106
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n = int(input())\n\nsum = int(n[0]) + (len(n)-1) * 9\nprint(sum if set(n[1:]) == {"9"} else sum - 1)\n', 'n = input()\n\nsum = int(n[0]) + (len(n)-1) * 9\n\nif len(n) == 1:\n print(n)\nelse:\n print(sum if set(n[1:]) == {"9"} else sum - 1)\n']
['Runtime Error', 'Accepted']
['s947358355', 's374579866']
[9068.0, 9092.0]
[29.0, 27.0]
[98, 133]
p03427
u221345507
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
["N=list(input())\nmark=0\nfor i in range (len(N)):\n if N[i]!='9':\n mark=i\n print (mark)\n break\nif mark==0:\n answer=list((''.join(['9']*(len(N)-1))))\nelse:\n answer=list((''.join(N[:mark-1]+[str(int(N[mark-1])-1)]+['9']*len(N[mark:]))))\n \nanswer_sum=0\nfor j in range (len(answe...
['Wrong Answer', 'Accepted']
['s829217474', 's986043219']
[3064.0, 3064.0]
[20.0, 18.0]
[358, 382]
p03427
u223133214
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
["N=input()\nans=''\nif N[0]!='1':\n for i,n in enumerate(list(N)):\n if n !='9':\n if n == '0':\n key=ans[-1]\n ans.rstrip('90')\n ans+='89'\n ans+='9'*(len(N)-i-2)\n break\n ans+=str(int(n)-1)\n ans+=...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s339206297', 's908870000', 's188848332']
[3064.0, 3064.0, 2940.0]
[17.0, 18.0, 18.0]
[508, 508, 95]
p03427
u227082700
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n=input()\nif len(n)==1:print(n)\nelif n="9"*len(n):print(9*len(n))\nelse:print(9*(len(n)-1)+int(n[0])-1)', 'n=input()\nif len(n)==1:print(n)\nelif n=="9"*len(n):print(9*len(n))\nelif n[1:]=="9"*(len(n)-1):print(int(n[0])+9*(len(n)-1))\nelse:print(9*(len(n)-1)+int(n[0])-1)']
['Runtime Error', 'Accepted']
['s066307713', 's720214343']
[2940.0, 3060.0]
[17.0, 18.0]
[102, 160]
p03427
u241159583
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['s = list(input())\nans = [sum(map(int, s)), 9*(len(s)-1) + int(s[0]-1)]\nprint(max(ans))', 's = list(input())\nans = [sum(map(int, s)), 9 * (len(s) - 1) + int(s[0]) - 1]\nprint(max(ans))']
['Runtime Error', 'Accepted']
['s935769111', 's583775285']
[8992.0, 9068.0]
[28.0, 29.0]
[86, 92]
p03427
u248670337
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n=str(int(input())+1)\nprint(sum(map(int,list(n[0]+[0]*(len(n)-1)))))\n', "n=str(int(input())+1)\nprint(sum(map(int,list(str(int(n[0]+'0'*(len(n)-1))-1)))))"]
['Runtime Error', 'Accepted']
['s697638846', 's687693519']
[2940.0, 2940.0]
[17.0, 17.0]
[69, 80]
p03427
u268793453
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N = [int(x) for x in input()]\nprint(max(sum(N), N[0]-1+9*len(N))', 'N = input()\nN_list = list(str(N))\nsum = 0\n\nfor i in N_list:\n sum += int(i)\n\nprint (sum)', 'N = [int(x) for x in input()]\nprint(max(sum(N), N[0]-1+9*len(N)))', 'N = [int(x) for x in input()]\nprint(max(sum(N), N[0]-1+9*(len(N)-1)))']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s789277089', 's828364989', 's997437424', 's893644367']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[64, 90, 65, 69]
p03427
u269724549
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['m=list(map(int,input().split()))\na=int(m[0])-1+(len(m)-1)*9\ns=sum(m)\nprint(max(s,a))\n', 'm=input()\na=int(m[0])-1+(len(m)-1)*9\nb=0\nfor i in n:\n b+=i\nprint(max(b,a))', 'm=input()\na=int(m[0])-1+(len(m)-1)*9\nb=0\nfor i in n:\n b+=int(i)\nprint(max(b,a))\n', 'm=input()\na=int(m[0])-1+(len(m)-1)*9\nb=0\nfor i ...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s293836302', 's793766069', 's866040287', 's909295340']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 20.0, 17.0]
[85, 75, 81, 81]
p03427
u276204978
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
["N = input()\nl = len(N)\n\ns = '9'*(l-1)\nif N[i::] == s:\n print(int(N[0])+9*(l-1))\nelse:\n print(int(N[0])-1+9*(l-1))", 'N = input()\nl = len(N)\n\nif N[i::] == "9"*(l-1):\n print(int(N[0])+9*(l-1))\nelse:\n print(int(N[0])-1+9*(l-1))', 'N = input()\n\nl = len(N)\nj = "9"*(l-1)\n\nif n[i::] == j:\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s063347762', 's390098780', 's486761119', 's550257883', 's808594448', 's984884013', 's865357534']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0, 17.0, 17.0, 17.0, 18.0]
[119, 113, 120, 113, 113, 114, 113]
p03427
u277429554
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n = input()\nans1=int(n[0])\nfor i in n:\n ans1 += int(i)\nans2=int(n[0])-1+9*(len(n)-1)\nprint(max(ans1,ans2)', 'n = input()\nans1=sum(int(i)for i in n)\nans2=int(n[0])-1+9*(len(n)-1)\nprint(max(ans1,ans2)', 'n = input()\nans1=sum(int(i)for i in n)\nans2=int(n[0])-1+9*(len(n)-1)\nprint(max(ans1,ans2))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s328930221', 's746167023', 's749044751']
[9044.0, 8980.0, 8960.0]
[25.0, 23.0, 28.0]
[106, 89, 90]
p03427
u280978334
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N = input()\ndigit = len(N)\nans=[int(N[0])-1]+[9]*(digit-1)\nprint(ans)\nprint(sum(ans))', 'N = input()\ndigit = len(N)\nif(digit == 1):\n print(int(N))\n\nelif(N[1:] == "9"*(digit-1)):\n print(9*(digit-1)+int(N[0]))\nelse:\n ans=[int(N[0])-1]+[9]*(digit-1)\n print(sum(ans))\n']
['Wrong Answer', 'Accepted']
['s258291453', 's838106481']
[2940.0, 3060.0]
[18.0, 18.0]
[85, 187]
p03427
u293579463
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N = int(input())\nnum = str(N)\nfor i in range(1,len(num)):\n if num[-i] != "9" and 0 < N - (int(num[-i]) + 1) * 10**(i-1):\n N -= (int(num[-i]) + 1) * 10**(i-1)\n num = str(N)\n print(N)\n\nD = 0\nfor digit in str(N):\n D += int(digit)\n\nprint(D)\n', 'N = int(input())\nnum = str(N)\nfor i...
['Wrong Answer', 'Accepted']
['s681255766', 's610300449']
[3060.0, 3060.0]
[17.0, 17.0]
[264, 246]
p03427
u314057689
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['def solve():\n N = list(map(int, list(input())))\n print(N)\n\n res = 0\n for i in range(len(N)):\n tmp = 0\n for j in range(len(N)):\n if j <= i-1:\n tmp += N[j]\n elif j==i:\n tmp += N[j]-1\n else:\n tmp += 9\n ...
['Wrong Answer', 'Accepted']
['s708072460', 's145443594']
[3060.0, 3060.0]
[18.0, 18.0]
[389, 392]
p03427
u319612498
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n=int(input())\nif N<10:\n print(n)\nelse:\n L=list(map(int, list(str(N))))\n if(L.count(9)==len(L)) or (L[0]!=9 and L.count(9)==len(L) -1):\n print(sum(L))\n else :\n print(9*(len(L)-1)+int(L[0])-1)\n', 'if n<10:\n print(n)\nelse:\n L=list(map(int, list(str(n))))\n if(L.count(9)==len(L)) or (L[0]!=9 and...
['Runtime Error', 'Runtime Error', 'Accepted']
['s653665809', 's741948455', 's030931978']
[3060.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0]
[202, 188, 203]
p03427
u325264482
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N = int(input())\n\n\ndef digitSum(n):\n s = str(n)\n array = list(map(int, list(s)))\n return sum(array)\n\nmin_sum = 1000000\nfor i in range(N - 1):\n A = i + 1\n B = N - A\n tmp = digitSum(A) + digitSum(B)\n if tmp < min_sum:\n min_sum = tmp\n\nans = min_sum\nprint(ans)\n', 'S = input()...
['Wrong Answer', 'Accepted']
['s550453904', 's997813914']
[3060.0, 3060.0]
[2104.0, 18.0]
[299, 307]
p03427
u344122377
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n = input()\n\nif len(n) == 1:\n print(n)\n exit()\n\nok = False\nans = ""\nfor i, c in enumerate(n):\n x = int(c)\n if x == 9:\n ans += "9"\n else:\n if ok:\n ans += "9"\n else:\n if i == len(n)-1:\n ans = ans[:-1]\n ans += str(int(n[i-1])-1)\n ans += "9"\n else:\n ...
['Wrong Answer', 'Accepted']
['s562877619', 's555153775']
[3064.0, 3064.0]
[17.0, 17.0]
[395, 467]
p03427
u345778634
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N = int(input())\nx = 9\norder = 0\nfor i in range(16):\n if x > N:\n break\n x = x*10+9\n order = i+1\nans = x\nfor i in range(10):\n ans -= 10**order\n print(ans)\n if ans <= N:\n break\nret = 0\nwhile True:\n if ans == 0:\n break\n ret += ans % 10\n ans = ans//10\np...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s158249326', 's698147704', 's787886583']
[9184.0, 9124.0, 9124.0]
[26.0, 2205.0, 35.0]
[307, 306, 292]
p03427
u347640436
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['9999999999999999', 'N = input()\nn = int(N)\nt = n % 10 ** (len(N) - 1) + 1\nprint(max(sum(map(int, N)), sum(map(int, str(n - t)))))\n']
['Wrong Answer', 'Accepted']
['s241544045', 's326169332']
[2940.0, 2940.0]
[17.0, 17.0]
[16, 110]
p03427
u350093546
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
["n=int(input())\nif n<=9:\n print(n)\nelse:\n n=str(n)\n x=n[0]\n x=int(x)-1\n if n[1:].count('9')==len(n-1):\n print(x+1(len(n)-1)*9)\n else:\n print(x+(len(n)-1)*9)\n", "n=int(input())\nif n<=9:\n print(n)\nelse:\n n=str(n)\n x=n[0]\n x=int(x)-1\n if n[1:].count('9')==len(n)-1:\n print(x+1+(len(n...
['Runtime Error', 'Accepted']
['s849267912', 's812735467']
[9184.0, 9184.0]
[25.0, 25.0]
[168, 169]
p03427
u367130284
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['s=input();print(sum(map(int,list(s)or int(s[0])-1+9*(len(s)-1))))', 's=str(int(input())+1);print(int(s[0])+9*len(s)-10)']
['Wrong Answer', 'Accepted']
['s783293726', 's770697619']
[2940.0, 2940.0]
[18.0, 18.0]
[65, 50]
p03427
u368563078
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N = input()\nDig = len(N)\nnum = None\nif Dig == 1:\n print(N)\nelse:\n for i in range(Dig-1):\n if N[i+1] != str(9):\n num = i\n print(num)\n break\n else:\n continue\n list_num = list(N)\n if not num == None:\n target = int(list_num[num]) ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s174363999', 's379523723', 's859334057', 's977920117', 's004831529']
[3064.0, 3064.0, 3064.0, 3060.0, 3064.0]
[18.0, 18.0, 18.0, 17.0, 17.0]
[504, 426, 449, 289, 459]
p03427
u374802266
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n=input()\nl=len(n)\na,b=0,0\nwhile True:\n b+=n[a]\n a+=1\n if a==l:\n break\nprint(b)', 'n=input()\nl=len(n)\na,b=0,0\nwhile True:\n b+=int(n[a])\n a+=1\n if a==l:\n break\nprint(b)\n', 'a=input()\nb=0\nfor i in range(len(a)):\n b+=int(a[i])\nprint(max((len(a)-1)*9+int(a[0])-1,b))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s381043612', 's638560299', 's043789616']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[93, 99, 93]
p03427
u391875425
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
["n = int(input())\nc = None\nres = 0\nfor i in range(1, len(str(n))+1):\n c = '9' * i\n if int(c) <= n:\n continue\n else:\n for j in range(9, 0, -1):\n if int(str(j) + str(c)[1:]) <= n:\n c = str(j) + str(c)[1:]\n break\n break\nfor i in range(len...
['Wrong Answer', 'Accepted']
['s907239005', 's310999521']
[3064.0, 3064.0]
[17.0, 18.0]
[342, 343]
p03427
u404034840
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
["N = int(input())\nlen = len(str(N))\na = list(str(N))\nb =0\nfor i in range(1,len)[::-1]:\n if a[i] == -1:\n a[i] == '9'\n if a[i] != '9':\n b += (int(a[i])+1) * (10**(len-1-i))\n a[i-1] = str(int(a[i-1])-1)\nprint(N-b)", "N = int(input())\nlen = len(str(N))\na = list(str(N))\nb =0\nfor i in range(1,len)[:...
['Wrong Answer', 'Accepted']
['s457441310', 's182493162']
[3064.0, 3064.0]
[17.0, 17.0]
[220, 269]
p03427
u407730443
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['\npattern = "simple"\n\nn = int(input())\n\nif pattern == "simple":\n \n max_sum = -1\n\n for i in range(10**(len(str(n))-1)-1, n+1):\n \n i_parts = []\n for i_part in str(i):\n i_parts.append(int(i_part))\n\n this_sum = sum(i_parts)\n \n if max_sum < this...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s550506959', 's675981294', 's881265688', 's670748920']
[3064.0, 2940.0, 2940.0, 2940.0]
[2104.0, 18.0, 17.0, 17.0]
[636, 115, 183, 94]
p03427
u409306788
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
["import sys\ninput = sys.stdin.readline\n\n\ndef digit_sum(str_num):\n\tsum = 0\t\n\t\n\tfor i in range(len(str_num)):\n\t\tsum += int(str_num[i])\n\t\n\treturn sum\n\n\nN = input()\npatterns = [N]\n\nfor i in range(len(N)-1):\n\tif N[i] != '0':\n\t\tleft, right = '', '' \n\t\t\t\t\n\t\tif i > 0:\n\t\t\tleft = N[:i]\...
['Runtime Error', 'Accepted']
['s010995433', 's822252475']
[3064.0, 3064.0]
[18.0, 17.0]
[487, 488]
p03427
u411923565
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
["N = input()\nN_list = list(N)\nN = int(N)\nK = len(N_list)\n\nans = int(N_list[0])+(K-1)*9\nans_list = [N_list[0]] + ['9' for _ in range(K-1)]\nans_cand = int(''.join(ans_list))\nprint(ans_cand)\nif N < ans_cand:\n print(ans - 1)\nelse:\n print(ans)", "N = input()\nN_list = list(N)\nN = int(N)\nK = len(N_list)\...
['Wrong Answer', 'Accepted']
['s368649619', 's766020244']
[9024.0, 9188.0]
[29.0, 29.0]
[243, 227]
p03427
u413165887
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
["a=list(input())\np=print\nx=len(a)\ny=int(a[0])\nprint(9*x-9+y if all(i=='9' for i in a[1:]) else y+9*(x-1))", "a=list(input());x,y=len(a)-1,int(a[0]);print(9*x+y if all(i=='9'for i in a[1:])else y-1+9*x)"]
['Wrong Answer', 'Accepted']
['s823271317', 's584372914']
[9152.0, 9116.0]
[28.0, 29.0]
[104, 92]
p03427
u419645731
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
["s = input()\nif int(s) < 10: print(s); exit()\n\nans = -1\nfor i in range(len(s)):\n t = s[:i]\n NINE = (len(s)-len(t))\n SUB = 0\n t+= '9' * NINE\n if int(s) < int(t): SUB = int('1' + '0' * NINE)\n t = max(int(t) - SUB, 0)\n ans = max(ans, sum(int(c) for c in str(t)))\n print(t)\nprint(ans)",...
['Wrong Answer', 'Accepted']
['s668742841', 's035619003']
[3064.0, 3064.0]
[17.0, 17.0]
[303, 290]
p03427
u457901067
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N = input()\n\nwork = 9\nfor i in range(len(N)):\n if N[i] != "9":\n work = int(N[i])\n break\n \nprint(work + 9 * (len(N)-1))', 'N = input()\n\nans = 0\nall_nine_flg = True\n\nfor i in range(1,len(N)):\n if N[i] == "9":\n continue\n else:\n all_nine_flg = False\n break\n\nsub = 0 if all_nine_flg...
['Wrong Answer', 'Accepted']
['s094354758', 's587358360']
[2940.0, 2940.0]
[17.0, 17.0]
[128, 212]
p03427
u462329577
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['s = input()\nif len(s) == 1: print(int(s[0])\nelif s[1:] == "9"*(len(s)-1): print(int(s[0]+9*len(s)-9)\nelse: print(int(s[0]+9*len(s)-10) ', 's = input()\nif len(s) == 1: print(int(s[0]))\nelif s[1:] == "9"*(len(s)-1):\n print(int(s[0])+9*len(s)-9)\nelse: \n print(int(s[0])+9*len(...
['Runtime Error', 'Accepted']
['s751209803', 's819475787']
[2940.0, 2940.0]
[17.0, 18.0]
[170, 179]
p03427
u463655976
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N = list(input())\nN = [str(int(N[0]) - 1)] + [9] * (len(N)-1)\nprint("{:.0f}".format(eval("".join(N))))', 'S = list(input())\nN = [str(int(N[0]) - 1)] + ["9"] * (len(S)-1)\nprint("{:.0f}".format(max(sum(map(int, N)), sum(map(int,S)))))', 'N = list(input())\nN = [str(int(N[0]) - 1)] + ["9"] * (len(N)-1)\nprint("{:.0f...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s128851135', 's139369286', 's231012925', 's336596034', 's806685411']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[102, 126, 104, 103, 127]
p03427
u474925961
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['x=int(input())\ny=str(x)\nn=len(y)\nprint(int(y[0])+9*n)\n', 'x=int(input())\ny=str(x)\nn=len(y)\nprint(int(n[0])+9*n)\n', 'x=int(input())\ny=str(x)\nn=len(y)\n\nif y[1:]=="9"*(n-1):\n print(int(y[0])+9*n-9)\nelse:\n print(int(y[0])-1+9*n-9)\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s244863783', 's475320817', 's365838438']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[54, 54, 117]
p03427
u482157295
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['ans = ""\na = input()\nnum_len = len(a)\nnum = [k for k in a]\nfor i in range(1,num_len):\n if num[i] != "9":\n num[i-1]= chr(ord(num[i-1])-1)\n if num[i-1] == "0":\n num[i-1] = ""\n for j in range(i,num_len):\n num[j] = "9"\n break\nfor w in num:\n ans = ans + w\nprint(ans)', 'ans = 0\na = in...
['Wrong Answer', 'Accepted']
['s754053044', 's094548675']
[3064.0, 3064.0]
[18.0, 18.0]
[285, 245]
p03427
u497883442
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['#coding:utf-8\nn = int(input())\nnum = len(str(n))\ntmp = pow(10, num)-1\ns = 0\nfor i in range(num+1):\n if i == num:\n s = sum(list(map(int, str(tmp-9*pow(10, num-1)+(int(str(n)[0])-1)*pow(10, num-1)))))\n break\n elif tmp-pow(10, i) <= n:\n s = sum(list(map(int, str(tmp-pow(10, i)))))\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s693596298', 's943995641', 's337418177']
[3064.0, 3064.0, 3064.0]
[19.0, 17.0, 17.0]
[413, 413, 413]
p03427
u504562455
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n = input()\nl = len(n)\n\nif set(list(n[1:])) == {"9"}:\n print(int(n[0])+9*(len(n)-1))\nelse:\n print(int(n[0])-1+9*(len(n)-1))n = input()\nl = len(n)\nif l == 1:\n print(n)\nelif set(list(n[1:])) == {"9"}:\n print(int(n[0])+9*(l-1))\nelse:\n print(int(n[0])-1+9*(l-1))', 'n = input()\nl = len(n)\n\ni...
['Runtime Error', 'Accepted']
['s838581334', 's675021698']
[2940.0, 2940.0]
[17.0, 19.0]
[273, 150]
p03427
u514118270
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['import bisect\nN = int(input())\nif len(str(N)) == 1:\n print(N)\n exit()\nL = len(list(str(N)))-1\nA = [10**(L)*i+10**(L)-1 for i in range(10)] \nn = bisect.bisect_left(A,N)-1\nif N in A:\n n += 1\nans = [int(list(str(A[n]))[i]) for i in range(len(list(str(A[n]))))]\nprint(sum(ans))\nprint(A)', 'import bis...
['Wrong Answer', 'Accepted']
['s474278211', 's211247066']
[3064.0, 3064.0]
[18.0, 18.0]
[292, 284]
p03427
u527993431
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N=input()\nM=len(str(N))\nK=int(N[0])\nans=0\nfor i in range (M):\n\tans+=N[i]\n\nprint(max(9*(M-1)+(K-1)),ans)', 'N=input()\nM=len(str(N))\nK=int(N[0])\nans=0\nfor i in range (M):\n\tans+=N[i]\nprint(max(9*(M-1)+(K-1),ans))', 'S=input()\nans=0\nfor i in range (len(S)):\n\tans+=int(S[i])\nprint(ans)', 'N=input()\nM=i...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s135654511', 's578814763', 's783914771', 's279612513']
[2940.0, 2940.0, 3316.0, 3064.0]
[17.0, 17.0, 19.0, 17.0]
[103, 102, 67, 242]
p03427
u550943777
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['arr=[int(i) for i in input()]\ncsum=[arr[0]]\nfor i in range(1,len(arr)):\n csum.append(csum[-1]+arr[i])\nmaxsum= csum[-1]\n\nprint(max(maxsum,arr[0]-1+9*(len(are)-1)))', 'arr=[int(i) for i in input()]\ncsum=[arr[0]]\nfor i in range(1,len(arr)):\n csum.append(csum[-1]+arr[i])\nmaxsum= csum[-1]\n\nprint(max(maxsum,a...
['Runtime Error', 'Accepted']
['s775648768', 's351256890']
[3060.0, 3060.0]
[18.0, 18.0]
[163, 163]
p03427
u559823804
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N=list(input())\ncnt=0\nsize=len(N)-1\nif size==0:\n print(N[0])\n exit()\nN.reverse()\n\nfor i in range(size):\n if N[i]!="9":\n N[i]="9"\n N[i+1]=str(int(N[i+1])-1)\nprint(cnt)\n\nfor i in range(size+1):\n cnt+=int(N[i])\nprint(cnt)\n', 'N=list(input())\ncnt=0\nsize=len(N)-1\nif size==0:\n...
['Wrong Answer', 'Accepted']
['s185493950', 's677668127']
[3060.0, 3060.0]
[18.0, 17.0]
[245, 233]
p03427
u562015767
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n = list(map(int,input()))\ncnt = 0\nans = []\n\nfor i in n:\n cnt += 1\n if i == 9:\n continue\n else:\n if cnt == len(n):\n break\n else:\n n[cnt-1] -= 1\n break\n\nfor i in range(cnt,len(n)):\n n[i] = 9\nprint(n)\n\nprint(sum(n))', 'n = list(map(int...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s150009532', 's424167658', 's942156694', 's251956829']
[3060.0, 3064.0, 3064.0, 3064.0]
[18.0, 17.0, 17.0, 17.0]
[279, 548, 453, 529]
p03427
u570612423
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['# -*- coding: utf-8 -*-\n\nimport numpy as np\n\nn = input()\n\na = np.zeros((int(len(n))))\nfor i in range(0,len(n)):\n a[i] = int(n[i])\n\nprint(int(sum(a)))', '# -*- coding: utf-8 -*-\nN = int(input())\n\ndef Sum(n):\n s = str(n)\n array = list(map(int, list(s)))\n return sum(array)\n\na=[]\n\na.append...
['Wrong Answer', 'Accepted']
['s514145211', 's505511300']
[13280.0, 3064.0]
[181.0, 17.0]
[152, 407]
p03427
u579699847
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['import bisect,collections,copy,heapq,itertools,math,numpy,string\nimport sys\ndef I(): return int(sys.stdin.readline().rstrip())\ndef LI(): return list(map(int,sys.stdin.readline().rstrip().split()))\ndef S(): return sys.stdin.readline().rstrip()\ndef LS(): return list(sys.stdin.readline().rstrip().split())\nN = I()\...
['Wrong Answer', 'Accepted']
['s963280333', 's455704282']
[72448.0, 2940.0]
[2112.0, 17.0]
[341, 174]
p03427
u623687794
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n=input()\nl=len(n)\nflag=0\nfor i in range(l-1):\n if n[-i]!=9:\n flag=1\n break\nans=int(n[0]-1)+9*(l-1)\nif flag==1:\n print(ans)\nelse:\n print(ans+1)\n ', 'n=input()\nl=len(n)\nflag=0\nfor i in range(1,l):\n if n[i]!="9":\n flag=1\n break\nans=int(n[0])-1+9*(l-1)\nif flag==1:\n print(ans)\nel...
['Runtime Error', 'Accepted']
['s452783151', 's515946380']
[2940.0, 2940.0]
[18.0, 17.0]
[157, 155]
p03427
u624923345
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['import math\n\nN = int(input())\ndigit_num = math.ceil(math.log10(N))\nmsd =int(N/(10**(digit_num-1)))\nprint(msd)\nif N%10 == 0:\n print(msd + 9*(digit_num-1))\nelse:\n print(msd + 9*(digit_num-1) - 1)\n', 'import math\n\nN = int(input())\ndigit_num = math.ceil(math.log10(N))\nmsd =int(N/(10**(digit_num-1)))\n...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s013578660', 's854031291', 's879028501', 's211012094']
[2940.0, 2940.0, 3188.0, 3060.0]
[17.0, 17.0, 18.0, 17.0]
[200, 189, 200, 220]
p03427
u626468554
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['N = list(input())\nprint(len(N)*9+N[0]-1)', 'N = list(input())\n\nflg = 0\nfor i in range(1,len(N)):\n if N[i]=="9":\n continue\n else:\n flg = 1\n break\n\nif flg:\n print((len(N)-1)*9+int(N[0])-1)\nelse:\n print((len(N)-1)*9+int(N[0]))']
['Runtime Error', 'Accepted']
['s841316111', 's807348912']
[2940.0, 3188.0]
[17.0, 20.0]
[40, 212]
p03427
u629350026
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n=int(input())\nt=list(str(n))\nif n%10**len(t)==0:\n print(9*(len(t)-1))\nelif n%10**(len(t)-1)==0:\n print(int(t[0])+9*(len(t)-1))\nelse:\n print(int(t[0])-1+9*(len(t)-1))', 'n=int(input())\nt=list(str(n))\nif n%10**len(t)==0:\n print(9*(len(t)-1))\nelif: n%10**(len(t)-1)==0:\n print(t[0]+9*(len(t)-2))\nelse:\...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s455302527', 's688789162', 's453348259']
[3064.0, 2940.0, 3060.0]
[18.0, 17.0, 17.0]
[169, 160, 174]
p03427
u631277801
2,000
262,144
Find the maximum possible sum of the digits (in base 10) of a positive integer not greater than N.
['n = int(input())\n\ncand = 0\n\ndef digit_sum(num:int, base:int) -> int:\n if num < base:\n return num\n else:\n return digit_sum(int(num/base), base) + (num % base)\n\ndef judge(n: int) -> int:\n if n < 10:\n return n\n \n else:\n \n if str(n)[0:1] == \'1\':\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s140929168', 's948311106', 's261096890']
[3064.0, 3064.0, 3064.0]
[17.0, 18.0, 17.0]
[982, 911, 858]