結果

問題 No.3086 愛国心(2)
ユーザー maimai
提出日時 2021-03-13 17:53:00
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 26,902 bytes
コンパイル時間 901 ms
コンパイル使用メモリ 29,696 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-04-23 08:32:13
合計ジャッジ時間 1,809 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 3 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

const unsigned char dat[] = {85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,79,74,84,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,76,59,32,17,46,68,81,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,84,85,85,84,72,52,25,2,15,22,4,5,38,61,78,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,81,66,44,16,4,18,26,24,23,26,24,9,4,28,54,73,84,85,85,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,78,61,35,5,7,21,25,24,22,22,22,22,23,25,24,17,4,18,46,68,81,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,84,73,54,26,3,14,23,25,24,22,22,22,22,22,22,22,22,23,24,25,21,5,4,37,62,78,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,82,68,47,18,3,18,25,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,24,11,3,29,54,73,84,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,79,62,38,8,4,21,26,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,25,25,16,3,19,46,68,82,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,85,85,84,85,85,85,85,85,85,84,85,85,85,85,85,84,85,85,85,85,85,84,84,85,85,85,75,56,30,4,11,22,25,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,25,20,6,7,37,61,78,85,85,85,84,84,85,85,85,85,85,84,85,84,85,85,85,85,84,85,84,85,85,84,84,85,85,85,85,85,85,85,85,85,85,84,85,85,85,84,85,85,85,85,85,85,84,85,85,85,85,85,84,85,85,85,84,84,85,85,82,70,49,20,3,17,24,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,25,23,13,3,27,55,73,84,85,85,84,84,85,85,85,84,85,84,85,85,85,85,84,85,84,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,80,64,41,9,4,21,25,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,25,18,3,18,47,68,81,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,76,58,33,4,7,23,26,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,26,21,4,7,37,61,78,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,85,85,83,72,51,24,4,14,24,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,26,23,11,4,28,54,74,84,85,85,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,85,85,81,67,44,12,4,19,24,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,24,18,4,16,46,68,81,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,77,60,36,4,5,23,25,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,25,22,4,5,38,61,78,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,84,73,53,27,3,11,24,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,26,24,9,3,29,54,73,84,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,82,68,46,18,4,17,25,25,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,24,16,4,18,46,68,81,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,79,64,38,5,6,21,25,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,25,21,6,5,37,63,79,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,62,17,0,12,26,26,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,26,26,14,0,10,59,83,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,77,64,44,15,4,19,24,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,24,20,5,14,42,62,76,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,82,71,50,23,4,14,24,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,24,14,4,22,49,70,82,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,78,81,85,85,85,84,75,57,32,4,7,23,26,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,26,23,7,4,32,57,75,84,85,85,85,80,79,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,58,34,65,79,85,85,85,85,79,64,41,8,4,21,25,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,25,20,4,9,41,64,79,85,85,85,85,78,62,31,64,85,84,85,85,85,85,85,85,85,85,85,85,85,85,84,85,59,0,6,32,56,75,84,85,85,85,82,70,50,21,3,17,24,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,24,16,3,22,50,70,82,85,85,85,84,73,54,29,4,0,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,8,26,15,4,22,49,70,82,85,85,85,84,75,57,31,4,9,22,26,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,26,21,8,4,32,58,75,84,85,85,85,81,68,46,19,4,16,26,9,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,84,85,59,3,25,25,24,20,5,8,40,63,78,85,85,85,85,79,63,40,9,4,20,26,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,26,19,4,13,42,64,79,85,85,85,85,77,61,37,5,6,21,25,25,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,22,22,24,25,23,9,3,30,56,74,84,85,85,85,82,69,48,20,3,17,25,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,25,15,2,24,50,70,82,85,85,85,83,73,54,28,3,12,24,25,23,22,22,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,23,25,25,16,3,21,48,68,81,85,85,85,84,74,56,29,3,12,23,25,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,25,22,8,4,33,58,75,84,85,85,85,81,67,46,18,3,17,26,25,23,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,84,85,85,85,85,59,4,24,23,22,22,22,22,22,22,25,26,19,4,9,38,62,78,85,85,85,85,78,63,38,8,5,20,25,25,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,25,25,18,4,13,42,65,79,85,85,85,85,77,61,36,7,5,20,26,24,22,22,22,22,22,22,23,24,4,64,85,84,85,85,85,85,85,85,85,85,85,84,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,24,25,22,12,4,29,55,73,83,85,85,85,81,68,47,20,3,16,25,25,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,25,13,3,25,51,71,82,85,85,85,83,72,53,26,4,13,23,25,24,22,22,22,22,22,22,22,22,23,24,4,64,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,23,24,24,18,3,18,47,68,81,85,85,85,84,73,55,29,3,11,24,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,25,23,6,4,34,58,76,85,85,85,85,80,67,45,15,3,19,25,24,23,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,24,26,21,4,6,37,61,77,85,85,85,85,78,62,37,4,5,21,25,24,23,22,22,22,22,22,22,22,22,22,23,24,24,19,4,11,43,65,79,85,85,85,85,76,60,36,5,4,22,26,24,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,26,23,10,4,28,53,72,83,85,85,85,81,68,46,18,4,17,24,25,23,22,22,22,22,22,23,25,23,14,4,24,51,71,82,85,85,85,83,72,52,26,4,11,23,26,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,24,18,4,16,45,67,80,85,85,85,83,73,53,28,4,10,24,26,23,22,24,26,22,5,5,34,59,76,85,85,85,85,80,66,44,14,4,18,24,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,84,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,25,22,5,4,36,60,76,85,85,85,85,77,60,37,4,5,22,26,19,3,15,44,65,80,85,85,85,85,76,59,35,4,6,22,25,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,64,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,23,24,23,22,22,22,22,22,22,22,22,22,22,22,23,25,24,12,3,27,52,72,83,85,85,85,80,67,45,15,2,25,52,71,83,85,85,85,83,71,52,26,3,13,25,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,84,85,59,4,24,23,22,22,22,22,22,22,22,23,20,11,22,25,23,22,22,22,22,22,22,22,22,22,22,22,22,25,25,17,4,16,44,66,80,85,85,85,83,71,62,76,85,85,85,85,80,65,43,15,4,18,25,25,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,23,18,32,40,10,4,22,26,23,22,22,22,22,22,22,22,22,22,22,22,22,24,25,21,8,4,34,59,76,85,85,85,85,85,85,85,76,59,34,4,8,21,25,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,25,4,45,81,69,44,12,4,22,25,23,22,22,22,22,22,22,22,22,22,22,22,22,24,25,24,14,3,25,51,72,84,85,84,72,51,24,2,15,24,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,26,5,45,85,85,83,71,48,15,4,21,25,24,22,22,22,22,22,22,22,22,22,22,22,22,23,24,25,21,0,32,81,85,81,32,0,22,25,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,26,4,47,84,85,85,85,84,73,51,21,4,18,25,25,22,22,22,22,22,22,22,22,22,22,22,22,22,26,19,35,80,85,81,36,19,26,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,26,4,47,84,85,84,84,85,85,85,75,54,26,3,15,25,25,22,22,22,22,22,22,22,22,22,22,22,24,13,36,81,85,81,36,12,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,26,3,49,85,85,84,84,84,84,85,85,85,77,57,30,3,14,25,24,22,22,22,22,22,22,22,22,22,24,14,35,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,24,15,36,73,85,85,85,84,84,84,84,85,85,85,78,61,33,3,16,23,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,23,18,19,48,71,84,85,85,84,84,85,84,85,85,85,80,64,35,19,23,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,84,85,59,4,24,23,22,22,22,22,22,22,22,22,23,20,5,13,45,69,83,85,85,84,84,85,84,85,85,85,63,4,24,23,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,24,25,22,6,5,42,67,81,85,85,84,84,85,84,85,64,4,24,23,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,23,25,24,7,4,38,63,80,85,85,85,84,85,62,4,24,23,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,25,24,9,4,34,60,79,85,85,85,62,4,24,23,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,84,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,24,14,4,30,58,76,85,63,3,24,23,22,22,22,22,22,22,24,14,36,81,85,80,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,64,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,24,17,3,23,58,51,13,23,23,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,25,18,3,17,23,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,25,23,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,84,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,22,22,22,22,22,22,22,22,22,24,14,36,81,85,80,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,64,85,84,85,85,85,85,85,85,85,85,85,84,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,80,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,64,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,59,4,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,4,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,84,85,60,4,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,6,65,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,58,3,27,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,27,3,63,85,84,85,85,85,85,85,85,85,85,85,85,85,85,84,85,63,0,5,23,26,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,26,22,4,3,68,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,83,70,46,12,4,22,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,25,21,3,17,49,72,84,85,85,85,85,85,85,85,85,85,85,85,84,85,85,85,84,85,85,84,72,49,16,4,20,25,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,80,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,25,20,4,19,51,73,85,85,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,73,50,20,4,18,25,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,25,17,4,23,53,75,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,84,85,85,85,84,85,85,84,84,85,85,85,74,53,24,3,18,26,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,80,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,26,16,3,27,55,76,85,85,85,84,84,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,85,85,76,56,26,2,17,25,24,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,24,25,16,2,29,57,77,85,85,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,85,85,84,85,85,85,85,85,85,84,84,85,85,85,77,57,28,3,16,24,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,80,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,24,15,3,31,59,78,85,85,85,84,85,84,85,84,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,85,85,78,60,31,4,13,24,25,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,24,12,4,34,61,79,85,85,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,79,61,35,4,9,25,25,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,25,24,8,4,37,63,80,85,85,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,80,64,37,4,8,24,25,23,22,22,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,22,22,23,25,24,7,4,39,65,81,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,81,66,40,4,8,23,25,23,22,22,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,22,22,24,25,22,7,5,42,67,82,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,82,68,42,9,6,21,25,23,22,22,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,22,22,24,25,21,5,11,44,69,83,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,83,69,45,13,4,22,26,23,22,22,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,22,22,23,26,21,4,15,46,70,84,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,84,71,48,16,3,21,25,23,22,22,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,22,22,23,25,21,3,17,49,71,84,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,84,72,50,18,4,20,25,24,22,22,22,24,14,36,81,85,81,36,13,24,22,22,22,24,25,20,4,19,51,73,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,74,52,22,4,18,25,24,22,24,14,36,81,85,81,36,13,24,22,25,25,18,4,23,53,75,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,75,54,26,3,17,25,26,13,35,81,85,81,36,13,26,25,16,3,26,55,76,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,84,85,85,85,76,57,28,2,19,18,37,81,85,81,37,18,19,2,29,57,77,85,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,85,85,78,59,32,0,32,81,85,81,33,0,32,60,78,85,85,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,85,85,84,85,85,85,85,85,85,84,85,85,85,85,85,84,85,85,85,85,85,85,84,84,85,85,85,84,85,85,85,84,84,85,85,85,85,84,85,85,85,79,59,43,80,85,80,44,59,80,85,85,84,84,85,85,85,85,85,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,84,85,85,85,85,84,85,84,85,85,84,84,85,85,85,85,85,85,85,85,85,85,84,85,85,85,84,85,85,85,85,85,85,84,85,85,85,85,85,84,85,85,85,85,85,85,84,84,85,85,85,84,85,85,85,84,84,85,85,84,85,85,85,84,84,85,85,80,83,85,83,81,85,85,85,84,84,85,85,85,85,85,85,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,84,85,85,85,85,84,85,84,85,85,84,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,85,85,85,85,85,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,85,85,84,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85};
const int W = 101;
int main() {
  int N, y, x, v;
  scanf("%d", &N);
  while(N--) {
    scanf("%d%d", &y, &x);
    v = dat[y*W + x];
    printf("%d\n", v*9);
  }
  return 0;
}
0