text stringlengths 0 234 |
|---|
declare |
use Chunks_Vectors; |
Str : constant String := Get_Line (File); |
Row : Vector := Empty_Vector; |
begin |
for Char of Str loop |
Row.Append (Char); |
end loop; |
Values.Append (Row); |
Function Definition: procedure Main is |
Function Body: use Ada.Execution_Time, |
Ada.Real_Time, |
Ada.Text_IO; |
use Utils; |
package Natural_Vectors is new Ada.Containers.Vectors (Natural, Natural); |
use Natural_Vectors; |
File : File_Type; |
Start_Time, End_Time : CPU_Time; |
Execution_Duration : Time_Span; |
Crabs : Vector; |
Min_Dist : Natural := Natural'Last; |
begin |
Get_File (File); |
if End_Of_File (File) then |
raise Program_Error with "Empty file"; |
end if; |
-- Get all Lanternfishes |
while not End_Of_File (File) loop |
declare |
use Ada.Integer_Text_IO; |
Line : constant String := Get_Line (File); |
First : Positive := Line'First; |
Last : Positive := Line'First; |
Last_Index : Positive := Line'First; |
Value : Natural; |
begin |
while Last <= Line'Last loop |
if Line (Last) not in '0' .. '9' then |
if Line (First .. Last - 1) /= "" then |
Get (Line (First .. Last - 1), Value, Last_Index); |
Crabs.Append (Value); |
end if; |
First := Last + 1; |
Last := First; |
elsif Last = Line'Last then |
Get (Line (First .. Line'Last), Value, Last_Index); |
Crabs.Append (Value); |
Last := Last + 1; |
else |
Last := Last + 1; |
end if; |
end loop; |
Function Definition: procedure Main is |
Function Body: use Ada.Execution_Time, |
Ada.Real_Time, |
Ada.Text_IO; |
use Utils; |
package Natural_Vectors is new Ada.Containers.Vectors (Natural, Natural); |
use Natural_Vectors; |
File : File_Type; |
Start_Time, End_Time : CPU_Time; |
Execution_Duration : Time_Span; |
Crabs : Vector; |
Min_Dist, Min : Natural := Natural'Last; |
Max : Natural := Natural'First; |
begin |
Get_File (File); |
if End_Of_File (File) then |
raise Program_Error with "Empty file"; |
end if; |
-- Get all Lanternfishes |
while not End_Of_File (File) loop |
declare |
use Ada.Integer_Text_IO; |
Line : constant String := Get_Line (File); |
First : Positive := Line'First; |
Last : Positive := Line'First; |
Last_Index : Positive := Line'First; |
Value : Natural; |
begin |
while Last <= Line'Last loop |
if Line (Last) not in '0' .. '9' then |
if Line (First .. Last - 1) /= "" then |
Get (Line (First .. Last - 1), Value, Last_Index); |
Crabs.Append (Value); |
if Value < Min then |
Min := Value; |
end if; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.