Record Case Detail

Notes

This function is in beta test. Please help improve it in the issues here.

Stderr


        

Hints

Your answer may be identical to the JOJ answer in the first several lines.

However, the main problem you meet now is Time Exceeded. And the exit code of your program is -9, which should be 0.

Please double check your code to solve this problem and try again.

Your Answer

-117
939
-23
-177
942
-121
-46
931
1002
994
982
-9
1033
1106
-88
965
-80
1107
-142
-209
-143
-31
-33
991
-81
-214
-19
1199
-19
842
1006
990
1358
904
-16
-54
956
987
-49
944
1073
-93
926
1045
-18
-129
-56
-45
-102
1009
-58
-95
-11
968
2061
1184
1147
-42
-140
825
988
1131
975
-92
-66
1249
985
1022
-13
1012
-38
1039
912
1208
-104
944
988
-57
982
901
-19
-100
-70
983
-73
-10
-57
1223
832
905
991
-54
936
896
-16
935
1087
-129
913
-43
-81
916
-18
897
1272
1181
-13
-28
-160
1003
986
932
924
-65
997
1542
1109
-45
895
983
-27
-53
954
983
-66
1034
-22
-71
-60
-38
903
1001
1021
1013
-136
-38
-99
-78
-89
-153
973
-78
-64
1392
-102
1109
1196
1044
1101
-18
908
-95
-19
961
964
926
-97
1166
-128
1012
1026
-65
-112
915
-170
949
-215
941
993
-139
852
-88
958
1246
904
-96
936
940
-85
-198
-78
935
-164
1092
-103
949
1150
1162
-128
971
-31
996
910
1039
-65
842
1019
1151
1004
-114
1011
-76
960
986
977
-91
-43
862
-12
806
-78
856
969
1096
1024
997
920
1019
-79
958
1759
930
1071
-49
-37
982
995
-43
2038
-120
1001
-161
1035
-72
854
1

JOJ Answer

-117
784
-23
-177
798
-121
-46
749
811
824
833
-9
772
1094
-88
839
-80
863
-142
-209
-143
-31
-33
875
-81
-214
-19
843
-19
842
779
925
1358
904
-16
-54
765
803
-49
839
1073
-93
847
956
-18
-129
-56
-45
-102
852
-58
-95
-11
928
2009
913
927
-42
-140
825
934
897
763
-92
-66
858
750
966
-13
818
-38
801
912
896
-104
821
807
-57
750
843
-19
-100
-70
848
-73
-10
-57
796
813
761
871
-54
800
801
-16
783
925
-129
821
-43
-81
916
-18
897
1024
919
-13
-28
-160
1003
986
756
808
-65
898
1542
959
-45
750
946
-27
-53
840
884
-66
889
-22
-71
-60
-38
852
837
912
833
-136
-38
-99
-78
-89
-153
972
-78
-64
923
-102
814
837
776
895
-18
763
-95
-19
886
766
773
-97
993
-128
804
794
-65
-112
836
-170
803
-215
811
950
-139
776
-88
798
1246
804
-96
788
795
-85
-198
-78
823
-164
1092
-103
805
984
989
-128
749
-31
756
782
864
-65
750
910
909
859
-114
1011
-76
796
936
923
-91
-43
862
-12
806
-78
780
969
837
824
786
916
924
-79
769
1170
856
1071
-49
-37
873
827
-43
1942
-120
932
-161
980
-72
854
796
-172
-14
852
-83
1476
-100
831
922
-25